Skip to content

Commit

Permalink
Clang
Browse files Browse the repository at this point in the history
  • Loading branch information
stxticOVFL committed Oct 22, 2021
1 parent 6dc4d21 commit 0966aa2
Show file tree
Hide file tree
Showing 29 changed files with 446 additions and 470 deletions.
10 changes: 5 additions & 5 deletions RSDKv3/Animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void LoadAnimationFile(const char *filePath)
byte sheetCount = 0;
FileRead(&sheetCount, 1); // Sheet Count

//Read & load each spritesheet
// Read & load each spritesheet
for (int s = 0; s < sheetCount; ++s) {
FileRead(&fileBuffer, 1);
if (fileBuffer) {
Expand All @@ -45,7 +45,7 @@ void LoadAnimationFile(const char *filePath)
animFile->animCount = animCount;
animFile->aniListOffset = animationCount;

//Read animations
// Read animations
for (int a = 0; a < animCount; ++a) {
SpriteAnimation *anim = &animationList[animationCount++];
anim->frameListOffset = animFrameCount;
Expand Down Expand Up @@ -82,7 +82,7 @@ void LoadAnimationFile(const char *filePath)
anim->frameCount >>= 1;
}

//Read Hitboxes
// Read Hitboxes
animFile->hitboxListOffset = hitboxCount;
FileRead(&fileBuffer, 1);
for (int i = 0; i < fileBuffer; ++i) {
Expand Down Expand Up @@ -119,7 +119,7 @@ AnimationFile *AddAnimationFile(const char *filePath)
StrCopy(path, "Data/Animations/");
StrAdd(path, filePath);

//If matching anim is found return that, otherwise load a new anim
// If matching anim is found return that, otherwise load a new anim
for (int a = 0; a < 0x100; ++a) {
if (StrLength(animationFileList[a].fileName) <= 0) {
StrCopy(animationFileList[a].fileName, filePath);
Expand All @@ -137,7 +137,7 @@ void ProcessObjectAnimation(void *objScr, void *ent)
{
ObjectScript *objectScript = (ObjectScript *)objScr;
Entity *entity = (Entity *)ent;
SpriteAnimation *sprAnim = &animationList[objectScript->animFile->aniListOffset + entity->animation];
SpriteAnimation *sprAnim = &animationList[objectScript->animFile->aniListOffset + entity->animation];

if (entity->animationSpeed <= 0) {
entity->animationTimer += sprAnim->speed;
Expand Down
9 changes: 4 additions & 5 deletions RSDKv3/Animation.hpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
#ifndef ANIMATION_H
#define ANIMATION_H

#define ANIFILE_COUNT (0x100)
#define ANIMATION_COUNT (0x400)
#define ANIFILE_COUNT (0x100)
#define ANIMATION_COUNT (0x400)
#define SPRITEFRAME_COUNT (0x1000)

#define HITBOX_COUNT (0x20)
#define HITBOX_COUNT (0x20)
#define HITBOX_DIR_COUNT (0x8)

enum AnimrotationFlags { ROTFLAG_NONE, ROTFLAG_FULL, ROTFLAG_45DEG, ROTFLAG_STATICFRAMES };

struct AnimationFile
{
struct AnimationFile {
char fileName[0x20];
int animCount;
int aniListOffset;
Expand Down
475 changes: 235 additions & 240 deletions RSDKv3/Collision.cpp

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions RSDKv3/Collision.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ enum CollisionSolidity {
};

enum ObjectCollisionTypes {
C_TOUCH = 0,
C_BOX = 1,
C_BOX2 = 2,
C_PLATFORM = 3,
C_TOUCH = 0,
C_BOX = 1,
C_BOX2 = 2,
C_PLATFORM = 3,
};

struct CollisionSensor
{
struct CollisionSensor {
int XPos;
int YPos;
int angle;
Expand Down
35 changes: 17 additions & 18 deletions RSDKv3/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ void initDevMenu()
for (int m = 0; m < modList.size(); ++m) scanModFolder(&modList[m]);
#endif
drawStageGFXHQ = false;
xScrollOffset = 0;
yScrollOffset = 0;
xScrollOffset = 0;
yScrollOffset = 0;
StopMusic();
StopAllSfx();
ReleaseStageSfx();
Expand Down Expand Up @@ -65,8 +65,8 @@ void initDevMenu()
void initErrorMessage()
{
drawStageGFXHQ = false;
xScrollOffset = 0;
yScrollOffset = 0;
xScrollOffset = 0;
yScrollOffset = 0;
StopMusic();
StopAllSfx();
ReleaseStageSfx();
Expand Down Expand Up @@ -106,11 +106,11 @@ void processStageSelect()
CheckKeyDown(&keyDown, 0xFF);
CheckKeyPress(&keyPress, 0xFF);

//#if defined RETRO_USING_MOUSE || defined RETRO_USING_TOUCH
//#if defined RETRO_USING_MOUSE || defined RETRO_USING_TOUCH
DrawSprite(32, 0x42, 16, 16, 78, 240, textMenuSurfaceNo);
DrawSprite(32, 0xB2, 16, 16, 95, 240, textMenuSurfaceNo);
DrawSprite(SCREEN_XSIZE - 32, SCREEN_YSIZE - 32, 16, 16, 112, 240, textMenuSurfaceNo);
//#endif
//#endif

if (!keyDown.start && !keyDown.up && !keyDown.down) {
int tFlags = touchFlags;
Expand Down Expand Up @@ -225,7 +225,7 @@ void processStageSelect()
gameMenu[0].selectionCount = 1;
gameMenu[1].timer = 0;
gameMenu[1].visibleRowOffset = 0;
stageMode = DEVMENU_MODMENU;
stageMode = DEVMENU_MODMENU;
}
#endif
else {
Expand Down Expand Up @@ -326,22 +326,22 @@ void processStageSelect()
DrawTextMenu(&gameMenu[0], SCREEN_CENTERX - 80, 72);
bool nextMenu = false;
switch (gameMenu[0].selection2) {
case 3: //Presentation
case 3: // Presentation
if (stageListCount[0] > 0)
nextMenu = true;
activeStageList = 0;
break;
case 5: //Regular
case 5: // Regular
if (stageListCount[1] > 0)
nextMenu = true;
activeStageList = 1;
break;
case 7: //Special
case 7: // Special
if (stageListCount[3] > 0)
nextMenu = true;
activeStageList = 3;
break;
case 9: //Bonus
case 9: // Bonus
if (stageListCount[2] > 0)
nextMenu = true;
activeStageList = 2;
Expand All @@ -366,19 +366,19 @@ void processStageSelect()
gameMenu[0].selectionCount = 1;
gameMenu[1].timer = 0;
gameMenu[1].visibleRowOffset = 0;
stageMode = DEVMENU_STAGESEL;
stageMode = DEVMENU_STAGESEL;
}
else if (keyPress.B) {
SetupTextMenu(&gameMenu[0], 0);
AddTextMenuEntry(&gameMenu[0], "SELECT A PLAYER");
SetupTextMenu(&gameMenu[1], 0);
LoadConfigListText(&gameMenu[1], 0);
gameMenu[0].alignment = 2;
gameMenu[1].alignment = 0;
gameMenu[0].alignment = 2;
gameMenu[1].alignment = 0;
gameMenu[1].selectionCount = 1;
gameMenu[1].visibleRowCount = 0;
gameMenu[1].selection1 = playerListPos;
stageMode = DEVMENU_PLAYERSEL;
gameMenu[1].selection1 = playerListPos;
stageMode = DEVMENU_PLAYERSEL;
}
break;
}
Expand Down Expand Up @@ -564,7 +564,7 @@ void processStageSelect()

char buffer[0x100];
if (gameMenu[1].selection1 < modList.size() && (keyPress.A || keyPress.start || keyPress.left || keyPress.right)) {
modList[gameMenu[1].selection1].active ^= 1;
modList[gameMenu[1].selection1].active ^= 1;
StrCopy(buffer, modList[gameMenu[1].selection1].name.c_str());
StrAdd(buffer, ": ");
StrAdd(buffer, (modList[gameMenu[1].selection1].active ? " Active" : "Inactive"));
Expand All @@ -576,7 +576,6 @@ void processStageSelect()
modList[preOption] = modList[option];
modList[option] = swap;


SetupTextMenu(&gameMenu[0], 0);
AddTextMenuEntry(&gameMenu[0], "MOD LIST");
SetupTextMenu(&gameMenu[1], 0);
Expand Down
4 changes: 2 additions & 2 deletions RSDKv3/Debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ inline void printLog(const char *msg, ...)
sprintf(pathBuffer, "%s/log.txt", gamePath);
__android_log_print(ANDROID_LOG_INFO, "RSDKv3", "%s", buffer);
#else
sprintf(pathBuffer, BASE_PATH"log.txt");
sprintf(pathBuffer, BASE_PATH "log.txt");
#endif
FileIO *file = fOpen(pathBuffer, "a");
if (file) {
Expand All @@ -50,4 +50,4 @@ void initDevMenu();
void initErrorMessage();
void processStageSelect();

#endif //!DEBUG_H
#endif //! DEBUG_H
21 changes: 10 additions & 11 deletions RSDKv3/Drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ short blendLookupTable[BLENDTABLE_SIZE];
short subtractLookupTable[BLENDTABLE_SIZE];
short tintLookupTable[TINTTABLE_SIZE];

int SCREEN_XSIZE = 424;
int SCREEN_CENTERX = 424 / 2;
int SCREEN_XSIZE = 424;
int SCREEN_CENTERX = 424 / 2;
int SCREEN_XSIZE_CONFIG = 424;

int touchWidth = SCREEN_XSIZE;
Expand Down Expand Up @@ -622,15 +622,15 @@ void FlipScreen()
if (dimAmount < 1.0 && stageMode != STAGEMODE_PAUSED)
DrawRectangle(0, 0, SCREEN_XSIZE, SCREEN_YSIZE, 0, 0, 0, 0xFF - (dimAmount * 0xFF));

bool fb = Engine.useFBTexture;
bool fb = Engine.useFBTexture;
Engine.useFBTexture = Engine.useFBTexture || stageMode == STAGEMODE_PAUSED;

if (Engine.gameMode == ENGINE_VIDEOWAIT)
FlipScreenVideo();
else
Engine.highResMode ? FlipScreenHRes() : Engine.useFBTexture ? FlipScreenFB() : FlipScreenNoFB();

Engine.useFBTexture = fb;
Engine.useFBTexture = fb;
}
}

Expand Down Expand Up @@ -1033,18 +1033,18 @@ void setFullScreen(bool fs)
float width = w;
#if RETRO_PLATFORM != RETRO_iOS && RETRO_PLATFORM != RETRO_ANDROID
float aspect = SCREEN_XSIZE_CONFIG / (float)SCREEN_YSIZE;
width = aspect * h;
width = aspect * h;
viewOffsetX = abs(w - width) / 2;
if (width > w) {
int gameWidth = (w / (float)h) * SCREEN_YSIZE;
SetScreenSize(gameWidth, (gameWidth + 9) & -0x10);

width = 0;
while (width <= w) {
width += SCREEN_XSIZE;
}
width -= SCREEN_XSIZE;
viewOffsetX = abs(w - width) / 2;
viewOffsetX = abs(w - width) / 2;
}
#else
viewOffsetX = 0;
Expand Down Expand Up @@ -1247,14 +1247,13 @@ void SetScreenDimensions(int width, int height, int winWidth, int winHeight)
bufferHeight = height;
bufferWidth = viewWidth = touchWidth = winWidth;
bufferHeight = viewHeight = touchHeight = winHeight;


viewAspect = 0.75f;
if (viewHeight > SCREEN_YSIZE * 2)
hq3DFloorEnabled = true;
else
hq3DFloorEnabled = false;

SetScreenSize(width, (width + 9) & -0x10);

#if RETRO_USING_OPENGL
Expand All @@ -1273,14 +1272,14 @@ void SetScreenDimensions(int width, int height, int winWidth, int winHeight)
// Setup framebuffer texture

int bufferW = 0;
int val = 0;
int val = 0;
do {
val = 1 << bufferW++;
} while (val < SCREEN_XSIZE);
bufferW--;

int bufferH = 0;
val = 0;
val = 0;
do {
val = 1 << bufferH++;
} while (val < SCREEN_YSIZE);
Expand Down
2 changes: 1 addition & 1 deletion RSDKv3/Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ void ProcessInput()

#ifdef RETRO_USING_MOUSE
if (touches <= 0) {
#endif //! RETRO_USING_SDL2
#endif //! RETRO_USING_SDL2
int mx = 0, my = 0;
SDL_GetMouseState(&mx, &my);

Expand Down
18 changes: 9 additions & 9 deletions RSDKv3/Math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ void CalculateTrigAngles()
srand((unsigned)time(NULL));

for (int i = 0; i < 0x200; ++i) {
float Val = sin(((float)i / 256.0) * M_PI);
sinM[i] = (Val * 4096.0);
Val = cos(((float)i / 256.0) * M_PI);
cosM[i] = (Val * 4096.0);
float Val = sin(((float)i / 256.0) * M_PI);
sinM[i] = (Val * 4096.0);
Val = cos(((float)i / 256.0) * M_PI);
cosM[i] = (Val * 4096.0);
}

cosM[0] = 4096;
Expand All @@ -38,9 +38,9 @@ void CalculateTrigAngles()
sinM[384] = -4096;

for (int i = 0; i < 0x200; ++i) {
float Val = sinf(((float)i / 256) * M_PI);
float Val = sinf(((float)i / 256) * M_PI);
sinVal512[i] = (signed int)(Val * 512.0);
Val = cosf(((float)i / 256) * M_PI);
Val = cosf(((float)i / 256) * M_PI);
cosVal512[i] = (signed int)(Val * 512.0);
}

Expand Down Expand Up @@ -76,12 +76,12 @@ byte ArcTanLookup(int X, int Y)

if (X >= 0)
XVal = X;
else
else
XVal = -X;

if (Y >= 0)
YVal = Y;
else
else
YVal = -Y;

if (XVal <= YVal) {
Expand All @@ -104,7 +104,7 @@ byte ArcTanLookup(int X, int Y)
}
else if (Y <= 0)
result = -atanVal256[0x100 * XVal + YVal];
else
else
result = atanVal256[0x100 * XVal + YVal];
return result;
}
3 changes: 2 additions & 1 deletion RSDKv3/Math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ extern byte atanVal256[0x100 * 0x100];
// Setup Angles
void CalculateTrigAngles();

inline int sin512(int angle) {
inline int sin512(int angle)
{
if (angle < 0)
angle = 0x200 - angle;
angle &= 0x1FFu;
Expand Down
Loading

0 comments on commit 0966aa2

Please sign in to comment.