Factor out displaying episode ending cutscenes into G_BonusCutscenes().

Also,
 - retire IFWITHIN() macro, preferring expanding it
 - fix _endofgame() in control.lua

git-svn-id: https://svn.eduke32.com/eduke32@3647 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-04-05 17:53:25 +00:00
parent e638c38c35
commit 53b01f57c6
5 changed files with 274 additions and 277 deletions

View file

@ -1457,7 +1457,7 @@ ACTOR_STATIC void G_MoveStandables(void)
if ((t[7]&(0xffff0000))!=ROTFIXSPR_MAGIC)
Bmemcpy(&actor[i].bpos.x, s, sizeof(vec3_t));
IFWITHIN(CRANE,CRANE+3)
if (PN >= CRANE && PN <= CRANE+3)
{
//t[0] = state
//t[1] = checking sector number
@ -1645,7 +1645,7 @@ ACTOR_STATIC void G_MoveStandables(void)
goto BOLT;
}
IFWITHIN(WATERFOUNTAIN,WATERFOUNTAIN+3)
if (PN >= WATERFOUNTAIN && PN <= WATERFOUNTAIN+3)
{
if (t[0] > 0)
{
@ -5364,7 +5364,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5
goto BOLT;
}
IFWITHIN(SCRAP6,SCRAP5+3)
if (PN >= SCRAP6 && PN <= SCRAP5+3)
{
if (s->xvel > 0)
s->xvel--;

View file

@ -11169,14 +11169,10 @@ static void G_DoOrderScreen(void)
}
void G_BonusScreen(int32_t bonusonly)
static void G_BonusCutscenes(void)
{
int32_t t, /*tinc,*/ gfx_offset;
int32_t i, y,xfragtotal,yfragtotal;
int32_t bonuscnt;
int32_t clockpad = 2;
char *lastmapname;
int32_t playerbest = -1;
int32_t bonuscnt=0;
int32_t t;
int32_t breathe[] =
{
@ -11197,41 +11193,9 @@ void G_BonusScreen(int32_t bonusonly)
350, 380, VICTORY1+8, 86, 59 // duplicate row to alleviate overflow in the for loop below "boss"
};
if (g_networkMode == NET_DEDICATED_SERVER)
if (!(numplayers < 2 && ud.eog && ud.from_bonus == 0))
return;
Bsprintf(tempbuf, "%s - " APPNAME, g_gameNamePtr);
wm_setapptitle(tempbuf);
if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0])
{
lastmapname = Bstrrchr(boardfilename,'\\');
if (!lastmapname) lastmapname = Bstrrchr(boardfilename,'/');
if (!lastmapname) lastmapname = boardfilename;
}
else
{
lastmapname = MapInfo[(ud.volume_number*MAXLEVELS)+ud.last_level-1].name;
if (!lastmapname) // this isn't right but it's better than no name at all
lastmapname = MapInfo[(ud.m_volume_number*MAXLEVELS)+ud.last_level-1].name;
}
bonuscnt = 0;
fadepal(0,0,0, 0,63,7);
setview(0,0,xdim-1,ydim-1);
clearallviews(0L);
nextpage();
flushperms();
FX_StopAllSounds();
S_ClearSoundLocks();
FX_SetReverb(0L);
CONTROL_BindsEnabled = 1; // so you can use your screenshot bind on the score screens
if (bonusonly) goto FRAGBONUS;
if (numplayers < 2 && ud.eog && ud.from_bonus == 0)
switch (ud.volume_number)
{
case 0:
@ -11241,12 +11205,11 @@ void G_BonusScreen(int32_t bonusonly)
clearallviews(0L);
rotatesprite_fs(0,50<<16,65536L,0,VICTORY1,0,0,2+8+16+64+128+(ud.bgstretch?1024:0));
nextpage();
//g_player[myconnectindex].ps->palette = endingpal;
fadepal(0,0,0, 63,0,-1);
I_ClearAllInput();
totalclock = 0;
// tinc = 0;
while (1)
{
clearallviews(0L);
@ -11301,7 +11264,6 @@ void G_BonusScreen(int32_t bonusonly)
I_ClearAllInput();
I_ClearInputWaiting();
//g_player[myconnectindex].ps->palette = palette;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
rotatesprite_fs(0,0,65536L,0,3292,0,0,2+8+16+64+(ud.bgstretch?1024:0));
@ -11331,7 +11293,6 @@ void G_BonusScreen(int32_t bonusonly)
fadepal(0,0,0, 0,63,1);
setview(0,0,xdim-1,ydim-1);
I_ClearInputWaiting();
//g_player[myconnectindex].ps->palette = palette;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
rotatesprite_fs(0,0,65536L,0,3293,0,0,2+8+16+64+(ud.bgstretch?1024:0));
fadepal(0,0,0, 63,0,-1);
@ -11366,7 +11327,6 @@ void G_BonusScreen(int32_t bonusonly)
S_PlaySound(ENDSEQVOL3SND4);
I_ClearInputWaiting();
//g_player[myconnectindex].ps->palette = palette;
G_FadePalette(0,0,0,0);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
// G_FadePalette(0,0,0,63);
@ -11475,14 +11435,58 @@ ENDANM:
break;
}
}
void G_BonusScreen(int32_t bonusonly)
{
int32_t gfx_offset;
int32_t i, y;
int32_t bonuscnt;
int32_t clockpad = 2;
char *lastmapname;
int32_t playerbest = -1;
if (g_networkMode == NET_DEDICATED_SERVER)
return;
Bsprintf(tempbuf, "%s - " APPNAME, g_gameNamePtr);
wm_setapptitle(tempbuf);
if (ud.volume_number == 0 && ud.last_level == 8 && boardfilename[0])
{
lastmapname = Bstrrchr(boardfilename,'\\');
if (!lastmapname) lastmapname = Bstrrchr(boardfilename,'/');
if (!lastmapname) lastmapname = boardfilename;
}
else
{
lastmapname = MapInfo[(ud.volume_number*MAXLEVELS)+ud.last_level-1].name;
if (!lastmapname) // this isn't right but it's better than no name at all
lastmapname = MapInfo[(ud.m_volume_number*MAXLEVELS)+ud.last_level-1].name;
}
fadepal(0,0,0, 0,63,7);
setview(0,0,xdim-1,ydim-1);
clearallviews(0L);
nextpage();
flushperms();
FX_StopAllSounds();
S_ClearSoundLocks();
FX_SetReverb(0L);
CONTROL_BindsEnabled = 1; // so you can use your screenshot bind on the score screens
if (bonusonly)
goto FRAGBONUS;
G_BonusCutscenes();
FRAGBONUS:
//g_player[myconnectindex].ps->palette = palette;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 8+2+1); // JBF 20040308
G_FadePalette(0,0,0,63); // JBF 20031228
KB_FlushKeyboardQueue();
totalclock = 0;
// tinc = 0;
bonuscnt = 0;
S_StopMusic();
@ -11491,6 +11495,8 @@ FRAGBONUS:
if (playerswhenstarted > 1 && (GametypeFlags[ud.coop]&GAMETYPE_SCORESHEET))
{
int32_t t;
if (!(ud.config.MusicToggle == 0 || ud.config.MusicDevice < 0))
S_PlaySound(BONUSMUSIC);
@ -11513,7 +11519,7 @@ FRAGBONUS:
for (i=0; i<playerswhenstarted; i++)
{
xfragtotal = 0;
int32_t xfragtotal = 0;
Bsprintf(tempbuf,"%d",i+1);
minitext(30,90+t,tempbuf,0,2+8+16+128);
@ -11543,7 +11549,7 @@ FRAGBONUS:
for (y=0; y<playerswhenstarted; y++)
{
yfragtotal = 0;
int32_t yfragtotal = 0;
for (i=0; i<playerswhenstarted; i++)
{
if (i == y)
@ -11578,16 +11584,7 @@ FRAGBONUS:
if (bonusonly || (g_netServer || ud.multimode > 1)) return;
switch (ud.volume_number)
{
case 1:
gfx_offset = 5;
break;
default:
gfx_offset = 0;
break;
}
gfx_offset = (ud.volume_number==1) ? 5 : 0;
rotatesprite_fs(0,0,65536L,0,BONUSSCREEN+gfx_offset,0,0,2+8+16+64+128+(ud.bgstretch?1024:0));
if (lastmapname)
@ -11604,7 +11601,6 @@ FRAGBONUS:
fadepal(0,0,0, 63,0,-1);
bonuscnt = 0;
totalclock = 0;
// tinc = 0;
playerbest = CONFIG_GetMapBestTime(MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].filename);
@ -11644,7 +11640,7 @@ FRAGBONUS:
rotatesprite_fs(0,0,65536L,0,BONUSSCREEN+gfx_offset,0,0,2+8+16+64+128+(ud.bgstretch?1024:0));
if (totalclock > (1000000000L) && totalclock < (1000000320L))
if (totalclock > 1000000000 && totalclock < 1000000320)
{
switch ((totalclock>>4)%15)
{
@ -11865,8 +11861,8 @@ FRAGBONUS:
KB_FlushKeyboardQueue();
totalclock = (60*13);
}
else if (totalclock < (1000000000L))
totalclock = (1000000000L);
else if (totalclock < 1000000000)
totalclock = 1000000000;
}
}
else

View file

@ -1130,7 +1130,7 @@ end
function _endofgame(pli, timebeforeexit)
player[pli].timebeforeexit = timebeforeexit
player[pli].customexitsound = -1
player[pli]:set_customexitsound(-1)
ffiC.ud.eog = 1
end

View file

@ -1043,7 +1043,9 @@ local player_mt = {
end,
set_customexitsound = function(p, soundnum)
if (soundnum >= 0) then
check_sound_idx(soundnum)
end
ffi.cast(player_ptr_ct, p).customexitsound = soundnum
end,

View file

@ -47,7 +47,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TEST_SYNC_KEY(bits, sync_num) TEST(bits, BIT(sync_num))
#define IFWITHIN(B,E) if ((PN)>=(B) && (PN)<=(E))
#define AFLAMABLE(X) (X==BOX||X==TREE1||X==TREE2||X==TIRE||X==CONE)
#define rnd(X) ((krand()>>8)>=(255-(X)))