mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
git-svn-id: https://svn.eduke32.com/eduke32@1215 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
7b9448d868
commit
a56ab804a8
12 changed files with 1001 additions and 882 deletions
|
@ -92,195 +92,6 @@ inline int32_t G_CheckForSpaceFloor(int32_t sectnum)
|
|||
return ((sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0 && ((sector[sectnum].floorpicnum==MOONSKY1)||(sector[sectnum].floorpicnum==BIGORBIT1))?1:0);
|
||||
}
|
||||
|
||||
void P_AddAmmo(int32_t weapon,DukePlayer_t *p,int32_t amount)
|
||||
{
|
||||
p->ammo_amount[weapon] += amount;
|
||||
|
||||
if (p->ammo_amount[weapon] > p->max_ammo_amount[weapon])
|
||||
p->ammo_amount[weapon] = p->max_ammo_amount[weapon];
|
||||
}
|
||||
|
||||
void P_AddWeaponNoSwitch(DukePlayer_t *p, int32_t weapon)
|
||||
{
|
||||
int32_t snum = sprite[p->i].yvel;
|
||||
|
||||
if (p->gotweapon[weapon] == 0)
|
||||
{
|
||||
p->gotweapon[weapon] = 1;
|
||||
if (weapon == SHRINKER_WEAPON)
|
||||
p->gotweapon[GROW_WEAPON] = 1;
|
||||
}
|
||||
|
||||
#if 1
|
||||
if (aplWeaponSelectSound[p->curr_weapon][snum])
|
||||
A_StopSound(aplWeaponSelectSound[p->curr_weapon][snum],p->i);
|
||||
if (aplWeaponSelectSound[weapon][snum])
|
||||
A_PlaySound(aplWeaponSelectSound[weapon][snum],p->i);
|
||||
#else
|
||||
switch (p->curr_weapon)
|
||||
{
|
||||
case KNEE_WEAPON:
|
||||
case TRIPBOMB_WEAPON:
|
||||
case HANDREMOTE_WEAPON:
|
||||
case HANDBOMB_WEAPON:
|
||||
break;
|
||||
case SHOTGUN_WEAPON:
|
||||
A_StopSound(SHOTGUN_COCK,p->i);
|
||||
break;
|
||||
case PISTOL_WEAPON:
|
||||
A_StopSound(INSERT_CLIP,p->i);
|
||||
break;
|
||||
default:
|
||||
A_StopSound(SELECT_WEAPON,p->i);
|
||||
break;
|
||||
}
|
||||
switch (weapon)
|
||||
{
|
||||
case KNEE_WEAPON:
|
||||
case TRIPBOMB_WEAPON:
|
||||
case HANDREMOTE_WEAPON:
|
||||
case HANDBOMB_WEAPON:
|
||||
break;
|
||||
case SHOTGUN_WEAPON:
|
||||
A_PlaySound(SHOTGUN_COCK,p->i);
|
||||
break;
|
||||
case PISTOL_WEAPON:
|
||||
A_PlaySound(INSERT_CLIP,p->i);
|
||||
break;
|
||||
default:
|
||||
A_PlaySound(SELECT_WEAPON,p->i);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void P_AddWeapon(DukePlayer_t *p,int32_t weapon)
|
||||
{
|
||||
int32_t snum = sprite[p->i].yvel;
|
||||
|
||||
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
|
||||
{
|
||||
p->weapon_pos = 10;
|
||||
p->holster_weapon = 0;
|
||||
p->last_weapon = -1;
|
||||
}
|
||||
|
||||
p->kickback_pic = 0;
|
||||
|
||||
if (p->curr_weapon != weapon)
|
||||
X_OnEvent(EVENT_CHANGEWEAPON,p->i, snum, -1);
|
||||
|
||||
p->curr_weapon = weapon;
|
||||
|
||||
Gv_SetVar(g_iWeaponVarID,p->curr_weapon, p->i, snum);
|
||||
if (p->curr_weapon>=0)
|
||||
{
|
||||
Gv_SetVar(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum], p->i, snum);
|
||||
}
|
||||
else
|
||||
{
|
||||
Gv_SetVar(g_iWorksLikeVarID,-1, p->i, snum);
|
||||
}
|
||||
}
|
||||
|
||||
void P_SelectNextInvItem(DukePlayer_t *p)
|
||||
{
|
||||
if (p->firstaid_amount > 0)
|
||||
p->inven_icon = 1;
|
||||
else if (p->steroids_amount > 0)
|
||||
p->inven_icon = 2;
|
||||
else if (p->holoduke_amount > 0)
|
||||
p->inven_icon = 3;
|
||||
else if (p->jetpack_amount > 0)
|
||||
p->inven_icon = 4;
|
||||
else if (p->heat_amount > 0)
|
||||
p->inven_icon = 5;
|
||||
else if (p->scuba_amount > 0)
|
||||
p->inven_icon = 6;
|
||||
else if (p->boot_amount > 0)
|
||||
p->inven_icon = 7;
|
||||
else p->inven_icon = 0;
|
||||
}
|
||||
|
||||
void P_CheckWeapon(DukePlayer_t *p)
|
||||
{
|
||||
int16_t i,snum;
|
||||
int32 weap;
|
||||
|
||||
if (p->reloading) return;
|
||||
|
||||
if (p->wantweaponfire >= 0)
|
||||
{
|
||||
weap = p->wantweaponfire;
|
||||
p->wantweaponfire = -1;
|
||||
|
||||
if (weap == p->curr_weapon) return;
|
||||
else if (p->gotweapon[weap] && p->ammo_amount[weap] > 0)
|
||||
{
|
||||
P_AddWeapon(p,weap);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
weap = p->curr_weapon;
|
||||
if (p->gotweapon[weap] && p->ammo_amount[weap] > 0)
|
||||
return;
|
||||
if (p->gotweapon[weap] && !(p->weaponswitch & 2))
|
||||
return;
|
||||
|
||||
snum = sprite[p->i].yvel;
|
||||
|
||||
for (i=0;i<10;i++)
|
||||
{
|
||||
weap = g_player[snum].wchoice[i];
|
||||
if (VOLUMEONE && weap > 6) continue;
|
||||
|
||||
if (weap == 0) weap = 9;
|
||||
else weap--;
|
||||
|
||||
if (weap == 0 || (p->gotweapon[weap] && p->ammo_amount[weap] > 0))
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == 10) weap = 0;
|
||||
|
||||
// Found the weapon
|
||||
|
||||
p->last_weapon = p->curr_weapon;
|
||||
p->random_club_frame = 0;
|
||||
p->curr_weapon = weap;
|
||||
Gv_SetVar(g_iWeaponVarID,p->curr_weapon, p->i, snum);
|
||||
if (p->curr_weapon>=0)
|
||||
{
|
||||
Gv_SetVar(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum], p->i, snum);
|
||||
}
|
||||
else
|
||||
{
|
||||
Gv_SetVar(g_iWorksLikeVarID,-1, p->i, snum);
|
||||
}
|
||||
X_OnEvent(EVENT_CHANGEWEAPON,p->i, snum, -1);
|
||||
p->kickback_pic = 0;
|
||||
if (p->holster_weapon == 1)
|
||||
{
|
||||
p->holster_weapon = 0;
|
||||
p->weapon_pos = 10;
|
||||
}
|
||||
else p->weapon_pos = -1;
|
||||
}
|
||||
|
||||
void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t hp3, int32_t hp4)
|
||||
{
|
||||
spritetype *s=&sprite[i],*sj;
|
||||
|
@ -600,9 +411,9 @@ void A_DeleteSprite(int32_t s)
|
|||
{
|
||||
int32_t p, pl=A_FindPlayer(&sprite[s],&p);
|
||||
|
||||
Gv_SetVar(g_iReturnVarID,0, -1, -1);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_KILLIT, s, pl, p);
|
||||
if (Gv_GetVar(g_iReturnVarID, -1, -1))
|
||||
if (aGameVars[g_iReturnVarID].val.lValue)
|
||||
return;
|
||||
}
|
||||
deletesprite(s);
|
||||
|
|
|
@ -44,7 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include <shellapi.h>
|
||||
#endif
|
||||
|
||||
#define BUILDDATE " 20090114"
|
||||
#define BUILDDATE " 20090117"
|
||||
#define VERSION " 1.2.0devel"
|
||||
|
||||
static int32_t floor_over_floor;
|
||||
|
|
|
@ -78,7 +78,8 @@ extern int32_t g_scriptVersion, g_Shareware, g_gameType;
|
|||
#define BYTEVERSION_13 27
|
||||
#define BYTEVERSION_14 116
|
||||
#define BYTEVERSION_15 117
|
||||
#define BYTEVERSION_JF 189 // increase by 3, because atomic GRP adds 1, and Shareware adds 2
|
||||
|
||||
#define BYTEVERSION_JF 192 // increase by 3, because atomic GRP adds 1, and Shareware adds 2
|
||||
|
||||
#define BYTEVERSION (BYTEVERSION_JF+(PLUTOPAK?1:(VOLUMEONE<<1))) // JBF 20040116: different data files give different versions
|
||||
|
||||
|
@ -533,7 +534,8 @@ typedef struct {
|
|||
spriteinterpolate sprpos[MAXSPRITES];
|
||||
|
||||
typedef struct {
|
||||
int32_t floorz,ceilingz,lastvx,lastvy,bposx,bposy,bposz;
|
||||
int32_t bposx,bposy,bposz;
|
||||
int32_t floorz,ceilingz,lastvx,lastvy;
|
||||
int32_t flags;
|
||||
intptr_t temp_data[10]; // sometimes used to hold pointers to con code
|
||||
int16_t picnum,ang,extra,owner,movflag;
|
||||
|
|
|
@ -3794,9 +3794,10 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
|
||||
if (pp->invdisptime > 0) G_DrawInventory(pp);
|
||||
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[screenpeek].ps->i,screenpeek);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
if (apScriptGameEvent[EVENT_DISPLAYSBAR])
|
||||
X_OnEvent(EVENT_DISPLAYSBAR, g_player[screenpeek].ps->i, screenpeek, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[screenpeek].ps->i,screenpeek) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
G_DrawStatusBar(screenpeek);
|
||||
|
||||
G_PrintGameQuotes();
|
||||
|
@ -3856,13 +3857,15 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
}
|
||||
}
|
||||
|
||||
if (apScriptGameEvent[EVENT_DISPLAYSBAR])
|
||||
X_OnEvent(EVENT_DISPLAYREST, g_player[screenpeek].ps->i, screenpeek, -1);
|
||||
|
||||
if (g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && ud.crosshair && ud.camerasprite == -1)
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[screenpeek].ps->i,screenpeek);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
if (apScriptGameEvent[EVENT_DISPLAYCROSSHAIR])
|
||||
X_OnEvent(EVENT_DISPLAYCROSSHAIR, g_player[screenpeek].ps->i, screenpeek, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[screenpeek].ps->i,screenpeek) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
rotatesprite((160L-(g_player[myconnectindex].ps->look_ang>>1))<<16,100L<<16,scale(65536,ud.crosshairscale,100),0,CROSSHAIR,0,CROSSHAIR_PAL,2+1,windowx1,windowy1,windowx2,windowy2);
|
||||
}
|
||||
#if 0
|
||||
|
@ -3968,7 +3971,7 @@ static void G_DoThirdPerson(DukePlayer_t *pp, vec3_t *vect,int16_t *vsectnum, in
|
|||
sp->cstat &= (int16_t)~0x101;
|
||||
|
||||
updatesectorz(vect->x,vect->y,vect->z,vsectnum);
|
||||
hitscan((const vec3_t *)&vect,*vsectnum,nx,ny,nz,&hitinfo,CLIPMASK1);
|
||||
hitscan((const vec3_t *)vect,*vsectnum,nx,ny,nz,&hitinfo,CLIPMASK1);
|
||||
|
||||
if (*vsectnum < 0)
|
||||
{
|
||||
|
@ -3999,9 +4002,9 @@ static void G_DoThirdPerson(DukePlayer_t *pp, vec3_t *vect,int16_t *vsectnum, in
|
|||
else i = divscale16(hy,ny);
|
||||
if (i < g_cameraDistance) g_cameraDistance = i;
|
||||
}
|
||||
vect->x = (vect->x)+mulscale16(nx,g_cameraDistance);
|
||||
vect->y = (vect->y)+mulscale16(ny,g_cameraDistance);
|
||||
vect->z = (vect->z)+mulscale16(nz,g_cameraDistance);
|
||||
vect->x += mulscale16(nx,g_cameraDistance);
|
||||
vect->y += mulscale16(ny,g_cameraDistance);
|
||||
vect->z += mulscale16(nz,g_cameraDistance);
|
||||
|
||||
g_cameraDistance = min(g_cameraDistance+((totalclock-g_cameraClock)<<10),65536);
|
||||
g_cameraClock = totalclock;
|
||||
|
@ -4056,15 +4059,17 @@ void G_DrawBackground(void)
|
|||
{
|
||||
// when not rendering a game, fullscreen wipe
|
||||
#define MENUTILE (!getrendermode()?MENUSCREEN:LOADSCREEN)
|
||||
Gv_SetVar(g_iReturnVarID,tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?MENUTILE:BIGHOLE, -1, -1);
|
||||
// Gv_SetVar(g_iReturnVarID,tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?MENUTILE:BIGHOLE, -1, -1);
|
||||
aGameVars[g_iReturnVarID].val.lValue = (tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?MENUTILE:BIGHOLE);
|
||||
if (apScriptGameEvent[EVENT_GETMENUTILE])
|
||||
X_OnEvent(EVENT_GETMENUTILE, -1, myconnectindex, -1);
|
||||
if (Gv_GetVarByLabel("MENU_TILE", tilesizx[MENUTILE]==320&&tilesizy[MENUTILE]==200?0:1, -1, -1))
|
||||
{
|
||||
for (y=y1;y<y2;y+=tilesizy[Gv_GetVar(g_iReturnVarID, -1, -1)])
|
||||
for (x=0;x<xdim;x+=tilesizx[Gv_GetVar(g_iReturnVarID, -1, -1)])
|
||||
rotatesprite(x<<16,y<<16,65536L,0,Gv_GetVar(g_iReturnVarID, -1, -1),bpp==8?16:8,0,8+16+64,0,0,xdim-1,ydim-1);
|
||||
for (y=y1;y<y2;y+=tilesizy[aGameVars[g_iReturnVarID].val.lValue])
|
||||
for (x=0;x<xdim;x+=tilesizx[aGameVars[g_iReturnVarID].val.lValue])
|
||||
rotatesprite(x<<16,y<<16,65536L,0,aGameVars[g_iReturnVarID].val.lValue,bpp==8?16:8,0,8+16+64,0,0,xdim-1,ydim-1);
|
||||
}
|
||||
else rotatesprite(320<<15,200<<15,65536L,0,Gv_GetVar(g_iReturnVarID, -1, -1),bpp==8?16:8,0,2+8+64,0,0,xdim-1,ydim-1);
|
||||
else rotatesprite(320<<15,200<<15,65536L,0,aGameVars[g_iReturnVarID].val.lValue,bpp==8?16:8,0,2+8+64,0,0,xdim-1,ydim-1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4523,6 +4528,7 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio)
|
|||
if (ud.camerahoriz > HORIZ_MAX) ud.camerahoriz = HORIZ_MAX;
|
||||
else if (ud.camerahoriz < HORIZ_MIN) ud.camerahoriz = HORIZ_MIN;
|
||||
|
||||
if (apScriptGameEvent[EVENT_DISPLAYROOMS])
|
||||
X_OnEvent(EVENT_DISPLAYROOMS, g_player[screenpeek].ps->i, screenpeek, -1);
|
||||
|
||||
#ifdef SE40
|
||||
|
@ -7501,6 +7507,8 @@ PALONLY:
|
|||
t->xrepeat = t->yrepeat = 0;
|
||||
}
|
||||
|
||||
if (apScriptGameEvent[EVENT_ANIMATESPRITES])
|
||||
{
|
||||
j = spritesortcnt-1;
|
||||
do
|
||||
{
|
||||
|
@ -7522,6 +7530,7 @@ PALONLY:
|
|||
X_OnEvent(EVENT_ANIMATESPRITES,tsprite[j].owner, myconnectindex, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
//#pragma auto_inline()
|
||||
#pragma optimize("",on)
|
||||
|
@ -7593,66 +7602,66 @@ void G_CheatGetInv(void)
|
|||
{
|
||||
Gv_SetVar(g_iReturnVarID, 400, g_player[myconnectindex].ps->i, myconnectindex);
|
||||
X_OnEvent(EVENT_CHEATGETSTEROIDS, g_player[myconnectindex].ps->i, myconnectindex, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID, g_player[myconnectindex].ps->i, myconnectindex) >=0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue >=0)
|
||||
{
|
||||
g_player[myconnectindex].ps->steroids_amount =
|
||||
Gv_GetVar(g_iReturnVarID, g_player[myconnectindex].ps->i, myconnectindex);
|
||||
aGameVars[g_iReturnVarID].val.lValue;
|
||||
}
|
||||
|
||||
Gv_SetVar(g_iReturnVarID, 1200, g_player[myconnectindex].ps->i, myconnectindex);
|
||||
X_OnEvent(EVENT_CHEATGETHEAT, g_player[myconnectindex].ps->i, myconnectindex, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID, g_player[myconnectindex].ps->i, myconnectindex) >=0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue >=0)
|
||||
{
|
||||
g_player[myconnectindex].ps->heat_amount =
|
||||
Gv_GetVar(g_iReturnVarID, g_player[myconnectindex].ps->i, myconnectindex);
|
||||
aGameVars[g_iReturnVarID].val.lValue;
|
||||
}
|
||||
|
||||
Gv_SetVar(g_iReturnVarID, 200, g_player[myconnectindex].ps->i, myconnectindex);
|
||||
X_OnEvent(EVENT_CHEATGETBOOT, g_player[myconnectindex].ps->i, myconnectindex, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID, g_player[myconnectindex].ps->i, myconnectindex) >=0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue >=0)
|
||||
{
|
||||
g_player[myconnectindex].ps->boot_amount =
|
||||
Gv_GetVar(g_iReturnVarID, g_player[myconnectindex].ps->i, myconnectindex);
|
||||
aGameVars[g_iReturnVarID].val.lValue;
|
||||
}
|
||||
|
||||
Gv_SetVar(g_iReturnVarID, 100, g_player[myconnectindex].ps->i, myconnectindex);
|
||||
X_OnEvent(EVENT_CHEATGETSHIELD, g_player[myconnectindex].ps->i, myconnectindex, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID, g_player[myconnectindex].ps->i, myconnectindex) >=0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue >=0)
|
||||
{
|
||||
g_player[myconnectindex].ps->shield_amount =
|
||||
Gv_GetVar(g_iReturnVarID, g_player[myconnectindex].ps->i, myconnectindex);
|
||||
aGameVars[g_iReturnVarID].val.lValue;
|
||||
}
|
||||
|
||||
Gv_SetVar(g_iReturnVarID, 6400, g_player[myconnectindex].ps->i, myconnectindex);
|
||||
X_OnEvent(EVENT_CHEATGETSCUBA, g_player[myconnectindex].ps->i, myconnectindex, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID, g_player[myconnectindex].ps->i, myconnectindex) >=0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue >=0)
|
||||
{
|
||||
g_player[myconnectindex].ps->scuba_amount =
|
||||
Gv_GetVar(g_iReturnVarID, g_player[myconnectindex].ps->i, myconnectindex);
|
||||
aGameVars[g_iReturnVarID].val.lValue;
|
||||
}
|
||||
|
||||
Gv_SetVar(g_iReturnVarID, 2400, g_player[myconnectindex].ps->i, myconnectindex);
|
||||
X_OnEvent(EVENT_CHEATGETHOLODUKE, g_player[myconnectindex].ps->i, myconnectindex, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID, g_player[myconnectindex].ps->i, myconnectindex) >=0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue >=0)
|
||||
{
|
||||
g_player[myconnectindex].ps->holoduke_amount =
|
||||
Gv_GetVar(g_iReturnVarID, g_player[myconnectindex].ps->i, myconnectindex);
|
||||
aGameVars[g_iReturnVarID].val.lValue;
|
||||
}
|
||||
|
||||
Gv_SetVar(g_iReturnVarID, 1600, g_player[myconnectindex].ps->i, myconnectindex);
|
||||
X_OnEvent(EVENT_CHEATGETJETPACK, g_player[myconnectindex].ps->i, myconnectindex, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID, g_player[myconnectindex].ps->i, myconnectindex) >=0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue >=0)
|
||||
{
|
||||
g_player[myconnectindex].ps->jetpack_amount =
|
||||
Gv_GetVar(g_iReturnVarID, g_player[myconnectindex].ps->i, myconnectindex);
|
||||
aGameVars[g_iReturnVarID].val.lValue;
|
||||
}
|
||||
|
||||
Gv_SetVar(g_iReturnVarID, g_player[myconnectindex].ps->max_player_health, g_player[myconnectindex].ps->i, myconnectindex);
|
||||
X_OnEvent(EVENT_CHEATGETFIRSTAID, g_player[myconnectindex].ps->i, myconnectindex, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID, g_player[myconnectindex].ps->i, myconnectindex) >=0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue >=0)
|
||||
{
|
||||
g_player[myconnectindex].ps->firstaid_amount =
|
||||
Gv_GetVar(g_iReturnVarID, g_player[myconnectindex].ps->i, myconnectindex);
|
||||
aGameVars[g_iReturnVarID].val.lValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11940,6 +11949,7 @@ RECHECK:
|
|||
ud.reccnt--;
|
||||
}
|
||||
G_DoMoveThings();
|
||||
ototalclock += TICSPERFRAME;
|
||||
}
|
||||
|
||||
if (foundemo == 0)
|
||||
|
@ -11948,7 +11958,8 @@ RECHECK:
|
|||
{
|
||||
G_HandleLocalKeys();
|
||||
|
||||
j = min(max((totalclock-lockclock)*(65536/TICSPERFRAME),0),65536);
|
||||
// j = min(max((totalclock-lockclock)*(65536/TICSPERFRAME),0),65536);
|
||||
j = min(max((totalclock - ototalclock) * (65536 / TICSPERFRAME),0),65536);
|
||||
G_DrawRooms(screenpeek,j);
|
||||
G_DisplayRest(j);
|
||||
|
||||
|
@ -12529,6 +12540,7 @@ FAKEHORIZONLY:
|
|||
|
||||
ENDFAKEPROCESSINPUT:
|
||||
|
||||
if (apScriptGameEvent[EVENT_FAKEDOMOVETHINGS])
|
||||
X_OnEvent(EVENT_FAKEDOMOVETHINGS, g_player[myconnectindex].ps->i, myconnectindex, -1);
|
||||
|
||||
myxbak[predictfifoplc&(MOVEFIFOSIZ-1)] = my.x;
|
||||
|
|
|
@ -1383,7 +1383,7 @@ static int32_t C_CheckEventSync(int32_t iEventID)
|
|||
#define GetDefID(szGameLabel) hash_find(&gamevarH,szGameLabel)
|
||||
#define GetADefID(szGameLabel) hash_find(&arrayH,szGameLabel)
|
||||
|
||||
static inline int32_t ispecial(char c)
|
||||
static inline int32_t ispecial(const char c)
|
||||
{
|
||||
if (c == 0x0a)
|
||||
{
|
||||
|
@ -1397,7 +1397,7 @@ static inline int32_t ispecial(char c)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline int32_t isaltok(char c)
|
||||
static inline int32_t isaltok(const char c)
|
||||
{
|
||||
return (isalnum(c) || c == '{' || c == '}' || c == '/' || c == '\\' ||
|
||||
c == '*' || c == '-' || c == '_' || c == '.');
|
||||
|
|
|
@ -149,7 +149,7 @@ static int32_t A_CheckSquished(int32_t i, int32_t p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void P_ForceAngle(DukePlayer_t *p)
|
||||
static inline void P_ForceAngle(DukePlayer_t *p)
|
||||
{
|
||||
int32_t n = 128-(krand()&255);
|
||||
|
||||
|
@ -658,7 +658,7 @@ static inline void X_DoConditional(int32_t condition)
|
|||
|
||||
static int32_t X_DoExecute(void)
|
||||
{
|
||||
int32_t j, l, s, tw = *insptr;
|
||||
int32_t tw = *insptr;
|
||||
|
||||
if (vm.g_killitFlag + vm.g_killitFlag) return 1;
|
||||
|
||||
|
@ -700,17 +700,20 @@ static int32_t X_DoExecute(void)
|
|||
break;
|
||||
|
||||
case CON_IFCANSHOOTTARGET:
|
||||
{
|
||||
int32_t j;
|
||||
if (vm.g_x > 1024)
|
||||
{
|
||||
int16_t temphit, sclip = 768, angdif = 16;
|
||||
|
||||
j = A_CheckHitSprite(vm.g_i,&temphit);
|
||||
|
||||
if (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->xrepeat > 56)
|
||||
{
|
||||
sclip = 3084;
|
||||
angdif = 48;
|
||||
}
|
||||
|
||||
j = A_CheckHitSprite(vm.g_i,&temphit);
|
||||
if (j == (1<<30))
|
||||
{
|
||||
X_DoConditional(1);
|
||||
|
@ -751,12 +754,15 @@ static int32_t X_DoExecute(void)
|
|||
else j = 1;
|
||||
|
||||
X_DoConditional(j);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_IFCANSEETARGET:
|
||||
j = cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-((krand()&41)<<8),vm.g_sp->sectnum,g_player[vm.g_p].ps->posx,g_player[vm.g_p].ps->posy,g_player[vm.g_p].ps->posz/*-((krand()&41)<<8)*/,sprite[g_player[vm.g_p].ps->i].sectnum);
|
||||
{
|
||||
int32_t j = cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-((krand()&41)<<8),vm.g_sp->sectnum,g_player[vm.g_p].ps->posx,g_player[vm.g_p].ps->posy,g_player[vm.g_p].ps->posz/*-((krand()&41)<<8)*/,sprite[g_player[vm.g_p].ps->i].sectnum);
|
||||
X_DoConditional(j);
|
||||
if (j) ActorExtra[vm.g_i].timetosleep = SLEEPTIME;
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_IFACTORNOTSTAYPUT:
|
||||
|
@ -766,6 +772,7 @@ static int32_t X_DoExecute(void)
|
|||
case CON_IFCANSEE:
|
||||
{
|
||||
spritetype *s = &sprite[g_player[vm.g_p].ps->i];
|
||||
int32_t j;
|
||||
|
||||
// select sprite for monster to target
|
||||
// if holoduke is on, let them target holoduke first.
|
||||
|
@ -895,7 +902,8 @@ static int32_t X_DoExecute(void)
|
|||
{
|
||||
if (*insptr == 0)
|
||||
{
|
||||
for (j=0;j < g_player[vm.g_p].ps->weapreccnt;j++)
|
||||
int32_t j = 0;
|
||||
for (;j < g_player[vm.g_p].ps->weapreccnt;j++)
|
||||
if (g_player[vm.g_p].ps->weaprecs[j] == vm.g_sp->picnum)
|
||||
break;
|
||||
|
||||
|
@ -960,7 +968,8 @@ static int32_t X_DoExecute(void)
|
|||
case CON_SIZETO:
|
||||
insptr++;
|
||||
|
||||
j = (*insptr++-vm.g_sp->xrepeat)<<1;
|
||||
{
|
||||
int32_t j = (*insptr++-vm.g_sp->xrepeat)<<1;
|
||||
vm.g_sp->xrepeat += ksgn(j);
|
||||
|
||||
if ((vm.g_sp->picnum == APLAYER && vm.g_sp->yrepeat < 36) || *insptr < vm.g_sp->yrepeat || ((vm.g_sp->yrepeat*(tilesizy[vm.g_sp->picnum]+8))<<2) < (ActorExtra[vm.g_i].floorz - ActorExtra[vm.g_i].ceilingz))
|
||||
|
@ -968,6 +977,7 @@ static int32_t X_DoExecute(void)
|
|||
j = ((*insptr)-vm.g_sp->yrepeat)<<1;
|
||||
if (klabs(j)) vm.g_sp->yrepeat += ksgn(j);
|
||||
}
|
||||
}
|
||||
insptr++;
|
||||
|
||||
break;
|
||||
|
@ -999,7 +1009,8 @@ static int32_t X_DoExecute(void)
|
|||
if ((*insptr<0 || *insptr>=MAXSOUNDS) && g_scriptSanityChecks)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],*insptr);
|
||||
insptr++;break;
|
||||
insptr++;
|
||||
break;
|
||||
}
|
||||
X_DoConditional(A_CheckSoundPlaying(vm.g_i,*insptr));
|
||||
// X_DoConditional(SoundOwner[*insptr][0].i == vm.g_i);
|
||||
|
@ -1048,7 +1059,8 @@ static int32_t X_DoExecute(void)
|
|||
insptr++;
|
||||
vm.g_sp->xoffset = vm.g_sp->yoffset = 0;
|
||||
|
||||
j = g_spriteGravity;
|
||||
{
|
||||
int32_t j = g_spriteGravity;
|
||||
|
||||
if (G_CheckForSpaceCeiling(vm.g_sp->sectnum) || sector[vm.g_sp->sectnum].lotag == 2)
|
||||
j = g_spriteGravity/6;
|
||||
|
@ -1094,6 +1106,7 @@ static int32_t X_DoExecute(void)
|
|||
A_PlaySound(THUD,vm.g_i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vm.g_sp->z > (ActorExtra[vm.g_i].floorz - FOURSLEIGHT))
|
||||
{
|
||||
|
@ -1234,6 +1247,9 @@ static int32_t X_DoExecute(void)
|
|||
case CON_ADDPHEALTH:
|
||||
insptr++;
|
||||
|
||||
{
|
||||
int32_t j;
|
||||
|
||||
if (g_player[vm.g_p].ps->newowner >= 0)
|
||||
{
|
||||
g_player[vm.g_p].ps->newowner = -1;
|
||||
|
@ -1293,6 +1309,7 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
sprite[g_player[vm.g_p].ps->i].extra = j;
|
||||
}
|
||||
}
|
||||
|
||||
insptr++;
|
||||
break;
|
||||
|
@ -1432,7 +1449,7 @@ static int32_t X_DoExecute(void)
|
|||
insptr++;
|
||||
{
|
||||
int32_t i=*insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
if ((ScriptQuotes[j] == NULL) && g_scriptSanityChecks)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],j);
|
||||
|
@ -1447,7 +1464,7 @@ static int32_t X_DoExecute(void)
|
|||
insptr++;
|
||||
{
|
||||
int32_t i=*insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
if ((j < 0 || j > MAXSTATUS) && g_scriptSanityChecks)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "invalid status list %d\n",g_errorLineNum,keyw[g_tw],j);
|
||||
|
@ -1461,7 +1478,7 @@ static int32_t X_DoExecute(void)
|
|||
insptr++;
|
||||
{
|
||||
int32_t i=*insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
if ((j < 0 || j >= MAXSPRITES) && g_scriptSanityChecks)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j);
|
||||
|
@ -1475,7 +1492,7 @@ static int32_t X_DoExecute(void)
|
|||
insptr++;
|
||||
{
|
||||
int32_t i=*insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
if ((j < 0 || j >= MAXSPRITES) && g_scriptSanityChecks)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j);
|
||||
|
@ -1489,7 +1506,7 @@ static int32_t X_DoExecute(void)
|
|||
insptr++;
|
||||
{
|
||||
int32_t i=*insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
if ((j < 0 || j > numsectors) && g_scriptSanityChecks)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "invalid sector %d\n",g_errorLineNum,keyw[g_tw],j);
|
||||
|
@ -1503,7 +1520,7 @@ static int32_t X_DoExecute(void)
|
|||
insptr++;
|
||||
{
|
||||
int32_t i=*insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
if ((j < 0 || j >= MAXSPRITES) && g_scriptSanityChecks)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j);
|
||||
|
@ -1517,7 +1534,7 @@ static int32_t X_DoExecute(void)
|
|||
insptr++;
|
||||
{
|
||||
int32_t i=*insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
if ((j < 0 || j >= MAXSPRITES) && g_scriptSanityChecks)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j);
|
||||
|
@ -1532,7 +1549,7 @@ static int32_t X_DoExecute(void)
|
|||
{
|
||||
int32_t i = Gv_GetVarX(*insptr++),
|
||||
f=Gv_GetVarX(*insptr++);
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
if ((i<0 || i>=MAXQUOTES) && g_scriptSanityChecks)
|
||||
OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],i);
|
||||
else if ((ScriptQuotes[i] == NULL) && g_scriptSanityChecks)
|
||||
|
@ -1668,7 +1685,7 @@ static int32_t X_DoExecute(void)
|
|||
insptr++;
|
||||
{
|
||||
int32_t i = Gv_GetVarX(*insptr++);
|
||||
j = Gv_GetVarX(*insptr++);
|
||||
int32_t j = Gv_GetVarX(*insptr++);
|
||||
|
||||
if ((i<0 || i>=MAXSPRITES) && g_scriptSanityChecks)
|
||||
{
|
||||
|
@ -1915,12 +1932,14 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
case CON_INITTIMER:
|
||||
insptr++;
|
||||
j = Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j = Gv_GetVarX(*insptr++);
|
||||
if (g_timerTicsPerSecond == j)
|
||||
break;
|
||||
uninittimer();
|
||||
inittimer(j);
|
||||
g_timerTicsPerSecond = j;
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_TIME:
|
||||
|
@ -1933,6 +1952,7 @@ static int32_t X_DoExecute(void)
|
|||
insptr++;
|
||||
{
|
||||
int32_t lIn=Gv_GetVarX(*insptr++);
|
||||
int32_t j;
|
||||
if ((vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= numsectors) && g_scriptSanityChecks)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum);
|
||||
|
@ -1945,7 +1965,7 @@ static int32_t X_DoExecute(void)
|
|||
if (j != -1)
|
||||
A_AddToDeleteQueue(j);
|
||||
case CON_ESPAWNVAR:
|
||||
Gv_SetVarX(g_iReturnVarID, j);
|
||||
aGameVars[g_iReturnVarID].val.lValue = j;
|
||||
break;
|
||||
case CON_QSPAWNVAR:
|
||||
if (j != -1)
|
||||
|
@ -1960,6 +1980,9 @@ static int32_t X_DoExecute(void)
|
|||
case CON_QSPAWN:
|
||||
insptr++;
|
||||
|
||||
{
|
||||
int32_t j;
|
||||
|
||||
if ((vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= numsectors) && g_scriptSanityChecks)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum);
|
||||
|
@ -1975,13 +1998,14 @@ static int32_t X_DoExecute(void)
|
|||
if (j != -1)
|
||||
A_AddToDeleteQueue(j);
|
||||
case CON_ESPAWN:
|
||||
Gv_SetVarX(g_iReturnVarID, j);
|
||||
aGameVars[g_iReturnVarID].val.lValue = j;
|
||||
break;
|
||||
case CON_QSPAWN:
|
||||
if (j != -1)
|
||||
A_AddToDeleteQueue(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_ESHOOT:
|
||||
|
@ -1989,6 +2013,9 @@ static int32_t X_DoExecute(void)
|
|||
case CON_ZSHOOT:
|
||||
insptr++;
|
||||
|
||||
{
|
||||
int32_t j;
|
||||
|
||||
if (tw == CON_ZSHOOT || tw == CON_EZSHOOT)
|
||||
{
|
||||
ActorExtra[vm.g_i].temp_data[9] = Gv_GetVarX(*insptr++);
|
||||
|
@ -2007,9 +2034,10 @@ static int32_t X_DoExecute(void)
|
|||
j = A_Shoot(vm.g_i,*insptr++);
|
||||
|
||||
if (tw == CON_EZSHOOT || tw == CON_ESHOOT)
|
||||
Gv_SetVarX(g_iReturnVarID, j);
|
||||
aGameVars[g_iReturnVarID].val.lValue = j;
|
||||
|
||||
ActorExtra[vm.g_i].temp_data[9]=0;
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_SHOOTVAR:
|
||||
|
@ -2018,6 +2046,7 @@ static int32_t X_DoExecute(void)
|
|||
case CON_ZSHOOTVAR:
|
||||
{
|
||||
int32_t lReturn=-1;
|
||||
int32_t j;
|
||||
|
||||
insptr++;
|
||||
|
||||
|
@ -2038,15 +2067,14 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
lReturn = A_Shoot(vm.g_i, j);
|
||||
if (tw == CON_ESHOOTVAR || tw == CON_EZSHOOTVAR)
|
||||
Gv_SetVarX(g_iReturnVarID, lReturn);
|
||||
aGameVars[g_iReturnVarID].val.lValue = lReturn;
|
||||
ActorExtra[vm.g_i].temp_data[9]=0;
|
||||
break;
|
||||
}
|
||||
|
||||
case CON_CMENU:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
ChangeToMenu(j);
|
||||
ChangeToMenu(Gv_GetVarX(*insptr++));
|
||||
break;
|
||||
|
||||
case CON_SOUNDVAR:
|
||||
|
@ -2054,7 +2082,8 @@ static int32_t X_DoExecute(void)
|
|||
case CON_SOUNDONCEVAR:
|
||||
case CON_GLOBALSOUNDVAR:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
|
||||
switch (tw)
|
||||
{
|
||||
|
@ -2077,12 +2106,13 @@ static int32_t X_DoExecute(void)
|
|||
A_PlaySound((int16_t)j,vm.g_i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_GUNIQHUDID:
|
||||
insptr++;
|
||||
{
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
if (j >= 0 && j < MAXUNIQHUDID-1)
|
||||
guniqhudid = j;
|
||||
else
|
||||
|
@ -2128,6 +2158,7 @@ static int32_t X_DoExecute(void)
|
|||
int32_t x2=scale(Gv_GetVarX(*insptr++),xdim,320);
|
||||
int32_t y2=scale(Gv_GetVarX(*insptr++),ydim,200);
|
||||
int32_t smoothratio = min(max((totalclock - ototalclock) * (65536 / TICSPERFRAME),0),65536);
|
||||
int32_t j;
|
||||
|
||||
if (x1 > x2) swaplong(&x1,&x2);
|
||||
if (y1 > y2) swaplong(&y1,&y2);
|
||||
|
@ -2538,6 +2569,7 @@ static int32_t X_DoExecute(void)
|
|||
insptr++;
|
||||
{
|
||||
int32_t dnum = *insptr++;
|
||||
int32_t s, l, j;
|
||||
|
||||
if (vm.g_sp->sectnum >= 0 && vm.g_sp->sectnum < MAXSECTORS)
|
||||
for (j=(*insptr)-1;j>=0;j--)
|
||||
|
@ -2702,6 +2734,7 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
g_player[vm.g_p].ps->movement_lock = 0;
|
||||
|
||||
if (apScriptGameEvent[EVENT_RESETPLAYER])
|
||||
X_OnEvent(EVENT_RESETPLAYER, g_player[vm.g_p].ps->i, vm.g_p, -1);
|
||||
g_cameraDistance = 0;
|
||||
g_cameraClock = totalclock;
|
||||
|
@ -2818,10 +2851,9 @@ static int32_t X_DoExecute(void)
|
|||
{
|
||||
// insptr++;
|
||||
|
||||
l = *(++insptr);
|
||||
j = 0;
|
||||
|
||||
s = sprite[g_player[vm.g_p].ps->i].xvel;
|
||||
int32_t l = *(++insptr);
|
||||
int32_t j = 0;
|
||||
int32_t s = sprite[g_player[vm.g_p].ps->i].xvel;
|
||||
|
||||
if ((l&8) && g_player[vm.g_p].ps->on_ground && TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_CROUCH))
|
||||
j = 1;
|
||||
|
@ -2915,7 +2947,8 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
case CON_CLEARMAPSTATE:
|
||||
insptr++;
|
||||
j = Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j = Gv_GetVarX(*insptr++);
|
||||
if ((j < 0 || j >= MAXVOLUMES*MAXLEVELS) && g_scriptSanityChecks)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Invalid map number: %d\n",g_errorLineNum,keyw[g_tw],j);
|
||||
|
@ -2923,6 +2956,7 @@ static int32_t X_DoExecute(void)
|
|||
}
|
||||
if (MapInfo[j].savedstate)
|
||||
G_FreeMapState(j);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case CON_STOPALLSOUNDS:
|
||||
|
@ -2958,7 +2992,7 @@ static int32_t X_DoExecute(void)
|
|||
if ((sector[neartagsector].lotag&16384) == 0)
|
||||
if ((sector[neartagsector].lotag&32768) == 0)
|
||||
{
|
||||
j = headspritesect[neartagsector];
|
||||
int32_t j = headspritesect[neartagsector];
|
||||
while (j >= 0)
|
||||
{
|
||||
if (sprite[j].picnum == ACTIVATOR)
|
||||
|
@ -3012,9 +3046,12 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
case CON_PALFROM:
|
||||
insptr++;
|
||||
{
|
||||
int32_t j = 2;
|
||||
g_player[vm.g_p].ps->pals_time = *insptr++;
|
||||
for (j=2;j>=0;j--)
|
||||
for (;j>=0;j--)
|
||||
g_player[vm.g_p].ps->pals[2-j] = *insptr++;
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_QSPRINTF:
|
||||
|
@ -3364,14 +3401,22 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
case CON_FINDPLAYER:
|
||||
insptr++;
|
||||
Gv_SetVarX(g_iReturnVarID, A_FindPlayer(&sprite[vm.g_i],&j));
|
||||
{
|
||||
int32_t j;
|
||||
// Gv_SetVarX(g_iReturnVarID, A_FindPlayer(&sprite[vm.g_i],&j));
|
||||
aGameVars[g_iReturnVarID].val.lValue = A_FindPlayer(&sprite[vm.g_i],&j);
|
||||
Gv_SetVarX(*insptr++, j);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_FINDOTHERPLAYER:
|
||||
insptr++;
|
||||
Gv_SetVarX(g_iReturnVarID, P_FindOtherPlayer(vm.g_p,&j));
|
||||
{
|
||||
int32_t j;
|
||||
// Gv_SetVarX(g_iReturnVarID, P_FindOtherPlayer(vm.g_p,&j));
|
||||
aGameVars[g_iReturnVarID].val.lValue = P_FindOtherPlayer(vm.g_p,&j);
|
||||
Gv_SetVarX(*insptr++, j);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_SETPLAYER:
|
||||
|
@ -3447,7 +3492,7 @@ static int32_t X_DoExecute(void)
|
|||
// gets the value of the per-actor variable varx into VAR
|
||||
// <var> <varx> <VAR>
|
||||
int32_t lSprite=Gv_GetVarX(*insptr++), lVar1=*insptr++;
|
||||
j=*insptr++;
|
||||
int32_t j=*insptr++;
|
||||
|
||||
if ((lSprite < 0 || lSprite >= MAXSPRITES) && g_scriptSanityChecks)
|
||||
{
|
||||
|
@ -3548,7 +3593,8 @@ static int32_t X_DoExecute(void)
|
|||
case CON_CHECKAVAILWEAPON:
|
||||
case CON_CHECKAVAILINVEN:
|
||||
insptr++;
|
||||
j = vm.g_p;
|
||||
{
|
||||
int32_t j = vm.g_p;
|
||||
|
||||
if (*insptr != g_iThisActorID)
|
||||
j=Gv_GetVarX(*insptr);
|
||||
|
@ -3564,6 +3610,7 @@ static int32_t X_DoExecute(void)
|
|||
if (tw == CON_CHECKAVAILWEAPON)
|
||||
P_CheckWeapon(g_player[j].ps);
|
||||
else P_SelectNextInvItem(g_player[j].ps);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
@ -3597,8 +3644,8 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
case CON_SETARRAY:
|
||||
insptr++;
|
||||
j=*insptr++;
|
||||
{
|
||||
int32_t j=*insptr++;
|
||||
int32_t index = Gv_GetVarX(*insptr++);
|
||||
int32_t value = Gv_GetVarX(*insptr++);
|
||||
|
||||
|
@ -3613,14 +3660,16 @@ static int32_t X_DoExecute(void)
|
|||
}
|
||||
case CON_GETARRAYSIZE:
|
||||
insptr++;
|
||||
j=*insptr++;
|
||||
{
|
||||
int32_t j=*insptr++;
|
||||
Gv_SetVarX(*insptr++,aGameArrays[j].size);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_RESIZEARRAY:
|
||||
insptr++;
|
||||
j=*insptr++;
|
||||
{
|
||||
int32_t j=*insptr++;
|
||||
int32_t asize = Gv_GetVarX(*insptr++);
|
||||
if (asize > 0)
|
||||
{
|
||||
|
@ -3693,25 +3742,32 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
case CON_SETVARVAR:
|
||||
insptr++;
|
||||
j=*insptr++;
|
||||
{
|
||||
int32_t j=*insptr++;
|
||||
Gv_SetVarX(j, Gv_GetVarX(*insptr++));
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_RANDVARVAR:
|
||||
insptr++;
|
||||
j=*insptr++;
|
||||
{
|
||||
int32_t j=*insptr++;
|
||||
Gv_SetVarX(j,mulscale(krand(), Gv_GetVarX(*insptr++)+1, 16));
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_DISPLAYRANDVARVAR:
|
||||
insptr++;
|
||||
j=*insptr++;
|
||||
{
|
||||
int32_t j=*insptr++;
|
||||
Gv_SetVarX(j,mulscale(rand(), Gv_GetVarX(*insptr++)+1, 15));
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_GMAXAMMO:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
if ((j<0 || j>=MAX_WEAPONS) && g_scriptSanityChecks)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],j);
|
||||
|
@ -3719,11 +3775,13 @@ static int32_t X_DoExecute(void)
|
|||
break;
|
||||
}
|
||||
Gv_SetVarX(*insptr++, g_player[vm.g_p].ps->max_ammo_amount[j]);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_SMAXAMMO:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
if ((j<0 || j>=MAX_WEAPONS) && g_scriptSanityChecks)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],j);
|
||||
|
@ -3731,18 +3789,21 @@ static int32_t X_DoExecute(void)
|
|||
break;
|
||||
}
|
||||
g_player[vm.g_p].ps->max_ammo_amount[j]=Gv_GetVarX(*insptr++);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_MULVARVAR:
|
||||
insptr++;
|
||||
j=*insptr++;
|
||||
{
|
||||
int32_t j=*insptr++;
|
||||
Gv_SetVarX(j, Gv_GetVarX(j)*Gv_GetVarX(*insptr++));
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_DIVVARVAR:
|
||||
insptr++;
|
||||
j=*insptr++;
|
||||
{
|
||||
int32_t j=*insptr++;
|
||||
int32_t l2=Gv_GetVarX(*insptr++);
|
||||
|
||||
if (l2==0)
|
||||
|
@ -3756,8 +3817,8 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
case CON_MODVARVAR:
|
||||
insptr++;
|
||||
j=*insptr++;
|
||||
{
|
||||
int32_t j=*insptr++;
|
||||
int32_t l2=Gv_GetVarX(*insptr++);
|
||||
|
||||
if (l2==0)
|
||||
|
@ -3772,20 +3833,26 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
case CON_ANDVARVAR:
|
||||
insptr++;
|
||||
j=*insptr++;
|
||||
{
|
||||
int32_t j=*insptr++;
|
||||
Gv_SetVarX(j, Gv_GetVarX(j) & Gv_GetVarX(*insptr++));
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_XORVARVAR:
|
||||
insptr++;
|
||||
j=*insptr++;
|
||||
{
|
||||
int32_t j=*insptr++;
|
||||
Gv_SetVarX(j, Gv_GetVarX(j) ^ Gv_GetVarX(*insptr++));
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_ORVARVAR:
|
||||
insptr++;
|
||||
j=*insptr++;
|
||||
{
|
||||
int32_t j=*insptr++;
|
||||
Gv_SetVarX(j, Gv_GetVarX(j) | Gv_GetVarX(*insptr++));
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_SUBVAR:
|
||||
|
@ -3796,8 +3863,10 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
case CON_SUBVARVAR:
|
||||
insptr++;
|
||||
j=*insptr++;
|
||||
{
|
||||
int32_t j=*insptr++;
|
||||
Gv_SetVarX(j, Gv_GetVarX(j) - Gv_GetVarX(*insptr++));
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_ADDVAR:
|
||||
|
@ -3832,8 +3901,10 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
case CON_ADDVARVAR:
|
||||
insptr++;
|
||||
j=*insptr++;
|
||||
{
|
||||
int32_t j=*insptr++;
|
||||
Gv_SetVarX(j, Gv_GetVarX(j) + Gv_GetVarX(*insptr++));
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_SPGETLOTAG:
|
||||
|
@ -3877,19 +3948,20 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
case CON_ACTIVATECHEAT:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*(insptr++));
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*(insptr++));
|
||||
if (numplayers != 1 || !(g_player[myconnectindex].ps->gm & MODE_GAME))
|
||||
{
|
||||
OSD_Printf(CON_ERROR "not in a single-player game.\n",g_errorLineNum,keyw[g_tw]);
|
||||
break;
|
||||
}
|
||||
osdcmd_cheatsinfo_stat.cheatnum = j;
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_SETGAMEPALETTE:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*(insptr++));
|
||||
switch (j)
|
||||
switch (Gv_GetVarX(*(insptr++)))
|
||||
{
|
||||
default:
|
||||
case 0:P_SetGamePalette(g_player[vm.g_p].ps,palette ,0);break;
|
||||
|
@ -3909,83 +3981,104 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
case CON_IFVARVARAND:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
l=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j = Gv_GetVarX(*insptr++);
|
||||
j &= Gv_GetVarX(*insptr++);
|
||||
insptr--;
|
||||
X_DoConditional(j & l);
|
||||
X_DoConditional(j);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_IFVARVAROR:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
l=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j = Gv_GetVarX(*insptr++);
|
||||
j |= Gv_GetVarX(*insptr++);
|
||||
insptr--;
|
||||
X_DoConditional(j | l);
|
||||
X_DoConditional(j);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_IFVARVARXOR:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
l=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j = Gv_GetVarX(*insptr++);
|
||||
j ^= Gv_GetVarX(*insptr++);
|
||||
insptr--;
|
||||
X_DoConditional(j ^ l);
|
||||
X_DoConditional(j);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_IFVARVAREITHER:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
l=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j = Gv_GetVarX(*insptr++);
|
||||
int32_t l = Gv_GetVarX(*insptr++);
|
||||
insptr--;
|
||||
X_DoConditional(j || l);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_IFVARVARN:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
l=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j = Gv_GetVarX(*insptr++);
|
||||
j = (j != Gv_GetVarX(*insptr++));
|
||||
insptr--;
|
||||
X_DoConditional(j != l);
|
||||
X_DoConditional(j);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_IFVARVARE:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
l=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j = Gv_GetVarX(*insptr++);
|
||||
j = (j == Gv_GetVarX(*insptr++));
|
||||
insptr--;
|
||||
X_DoConditional(j == l);
|
||||
X_DoConditional(j);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_IFVARVARG:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
l=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j = Gv_GetVarX(*insptr++);
|
||||
j = (j > Gv_GetVarX(*insptr++));
|
||||
insptr--;
|
||||
X_DoConditional(j > l);
|
||||
X_DoConditional(j);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_IFVARVARL:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
l=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j = Gv_GetVarX(*insptr++);
|
||||
j = (j < Gv_GetVarX(*insptr++));
|
||||
insptr--;
|
||||
X_DoConditional(j < l);
|
||||
X_DoConditional(j);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_IFVARE:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
X_DoConditional(j == *insptr);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_IFVARN:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
X_DoConditional(j != *insptr);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_WHILEVARN:
|
||||
{
|
||||
intptr_t *savedinsptr=insptr+2;
|
||||
int32_t j;
|
||||
do
|
||||
{
|
||||
insptr=savedinsptr;
|
||||
|
@ -3998,13 +4091,13 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
case CON_WHILEVARVARN:
|
||||
{
|
||||
int32_t i;
|
||||
int32_t j;
|
||||
intptr_t *savedinsptr=insptr+2;
|
||||
do
|
||||
{
|
||||
insptr=savedinsptr;
|
||||
i = Gv_GetVarX(*(insptr-1));
|
||||
j = (i != Gv_GetVarX(*insptr++));
|
||||
j = Gv_GetVarX(*(insptr-1));
|
||||
j = (j != Gv_GetVarX(*insptr++));
|
||||
insptr--;
|
||||
X_DoConditional(j);
|
||||
}
|
||||
|
@ -4014,38 +4107,50 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
case CON_IFVARAND:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
X_DoConditional(j & *insptr);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_IFVAROR:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
X_DoConditional(j | *insptr);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_IFVARXOR:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
X_DoConditional(j ^ *insptr);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_IFVAREITHER:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
X_DoConditional(j || *insptr);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_IFVARG:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
X_DoConditional(j > *insptr);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_IFVARL:
|
||||
insptr++;
|
||||
j=Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j=Gv_GetVarX(*insptr++);
|
||||
X_DoConditional(j < *insptr);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_IFPHEALTHL:
|
||||
|
@ -4054,9 +4159,9 @@ static int32_t X_DoExecute(void)
|
|||
break;
|
||||
|
||||
case CON_IFPINVENTORY:
|
||||
{
|
||||
insptr++;
|
||||
j = 0;
|
||||
{
|
||||
int32_t j = 0;
|
||||
switch (*insptr++)
|
||||
{
|
||||
case GET_STEROIDS:
|
||||
|
@ -4112,7 +4217,8 @@ static int32_t X_DoExecute(void)
|
|||
if (g_player[vm.g_p].ps->knee_incs == 0 && sprite[g_player[vm.g_p].ps->i].xrepeat >= 40)
|
||||
if (cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(4<<8),vm.g_sp->sectnum,g_player[vm.g_p].ps->posx,g_player[vm.g_p].ps->posy,g_player[vm.g_p].ps->posz+(16<<8),sprite[g_player[vm.g_p].ps->i].sectnum))
|
||||
{
|
||||
for (j=ud.multimode-1;j>=0;j--)
|
||||
int32_t j = ud.multimode-1;
|
||||
for (;j>=0;j--)
|
||||
{
|
||||
if (g_player[j].ps->actorsqu == vm.g_i)
|
||||
break;
|
||||
|
@ -4130,8 +4236,7 @@ static int32_t X_DoExecute(void)
|
|||
case CON_IFAWAYFROMWALL:
|
||||
{
|
||||
int16_t s1=vm.g_sp->sectnum;
|
||||
|
||||
j = 0;
|
||||
int32_t j = 0;
|
||||
|
||||
updatesector(vm.g_sp->x+108,vm.g_sp->y+108,&s1);
|
||||
if (s1 == vm.g_sp->sectnum)
|
||||
|
@ -4226,16 +4331,21 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
case CON_IFANGDIFFL:
|
||||
insptr++;
|
||||
j = klabs(G_GetAngleDelta(g_player[vm.g_p].ps->ang,vm.g_sp->ang));
|
||||
{
|
||||
int32_t j = klabs(G_GetAngleDelta(g_player[vm.g_p].ps->ang,vm.g_sp->ang));
|
||||
X_DoConditional(j <= *insptr);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_IFNOSOUNDS:
|
||||
for (j=MAXSOUNDS-1;j>=0;j--)
|
||||
{
|
||||
int32_t j = MAXSOUNDS-1;
|
||||
for (;j>=0;j--)
|
||||
if (g_sounds[j].SoundOwner[0].i == vm.g_i)
|
||||
break;
|
||||
|
||||
X_DoConditional(j < 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_SPRITEFLAGS:
|
||||
|
@ -4245,20 +4355,26 @@ static int32_t X_DoExecute(void)
|
|||
|
||||
case CON_GETTICKS:
|
||||
insptr++;
|
||||
j=*insptr++;
|
||||
{
|
||||
int32_t j=*insptr++;
|
||||
Gv_SetVarX(j, getticks());
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_GETCURRADDRESS:
|
||||
insptr++;
|
||||
j=*insptr++;
|
||||
{
|
||||
int32_t j=*insptr++;
|
||||
Gv_SetVarX(j, (intptr_t)(insptr-script));
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_JUMP:
|
||||
insptr++;
|
||||
j = Gv_GetVarX(*insptr++);
|
||||
{
|
||||
int32_t j = Gv_GetVarX(*insptr++);
|
||||
insptr = (intptr_t *)(j+script);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
//-------------------------------------------------------------------------
|
||||
#include "duke3d.h"
|
||||
|
||||
const char *s_buildDate = "20090114";
|
||||
const char *s_buildDate = "20090117";
|
||||
char *MusicPtr = NULL;
|
||||
int32_t g_musicSize;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "mouse.h"
|
||||
#include "osd.h"
|
||||
#include "osdcmds.h"
|
||||
#include "gamedef.h"
|
||||
#include <sys/stat.h>
|
||||
|
||||
extern char inputloc;
|
||||
|
@ -562,6 +563,7 @@ void M_DisplayMenus(void)
|
|||
walock[TILE_LOADSHOT] = 1;
|
||||
return;
|
||||
}
|
||||
if (apScriptGameEvent[EVENT_DISPLAYMENU])
|
||||
X_OnEvent(EVENT_DISPLAYMENU, g_player[screenpeek].ps->i, screenpeek, -1);
|
||||
|
||||
g_player[myconnectindex].ps->gm &= (0xff-MODE_TYPE);
|
||||
|
@ -5404,6 +5406,7 @@ VOLUME_ALL_40x:
|
|||
|
||||
break;
|
||||
}
|
||||
if (apScriptGameEvent[EVENT_DISPLAYMENUREST])
|
||||
X_OnEvent(EVENT_DISPLAYMENUREST, g_player[myconnectindex].ps->i, myconnectindex, -1);
|
||||
|
||||
if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU)
|
||||
|
|
|
@ -62,10 +62,11 @@ static void P_IncurDamage(DukePlayer_t *p)
|
|||
{
|
||||
int32_t damage = 0L, shield_damage = 0L;
|
||||
|
||||
Gv_SetVar(g_iReturnVarID,0,p->i,sprite[p->i].yvel);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
if (apScriptGameEvent[EVENT_INCURDAMAGE])
|
||||
X_OnEvent(EVENT_INCURDAMAGE, p->i, sprite[p->i].yvel, -1);
|
||||
|
||||
if (Gv_GetVar(g_iReturnVarID,p->i,sprite[p->i].yvel) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
|
||||
{
|
||||
sprite[p->i].extra -= p->extra_extra8>>8;
|
||||
|
@ -564,6 +565,7 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
|
|||
int32_t zRange=256;
|
||||
|
||||
Gv_SetVar(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p);
|
||||
if (apScriptGameEvent[EVENT_GETAUTOAIMANGLE])
|
||||
X_OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1);
|
||||
j=-1;
|
||||
if (Gv_GetVar(g_iAimAngleVarID,i,p) > 0)
|
||||
|
@ -898,6 +900,7 @@ DOSKIPBULLETHOLE:
|
|||
{
|
||||
// j = A_FindTargetSprite( s, AUTO_AIM_ANGLE ); // 48
|
||||
Gv_SetVar(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p);
|
||||
if (apScriptGameEvent[EVENT_GETAUTOAIMANGLE])
|
||||
X_OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1);
|
||||
j=-1;
|
||||
if (Gv_GetVar(g_iAimAngleVarID,i,p) > 0)
|
||||
|
@ -1147,6 +1150,7 @@ DOSKIPBULLETHOLE:
|
|||
int32_t zRange=256;
|
||||
|
||||
Gv_SetVar(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p);
|
||||
if (apScriptGameEvent[EVENT_GETAUTOAIMANGLE])
|
||||
X_OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1);
|
||||
j=-1;
|
||||
if (Gv_GetVar(g_iAimAngleVarID,i,p) > 0)
|
||||
|
@ -1441,6 +1445,7 @@ SKIPBULLETHOLE:
|
|||
{
|
||||
// j = A_FindTargetSprite( s, AUTO_AIM_ANGLE );
|
||||
Gv_SetVar(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p);
|
||||
if (apScriptGameEvent[EVENT_GETAUTOAIMANGLE])
|
||||
X_OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1);
|
||||
j=-1;
|
||||
if (Gv_GetVar(g_iAimAngleVarID,i,p) > 0)
|
||||
|
@ -1546,6 +1551,7 @@ SKIPBULLETHOLE:
|
|||
{
|
||||
// j = A_FindTargetSprite( s, AUTO_AIM_ANGLE ); // 48
|
||||
Gv_SetVar(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p);
|
||||
if (apScriptGameEvent[EVENT_GETAUTOAIMANGLE])
|
||||
X_OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1);
|
||||
j=-1;
|
||||
if (Gv_GetVar(g_iAimAngleVarID,i,p) > 0)
|
||||
|
@ -1752,6 +1758,7 @@ SKIPBULLETHOLE:
|
|||
{
|
||||
// j = A_FindTargetSprite( s, AUTO_AIM_ANGLE );
|
||||
Gv_SetVar(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p);
|
||||
if (apScriptGameEvent[EVENT_GETAUTOAIMANGLE])
|
||||
X_OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1);
|
||||
j=-1;
|
||||
if (Gv_GetVar(g_iAimAngleVarID,i,p) > 0)
|
||||
|
@ -1851,6 +1858,7 @@ SKIPBULLETHOLE:
|
|||
{
|
||||
// j = A_FindTargetSprite( s, AUTO_AIM_ANGLE );
|
||||
Gv_SetVar(g_iAimAngleVarID,AUTO_AIM_ANGLE,i,p);
|
||||
if (apScriptGameEvent[EVENT_GETAUTOAIMANGLE])
|
||||
X_OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1);
|
||||
j=-1;
|
||||
if (Gv_GetVar(g_iAimAngleVarID,i,p) > 0)
|
||||
|
@ -2058,10 +2066,11 @@ void P_FireWeapon(DukePlayer_t *p)
|
|||
{
|
||||
int32_t i, snum = sprite[p->i].yvel;
|
||||
|
||||
Gv_SetVar(g_iReturnVarID,0,p->i,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
if (apScriptGameEvent[EVENT_DOFIRE])
|
||||
X_OnEvent(EVENT_DOFIRE, p->i, snum, -1);
|
||||
|
||||
if (Gv_GetVar(g_iReturnVarID,p->i,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
if (p->weapon_pos != 0) return;
|
||||
|
||||
|
@ -2255,10 +2264,11 @@ void P_DisplayWeapon(int32_t snum)
|
|||
g_kb=*kb;
|
||||
g_looking_angSR1=p->look_ang>>1;
|
||||
|
||||
Gv_SetVar(g_iReturnVarID,0,p->i,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
if (apScriptGameEvent[EVENT_DISPLAYWEAPON])
|
||||
X_OnEvent(EVENT_DISPLAYWEAPON, p->i, screenpeek, -1);
|
||||
|
||||
if (Gv_GetVar(g_iReturnVarID,p->i,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
j = 14-p->quick_kick;
|
||||
if (j != 14 || p->last_quick_kick)
|
||||
|
@ -2307,9 +2317,10 @@ void P_DisplayWeapon(int32_t snum)
|
|||
|
||||
case KNEE_WEAPON:
|
||||
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[screenpeek].ps->i,screenpeek);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
if (apScriptGameEvent[EVENT_DRAWWEAPON])
|
||||
X_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[screenpeek].ps->i,screenpeek) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
if ((*kb) > 0)
|
||||
{
|
||||
|
@ -2336,9 +2347,10 @@ void P_DisplayWeapon(int32_t snum)
|
|||
|
||||
case TRIPBOMB_WEAPON:
|
||||
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[screenpeek].ps->i,screenpeek);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
if (apScriptGameEvent[EVENT_DRAWWEAPON])
|
||||
X_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[screenpeek].ps->i,screenpeek) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
|
@ -2373,9 +2385,10 @@ void P_DisplayWeapon(int32_t snum)
|
|||
|
||||
case RPG_WEAPON:
|
||||
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[screenpeek].ps->i,screenpeek);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
if (apScriptGameEvent[EVENT_DRAWWEAPON])
|
||||
X_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[screenpeek].ps->i,screenpeek) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
|
@ -2402,9 +2415,10 @@ void P_DisplayWeapon(int32_t snum)
|
|||
|
||||
case SHOTGUN_WEAPON:
|
||||
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[screenpeek].ps->i,screenpeek);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
if (apScriptGameEvent[EVENT_DRAWWEAPON])
|
||||
X_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[screenpeek].ps->i,screenpeek) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
|
@ -2502,9 +2516,10 @@ void P_DisplayWeapon(int32_t snum)
|
|||
|
||||
case CHAINGUN_WEAPON:
|
||||
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[screenpeek].ps->i,screenpeek);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
if (apScriptGameEvent[EVENT_DRAWWEAPON])
|
||||
X_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[screenpeek].ps->i,screenpeek) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
|
@ -2553,9 +2568,10 @@ void P_DisplayWeapon(int32_t snum)
|
|||
|
||||
case PISTOL_WEAPON:
|
||||
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[screenpeek].ps->i,screenpeek);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
if (apScriptGameEvent[EVENT_DRAWWEAPON])
|
||||
X_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[screenpeek].ps->i,screenpeek) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
|
@ -2565,7 +2581,7 @@ void P_DisplayWeapon(int32_t snum)
|
|||
|
||||
if ((*kb) < *aplWeaponTotalTime[PISTOL_WEAPON]+1)
|
||||
{
|
||||
static int16_t kb_frames[] = {0,1,2};
|
||||
static uint8_t kb_frames[] = { 0, 1, 2 };
|
||||
int32_t l = 195-12+weapon_xoffset;
|
||||
|
||||
if ((*kb) == *aplWeaponFireDelay[PISTOL_WEAPON])
|
||||
|
@ -2626,9 +2642,10 @@ void P_DisplayWeapon(int32_t snum)
|
|||
break;
|
||||
case HANDBOMB_WEAPON:
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[screenpeek].ps->i,screenpeek);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
if (apScriptGameEvent[EVENT_DRAWWEAPON])
|
||||
X_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[screenpeek].ps->i,screenpeek) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
|
@ -2641,7 +2658,7 @@ void P_DisplayWeapon(int32_t snum)
|
|||
if ((*kb) < (*aplWeaponTotalTime[p->curr_weapon]))
|
||||
{
|
||||
|
||||
static char throw_frames[]
|
||||
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)
|
||||
|
@ -2663,11 +2680,12 @@ void P_DisplayWeapon(int32_t snum)
|
|||
|
||||
case HANDREMOTE_WEAPON:
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[screenpeek].ps->i,screenpeek);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
if (apScriptGameEvent[EVENT_DRAWWEAPON])
|
||||
X_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[screenpeek].ps->i,screenpeek) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
static char remote_frames[] = {0,1,1,2,1,1,0,0,0,0,0};
|
||||
static uint8_t remote_frames[] = {0,1,1,2,1,1,0,0,0,0,0};
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
else if (p->cursectnum >= 0)
|
||||
|
@ -2687,9 +2705,10 @@ void P_DisplayWeapon(int32_t snum)
|
|||
|
||||
case DEVISTATOR_WEAPON:
|
||||
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[screenpeek].ps->i,screenpeek);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
if (apScriptGameEvent[EVENT_DRAWWEAPON])
|
||||
X_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[screenpeek].ps->i,screenpeek) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
|
@ -2699,7 +2718,7 @@ void P_DisplayWeapon(int32_t snum)
|
|||
|
||||
if ((*kb) < (*aplWeaponTotalTime[DEVISTATOR_WEAPON]+1) && (*kb) > 0)
|
||||
{
|
||||
static char cycloidy[] = {0,4,12,24,12,4,0};
|
||||
static uint8_t cycloidy[] = {0,4,12,24,12,4,0};
|
||||
|
||||
i = ksgn((*kb)>>2);
|
||||
|
||||
|
@ -2733,9 +2752,10 @@ void P_DisplayWeapon(int32_t snum)
|
|||
|
||||
case FREEZE_WEAPON:
|
||||
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[screenpeek].ps->i,screenpeek);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
if (apScriptGameEvent[EVENT_DRAWWEAPON])
|
||||
X_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[screenpeek].ps->i,screenpeek) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
if (sprite[p->i].pal == 1)
|
||||
pal = 1;
|
||||
|
@ -2744,7 +2764,7 @@ void P_DisplayWeapon(int32_t snum)
|
|||
else pal = 0;
|
||||
if ((*kb) < (aplWeaponTotalTime[p->curr_weapon][snum]+1) && (*kb) > 0)
|
||||
{
|
||||
static char cat_frames[] = { 0,0,1,1,2,2 };
|
||||
static uint8_t cat_frames[] = { 0,0,1,1,2,2 };
|
||||
|
||||
if (sprite[p->i].pal != 1)
|
||||
{
|
||||
|
@ -2769,9 +2789,10 @@ void P_DisplayWeapon(int32_t snum)
|
|||
|
||||
case GROW_WEAPON:
|
||||
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[screenpeek].ps->i,screenpeek);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
if (apScriptGameEvent[EVENT_DRAWWEAPON])
|
||||
X_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[screenpeek].ps->i,screenpeek) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
weapon_xoffset += 28;
|
||||
looking_arc += 18;
|
||||
|
@ -2818,9 +2839,10 @@ void P_DisplayWeapon(int32_t snum)
|
|||
|
||||
case SHRINKER_WEAPON:
|
||||
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[screenpeek].ps->i,screenpeek);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
if (apScriptGameEvent[EVENT_DRAWWEAPON])
|
||||
X_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[screenpeek].ps->i,screenpeek) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
weapon_xoffset += 28;
|
||||
looking_arc += 18;
|
||||
|
@ -3391,7 +3413,8 @@ int16_t WeaponPickupSprites[MAX_WEAPONS] = { KNEE__STATIC, FIRSTGUNSPRITE__STATI
|
|||
// this is used for player deaths
|
||||
void P_DropWeapon(DukePlayer_t *p)
|
||||
{
|
||||
int32_t snum = sprite[p->i].yvel, cw = aplWeaponWorksLike[p->curr_weapon][snum];
|
||||
int32_t snum = sprite[p->i].yvel,
|
||||
cw = aplWeaponWorksLike[p->curr_weapon][snum];
|
||||
|
||||
if (cw < 1 || cw >= MAX_WEAPONS) return;
|
||||
|
||||
|
@ -3412,6 +3435,294 @@ void P_DropWeapon(DukePlayer_t *p)
|
|||
int32_t g_numObituaries = 0;
|
||||
int32_t g_numSelfObituaries = 0;
|
||||
|
||||
void P_AddAmmo(int32_t weapon,DukePlayer_t *p,int32_t amount)
|
||||
{
|
||||
p->ammo_amount[weapon] += amount;
|
||||
|
||||
if (p->ammo_amount[weapon] > p->max_ammo_amount[weapon])
|
||||
p->ammo_amount[weapon] = p->max_ammo_amount[weapon];
|
||||
}
|
||||
|
||||
void P_AddWeaponNoSwitch(DukePlayer_t *p, int32_t weapon)
|
||||
{
|
||||
int32_t snum = sprite[p->i].yvel;
|
||||
|
||||
if (p->gotweapon[weapon] == 0)
|
||||
{
|
||||
p->gotweapon[weapon] = 1;
|
||||
if (weapon == SHRINKER_WEAPON)
|
||||
p->gotweapon[GROW_WEAPON] = 1;
|
||||
}
|
||||
|
||||
#if 1
|
||||
if (aplWeaponSelectSound[p->curr_weapon][snum])
|
||||
A_StopSound(aplWeaponSelectSound[p->curr_weapon][snum],p->i);
|
||||
if (aplWeaponSelectSound[weapon][snum])
|
||||
A_PlaySound(aplWeaponSelectSound[weapon][snum],p->i);
|
||||
#else
|
||||
switch (p->curr_weapon)
|
||||
{
|
||||
case KNEE_WEAPON:
|
||||
case TRIPBOMB_WEAPON:
|
||||
case HANDREMOTE_WEAPON:
|
||||
case HANDBOMB_WEAPON:
|
||||
break;
|
||||
case SHOTGUN_WEAPON:
|
||||
A_StopSound(SHOTGUN_COCK,p->i);
|
||||
break;
|
||||
case PISTOL_WEAPON:
|
||||
A_StopSound(INSERT_CLIP,p->i);
|
||||
break;
|
||||
default:
|
||||
A_StopSound(SELECT_WEAPON,p->i);
|
||||
break;
|
||||
}
|
||||
switch (weapon)
|
||||
{
|
||||
case KNEE_WEAPON:
|
||||
case TRIPBOMB_WEAPON:
|
||||
case HANDREMOTE_WEAPON:
|
||||
case HANDBOMB_WEAPON:
|
||||
break;
|
||||
case SHOTGUN_WEAPON:
|
||||
A_PlaySound(SHOTGUN_COCK,p->i);
|
||||
break;
|
||||
case PISTOL_WEAPON:
|
||||
A_PlaySound(INSERT_CLIP,p->i);
|
||||
break;
|
||||
default:
|
||||
A_PlaySound(SELECT_WEAPON,p->i);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void P_AddWeapon(DukePlayer_t *p,int32_t weapon)
|
||||
{
|
||||
int32_t snum = sprite[p->i].yvel;
|
||||
|
||||
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
|
||||
{
|
||||
p->weapon_pos = 10;
|
||||
p->holster_weapon = 0;
|
||||
p->last_weapon = -1;
|
||||
}
|
||||
|
||||
p->kickback_pic = 0;
|
||||
|
||||
if (p->curr_weapon != weapon && apScriptGameEvent[EVENT_CHANGEWEAPON])
|
||||
X_OnEvent(EVENT_CHANGEWEAPON,p->i, snum, -1);
|
||||
|
||||
p->curr_weapon = weapon;
|
||||
|
||||
Gv_SetVar(g_iWeaponVarID,p->curr_weapon, p->i, snum);
|
||||
if (p->curr_weapon>=0)
|
||||
{
|
||||
Gv_SetVar(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum], p->i, snum);
|
||||
}
|
||||
else
|
||||
{
|
||||
Gv_SetVar(g_iWorksLikeVarID,-1, p->i, snum);
|
||||
}
|
||||
}
|
||||
|
||||
void P_SelectNextInvItem(DukePlayer_t *p)
|
||||
{
|
||||
if (p->firstaid_amount > 0)
|
||||
p->inven_icon = 1;
|
||||
else if (p->steroids_amount > 0)
|
||||
p->inven_icon = 2;
|
||||
else if (p->holoduke_amount > 0)
|
||||
p->inven_icon = 3;
|
||||
else if (p->jetpack_amount > 0)
|
||||
p->inven_icon = 4;
|
||||
else if (p->heat_amount > 0)
|
||||
p->inven_icon = 5;
|
||||
else if (p->scuba_amount > 0)
|
||||
p->inven_icon = 6;
|
||||
else if (p->boot_amount > 0)
|
||||
p->inven_icon = 7;
|
||||
else p->inven_icon = 0;
|
||||
}
|
||||
|
||||
void P_CheckWeapon(DukePlayer_t *p)
|
||||
{
|
||||
int16_t i,snum;
|
||||
int32 weap;
|
||||
|
||||
if (p->reloading) return;
|
||||
|
||||
if (p->wantweaponfire >= 0)
|
||||
{
|
||||
weap = p->wantweaponfire;
|
||||
p->wantweaponfire = -1;
|
||||
|
||||
if (weap == p->curr_weapon) return;
|
||||
else if (p->gotweapon[weap] && p->ammo_amount[weap] > 0)
|
||||
{
|
||||
P_AddWeapon(p,weap);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
weap = p->curr_weapon;
|
||||
if (p->gotweapon[weap] && p->ammo_amount[weap] > 0)
|
||||
return;
|
||||
if (p->gotweapon[weap] && !(p->weaponswitch & 2))
|
||||
return;
|
||||
|
||||
snum = sprite[p->i].yvel;
|
||||
|
||||
for (i=0;i<10;i++)
|
||||
{
|
||||
weap = g_player[snum].wchoice[i];
|
||||
if (VOLUMEONE && weap > 6) continue;
|
||||
|
||||
if (weap == 0) weap = 9;
|
||||
else weap--;
|
||||
|
||||
if (weap == 0 || (p->gotweapon[weap] && p->ammo_amount[weap] > 0))
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == 10) weap = 0;
|
||||
|
||||
// Found the weapon
|
||||
|
||||
p->last_weapon = p->curr_weapon;
|
||||
p->random_club_frame = 0;
|
||||
p->curr_weapon = weap;
|
||||
Gv_SetVar(g_iWeaponVarID,p->curr_weapon, p->i, snum);
|
||||
if (p->curr_weapon>=0)
|
||||
{
|
||||
Gv_SetVar(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum], p->i, snum);
|
||||
}
|
||||
else
|
||||
{
|
||||
Gv_SetVar(g_iWorksLikeVarID,-1, p->i, snum);
|
||||
}
|
||||
if (apScriptGameEvent[EVENT_CHANGEWEAPON])
|
||||
X_OnEvent(EVENT_CHANGEWEAPON,p->i, snum, -1);
|
||||
p->kickback_pic = 0;
|
||||
if (p->holster_weapon == 1)
|
||||
{
|
||||
p->holster_weapon = 0;
|
||||
p->weapon_pos = 10;
|
||||
}
|
||||
else p->weapon_pos = -1;
|
||||
}
|
||||
|
||||
void P_CheckTouchDamage(DukePlayer_t *p,int32_t j)
|
||||
{
|
||||
if ((j&49152) == 49152)
|
||||
{
|
||||
j &= (MAXSPRITES-1);
|
||||
|
||||
if (sprite[j].picnum == CACTUS)
|
||||
{
|
||||
if (p->hurt_delay < 8)
|
||||
{
|
||||
sprite[p->i].extra -= 5;
|
||||
|
||||
p->hurt_delay = 16;
|
||||
p->pals_time = 32;
|
||||
p->pals[0] = 32;
|
||||
p->pals[1] = 0;
|
||||
p->pals[2] = 0;
|
||||
A_PlaySound(DUKE_LONGTERM_PAIN,p->i);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ((j&49152) != 32768) return;
|
||||
j &= (MAXWALLS-1);
|
||||
|
||||
if (p->hurt_delay > 0) p->hurt_delay--;
|
||||
else if (wall[j].cstat&85)
|
||||
{
|
||||
int32_t switchpicnum = wall[j].overpicnum;
|
||||
if ((switchpicnum>W_FORCEFIELD)&&(switchpicnum<=W_FORCEFIELD+2))
|
||||
switchpicnum=W_FORCEFIELD;
|
||||
|
||||
switch (DynamicTileMap[switchpicnum])
|
||||
{
|
||||
case W_FORCEFIELD__STATIC:
|
||||
// case W_FORCEFIELD+1:
|
||||
// case W_FORCEFIELD+2:
|
||||
sprite[p->i].extra -= 5;
|
||||
|
||||
p->hurt_delay = 16;
|
||||
p->pals_time = 32;
|
||||
p->pals[0] = 32;
|
||||
p->pals[1] = 0;
|
||||
p->pals[2] = 0;
|
||||
|
||||
p->posxv = -(sintable[(p->ang+512)&2047]<<8);
|
||||
p->posyv = -(sintable[(p->ang)&2047]<<8);
|
||||
A_PlaySound(DUKE_LONGTERM_PAIN,p->i);
|
||||
|
||||
{
|
||||
vec3_t davect;
|
||||
|
||||
davect.x = p->posx+(sintable[(p->ang+512)&2047]>>9);
|
||||
davect.y = p->posy+(sintable[p->ang&2047]>>9);
|
||||
davect.z = p->posz;
|
||||
A_DamageWall(p->i,j,&davect,-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case BIGFORCE__STATIC:
|
||||
p->hurt_delay = 26;
|
||||
{
|
||||
vec3_t davect;
|
||||
|
||||
davect.x = p->posx+(sintable[(p->ang+512)&2047]>>9);
|
||||
davect.y = p->posy+(sintable[p->ang&2047]>>9);
|
||||
davect.z = p->posz;
|
||||
A_DamageWall(p->i,j,&davect,-1);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int32_t P_FindOtherPlayer(int32_t p,int32_t *d)
|
||||
{
|
||||
int32_t j, closest_player = p;
|
||||
int32_t x, closest = 0x7fffffff;
|
||||
|
||||
TRAVERSE_CONNECT(j)
|
||||
if (p != j && sprite[g_player[j].ps->i].extra > 0)
|
||||
{
|
||||
x = klabs(g_player[j].ps->oposx-g_player[p].ps->posx) + klabs(g_player[j].ps->oposy-g_player[p].ps->posy) + (klabs(g_player[j].ps->oposz-g_player[p].ps->posz)>>4);
|
||||
|
||||
if (x < closest)
|
||||
{
|
||||
closest_player = j;
|
||||
closest = x;
|
||||
}
|
||||
}
|
||||
|
||||
*d = closest;
|
||||
return closest_player;
|
||||
}
|
||||
|
||||
void P_ProcessInput(int32_t snum)
|
||||
{
|
||||
int32_t j, i, k, doubvel, fz, cz, hz, lz, truefdist, x, y, shrunk;
|
||||
|
@ -3432,9 +3743,9 @@ void P_ProcessInput(int32_t snum)
|
|||
if (TEST_SYNC_KEY(sb_snum, SK_FIRE))
|
||||
// if ((sb_snum&(1<<2)))
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,pi,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_PRESSEDFIRE, pi, snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,pi,snum) != 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue != 0)
|
||||
sb_snum &= ~BIT(SK_FIRE);
|
||||
}
|
||||
|
||||
|
@ -3712,52 +4023,6 @@ void P_ProcessInput(int32_t snum)
|
|||
|
||||
if (ud.obituaries)
|
||||
{
|
||||
/*
|
||||
if (GTFLAGS(GAMETYPE_PLAYERSFRIENDLY) || (GTFLAGS(GAMETYPE_TDM) && g_player[snum].ps->team == g_player[p->frag_ps].ps->team))
|
||||
i = 9;
|
||||
else
|
||||
{
|
||||
// temp_data[1] on a player's APLAYER actor means the player is frozen
|
||||
if (ActorExtra[p->i].temp_data[1] == 1)
|
||||
i = 7;
|
||||
else switch (DynamicTileMap[ActorExtra[p->i].picnum])
|
||||
{
|
||||
case KNEE__STATIC:
|
||||
i = 0;
|
||||
break;
|
||||
case SHOTSPARK1__STATIC:
|
||||
switch (g_player[p->frag_ps].ps->curr_weapon)
|
||||
{
|
||||
default:
|
||||
case PISTOL_WEAPON:
|
||||
i = 1;
|
||||
break;
|
||||
case SHOTGUN_WEAPON:
|
||||
i = 2;
|
||||
break;
|
||||
case CHAINGUN_WEAPON:
|
||||
i = 3;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RPG__STATIC:
|
||||
i = 4;
|
||||
break;
|
||||
case RADIUSEXPLOSION__STATIC:
|
||||
i = 5;
|
||||
break;
|
||||
case SHRINKSPARK__STATIC:
|
||||
i = 6;
|
||||
break;
|
||||
case GROWSPARK__STATIC:
|
||||
i = 8;
|
||||
break;
|
||||
default:
|
||||
i = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
Bsprintf(tempbuf,ScriptQuotes[FIRST_OBITUARY_QUOTE+(krand()%g_numObituaries)],
|
||||
&g_player[p->frag_ps].user_name[0],
|
||||
&g_player[snum].user_name[0]);
|
||||
|
@ -3877,9 +4142,9 @@ void P_ProcessInput(int32_t snum)
|
|||
if (TEST_SYNC_KEY(sb_snum, SK_LOOK_LEFT))
|
||||
{
|
||||
// look_left
|
||||
Gv_SetVar(g_iReturnVarID,0,pi,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_LOOKLEFT,pi,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,pi,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
p->look_ang -= 152;
|
||||
p->rotscrnang += 24;
|
||||
|
@ -3889,9 +4154,9 @@ void P_ProcessInput(int32_t snum)
|
|||
if (TEST_SYNC_KEY(sb_snum, SK_LOOK_RIGHT))
|
||||
{
|
||||
// look_right
|
||||
Gv_SetVar(g_iReturnVarID,0,pi,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_LOOKRIGHT,pi,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,pi,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
p->look_ang += 152;
|
||||
p->rotscrnang -= 24;
|
||||
|
@ -3968,9 +4233,9 @@ void P_ProcessInput(int32_t snum)
|
|||
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_JUMP))
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,pi,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_SWIMUP,pi,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,pi,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
// jump
|
||||
if (p->poszv > 0) p->poszv = 0;
|
||||
|
@ -3980,9 +4245,9 @@ void P_ProcessInput(int32_t snum)
|
|||
}
|
||||
else if (TEST_SYNC_KEY(sb_snum, SK_CROUCH))
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,pi,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_SWIMDOWN,pi,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,pi,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
// crouch
|
||||
if (p->poszv < 0) p->poszv = 0;
|
||||
|
@ -4059,9 +4324,9 @@ void P_ProcessInput(int32_t snum)
|
|||
if (TEST_SYNC_KEY(sb_snum, SK_JUMP)) //A (soar high)
|
||||
{
|
||||
// jump
|
||||
Gv_SetVar(g_iReturnVarID,0,pi,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_SOARUP,pi,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,pi,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
p->posz -= j;
|
||||
p->crack_time = 777;
|
||||
|
@ -4071,9 +4336,9 @@ void P_ProcessInput(int32_t snum)
|
|||
if (TEST_SYNC_KEY(sb_snum, SK_CROUCH)) //Z (soar low)
|
||||
{
|
||||
// crouch
|
||||
Gv_SetVar(g_iReturnVarID,0,pi,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_SOARDOWN,pi,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,pi,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
p->posz += j;
|
||||
p->crack_time = 777;
|
||||
|
@ -4255,9 +4520,9 @@ void P_ProcessInput(int32_t snum)
|
|||
if (TEST_SYNC_KEY(sb_snum, SK_CROUCH))
|
||||
{
|
||||
// crouching
|
||||
Gv_SetVar(g_iReturnVarID,0,pi,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_CROUCH,pi,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,pi,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
p->posz += (2048+768);
|
||||
p->crack_time = 777;
|
||||
|
@ -4272,9 +4537,9 @@ void P_ProcessInput(int32_t snum)
|
|||
if (p->jumping_counter == 0)
|
||||
if ((fz-cz) > (56<<8))
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,pi,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_JUMP,pi,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,pi,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
p->jumping_counter = 1;
|
||||
p->jumping_toggle = 1;
|
||||
|
@ -4639,9 +4904,9 @@ HORIZONLY:
|
|||
i = 0;
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_CENTER_VIEW) || p->hard_landing)
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,pi,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_RETURNTOCENTER,pi,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,pi,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
p->return_to_center = 9;
|
||||
}
|
||||
|
@ -4650,9 +4915,9 @@ HORIZONLY:
|
|||
if (TEST_SYNC_KEY(sb_snum, SK_LOOK_UP))
|
||||
{
|
||||
// look_up
|
||||
Gv_SetVar(g_iReturnVarID,0,pi,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_LOOKUP,pi,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,pi,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
p->return_to_center = 9;
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_RUN)) p->horiz += 12; // running
|
||||
|
@ -4664,9 +4929,9 @@ HORIZONLY:
|
|||
else if (TEST_SYNC_KEY(sb_snum, SK_LOOK_DOWN))
|
||||
{
|
||||
// look_down
|
||||
Gv_SetVar(g_iReturnVarID,0,pi,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_LOOKDOWN,pi,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,pi,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
p->return_to_center = 9;
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_RUN)) p->horiz -= 12;
|
||||
|
@ -4678,9 +4943,9 @@ HORIZONLY:
|
|||
else if (TEST_SYNC_KEY(sb_snum, SK_AIM_UP))
|
||||
{
|
||||
// aim_up
|
||||
Gv_SetVar(g_iReturnVarID,0,pi,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_AIMUP,pi,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,pi,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
// running
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_RUN)) p->horiz += 6;
|
||||
|
@ -4692,9 +4957,9 @@ HORIZONLY:
|
|||
else if (TEST_SYNC_KEY(sb_snum, SK_AIM_DOWN))
|
||||
{
|
||||
// aim_down
|
||||
Gv_SetVar(g_iReturnVarID,0,pi,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_AIMDOWN,pi,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,pi,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
// running
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_RUN)) p->horiz -= 6;
|
||||
|
@ -4819,11 +5084,11 @@ HORIZONLY:
|
|||
SHOOTINCODE:
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_HOLSTER)) // 'Holster Weapon
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,pi,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
Gv_SetVar(g_iWeaponVarID,p->curr_weapon,pi,snum);
|
||||
Gv_SetVar(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum],pi,snum);
|
||||
X_OnEvent(EVENT_HOLSTER, pi, snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,pi,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
if (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_HOLSTER_CLEARS_CLIP)
|
||||
{
|
||||
|
@ -4889,15 +5154,16 @@ SHOOTINCODE:
|
|||
}
|
||||
else
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,pi,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
Gv_SetVar(g_iWeaponVarID,p->curr_weapon,pi,snum);
|
||||
Gv_SetVar(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum],pi,snum);
|
||||
X_OnEvent(EVENT_FIRE, pi, snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,pi,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
switch (aplWeaponWorksLike[p->curr_weapon][snum])
|
||||
{
|
||||
case HANDBOMB_WEAPON:
|
||||
if (apScriptGameEvent[EVENT_FIREWEAPON])
|
||||
X_OnEvent(EVENT_FIREWEAPON, p->i, snum, -1);
|
||||
|
||||
p->hbomb_hold_delay = 0;
|
||||
|
@ -4912,6 +5178,7 @@ SHOOTINCODE:
|
|||
break;
|
||||
|
||||
case HANDREMOTE_WEAPON:
|
||||
if (apScriptGameEvent[EVENT_FIREWEAPON])
|
||||
X_OnEvent(EVENT_FIREWEAPON, p->i, snum, -1);
|
||||
p->hbomb_hold_delay = 0;
|
||||
(*kb) = 1;
|
||||
|
@ -4922,6 +5189,7 @@ SHOOTINCODE:
|
|||
break;
|
||||
|
||||
case SHOTGUN_WEAPON:
|
||||
if (apScriptGameEvent[EVENT_FIREWEAPON])
|
||||
X_OnEvent(EVENT_FIREWEAPON, p->i, snum, -1);
|
||||
if (p->ammo_amount[p->curr_weapon] > 0 && p->random_club_frame == 0)
|
||||
{
|
||||
|
@ -4987,6 +5255,7 @@ SHOOTINCODE:
|
|||
case GROW_WEAPON:
|
||||
case FREEZE_WEAPON:
|
||||
case RPG_WEAPON:
|
||||
if (apScriptGameEvent[EVENT_FIREWEAPON])
|
||||
X_OnEvent(EVENT_FIREWEAPON, p->i, snum, -1);
|
||||
if (p->ammo_amount[p->curr_weapon] > 0)
|
||||
{
|
||||
|
@ -4999,6 +5268,7 @@ SHOOTINCODE:
|
|||
break;
|
||||
|
||||
case DEVISTATOR_WEAPON:
|
||||
if (apScriptGameEvent[EVENT_FIREWEAPON])
|
||||
X_OnEvent(EVENT_FIREWEAPON, p->i, snum, -1);
|
||||
if (p->ammo_amount[p->curr_weapon] > 0)
|
||||
{
|
||||
|
@ -5012,6 +5282,7 @@ SHOOTINCODE:
|
|||
break;
|
||||
|
||||
case KNEE_WEAPON:
|
||||
if (apScriptGameEvent[EVENT_FIREWEAPON])
|
||||
X_OnEvent(EVENT_FIREWEAPON, p->i, snum, -1);
|
||||
if (p->quick_kick == 0)
|
||||
{
|
||||
|
|
|
@ -347,9 +347,10 @@ static void G_DoLoadScreen(char *statustext, int32_t percent)
|
|||
clearview(0L);
|
||||
}
|
||||
|
||||
Gv_SetVar(g_iReturnVarID,LOADSCREEN, -1, -1);
|
||||
/*Gv_SetVar(g_iReturnVarID,LOADSCREEN, -1, -1);*/
|
||||
aGameVars[g_iReturnVarID].val.lValue = LOADSCREEN;
|
||||
X_OnEvent(EVENT_GETLOADTILE, -1, myconnectindex, -1);
|
||||
j = Gv_GetVar(g_iReturnVarID, -1, -1);
|
||||
j = aGameVars[g_iReturnVarID].val.lValue;
|
||||
rotatesprite(320<<15,200<<15,65536L,0,j > MAXTILES-1?j-MAXTILES:j,0,0,2+8+64,0,0,xdim-1,ydim-1);
|
||||
if (j > MAXTILES-1)
|
||||
{
|
||||
|
@ -407,9 +408,10 @@ static void G_DoLoadScreen(char *statustext, int32_t percent)
|
|||
//G_FadePalette(0,0,0,0);
|
||||
P_SetGamePalette(g_player[myconnectindex].ps, palette, 0); // JBF 20040308
|
||||
}
|
||||
Gv_SetVar(g_iReturnVarID,LOADSCREEN, -1, -1);
|
||||
/*Gv_SetVar(g_iReturnVarID,LOADSCREEN, -1, -1);*/
|
||||
aGameVars[g_iReturnVarID].val.lValue = LOADSCREEN;
|
||||
X_OnEvent(EVENT_GETLOADTILE, -1, myconnectindex, -1);
|
||||
j = Gv_GetVar(g_iReturnVarID, -1, -1);
|
||||
j = aGameVars[g_iReturnVarID].val.lValue;
|
||||
rotatesprite(320<<15,200<<15,65536L,0,j > MAXTILES-1?j-MAXTILES:j,0,0,2+8+64,0,0,xdim-1,ydim-1);
|
||||
if (j > MAXTILES-1)
|
||||
{
|
||||
|
|
|
@ -251,27 +251,6 @@ int32_t __fastcall A_FindPlayer(spritetype *s, int32_t *d)
|
|||
}
|
||||
}
|
||||
|
||||
int32_t P_FindOtherPlayer(int32_t p,int32_t *d)
|
||||
{
|
||||
int32_t j, closest_player = p;
|
||||
int32_t x, closest = 0x7fffffff;
|
||||
|
||||
TRAVERSE_CONNECT(j)
|
||||
if (p != j && sprite[g_player[j].ps->i].extra > 0)
|
||||
{
|
||||
x = klabs(g_player[j].ps->oposx-g_player[p].ps->posx) + klabs(g_player[j].ps->oposy-g_player[p].ps->posy) + (klabs(g_player[j].ps->oposz-g_player[p].ps->posz)>>4);
|
||||
|
||||
if (x < closest)
|
||||
{
|
||||
closest_player = j;
|
||||
closest = x;
|
||||
}
|
||||
}
|
||||
|
||||
*d = closest;
|
||||
return closest_player;
|
||||
}
|
||||
|
||||
void G_DoSectorAnimations(void)
|
||||
{
|
||||
int32_t i, j, a, p, v, dasect;
|
||||
|
@ -1887,85 +1866,6 @@ void A_DamageWall(int32_t spr,int32_t dawallnum,const vec3_t *pos,int32_t atwith
|
|||
}
|
||||
}
|
||||
|
||||
void P_CheckTouchDamage(DukePlayer_t *p,int32_t j)
|
||||
{
|
||||
if ((j&49152) == 49152)
|
||||
{
|
||||
j &= (MAXSPRITES-1);
|
||||
|
||||
if (sprite[j].picnum==CACTUS)
|
||||
{
|
||||
|
||||
if (p->hurt_delay < 8)
|
||||
{
|
||||
sprite[p->i].extra -= 5;
|
||||
|
||||
p->hurt_delay = 16;
|
||||
p->pals_time = 32;
|
||||
p->pals[0] = 32;
|
||||
p->pals[1] = 0;
|
||||
p->pals[2] = 0;
|
||||
A_PlaySound(DUKE_LONGTERM_PAIN,p->i);
|
||||
}
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ((j&49152) != 32768) return;
|
||||
j &= (MAXWALLS-1);
|
||||
|
||||
if (p->hurt_delay > 0) p->hurt_delay--;
|
||||
else if (wall[j].cstat&85)
|
||||
{
|
||||
int32_t switchpicnum = wall[j].overpicnum;
|
||||
if ((switchpicnum>W_FORCEFIELD)&&(switchpicnum<=W_FORCEFIELD+2))
|
||||
switchpicnum=W_FORCEFIELD;
|
||||
|
||||
switch (DynamicTileMap[switchpicnum])
|
||||
{
|
||||
case W_FORCEFIELD__STATIC:
|
||||
// case W_FORCEFIELD+1:
|
||||
// case W_FORCEFIELD+2:
|
||||
sprite[p->i].extra -= 5;
|
||||
|
||||
p->hurt_delay = 16;
|
||||
p->pals_time = 32;
|
||||
p->pals[0] = 32;
|
||||
p->pals[1] = 0;
|
||||
p->pals[2] = 0;
|
||||
|
||||
p->posxv = -(sintable[(p->ang+512)&2047]<<8);
|
||||
p->posyv = -(sintable[(p->ang)&2047]<<8);
|
||||
A_PlaySound(DUKE_LONGTERM_PAIN,p->i);
|
||||
|
||||
{
|
||||
vec3_t davect;
|
||||
|
||||
davect.x = p->posx+(sintable[(p->ang+512)&2047]>>9);
|
||||
davect.y = p->posy+(sintable[p->ang&2047]>>9);
|
||||
davect.z = p->posz;
|
||||
A_DamageWall(p->i,j,&davect,-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case BIGFORCE__STATIC:
|
||||
p->hurt_delay = 26;
|
||||
{
|
||||
vec3_t davect;
|
||||
|
||||
davect.x = p->posx+(sintable[(p->ang+512)&2047]>>9);
|
||||
davect.y = p->posy+(sintable[p->ang&2047]>>9);
|
||||
davect.z = p->posz;
|
||||
A_DamageWall(p->i,j,&davect,-1);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int32_t Sect_DamageCeiling(int32_t sn)
|
||||
{
|
||||
int32_t i, j;
|
||||
|
@ -2589,9 +2489,9 @@ void G_HandleSharedKeys(int32_t snum)
|
|||
if (TEST_SYNC_KEY(sb_snum, SK_QUICK_KICK) && p->quick_kick == 0)
|
||||
if (p->curr_weapon != KNEE_WEAPON || p->kickback_pic == 0)
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[snum].ps->i,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_QUICKKICK,g_player[snum].ps->i,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[snum].ps->i,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
p->quick_kick = 14;
|
||||
if (p->fta == 0 || p->ftq == 80)
|
||||
|
@ -2635,9 +2535,9 @@ void G_HandleSharedKeys(int32_t snum)
|
|||
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_INVENTORY) && p->newowner == -1) // inventory button generates event for selected item
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[snum].ps->i,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_INVENTORY,g_player[snum].ps->i,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[snum].ps->i,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
switch (p->inven_icon)
|
||||
{
|
||||
|
@ -2662,9 +2562,9 @@ void G_HandleSharedKeys(int32_t snum)
|
|||
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_NIGHTVISION))
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[snum].ps->i,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_USENIGHTVISION,g_player[snum].ps->i,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[snum].ps->i,snum) == 0
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0
|
||||
&& p->heat_amount > 0)
|
||||
{
|
||||
p->heat_on = !p->heat_on;
|
||||
|
@ -2677,9 +2577,9 @@ void G_HandleSharedKeys(int32_t snum)
|
|||
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_STEROIDS))
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[snum].ps->i,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_USESTEROIDS,g_player[snum].ps->i,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[snum].ps->i,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
if (p->steroids_amount == 400)
|
||||
{
|
||||
|
@ -2765,15 +2665,17 @@ CHECKINV1:
|
|||
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_INV_LEFT)) // Inventory_Left
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,dainv,g_player[snum].ps->i,snum);
|
||||
/*Gv_SetVar(g_iReturnVarID,dainv,g_player[snum].ps->i,snum);*/
|
||||
aGameVars[g_iReturnVarID].val.lValue = dainv;
|
||||
X_OnEvent(EVENT_INVENTORYLEFT,g_player[snum].ps->i,snum, -1);
|
||||
dainv=Gv_GetVar(g_iReturnVarID,g_player[snum].ps->i,snum);
|
||||
dainv=aGameVars[g_iReturnVarID].val.lValue;
|
||||
}
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_INV_RIGHT)) // Inventory_Right
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,dainv,g_player[snum].ps->i,snum);
|
||||
/*Gv_SetVar(g_iReturnVarID,dainv,g_player[snum].ps->i,snum);*/
|
||||
aGameVars[g_iReturnVarID].val.lValue = dainv;
|
||||
X_OnEvent(EVENT_INVENTORYRIGHT,g_player[snum].ps->i,snum, -1);
|
||||
dainv=Gv_GetVar(g_iReturnVarID,g_player[snum].ps->i,snum);
|
||||
dainv=aGameVars[g_iReturnVarID].val.lValue;
|
||||
}
|
||||
|
||||
p->inven_icon = dainv;
|
||||
|
@ -2806,7 +2708,7 @@ CHECKINV1:
|
|||
|
||||
j = ((sb_snum&(15<<SK_WEAPON_BITS))>>SK_WEAPON_BITS) - 1;
|
||||
|
||||
Gv_SetVar(g_iReturnVarID,j,p->i,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = j;
|
||||
|
||||
switch (j)
|
||||
{
|
||||
|
@ -2848,8 +2750,8 @@ CHECKINV1:
|
|||
break;
|
||||
}
|
||||
|
||||
if ((uint32_t) Gv_GetVar(g_iReturnVarID,p->i,snum) != j)
|
||||
j = (uint32_t) Gv_GetVar(g_iReturnVarID,p->i,snum);
|
||||
if ((uint32_t) aGameVars[g_iReturnVarID].val.lValue != j)
|
||||
j = (uint32_t) aGameVars[g_iReturnVarID].val.lValue;
|
||||
|
||||
if (p->reloading == 1)
|
||||
j = -1;
|
||||
|
@ -2923,9 +2825,9 @@ CHECKINV1:
|
|||
k = -1;
|
||||
|
||||
Gv_SetVar(g_iWeaponVarID,j, p->i, snum);
|
||||
Gv_SetVar(g_iReturnVarID,0,p->i,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_SELECTWEAPON,p->i,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,p->i,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
if (j == HANDBOMB_WEAPON && p->ammo_amount[HANDBOMB_WEAPON] == 0)
|
||||
{
|
||||
|
@ -3087,9 +2989,9 @@ CHECKINV1:
|
|||
|
||||
if (p->holoduke_on == -1)
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[snum].ps->i,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_HOLODUKEON,g_player[snum].ps->i,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[snum].ps->i,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
if (p->holoduke_amount > 0)
|
||||
{
|
||||
|
@ -3114,9 +3016,9 @@ CHECKINV1:
|
|||
}
|
||||
else
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[snum].ps->i,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_HOLODUKEOFF,g_player[snum].ps->i,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[snum].ps->i,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
A_PlaySound(TELEPORTER,p->holoduke_on);
|
||||
p->holoduke_on = -1;
|
||||
|
@ -3127,9 +3029,9 @@ CHECKINV1:
|
|||
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_MEDKIT))
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[snum].ps->i,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_USEMEDKIT,g_player[snum].ps->i,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[snum].ps->i,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
if (p->firstaid_amount > 0 && sprite[p->i].extra < p->max_player_health)
|
||||
{
|
||||
|
@ -3154,9 +3056,9 @@ CHECKINV1:
|
|||
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_JETPACK) && p->newowner == -1)
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,g_player[snum].ps->i,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_USEJETPACK,g_player[snum].ps->i,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,g_player[snum].ps->i,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
if (p->jetpack_amount > 0)
|
||||
{
|
||||
|
@ -3191,9 +3093,9 @@ CHECKINV1:
|
|||
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_TURNAROUND) && p->one_eighty_count == 0)
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,p->i,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_TURNAROUND,p->i,snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,p->i,snum) == 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
p->one_eighty_count = -1024;
|
||||
}
|
||||
|
@ -3294,9 +3196,9 @@ void checksectors(int32_t snum)
|
|||
|
||||
if (TEST_SYNC_KEY(g_player[snum].sync->bits, SK_OPEN))
|
||||
{
|
||||
Gv_SetVar(g_iReturnVarID,0,p->i,snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
X_OnEvent(EVENT_USE, p->i, snum, -1);
|
||||
if (Gv_GetVar(g_iReturnVarID,p->i,snum) != 0)
|
||||
if (aGameVars[g_iReturnVarID].val.lValue != 0)
|
||||
g_player[snum].sync->bits &= ~BIT(SK_OPEN);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue