mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
more demo control + sound access for m32script
git-svn-id: https://svn.eduke32.com/eduke32@1538 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
784e919941
commit
73d0b92d92
7 changed files with 204 additions and 45 deletions
|
@ -370,6 +370,26 @@ onevent EVENT_ANALYZESPRITES
|
|||
endevent
|
||||
|
||||
onevent EVENT_KEYS3D
|
||||
// door sound tester
|
||||
ife searchstat 0
|
||||
ifholdkey KEY_SPACE
|
||||
{
|
||||
set k wall[searchwall].nextsector
|
||||
ifl k 0 set k searchsector
|
||||
|
||||
ife sector[k].lotag 0 return
|
||||
|
||||
for i spritesofsector k
|
||||
{
|
||||
ifactor MUSICANDSFX
|
||||
ifge .lotag 0 ifl .lotag MAXSOUNDS
|
||||
{
|
||||
getsoundflags .lotag m
|
||||
ifand m 1 nullop else soundonce .lotag
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// swinging doors tester -- hit space on a door wall
|
||||
ife searchstat 0
|
||||
ifhitkey KEY_SPACE // SE11 ST23 up:ccw
|
||||
|
|
|
@ -100,6 +100,8 @@ static char *rtsptr;
|
|||
extern int32_t numlumps;
|
||||
|
||||
static FILE *frecfilep = (FILE *)NULL;
|
||||
static int32_t demo_goalreccnt=0, demo_startreccnt=0, demo_oldsoundtoggle, demo_showstats=1;
|
||||
static int32_t demo_paused=0;
|
||||
|
||||
int32_t g_restorePalette, g_screenCapture;
|
||||
static int32_t g_noLogoAnim = 0;
|
||||
|
@ -3766,7 +3768,7 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
extern int32_t mdpause;
|
||||
|
||||
mdpause = 0;
|
||||
if (ud.pause_on || (g_player[myconnectindex].ps->gm&MODE_MENU && numplayers < 2))
|
||||
if (ud.pause_on || (ud.recstat==2 && (demo_paused && demo_goalreccnt==0)) || (g_player[myconnectindex].ps->gm&MODE_MENU && numplayers < 2))
|
||||
mdpause = 1;
|
||||
}
|
||||
#endif
|
||||
|
@ -8113,8 +8115,6 @@ static void G_ShowScores(void)
|
|||
|
||||
#undef SCORESHEETOFFSET
|
||||
|
||||
static int32_t demo_goalreccnt=0, demo_startreccnt=0, demo_oldsoundtoggle, demo_showstats=1;
|
||||
|
||||
static void G_HandleLocalKeys(void)
|
||||
{
|
||||
int32_t i,ch;
|
||||
|
@ -8236,6 +8236,12 @@ static void G_HandleLocalKeys(void)
|
|||
|
||||
if (ud.recstat == 2)
|
||||
{
|
||||
if (KB_KeyPressed(sc_Space))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Space);
|
||||
demo_paused = !demo_paused;
|
||||
}
|
||||
|
||||
if (KB_KeyPressed(sc_Tab))
|
||||
{
|
||||
KB_ClearKeyDown(sc_Tab);
|
||||
|
@ -8271,11 +8277,11 @@ static void G_HandleLocalKeys(void)
|
|||
{
|
||||
KB_ClearKeyDown(sc_kpad_6);
|
||||
j = ALT_IS_PRESSED ? 30 : 10;
|
||||
demo_goalreccnt = ud.reccnt-(TICRATE/TICSPERFRAME)*ud.multimode*j;
|
||||
demo_goalreccnt = demo_paused ? ud.reccnt-ud.multimode : ud.reccnt-(TICRATE/TICSPERFRAME)*ud.multimode*j;
|
||||
demo_oldsoundtoggle = ud.config.SoundToggle;
|
||||
|
||||
j=(demo_startreccnt-ud.reccnt)/(ud.multimode*(TICRATE/TICSPERFRAME));
|
||||
OSD_Printf(" FF %d s from %02d:%02d\n", ALT_IS_PRESSED ? 30 : 10, j/60, j%60);
|
||||
// j=(demo_startreccnt-ud.reccnt)/(ud.multimode*(TICRATE/TICSPERFRAME));
|
||||
// OSD_Printf(" FF %d s from %02d:%02d\n", ALT_IS_PRESSED ? 30 : 10, j/60, j%60);
|
||||
|
||||
if (demo_goalreccnt <= 0)
|
||||
demo_goalreccnt = 0;
|
||||
|
@ -8285,16 +8291,17 @@ static void G_HandleLocalKeys(void)
|
|||
FX_StopAllSounds();
|
||||
S_ClearSoundLocks();
|
||||
}
|
||||
|
||||
}
|
||||
else if (KB_KeyPressed(sc_kpad_4))
|
||||
{
|
||||
KB_ClearKeyDown(sc_kpad_4);
|
||||
j = ALT_IS_PRESSED ? 30 : 10;
|
||||
demo_goalreccnt = ud.reccnt+(TICRATE/(TICRATE/GAMETICSPERSEC))*ud.multimode*j;
|
||||
demo_goalreccnt = demo_paused ? ud.reccnt+ud.multimode : ud.reccnt+(TICRATE/TICSPERFRAME)*ud.multimode*j;
|
||||
demo_oldsoundtoggle = ud.config.SoundToggle;
|
||||
|
||||
j=(demo_startreccnt-ud.reccnt)/(ud.multimode*TICRATE/(TICRATE/GAMETICSPERSEC));
|
||||
OSD_Printf(" RW %d s from %02d:%02d\n", ALT_IS_PRESSED ? 30 : 10, j/60, j%60);
|
||||
// j=(demo_startreccnt-ud.reccnt)/(ud.multimode*TICRATE/TICSPERFRAME);
|
||||
// OSD_Printf(" RW %d s from %02d:%02d\n", ALT_IS_PRESSED ? 30 : 10, j/60, j%60);
|
||||
|
||||
if (demo_goalreccnt > demo_startreccnt)
|
||||
demo_goalreccnt = demo_startreccnt;
|
||||
|
@ -8304,6 +8311,21 @@ static void G_HandleLocalKeys(void)
|
|||
FX_StopAllSounds();
|
||||
S_ClearSoundLocks();
|
||||
}
|
||||
|
||||
#if 0
|
||||
// just what is wrong with that?
|
||||
if (KB_KeyPressed(sc_Return) && ud.multimode==1)
|
||||
{
|
||||
KB_ClearKeyDown(sc_Return);
|
||||
ud.reccnt = 0;
|
||||
ud.recstat = 0;
|
||||
// kclose(recfilep);
|
||||
g_player[myconnectindex].ps->gm = MODE_GAME;
|
||||
ready2send=0;
|
||||
screenpeek=myconnectindex;
|
||||
demo_paused=0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (SHIFTS_IS_PRESSED || ALT_IS_PRESSED)
|
||||
|
@ -11550,10 +11572,24 @@ RECHECK:
|
|||
|
||||
while (ud.reccnt > 0 || foundemo == 0)
|
||||
{
|
||||
if (foundemo)
|
||||
if (foundemo && (!demo_paused || demo_goalreccnt!=0))
|
||||
{
|
||||
while (totalclock >= (lockclock+TICSPERFRAME) ||
|
||||
(demo_goalreccnt>0 && demo_goalreccnt<ud.reccnt))
|
||||
if (demo_goalreccnt < 0)
|
||||
{
|
||||
demo_goalreccnt = -demo_goalreccnt;
|
||||
|
||||
if (g_whichDemo > 1) // load the same demo again and FF from beginning... yay!
|
||||
g_whichDemo--;
|
||||
foundemo = 0;
|
||||
ud.reccnt = 0;
|
||||
kclose(recfilep);
|
||||
premap_quickenterlevel=1;
|
||||
goto RECHECK;
|
||||
}
|
||||
|
||||
while (totalclock >= (lockclock+TICSPERFRAME)
|
||||
|| (ud.reccnt > (TICRATE/TICSPERFRAME)*2 && ud.pause_on)
|
||||
|| (demo_goalreccnt>0 && demo_goalreccnt<ud.reccnt))
|
||||
{
|
||||
if ((i == 0) || (i >= RECSYNCBUFSIZ))
|
||||
{
|
||||
|
@ -11582,22 +11618,9 @@ RECHECK:
|
|||
|
||||
if (demo_goalreccnt > 0)
|
||||
{
|
||||
if (demo_goalreccnt<ud.reccnt)
|
||||
if (demo_goalreccnt<ud.reccnt || (ud.reccnt > (TICRATE/TICSPERFRAME)*2 && ud.pause_on))
|
||||
totalclock += TICSPERFRAME;
|
||||
}
|
||||
else if (demo_goalreccnt < 0)
|
||||
{
|
||||
demo_goalreccnt = -demo_goalreccnt;
|
||||
|
||||
if (g_whichDemo > 1) // load the same demo again and FF from beginning... yay!
|
||||
g_whichDemo--;
|
||||
foundemo = 0;
|
||||
ud.reccnt = 0;
|
||||
kclose(recfilep);
|
||||
premap_quickenterlevel=1;
|
||||
goto RECHECK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (demo_goalreccnt > 0 && ud.reccnt<=demo_goalreccnt)
|
||||
|
@ -11607,6 +11630,10 @@ RECHECK:
|
|||
premap_quickenterlevel = 0;
|
||||
}
|
||||
}
|
||||
else if (foundemo && demo_paused && demo_goalreccnt==0)
|
||||
{
|
||||
lockclock = ototalclock = totalclock;
|
||||
}
|
||||
|
||||
if (foundemo == 0)
|
||||
G_DrawBackground();
|
||||
|
@ -11624,6 +11651,18 @@ RECHECK:
|
|||
j=(demo_startreccnt-ud.reccnt)/(TICRATE/TICSPERFRAME);
|
||||
Bsprintf(buf, "%02d:%02d", j/60, j%60);
|
||||
gametext(18,16,buf,0,2+8+16);
|
||||
|
||||
rotatesprite(60<<16,16<<16,32768,0,SLIDEBAR,0,0,2+8+16,0,0,(xdim*95)/320,ydim-1);
|
||||
rotatesprite(90<<16,16<<16,32768,0,SLIDEBAR,0,0,2+8+16,(xdim*95)/320,0,(xdim*125)/320,ydim-1);
|
||||
rotatesprite(120<<16,16<<16,32768,0,SLIDEBAR,0,0,2+8+16,(xdim*125)/320,0,(xdim*155)/320,ydim-1);
|
||||
rotatesprite(150<<16,16<<16,32768,0,SLIDEBAR,0,0,2+8+16,(xdim*155)/320,0,xdim-1,ydim-1);
|
||||
|
||||
j = (182<<16) - ((((120*ud.reccnt)<<4)/demo_startreccnt)<<12);
|
||||
rotatesprite(j,(16<<16)+(1<<15),32768,0,SLIDEBAR+1,0,0,2+8+16,0,0,xdim-1,ydim-1);
|
||||
|
||||
j=ud.reccnt/(TICRATE/TICSPERFRAME);
|
||||
Bsprintf(buf, "-%02d:%02d%s", j/60, j%60, demo_paused?" ^15PAUSED":"");
|
||||
gametext(194,16,buf,0,2+8+16);
|
||||
}
|
||||
|
||||
if (ud.multimode > 1 && g_player[myconnectindex].ps->gm)
|
||||
|
|
|
@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "m32script.h"
|
||||
#include "m32def.h"
|
||||
#include "cache1d.h"
|
||||
#include "sounds_mapster32.h"
|
||||
|
||||
//#include "osd.h"
|
||||
#include "keys.h"
|
||||
|
@ -292,6 +293,7 @@ const char *keyw[] =
|
|||
"ifangdiffl",
|
||||
"ifspritepal",
|
||||
"ifactor",
|
||||
"ifsound",
|
||||
"ifpdistl",
|
||||
"ifpdistg",
|
||||
|
||||
|
@ -305,6 +307,7 @@ const char *keyw[] =
|
|||
"ifonwater",
|
||||
"ifinwater",
|
||||
"ifoutside",
|
||||
"ifnosounds",
|
||||
|
||||
// BUILD functions
|
||||
"resetkey",
|
||||
|
@ -387,6 +390,13 @@ const char *keyw[] =
|
|||
"gettexturefloor",
|
||||
"gettextureceiling",
|
||||
|
||||
"sound", //var
|
||||
"soundonce", //var
|
||||
"stopallsounds",
|
||||
"stopsound", //var
|
||||
"globalsound", //var
|
||||
"getsoundflags",
|
||||
|
||||
/// "killit",
|
||||
|
||||
"drawline16",
|
||||
|
@ -2646,12 +2656,12 @@ repeatcase:
|
|||
case CON_IFANGDIFFL:
|
||||
case CON_IFSPRITEPAL:
|
||||
case CON_IFACTOR:
|
||||
case CON_IFSOUND:
|
||||
case CON_IFPDISTL:
|
||||
case CON_IFPDISTG:
|
||||
/// case CON_IFGAPZL:
|
||||
/// case CON_IFFLOORDISTL:
|
||||
/// case CON_IFCEILINGDISTL:
|
||||
/// case CON_IFSOUND:
|
||||
// ---
|
||||
case CON_IFINSIDE:
|
||||
// ---
|
||||
|
@ -2667,7 +2677,7 @@ repeatcase:
|
|||
/// case CON_IFINSPACE:
|
||||
/// case CON_IFINOUTERSPACE:
|
||||
/// case CON_IFCANSEETARGET:
|
||||
/// case CON_IFNOSOUNDS:
|
||||
case CON_IFNOSOUNDS:
|
||||
{
|
||||
ofstype offset;
|
||||
ofstype lastScriptOfs = (g_scriptPtr-script-1);
|
||||
|
@ -3022,6 +3032,7 @@ repeatcase:
|
|||
case CON_SECTGETHITAG:
|
||||
case CON_GETTEXTUREFLOOR:
|
||||
case CON_GETTEXTURECEILING:
|
||||
case CON_STOPALLSOUNDS:
|
||||
// no paramaters...
|
||||
return 0;
|
||||
|
||||
|
@ -3036,11 +3047,16 @@ repeatcase:
|
|||
break;
|
||||
|
||||
/// case CON_ANGOFF:
|
||||
/// case CON_SOUND:
|
||||
/// case CON_GLOBALSOUND:
|
||||
/// case CON_SOUNDONCE:
|
||||
/// case CON_STOPSOUND:
|
||||
|
||||
case CON_GETSOUNDFLAGS:
|
||||
C_GetNextVar();
|
||||
C_GetNextVarType(GAMEVAR_READONLY);
|
||||
break;
|
||||
|
||||
case CON_SOUNDVAR:
|
||||
case CON_STOPSOUNDVAR:
|
||||
case CON_SOUNDONCEVAR:
|
||||
case CON_GLOBALSOUNDVAR:
|
||||
case CON_CSTATOR:
|
||||
case CON_SPRITEPAL:
|
||||
case CON_CACTOR:
|
||||
|
@ -3131,6 +3147,7 @@ static void C_AddDefaultDefinitions(void)
|
|||
C_AddDefinition("MAXWALLS", MAXWALLS, LABEL_DEFINE);
|
||||
C_AddDefinition("MAXTILES", MAXTILES, LABEL_DEFINE);
|
||||
C_AddDefinition("MAXSTATUS", MAXSTATUS, LABEL_DEFINE);
|
||||
C_AddDefinition("MAXSOUNDS", MAXSOUNDS, LABEL_DEFINE);
|
||||
|
||||
// keys
|
||||
C_AddDefinition("KEY_SPACE", KEYSC_SPACE, LABEL_DEFINE);
|
||||
|
|
|
@ -364,12 +364,12 @@ enum ScriptKeywords_t
|
|||
CON_IFANGDIFFL,
|
||||
CON_IFSPRITEPAL,
|
||||
CON_IFACTOR,
|
||||
CON_IFSOUND,
|
||||
CON_IFPDISTL,
|
||||
CON_IFPDISTG,
|
||||
/// CON_IFGAPZL,
|
||||
/// CON_IFFLOORDISTL,
|
||||
/// CON_IFCEILINGDISTL,
|
||||
/// CON_IFSOUND,
|
||||
|
||||
CON_IFINSIDE,
|
||||
|
||||
|
@ -385,7 +385,7 @@ enum ScriptKeywords_t
|
|||
/// CON_IFINSPACE,
|
||||
/// CON_IFINOUTERSPACE,
|
||||
/// CON_IFCANSEETARGET,
|
||||
/// CON_IFNOSOUNDS,
|
||||
CON_IFNOSOUNDS,
|
||||
|
||||
// BUILD functions
|
||||
CON_RESETKEY,
|
||||
|
@ -476,15 +476,16 @@ enum ScriptKeywords_t
|
|||
// left to define later/undecided
|
||||
|
||||
// sound
|
||||
CON_SOUNDVAR,
|
||||
CON_SOUNDONCEVAR,
|
||||
CON_STOPALLSOUNDS,
|
||||
CON_STOPSOUNDVAR,
|
||||
CON_GLOBALSOUNDVAR,
|
||||
CON_GETSOUNDFLAGS,
|
||||
/// CON_SOUND,
|
||||
/// CON_SOUNDVAR,
|
||||
/// CON_SOUNDONCE,
|
||||
/// CON_STOPSOUND,
|
||||
/// CON_GLOBALSOUND,
|
||||
/// CON_SOUNDONCEVAR,
|
||||
/// CON_STOPALLSOUNDS,
|
||||
/// CON_STOPSOUNDVAR,
|
||||
/// CON_GLOBALSOUNDVAR,
|
||||
|
||||
// drawing
|
||||
/// CON_MYOS,
|
||||
|
|
|
@ -28,6 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "m32script.h"
|
||||
#include "m32def.h"
|
||||
#include "macros.h"
|
||||
#include "sounds_mapster32.h"
|
||||
#include "fx_man.h"
|
||||
//#include "scriplib.h"
|
||||
|
||||
//#include "osdcmds.h"
|
||||
|
@ -2559,6 +2561,89 @@ dodefault:
|
|||
}
|
||||
continue;
|
||||
|
||||
// *** sounds
|
||||
case CON_IFSOUND:
|
||||
insptr++;
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*insptr);
|
||||
if (j<0 || j>=MAXSOUNDS)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j);
|
||||
vm.flags |= VMFLAG_ERROR;
|
||||
insptr++;
|
||||
continue;
|
||||
}
|
||||
X_DoConditional(S_CheckSoundPlaying(vm.g_i,j));
|
||||
}
|
||||
continue;
|
||||
|
||||
case CON_IFNOSOUNDS:
|
||||
{
|
||||
int32_t j = MAXSOUNDS-1;
|
||||
for (; j>=0; j--)
|
||||
if (g_sounds[j].SoundOwner[0].i == vm.g_i)
|
||||
break;
|
||||
|
||||
X_DoConditional(j < 0);
|
||||
}
|
||||
continue;
|
||||
|
||||
case CON_GETSOUNDFLAGS:
|
||||
insptr++;
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*insptr++), var=*insptr++;
|
||||
if (j<0 || j>=MAXSOUNDS)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j);
|
||||
vm.flags |= VMFLAG_ERROR;
|
||||
insptr++;
|
||||
continue;
|
||||
}
|
||||
|
||||
Gv_SetVarX(var, g_sounds[j].m);
|
||||
}
|
||||
continue;
|
||||
|
||||
case CON_SOUNDVAR:
|
||||
case CON_STOPSOUNDVAR:
|
||||
case CON_SOUNDONCEVAR:
|
||||
case CON_GLOBALSOUNDVAR:
|
||||
insptr++;
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
|
||||
if (j<0 || j>=MAXSOUNDS)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j);
|
||||
vm.flags |= VMFLAG_ERROR;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (tw)
|
||||
{
|
||||
case CON_SOUNDONCEVAR:
|
||||
if (!S_CheckSoundPlaying(vm.g_i,j))
|
||||
A_PlaySound((int16_t)j,vm.g_i);
|
||||
break;
|
||||
case CON_GLOBALSOUNDVAR:
|
||||
A_PlaySound((int16_t)j,-1);
|
||||
break;
|
||||
case CON_STOPSOUNDVAR:
|
||||
if (S_CheckSoundPlaying(vm.g_i,j))
|
||||
S_StopSound((int16_t)j);
|
||||
break;
|
||||
case CON_SOUNDVAR:
|
||||
A_PlaySound((int16_t)j,vm.g_i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
||||
case CON_STOPALLSOUNDS:
|
||||
insptr++;
|
||||
FX_StopAllSounds();
|
||||
continue;
|
||||
|
||||
default:
|
||||
X_ScriptInfo();
|
||||
|
||||
|
|
|
@ -48,10 +48,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
static char SM32_havesound = 0;
|
||||
|
||||
#pragma pack(push,1)
|
||||
extern sound_t g_sounds[MAXSOUNDS];
|
||||
#pragma pack(pop)
|
||||
|
||||
char SoundToggle = 1;
|
||||
int32_t NumVoices = 32;
|
||||
|
||||
|
|
|
@ -21,6 +21,9 @@ typedef struct {
|
|||
char *definedname; // new
|
||||
} sound_t;
|
||||
|
||||
#define MAXSOUNDS 2560
|
||||
extern sound_t g_sounds[MAXSOUNDS];
|
||||
|
||||
int32_t S_SoundStartup(void);
|
||||
void S_SoundShutdown(void);
|
||||
int32_t S_PlaySound3D(int32_t, int32_t, const vec3_t*);
|
||||
|
@ -35,6 +38,4 @@ void S_ClearSoundLocks(void);
|
|||
|
||||
#pragma pack(pop)
|
||||
|
||||
#define MAXSOUNDS 2560
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue