diff --git a/TODO.txt b/TODO.txt index a394ea5..5245503 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,5 +1,6 @@ general: +- Refactor. - Rewrite python scripts to C (faster, less bloat). - Try to recolor textures and give them a bit more of variety. - automatic tests: a frontend that will play the game, check the state, rendered diff --git a/assets/level0.gif b/assets/level0.gif index eb2a6af..85091cd 100644 Binary files a/assets/level0.gif and b/assets/level0.gif differ diff --git a/assets/level5.gif b/assets/level5.gif index 13f9363..056c250 100644 Binary files a/assets/level5.gif and b/assets/level5.gif differ diff --git a/game.h b/game.h index f9460f4..9aee511 100755 --- a/game.h +++ b/game.h @@ -969,7 +969,7 @@ void SFG_pixelFunc(RCL_PixelInfo *pixel) RCL_Unit screenX = pixel->position.x * SFG_RAYCASTING_SUBSAMPLE; - for (uint8_t i = 0; i < SFG_RAYCASTING_SUBSAMPLE; ++i) + for (int_fast8_t i = 0; i < SFG_RAYCASTING_SUBSAMPLE; ++i) { SFG_setGamePixel(screenX,pixel->position.y,color); screenX++; @@ -3968,8 +3968,8 @@ void SFG_drawMap() } } - for (uint16_t k = 0; k < SFG_MAP_PIXEL_SIZE; ++k) - for (uint16_t l = 0; l < SFG_MAP_PIXEL_SIZE; ++l) + for (int_fast16_t k = 0; k < SFG_MAP_PIXEL_SIZE; ++k) + for (int_fast16_t l = 0; l < SFG_MAP_PIXEL_SIZE; ++l) SFG_setGamePixel(x + l, y + k,color); x += SFG_MAP_PIXEL_SIZE; @@ -4084,11 +4084,11 @@ uint8_t SFG_drawNumber( */ void SFG_drawIndicationBorder(uint16_t width, uint8_t color) { - for (uint16_t j = 0; j < width; ++j) + for (int_fast16_t j = 0; j < width; ++j) { uint16_t j2 = SFG_GAME_RESOLUTION_Y - 1 - j; - for (uint16_t i = 0; i < SFG_GAME_RESOLUTION_X; ++i) + for (int_fast16_t i = 0; i < SFG_GAME_RESOLUTION_X; ++i) { if ((i & 0x01) == (j & 0x01)) { @@ -4098,11 +4098,11 @@ void SFG_drawIndicationBorder(uint16_t width, uint8_t color) } } - for (uint16_t i = 0; i < width; ++i) + for (int_fast16_t i = 0; i < width; ++i) { uint16_t i2 = SFG_GAME_RESOLUTION_X - 1 - i; - for (uint16_t j = width; j < SFG_GAME_RESOLUTION_Y - width; ++j) + for (int_fast16_t j = width; j < SFG_GAME_RESOLUTION_Y - width; ++j) { if ((i & 0x01) == (j & 0x01)) { @@ -4421,7 +4421,7 @@ void SFG_draw() } else { - for (uint16_t i = 0; i < SFG_Z_BUFFER_SIZE; ++i) + for (int_fast16_t i = 0; i < SFG_Z_BUFFER_SIZE; ++i) SFG_game.zBuffer[i] = 255; int16_t weaponBobOffset = 0; @@ -4464,7 +4464,7 @@ void SFG_draw() // draw sprites: // monster sprites: - for (uint16_t i = 0; i < SFG_currentLevel.monsterRecordCount; ++i) + for (int_fast16_t i = 0; i < SFG_currentLevel.monsterRecordCount; ++i) { SFG_MonsterRecord m = SFG_currentLevel.monsterRecords[i]; @@ -4510,7 +4510,7 @@ void SFG_draw() } // item sprites: - for (uint16_t i = 0; i < SFG_currentLevel.itemRecordCount; ++i) + for (int_fast16_t i = 0; i < SFG_currentLevel.itemRecordCount; ++i) if (SFG_currentLevel.itemRecords[i] & SFG_ITEM_RECORD_ACTIVE_MASK) { RCL_Vector2D worldPosition; diff --git a/main_sdl.c b/main_sdl.c index d552f94..2c147c1 100644 --- a/main_sdl.c +++ b/main_sdl.c @@ -28,10 +28,10 @@ #define SFG_LOG(str) puts(str); // #define SFG_START_LEVEL 6 -// #define SFG_IMMORTAL 1 -// #define SFG_UNLOCK_DOOR 1 + #define SFG_IMMORTAL 1 + #define SFG_UNLOCK_DOOR 1 // #define SFG_REVEAL_MAP 1 - #define SFG_INFINITE_AMMO 1 +// #define SFG_INFINITE_AMMO 1 // #define SFG_SCREEN_RESOLUTION_X 80 // #define SFG_SCREEN_RESOLUTION_Y 64 @@ -417,7 +417,11 @@ int main(int argc, char *argv[]) audioSpec.freq = 8000; audioSpec.format = AUDIO_U16; audioSpec.channels = 1; +#ifdef __EMSCRIPTEN__ audioSpec.samples = 1024; +#else + audioSpec.samples = 256; +#endif if (SDL_OpenAudio(&audioSpec,NULL) < 0) puts("SDL: could not initialize audio");