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 @@
system/processor/binary build
* Suite of utilities to edit the game data.
* Resolve any endian issues
* Add a ViewMap?
......@@ -15,11 +15,6 @@ Sound Menu:
- 44100
- 22050
------------------------------------------------------------------------------
*
SD_StartMusic((MusicGroup *)audiosegs[STARTMUSIC + chunk]);
=>
SD_StartMusic(chunk);
------------------------------------------------------------------------------
* use int16_t, etc (stdint)
* finish serializing reads/writes, endian issues
* fix fix fix different size stuff
......@@ -33,6 +28,11 @@ probably will only support 320x200, 640x400, 960x600
example (is this reproducible?)
* getenv so that you can point an env. var to the proper dir
* 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
* menu code is a mess, always does things differently than the rest of the
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
* clean up header files, especially wl_def.h, where some declarations aren't
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
* remove check for debugmode?
* fizzlefade is hackish, stipple buf would work ok in opengl, maybe only
......
......@@ -53,7 +53,7 @@ extern void SD_Shutdown();
extern boolean SD_PlaySound(soundnames sound);
extern void SD_StopSound(),
SD_WaitSoundDone(),
SD_StartMusic(MusicGroup *music),
SD_StartMusic(int music),
SD_MusicOn(),
SD_MusicOff(),
SD_FadeOutMusic();
......
......@@ -131,7 +131,7 @@ void SD_MusicOff()
// SD_StartMusic() - starts playing the music pointed to
//
///////////////////////////////////////////////////////////////////////////
void SD_StartMusic(MusicGroup *music)
void SD_StartMusic(int music)
{
SD_MusicOff();
}
......
......@@ -132,7 +132,7 @@ void SD_MusicOff()
// SD_StartMusic() - starts playing the music pointed to
//
///////////////////////////////////////////////////////////////////////////
void SD_StartMusic(MusicGroup *music)
void SD_StartMusic(int music)
{
SD_MusicOff();
}
......
......@@ -571,11 +571,11 @@ void SD_MusicOff()
// SD_StartMusic() - starts playing the music pointed to
//
///////////////////////////////////////////////////////////////////////////
void SD_StartMusic(MusicGroup *music)
void SD_StartMusic(int music)
{
SD_MusicOff();
SD_MusicOn();
Music = music;
Music = (MusicGroup *)audiosegs[music];
NewMusic = 1;
}
......
......@@ -15,9 +15,7 @@ long spearx,speary;
unsigned spearangle;
boolean spearflag;
//
// ELEVATOR BACK MAPS - REMEMBER (-1)!!
//
/* ELEVATOR BACK MAPS - REMEMBER (-1)!! */
#ifndef SPEAR
static int ElevatorBackTo[]={ 1, 1, 7, 3, 5, 3};
#endif
......@@ -473,11 +471,12 @@ void SetupGameLevel()
/* load the level */
CA_CacheMap(gamestate.mapon+10*gamestate.episode);
mapon -= gamestate.episode*10;
if ((mapheaderseg[mapon]->width != 64) || (mapheaderseg[mapon]->height != 64))
Quit("Map not 64*64!");
mapon -= gamestate.episode*10;
memset(tilemap, 0, sizeof(tilemap));
memset(actorat, 0, sizeof(actorat));
......@@ -501,8 +500,8 @@ void SetupGameLevel()
/* spawn doors */
map = mapsegs[0];
for (y=0;y<mapheight;y++)
for (x=0;x<mapwidth;x++)
for (y = 0; y < mapheight; y++)
for (x = 0; x < mapwidth; x++)
{
tile = *map++;
if (tile >= 90 && tile <= 101)
......@@ -694,7 +693,7 @@ void FinishDemoRecord()
demorecord = false;
length = demoptr - (byte *)demobuffer;
length = (byte *)demoptr - (byte *)demobuffer;
demoptr = ((byte *)demobuffer)+1;
......@@ -735,21 +734,22 @@ void RecordDemo()
int level,esc;
CenterWindow(26,3);
PrintY+=6;
PrintY += 6;
CA_CacheGrChunk(STARTFONT);
fontnumber=0;
fontnumber = 0;
US_Print(" Demo which level(1-10):");
VW_UpdateScreen();
VW_FadeIn ();
esc = !US_LineInput (px,py,str,NULL,true,2,0);
VW_FadeIn();
esc = !US_LineInput(px,py,str,NULL,true,2,0);
if (esc)
return;
level = atoi (str);
level = atoi(str);
level--;
SETFONTCOLOR(0,15);
VW_FadeOut ();
VW_FadeOut();
#ifndef SPEAR
NewGame (gd_hard,level/10);
......@@ -759,27 +759,27 @@ void RecordDemo()
gamestate.mapon = level;
#endif
StartDemoRecord (level);
StartDemoRecord(level);
DrawPlayScreen ();
DrawPlayScreen();
VW_UpdateScreen();
VW_FadeIn ();
VW_FadeIn();
startgame = false;
demorecord = true;
SetupGameLevel ();
StartMusic ();
SetupGameLevel();
StartMusic();
fizzlein = true;
PlayLoop ();
PlayLoop();
demoplayback = false;
StopMusic ();
VW_FadeOut ();
ClearMemory ();
StopMusic();
VW_FadeOut();
ClearMemory();
FinishDemoRecord ();
}
......@@ -808,11 +808,13 @@ void PlayDemo(int demonumber)
demoptr = grsegs[dems[demonumber]];
NewGame(1, 0);
gamestate.mapon = *demoptr++;
gamestate.mapon = demoptr[0];
gamestate.difficulty = gd_hard;
length = demoptr[0] | (demoptr[1] << 8);
demoptr += 3;
lastdemoptr = demoptr-4+length;
length = demoptr[1] | (demoptr[2] << 8);
demoptr += 4;
lastdemoptr = demoptr+length-4;
VW_FadeOut();
......@@ -822,6 +824,7 @@ void PlayDemo(int demonumber)
VW_FadeIn();
loadedgame = false;
startgame = false;
demoplayback = true;
......@@ -835,9 +838,9 @@ void PlayDemo(int demonumber)
demoplayback = false;
StopMusic ();
VW_FadeOut ();
ClearMemory ();
StopMusic();
VW_FadeOut();
ClearMemory();
}
int PlayDemoFromFile(char *demoname)
......
......@@ -94,9 +94,10 @@ void CalcTics()
lasttimecount = newtime;
if (tics > MAXTICS) {
if (demoplayback || demorecord)
tics = DEMOTICS;
else if (tics > MAXTICS)
tics = MAXTICS;
}
}
/* ======================================================================== */
......@@ -327,9 +328,9 @@ int SaveTheGame(char *fn, char *tag, int dx, int dy)
DiskFlopAnim(dx, dy);
for (y = 0; y < 64; y++)
for (x = 0; x < 64; x++)
WriteInt32(fd, actorat[y][x]);
for (x = 0; x < 64; x++)
for (y = 0; y < 64; y++)
WriteInt32(fd, actorat[x][y]);
DiskFlopAnim(dx, dy);
......@@ -573,9 +574,9 @@ int LoadTheGame(char *fn, int dx, int dy)
DiskFlopAnim(dx, dy);
for (y = 0; y < 64; y++)
for (x = 0; x < 64; x++)
actorat[y][x] = ReadInt32(fd);
for (x = 0; x < 64; x++)
for (y = 0; y < 64; y++)
actorat[x][y] = ReadInt32(fd);
DiskFlopAnim(dx, dy);
......@@ -618,10 +619,10 @@ int LoadTheGame(char *fn, int dx, int dy)
player->temp3 = ReadInt32(fd);
/* update the id */
for (y = 0; y < 64; y++)
for (x = 0; x < 64; x++)
if (actorat[y][x] == (id | 0x8000))
actorat[y][x] = player->id | 0x8000;
for (x = 0; x < 64; x++)
for (y = 0; y < 64; y++)
if (actorat[x][y] == (id | 0x8000))
actorat[x][y] = player->id | 0x8000;
while (1) {
DiskFlopAnim(dx, dy);
......@@ -656,10 +657,10 @@ int LoadTheGame(char *fn, int dx, int dy)
new->temp2 = ReadInt32(fd);
new->temp3 = ReadInt32(fd);
for (y = 0; y < 64; y++)
for (x = 0; x < 64; x++)
if (actorat[y][x] == (id | 0x8000))
actorat[y][x] = new->id | 0x8000;
for (x = 0; x < 64; x++)
for (y = 0; y < 64; y++)
if (actorat[x][y] == (id | 0x8000))
actorat[x][y] = new->id | 0x8000;
}
DiskFlopAnim(dx, dy);
......@@ -1343,6 +1344,15 @@ void DemoLoop()
VW_FadeOut();
}
if (MS_CheckParm("demotest")) {
#ifndef SPEARDEMO
for (i = 0; i < 4; i++)
PlayDemo(i);
#else
PlayDemo(0);
#endif
}
while (1)
{
while (!NoWait)
......
......@@ -3178,7 +3178,7 @@ void StartCPMusic(int song)
lastmusic = song;
CA_CacheAudioChunk(STARTMUSIC + song);
SD_StartMusic((MusicGroup *)audiosegs[STARTMUSIC + song]);
SD_StartMusic(STARTMUSIC + song);
}
void FreeMusic()
......
......@@ -373,10 +373,8 @@ void PollJoystickMove()
void PollControls()
{
int max, min, i;
byte buttonbits;
int max, min, i;
byte buttonbits;
controlx = 0;
controly = 0;
......@@ -388,14 +386,14 @@ void PollControls()
// read commands from demo buffer
//
buttonbits = *demoptr++;
for (i=0;i<NUMBUTTONS;i++)
for (i = 0; i < NUMBUTTONS; i++)
{
buttonstate[i] = buttonbits&1;
buttonbits >>= 1;
}
controlx = *demoptr++;
controly = *demoptr++;
controlx = (signed char)*demoptr++;
controly = (signed char)*demoptr++;
if (demoptr == lastdemoptr)
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