mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Replace outer apScriptGameEvent[...] checks with G_HaveEvent().
git-svn-id: https://svn.eduke32.com/eduke32@3266 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
99f56fd295
commit
9d2260c3c8
7 changed files with 36 additions and 26 deletions
|
@ -477,7 +477,7 @@ void A_DeleteSprite(int32_t s)
|
|||
return;
|
||||
}
|
||||
|
||||
if (apScriptGameEvent[EVENT_KILLIT])
|
||||
if (G_HaveEvent(EVENT_KILLIT))
|
||||
{
|
||||
int32_t p, pl=A_FindPlayer(&sprite[s],&p);
|
||||
|
||||
|
@ -8199,7 +8199,7 @@ void G_MoveWorld(void)
|
|||
{
|
||||
int32_t j = nextspritestat[i];
|
||||
|
||||
if (!apScriptGameEvent[EVENT_PREGAME] || A_CheckSpriteFlags(i, SPRITE_NOEVENTCODE))
|
||||
if (!G_HaveEvent(EVENT_PREGAME) || A_CheckSpriteFlags(i, SPRITE_NOEVENTCODE))
|
||||
{
|
||||
i = j;
|
||||
continue;
|
||||
|
@ -8246,7 +8246,7 @@ void G_MoveWorld(void)
|
|||
if (getrendermode() == 4)
|
||||
A_DoLight(i);
|
||||
#endif
|
||||
if (!apScriptGameEvent[EVENT_GAME] || A_CheckSpriteFlags(i, SPRITE_NOEVENTCODE))
|
||||
if (!G_HaveEvent(EVENT_GAME) || A_CheckSpriteFlags(i, SPRITE_NOEVENTCODE))
|
||||
{
|
||||
i = j;
|
||||
continue;
|
||||
|
|
|
@ -131,6 +131,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "gameexec.h"
|
||||
#include "gamevars.h"
|
||||
|
||||
#ifdef LUNATIC
|
||||
# include "lunatic_game.h"
|
||||
#endif
|
||||
|
||||
static inline int32_t G_HaveEvent(int32_t iEventID)
|
||||
{
|
||||
return
|
||||
#ifdef LUNATIC
|
||||
El_HaveEvent(iEventID) ||
|
||||
#endif
|
||||
apScriptGameEvent[iEventID]!=NULL;
|
||||
}
|
||||
|
||||
#ifdef EXTERNC
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -2871,10 +2871,7 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef LUNATIC
|
||||
// TODO: get rid of the other outer apScriptGameEvent checks, too
|
||||
if (apScriptGameEvent[EVENT_DISPLAYREST])
|
||||
#endif
|
||||
if (G_HaveEvent(EVENT_DISPLAYREST))
|
||||
{
|
||||
int32_t vr=viewingrange, asp=yxaspect;
|
||||
VM_OnEvent(EVENT_DISPLAYREST, g_player[screenpeek].ps->i, screenpeek, -1, 0);
|
||||
|
@ -3141,7 +3138,7 @@ void G_DrawBackground(void)
|
|||
#define MENUTILE (!getrendermode()?MENUSCREEN:LOADSCREEN)
|
||||
// Gv_SetVar(g_iReturnVarID,tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?MENUTILE:BIGHOLE, -1, -1);
|
||||
bgtile = (tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?MENUTILE:BIGHOLE);
|
||||
if (apScriptGameEvent[EVENT_GETMENUTILE])
|
||||
if (G_HaveEvent(EVENT_GETMENUTILE))
|
||||
bgtile = VM_OnEvent(EVENT_GETMENUTILE, -1, myconnectindex, -1, bgtile);
|
||||
if (Gv_GetVarByLabel("MENU_TILE", tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?0:1, -1, -1))
|
||||
{
|
||||
|
@ -3725,7 +3722,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
|
|||
dont_draw = 0;
|
||||
// NOTE: might be rendering off-screen here, so CON commands that draw stuff
|
||||
// like showview must cope with that situation or bail out!
|
||||
if (apScriptGameEvent[EVENT_DISPLAYROOMS])
|
||||
if (G_HaveEvent(EVENT_DISPLAYROOMS))
|
||||
dont_draw = VM_OnEvent(EVENT_DISPLAYROOMS, g_player[screenpeek].ps->i, screenpeek, -1, 0);
|
||||
|
||||
ud.camerahoriz = clamp(ud.camerahoriz, HORIZ_MIN, HORIZ_MAX);
|
||||
|
@ -4014,7 +4011,7 @@ int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int3
|
|||
|
||||
A_ResetVars(i);
|
||||
|
||||
if (apScriptGameEvent[EVENT_EGS])
|
||||
if (G_HaveEvent(EVENT_EGS))
|
||||
{
|
||||
extern int32_t block_deletesprite;
|
||||
int32_t pl=A_FindPlayer(s, &p);
|
||||
|
@ -5802,7 +5799,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
|
|||
OSD_Printf_nowarn(OSD_ERROR "Found lonely Sector Effector (lotag 0) at (%d,%d)\n",
|
||||
TrackerCast(sp->x),TrackerCast(sp->y));
|
||||
changespritestat(i, STAT_ACTOR);
|
||||
if (apScriptGameEvent[EVENT_SPAWN])
|
||||
if (G_HaveEvent(EVENT_SPAWN))
|
||||
{
|
||||
int32_t pl=A_FindPlayer(&sprite[i],&p);
|
||||
VM_OnEvent(EVENT_SPAWN,i, pl, p, 0);
|
||||
|
@ -6033,7 +6030,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
|
|||
}
|
||||
|
||||
SPAWN_END:
|
||||
if (apScriptGameEvent[EVENT_SPAWN])
|
||||
if (G_HaveEvent(EVENT_SPAWN))
|
||||
{
|
||||
int32_t pl=A_FindPlayer(&sprite[i],&p);
|
||||
VM_OnEvent(EVENT_SPAWN,i, pl, p, 0);
|
||||
|
@ -7008,7 +7005,7 @@ skip:
|
|||
*/
|
||||
}
|
||||
|
||||
if (apScriptGameEvent[EVENT_ANIMATESPRITES])
|
||||
if (G_HaveEvent(EVENT_ANIMATESPRITES))
|
||||
{
|
||||
for (j = spritesortcnt-1; j>=0; j--)
|
||||
G_DoEventAnimSprites(j);
|
||||
|
|
|
@ -97,7 +97,7 @@ extern int32_t voting;
|
|||
|
||||
void M_ChangeMenu(int32_t cm)
|
||||
{
|
||||
if (apScriptGameEvent[EVENT_CHANGEMENU])
|
||||
if (G_HaveEvent(EVENT_CHANGEMENU))
|
||||
cm = VM_OnEvent(EVENT_CHANGEMENU, g_player[myconnectindex].ps->i, myconnectindex, -1, cm);
|
||||
|
||||
if (cm >= 0)
|
||||
|
@ -851,7 +851,7 @@ void M_DisplayMenus(void)
|
|||
walock[TILE_LOADSHOT] = 1;
|
||||
return;
|
||||
}
|
||||
if (apScriptGameEvent[EVENT_DISPLAYMENU])
|
||||
if (G_HaveEvent(EVENT_DISPLAYMENU))
|
||||
VM_OnEvent(EVENT_DISPLAYMENU, g_player[screenpeek].ps->i, screenpeek, -1, 0);
|
||||
|
||||
g_player[myconnectindex].ps->gm &= (0xff-MODE_TYPE);
|
||||
|
@ -5412,7 +5412,7 @@ VOLUME_ALL_40x:
|
|||
|
||||
break;
|
||||
}
|
||||
if (apScriptGameEvent[EVENT_DISPLAYMENUREST])
|
||||
if (G_HaveEvent(EVENT_DISPLAYMENUREST))
|
||||
VM_OnEvent(EVENT_DISPLAYMENUREST, g_player[screenpeek].ps->i, screenpeek, -1, 0);
|
||||
|
||||
if (I_EscapeTrigger())
|
||||
|
|
|
@ -342,7 +342,7 @@ static int32_t GetAutoAimAngle(int32_t i, int32_t p, int32_t atwith,
|
|||
|
||||
Gv_SetVar(g_iAimAngleVarID, AUTO_AIM_ANGLE, i, p);
|
||||
|
||||
if (apScriptGameEvent[EVENT_GETAUTOAIMANGLE])
|
||||
if (G_HaveEvent(EVENT_GETAUTOAIMANGLE))
|
||||
VM_OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1, 0);
|
||||
|
||||
j = -1;
|
||||
|
@ -674,7 +674,7 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
|
|||
Gv_SetVar(g_iAngRangeVarID,angRange, i,p);
|
||||
Gv_SetVar(g_iZRangeVarID,zRange,i,p);
|
||||
|
||||
if (apScriptGameEvent[EVENT_GETSHOTRANGE])
|
||||
if (G_HaveEvent(EVENT_GETSHOTRANGE))
|
||||
VM_OnEvent(EVENT_GETSHOTRANGE, i,p, -1, 0);
|
||||
|
||||
angRange=Gv_GetVar(g_iAngRangeVarID,i,p);
|
||||
|
@ -1209,7 +1209,7 @@ DOSKIPBULLETHOLE:
|
|||
Gv_SetVar(g_iAngRangeVarID,angRange, i,p);
|
||||
Gv_SetVar(g_iZRangeVarID,zRange,i,p);
|
||||
|
||||
if (apScriptGameEvent[EVENT_GETSHOTRANGE])
|
||||
if (G_HaveEvent(EVENT_GETSHOTRANGE))
|
||||
VM_OnEvent(EVENT_GETSHOTRANGE, i,p, -1, 0);
|
||||
|
||||
angRange=Gv_GetVar(g_iAngRangeVarID,i,p);
|
||||
|
@ -3089,10 +3089,10 @@ void getinput(int32_t snum)
|
|||
loc.extbits |= (BUTTON(gamefunc_Strafe_Left) || (svel > 0))<<2;
|
||||
loc.extbits |= (BUTTON(gamefunc_Strafe_Right) || (svel < 0))<<3;
|
||||
|
||||
if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_TURNLEFT])
|
||||
if (G_HaveEvent(EVENT_PROCESSINPUT) || G_HaveEvent(EVENT_TURNLEFT))
|
||||
loc.extbits |= BUTTON(gamefunc_Turn_Left)<<4;
|
||||
|
||||
if (apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_TURNRIGHT])
|
||||
if (G_HaveEvent(EVENT_PROCESSINPUT) || G_HaveEvent(EVENT_TURNRIGHT))
|
||||
loc.extbits |= BUTTON(gamefunc_Turn_Right)<<5;
|
||||
|
||||
// used for changing team
|
||||
|
@ -3382,7 +3382,7 @@ void P_ChangeWeapon(DukePlayer_t *p,int32_t weapon)
|
|||
|
||||
if (p->reloading) return;
|
||||
|
||||
if (p->curr_weapon != weapon && apScriptGameEvent[EVENT_CHANGEWEAPON])
|
||||
if (p->curr_weapon != weapon && G_HaveEvent(EVENT_CHANGEWEAPON))
|
||||
i = VM_OnEvent(EVENT_CHANGEWEAPON,p->i, snum, -1, weapon);
|
||||
|
||||
if (i == -1)
|
||||
|
@ -3898,7 +3898,7 @@ void P_ProcessWeapon(int32_t snum)
|
|||
|
||||
if (VM_OnEvent(EVENT_FIRE, p->i, snum, -1, 0) == 0)
|
||||
{
|
||||
if (apScriptGameEvent[EVENT_FIREWEAPON]) // this event is deprecated
|
||||
if (G_HaveEvent(EVENT_FIREWEAPON)) // this event is deprecated
|
||||
VM_OnEvent(EVENT_FIREWEAPON, p->i, snum, -1, 0);
|
||||
|
||||
switch (aplWeaponWorksLike[p->curr_weapon][snum])
|
||||
|
|
|
@ -716,7 +716,7 @@ void P_ResetPlayer(int32_t snum)
|
|||
|
||||
pl->movement_lock = 0;
|
||||
|
||||
if (apScriptGameEvent[EVENT_RESETPLAYER])
|
||||
if (G_HaveEvent(EVENT_RESETPLAYER))
|
||||
VM_OnEvent(EVENT_RESETPLAYER, pl->i, snum, -1, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -542,7 +542,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
|
|||
const DukePlayer_t *const myps = g_player[myconnectindex].ps;
|
||||
const DukePlayer_t *peekps;
|
||||
|
||||
if (apScriptGameEvent[EVENT_SOUND])
|
||||
if (G_HaveEvent(EVENT_SOUND))
|
||||
num = VM_OnEvent(EVENT_SOUND, i, screenpeek, -1, num);
|
||||
|
||||
if ((unsigned)num > (unsigned)g_maxSoundPos ||
|
||||
|
@ -682,7 +682,7 @@ int32_t S_PlaySound(int32_t num)
|
|||
int32_t pitch;
|
||||
int32_t voice, j;
|
||||
|
||||
if (apScriptGameEvent[EVENT_SOUND])
|
||||
if (G_HaveEvent(EVENT_SOUND))
|
||||
num = VM_OnEvent(EVENT_SOUND, g_player[screenpeek].ps->i, screenpeek, -1, num);
|
||||
|
||||
if (ud.config.FXDevice < 0) return -1;
|
||||
|
|
Loading…
Reference in a new issue