diff --git a/polymer/eduke32/eduke32.vcxproj b/polymer/eduke32/eduke32.vcxproj
index 49ecf215a..9e8bf4e07 100644
--- a/polymer/eduke32/eduke32.vcxproj
+++ b/polymer/eduke32/eduke32.vcxproj
@@ -116,6 +116,7 @@
+
diff --git a/polymer/eduke32/eduke32.vcxproj.filters b/polymer/eduke32/eduke32.vcxproj.filters
index 0a92d2d8e..93ac82654 100644
--- a/polymer/eduke32/eduke32.vcxproj.filters
+++ b/polymer/eduke32/eduke32.vcxproj.filters
@@ -49,6 +49,12 @@
{8a6aad55-a3bc-4e4f-a61d-4652c29d8b92}
+
+ {e8ea0b0a-e748-4c94-8d84-5062dd5b68a1}
+
+
+ {3477e5cd-29a4-42b2-8c3f-ca4618242526}
+
@@ -180,9 +186,6 @@
eduke32\headers
-
- eduke32\headers
-
eduke32\headers
@@ -207,9 +210,6 @@
eduke32\headers
-
- eduke32\headers
-
eduke32\headers
@@ -357,6 +357,15 @@
eduke32\headers
+
+ eduke32\headers\editor
+
+
+ eduke32\headers\editor
+
+
+ eduke32\headers\editor
+
@@ -455,9 +464,6 @@
eduke32\source
-
- eduke32\source
-
eduke32\source
@@ -482,18 +488,6 @@
eduke32\source
-
- eduke32\source
-
-
- eduke32\source
-
-
- eduke32\source
-
-
- eduke32\source
-
eduke32\source
@@ -539,9 +533,6 @@
eduke32\source
-
- eduke32\source
-
eduke32\source
@@ -641,6 +632,24 @@
eduke32\source
+
+ eduke32\source\editor
+
+
+ eduke32\source\editor
+
+
+ eduke32\source\editor
+
+
+ eduke32\source\editor
+
+
+ eduke32\source\editor
+
+
+ eduke32\source\editor
+
diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c
index 4e118e31c..1d393d661 100644
--- a/polymer/eduke32/source/actors.c
+++ b/polymer/eduke32/source/actors.c
@@ -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;
diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c
index b20a4756b..709cbb2b6 100644
--- a/polymer/eduke32/source/gamedef.c
+++ b/polymer/eduke32/source/gamedef.c
@@ -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;
diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c
index e0cd8cdcc..1624c183a 100644
--- a/polymer/eduke32/source/gameexec.c
+++ b/polymer/eduke32/source/gameexec.c
@@ -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);
}
diff --git a/polymer/eduke32/source/gameexec.h b/polymer/eduke32/source/gameexec.h
index 2d541b20b..52160b8ce 100644
--- a/polymer/eduke32/source/gameexec.h
+++ b/polymer/eduke32/source/gameexec.h
@@ -118,6 +118,9 @@ enum GameEvent_t {
EVENT_DISPLAYLOADINGSCREEN,
EVENT_ANIMATESPRITES,
EVENT_NEWGAME,
+ EVENT_SOUND,
+ EVENT_CHECKTOUCHDAMAGE,
+ EVENT_CHECKFLOORDAMAGE,
MAXEVENTS
};
diff --git a/polymer/eduke32/source/jaudiolib/src/multivoc.c b/polymer/eduke32/source/jaudiolib/src/multivoc.c
index 503b52c8d..75658f6d5 100644
--- a/polymer/eduke32/source/jaudiolib/src/multivoc.c
+++ b/polymer/eduke32/source/jaudiolib/src/multivoc.c
@@ -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;
}
diff --git a/polymer/eduke32/source/jaudiolib/src/multivoc.h b/polymer/eduke32/source/jaudiolib/src/multivoc.h
index 80fb9f7d9..7697b6440 100644
--- a/polymer/eduke32/source/jaudiolib/src/multivoc.h
+++ b/polymer/eduke32/source/jaudiolib/src/multivoc.h
@@ -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 );
diff --git a/polymer/eduke32/source/jaudiolib/src/vorbis.c b/polymer/eduke32/source/jaudiolib/src/vorbis.c
index 2beaced4a..7b5ef584c 100644
--- a/polymer/eduke32/source/jaudiolib/src/vorbis.c
+++ b/polymer/eduke32/source/jaudiolib/src/vorbis.c
@@ -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;
diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c
index 6d3e909d8..d25caa447 100644
--- a/polymer/eduke32/source/player.c
+++ b/polymer/eduke32/source/player.c
@@ -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<gotweapon |= (1<gotweapon |= (1<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<ammo_amount[weap] > 0)
- return;
- if ((p->gotweapon & (1<weaponswitch & 2))
+
+ if ((p->gotweapon & (1<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;
diff --git a/polymer/eduke32/source/quotes.h b/polymer/eduke32/source/quotes.h
index d5a1ad436..9d7462de0 100644
--- a/polymer/eduke32/source/quotes.h
+++ b/polymer/eduke32/source/quotes.h
@@ -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
diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c
index 32a9abebc..d05c118cf 100644
--- a/polymer/eduke32/source/sector.c
+++ b/polymer/eduke32/source/sector.c
@@ -2633,8 +2633,8 @@ void G_HandleSharedKeys(int32_t snum)
dainv = p->inven_icon;
i = 0;
-CHECKINV1:
+CHECKINV1:
if (i < 9)
{
i++;
diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c
index d18dd16de..2e5ff13ba 100644
--- a/polymer/eduke32/source/sounds.c
+++ b/polymer/eduke32/source/sounds.c
@@ -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)