Commit 0e85990d authored by Steven Fuller's avatar Steven Fuller

wl_play.c: Demo bug 1: compensate for demoptr being changed to unsigned

wl_main.c: Demo bug 2: force tics to DEMOTICS in demo mode

wl_menu.c, sd_*: SD_StartMusic changed to take int, not ptr

rest: cleanups and other insignifigant changes
parent a8c256ed
...@@ -21,3 +21,4 @@ ...@@ -21,3 +21,4 @@
system/processor/binary build system/processor/binary build
* Suite of utilities to edit the game data. * Suite of utilities to edit the game data.
* Resolve any endian issues * Resolve any endian issues
* Add a ViewMap?
...@@ -15,11 +15,6 @@ Sound Menu: ...@@ -15,11 +15,6 @@ Sound Menu:
- 44100 - 44100
- 22050 - 22050
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*
SD_StartMusic((MusicGroup *)audiosegs[STARTMUSIC + chunk]);
=>
SD_StartMusic(chunk);
------------------------------------------------------------------------------
* use int16_t, etc (stdint) * use int16_t, etc (stdint)
* finish serializing reads/writes, endian issues * finish serializing reads/writes, endian issues
* fix fix fix different size stuff * fix fix fix different size stuff
...@@ -33,6 +28,11 @@ probably will only support 320x200, 640x400, 960x600 ...@@ -33,6 +28,11 @@ probably will only support 320x200, 640x400, 960x600
example (is this reproducible?) example (is this reproducible?)
* getenv so that you can point an env. var to the proper dir * getenv so that you can point an env. var to the proper dir
* rewrite hw (sound, input) code, remove stuff like SD_SetSoundMode * rewrite hw (sound, input) code, remove stuff like SD_SetSoundMode
* fix the input code, everything is spread out... ideally everything should
work the same, let the input handler do it all instead
i think its safe for now to go with the scancodes as being the "universal"
key type, and for everything not scancode-based, have a function to
translate
* use static and const where appropriate * use static and const where appropriate
* menu code is a mess, always does things differently than the rest of the * menu code is a mess, always does things differently than the rest of the
code, it really needs to be cleaned up code, it really needs to be cleaned up
...@@ -40,12 +40,6 @@ code, it really needs to be cleaned up ...@@ -40,12 +40,6 @@ code, it really needs to be cleaned up
* rewrite id_ca.c: uniform memory handling system * rewrite id_ca.c: uniform memory handling system
* clean up header files, especially wl_def.h, where some declarations aren't * clean up header files, especially wl_def.h, where some declarations aren't
in the right place in the right place
* fix the input code, everything is spread out... ideally everything should
work the same, let the input handler do it all instead
i think its safe for now to go with the scancodes as being the "universal"
key type, and for everything not scancode-based, have a function to
translate
* add a ViewMap? (could be done similar to mac version)
* change the current parameter handling code to something like getopt * change the current parameter handling code to something like getopt
* remove check for debugmode? * remove check for debugmode?
* fizzlefade is hackish, stipple buf would work ok in opengl, maybe only * fizzlefade is hackish, stipple buf would work ok in opengl, maybe only
......
...@@ -53,7 +53,7 @@ extern void SD_Shutdown(); ...@@ -53,7 +53,7 @@ extern void SD_Shutdown();
extern boolean SD_PlaySound(soundnames sound); extern boolean SD_PlaySound(soundnames sound);
extern void SD_StopSound(), extern void SD_StopSound(),
SD_WaitSoundDone(), SD_WaitSoundDone(),
SD_StartMusic(MusicGroup *music), SD_StartMusic(int music),
SD_MusicOn(), SD_MusicOn(),
SD_MusicOff(), SD_MusicOff(),
SD_FadeOutMusic(); SD_FadeOutMusic();
......
...@@ -131,7 +131,7 @@ void SD_MusicOff() ...@@ -131,7 +131,7 @@ void SD_MusicOff()
// SD_StartMusic() - starts playing the music pointed to // SD_StartMusic() - starts playing the music pointed to
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void SD_StartMusic(MusicGroup *music) void SD_StartMusic(int music)
{ {
SD_MusicOff(); SD_MusicOff();
} }
......
...@@ -132,7 +132,7 @@ void SD_MusicOff() ...@@ -132,7 +132,7 @@ void SD_MusicOff()
// SD_StartMusic() - starts playing the music pointed to // SD_StartMusic() - starts playing the music pointed to
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void SD_StartMusic(MusicGroup *music) void SD_StartMusic(int music)
{ {
SD_MusicOff(); SD_MusicOff();
} }
......
...@@ -571,11 +571,11 @@ void SD_MusicOff() ...@@ -571,11 +571,11 @@ void SD_MusicOff()
// SD_StartMusic() - starts playing the music pointed to // SD_StartMusic() - starts playing the music pointed to
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void SD_StartMusic(MusicGroup *music) void SD_StartMusic(int music)
{ {
SD_MusicOff(); SD_MusicOff();
SD_MusicOn(); SD_MusicOn();
Music = music; Music = (MusicGroup *)audiosegs[music];
NewMusic = 1; NewMusic = 1;
} }
......
...@@ -15,9 +15,7 @@ long spearx,speary; ...@@ -15,9 +15,7 @@ long spearx,speary;
unsigned spearangle; unsigned spearangle;
boolean spearflag; boolean spearflag;
// /* ELEVATOR BACK MAPS - REMEMBER (-1)!! */
// ELEVATOR BACK MAPS - REMEMBER (-1)!!
//
#ifndef SPEAR #ifndef SPEAR
static int ElevatorBackTo[]={ 1, 1, 7, 3, 5, 3}; static int ElevatorBackTo[]={ 1, 1, 7, 3, 5, 3};
#endif #endif
...@@ -473,11 +471,12 @@ void SetupGameLevel() ...@@ -473,11 +471,12 @@ void SetupGameLevel()
/* load the level */ /* load the level */
CA_CacheMap(gamestate.mapon+10*gamestate.episode); CA_CacheMap(gamestate.mapon+10*gamestate.episode);
mapon -= gamestate.episode*10;
if ((mapheaderseg[mapon]->width != 64) || (mapheaderseg[mapon]->height != 64)) if ((mapheaderseg[mapon]->width != 64) || (mapheaderseg[mapon]->height != 64))
Quit("Map not 64*64!"); Quit("Map not 64*64!");
mapon -= gamestate.episode*10;
memset(tilemap, 0, sizeof(tilemap)); memset(tilemap, 0, sizeof(tilemap));
memset(actorat, 0, sizeof(actorat)); memset(actorat, 0, sizeof(actorat));
...@@ -501,8 +500,8 @@ void SetupGameLevel() ...@@ -501,8 +500,8 @@ void SetupGameLevel()
/* spawn doors */ /* spawn doors */
map = mapsegs[0]; map = mapsegs[0];
for (y=0;y<mapheight;y++) for (y = 0; y < mapheight; y++)
for (x=0;x<mapwidth;x++) for (x = 0; x < mapwidth; x++)
{ {
tile = *map++; tile = *map++;
if (tile >= 90 && tile <= 101) if (tile >= 90 && tile <= 101)
...@@ -694,7 +693,7 @@ void FinishDemoRecord() ...@@ -694,7 +693,7 @@ void FinishDemoRecord()
demorecord = false; demorecord = false;
length = demoptr - (byte *)demobuffer; length = (byte *)demoptr - (byte *)demobuffer;
demoptr = ((byte *)demobuffer)+1; demoptr = ((byte *)demobuffer)+1;
...@@ -735,21 +734,22 @@ void RecordDemo() ...@@ -735,21 +734,22 @@ void RecordDemo()
int level,esc; int level,esc;
CenterWindow(26,3); CenterWindow(26,3);
PrintY+=6; PrintY += 6;
CA_CacheGrChunk(STARTFONT); CA_CacheGrChunk(STARTFONT);
fontnumber=0; fontnumber = 0;
US_Print(" Demo which level(1-10):"); US_Print(" Demo which level(1-10):");
VW_UpdateScreen(); VW_UpdateScreen();
VW_FadeIn (); VW_FadeIn();
esc = !US_LineInput (px,py,str,NULL,true,2,0);
esc = !US_LineInput(px,py,str,NULL,true,2,0);
if (esc) if (esc)
return; return;
level = atoi (str); level = atoi(str);
level--; level--;
SETFONTCOLOR(0,15); SETFONTCOLOR(0,15);
VW_FadeOut (); VW_FadeOut();
#ifndef SPEAR #ifndef SPEAR
NewGame (gd_hard,level/10); NewGame (gd_hard,level/10);
...@@ -759,27 +759,27 @@ void RecordDemo() ...@@ -759,27 +759,27 @@ void RecordDemo()
gamestate.mapon = level; gamestate.mapon = level;
#endif #endif
StartDemoRecord (level); StartDemoRecord(level);
DrawPlayScreen (); DrawPlayScreen();
VW_UpdateScreen(); VW_UpdateScreen();
VW_FadeIn (); VW_FadeIn();
startgame = false; startgame = false;
demorecord = true; demorecord = true;
SetupGameLevel (); SetupGameLevel();
StartMusic (); StartMusic();
fizzlein = true; fizzlein = true;
PlayLoop (); PlayLoop();
demoplayback = false; demoplayback = false;
StopMusic (); StopMusic();
VW_FadeOut (); VW_FadeOut();
ClearMemory (); ClearMemory();
FinishDemoRecord (); FinishDemoRecord ();
} }
...@@ -808,11 +808,13 @@ void PlayDemo(int demonumber) ...@@ -808,11 +808,13 @@ void PlayDemo(int demonumber)
demoptr = grsegs[dems[demonumber]]; demoptr = grsegs[dems[demonumber]];
NewGame(1, 0); NewGame(1, 0);
gamestate.mapon = *demoptr++;
gamestate.mapon = demoptr[0];
gamestate.difficulty = gd_hard; gamestate.difficulty = gd_hard;
length = demoptr[0] | (demoptr[1] << 8); length = demoptr[1] | (demoptr[2] << 8);
demoptr += 3; demoptr += 4;
lastdemoptr = demoptr-4+length;
lastdemoptr = demoptr+length-4;
VW_FadeOut(); VW_FadeOut();
...@@ -822,6 +824,7 @@ void PlayDemo(int demonumber) ...@@ -822,6 +824,7 @@ void PlayDemo(int demonumber)
VW_FadeIn(); VW_FadeIn();
loadedgame = false;
startgame = false; startgame = false;
demoplayback = true; demoplayback = true;
...@@ -835,9 +838,9 @@ void PlayDemo(int demonumber) ...@@ -835,9 +838,9 @@ void PlayDemo(int demonumber)
demoplayback = false; demoplayback = false;
StopMusic (); StopMusic();
VW_FadeOut (); VW_FadeOut();
ClearMemory (); ClearMemory();
} }
int PlayDemoFromFile(char *demoname) int PlayDemoFromFile(char *demoname)
......
...@@ -94,9 +94,10 @@ void CalcTics() ...@@ -94,9 +94,10 @@ void CalcTics()
lasttimecount = newtime; lasttimecount = newtime;
if (tics > MAXTICS) { if (demoplayback || demorecord)
tics = DEMOTICS;
else if (tics > MAXTICS)
tics = MAXTICS; tics = MAXTICS;
}
} }
/* ======================================================================== */ /* ======================================================================== */
...@@ -327,9 +328,9 @@ int SaveTheGame(char *fn, char *tag, int dx, int dy) ...@@ -327,9 +328,9 @@ int SaveTheGame(char *fn, char *tag, int dx, int dy)
DiskFlopAnim(dx, dy); DiskFlopAnim(dx, dy);
for (y = 0; y < 64; y++) for (x = 0; x < 64; x++)
for (x = 0; x < 64; x++) for (y = 0; y < 64; y++)
WriteInt32(fd, actorat[y][x]); WriteInt32(fd, actorat[x][y]);
DiskFlopAnim(dx, dy); DiskFlopAnim(dx, dy);
...@@ -573,9 +574,9 @@ int LoadTheGame(char *fn, int dx, int dy) ...@@ -573,9 +574,9 @@ int LoadTheGame(char *fn, int dx, int dy)
DiskFlopAnim(dx, dy); DiskFlopAnim(dx, dy);
for (y = 0; y < 64; y++) for (x = 0; x < 64; x++)
for (x = 0; x < 64; x++) for (y = 0; y < 64; y++)
actorat[y][x] = ReadInt32(fd); actorat[x][y] = ReadInt32(fd);
DiskFlopAnim(dx, dy); DiskFlopAnim(dx, dy);
...@@ -618,10 +619,10 @@ int LoadTheGame(char *fn, int dx, int dy) ...@@ -618,10 +619,10 @@ int LoadTheGame(char *fn, int dx, int dy)
player->temp3 = ReadInt32(fd); player->temp3 = ReadInt32(fd);
/* update the id */ /* update the id */
for (y = 0; y < 64; y++) for (x = 0; x < 64; x++)
for (x = 0; x < 64; x++) for (y = 0; y < 64; y++)
if (actorat[y][x] == (id | 0x8000)) if (actorat[x][y] == (id | 0x8000))
actorat[y][x] = player->id | 0x8000; actorat[x][y] = player->id | 0x8000;
while (1) { while (1) {
DiskFlopAnim(dx, dy); DiskFlopAnim(dx, dy);
...@@ -656,10 +657,10 @@ int LoadTheGame(char *fn, int dx, int dy) ...@@ -656,10 +657,10 @@ int LoadTheGame(char *fn, int dx, int dy)
new->temp2 = ReadInt32(fd); new->temp2 = ReadInt32(fd);
new->temp3 = ReadInt32(fd); new->temp3 = ReadInt32(fd);
for (y = 0; y < 64; y++) for (x = 0; x < 64; x++)
for (x = 0; x < 64; x++) for (y = 0; y < 64; y++)
if (actorat[y][x] == (id | 0x8000)) if (actorat[x][y] == (id | 0x8000))
actorat[y][x] = new->id | 0x8000; actorat[x][y] = new->id | 0x8000;
} }
DiskFlopAnim(dx, dy); DiskFlopAnim(dx, dy);
...@@ -1343,6 +1344,15 @@ void DemoLoop() ...@@ -1343,6 +1344,15 @@ void DemoLoop()
VW_FadeOut(); VW_FadeOut();
} }
if (MS_CheckParm("demotest")) {
#ifndef SPEARDEMO
for (i = 0; i < 4; i++)
PlayDemo(i);
#else
PlayDemo(0);
#endif
}
while (1) while (1)
{ {
while (!NoWait) while (!NoWait)
......
...@@ -3178,7 +3178,7 @@ void StartCPMusic(int song) ...@@ -3178,7 +3178,7 @@ void StartCPMusic(int song)
lastmusic = song; lastmusic = song;
CA_CacheAudioChunk(STARTMUSIC + song); CA_CacheAudioChunk(STARTMUSIC + song);
SD_StartMusic((MusicGroup *)audiosegs[STARTMUSIC + song]); SD_StartMusic(STARTMUSIC + song);
} }
void FreeMusic() void FreeMusic()
......
...@@ -373,10 +373,8 @@ void PollJoystickMove() ...@@ -373,10 +373,8 @@ void PollJoystickMove()
void PollControls() void PollControls()
{ {
int max, min, i; int max, min, i;
byte buttonbits; byte buttonbits;
controlx = 0; controlx = 0;
controly = 0; controly = 0;
...@@ -388,14 +386,14 @@ void PollControls() ...@@ -388,14 +386,14 @@ void PollControls()
// read commands from demo buffer // read commands from demo buffer
// //
buttonbits = *demoptr++; buttonbits = *demoptr++;
for (i=0;i<NUMBUTTONS;i++) for (i = 0; i < NUMBUTTONS; i++)
{ {
buttonstate[i] = buttonbits&1; buttonstate[i] = buttonbits&1;
buttonbits >>= 1; buttonbits >>= 1;
} }
controlx = *demoptr++; controlx = (signed char)*demoptr++;
controly = *demoptr++; controly = (signed char)*demoptr++;
if (demoptr == lastdemoptr) if (demoptr == lastdemoptr)
playstate = ex_completed; // demo is done playstate = ex_completed; // demo is done
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment