Commit 328d9220 authored by Steven Fuller's avatar Steven Fuller

Temp checkin.

id_vh.c, vi_*: added VL_DirectPlotFlush (used by FizzleFade) to just update
the screen

wl_act2.c, wl_def.h, wl_agent.c, wl_act3.h, wl_act3.c: moved all statetype
declarations to wl_act3.c/wl_act3.h

wl_act2.c, wl_state.c: removed some UPLOAD ifndefs (from when the older wl1
sound header was used)

wl_menu.c: fixed the music functions again (no more trying to free null
chunk warnings)

rest: most likely whitespace changes
parent 60d51311
......@@ -7,7 +7,7 @@ CFLAGS = -g -Wall
#CFLAGS = -Os -Wall -fomit-frame-pointer -ffast-math -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
OBJS = objs.o misc.o id_ca.o id_vh.o id_us.o \
wl_act1.o wl_act2.o wl_agent.o wl_game.o \
wl_act1.o wl_act2.o wl_act3.o wl_agent.o wl_game.o \
wl_inter.o wl_menu.o wl_play.o wl_state.o wl_text.o wl_main.o \
wl_debug.o gfxsave.o
ROBJS = wl_draw.o
......
......@@ -20,7 +20,9 @@ SD_StartMusic((MusicGroup *)audiosegs[STARTMUSIC + chunk]);
=>
SD_StartMusic(chunk);
------------------------------------------------------------------------------
* serialize reads/writes
* fix fix fix different size stuff
works alright at some res, but breaks on most others currently
* add ylookup
* remove farmapylookup?
* would be nice if Quit() used vsnprintf, etc
......
......@@ -49,6 +49,7 @@ boolean FizzleFade(unsigned xx, unsigned yy, unsigned width, unsigned height, un
int pixperframe;
unsigned x, y, p, frame;
long rndval;
int retr;
rndval = 1;
pixperframe = 64000/frames;
......@@ -61,9 +62,12 @@ boolean FizzleFade(unsigned xx, unsigned yy, unsigned width, unsigned height, un
if (vwidth != 320)
return false;
retr = -1;
do {
if (abortable && IN_CheckAck())
return true;
retr = true;
else
for (p = 0; p < pixperframe; p++) {
y = (rndval & 0x00FF) - 1;
x = (rndval & 0x00FFFF00) >> 8;
......@@ -79,13 +83,22 @@ boolean FizzleFade(unsigned xx, unsigned yy, unsigned width, unsigned height, un
VL_DirectPlot(xx+x, yy+y, xx+x, yy+y);
if (rndval == 1) /* entire sequence has been completed */
return false;
if (rndval == 1) {
/* entire sequence has been completed */
retr = false;
break;
}
}
VL_DirectPlotFlush();
frame++;
while (get_TimeCount() < frame);
} while (1);
} while (retr == -1);
VL_DirectPlotFlush();
return retr;
}
void VL_FillPalette(int red, int green, int blue)
......
......@@ -25,7 +25,7 @@ void VL_MemToScreen(const byte *source, int width, int height, int x, int y);
void VL_DeModeXize(byte *buf, int width, int height);
void VL_DirectPlot(int x1, int y1, int x2, int y2);
void VL_DirectPlotFlush();
#define MaxPlayers 4
#define MaxJoys 2
......
......@@ -143,9 +143,6 @@ void VL_SetPalette(const byte *palette)
SDL_SetColors(surface, colors, 0, 256);
}
//===========================================================================
/*
=================
=
......@@ -168,7 +165,11 @@ void VL_GetPalette(byte *palette)
void VL_DirectPlot(int x1, int y1, int x2, int y2)
{
*(((Uint8 *)surface->pixels) + x1 + y1 * vwidth) = *(gfxbuf + x2 + y2 * vwidth);
//SDL_UpdateRect(surface, x1,y1,x1,y1);
}
void VL_DirectPlotFlush()
{
SDL_UpdateRect(surface, 0, 0, 0, 0);
}
/*
......
......@@ -143,6 +143,10 @@ void VL_DirectPlot(int x1, int y1, int x2, int y2)
*(graph_mem + x1 + y1 * 320) = *(gfxbuf + x2 + y2 * 320);
}
void VL_DirectPlotFlush()
{
}
/*
=============================================================================
......
......@@ -526,6 +526,10 @@ void VL_DirectPlot(int x1, int y1, int x2, int y2)
}
}
void VL_DirectPlotFlush()
{
}
/*
=============================================================================
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -41,12 +41,6 @@ objtype *LastAttacker;
*/
void T_Player(objtype *ob);
void T_Attack(objtype *ob);
statetype s_player = {false,0,0,T_Player,NULL,NULL};
statetype s_attack = {false,0,0,T_Attack,NULL,NULL};
struct atkinf
{
char tics, attack, frame; // attack is 1 for gun, 2 for knife
......@@ -62,13 +56,6 @@ void DrawWeapon (void);
void GiveWeapon (int weapon);
void GiveAmmo (int ammo);
//===========================================================================
boolean TryMove (objtype *ob);
void T_Player (objtype *ob);
void ClipMove (objtype *ob, long xmove, long ymove);
/*
=============================================================================
......@@ -87,7 +74,7 @@ void ClipMove (objtype *ob, long xmove, long ymove);
======================
*/
void CheckWeaponChange (void)
void CheckWeaponChange()
{
int i;
......@@ -264,7 +251,6 @@ void UpdateFace()
}
/*
===============
=
......@@ -734,11 +720,11 @@ void GetBonus (statobj_t *check)
= TryMove
=
= returns true if move ok
= debug: use pointers to optimize
=
===================
*/
boolean TryMove (objtype *ob)
boolean TryMove(objtype *ob)
{
int xl,yl,xh,yh,x,y;
objtype *check;
......@@ -803,7 +789,7 @@ boolean TryMove (objtype *ob)
===================
*/
void ClipMove (objtype *ob, long xmove, long ymove)
void ClipMove(objtype *ob, long xmove, long ymove)
{
long basex,basey;
......@@ -847,12 +833,11 @@ void ClipMove (objtype *ob, long xmove, long ymove)
===================
*/
void VictoryTile (void)
void VictoryTile()
{
#ifndef SPEAR
SpawnBJVictory ();
SpawnBJVictory();
#endif
gamestate.victoryflag = true;
}
......@@ -870,14 +855,13 @@ void Thrust(int angle, long speed)
long xmove,ymove;
unsigned offset;
#ifdef SPEAR
//
// ZERO FUNNY COUNTER IF MOVED!
//
#ifdef SPEAR
if (speed)
funnyticount = 0;
#endif
#endif
thrustspeed += speed;
//
......@@ -919,7 +903,7 @@ void Thrust(int angle, long speed)
===============
*/
void Cmd_Fire (void)
void Cmd_Fire()
{
buttonheld[bt_attack] = true;
......@@ -946,7 +930,7 @@ void Cmd_Fire (void)
void Cmd_Use()
{
int checkx,checky,doornum,dir;
int checkx, checky, doornum, dir;
boolean elevatorok;
//
......@@ -1003,16 +987,16 @@ void Cmd_Use()
playstate = ex_secretlevel;
else
playstate = ex_completed;
SD_PlaySound (LEVELDONESND);
SD_PlaySound(LEVELDONESND);
SD_WaitSoundDone();
}
else if (!buttonheld[bt_use] && doornum & 0x80)
{
buttonheld[bt_use] = true;
OperateDoor (doornum & ~0x80);
OperateDoor(doornum & ~0x80);
}
else
SD_PlaySound (DONOTHINGSND);
SD_PlaySound(DONOTHINGSND);
}
......@@ -1191,7 +1175,7 @@ void GunAttack(objtype *ob)
===============
*/
void VictorySpin (void)
void VictorySpin()
{
long desty;
......@@ -1233,11 +1217,11 @@ void T_Attack(objtype *ob)
{
struct atkinf *cur;
UpdateFace ();
UpdateFace();
if (gamestate.victoryflag) // watching the BJ actor
{
VictorySpin ();
VictorySpin();
return;
}
......@@ -1317,10 +1301,6 @@ void T_Attack(objtype *ob)
}
//===========================================================================
/*
===============
=
......@@ -1329,32 +1309,29 @@ void T_Attack(objtype *ob)
===============
*/
void T_Player (objtype *ob)
void T_Player(objtype *ob)
{
if (gamestate.victoryflag) // watching the BJ actor
{
VictorySpin ();
VictorySpin();
return;
}
UpdateFace ();
CheckWeaponChange ();
UpdateFace();
CheckWeaponChange();
if ( buttonstate[bt_use] )
Cmd_Use ();
if (buttonstate[bt_use])
Cmd_Use();
if ( buttonstate[bt_attack] && !buttonheld[bt_attack])
Cmd_Fire ();
if (buttonstate[bt_attack] && !buttonheld[bt_attack])
Cmd_Fire();
ControlMovement (ob);
ControlMovement(ob);
if (gamestate.victoryflag) // watching the BJ actor
return;
plux = player->x >> UNSIGNEDSHIFT; // scale to fit in unsigned
pluy = player->y >> UNSIGNEDSHIFT;
player->tilex = player->x >> TILESHIFT; // scale to tile values
player->tiley = player->y >> TILESHIFT;
}
......@@ -862,9 +862,6 @@ extern fixed viewsin,viewcos;
extern int horizwall[],vertwall[];
extern unsigned pwallpos;
fixed FixedByFrac (fixed a, fixed b);
void BuildTables (void);
void CalcTics (void);
......@@ -977,66 +974,6 @@ void InitAreas (void);
=============================================================================
*/
extern statetype s_grddie1;
extern statetype s_dogdie1;
extern statetype s_ofcdie1;
extern statetype s_mutdie1;
extern statetype s_ssdie1;
extern statetype s_bossdie1;
extern statetype s_schabbdie1;
extern statetype s_fakedie1;
extern statetype s_mechadie1;
extern statetype s_hitlerdie1;
extern statetype s_greteldie1;
extern statetype s_giftdie1;
extern statetype s_fatdie1;
extern statetype s_spectredie1;
extern statetype s_angeldie1;
extern statetype s_transdie0;
extern statetype s_uberdie0;
extern statetype s_willdie1;
extern statetype s_deathdie1;
extern statetype s_grdchase1;
extern statetype s_dogchase1;
extern statetype s_ofcchase1;
extern statetype s_sschase1;
extern statetype s_mutchase1;
extern statetype s_bosschase1;
extern statetype s_schabbchase1;
extern statetype s_fakechase1;
extern statetype s_mechachase1;
extern statetype s_gretelchase1;
extern statetype s_giftchase1;
extern statetype s_fatchase1;
extern statetype s_spectrechase1;
extern statetype s_angelchase1;
extern statetype s_transchase1;
extern statetype s_uberchase1;
extern statetype s_willchase1;
extern statetype s_deathchase1;
extern statetype s_blinkychase1;
extern statetype s_hitlerchase1;
extern statetype s_grdpain;
extern statetype s_grdpain1;
extern statetype s_ofcpain;
extern statetype s_ofcpain1;
extern statetype s_sspain;
extern statetype s_sspain1;
extern statetype s_mutpain;
extern statetype s_mutpain1;
extern statetype s_deathcam;
extern statetype s_schabbdeathcam2;
extern statetype s_hitlerdeathcam2;
extern statetype s_giftdeathcam2;
extern statetype s_fatdeathcam2;
void A_DeathScream(objtype *ob);
void SpawnBJVictory(void);
......@@ -1073,4 +1010,6 @@ void SpawnHitler (int tilex, int tiley);
extern void HelpScreens();
extern void EndText();
#include "wl_act3.h"
#endif
......@@ -56,9 +56,10 @@ void EndSpear()
WindowW = 320;
PrintX = 0;
PrintY = 180;
US_CPrint (STR_ENDGAME1"\n");
US_CPrint (STR_ENDGAME2);
VW_UpdateScreen ();
US_CPrint(STR_ENDGAME1"\n");
US_CPrint(STR_ENDGAME2);
VW_UpdateScreen();
IN_StartAck ();
set_TimeCount(0);
while ( !IN_CheckAck () && (get_TimeCount() < 700) );
......@@ -66,9 +67,10 @@ void EndSpear()
PrintX = 0;
PrintY = 180;
VW_Bar(0,180,320,20,0);
US_CPrint (STR_ENDGAME3"\n");
US_CPrint (STR_ENDGAME4);
VW_UpdateScreen ();
US_CPrint(STR_ENDGAME3"\n");
US_CPrint(STR_ENDGAME4);
VW_UpdateScreen();
IN_StartAck ();
set_TimeCount(0);
while ( !IN_CheckAck () && (get_TimeCount() < 700) );
......@@ -493,7 +495,7 @@ void LevelCompleted()
};
CacheLump(LEVELEND_LUMP_START,LEVELEND_LUMP_END);
ClearSplitVWB (); // set up for double buffering in split screen
ClearSplitVWB(); // set up for double buffering in split screen
VW_Bar (0,0,320,200-STATUSLINES,127);
StartCPMusic(ENDLEVEL_MUS);
......@@ -814,14 +816,14 @@ void LevelCompleted()
#ifdef SPEARDEMO
if (gamestate.mapon == 1)
{
SD_PlaySound (BONUS1UPSND);
SD_PlaySound(BONUS1UPSND);
CA_CacheGrChunk (STARTFONT+1);
Message ("This concludes your demo\n"
CA_CacheGrChunk(STARTFONT+1);
Message("This concludes your demo\n"
"of Spear of Destiny! Now,\n"
"go to your local software\n"
"store and buy it!");
CA_UnCacheGrChunk (STARTFONT+1);
CA_UnCacheGrChunk(STARTFONT+1);
IN_ClearKeysDown();
IN_Ack();
......@@ -933,14 +935,14 @@ void DrawHighScores()
fontnumber = 0;
#else
CacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
CacheLump(BACKDROP_LUMP_START,BACKDROP_LUMP_END);
ClearMScreen();
DrawStripes(10);
UnCacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
UnCacheLump(BACKDROP_LUMP_START,BACKDROP_LUMP_END);
CacheLump (HIGHSCORES_LUMP_START,HIGHSCORES_LUMP_END);
CA_CacheGrChunk (STARTFONT+1);
VWB_DrawPic (0,0,HIGHSCORESPIC);
CacheLump(HIGHSCORES_LUMP_START,HIGHSCORES_LUMP_END);
CA_CacheGrChunk(STARTFONT+1);
VWB_DrawPic(0,0,HIGHSCORESPIC);
fontnumber = 1;
#endif
......@@ -979,15 +981,13 @@ void DrawHighScores()
PrintX = 194 - w;
#endif
#ifndef UPLOAD
#ifndef SPEAR
#if !defined(UPLOAD) || !defined(SPEAR)
PrintX -= 6;
itoa(s->episode+1,buffer1,10);
US_Print("E");
US_Print(buffer1);
US_Print("/L");
#endif
#endif
#ifdef SPEAR
if (s->completed == 21)
......@@ -1015,14 +1015,11 @@ void DrawHighScores()
VW_UpdateScreen();
#ifdef SPEAR
UnCacheLump (HIGHSCORES_LUMP_START,HIGHSCORES_LUMP_END);
UnCacheLump(HIGHSCORES_LUMP_START, HIGHSCORES_LUMP_END);
fontnumber = 0;
#endif
}
//===========================================================================
/*
=======================
=
......@@ -1031,27 +1028,22 @@ void DrawHighScores()
=======================
*/
void CheckHighScore (long score,word other)
void CheckHighScore(long score, word other)
{
word i,j;
word i, j;
int n;
HighScore myscore;
strcpy(myscore.name,"");
strcpy(myscore.name, "");
myscore.score = score;
myscore.episode = gamestate.episode;
myscore.completed = other;
for (i = 0,n = -1;i < MaxScores;i++)
for (i = 0, n = -1; i < MaxScores;i++)
{
if
(
(myscore.score > Scores[i].score)
|| (
(myscore.score == Scores[i].score)
&& (myscore.completed > Scores[i].completed)
)
)
if ((myscore.score > Scores[i].score) ||
((myscore.score == Scores[i].score) &&
(myscore.completed > Scores[i].completed)))
{
for (j = MaxScores;--j > i;)
Scores[j] = Scores[j - 1];
......@@ -1062,13 +1054,13 @@ void CheckHighScore (long score,word other)
}
#ifdef SPEAR
StartCPMusic (XAWARD_MUS);
StartCPMusic(XAWARD_MUS);
#else
StartCPMusic (ROSTER_MUS);
StartCPMusic(ROSTER_MUS);
#endif
DrawHighScores ();
DrawHighScores();
VW_FadeIn ();
VW_FadeIn();
if (n != -1)
{
......@@ -1085,7 +1077,7 @@ void CheckHighScore (long score,word other)
PrintX = 16;
fontnumber = 1;
VW_Bar(PrintX-2,PrintY-2,145,15,0x9c);
VW_UpdateScreen ();
VW_UpdateScreen();
backcolor = 0x9c;
fontcolor = 15;
US_LineInput(PrintX,PrintY,Scores[n].name,NULL,true,MaxHighName,130);
......@@ -1093,7 +1085,7 @@ void CheckHighScore (long score,word other)
}
else
{
IN_ClearKeysDown ();
IN_ClearKeysDown();
IN_UserInput(500);
}
......
......@@ -282,9 +282,9 @@ void DiskFlopAnim(int x, int y)
long DoChecksum(byte *source, unsigned size, long checksum)
{
unsigned i;
int i;
for (i=0;i<size-1;i++)
for (i = 0; i < size-1; i++)
checksum += source[i]^source[i+1];
return checksum;
......@@ -427,9 +427,9 @@ boolean LoadTheGame(int file,int x,int y)
if (nullobj.active == ac_badobject)
break;
GetNewActor ();
GetNewActor();
// don't copy over the links
memcpy(new,&nullobj,sizeof(nullobj)-4);
memcpy(new, &nullobj, sizeof(nullobj)-4);
}
......
......@@ -440,7 +440,7 @@ void US_ControlPanel(byte scancode)
#ifdef SPEAR
UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
MM_SortMem ();
MM_SortMem();
#endif
}
......@@ -1344,7 +1344,6 @@ int CP_SaveGame(int quick)
if (SaveGamesAvail[which])
{
name[7]=which+'0';
unlink(name);
handle=creat(name,S_IREAD|S_IWRITE);
strcpy(input,&SaveGameNames[which][0]);
......@@ -1399,16 +1398,15 @@ int CP_SaveGame(int quick)
if (US_LineInput(LSM_X+LSItems.indent+2,LSM_Y+which*13+1,input,input,true,31,LSM_W-LSItems.indent-30))
{
SaveGamesAvail[which]=1;
SaveGamesAvail[which] = 1;
strcpy(&SaveGameNames[which][0],input);
unlink(name);
handle=creat(name,S_IREAD|S_IWRITE);
nwritten = write(handle,(void *)input,32);
lseek(handle,32,SEEK_SET);
handle = creat(name, S_IREAD|S_IWRITE);
nwritten = write(handle, (void *)input, 32);
lseek(handle, 32, SEEK_SET);
DrawLSAction(1);
SaveTheGame(handle,LSA_X+8,LSA_Y+5);
SaveTheGame(handle, LSA_X+8, LSA_Y+5);
close(handle);
......@@ -3244,7 +3242,6 @@ void StartCPMusic(int song)
lastmusic = song;
CA_CacheAudioChunk(STARTMUSIC + song);
MM_SetLock((memptr *)&(audiosegs[STARTMUSIC + song]), true);
SD_StartMusic((MusicGroup *)audiosegs[STARTMUSIC + song]);
}
......@@ -3252,8 +3249,10 @@ void FreeMusic()
{
SD_MusicOff();
if (lastmusic >= 0)
if (lastmusic >= 0) {
CA_UnCacheAudioChunk(STARTMUSIC + lastmusic);
lastmusic = -1;
}
}
///////////////////////////////////////////////////////////////////////////
......
......@@ -1104,7 +1104,7 @@ void FinishPaletteShifts (void)
=====================
*/
void DoActor (objtype *ob)
void DoActor(objtype *ob)
{
void (*think)(objtype *);
......@@ -1134,7 +1134,7 @@ void DoActor (objtype *ob)
if (ob->flags&FL_NEVERMARK)
return;
if ( (ob->flags&FL_NONMARK) && actorat[ob->tilex][ob->tiley])
if ((ob->flags&FL_NONMARK) && actorat[ob->tilex][ob->tiley])
return;
actorat[ob->tilex][ob->tiley] = ob;
......@@ -1153,7 +1153,7 @@ void DoActor (objtype *ob)
think (ob);
if (!ob->state)
{
RemoveObj (ob);
RemoveObj(ob);
return;
}
}
......@@ -1185,7 +1185,7 @@ think:
think (ob);
if (!ob->state)
{
RemoveObj (ob);
RemoveObj(ob);
return;
}
}
......@@ -1193,7 +1193,7 @@ think:
if (ob->flags&FL_NEVERMARK)
return;
if ( (ob->flags&FL_NONMARK) && actorat[ob->tilex][ob->tiley])
if ((ob->flags&FL_NONMARK) && actorat[ob->tilex][ob->tiley])
return;
actorat[ob->tilex][ob->tiley] = ob;
......
......@@ -1214,25 +1214,19 @@ void FirstSighting (objtype *ob)
break;
case gretelobj:
#ifndef UPLOAD
SD_PlaySound(KEINSND);
#endif
NewState (ob,&s_gretelchase1);
ob->speed *= 3; // go faster when chasing player
break;
case giftobj:
#ifndef UPLOAD
SD_PlaySound(EINESND);
#endif
NewState (ob,&s_giftchase1);
ob->speed *= 3; // go faster when chasing player
break;
case fatobj:
#ifndef UPLOAD
SD_PlaySound(ERLAUBENSND);
#endif
NewState (ob,&s_fatchase1);
ob->speed *= 3; // go faster when chasing player
break;
......
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