mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2024-11-21 08:25:05 -05:00
Run cppcheck
This commit is contained in:
parent
124b47ebd8
commit
5331bf1549
2
TODO.txt
2
TODO.txt
@ -1,6 +1,7 @@
|
||||
general:
|
||||
|
||||
- Refactor.
|
||||
- Check grammar in source code.
|
||||
- Polish the emscripten version (is basically unplayable on phone, horizontal
|
||||
mode doesnt show whole screen etc).
|
||||
- Polish controls (bindings, mouse sensitivity etc.).
|
||||
@ -130,6 +131,7 @@ level ideas:
|
||||
|
||||
bugs:
|
||||
|
||||
- At the beginning "FPS cant be reached" is always displayed.
|
||||
- Even if music is off, after turning on a few samples are played (also on
|
||||
Pokitto).
|
||||
- On Pokitto/GB Meta sometimes after turn on the game starts midway loading the
|
||||
|
16
game.h
16
game.h
@ -1054,13 +1054,11 @@ void SFG_blitImage(
|
||||
if (y1 >= SFG_GAME_RESOLUTION_Y)
|
||||
y1 = SFG_GAME_RESOLUTION_Y - 1;
|
||||
|
||||
uint8_t u,v;
|
||||
|
||||
v = v0;
|
||||
uint8_t v = v0;
|
||||
|
||||
for (uint16_t y = y0; y < y1; y += scale)
|
||||
{
|
||||
u = u0;
|
||||
uint8_t u = u0;
|
||||
|
||||
for (uint16_t x = x0; x < x1; x += scale)
|
||||
{
|
||||
@ -2158,7 +2156,7 @@ void SFG_monsterPerformAI(SFG_MonsterRecord *monster)
|
||||
SFG_GET_MONSTER_AGGRESSIVITY(SFG_MONSTER_TYPE_TO_INDEX(type)))
|
||||
)
|
||||
{
|
||||
if (!notRanged && (SFG_random() % 4 != 0))
|
||||
if (SFG_random() % 4 != 0)
|
||||
{
|
||||
// attack
|
||||
|
||||
@ -2473,7 +2471,7 @@ void SFG_updateLevel()
|
||||
// update projectiles:
|
||||
|
||||
uint8_t substractFrames =
|
||||
(SFG_game.frame - SFG_currentLevel.frameStart) & 0x01 ? 1 : 0;
|
||||
((SFG_game.frame - SFG_currentLevel.frameStart) & 0x01) ? 1 : 0;
|
||||
/* ^ only substract frames to live every other frame because a maximum of
|
||||
256 frames would be too few */
|
||||
|
||||
@ -2937,7 +2935,7 @@ void SFG_drawText(
|
||||
uint16_t currentX = x;
|
||||
uint16_t currentY = y;
|
||||
|
||||
while (text[pos] != 0 && pos < maxLength) // for each character
|
||||
while (pos < maxLength && text[pos] != 0) // for each character
|
||||
{
|
||||
uint16_t character = SFG_font[SFG_charToFontIndex(text[pos])];
|
||||
|
||||
@ -3313,8 +3311,8 @@ void SFG_gameStepPlaying()
|
||||
|
||||
uint8_t onlyKnife = 1;
|
||||
|
||||
for (uint8_t i = 0; i < SFG_AMMO_TOTAL; ++i)
|
||||
if (SFG_player.ammo[i] != 0)
|
||||
for (uint8_t j = 0; j < SFG_AMMO_TOTAL; ++j)
|
||||
if (SFG_player.ammo[j] != 0)
|
||||
{
|
||||
onlyKnife = 0;
|
||||
break;
|
||||
|
@ -53,9 +53,9 @@ int8_t SFG_keyPressed(uint8_t key)
|
||||
return k(S) || k(Down) || k(Num5) || k (Num2); break;
|
||||
case SFG_KEY_LEFT: return k(Q) || k(Left) || k(Num4); break;
|
||||
case SFG_KEY_A:
|
||||
return k(J) || k(Return) || k(LShift); break;
|
||||
case SFG_KEY_B: return k(K) || k(LControl) || k(RControl)
|
||||
|| sfMouse_isButtonPressed(sfMouseLeft); break;
|
||||
return k(J) || k(Return) || k(LShift) ||
|
||||
sfMouse_isButtonPressed(sfMouseLeft); break;
|
||||
case SFG_KEY_B: return k(K) || k(LControl) || k(RControl); break;
|
||||
case SFG_KEY_C: return k(L); break;
|
||||
case SFG_KEY_JUMP: return k(Space); break;
|
||||
case SFG_KEY_STRAFE_LEFT: return k(A) || k(Num7); break;
|
||||
|
@ -208,9 +208,9 @@ int8_t SFG_keyPressed(uint8_t key)
|
||||
case SFG_KEY_RIGHT: return k(RIGHT) || k(E) || k(KP_6); break;
|
||||
case SFG_KEY_DOWN: return k(DOWN) || k(S) || k(KP_5) || k(KP_2); break;
|
||||
case SFG_KEY_LEFT: return k(LEFT) || k(Q) || k(KP_4); break;
|
||||
case SFG_KEY_A: return k(J) || k(RETURN) || k(LSHIFT); break;
|
||||
case SFG_KEY_B: return k(K) || k(LCTRL) || k(RCTRL) ||
|
||||
sdlMouseButtonState & SDL_BUTTON_LMASK; break;
|
||||
case SFG_KEY_A: return k(J) || k(RETURN) || k(LSHIFT) ||
|
||||
(sdlMouseButtonState & SDL_BUTTON_LMASK); break;
|
||||
case SFG_KEY_B: return k(K) || k(LCTRL) || k(RCTRL); break;
|
||||
case SFG_KEY_C: return k(L); break;
|
||||
case SFG_KEY_JUMP: return k(SPACE); break;
|
||||
case SFG_KEY_STRAFE_LEFT: return k(A) || k(KP_7); break;
|
||||
@ -330,7 +330,7 @@ void SFG_setMusic(uint8_t value)
|
||||
case SFG_MUSIC_TURN_ON: musicOn = 1; break;
|
||||
case SFG_MUSIC_TURN_OFF: musicOn = 0; break;
|
||||
case SFG_MUSIC_NEXT: SFG_nextMusicTrack(); break;
|
||||
defaule: break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -937,15 +937,15 @@ void RCL_castRayMultiHit(RCL_Ray ray, RCL_ArrayFunction arrayFunc,
|
||||
RCL_HitResult RCL_castRay(RCL_Ray ray, RCL_ArrayFunction arrayFunc)
|
||||
{
|
||||
RCL_HitResult result;
|
||||
uint16_t RCL_len;
|
||||
uint16_t len;
|
||||
RCL_RayConstraints c;
|
||||
|
||||
c.maxSteps = 1000;
|
||||
c.maxHits = 1;
|
||||
|
||||
RCL_castRayMultiHit(ray,arrayFunc,0,&result,&RCL_len,c);
|
||||
RCL_castRayMultiHit(ray,arrayFunc,0,&result,&len,c);
|
||||
|
||||
if (RCL_len == 0)
|
||||
if (len == 0)
|
||||
result.distance = -1;
|
||||
|
||||
return result;
|
||||
@ -1805,10 +1805,11 @@ void RCL_moveCameraWithCollision(RCL_Camera *camera, RCL_Vector2D planeOffset,
|
||||
RCL_ArrayFunction ceilingHeightFunc, int8_t computeHeight, int8_t force)
|
||||
{
|
||||
int8_t movesInPlane = planeOffset.x != 0 || planeOffset.y != 0;
|
||||
int16_t xSquareNew, ySquareNew;
|
||||
|
||||
if (movesInPlane || force)
|
||||
{
|
||||
int16_t xSquareNew, ySquareNew;
|
||||
|
||||
RCL_Vector2D corner; // BBox corner in the movement direction
|
||||
RCL_Vector2D cornerNew;
|
||||
|
||||
|
4
sounds.h
4
sounds.h
@ -82,7 +82,7 @@ uint8_t SFG_getNextMusicSample()
|
||||
case 0:
|
||||
{
|
||||
uint32_t a = ((S >> 7) | (S >> 9) | (~S << 1) | S);
|
||||
result = ((S) & 65536 ? (a & (((S2) >> 16) & 0x09)) : ~a);
|
||||
result = (((S) & 65536) ? (a & (((S2) >> 16) & 0x09)) : ~a);
|
||||
|
||||
SFG_MusicState.t2 += S;
|
||||
|
||||
@ -110,7 +110,7 @@ uint8_t SFG_getNextMusicSample()
|
||||
{
|
||||
result =
|
||||
(((((S >> ((S >> 2) % 32)) + (S >> ((S >> 7) % 32)))) & 0x3f) | (S >> 5)
|
||||
| (S >> 11)) & (S & (32768 | 8192) ? 0xf0 : 0x30);
|
||||
| (S >> 11)) & ((S & (32768 | 8192)) ? 0xf0 : 0x30);
|
||||
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user