Addition of 3 events:

EVENT_SOUND: triggered upon playback of any sound, this allows the "hard coded" sounds to be altered in a context-aware fashion instead of having to resort to clunky hacks like replacing them with a blank sound effect.  RETURN var
iable is set to the sound effect # of the sound to be played, or -1 to cancel playback.

EVENT_CHECKTOUCHDAMAGE: triggered in P_CheckTouchDamage() whenever the player collides with anything.  Value of RET
URN is set to the result provided by clipmove() and so can be decoded in the same way.  Value of RETURN when the event is over can also be manipulated to control some of the hard coded damage effects.

EVENT_CHECKFLOORDAMAGE: triggered in P_CheckFloorDamage(), RETURN is simply the picnum of the floor of the sector t
he player is in.  Can be used to cancel hard coded floor damage effects or to make other tiles exhibit the same eff
ects

Other misc fixes and cleanups, including a possible workaround for Duke Plus SECTOREFFECTOR light issues wherein all SE49 and SE50 that have a statnum of STAT_EFFECTOR are simply changed to STAT_LIGHT during the STAT_EFFECTOR loop
 now.


git-svn-id: https://svn.eduke32.com/eduke32@2652 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2012-05-14 18:12:27 +00:00
parent 0b055de591
commit 4ba6da5007
13 changed files with 294 additions and 238 deletions

View file

@ -116,6 +116,7 @@
<ClInclude Include="source\gameexec.h" />
<ClInclude Include="source\gamevars.h" />
<ClInclude Include="source\global.h" />
<ClInclude Include="source\m32def.h" />
<ClInclude Include="source\menus.h" />
<ClInclude Include="source\net.h" />
<ClInclude Include="source\player.h" />

View file

@ -49,6 +49,12 @@
<Filter Include="jmact\source">
<UniqueIdentifier>{8a6aad55-a3bc-4e4f-a61d-4652c29d8b92}</UniqueIdentifier>
</Filter>
<Filter Include="eduke32\source\editor">
<UniqueIdentifier>{e8ea0b0a-e748-4c94-8d84-5062dd5b68a1}</UniqueIdentifier>
</Filter>
<Filter Include="eduke32\headers\editor">
<UniqueIdentifier>{3477e5cd-29a4-42b2-8c3f-ca4618242526}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="build\include\a.h">
@ -180,9 +186,6 @@
<ClInclude Include="source\macros.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
<ClInclude Include="source\mapster32.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
<ClInclude Include="source\mdump.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
@ -207,9 +210,6 @@
<ClInclude Include="source\sounds.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
<ClInclude Include="source\sounds_mapster32.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
<ClInclude Include="source\startwin.game.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
@ -357,6 +357,15 @@
<ClInclude Include="source\quotes.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
<ClInclude Include="source\m32def.h">
<Filter>eduke32\headers\editor</Filter>
</ClInclude>
<ClInclude Include="source\mapster32.h">
<Filter>eduke32\headers\editor</Filter>
</ClInclude>
<ClInclude Include="source\sounds_mapster32.h">
<Filter>eduke32\headers\editor</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="build\src\a-c.c">
@ -455,9 +464,6 @@
<ClCompile Include="source\anim.c">
<Filter>eduke32\source</Filter>
</ClCompile>
<ClCompile Include="source\astub.c">
<Filter>eduke32\source</Filter>
</ClCompile>
<ClCompile Include="source\config.c">
<Filter>eduke32\source</Filter>
</ClCompile>
@ -482,18 +488,6 @@
<ClCompile Include="source\grpscan.c">
<Filter>eduke32\source</Filter>
</ClCompile>
<ClCompile Include="source\m32def.c">
<Filter>eduke32\source</Filter>
</ClCompile>
<ClCompile Include="source\m32exec.c">
<Filter>eduke32\source</Filter>
</ClCompile>
<ClCompile Include="source\m32structures.c">
<Filter>eduke32\source</Filter>
</ClCompile>
<ClCompile Include="source\m32vars.c">
<Filter>eduke32\source</Filter>
</ClCompile>
<ClCompile Include="source\mdump.cpp">
<Filter>eduke32\source</Filter>
</ClCompile>
@ -539,9 +533,6 @@
<ClCompile Include="source\sounds.c">
<Filter>eduke32\source</Filter>
</ClCompile>
<ClCompile Include="source\sounds_mapster32.c">
<Filter>eduke32\source</Filter>
</ClCompile>
<ClCompile Include="source\startgtk.game.c">
<Filter>eduke32\source</Filter>
</ClCompile>
@ -641,6 +632,24 @@
<ClCompile Include="source\demo.c">
<Filter>eduke32\source</Filter>
</ClCompile>
<ClCompile Include="source\astub.c">
<Filter>eduke32\source\editor</Filter>
</ClCompile>
<ClCompile Include="source\m32def.c">
<Filter>eduke32\source\editor</Filter>
</ClCompile>
<ClCompile Include="source\m32exec.c">
<Filter>eduke32\source\editor</Filter>
</ClCompile>
<ClCompile Include="source\m32structures.c">
<Filter>eduke32\source\editor</Filter>
</ClCompile>
<ClCompile Include="source\m32vars.c">
<Filter>eduke32\source\editor</Filter>
</ClCompile>
<ClCompile Include="source\sounds_mapster32.c">
<Filter>eduke32\source\editor</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="Makefile.msvc">

View file

@ -824,7 +824,9 @@ ACTOR_STATIC void G_MoveZombieActors(void)
// j = 1;
if (j) switch (DYNAMICTILEMAP(s->picnum))
if (j)
{
switch (DynamicTileMap[s->picnum])
{
case RUBBERCAN__STATIC:
case EXPLODINGBARREL__STATIC:
@ -857,6 +859,7 @@ ACTOR_STATIC void G_MoveZombieActors(void)
changespritestat(i, STAT_ACTOR);
break;
}
}
else actor[i].timetosleep = 0;
}
}
@ -3537,10 +3540,10 @@ ACTOR_STATIC void G_MoveActors(void)
Bmemcpy(&actor[i].bposx, s, sizeof(vec3_t));
switchpicnum=s->picnum;
if ((s->picnum > GREENSLIME)&&(s->picnum <= GREENSLIME+7))
{
if ((s->picnum > GREENSLIME) && (s->picnum <= GREENSLIME+7))
switchpicnum = GREENSLIME;
}
switch (DYNAMICTILEMAP(switchpicnum))
{
@ -7625,6 +7628,10 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
A_SetSprite(k,CLIPMASK0);
}
break;
case 49:
case 50:
changespritestat(i, STAT_LIGHT);
break;
}
BOLT:
i = nexti;

View file

@ -661,6 +661,9 @@ const tokenlist EventNames[MAXEVENTS] =
{ "EVENT_DISPLAYLOADINGSCREEN", EVENT_DISPLAYLOADINGSCREEN },
{ "EVENT_ANIMATESPRITES", EVENT_ANIMATESPRITES },
{ "EVENT_NEWGAME", EVENT_NEWGAME },
{ "EVENT_SOUND", EVENT_SOUND },
{ "EVENT_CHECKTOUCHDAMAGE", EVENT_CHECKTOUCHDAMAGE },
{ "EVENT_CHECKFLOORDAMAGE", EVENT_CHECKFLOORDAMAGE }
};
const memberlabel_t SectorLabels[]=
@ -5823,8 +5826,8 @@ void C_Compile(const char *filenam)
if (script != NULL)
Bfree(script);
script = Bcalloc(1,g_scriptSize * sizeof(intptr_t));
bitptr = Bcalloc(1,(((g_scriptSize+7)>>3)+1) * sizeof(uint8_t));
script = (intptr_t *)Bcalloc(1,g_scriptSize * sizeof(intptr_t));
bitptr = (char *)Bcalloc(1,(((g_scriptSize+7)>>3)+1) * sizeof(uint8_t));
// initprintf("script: %d, bitptr: %d\n",script,bitptr);
g_numLabels = g_numDefaultLabels = 0;

View file

@ -105,6 +105,7 @@ void VM_OnEvent(register int32_t iEventID, register int32_t iActor, register int
{
intptr_t *oinsptr=insptr;
vmstate_t vm_backup;
vmstate_t tempvm = { iActor, iPlayer, lDist,
iActor >= 0 ? &actor[iActor].t_data[0] : NULL,
iActor >= 0 ? &sprite[iActor] : NULL,
@ -250,7 +251,9 @@ int32_t A_GetFurthestAngle(int32_t iActor,int32_t angs)
int32_t A_FurthestVisiblePoint(int32_t iActor,spritetype *ts,int32_t *dax,int32_t *day)
{
if ((actor[iActor].t_data[0]&63)) return -1;
if ((actor[iActor].t_data[0]&63))
return -1;
{
int32_t d, da;//, d, cd, ca,tempx,tempy,cx,cy;
int32_t j, angincs;
@ -377,9 +380,9 @@ void A_Fall(int32_t iActor)
#endif
if (s->z < actor[iActor].floorz-(ZOFFSET)
#ifdef YAX_ENABLE
|| (fbunch >= 0)
|| (fbunch >= 0)
#endif
)
)
{
if (sector[s->sectnum].lotag == 2 && s->zvel > 3122)
s->zvel = 3144;
@ -390,11 +393,11 @@ void A_Fall(int32_t iActor)
setspritez(iActor, (vec3_t *)s);
if (fbunch < 0)
#endif
if (s->z >= actor[iActor].floorz-(ZOFFSET))
{
s->z = actor[iActor].floorz - ZOFFSET;
s->zvel = 0;
}
if (s->z >= actor[iActor].floorz-(ZOFFSET))
{
s->z = actor[iActor].floorz - ZOFFSET;
s->zvel = 0;
}
}
int32_t G_GetAngleDelta(int32_t a,int32_t na)
@ -1177,8 +1180,8 @@ skip_check:
setspritez(vm.g_i, (vec3_t *)vm.g_sp);
else
#endif
if (vm.g_sp->z > (actor[vm.g_i].floorz - ZOFFSET))
vm.g_sp->z = (actor[vm.g_i].floorz - ZOFFSET);
if (vm.g_sp->z > (actor[vm.g_i].floorz - ZOFFSET))
vm.g_sp->z = (actor[vm.g_i].floorz - ZOFFSET);
continue;
}
vm.g_sp->z = actor[vm.g_i].floorz - ZOFFSET;
@ -1261,7 +1264,8 @@ skip_check:
if (((unsigned)*(++insptr) >= MAX_WEAPONS))
{
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr);
insptr += 2; break;
insptr += 2;
break;
}
if (g_player[vm.g_p].ps->ammo_amount[*insptr] >= g_player[vm.g_p].ps->max_ammo_amount[*insptr])
{
@ -3296,12 +3300,9 @@ nullquote:
continue;
case CON_IFRESPAWN:
if (A_CheckEnemySprite(vm.g_sp))
VM_CONDITIONAL(ud.respawn_monsters)
else if (A_CheckInventorySprite(vm.g_sp))
VM_CONDITIONAL(ud.respawn_inventory)
else
VM_CONDITIONAL(ud.respawn_items)
if (A_CheckEnemySprite(vm.g_sp)) VM_CONDITIONAL(ud.respawn_monsters)
else if (A_CheckInventorySprite(vm.g_sp)) VM_CONDITIONAL(ud.respawn_inventory)
else VM_CONDITIONAL(ud.respawn_items)
continue;
case CON_IFFLOORDISTL:
@ -3566,11 +3567,12 @@ nullquote:
if (tw == CON_FINDNEARACTOR || tw == CON_FINDNEARACTOR3D)
k = 1;
do
if (tw==CON_FINDNEARSPRITE3D || tw==CON_FINDNEARACTOR3D)
{
j=headspritestat[k]; // all sprites
if (tw==CON_FINDNEARSPRITE3D || tw==CON_FINDNEARACTOR3D)
do
{
j=headspritestat[k]; // all sprites
while (j>=0)
{
if (sprite[j].picnum == lType && j != vm.g_i && dist(&sprite[vm.g_i], &sprite[j]) < lMaxDist)
@ -3583,9 +3585,15 @@ nullquote:
}
if (j == MAXSPRITES || tw == CON_FINDNEARACTOR3D)
break;
continue;
}
while (k--);
Gv_SetVarX(lVarID, lFound);
continue;
}
do
{
j=headspritestat[k]; // all sprites
while (j>=0)
{
if (sprite[j].picnum == lType && j != vm.g_i && ldist(&sprite[vm.g_i], &sprite[j]) < lMaxDist)
@ -3622,11 +3630,12 @@ nullquote:
if (tw == CON_FINDNEARSPRITEVAR || tw == CON_FINDNEARSPRITE3DVAR)
k = MAXSTATUS-1;
do
if (tw==CON_FINDNEARACTOR3DVAR || tw==CON_FINDNEARSPRITE3DVAR)
{
j=headspritestat[k]; // all sprites
if (tw==CON_FINDNEARACTOR3DVAR || tw==CON_FINDNEARSPRITE3DVAR)
do
{
j=headspritestat[k]; // all sprites
while (j >= 0)
{
if (sprite[j].picnum == lType && j != vm.g_i && dist(&sprite[vm.g_i], &sprite[j]) < lMaxDist)
@ -3639,8 +3648,15 @@ nullquote:
}
if (j == MAXSPRITES || tw==CON_FINDNEARACTOR3DVAR)
break;
continue;
}
while (k--);
Gv_SetVarX(lVarID, lFound);
continue;
}
do
{
j=headspritestat[k]; // all sprites
while (j >= 0)
{
@ -4173,7 +4189,7 @@ nullquote:
insptr++;
if (*(insptr+1) == 0)
{
OSD_Printf(CON_ERROR "Divide by zero.\n",g_errorLineNum,keyw[g_tw]);
OSD_Printf(CON_ERROR "divide by zero!\n",g_errorLineNum,keyw[g_tw]);
insptr += 2;
continue;
}
@ -4185,7 +4201,7 @@ nullquote:
insptr++;
if (*(insptr+1) == 0)
{
OSD_Printf(CON_ERROR "Mod by zero.\n",g_errorLineNum,keyw[g_tw]);
OSD_Printf(CON_ERROR "mod by zero!\n",g_errorLineNum,keyw[g_tw]);
insptr += 2;
continue;
}
@ -4246,7 +4262,7 @@ nullquote:
insptr++;
{
int32_t j=Gv_GetVarX(*insptr++);
if ((j<0 || j>=MAX_WEAPONS))
if ((unsigned)j>=MAX_WEAPONS)
{
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],j);
insptr++;
@ -4260,7 +4276,7 @@ nullquote:
insptr++;
{
int32_t j=Gv_GetVarX(*insptr++);
if ((j<0 || j>=MAX_WEAPONS))
if ((unsigned)j>=MAX_WEAPONS)
{
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],j);
insptr++;
@ -4287,7 +4303,7 @@ nullquote:
if (!l2)
{
OSD_Printf(CON_ERROR "Divide by zero.\n",g_errorLineNum,keyw[g_tw]);
OSD_Printf(CON_ERROR "divide by zero!\n",g_errorLineNum,keyw[g_tw]);
continue;
}
@ -4303,7 +4319,7 @@ nullquote:
if (!l2)
{
OSD_Printf(CON_ERROR "Mod by zero.\n",g_errorLineNum,keyw[g_tw]);
OSD_Printf(CON_ERROR "mod by zero!\n",g_errorLineNum,keyw[g_tw]);
continue;
}
@ -4495,7 +4511,7 @@ nullquote:
insptr++;
{
int32_t j = Gv_GetVarX(*insptr++);
int32_t l = Gv_GetVarX(*insptr++);
int32_t l = Gv_GetVarX(*insptr++);
insptr--;
VM_CONDITIONAL(j || l);
}

View file

@ -118,6 +118,9 @@ enum GameEvent_t {
EVENT_DISPLAYLOADINGSCREEN,
EVENT_ANIMATESPRITES,
EVENT_NEWGAME,
EVENT_SOUND,
EVENT_CHECKTOUCHDAMAGE,
EVENT_CHECKFLOORDAMAGE,
MAXEVENTS
};

View file

@ -485,7 +485,7 @@ static playbackstatus MV_GetNextVOCBlock(VoiceNode *voice)
const uint8_t *ptr;
int32_t blocktype;
int32_t lastblocktype;
uint32_t blocklength;
size_t blocklength;
uint32_t samplespeed = 0; // XXX: compiler-happy on synthesis
uint32_t tc = 0;
int32_t packtype;
@ -724,13 +724,13 @@ end_of_data:
if (voice->LoopEnd != NULL)
{
if (blocklength > (uint32_t)voice->LoopEnd)
blocklength = (uint32_t)voice->LoopEnd;
if (blocklength > (uintptr_t)voice->LoopEnd)
blocklength = (uintptr_t)voice->LoopEnd;
else
voice->LoopEnd = (char *)blocklength;
voice->LoopStart = voice->sound + (uint32_t)voice->LoopStart;
voice->LoopEnd = voice->sound + (uint32_t)voice->LoopEnd;
voice->LoopStart = voice->sound + (uintptr_t)voice->LoopStart;
voice->LoopEnd = voice->sound + (uintptr_t)voice->LoopEnd;
voice->LoopSize = voice->LoopEnd - voice->LoopStart;
}

View file

@ -57,7 +57,7 @@ enum MV_Errors
MV_NullRecordFunction
};
void (*MV_Printf)(const char *fmt, ...);
extern void (*MV_Printf)(const char *fmt, ...);
const char *MV_ErrorString( int32_t ErrorNumber );
int32_t MV_VoicePlaying( int32_t handle );
int32_t MV_KillAllVoices( void );

View file

@ -387,7 +387,7 @@ int32_t MV_PlayLoopedVorbis
voice->prev = NULL;
voice->priority = priority;
voice->callbackval = callbackval;
voice->LoopStart = (char *) (loopstart >= 0 ? TRUE : FALSE);
voice->LoopStart = (char *) (intptr_t)(loopstart >= 0 ? TRUE : FALSE);
voice->LoopEnd = 0;
voice->LoopSize = 0;
voice->Playing = TRUE;

View file

@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "demo.h"
#include "enet/enet.h"
int32_t lastvisinc;
int32_t g_currentweapon;
int32_t g_gun_pos;
int32_t g_looking_arc;
@ -2134,8 +2135,6 @@ static int32_t P_DisplayKnuckles(int32_t gs,int32_t snum)
return 1;
}
int32_t lastvisinc;
void P_FireWeapon(DukePlayer_t *p)
{
int32_t i, snum = sprite[p->i].yvel;
@ -2271,6 +2270,7 @@ static int32_t P_DisplayAccess(int32_t gs,int32_t snum)
-108,-96,-72,-64,-32,-16
};
int32_t looking_arc, p = 0;
if (g_player[snum].ps->access_incs == 0 || sprite[g_player[snum].ps->i].extra <= 0) return 0;
@ -2396,42 +2396,44 @@ void P_DisplayWeapon(int32_t snum)
looking_arc+200+(klabs(sintable[(fistsign)&2047]>>8)),
FIST,gs,o|4);
}
else switch (cw)
else
{
pal = get_hud_pal(p);
switch (cw)
{
case KNEE_WEAPON:
aGameVars[g_iReturnVarID].val.lValue = 0;
if (apScriptGameEvent[EVENT_DRAWWEAPON])
VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0)
{
if ((*kb) > 0)
{
pal = get_hud_pal(p);
if (pal == 0)
pal = p->palookup;
guniqhudid = cw;
if ((*kb) < 5 || (*kb) > 9)
G_DrawTileScaled(weapon_xoffset+220-(p->look_ang>>1),
looking_arc+250-gun_pos,KNEE,gs,o,pal);
looking_arc+250-gun_pos,KNEE,gs,o,pal);
else
G_DrawTileScaled(weapon_xoffset+160-(p->look_ang>>1),
looking_arc+214-gun_pos,KNEE+1,gs,o,pal);
looking_arc+214-gun_pos,KNEE+1,gs,o,pal);
guniqhudid = 0;
}
}
break;
case TRIPBOMB_WEAPON:
aGameVars[g_iReturnVarID].val.lValue = 0;
if (apScriptGameEvent[EVENT_DRAWWEAPON])
VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0)
{
pal = get_hud_pal(p);
weapon_xoffset += 8;
gun_pos -= 10;
@ -2441,57 +2443,52 @@ void P_DisplayWeapon(int32_t snum)
{
guniqhudid = cw<<2;
G_DrawWeaponTile(weapon_xoffset+142-(p->look_ang>>1),
looking_arc+234-gun_pos,HANDHOLDINGLASER+3,gs,o,pal,0);
looking_arc+234-gun_pos,HANDHOLDINGLASER+3,gs,o,pal,0);
}
guniqhudid = cw;
G_DrawWeaponTile(weapon_xoffset+130-(p->look_ang>>1),
looking_arc+249-gun_pos,
HANDHOLDINGLASER+((*kb)>>2),gs,o,pal,0);
looking_arc+249-gun_pos,
HANDHOLDINGLASER+((*kb)>>2),gs,o,pal,0);
guniqhudid = cw<<1;
G_DrawWeaponTile(weapon_xoffset+152-(p->look_ang>>1),
looking_arc+249-gun_pos,
HANDHOLDINGLASER+((*kb)>>2),gs,o|4,pal,0);
looking_arc+249-gun_pos,
HANDHOLDINGLASER+((*kb)>>2),gs,o|4,pal,0);
guniqhudid = 0;
}
break;
case RPG_WEAPON:
aGameVars[g_iReturnVarID].val.lValue = 0;
if (apScriptGameEvent[EVENT_DRAWWEAPON])
VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0)
{
pal = get_hud_pal(p);
weapon_xoffset -= sintable[(768+((*kb)<<7))&2047]>>11;
gun_pos += sintable[(768+((*kb)<<7))&2047]>>11;
if (*kb > 0)
if (*kb > 0 && *kb < 8)
{
if (*kb < 8)
{
G_DrawWeaponTile(weapon_xoffset+164,(looking_arc<<1)+176-gun_pos,
RPGGUN+((*kb)>>1),gs,o|512,pal,0);
}
G_DrawWeaponTile(weapon_xoffset+164,(looking_arc<<1)+176-gun_pos,
RPGGUN+((*kb)>>1),gs,o|512,pal,0);
}
G_DrawWeaponTile(weapon_xoffset+164,(looking_arc<<1)+176-gun_pos,
RPGGUN,gs,o|512,pal,0);
RPGGUN,gs,o|512,pal,0);
}
break;
case SHOTGUN_WEAPON:
aGameVars[g_iReturnVarID].val.lValue = 0;
if (apScriptGameEvent[EVENT_DRAWWEAPON])
VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0)
{
pal = get_hud_pal(p);
weapon_xoffset -= 8;
switch (*kb)
@ -2500,14 +2497,14 @@ void P_DisplayWeapon(int32_t snum)
case 2:
guniqhudid = cw<<1;
G_DrawWeaponTile(weapon_xoffset+168-(p->look_ang>>1),looking_arc+201-gun_pos,
SHOTGUN+2,-128,o,pal,0);
SHOTGUN+2,-128,o,pal,0);
case 0:
case 6:
case 7:
case 8:
guniqhudid = cw;
G_DrawWeaponTile(weapon_xoffset+146-(p->look_ang>>1),looking_arc+202-gun_pos,
SHOTGUN,gs,o,pal,0);
SHOTGUN,gs,o,pal,0);
guniqhudid = 0;
break;
case 3:
@ -2524,11 +2521,11 @@ void P_DisplayWeapon(int32_t snum)
guniqhudid = cw<<1;
G_DrawWeaponTile(weapon_xoffset+178-(p->look_ang>>1),looking_arc+194-gun_pos,
SHOTGUN+1+((*(kb)-1)>>1),-128,o,pal,0);
SHOTGUN+1+((*(kb)-1)>>1),-128,o,pal,0);
}
guniqhudid = cw;
G_DrawWeaponTile(weapon_xoffset+158-(p->look_ang>>1),looking_arc+220-gun_pos,
SHOTGUN+3,gs,o,pal,0);
SHOTGUN+3,gs,o,pal,0);
guniqhudid = 0;
break;
case 13:
@ -2536,7 +2533,7 @@ void P_DisplayWeapon(int32_t snum)
case 15:
guniqhudid = cw;
G_DrawWeaponTile(32+weapon_xoffset+166-(p->look_ang>>1),looking_arc+210-gun_pos,
SHOTGUN+4,gs,o,pal,0);
SHOTGUN+4,gs,o,pal,0);
guniqhudid = 0;
break;
case 16:
@ -2545,7 +2542,7 @@ void P_DisplayWeapon(int32_t snum)
case 19:
guniqhudid = cw;
G_DrawWeaponTile(64+weapon_xoffset+170-(p->look_ang>>1),looking_arc+196-gun_pos,
SHOTGUN+5,gs,o,pal,0);
SHOTGUN+5,gs,o,pal,0);
guniqhudid = 0;
break;
case 20:
@ -2554,7 +2551,7 @@ void P_DisplayWeapon(int32_t snum)
case 23:
guniqhudid = cw;
G_DrawWeaponTile(64+weapon_xoffset+176-(p->look_ang>>1),looking_arc+196-gun_pos,
SHOTGUN+6,gs,o,pal,0);
SHOTGUN+6,gs,o,pal,0);
guniqhudid = 0;
break;
case 24:
@ -2563,7 +2560,7 @@ void P_DisplayWeapon(int32_t snum)
case 27:
guniqhudid = cw;
G_DrawWeaponTile(64+weapon_xoffset+170-(p->look_ang>>1),looking_arc+196-gun_pos,
SHOTGUN+5,gs,o,pal,0);
SHOTGUN+5,gs,o,pal,0);
guniqhudid = 0;
break;
case 28:
@ -2571,7 +2568,7 @@ void P_DisplayWeapon(int32_t snum)
case 30:
guniqhudid = cw;
G_DrawWeaponTile(32+weapon_xoffset+156-(p->look_ang>>1),looking_arc+206-gun_pos,
SHOTGUN+4,gs,o,pal,0);
SHOTGUN+4,gs,o,pal,0);
guniqhudid = 0;
break;
}
@ -2580,62 +2577,67 @@ void P_DisplayWeapon(int32_t snum)
case CHAINGUN_WEAPON:
aGameVars[g_iReturnVarID].val.lValue = 0;
if (apScriptGameEvent[EVENT_DRAWWEAPON])
VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0)
{
pal = get_hud_pal(p);
if (*kb > 0)
{
gun_pos -= sintable[(*kb)<<7]>>12;
if (*kb > 0 && sprite[p->i].pal != 1) weapon_xoffset += 1-(rand()&3);
if (sprite[p->i].pal != 1)
weapon_xoffset += 1-(rand()&3);
}
G_DrawWeaponTile(weapon_xoffset+168-(p->look_ang>>1),looking_arc+260-gun_pos,
CHAINGUN,gs,o,pal,0);
CHAINGUN,gs,o,pal,0);
switch (*kb)
{
case 0:
G_DrawWeaponTile(weapon_xoffset+178-(p->look_ang>>1),looking_arc+233-gun_pos,
CHAINGUN+1,gs,o,pal,0);
CHAINGUN+1,gs,o,pal,0);
break;
default:
if (*kb > *aplWeaponFireDelay[CHAINGUN_WEAPON] && *kb < *aplWeaponTotalTime[CHAINGUN_WEAPON])
{
i = 0;
if (sprite[p->i].pal != 1) i = rand()&7;
G_DrawWeaponTile(i+weapon_xoffset-4+140-(p->look_ang>>1),i+looking_arc-((*kb)>>1)+208-gun_pos,
CHAINGUN+5+((*kb-4)/5),gs,o,pal,0);
CHAINGUN+5+((*kb-4)/5),gs,o,pal,0);
if (sprite[p->i].pal != 1) i = rand()&7;
G_DrawWeaponTile(i+weapon_xoffset-4+184-(p->look_ang>>1),i+looking_arc-((*kb)>>1)+208-gun_pos,
CHAINGUN+5+((*kb-4)/5),gs,o,pal,0);
CHAINGUN+5+((*kb-4)/5),gs,o,pal,0);
}
if (*kb < *aplWeaponTotalTime[CHAINGUN_WEAPON]-4)
{
i = rand()&7;
G_DrawWeaponTile(i+weapon_xoffset-4+162-(p->look_ang>>1),i+looking_arc-((*kb)>>1)+208-gun_pos,
CHAINGUN+5+((*kb-2)/5),gs,o,pal,0);
CHAINGUN+5+((*kb-2)/5),gs,o,pal,0);
G_DrawWeaponTile(weapon_xoffset+178-(p->look_ang>>1),looking_arc+233-gun_pos,
CHAINGUN+1+((*kb)>>1),gs,o,pal,0);
CHAINGUN+1+((*kb)>>1),gs,o,pal,0);
}
else G_DrawWeaponTile(weapon_xoffset+178-(p->look_ang>>1),looking_arc+233-gun_pos,
CHAINGUN+1,gs,o,pal,0);
CHAINGUN+1,gs,o,pal,0);
break;
}
}
break;
case PISTOL_WEAPON:
aGameVars[g_iReturnVarID].val.lValue = 0;
if (apScriptGameEvent[EVENT_DRAWWEAPON])
VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0)
{
pal = get_hud_pal(p);
if ((*kb) < *aplWeaponTotalTime[PISTOL_WEAPON]+1)
{
static uint8_t kb_frames[] = { 0, 1, 2 };
@ -2698,70 +2700,65 @@ void P_DisplayWeapon(int32_t snum)
break;
case HANDBOMB_WEAPON:
{
aGameVars[g_iReturnVarID].val.lValue = 0;
if (apScriptGameEvent[EVENT_DRAWWEAPON])
VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0)
{
pal = get_hud_pal(p);
aGameVars[g_iReturnVarID].val.lValue = 0;
guniqhudid = cw;
if ((*kb))
if (apScriptGameEvent[EVENT_DRAWWEAPON])
VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0)
{
if ((*kb) < (*aplWeaponTotalTime[p->curr_weapon]))
guniqhudid = cw;
if ((*kb))
{
if ((*kb) < (*aplWeaponTotalTime[p->curr_weapon]))
{
static uint8_t throw_frames[] = {0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2};
static uint8_t throw_frames[] = {0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2};
if ((*kb) < 7)
gun_pos -= 10*(*kb); //D
else if ((*kb) < 12)
gun_pos += 20*((*kb)-10); //U
else if ((*kb) < 20)
gun_pos -= 9*((*kb)-14); //D
if ((*kb) < 7)
gun_pos -= 10*(*kb); //D
else if ((*kb) < 12)
gun_pos += 20*((*kb)-10); //U
else if ((*kb) < 20)
gun_pos -= 9*((*kb)-14); //D
G_DrawWeaponTile(weapon_xoffset+190-(p->look_ang>>1),looking_arc+250-gun_pos,HANDTHROW+throw_frames[(*kb)],gs,o,pal,0);
G_DrawWeaponTile(weapon_xoffset+190-(p->look_ang>>1),looking_arc+250-gun_pos,HANDTHROW+throw_frames[(*kb)],gs,o,pal,0);
}
}
else
G_DrawWeaponTile(weapon_xoffset+190-(p->look_ang>>1),looking_arc+260-gun_pos,HANDTHROW,gs,o,pal,0);
guniqhudid = 0;
}
else
G_DrawWeaponTile(weapon_xoffset+190-(p->look_ang>>1),looking_arc+260-gun_pos,HANDTHROW,gs,o,pal,0);
guniqhudid = 0;
}
}
break;
break;
case HANDREMOTE_WEAPON:
{
aGameVars[g_iReturnVarID].val.lValue = 0;
if (apScriptGameEvent[EVENT_DRAWWEAPON])
VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0)
{
static uint8_t remote_frames[] = {0,1,1,2,1,1,0,0,0,0,0};
aGameVars[g_iReturnVarID].val.lValue = 0;
pal = get_hud_pal(p);
if (apScriptGameEvent[EVENT_DRAWWEAPON])
VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
weapon_xoffset = -48;
guniqhudid = cw;
if ((*kb))
if (aGameVars[g_iReturnVarID].val.lValue == 0)
{
static uint8_t remote_frames[] = {0,1,1,2,1,1,0,0,0,0,0};
weapon_xoffset = -48;
guniqhudid = cw;
// if ((*kb))
G_DrawWeaponTile(weapon_xoffset+150-(p->look_ang>>1),looking_arc+258-gun_pos,HANDREMOTE+remote_frames[(*kb)],gs,o,pal,0);
else
G_DrawWeaponTile(weapon_xoffset+150-(p->look_ang>>1),looking_arc+258-gun_pos,HANDREMOTE,gs,o,pal,0);
guniqhudid = 0;
}
}
break;
// else
// G_DrawWeaponTile(weapon_xoffset+150-(p->look_ang>>1),looking_arc+258-gun_pos,HANDREMOTE,gs,o,pal,0);
guniqhudid = 0;
}
break;
case DEVISTATOR_WEAPON:
aGameVars[g_iReturnVarID].val.lValue = 0;
if (apScriptGameEvent[EVENT_DRAWWEAPON])
VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0)
{
pal = get_hud_pal(p);
if ((*kb) < (*aplWeaponTotalTime[DEVISTATOR_WEAPON]+1) && (*kb) > 0)
{
static uint8_t cycloidy[] = {0,4,12,24,12,4,0};
@ -2797,14 +2794,13 @@ void P_DisplayWeapon(int32_t snum)
break;
case FREEZE_WEAPON:
aGameVars[g_iReturnVarID].val.lValue = 0;
if (apScriptGameEvent[EVENT_DRAWWEAPON])
VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0)
{
pal = get_hud_pal(p);
if ((*kb) < (aplWeaponTotalTime[p->curr_weapon][snum]+1) && (*kb) > 0)
{
static uint8_t cat_frames[] = { 0,0,1,1,2,2 };
@ -2831,17 +2827,16 @@ void P_DisplayWeapon(int32_t snum)
break;
case GROW_WEAPON:
aGameVars[g_iReturnVarID].val.lValue = 0;
if (apScriptGameEvent[EVENT_DRAWWEAPON])
VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0)
{
weapon_xoffset += 28;
looking_arc += 18;
pal = get_hud_pal(p);
if ((*kb) < aplWeaponTotalTime[p->curr_weapon][snum] && (*kb) > 0)
{
if (sprite[p->i].pal != 1)
@ -2877,17 +2872,16 @@ void P_DisplayWeapon(int32_t snum)
break;
case SHRINKER_WEAPON:
aGameVars[g_iReturnVarID].val.lValue = 0;
if (apScriptGameEvent[EVENT_DRAWWEAPON])
VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
if (aGameVars[g_iReturnVarID].val.lValue == 0)
{
weapon_xoffset += 28;
looking_arc += 18;
pal = get_hud_pal(p);
if (((*kb) > 0) && ((*kb) < aplWeaponTotalTime[p->curr_weapon][snum]))
{
if (sprite[p->i].pal != 1)
@ -2897,11 +2891,11 @@ void P_DisplayWeapon(int32_t snum)
}
guniqhudid = cw<<1;
G_DrawWeaponTile(weapon_xoffset+184-(p->look_ang>>1),
looking_arc+240-gun_pos,SHRINKER+3+((*kb)&3),-32,
o,0,1);
looking_arc+240-gun_pos,SHRINKER+3+((*kb)&3),-32,
o,0,1);
guniqhudid = cw;
G_DrawWeaponTile(weapon_xoffset+188-(p->look_ang>>1),
looking_arc+240-gun_pos,SHRINKER+1,gs,o,pal,0);
looking_arc+240-gun_pos,SHRINKER+1,gs,o,pal,0);
guniqhudid = 0;
}
@ -2909,19 +2903,21 @@ void P_DisplayWeapon(int32_t snum)
{
guniqhudid = cw<<1;
G_DrawWeaponTile(weapon_xoffset+184-(p->look_ang>>1),
looking_arc+240-gun_pos,SHRINKER+2,
16-(sintable[p->random_club_frame&2047]>>10),
o,0,1);
looking_arc+240-gun_pos,SHRINKER+2,
16-(sintable[p->random_club_frame&2047]>>10),
o,0,1);
guniqhudid = cw;
G_DrawWeaponTile(weapon_xoffset+188-(p->look_ang>>1),
looking_arc+240-gun_pos,SHRINKER,gs,o,pal,0);
looking_arc+240-gun_pos,SHRINKER,gs,o,pal,0);
guniqhudid = 0;
}
}
break;
}
}
}
P_DisplaySpit(snum);
}
@ -3244,26 +3240,27 @@ static int32_t P_DoCounters(DukePlayer_t *p)
if (p->last_pissed_time > 0)
{
p->last_pissed_time--;
if (p->last_pissed_time == (GAMETICSPERSEC*219))
switch (--p->last_pissed_time)
{
A_PlaySound(FLUSH_TOILET,p->i);
if (snum == screenpeek || GTFLAGS(GAMETYPE_COOPSOUND))
A_PlaySound(DUKE_PISSRELIEF,p->i);
}
if (p->last_pissed_time == (GAMETICSPERSEC*218))
{
p->holster_weapon = 0;
p->weapon_pos = 10;
case GAMETICSPERSEC*219:
{
A_PlaySound(FLUSH_TOILET,p->i);
if (snum == screenpeek || GTFLAGS(GAMETYPE_COOPSOUND))
A_PlaySound(DUKE_PISSRELIEF,p->i);
}
break;
case GAMETICSPERSEC*218:
{
p->holster_weapon = 0;
p->weapon_pos = 10;
}
break;
}
}
if (p->crack_time > 0)
{
p->crack_time--;
if (p->crack_time == 0)
if (--p->crack_time == 0)
{
p->knuckle_incs = 1;
p->crack_time = 777;
@ -3272,9 +3269,9 @@ static int32_t P_DoCounters(DukePlayer_t *p)
if (p->inv_amount[GET_STEROIDS] > 0 && p->inv_amount[GET_STEROIDS] < 400)
{
p->inv_amount[GET_STEROIDS]--;
if (p->inv_amount[GET_STEROIDS] == 0)
if (--p->inv_amount[GET_STEROIDS] == 0)
P_SelectNextInvItem(p);
if (!(p->inv_amount[GET_STEROIDS]&7))
if (snum == screenpeek || GTFLAGS(GAMETYPE_COOPSOUND))
A_PlaySound(DUKE_HARTBEAT,p->i);
@ -3282,8 +3279,7 @@ static int32_t P_DoCounters(DukePlayer_t *p)
if (p->heat_on && p->inv_amount[GET_HEATS] > 0)
{
p->inv_amount[GET_HEATS]--;
if (p->inv_amount[GET_HEATS] == 0)
if (--p->inv_amount[GET_HEATS] == 0)
{
p->heat_on = 0;
P_SelectNextInvItem(p);
@ -3294,8 +3290,7 @@ static int32_t P_DoCounters(DukePlayer_t *p)
if (p->holoduke_on >= 0)
{
p->inv_amount[GET_HOLODUKE]--;
if (p->inv_amount[GET_HOLODUKE] <= 0)
if (--p->inv_amount[GET_HOLODUKE] <= 0)
{
A_PlaySound(TELEPORTER,p->i);
p->holoduke_on = -1;
@ -3305,8 +3300,7 @@ static int32_t P_DoCounters(DukePlayer_t *p)
if (p->jetpack_on && p->inv_amount[GET_JETPACK] > 0)
{
p->inv_amount[GET_JETPACK]--;
if (p->inv_amount[GET_JETPACK] <= 0)
if (--p->inv_amount[GET_JETPACK] <= 0)
{
p->jetpack_on = 0;
P_SelectNextInvItem(p);
@ -3319,8 +3313,8 @@ static int32_t P_DoCounters(DukePlayer_t *p)
if (p->quick_kick > 0 && sprite[p->i].pal != 1)
{
p->last_quick_kick = p->quick_kick+1;
p->quick_kick--;
if (p->quick_kick == 8)
if (--p->quick_kick == 8)
A_Shoot(p->i,KNEE);
}
else if (p->last_quick_kick > 0) p->last_quick_kick--;
@ -3330,6 +3324,7 @@ static int32_t P_DoCounters(DukePlayer_t *p)
p->access_incs++;
if (sprite[p->i].extra <= 0)
p->access_incs = 12;
if (p->access_incs == 12)
{
if (p->access_spritenum >= 0)
@ -3407,8 +3402,7 @@ static int32_t P_DoCounters(DukePlayer_t *p)
if (p->knuckle_incs)
{
p->knuckle_incs++;
if (p->knuckle_incs==10)
if (++p->knuckle_incs == 10)
{
if (totalclock > 1024)
if (snum == screenpeek || GTFLAGS(GAMETYPE_COOPSOUND))
@ -3441,15 +3435,15 @@ void P_DropWeapon(DukePlayer_t *p)
int32_t snum = sprite[p->i].yvel,
cw = aplWeaponWorksLike[p->curr_weapon][snum];
if (cw < 1 || cw >= MAX_WEAPONS) return;
if ((unsigned)cw >= MAX_WEAPONS) return;
if (krand()&1)
A_Spawn(p->i,WeaponPickupSprites[cw]);
A_Spawn(p->i, WeaponPickupSprites[cw]);
else switch (cw)
{
case RPG_WEAPON:
case HANDBOMB_WEAPON:
A_Spawn(p->i,EXPLOSION2);
A_Spawn(p->i, EXPLOSION2);
break;
}
}
@ -3469,6 +3463,7 @@ void P_AddWeaponNoSwitch(DukePlayer_t *p, int32_t weapon)
if ((p->gotweapon & (1<<weapon)) == 0)
{
p->gotweapon |= (1<<weapon);
if (weapon == SHRINKER_WEAPON)
p->gotweapon |= (1<<GROW_WEAPON);
}
@ -3484,20 +3479,19 @@ void P_AddWeapon(DukePlayer_t *p,int32_t weapon)
{
int32_t snum = sprite[p->i].yvel;
P_AddWeaponNoSwitch(p,weapon);
P_AddWeaponNoSwitch(p, weapon);
if (p->reloading) return;
p->random_club_frame = 0;
if (p->holster_weapon == 0)
{
if (p->weapon_pos == 0)
p->weapon_pos = -1;
else p->weapon_pos = -9;
p->last_weapon = p->curr_weapon;
}
else
if (p->weapon_pos == 0)
p->weapon_pos = -1;
else p->weapon_pos = -9;
p->last_weapon = p->curr_weapon;
if (p->holster_weapon)
{
p->weapon_pos = 10;
p->holster_weapon = 0;
@ -3513,7 +3507,7 @@ void P_AddWeapon(DukePlayer_t *p,int32_t weapon)
Gv_SetVar(g_iWeaponVarID,p->curr_weapon, p->i, snum);
Gv_SetVar(g_iWorksLikeVarID,
(p->curr_weapon>=0) ? aplWeaponWorksLike[p->curr_weapon][snum] : -1,
(unsigned)p->curr_weapon < MAX_WEAPONS ? aplWeaponWorksLike[p->curr_weapon][snum] : -1,
p->i, snum);
}
@ -3523,10 +3517,10 @@ void P_SelectNextInvItem(DukePlayer_t *p)
p->inven_icon = 1;
else if (p->inv_amount[GET_STEROIDS] > 0)
p->inven_icon = 2;
else if (p->inv_amount[GET_HOLODUKE] > 0)
p->inven_icon = 3;
else if (p->inv_amount[GET_JETPACK] > 0)
p->inven_icon = 4;
else if (p->inv_amount[GET_HOLODUKE] > 0)
p->inven_icon = 3;
else if (p->inv_amount[GET_HEATS] > 0)
p->inven_icon = 5;
else if (p->inv_amount[GET_SCUBA] > 0)
@ -3556,9 +3550,8 @@ void P_CheckWeapon(DukePlayer_t *p)
}
weap = p->curr_weapon;
if ((p->gotweapon & (1<<weap)) && p->ammo_amount[weap] > 0)
return;
if ((p->gotweapon & (1<<weap)) && !(p->weaponswitch & 2))
if ((p->gotweapon & (1<<weap)) && (p->ammo_amount[weap] > 0 || !(p->weaponswitch & 2)))
return;
snum = sprite[p->i].yvel;
@ -3583,7 +3576,7 @@ void P_CheckWeapon(DukePlayer_t *p)
p->random_club_frame = 0;
p->curr_weapon = weap;
Gv_SetVar(g_iWeaponVarID,p->curr_weapon, p->i, snum);
Gv_SetVar(g_iWorksLikeVarID, p->curr_weapon >= 0 ? aplWeaponWorksLike[p->curr_weapon][snum] : -1, p->i, snum);
Gv_SetVar(g_iWorksLikeVarID, (unsigned)p->curr_weapon < MAX_WEAPONS ? aplWeaponWorksLike[p->curr_weapon][snum] : -1, p->i, snum);
if (apScriptGameEvent[EVENT_CHANGEWEAPON])
VM_OnEvent(EVENT_CHANGEWEAPON,p->i, snum, -1);
@ -3598,6 +3591,12 @@ void P_CheckWeapon(DukePlayer_t *p)
void P_CheckTouchDamage(DukePlayer_t *p,int32_t j)
{
aGameVars[g_iReturnVarID].val.lValue = j;
if (apScriptGameEvent[EVENT_CHECKTOUCHDAMAGE])
VM_OnEvent(EVENT_CHECKTOUCHDAMAGE, p->i, sprite[p->i].yvel, -1);
if (aGameVars[g_iReturnVarID].val.lValue == -1) return;
if ((j&49152) == 49152)
{
j &= (MAXSPRITES-1);
@ -3669,16 +3668,21 @@ void P_CheckTouchDamage(DukePlayer_t *p,int32_t j)
int32_t P_CheckFloorDamage(DukePlayer_t *p, int32_t j)
{
int32_t ret = 0;
spritetype *s = &sprite[p->i];
switch (DYNAMICTILEMAP(j))
aGameVars[g_iReturnVarID].val.lValue = j;
if (apScriptGameEvent[EVENT_CHECKFLOORDAMAGE])
VM_OnEvent(EVENT_CHECKFLOORDAMAGE, p->i, sprite[p->i].yvel, -1);
if ((unsigned)(j = aGameVars[g_iReturnVarID].val.lValue) >= MAXTILES) return 0;
switch (DynamicTileMap[j])
{
case HURTRAIL__STATIC:
if (rnd(32))
{
if (p->inv_amount[GET_BOOTS] > 0)
ret++;
return 1;
else
{
if (!A_CheckSoundPlaying(p->i,DUKE_LONGTERM_PAIN))
@ -3689,6 +3693,8 @@ int32_t P_CheckFloorDamage(DukePlayer_t *p, int32_t j)
s->extra -= 1+(krand()&3);
if (!A_CheckSoundPlaying(p->i,SHORT_CIRCUIT))
A_PlaySound(SHORT_CIRCUIT,p->i);
return 0;
}
}
break;
@ -3696,7 +3702,7 @@ int32_t P_CheckFloorDamage(DukePlayer_t *p, int32_t j)
if (rnd(16))
{
if (p->inv_amount[GET_BOOTS] > 0)
ret++;
return 1;
else
{
if (!A_CheckSoundPlaying(p->i,DUKE_LONGTERM_PAIN))
@ -3704,6 +3710,8 @@ int32_t P_CheckFloorDamage(DukePlayer_t *p, int32_t j)
P_PalFrom(p, 32, 0,8,0);
s->extra -= 1+(krand()&3);
return 0;
}
}
break;
@ -3711,7 +3719,7 @@ int32_t P_CheckFloorDamage(DukePlayer_t *p, int32_t j)
if (rnd(32))
{
if (p->inv_amount[GET_BOOTS] > 0)
ret++;
return 1;
else
{
if (!A_CheckSoundPlaying(p->i,DUKE_LONGTERM_PAIN))
@ -3719,12 +3727,14 @@ int32_t P_CheckFloorDamage(DukePlayer_t *p, int32_t j)
P_PalFrom(p, 32, 8,0,0);
s->extra -= 1+(krand()&3);
return 0;
}
}
break;
}
return ret;
return 0;
}
@ -4762,7 +4772,7 @@ void P_ProcessInput(int32_t snum)
if (p->on_ground)
p->bobcounter += sprite[p->i].xvel>>1;
if (ud.noclip == 0 && (sector[p->cursectnum].floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS))
if (ud.noclip == 0 && ((uint16_t)p->cursectnum >= MAXSECTORS || sector[p->cursectnum].floorpicnum == MIRROR))
{
p->pos.x = p->opos.x;
p->pos.y = p->opos.y;

View file

@ -25,8 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MAXQUOTES 16384
#define MAXQUOTELEN 128
#define OBITQUOTEINDEX MAXQUOTES-128
#define SUICIDEQUOTEINDEX MAXQUOTES-32
#define OBITQUOTEINDEX (MAXQUOTES-128)
#define SUICIDEQUOTEINDEX (MAXQUOTES-32)
#define QUOTE_SHOW_MAP_OFF 1
#define QUOTE_ACTIVATED 2

View file

@ -2633,8 +2633,8 @@ void G_HandleSharedKeys(int32_t snum)
dainv = p->inven_icon;
i = 0;
CHECKINV1:
CHECKINV1:
if (i < 9)
{
i++;

View file

@ -621,8 +621,15 @@ int32_t S_PlaySound(int32_t num)
int32_t A_PlaySound(uint32_t num, int32_t i)
{
if ((unsigned)num > (unsigned)g_maxSoundPos) return -1;
return i < 0 ? S_PlaySound(num) : S_PlaySound3D(num, i, (vec3_t *)&sprite[i]);
aGameVars[g_iReturnVarID].val.lValue = num;
if (apScriptGameEvent[EVENT_SOUND])
VM_OnEvent(EVENT_SOUND, i, myconnectindex, -1);
if ((unsigned)aGameVars[g_iReturnVarID].val.lValue > (unsigned)g_maxSoundPos) return -1;
return i < 0 ? S_PlaySound(aGameVars[g_iReturnVarID].val.lValue) :
S_PlaySound3D(aGameVars[g_iReturnVarID].val.lValue, i, (vec3_t *)&sprite[i]);
}
void S_StopEnvSound(int32_t num, int32_t i)