Continue menu
This commit is contained in:
parent
c017297e06
commit
6e8badf4b1
4 changed files with 53 additions and 54 deletions
27
TODO.txt
27
TODO.txt
|
@ -1,5 +1,8 @@
|
|||
=========== GENERAL ==============
|
||||
|
||||
- add argc/argv to gameInit? could be used to quickly start maps, verify
|
||||
replays etc.
|
||||
- player name (modifyable via resource file)
|
||||
- popup messages? would be useful for several things: showing checkpoint times,
|
||||
showing changes in menu etc.
|
||||
- prevent time overflow! stop incrementing level frame once it's at maximum
|
||||
|
@ -27,20 +30,8 @@
|
|||
- make the racing module usable by itself, e.g. to allow making tools for
|
||||
verifying replays etc., i.e. make the module measure time, count checkpoints
|
||||
etc.
|
||||
- racing update step should return events that happened, e.g.:
|
||||
- CP taken
|
||||
- crash (to play sound)
|
||||
- finish
|
||||
- etc.
|
||||
- car shadow?
|
||||
- sound engine: probably all SFX will be procedurally generated, ok?
|
||||
- allow slowing down in air like in TM?
|
||||
- music?
|
||||
- probably just make one long track, literally OGG or something, then make
|
||||
that be played by the frontend just ALL the time (maybe with the option in
|
||||
menu to just turn music off) -- simple frontends can just ignore music
|
||||
- allow car to be flipped upside down on start? with start block transform
|
||||
- camera behavior? what if car is riding upside down (on magnet) etc?
|
||||
- compile time option to choose how many maps to include (for platforms with
|
||||
lower memory)
|
||||
- Environments: just different textures for a cube inside which the tarck is,
|
||||
|
@ -62,6 +53,11 @@
|
|||
=========== HANDLED ==============
|
||||
|
||||
- allow stopping car rotation in air like in Trackmania
|
||||
- music?
|
||||
- probably just make one long track, literally OGG or something, then make
|
||||
that be played by the frontend just ALL the time (maybe with the option in
|
||||
menu to just turn music off) -- simple frontends can just ignore music
|
||||
- sound engine: probably all SFX will be procedurally generated, ok?
|
||||
- make a simple rendering setting:
|
||||
- will exclude images and only draw solid colors, let's say only 16, so that
|
||||
memory usage is reduced, CPU rendering is relieved, executable is smaller
|
||||
|
@ -70,6 +66,11 @@
|
|||
steering friction until reaching some some lower threshold again probably
|
||||
- maybe allow some more air control, like slowing down with brakes, like in TM
|
||||
- map actually in ASCII format? how will humans edit it?
|
||||
- racing update step should return events that happened, e.g.:
|
||||
- CP taken
|
||||
- crash (to play sound)
|
||||
- finish
|
||||
- etc.
|
||||
- rework the code for special blocks, we have to literally remember the last
|
||||
block, not the pointer, now it won't work e.g. if wanting to repeat an
|
||||
empty block
|
||||
|
@ -97,6 +98,8 @@
|
|||
to pixels where depth buffer was not overwritten (this step can be left out
|
||||
in case we have depth buffer or sky turned off)
|
||||
- maybe change sticker to fan? could me more fun: TEST and see
|
||||
- camera behavior? what if car is riding upside down (on magnet) etc? <- looks cool now
|
||||
- allow car to be flipped upside down on start? with start block transform
|
||||
- track size: 64x64x64
|
||||
- sky images could be just composed of 4x4 normal images? then we only need
|
||||
one type of image
|
||||
|
|
4
assets.h
4
assets.h
|
@ -29,7 +29,9 @@ static const char *LCR_texts[] =
|
|||
"music",
|
||||
"sound",
|
||||
"save repl",
|
||||
"exit"
|
||||
"exit",
|
||||
|
||||
"loading"
|
||||
};
|
||||
|
||||
static const char *LCR_internalResourceFile =
|
||||
|
|
2
audio.h
2
audio.h
|
@ -104,7 +104,7 @@ uint8_t LCR_audioGetNextSample(void)
|
|||
|
||||
if (LCR_audio.soundPlayed != LCR_SOUND_NONE)
|
||||
LCR_audio.soundPlayedFrame++;
|
||||
else
|
||||
else if (LCR_audio.engineIntensity)
|
||||
{
|
||||
LCR_audio.engineOsc +=
|
||||
LCR_audio.engineInc ?
|
||||
|
|
74
game.h
74
game.h
|
@ -173,6 +173,7 @@ uint8_t LCR_gameGetNextAudioSample(void);
|
|||
#define LCR_GAME_STATE_RUN_STARTING 0x01
|
||||
#define LCR_GAME_STATE_RUN 0x02
|
||||
#define LCR_GAME_STATE_RUN_FINISHED 0x03
|
||||
#define LCR_GAME_STATE_LOADING_MAP 0x04
|
||||
#define LCR_GAME_STATE_END 0xff
|
||||
|
||||
// TODO: move to consts?
|
||||
|
@ -384,8 +385,7 @@ void LCR_gameStartRun(unsigned int mapIndex)
|
|||
{
|
||||
LCR_seekResourceByIndex(mapIndex,'M');
|
||||
LCR_mapLoadFromStr(LCR_gameGetNextResourceStrChar);
|
||||
LCR_rendererLoadMap();
|
||||
LCR_gameResetRun();
|
||||
LCR_gameSetState(LCR_GAME_STATE_LOADING_MAP);
|
||||
}
|
||||
|
||||
void LCR_gameEraseMenuItemNames(void)
|
||||
|
@ -410,10 +410,10 @@ void LCR_gameSetMenuItemStr(uint8_t item, const char *str)
|
|||
|
||||
void LCR_gameLoadMainMenuItems(void)
|
||||
{
|
||||
for (int i = 0; i < 5; ++i)
|
||||
LCR_gameSetMenuItemStr(i,LCR_texts[4 + i]);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
LCR_gameSetMenuItemStr(i,LCR_texts[4 + i]);
|
||||
|
||||
LCR_game.menuItemCount = 5;
|
||||
LCR_game.menuItemCount = 4;
|
||||
}
|
||||
|
||||
void LCR_gameInit(void)
|
||||
|
@ -449,8 +449,6 @@ void LCR_gameInit(void)
|
|||
LCR_currentMap.blockCount = 0; // means no map loaded
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Loads up to LCR_RESOURCE_ITEM_CHUNK items of given type, starting at given
|
||||
index (among items of the same type). This will also load the menu item
|
||||
|
@ -458,10 +456,10 @@ void LCR_gameInit(void)
|
|||
*/
|
||||
void LCR_gameLoadResourceFileChunk(unsigned int startIndex, char magicNumber)
|
||||
{
|
||||
char c;
|
||||
unsigned char state = 0;
|
||||
char c;
|
||||
unsigned char state = 0;
|
||||
|
||||
LCR_gameEraseMenuItemNames();
|
||||
LCR_gameEraseMenuItemNames();
|
||||
|
||||
LCR_game.resourceFile.firstItemIndex = startIndex;
|
||||
LCR_game.resourceFile.itemsTotal = 0;
|
||||
|
@ -527,9 +525,6 @@ void LCR_gameEnd(void)
|
|||
LCR_LOG0("ending");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void LCR_gameDraw3DView(void)
|
||||
{
|
||||
LCR_GameUnit carTransform[6];
|
||||
|
@ -746,6 +741,12 @@ uint8_t LCR_gameStep(uint32_t time)
|
|||
LCR_game.keyStates[i] = LCR_keyPressed(i) ?
|
||||
(LCR_game.keyStates[i] < 255 ? LCR_game.keyStates[i] + 1 : 255) : 0;
|
||||
|
||||
if (LCR_game.state == LCR_GAME_STATE_LOADING_MAP)
|
||||
{
|
||||
LCR_rendererLoadMap();
|
||||
LCR_gameResetRun();
|
||||
}
|
||||
|
||||
LCR_gameHandleInput();
|
||||
|
||||
LCR_GameUnit offsets[5];
|
||||
|
@ -824,7 +825,8 @@ uint8_t LCR_gameStep(uint32_t time)
|
|||
}
|
||||
|
||||
int engineIntensity = LCR_carSpeedKMH() * 2;
|
||||
LCR_audioSetEngineIntensity(engineIntensity < 256 ? engineIntensity : 255);
|
||||
LCR_audioSetEngineIntensity(paused ? 0 :
|
||||
(engineIntensity < 256 ? engineIntensity : 255));
|
||||
|
||||
LCR_game.nextRacingTickTime += LCR_RACING_TICK_MS;
|
||||
}
|
||||
|
@ -839,35 +841,11 @@ uint8_t LCR_gameStep(uint32_t time)
|
|||
while (time >= LCR_game.nextRenderFrameTime)
|
||||
LCR_game.nextRenderFrameTime += 1000 / LCR_SETTING_FPS;
|
||||
|
||||
if (LCR_game.state == LCR_GAME_STATE_MENU)
|
||||
{
|
||||
|
||||
/*
|
||||
const char *items[LCR_MENU_MAX_ITEMS];
|
||||
uint8_t itemCount = 1;
|
||||
|
||||
items[0] = LCR_texts[LCR_game.menuSelectedTab];
|
||||
|
||||
if (LCR_game.menuSelectedTab == 0)
|
||||
{
|
||||
for (int i = 0; i < 5; ++i)
|
||||
items[1 + i] = LCR_texts[4 + i];
|
||||
|
||||
itemCount = 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < LCR_game.resourceFile.loadedItemCount; ++i)
|
||||
items[i + 1] = LCR_game.menuItemNames + i * LCR_MENU_STRING_SIZE;
|
||||
|
||||
itemCount = LCR_game.resourceFile.loadedItemCount + 1;
|
||||
}
|
||||
*/
|
||||
|
||||
if (LCR_game.state == LCR_GAME_STATE_MENU ||
|
||||
LCR_game.state == LCR_GAME_STATE_LOADING_MAP)
|
||||
LCR_rendererDrawMenu(LCR_texts[LCR_game.menuSelectedTab],
|
||||
LCR_game.menuItemNamePointers,LCR_game.menuItemCount + 1,
|
||||
LCR_game.menuSelectedItem);
|
||||
}
|
||||
else
|
||||
LCR_gameDraw3DView();
|
||||
}
|
||||
|
@ -877,6 +855,22 @@ else
|
|||
sleep = tmp < sleep ? tmp : sleep;
|
||||
}
|
||||
|
||||
if (LCR_game.state == LCR_GAME_STATE_LOADING_MAP)
|
||||
{
|
||||
LCR_rendererDrawRect(
|
||||
LCR_EFFECTIVE_RESOLUTION_X / 8,
|
||||
LCR_EFFECTIVE_RESOLUTION_Y / 8,
|
||||
LCR_EFFECTIVE_RESOLUTION_X - LCR_EFFECTIVE_RESOLUTION_X / 4,
|
||||
LCR_EFFECTIVE_RESOLUTION_Y - LCR_EFFECTIVE_RESOLUTION_Y / 4,
|
||||
0xffff,0);
|
||||
|
||||
LCR_rendererDrawText(LCR_texts[9],
|
||||
(LCR_EFFECTIVE_RESOLUTION_X -
|
||||
LCR_rendererComputeTextWidth(LCR_texts[9],4)) / 2,
|
||||
(LCR_EFFECTIVE_RESOLUTION_Y -
|
||||
LCR_rendererComputeTextHeight(4)) / 2,0x0000,4);
|
||||
}
|
||||
|
||||
if (sleep)
|
||||
LCR_sleep(sleep);
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue