From a2f4bdb2c87179302bd104d65fbb8a9ae288ca05 Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 27 Aug 2007 00:20:15 +0000 Subject: [PATCH] Wanna buy some crack? git-svn-id: https://svn.eduke32.com/eduke32@563 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/actors.c | 740 ++++++------- polymer/eduke32/source/anim.c | 4 +- polymer/eduke32/source/config.c | 678 ++++++------ polymer/eduke32/source/config.h | 64 -- polymer/eduke32/source/duke3d.h | 145 ++- polymer/eduke32/source/funct.h | 24 +- polymer/eduke32/source/game.c | 1334 +++++++++++------------ polymer/eduke32/source/gameexec.c | 990 ++++++++--------- polymer/eduke32/source/global.c | 30 +- polymer/eduke32/source/jfaud_sounds.cpp | 22 +- polymer/eduke32/source/menus.c | 372 +++---- polymer/eduke32/source/osdcmds.c | 114 +- polymer/eduke32/source/player.c | 538 ++++----- polymer/eduke32/source/premap.c | 266 ++--- polymer/eduke32/source/savegame.c | 47 +- polymer/eduke32/source/sector.c | 200 ++-- polymer/eduke32/source/sounds.c | 79 +- polymer/eduke32/source/startgtk.game.c | 32 +- polymer/eduke32/source/startwin.game.c | 28 +- 19 files changed, 2862 insertions(+), 2845 deletions(-) diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 30629551b..ad1c84617 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -96,7 +96,7 @@ long floorspace(int sectnum) return 0; } -void addammo(int weapon,struct player_struct *p,int amount) +void addammo(int weapon,player_struct *p,int amount) { p->ammo_amount[weapon] += amount; @@ -104,7 +104,7 @@ void addammo(int weapon,struct player_struct *p,int amount) p->ammo_amount[weapon] = max_ammo_amount[weapon]; } -void addweaponnoswitch(struct player_struct *p, int weapon) +void addweaponnoswitch(player_struct *p, int weapon) { if (p->gotweapon[weapon] == 0) { @@ -148,7 +148,7 @@ void addweaponnoswitch(struct player_struct *p, int weapon) } } -void addweapon(struct player_struct *p,int weapon) +void addweapon(player_struct *p,int weapon) { int snum = sprite[p->i].yvel; @@ -190,7 +190,7 @@ void addweapon(struct player_struct *p,int weapon) } } -void checkavailinven(struct player_struct *p) +void checkavailinven(player_struct *p) { if (p->firstaid_amount > 0) @@ -210,7 +210,7 @@ void checkavailinven(struct player_struct *p) else p->inven_icon = 0; } -void checkavailweapon(struct player_struct *p) +void checkavailweapon(player_struct *p) { short i,snum; int32 weap; @@ -240,7 +240,7 @@ void checkavailweapon(struct player_struct *p) for (i=0;i<10;i++) { - weap = ud.wchoice[snum][i]; + weap = g_player[snum].wchoice[i]; if (VOLUMEONE && weap > 6) continue; if (weap == 0) weap = 9; @@ -429,15 +429,15 @@ SKIPWALLCHECK: if (sj->picnum == APLAYER) { p = sj->yvel; - if (ps[p].newowner >= 0) + if (g_player[p].ps.newowner >= 0) { - ps[p].newowner = -1; - ps[p].posx = ps[p].oposx; - ps[p].posy = ps[p].oposy; - ps[p].posz = ps[p].oposz; - ps[p].ang = ps[p].oang; - updatesector(ps[p].posx,ps[p].posy,&ps[p].cursectnum); - setpal(&ps[p]); + g_player[p].ps.newowner = -1; + g_player[p].ps.posx = g_player[p].ps.oposx; + g_player[p].ps.posy = g_player[p].ps.oposy; + g_player[p].ps.posz = g_player[p].ps.oposz; + g_player[p].ps.ang = g_player[p].ps.oang; + updatesector(g_player[p].ps.posx,g_player[p].ps.posy,&g_player[p].ps.cursectnum); + setpal(&g_player[p].ps); k = headspritestat[1]; while (k >= 0) @@ -743,7 +743,7 @@ static void movefta(void) ssect = psect = s->sectnum; - if (sprite[ps[p].i].extra > 0) + if (sprite[g_player[p].ps.i].extra > 0) { if (x < 30000) { @@ -752,8 +752,8 @@ static void movefta(void) { if (badguy(s)) { - px = ps[p].oposx+64-(TRAND&127); - py = ps[p].oposy+64-(TRAND&127); + px = g_player[p].ps.oposx+64-(TRAND&127); + py = g_player[p].ps.oposy+64-(TRAND&127); updatesector(px,py,&psect); if (psect == -1) { @@ -768,10 +768,10 @@ static void movefta(void) i = nexti; continue; } - j = cansee(sx,sy,s->z-(TRAND%(52<<8)),s->sectnum,px,py,ps[p].oposz-(TRAND%(32<<8)),ps[p].cursectnum); + j = cansee(sx,sy,s->z-(TRAND%(52<<8)),s->sectnum,px,py,g_player[p].ps.oposz-(TRAND%(32<<8)),g_player[p].ps.cursectnum); } else - j = cansee(s->x,s->y,s->z-((TRAND&31)<<8),s->sectnum,ps[p].oposx,ps[p].oposy,ps[p].oposz-((TRAND&31)<<8),ps[p].cursectnum); + j = cansee(s->x,s->y,s->z-((TRAND&31)<<8),s->sectnum,g_player[p].ps.oposx,g_player[p].ps.oposy,g_player[p].ps.oposz-((TRAND&31)<<8),g_player[p].ps.cursectnum); // j = 1; @@ -857,7 +857,7 @@ int ifhitbyweapon(int sn) if (j >= 0 && sprite[j].picnum == APLAYER && (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) && - ps[p].team == ps[sprite[j].yvel].team && + g_player[p].ps.team == g_player[sprite[j].yvel].ps.team && ud.ffire == 0) return -1; @@ -869,27 +869,27 @@ int ifhitbyweapon(int sn) { npc->extra = 0; - ps[p].wackedbyactor = j; + g_player[p].ps.wackedbyactor = j; if (sprite[hittype[sn].owner].picnum == APLAYER && p != sprite[hittype[sn].owner].yvel) - ps[p].frag_ps = sprite[j].yvel; + g_player[p].ps.frag_ps = sprite[j].yvel; - hittype[sn].owner = ps[p].i; + hittype[sn].owner = g_player[p].ps.i; } } if (checkspriteflagsp(hittype[sn].picnum,SPRITE_FLAG_PROJECTILE) && (thisprojectile[sn].workslike & PROJECTILE_FLAG_RPG)) { - ps[p].posxv += + g_player[p].ps.posxv += hittype[sn].extra*(sintable[(hittype[sn].ang+512)&2047])<<2; - ps[p].posyv += + g_player[p].ps.posyv += hittype[sn].extra*(sintable[hittype[sn].ang&2047])<<2; } else if (checkspriteflagsp(hittype[sn].picnum,SPRITE_FLAG_PROJECTILE)) { - ps[p].posxv += + g_player[p].ps.posxv += hittype[sn].extra*(sintable[(hittype[sn].ang+512)&2047])<<1; - ps[p].posyv += + g_player[p].ps.posyv += hittype[sn].extra*(sintable[hittype[sn].ang&2047])<<1; } @@ -902,15 +902,15 @@ int ifhitbyweapon(int sn) case SEENINE__STATIC: case OOZFILTER__STATIC: case EXPLODINGBARREL__STATIC: - ps[p].posxv += + g_player[p].ps.posxv += hittype[sn].extra*(sintable[(hittype[sn].ang+512)&2047])<<2; - ps[p].posyv += + g_player[p].ps.posyv += hittype[sn].extra*(sintable[hittype[sn].ang&2047])<<2; break; default: - ps[p].posxv += + g_player[p].ps.posxv += hittype[sn].extra*(sintable[(hittype[sn].ang+512)&2047])<<1; - ps[p].posyv += + g_player[p].ps.posyv += hittype[sn].extra*(sintable[hittype[sn].ang&2047])<<1; break; } @@ -982,18 +982,18 @@ void movedummyplayers(void) p = sprite[OW].yvel; - if (ps[p].on_crane >= 0 || sector[ps[p].cursectnum].lotag != 1 || sprite[ps[p].i].extra <= 0) + if (g_player[p].ps.on_crane >= 0 || sector[g_player[p].ps.cursectnum].lotag != 1 || sprite[g_player[p].ps.i].extra <= 0) { - ps[p].dummyplayersprite = -1; + g_player[p].ps.dummyplayersprite = -1; KILLIT(i); } else { - if (ps[p].on_ground && ps[p].on_warping_sector == 1 && sector[ps[p].cursectnum].lotag == 1) + if (g_player[p].ps.on_ground && g_player[p].ps.on_warping_sector == 1 && sector[g_player[p].ps.cursectnum].lotag == 1) { CS = 257; SZ = sector[SECT].ceilingz+(27<<8); - SA = ps[p].ang; + SA = g_player[p].ps.ang; if (T1 == 8) T1 = 0; else T1++; @@ -1005,8 +1005,8 @@ void movedummyplayers(void) } } - SX += (ps[p].posx-ps[p].oposx); - SY += (ps[p].posy-ps[p].oposy); + SX += (g_player[p].ps.posx-g_player[p].ps.oposx); + SY += (g_player[p].ps.posy-g_player[p].ps.oposy); setsprite(i,SX,SY,SZ); BOLT: @@ -1022,14 +1022,14 @@ static void moveplayers(void) //Players int i = headspritestat[10], nexti; long otherx; spritetype *s; - struct player_struct *p; + player_struct *p; while (i >= 0) { nexti = nextspritestat[i]; s = &sprite[i]; - p = &ps[s->yvel]; + p = &g_player[s->yvel].ps; if (s->owner >= 0) { if (p->newowner >= 0) //Looking thru the camera @@ -1053,15 +1053,15 @@ static void moveplayers(void) //Players execute(i,s->yvel,otherx); if (ud.multimode > 1) - if (sprite[ps[otherp].i].extra > 0) + if (sprite[g_player[otherp].ps.i].extra > 0) { - if (s->yrepeat > 32 && sprite[ps[otherp].i].yrepeat < 32) + if (s->yrepeat > 32 && sprite[g_player[otherp].ps.i].yrepeat < 32) { if (otherx < 1400 && p->knee_incs == 0) { p->knee_incs = 1; p->weapon_pos = -1; - p->actorsqu = ps[otherp].i; + p->actorsqu = g_player[otherp].ps.i; } } } @@ -1181,15 +1181,15 @@ static void movefx(void) ht = s->hitag; - if (T2 != config.SoundToggle) + if (T2 != ud.config.SoundToggle) { - T2 = config.SoundToggle; + T2 = ud.config.SoundToggle; T1 = 0; } if (s->lotag >= 1000 && s->lotag < 2000) { - x = ldist(&sprite[ps[screenpeek].i],s); + x = ldist(&sprite[g_player[screenpeek].ps.i],s); if (x < ht && T1 == 0) { FX_SetReverb(s->lotag - 1000); @@ -1202,19 +1202,19 @@ static void movefx(void) T1 = 0; } } - else if (s->lotag < 999 && (unsigned)sector[s->sectnum].lotag < 9 && config.AmbienceToggle && sector[SECT].floorz != sector[SECT].ceilingz) + else if (s->lotag < 999 && (unsigned)sector[s->sectnum].lotag < 9 && ud.config.AmbienceToggle && sector[SECT].floorz != sector[SECT].ceilingz) { if ((soundm[s->lotag]&2)) { - x = dist(&sprite[ps[screenpeek].i],s); + x = dist(&sprite[g_player[screenpeek].ps.i],s); if (x < ht && T1 == 0 && FX_VoiceAvailable(soundpr[s->lotag]-1)) { - if (numenvsnds == config.NumVoices) + if (numenvsnds == ud.config.NumVoices) { j = headspritestat[11]; while (j >= 0) { - if (PN == MUSICANDSFX && j != i && sprite[j].lotag < 999 && hittype[j].temp_data[0] == 1 && dist(&sprite[j],&sprite[ps[screenpeek].i]) > x) + if (PN == MUSICANDSFX && j != i && sprite[j].lotag < 999 && hittype[j].temp_data[0] == 1 && dist(&sprite[j],&sprite[g_player[screenpeek].ps.i]) > x) { stopenvsound(sprite[j].lotag,j); break; @@ -1236,7 +1236,7 @@ static void movefx(void) { if (T5 > 0) T5--; else for (p=connecthead;p>=0;p=connectpoint2[p]) - if (p == myconnectindex && ps[p].cursectnum == s->sectnum) + if (p == myconnectindex && g_player[p].ps.cursectnum == s->sectnum) { j = s->lotag+((unsigned)global_random%(s->hitag+1)); sound(j); @@ -1429,10 +1429,10 @@ static void movestandables(void) { if (s->owner==-2) { - spritesound(DUKE_GRUNT,ps[p].i); + spritesound(DUKE_GRUNT,g_player[p].ps.i); p = findplayer(s,&x); - if (ps[p].on_crane == i) - ps[p].on_crane = -1; + if (g_player[p].ps.on_crane == i) + g_player[p].ps.on_crane = -1; } t[0]++; s->owner = -1; @@ -1446,12 +1446,12 @@ static void movestandables(void) if (s->picnum == (CRANE+2)) { p = checkcursectnums(t[1]); - if (p >= 0 && ps[p].on_ground) + if (p >= 0 && g_player[p].ps.on_ground) { s->owner = -2; - ps[p].on_crane = i; - spritesound(DUKE_GRUNT,ps[p].i); - ps[p].ang = s->ang+1024; + g_player[p].ps.on_crane = i; + spritesound(DUKE_GRUNT,g_player[p].ps.i); + g_player[p].ps.ang = s->ang+1024; } else { @@ -1516,8 +1516,8 @@ static void movestandables(void) IFHIT { if (s->owner == -2) - if (ps[p].on_crane == i) - ps[p].on_crane = -1; + if (g_player[p].ps.on_crane == i) + g_player[p].ps.on_crane = -1; s->owner = -1; s->picnum = CRANE; goto BOLT; @@ -1535,11 +1535,11 @@ static void movestandables(void) } else if (s->owner == -2) { - ps[p].oposx = ps[p].posx = s->x-(sintable[(ps[p].ang+512)&2047]>>6); - ps[p].oposy = ps[p].posy = s->y-(sintable[ps[p].ang&2047]>>6); - ps[p].oposz = ps[p].posz = s->z+(2<<8); - setsprite(ps[p].i,ps[p].posx,ps[p].posy,ps[p].posz); - ps[p].cursectnum = sprite[ps[p].i].sectnum; + g_player[p].ps.oposx = g_player[p].ps.posx = s->x-(sintable[(g_player[p].ps.ang+512)&2047]>>6); + g_player[p].ps.oposy = g_player[p].ps.posy = s->y-(sintable[g_player[p].ps.ang&2047]>>6); + g_player[p].ps.oposz = g_player[p].ps.posz = s->z+(2<<8); + setsprite(g_player[p].ps.i,g_player[p].ps.posx,g_player[p].ps.posy,g_player[p].ps.posz); + g_player[p].ps.cursectnum = sprite[g_player[p].ps.i].sectnum; } } @@ -2192,7 +2192,7 @@ CLEAR_THE_BOLT: { sector[sect].floorz += sector[sect].extra; p = checkcursectnums(sect); - if (p >= 0) ps[p].posz += sector[sect].extra; + if (p >= 0) g_player[p].ps.posz += sector[sect].extra; } } else @@ -2207,7 +2207,7 @@ CLEAR_THE_BOLT: sector[sect].floorz -= sector[sect].extra; p = checkcursectnums(sect); if (p >= 0) - ps[p].posz -= sector[sect].extra; + g_player[p].ps.posz -= sector[sect].extra; } } goto BOLT; @@ -2216,7 +2216,7 @@ CLEAR_THE_BOLT: if (t[5] == 1) goto BOLT; p = checkcursectnums(sect); - if (p >= 0 && (ps[p].on_ground || s->ang == 512)) + if (p >= 0 && (g_player[p].ps.on_ground || s->ang == 512)) { if (t[0] == 0 && !check_activator_motion(s->lotag)) { @@ -2586,21 +2586,21 @@ static void moveweapons(void) if (thisprojectile[i].workslike & PROJECTILE_FLAG_SPIT) { - ps[p].horiz += 32; - ps[p].return_to_center = 8; + g_player[p].ps.horiz += 32; + g_player[p].ps.return_to_center = 8; - if (ps[p].loogcnt == 0) + if (g_player[p].ps.loogcnt == 0) { - if (!isspritemakingsound(ps[p].i, DUKE_LONGTERM_PAIN)) - spritesound(DUKE_LONGTERM_PAIN,ps[p].i); + if (!isspritemakingsound(g_player[p].ps.i, DUKE_LONGTERM_PAIN)) + spritesound(DUKE_LONGTERM_PAIN,g_player[p].ps.i); j = 3+(TRAND&3); - ps[p].numloogs = j; - ps[p].loogcnt = 24*4; + g_player[p].ps.numloogs = j; + g_player[p].ps.loogcnt = 24*4; for (x=0;x < j;x++) { - ps[p].loogiex[x] = TRAND%xdim; - ps[p].loogiey[x] = TRAND%ydim; + g_player[p].ps.loogiex[x] = TRAND%xdim; + g_player[p].ps.loogiey[x] = TRAND%ydim; } } } @@ -2950,21 +2950,21 @@ static void moveweapons(void) if (s->picnum == SPIT) { - ps[p].horiz += 32; - ps[p].return_to_center = 8; + g_player[p].ps.horiz += 32; + g_player[p].ps.return_to_center = 8; - if (ps[p].loogcnt == 0) + if (g_player[p].ps.loogcnt == 0) { - if (!isspritemakingsound(ps[p].i, DUKE_LONGTERM_PAIN)) - spritesound(DUKE_LONGTERM_PAIN,ps[p].i); + if (!isspritemakingsound(g_player[p].ps.i, DUKE_LONGTERM_PAIN)) + spritesound(DUKE_LONGTERM_PAIN,g_player[p].ps.i); j = 3+(TRAND&3); - ps[p].numloogs = j; - ps[p].loogcnt = 24*4; + g_player[p].ps.numloogs = j; + g_player[p].ps.loogcnt = 24*4; for (x=0;x < j;x++) { - ps[p].loogiex[x] = TRAND%xdim; - ps[p].loogiey[x] = TRAND%ydim; + g_player[p].ps.loogiex[x] = TRAND%xdim; + g_player[p].ps.loogiey[x] = TRAND%ydim; } } } @@ -3150,11 +3150,11 @@ static void movetransports(void) { p = sprite[j].yvel; - ps[p].on_warping_sector = 1; + g_player[p].ps.on_warping_sector = 1; - if (ps[p].transporter_hold == 0 && ps[p].jumping_counter == 0) + if (g_player[p].ps.transporter_hold == 0 && g_player[p].ps.jumping_counter == 0) { - if (ps[p].on_ground && sectlotag == 0 && onfloorz && ps[p].jetpack_on == 0) + if (g_player[p].ps.on_ground && sectlotag == 0 && onfloorz && g_player[p].ps.jetpack_on == 0) { if (sprite[i].pal == 0) { @@ -3163,27 +3163,27 @@ static void movetransports(void) } for (k=connecthead;k>=0;k=connectpoint2[k]) - if (ps[k].cursectnum == sprite[OW].sectnum) + if (g_player[k].ps.cursectnum == sprite[OW].sectnum) { - ps[k].frag_ps = p; - sprite[ps[k].i].extra = 0; + g_player[k].ps.frag_ps = p; + sprite[g_player[k].ps.i].extra = 0; } - ps[p].ang = sprite[OW].ang; + g_player[p].ps.ang = sprite[OW].ang; if (sprite[OW].owner != OW) { T1 = 13; hittype[OW].temp_data[0] = 13; - ps[p].transporter_hold = 13; + g_player[p].ps.transporter_hold = 13; } - ps[p].bobposx = ps[p].oposx = ps[p].posx = sprite[OW].x; - ps[p].bobposy = ps[p].oposy = ps[p].posy = sprite[OW].y; - ps[p].oposz = ps[p].posz = sprite[OW].z-PHEIGHT; + g_player[p].ps.bobposx = g_player[p].ps.oposx = g_player[p].ps.posx = sprite[OW].x; + g_player[p].ps.bobposy = g_player[p].ps.oposy = g_player[p].ps.posy = sprite[OW].y; + g_player[p].ps.oposz = g_player[p].ps.posz = sprite[OW].z-PHEIGHT; changespritesect(j,sprite[OW].sectnum); - ps[p].cursectnum = sprite[j].sectnum; + g_player[p].ps.cursectnum = sprite[j].sectnum; if (sprite[i].pal == 0) { @@ -3194,34 +3194,34 @@ static void movetransports(void) break; } } - else if (!(sectlotag == 1 && ps[p].on_ground == 1)) break; + else if (!(sectlotag == 1 && g_player[p].ps.on_ground == 1)) break; - if (onfloorz == 0 && klabs(SZ-ps[p].posz) < 6144) - if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && (sync[p].bits&1)) || - (ps[p].jetpack_on && (sync[p].bits&2))) + if (onfloorz == 0 && klabs(SZ-g_player[p].ps.posz) < 6144) + if ((g_player[p].ps.jetpack_on == 0) || (g_player[p].ps.jetpack_on && (g_player[p].sync.bits&1)) || + (g_player[p].ps.jetpack_on && (g_player[p].sync.bits&2))) { - ps[p].oposx = ps[p].posx += sprite[OW].x-SX; - ps[p].oposy = ps[p].posy += sprite[OW].y-SY; + g_player[p].ps.oposx = g_player[p].ps.posx += sprite[OW].x-SX; + g_player[p].ps.oposy = g_player[p].ps.posy += sprite[OW].y-SY; - if (ps[p].jetpack_on && ((sync[p].bits&1) || ps[p].jetpack_on < 11)) - ps[p].posz = sprite[OW].z-6144; - else ps[p].posz = sprite[OW].z+6144; - ps[p].oposz = ps[p].posz; + if (g_player[p].ps.jetpack_on && ((g_player[p].sync.bits&1) || g_player[p].ps.jetpack_on < 11)) + g_player[p].ps.posz = sprite[OW].z-6144; + else g_player[p].ps.posz = sprite[OW].z+6144; + g_player[p].ps.oposz = g_player[p].ps.posz; - hittype[ps[p].i].bposx = ps[p].posx; - hittype[ps[p].i].bposy = ps[p].posy; - hittype[ps[p].i].bposz = ps[p].posz; + hittype[g_player[p].ps.i].bposx = g_player[p].ps.posx; + hittype[g_player[p].ps.i].bposy = g_player[p].ps.posy; + hittype[g_player[p].ps.i].bposz = g_player[p].ps.posz; changespritesect(j,sprite[OW].sectnum); - ps[p].cursectnum = sprite[OW].sectnum; + g_player[p].ps.cursectnum = sprite[OW].sectnum; break; } k = 0; - if (onfloorz && sectlotag == 1 && ps[p].on_ground && ps[p].posz > (sector[sect].floorz-1080) && ((sync[p].bits&2) || ps[p].poszv > 2048)) - // if( onfloorz && sectlotag == 1 && ps[p].posz > (sector[sect].floorz-(6<<8)) ) + if (onfloorz && sectlotag == 1 && g_player[p].ps.on_ground && g_player[p].ps.posz > (sector[sect].floorz-1080) && ((g_player[p].sync.bits&2) || g_player[p].ps.poszv > 2048)) + // if( onfloorz && sectlotag == 1 && g_player[p].ps.posz > (sector[sect].floorz-(6<<8)) ) { k = 1; if (screenpeek == p) @@ -3229,17 +3229,17 @@ static void movetransports(void) FX_StopAllSounds(); clearsoundlocks(); } - if (sprite[ps[p].i].extra > 0) + if (sprite[g_player[p].ps.i].extra > 0) spritesound(DUKE_UNDERWATER,j); - ps[p].oposz = ps[p].posz = + g_player[p].ps.oposz = g_player[p].ps.posz = sector[sprite[OW].sectnum].ceilingz; - ps[p].posxv = 4096-(TRAND&8192); - ps[p].posyv = 4096-(TRAND&8192); - // ps[p].poszv += 1080; + g_player[p].ps.posxv = 4096-(TRAND&8192); + g_player[p].ps.posyv = 4096-(TRAND&8192); + // g_player[p].ps.poszv += 1080; } - if (onfloorz && sectlotag == 2 && ps[p].posz < (sector[sect].ceilingz+1080) && ps[p].poszv == 0) + if (onfloorz && sectlotag == 2 && g_player[p].ps.posz < (sector[sect].ceilingz+1080) && g_player[p].ps.poszv == 0) { k = 1; // if( sprite[j].extra <= 0) break; @@ -3250,27 +3250,27 @@ static void movetransports(void) } spritesound(DUKE_GASP,j); - ps[p].oposz = ps[p].posz = + g_player[p].ps.oposz = g_player[p].ps.posz = sector[sprite[OW].sectnum].floorz; - ps[p].jumping_toggle = 1; - ps[p].jumping_counter = 0; - // ps[p].poszv += 1024; + g_player[p].ps.jumping_toggle = 1; + g_player[p].ps.jumping_counter = 0; + // g_player[p].ps.poszv += 1024; } if (k == 1) { - ps[p].oposx = ps[p].posx += sprite[OW].x-SX; - ps[p].oposy = ps[p].posy += sprite[OW].y-SY; + g_player[p].ps.oposx = g_player[p].ps.posx += sprite[OW].x-SX; + g_player[p].ps.oposy = g_player[p].ps.posy += sprite[OW].y-SY; if (sprite[OW].owner != OW) - ps[p].transporter_hold = -2; - ps[p].cursectnum = sprite[OW].sectnum; + g_player[p].ps.transporter_hold = -2; + g_player[p].ps.cursectnum = sprite[OW].sectnum; changespritesect(j,sprite[OW].sectnum); - setsprite(ps[p].i,ps[p].posx,ps[p].posy,ps[p].posz+PHEIGHT); + setsprite(g_player[p].ps.i,g_player[p].ps.posx,g_player[p].ps.posy,g_player[p].ps.posz+PHEIGHT); - setpal(&ps[p]); + setpal(&g_player[p].ps); if ((TRAND&255) < 32) spawn(j,WATERSPLASH2); @@ -3278,7 +3278,7 @@ static void movetransports(void) if (sectlotag == 1) for (l = 0;l < 9;l++) { - q = spawn(ps[p].i,WATERBUBBLE); + q = spawn(g_player[p].ps.i,WATERBUBBLE); sprite[q].z += TRAND&16383; } } @@ -3641,16 +3641,16 @@ static void moveactors(void) // if(s->pal == 12) { - j = getincangle(ps[p].ang,getangle(s->x-ps[p].posx,s->y-ps[p].posy)); - if (j > -64 && j < 64 && (sync[p].bits&(1<<29))) - if (ps[p].toggle_key_flag == 1) + j = getincangle(g_player[p].ps.ang,getangle(s->x-g_player[p].ps.posx,s->y-g_player[p].ps.posy)); + if (j > -64 && j < 64 && (g_player[p].sync.bits&(1<<29))) + if (g_player[p].ps.toggle_key_flag == 1) { a = headspritestat[1]; while (a >= 0) { if (sprite[a].picnum == QUEBALL || sprite[a].picnum == STRIPEBALL) { - j = getincangle(ps[p].ang,getangle(sprite[a].x-ps[p].posx,sprite[a].y-ps[p].posy)); + j = getincangle(g_player[p].ps.ang,getangle(sprite[a].x-g_player[p].ps.posx,sprite[a].y-g_player[p].ps.posy)); if (j > -64 && j < 64) { findplayer(&sprite[a],&l); @@ -3664,15 +3664,15 @@ static void moveactors(void) if (s->pal == 12) s->xvel = 164; else s->xvel = 140; - s->ang = ps[p].ang; - ps[p].toggle_key_flag = 2; + s->ang = g_player[p].ps.ang; + g_player[p].ps.toggle_key_flag = 2; } } } } - if (x < 512 && s->sectnum == ps[p].cursectnum) + if (x < 512 && s->sectnum == g_player[p].ps.cursectnum) { - s->ang = getangle(s->x-ps[p].posx,s->y-ps[p].posy); + s->ang = getangle(s->x-g_player[p].ps.posx,s->y-g_player[p].ps.posy); s->xvel = 48; } } @@ -3768,7 +3768,7 @@ static void moveactors(void) RANDOMSCRAP; spritesound(LASERTRIP_EXPLODE,i); spawn(i,PIGCOP); - ps[myconnectindex].actors_killed++; + g_player[myconnectindex].ps.actors_killed++; KILLIT(i); } goto BOLT; @@ -3795,13 +3795,13 @@ static void moveactors(void) shoot(i,FIRELASER); s->ang = a; } - if (t[2] > (26*3) || !cansee(s->x,s->y,s->z-(16<<8),s->sectnum, ps[p].posx,ps[p].posy,ps[p].posz,ps[p].cursectnum)) + if (t[2] > (26*3) || !cansee(s->x,s->y,s->z-(16<<8),s->sectnum, g_player[p].ps.posx,g_player[p].ps.posy,g_player[p].ps.posz,g_player[p].ps.cursectnum)) { t[0] = 0; t[2] = 0; } else hittype[i].tempang += - getincangle(hittype[i].tempang,getangle(ps[p].posx-s->x,ps[p].posy-s->y))/3; + getincangle(hittype[i].tempang,getangle(g_player[p].ps.posx-s->x,g_player[p].ps.posy-s->y))/3; } else if (t[0] == 2 || t[0] == 3) { @@ -3811,14 +3811,14 @@ static void moveactors(void) if (t[0] == 2) { - l = ps[p].posz-s->z; + l = g_player[p].ps.posz-s->z; if (klabs(l) < (48<<8)) t[0] = 3; - else s->z += ksgn(ps[p].posz-s->z)<<10; + else s->z += ksgn(g_player[p].ps.posz-s->z)<<10; } else { t[2]++; - if (t[2] > (26*3) || !cansee(s->x,s->y,s->z-(16<<8),s->sectnum, ps[p].posx,ps[p].posy,ps[p].posz,ps[p].cursectnum)) + if (t[2] > (26*3) || !cansee(s->x,s->y,s->z-(16<<8),s->sectnum, g_player[p].ps.posx,g_player[p].ps.posy,g_player[p].ps.posz,g_player[p].ps.cursectnum)) { t[0] = 1; t[2] = 0; @@ -3829,7 +3829,7 @@ static void moveactors(void) shoot(i,FIRELASER); } } - s->ang += getincangle(s->ang,getangle(ps[p].posx-s->x,ps[p].posy-s->y))>>2; + s->ang += getincangle(s->ang,getangle(g_player[p].ps.posx-s->x,g_player[p].ps.posy-s->y))>>2; } if (t[0] != 2 && t[0] != 3) @@ -3988,11 +3988,11 @@ static void moveactors(void) spritesound(GLASS_BREAKING,i); KILLIT(i); } - else if (x < 1024 && ps[p].quick_kick == 0) + else if (x < 1024 && g_player[p].ps.quick_kick == 0) { - j = getincangle(ps[p].ang,getangle(SX-ps[p].posx,SY-ps[p].posy)); + j = getincangle(g_player[p].ps.ang,getangle(SX-g_player[p].ps.posx,SY-g_player[p].ps.posy)); if (j > -128 && j < 128) - ps[p].quick_kick = 14; + g_player[p].ps.quick_kick = 14; } goto BOLT; @@ -4004,7 +4004,7 @@ static void moveactors(void) if (t[0] == -4) //On the player { - if (sprite[ps[p].i].extra < 1) + if (sprite[g_player[p].ps.i].extra < 1) { t[0] = 0; goto BOLT; @@ -4012,10 +4012,10 @@ static void moveactors(void) setsprite(i,s->x,s->y,s->z); - s->ang = ps[p].ang; + s->ang = g_player[p].ps.ang; - if (((sync[p].bits&4) || (ps[p].quick_kick > 0)) && sprite[ps[p].i].extra > 0) - if (ps[p].quick_kick > 0 || (ps[p].curr_weapon != HANDREMOTE_WEAPON && ps[p].curr_weapon != HANDBOMB_WEAPON && ps[p].curr_weapon != TRIPBOMB_WEAPON && ps[p].ammo_amount[ps[p].curr_weapon] >= 0)) + if (((g_player[p].sync.bits&4) || (g_player[p].ps.quick_kick > 0)) && sprite[g_player[p].ps.i].extra > 0) + if (g_player[p].ps.quick_kick > 0 || (g_player[p].ps.curr_weapon != HANDREMOTE_WEAPON && g_player[p].ps.curr_weapon != HANDBOMB_WEAPON && g_player[p].ps.curr_weapon != TRIPBOMB_WEAPON && g_player[p].ps.ammo_amount[g_player[p].ps.curr_weapon] >= 0)) { for (x=0;x<8;x++) { @@ -4030,16 +4030,16 @@ static void moveactors(void) j = spawn(i,BLOODPOOL); sprite[j].pal = 0; } - ps[p].actors_killed ++; + g_player[p].ps.actors_killed ++; t[0] = -3; - if (ps[p].somethingonplayer == i) - ps[p].somethingonplayer = -1; + if (g_player[p].ps.somethingonplayer == i) + g_player[p].ps.somethingonplayer = -1; KILLIT(i); } - s->z = ps[p].posz+ps[p].pyoff-t[2]+(8<<8); + s->z = g_player[p].ps.posz+g_player[p].ps.pyoff-t[2]+(8<<8); - s->z += (100-ps[p].horiz)<<4; + s->z += (100-g_player[p].ps.horiz)<<4; if (t[2] > 512) t[2] -= 128; @@ -4047,16 +4047,16 @@ static void moveactors(void) if (t[2] < 348) t[2] += 128; - if (ps[p].newowner >= 0) + if (g_player[p].ps.newowner >= 0) { - ps[p].newowner = -1; - ps[p].posx = ps[p].oposx; - ps[p].posy = ps[p].oposy; - ps[p].posz = ps[p].oposz; - ps[p].ang = ps[p].oang; + g_player[p].ps.newowner = -1; + g_player[p].ps.posx = g_player[p].ps.oposx; + g_player[p].ps.posy = g_player[p].ps.oposy; + g_player[p].ps.posz = g_player[p].ps.oposz; + g_player[p].ps.ang = g_player[p].ps.oang; - updatesector(ps[p].posx,ps[p].posy,&ps[p].cursectnum); - setpal(&ps[p]); + updatesector(g_player[p].ps.posx,g_player[p].ps.posy,&g_player[p].ps.cursectnum); + setpal(&g_player[p].ps); j = headspritestat[1]; while (j >= 0) @@ -4074,7 +4074,7 @@ static void moveactors(void) if (t[3] == 5) { - sprite[ps[p].i].extra += -(5+(TRAND&3)); + sprite[g_player[p].ps.i].extra += -(5+(TRAND&3)); spritesound(SLIM_ATTACK,i); } @@ -4092,17 +4092,17 @@ static void moveactors(void) s->xrepeat = 20+(sintable[t[1]&2047]>>13); s->yrepeat = 15+(sintable[t[1]&2047]>>13); - s->x = ps[p].posx + (sintable[(ps[p].ang+512)&2047]>>7); - s->y = ps[p].posy + (sintable[ps[p].ang&2047]>>7); + s->x = g_player[p].ps.posx + (sintable[(g_player[p].ps.ang+512)&2047]>>7); + s->y = g_player[p].ps.posy + (sintable[g_player[p].ps.ang&2047]>>7); goto BOLT; } else if (s->xvel < 64 && x < 768) { - if (ps[p].somethingonplayer == -1) + if (g_player[p].ps.somethingonplayer == -1) { - ps[p].somethingonplayer = i; + g_player[p].ps.somethingonplayer = i; if (t[0] == 3 || t[0] == 2) //Falling downward t[2] = (12<<8); else t[2] = -(13<<8); //Climbing up duke @@ -4114,9 +4114,9 @@ static void moveactors(void) { spritesound(SLIM_DYING,i); - ps[p].actors_killed ++; - if (ps[p].somethingonplayer == i) - ps[p].somethingonplayer = -1; + g_player[p].ps.actors_killed ++; + if (g_player[p].ps.somethingonplayer == i) + g_player[p].ps.somethingonplayer = -1; if (j == FREEZEBLAST) { @@ -4192,7 +4192,7 @@ static void moveactors(void) // JBF 20041129: a slimer eating another enemy really ought // to decrease the maximum kill count by one. - if (sprite[t[5]].extra > 0) ps[myconnectindex].max_actors_killed--; + if (sprite[t[5]].extra > 0) g_player[myconnectindex].ps.max_actors_killed--; } } } @@ -4265,7 +4265,7 @@ static void moveactors(void) s->xvel = 64 - (sintable[(t[1]+512)&2047]>>9); s->ang += getincangle(s->ang, - getangle(ps[p].posx-s->x,ps[p].posy-s->y))>>3; + getangle(g_player[p].ps.posx-s->x,g_player[p].ps.posy-s->y))>>3; // TJR } @@ -4466,7 +4466,7 @@ DETONATEB: } // } - if ((l >= 0 && ps[l].hbomb_on == 0 && hittype[i].temp_data[6] == 2) || t[3] == 1) + if ((l >= 0 && g_player[l].ps.hbomb_on == 0 && hittype[i].temp_data[6] == 2) || t[3] == 1) hittype[i].temp_data[6] = 3; if (hittype[i].temp_data[6] == 3) @@ -4523,36 +4523,36 @@ DETONATEB: } } else if (s->picnum == HEAVYHBOMB && x < 788 && t[0] > 7 && s->xvel == 0) - if (cansee(s->x,s->y,s->z-(8<<8),s->sectnum,ps[p].posx,ps[p].posy,ps[p].posz,ps[p].cursectnum)) - if (ps[p].ammo_amount[HANDBOMB_WEAPON] < max_ammo_amount[HANDBOMB_WEAPON]) + if (cansee(s->x,s->y,s->z-(8<<8),s->sectnum,g_player[p].ps.posx,g_player[p].ps.posy,g_player[p].ps.posz,g_player[p].ps.cursectnum)) + if (g_player[p].ps.ammo_amount[HANDBOMB_WEAPON] < max_ammo_amount[HANDBOMB_WEAPON]) { if ((gametype_flags[ud.coop] & GAMETYPE_FLAG_WEAPSTAY) && s->owner == i) { - for (j=0;jpicnum) + for (j=0;jpicnum) goto BOLT; - if (ps[p].weapreccnt < 255) - ps[p].weaprecs[ps[p].weapreccnt++] = s->picnum; + if (g_player[p].ps.weapreccnt < 255) + g_player[p].ps.weaprecs[g_player[p].ps.weapreccnt++] = s->picnum; } - addammo(HANDBOMB_WEAPON,&ps[p],1); - spritesound(DUKE_GET,ps[p].i); + addammo(HANDBOMB_WEAPON,&g_player[p].ps,1); + spritesound(DUKE_GET,g_player[p].ps.i); - if (ps[p].gotweapon[HANDBOMB_WEAPON] == 0 || s->owner == ps[p].i) + if (g_player[p].ps.gotweapon[HANDBOMB_WEAPON] == 0 || s->owner == g_player[p].ps.i) { - /* addweapon(&ps[p],HANDBOMB_WEAPON); */ - if (!(ps[p].weaponswitch & 1) && *aplWeaponWorksLike[ps[p].curr_weapon] != HANDREMOTE_WEAPON) - addweaponnoswitch(&ps[p],HANDBOMB_WEAPON); - else addweapon(&ps[p],HANDBOMB_WEAPON); + /* addweapon(&g_player[p].ps,HANDBOMB_WEAPON); */ + if (!(g_player[p].ps.weaponswitch & 1) && *aplWeaponWorksLike[g_player[p].ps.curr_weapon] != HANDREMOTE_WEAPON) + addweaponnoswitch(&g_player[p].ps,HANDBOMB_WEAPON); + else addweapon(&g_player[p].ps,HANDBOMB_WEAPON); } if (sprite[s->owner].picnum != APLAYER) { - ps[p].pals[0] = 0; - ps[p].pals[1] = 32; - ps[p].pals[2] = 0; - ps[p].pals_time = 32; + g_player[p].ps.pals[0] = 0; + g_player[p].ps.pals[1] = 32; + g_player[p].ps.pals[2] = 0; + g_player[p].ps.pals_time = 32; } if (s->owner != i || ud.respawn_items == 0) @@ -4624,16 +4624,16 @@ DETONATEB: { if ((TRAND&255) < 16) { - if (!isspritemakingsound(ps[p].i, DUKE_LONGTERM_PAIN)) - spritesound(DUKE_LONGTERM_PAIN,ps[p].i); + if (!isspritemakingsound(g_player[p].ps.i, DUKE_LONGTERM_PAIN)) + spritesound(DUKE_LONGTERM_PAIN,g_player[p].ps.i); spritesound(SHORT_CIRCUIT,i); - sprite[ps[p].i].extra --; - ps[p].pals_time = 32; - ps[p].pals[0] = 32; - ps[p].pals[1] = 0; - ps[p].pals[2] = 0; + sprite[g_player[p].ps.i].extra --; + g_player[p].ps.pals_time = 32; + g_player[p].ps.pals[0] = 32; + g_player[p].ps.pals[1] = 0; + g_player[p].ps.pals[2] = 0; } t[0] += 128; if (t[3] == 0) @@ -4856,9 +4856,9 @@ static void moveexplosions(void) // STATNUM 5 else if (t[0] == 16) { s->picnum = NUKEBUTTON+2; - ps[sprite[s->owner].yvel].fist_incs = 1; + g_player[sprite[s->owner].yvel].ps.fist_incs = 1; } - if (ps[sprite[s->owner].yvel].fist_incs == 26) + if (g_player[sprite[s->owner].yvel].ps.fist_incs == 26) s->picnum = NUKEBUTTON+3; } goto BOLT; @@ -4954,11 +4954,11 @@ static void moveexplosions(void) // STATNUM 5 p = findplayer(s,&x); if (x < 512) { - ps[p].pals_time = 32; - ps[p].pals[0] = 32; - ps[p].pals[1] = 0; - ps[p].pals[2] = 0; - sprite[ps[p].i].extra -= 4; + g_player[p].ps.pals_time = 32; + g_player[p].ps.pals[0] = 32; + g_player[p].ps.pals[1] = 0; + g_player[p].ps.pals[2] = 0; + sprite[g_player[p].ps.i].extra -= 4; } case FIRELASER__STATIC: @@ -5169,17 +5169,17 @@ static void moveexplosions(void) // STATNUM 5 { if (s->pal == 0 && (TRAND&255) < 16 && s->picnum != PUKE) { - if (ps[p].boot_amount > 0) - ps[p].boot_amount--; + if (g_player[p].ps.boot_amount > 0) + g_player[p].ps.boot_amount--; else { - if (!isspritemakingsound(ps[p].i,DUKE_LONGTERM_PAIN)) - spritesound(DUKE_LONGTERM_PAIN,ps[p].i); - sprite[ps[p].i].extra --; - ps[p].pals_time = 32; - ps[p].pals[0] = 16; - ps[p].pals[1] = 0; - ps[p].pals[2] = 0; + if (!isspritemakingsound(g_player[p].ps.i,DUKE_LONGTERM_PAIN)) + spritesound(DUKE_LONGTERM_PAIN,g_player[p].ps.i); + sprite[g_player[p].ps.i].extra --; + g_player[p].ps.pals_time = 32; + g_player[p].ps.pals[0] = 16; + g_player[p].ps.pals[1] = 0; + g_player[p].ps.pals[2] = 0; } } @@ -5187,11 +5187,11 @@ static void moveexplosions(void) // STATNUM 5 t[1] = 1; if (hittype[i].picnum == TIRE) - ps[p].footprintcount = 10; - else ps[p].footprintcount = 3; + g_player[p].ps.footprintcount = 10; + else g_player[p].ps.footprintcount = 3; - ps[p].footprintpal = s->pal; - ps[p].footprintshade = s->shade; + g_player[p].ps.footprintpal = s->pal; + g_player[p].ps.footprintshade = s->shade; if (t[2] == 32) { @@ -5471,26 +5471,26 @@ static void moveeffectors(void) //STATNUM 3 { for (p=connecthead;p>=0;p=connectpoint2[p]) { - if (ps[p].cursectnum == s->sectnum && ps[p].on_ground == 1) + if (g_player[p].ps.cursectnum == s->sectnum && g_player[p].ps.on_ground == 1) { - ps[p].ang += (l*q); - ps[p].ang &= 2047; + g_player[p].ps.ang += (l*q); + g_player[p].ps.ang &= 2047; - ps[p].posz += zchange; + g_player[p].ps.posz += zchange; - rotatepoint(sprite[j].x,sprite[j].y,ps[p].posx,ps[p].posy,(q*l),&m,&x); + rotatepoint(sprite[j].x,sprite[j].y,g_player[p].ps.posx,g_player[p].ps.posy,(q*l),&m,&x); - ps[p].bobposx += m-ps[p].posx; - ps[p].bobposy += x-ps[p].posy; + g_player[p].ps.bobposx += m-g_player[p].ps.posx; + g_player[p].ps.bobposy += x-g_player[p].ps.posy; - ps[p].posx = m; - ps[p].posy = x; + g_player[p].ps.posx = m; + g_player[p].ps.posy = x; - if (sprite[ps[p].i].extra <= 0) + if (sprite[g_player[p].ps.i].extra <= 0) { - sprite[ps[p].i].x = m; - sprite[ps[p].i].y = x; + sprite[g_player[p].ps.i].x = m; + sprite[g_player[p].ps.i].y = x; } } } @@ -5630,7 +5630,7 @@ static void moveeffectors(void) //STATNUM 3 if (x < 20480) { j = s->ang; - s->ang = getangle(s->x-ps[p].posx,s->y-ps[p].posy); + s->ang = getangle(s->x-g_player[p].ps.posx,s->y-g_player[p].ps.posy); shoot(i,RPG); s->ang = j; } @@ -5644,18 +5644,18 @@ static void moveeffectors(void) //STATNUM 3 { if (ud.clipping == 0 && s->xvel >= 192) for (p=connecthead;p>=0;p=connectpoint2[p]) - if (sprite[ps[p].i].extra > 0) + if (sprite[g_player[p].ps.i].extra > 0) { - k = ps[p].cursectnum; - updatesector(ps[p].posx,ps[p].posy,&k); - if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && ps[p].cursectnum != s->sectnum)) + k = g_player[p].ps.cursectnum; + updatesector(g_player[p].ps.posx,g_player[p].ps.posy,&k); + if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && g_player[p].ps.cursectnum != s->sectnum)) { - ps[p].posx = s->x; - ps[p].posy = s->y; - ps[p].cursectnum = s->sectnum; + g_player[p].ps.posx = s->x; + g_player[p].ps.posy = s->y; + g_player[p].ps.cursectnum = s->sectnum; - setsprite(ps[p].i,s->x,s->y,s->z); - quickkill(&ps[p]); + setsprite(g_player[p].ps.i,s->x,s->y,s->z); + quickkill(&g_player[p].ps); } } } @@ -5664,35 +5664,35 @@ static void moveeffectors(void) //STATNUM 3 x = (s->xvel*sintable[s->ang&2047])>>14; for (p = connecthead;p >= 0;p=connectpoint2[p]) - if (sector[ps[p].cursectnum].lotag != 2) + if (sector[g_player[p].ps.cursectnum].lotag != 2) { - if (po[p].os == s->sectnum) + if (g_player[p].po.os == s->sectnum) { - po[p].ox += m; - po[p].oy += x; + g_player[p].po.ox += m; + g_player[p].po.oy += x; } - if (s->sectnum == sprite[ps[p].i].sectnum) + if (s->sectnum == sprite[g_player[p].ps.i].sectnum) { - rotatepoint(s->x,s->y,ps[p].posx,ps[p].posy,q,&ps[p].posx,&ps[p].posy); + rotatepoint(s->x,s->y,g_player[p].ps.posx,g_player[p].ps.posy,q,&g_player[p].ps.posx,&g_player[p].ps.posy); - ps[p].posx += m; - ps[p].posy += x; + g_player[p].ps.posx += m; + g_player[p].ps.posy += x; - ps[p].bobposx += m; - ps[p].bobposy += x; + g_player[p].ps.bobposx += m; + g_player[p].ps.bobposy += x; - ps[p].ang += q; + g_player[p].ps.ang += q; if (numplayers > 1) { - ps[p].oposx = ps[p].posx; - ps[p].oposy = ps[p].posy; + g_player[p].ps.oposx = g_player[p].ps.posx; + g_player[p].ps.oposy = g_player[p].ps.posy; } - if (sprite[ps[p].i].extra <= 0) + if (sprite[g_player[p].ps.i].extra <= 0) { - sprite[ps[p].i].x = ps[p].posx; - sprite[ps[p].i].y = ps[p].posy; + sprite[g_player[p].ps.i].x = g_player[p].ps.posx; + sprite[g_player[p].ps.i].y = g_player[p].ps.posy; } } } @@ -5724,18 +5724,18 @@ static void moveeffectors(void) //STATNUM 3 { if (ud.clipping == 0 && s->xvel >= 192) for (p=connecthead;p>=0;p=connectpoint2[p]) - if (sprite[ps[p].i].extra > 0) + if (sprite[g_player[p].ps.i].extra > 0) { - k = ps[p].cursectnum; - updatesector(ps[p].posx,ps[p].posy,&k); - if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && ps[p].cursectnum != s->sectnum)) + k = g_player[p].ps.cursectnum; + updatesector(g_player[p].ps.posx,g_player[p].ps.posy,&k); + if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && g_player[p].ps.cursectnum != s->sectnum)) { - ps[p].oposx = ps[p].posx = s->x; - ps[p].oposy = ps[p].posy = s->y; - ps[p].cursectnum = s->sectnum; + g_player[p].ps.oposx = g_player[p].ps.posx = s->x; + g_player[p].ps.oposy = g_player[p].ps.posy = s->y; + g_player[p].ps.cursectnum = s->sectnum; - setsprite(ps[p].i,s->x,s->y,s->z); - quickkill(&ps[p]); + setsprite(g_player[p].ps.i,s->x,s->y,s->z); + quickkill(&g_player[p].ps); } } @@ -5823,42 +5823,42 @@ static void moveeffectors(void) //STATNUM 3 if ((sc->floorz-sc->ceilingz) < (108<<8)) if (ud.clipping == 0) for (p=connecthead;p>=0;p=connectpoint2[p]) - if (sprite[ps[p].i].extra > 0) + if (sprite[g_player[p].ps.i].extra > 0) { - k = ps[p].cursectnum; - updatesector(ps[p].posx,ps[p].posy,&k); - if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && ps[p].cursectnum != s->sectnum)) + k = g_player[p].ps.cursectnum; + updatesector(g_player[p].ps.posx,g_player[p].ps.posy,&k); + if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && g_player[p].ps.cursectnum != s->sectnum)) { - ps[p].posx = s->x; - ps[p].posy = s->y; - ps[p].cursectnum = s->sectnum; + g_player[p].ps.posx = s->x; + g_player[p].ps.posy = s->y; + g_player[p].ps.cursectnum = s->sectnum; - setsprite(ps[p].i,s->x,s->y,s->z); - quickkill(&ps[p]); + setsprite(g_player[p].ps.i,s->x,s->y,s->z); + quickkill(&g_player[p].ps); } } for (p = connecthead;p >= 0;p = connectpoint2[p]) { - if (sprite[ps[p].i].sectnum == s->sectnum) + if (sprite[g_player[p].ps.i].sectnum == s->sectnum) { - ps[p].posx += l; - ps[p].posy += x; + g_player[p].ps.posx += l; + g_player[p].ps.posy += x; if (numplayers > 1) { - ps[p].oposx = ps[p].posx; - ps[p].oposy = ps[p].posy; + g_player[p].ps.oposx = g_player[p].ps.posx; + g_player[p].ps.oposy = g_player[p].ps.posy; } - ps[p].bobposx += l; - ps[p].bobposy += x; + g_player[p].ps.bobposx += l; + g_player[p].ps.bobposy += x; } - if (po[p].os == s->sectnum) + if (g_player[p].po.os == s->sectnum) { - po[p].ox += l; - po[p].oy += x; + g_player[p].po.ox += l; + g_player[p].po.oy += x; } } @@ -5892,22 +5892,22 @@ static void moveeffectors(void) //STATNUM 3 { if (ud.clipping == 0) for (p=connecthead;p>=0;p=connectpoint2[p]) - if (sprite[ps[p].i].extra > 0) + if (sprite[g_player[p].ps.i].extra > 0) { - k = ps[p].cursectnum; - updatesector(ps[p].posx,ps[p].posy,&k); - if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && ps[p].cursectnum != s->sectnum)) + k = g_player[p].ps.cursectnum; + updatesector(g_player[p].ps.posx,g_player[p].ps.posy,&k); + if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && g_player[p].ps.cursectnum != s->sectnum)) { - ps[p].posx = s->x; - ps[p].posy = s->y; + g_player[p].ps.posx = s->x; + g_player[p].ps.posy = s->y; - ps[p].oposx = ps[p].posx; - ps[p].oposy = ps[p].posy; + g_player[p].ps.oposx = g_player[p].ps.posx; + g_player[p].ps.oposy = g_player[p].ps.posy; - ps[p].cursectnum = s->sectnum; + g_player[p].ps.cursectnum = s->sectnum; - setsprite(ps[p].i,s->x,s->y,s->z); - quickkill(&ps[p]); + setsprite(g_player[p].ps.i,s->x,s->y,s->z); + quickkill(&g_player[p].ps); } } @@ -5963,7 +5963,7 @@ static void moveeffectors(void) //STATNUM 3 if ((t[0]&31) == 8) { earthquaketime = 48; - spritesound(EARTHQUAKE,ps[screenpeek].i); + spritesound(EARTHQUAKE,g_player[screenpeek].ps.i); } if (klabs(sc->floorheinum-t[5]) < 8) @@ -5976,13 +5976,13 @@ static void moveeffectors(void) //STATNUM 3 for (p=connecthead;p>=0;p=connectpoint2[p]) - if (ps[p].cursectnum == s->sectnum && ps[p].on_ground) + if (g_player[p].ps.cursectnum == s->sectnum && g_player[p].ps.on_ground) { - ps[p].posx += m; - ps[p].posy += x; + g_player[p].ps.posx += m; + g_player[p].ps.posy += x; - ps[p].bobposx += m; - ps[p].bobposy += x; + g_player[p].ps.bobposx += m; + g_player[p].ps.bobposy += x; } j = headspritesect[s->sectnum]; @@ -6108,7 +6108,7 @@ static void moveeffectors(void) //STATNUM 3 if (x < 8192) { j = s->ang; - s->ang = getangle(s->x-ps[p].posx,s->y-ps[p].posy); + s->ang = getangle(s->x-g_player[p].ps.posx,s->y-g_player[p].ps.posy); shoot(i,FIRELASER); s->ang = j; } @@ -6123,7 +6123,7 @@ static void moveeffectors(void) //STATNUM 3 if (s->owner==-1) break; - m = ldist(&sprite[ps[p].i],&sprite[s->owner]); + m = ldist(&sprite[g_player[p].ps.i],&sprite[s->owner]); if (l > m) { @@ -6142,7 +6142,7 @@ static void moveeffectors(void) //STATNUM 3 { short ta; ta = s->ang; - s->ang = getangle(ps[p].posx-s->x,ps[p].posy-s->y); + s->ang = getangle(g_player[p].ps.posx-s->x,g_player[p].ps.posy-s->y); s->ang = ta; s->owner = -1; goto BOLT; @@ -6162,7 +6162,7 @@ static void moveeffectors(void) //STATNUM 3 else { t[2] += - getincangle(t[2]+512,getangle(ps[p].posx-s->x,ps[p].posy-s->y))>>2; + getincangle(t[2]+512,getangle(g_player[p].ps.posx-s->x,g_player[p].ps.posy-s->y))>>2; sc->ceilingshade = 0; } IFHIT @@ -6171,7 +6171,7 @@ static void moveeffectors(void) //STATNUM 3 if (t[3] == 5) { s->zvel += 1024; - FTA(7,&ps[myconnectindex]); + FTA(7,&g_player[myconnectindex].ps); } } @@ -6263,7 +6263,7 @@ static void moveeffectors(void) //STATNUM 3 if ((sc->lotag&0xff) != 27) for (p=connecthead;p>=0;p=connectpoint2[p]) if (sc->lotag != 30 && sc->lotag != 31 && sc->lotag != 0) - if (s->sectnum == sprite[ps[p].i].sectnum) + if (s->sectnum == sprite[g_player[p].ps.i].sectnum) j = 0; if (j == 1) @@ -6455,12 +6455,12 @@ static void moveeffectors(void) //STATNUM 3 sc->floorshade = s->shade; - if (ps[0].one_parallax_sectnum >= 0) + if (g_player[0].ps.one_parallax_sectnum >= 0) { sc->ceilingpicnum = - sector[ps[0].one_parallax_sectnum].ceilingpicnum; + sector[g_player[0].ps.one_parallax_sectnum].ceilingpicnum; sc->ceilingshade = - sector[ps[0].one_parallax_sectnum].ceilingshade; + sector[g_player[0].ps.one_parallax_sectnum].ceilingshade; } } } @@ -6556,12 +6556,12 @@ static void moveeffectors(void) //STATNUM 3 { p = sprite[j].yvel; if (numplayers < 2) - ps[p].oposz = ps[p].posz; - ps[p].posz += q; - ps[p].truefz += q; - ps[p].truecz += q; + g_player[p].ps.oposz = g_player[p].ps.posz; + g_player[p].ps.posz += q; + g_player[p].ps.truefz += q; + g_player[p].ps.truecz += q; if (numplayers > 1) - ps[p].oposz = ps[p].posz; + g_player[p].ps.oposz = g_player[p].ps.posz; } if (sprite[j].statnum != 3) { @@ -6615,23 +6615,23 @@ static void moveeffectors(void) //STATNUM 3 { p = sprite[k].yvel; - ps[p].posx += sprite[j].x-s->x; - ps[p].posy += sprite[j].y-s->y; - ps[p].posz = sector[sprite[j].sectnum].floorz-(sc->floorz-ps[p].posz); + g_player[p].ps.posx += sprite[j].x-s->x; + g_player[p].ps.posy += sprite[j].y-s->y; + g_player[p].ps.posz = sector[sprite[j].sectnum].floorz-(sc->floorz-g_player[p].ps.posz); hittype[k].floorz = sector[sprite[j].sectnum].floorz; hittype[k].ceilingz = sector[sprite[j].sectnum].ceilingz; - ps[p].bobposx = ps[p].oposx = ps[p].posx; - ps[p].bobposy = ps[p].oposy = ps[p].posy; - ps[p].oposz = ps[p].posz; + g_player[p].ps.bobposx = g_player[p].ps.oposx = g_player[p].ps.posx; + g_player[p].ps.bobposy = g_player[p].ps.oposy = g_player[p].ps.posy; + g_player[p].ps.oposz = g_player[p].ps.posz; - ps[p].truefz = hittype[k].floorz; - ps[p].truecz = hittype[k].ceilingz; - ps[p].bobcounter = 0; + g_player[p].ps.truefz = hittype[k].floorz; + g_player[p].ps.truecz = hittype[k].ceilingz; + g_player[p].ps.bobcounter = 0; changespritesect(k,sprite[j].sectnum); - ps[p].cursectnum = sprite[j].sectnum; + g_player[p].ps.cursectnum = sprite[j].sectnum; } else if (sprite[k].statnum != 3) { @@ -6679,8 +6679,8 @@ static void moveeffectors(void) //STATNUM 3 while (j >= 0) { if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) - if (ps[sprite[j].yvel].on_ground == 1) - ps[sprite[j].yvel].posz += sc->extra; + if (g_player[sprite[j].yvel].ps.on_ground == 1) + g_player[sprite[j].yvel].ps.posz += sc->extra; if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) { hittype[j].bposz = sprite[j].z += sc->extra; @@ -6713,8 +6713,8 @@ static void moveeffectors(void) //STATNUM 3 while (j >= 0) { if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) - if (ps[sprite[j].yvel].on_ground == 1) - ps[sprite[j].yvel].posz -= sc->extra; + if (g_player[sprite[j].yvel].ps.on_ground == 1) + g_player[sprite[j].yvel].ps.posz -= sc->extra; if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) { hittype[j].bposz = sprite[j].z -= sc->extra; @@ -6789,7 +6789,7 @@ static void moveeffectors(void) //STATNUM 3 { IFHITSECT { - FTA(8,&ps[myconnectindex]); + FTA(8,&g_player[myconnectindex].ps); l = headspritestat[3]; while (l >= 0) @@ -6877,15 +6877,15 @@ static void moveeffectors(void) //STATNUM 3 dragpoint((short)t[2],wall[t[2]].x+x,wall[t[2]].y+l); for (p=connecthead;p>=0;p=connectpoint2[p]) - if (ps[p].cursectnum == s->sectnum && ps[p].on_ground) + if (g_player[p].ps.cursectnum == s->sectnum && g_player[p].ps.on_ground) { - ps[p].posx += x; - ps[p].posy += l; + g_player[p].ps.posx += x; + g_player[p].ps.posy += l; - ps[p].oposx = ps[p].posx; - ps[p].oposy = ps[p].posy; + g_player[p].ps.oposx = g_player[p].ps.posx; + g_player[p].ps.oposy = g_player[p].ps.posy; - setsprite(ps[p].i,ps[p].posx,ps[p].posy,ps[p].posz+PHEIGHT); + setsprite(g_player[p].ps.i,g_player[p].ps.posx,g_player[p].ps.posy,g_player[p].ps.posz+PHEIGHT); } sc->floorxpanning-=x>>3; @@ -7013,8 +7013,8 @@ static void moveeffectors(void) //STATNUM 3 } p = myconnectindex; - if (ps[p].cursectnum == s->sectnum && ps[p].on_ground) - if (klabs(ps[p].posz-ps[p].truefz) < PHEIGHT+(9<<8)) + if (g_player[p].ps.cursectnum == s->sectnum && g_player[p].ps.on_ground) + if (klabs(g_player[p].ps.posz-g_player[p].ps.truefz) < PHEIGHT+(9<<8)) { fricxv += x<<3; fricyv += l<<3; @@ -7117,15 +7117,15 @@ static void moveeffectors(void) //STATNUM 3 } p = myconnectindex; - if (sprite[ps[p].i].sectnum == s->sectnum && ps[p].on_ground) + if (sprite[g_player[p].ps.i].sectnum == s->sectnum && g_player[p].ps.on_ground) { fricxv += l<<5; fricyv += x<<5; } for (p = connecthead;p >= 0;p = connectpoint2[p]) - if (sprite[ps[p].i].sectnum == s->sectnum && ps[p].on_ground) - ps[p].posz += s->zvel; + if (sprite[g_player[p].ps.i].sectnum == s->sectnum && g_player[p].ps.on_ground) + g_player[p].ps.posz += s->zvel; ms(i); setsprite(i,s->x,s->y,s->z); @@ -7140,23 +7140,23 @@ static void moveeffectors(void) //STATNUM 3 hittype[i].tempang = s->ang; p = findplayer(s,&x); - if (sprite[ps[p].i].extra > 0 && myconnectindex == screenpeek) + if (sprite[g_player[p].ps.i].extra > 0 && myconnectindex == screenpeek) { if (t[0] < 0) { ud.camerasprite = i; t[0]++; } - else if (ud.recstat == 2 && ps[p].newowner == -1) + else if (ud.recstat == 2 && g_player[p].ps.newowner == -1) { - if (cansee(s->x,s->y,s->z,SECT,ps[p].posx,ps[p].posy,ps[p].posz,ps[p].cursectnum)) + if (cansee(s->x,s->y,s->z,SECT,g_player[p].ps.posx,g_player[p].ps.posy,g_player[p].ps.posz,g_player[p].ps.cursectnum)) { if (x < (long)((unsigned)sh)) { ud.camerasprite = i; t[0] = 999; - s->ang += getincangle(s->ang,getangle(ps[p].posx-s->x,ps[p].posy-s->y))>>3; - SP = 100+((s->z-ps[p].posz)/257); + s->ang += getincangle(s->ang,getangle(g_player[p].ps.posx-s->x,g_player[p].ps.posy-s->y))>>3; + SP = 100+((s->z-g_player[p].ps.posz)/257); } else if (t[0] == 999) @@ -7170,7 +7170,7 @@ static void moveeffectors(void) //STATNUM 3 } else { - s->ang = getangle(ps[p].posx-s->x,ps[p].posy-s->y); + s->ang = getangle(g_player[p].ps.posx-s->x,g_player[p].ps.posy-s->y); if (t[0] == 999) { @@ -7205,7 +7205,7 @@ static void moveeffectors(void) //STATNUM 3 if (T3 > T2) { T1 = 0; - ps[screenpeek].visibility = ud.const_visibility; + g_player[screenpeek].ps.visibility = ud.const_visibility; break; } else if (T3 == (T2>>1)) @@ -7224,17 +7224,17 @@ static void moveeffectors(void) //STATNUM 3 } else if (T3 > (T2>>3) && T3 < (T2>>2)) { - if (cansee(s->x,s->y,s->z,s->sectnum,ps[screenpeek].posx,ps[screenpeek].posy,ps[screenpeek].posz,ps[screenpeek].cursectnum)) + if (cansee(s->x,s->y,s->z,s->sectnum,g_player[screenpeek].ps.posx,g_player[screenpeek].ps.posy,g_player[screenpeek].ps.posz,g_player[screenpeek].ps.cursectnum)) j = 1; else j = 0; if (rnd(192) && (T3&1)) { if (j) - ps[screenpeek].visibility = 0; + g_player[screenpeek].ps.visibility = 0; } else if (j) - ps[screenpeek].visibility = ud.const_visibility; + g_player[screenpeek].ps.visibility = ud.const_visibility; j = headspritestat[0]; while (j >= 0) @@ -7247,17 +7247,17 @@ static void moveeffectors(void) //STATNUM 3 spawn(j,SMALLSMOKE); p = findplayer(s,&x); - x = ldist(&sprite[ps[p].i], &sprite[j]); + x = ldist(&sprite[g_player[p].ps.i], &sprite[j]); if (x < 768) { - if (!isspritemakingsound(ps[p].i,DUKE_LONGTERM_PAIN)) - spritesound(DUKE_LONGTERM_PAIN,ps[p].i); - spritesound(SHORT_CIRCUIT,ps[p].i); - sprite[ps[p].i].extra -= 8+(TRAND&7); - ps[p].pals_time = 32; - ps[p].pals[0] = 16; - ps[p].pals[1] = 0; - ps[p].pals[2] = 0; + if (!isspritemakingsound(g_player[p].ps.i,DUKE_LONGTERM_PAIN)) + spritesound(DUKE_LONGTERM_PAIN,g_player[p].ps.i); + spritesound(SHORT_CIRCUIT,g_player[p].ps.i); + sprite[g_player[p].ps.i].extra -= 8+(TRAND&7); + g_player[p].ps.pals_time = 32; + g_player[p].ps.pals[0] = 16; + g_player[p].ps.pals[1] = 0; + g_player[p].ps.pals[2] = 0; } break; } @@ -7306,8 +7306,8 @@ static void moveeffectors(void) //STATNUM 3 while (j >= 0) { if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) - if (ps[sprite[j].yvel].on_ground == 1) - ps[sprite[j].yvel].posz += l; + if (g_player[sprite[j].yvel].ps.on_ground == 1) + g_player[sprite[j].yvel].ps.posz += l; if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) { hittype[j].bposz = sprite[j].z += l; @@ -7336,8 +7336,8 @@ static void moveeffectors(void) //STATNUM 3 while (j >= 0) { if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) - if (ps[sprite[j].yvel].on_ground == 1) - ps[sprite[j].yvel].posz += l; + if (g_player[sprite[j].yvel].ps.on_ground == 1) + g_player[sprite[j].yvel].ps.posz += l; if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) { hittype[j].bposz = sprite[j].z += l; @@ -7368,8 +7368,8 @@ static void moveeffectors(void) //STATNUM 3 while (j >= 0) { if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) - if (ps[sprite[j].yvel].on_ground == 1) - ps[sprite[j].yvel].posz += l; + if (g_player[sprite[j].yvel].ps.on_ground == 1) + g_player[sprite[j].yvel].ps.posz += l; if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) { hittype[j].bposz = sprite[j].z += l; @@ -7397,8 +7397,8 @@ static void moveeffectors(void) //STATNUM 3 while (j >= 0) { if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) - if (ps[sprite[j].yvel].on_ground == 1) - ps[sprite[j].yvel].posz -= l; + if (g_player[sprite[j].yvel].ps.on_ground == 1) + g_player[sprite[j].yvel].ps.posz -= l; if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) { hittype[j].bposz = sprite[j].z -= l; diff --git a/polymer/eduke32/source/anim.c b/polymer/eduke32/source/anim.c index 47d41d7a1..089fe2b3b 100644 --- a/polymer/eduke32/source/anim.c +++ b/polymer/eduke32/source/anim.c @@ -248,7 +248,7 @@ void playanm(const char *fn,char t) //setpalette(0L,256L,tempbuf); //setbrightness(ud.brightness>>2,tempbuf,2); - setgamepalette(&ps[myconnectindex],animpal,10); + setgamepalette(&g_player[myconnectindex].ps,animpal,10); #if defined(POLYMOST) && defined(USE_OPENGL) gltexfiltermode = 0; @@ -267,7 +267,7 @@ void playanm(const char *fn,char t) getpackets(); if (restorepalette == 1) { - setgamepalette(&ps[myconnectindex],animpal,0); + setgamepalette(&g_player[myconnectindex].ps,animpal,0); restorepalette = 0; } idle(); diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index e3577bc19..6f7f16ee2 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -42,8 +42,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define __SETUP__ // JBF 20031211 #include "_functio.h" -config_t config; - /* =================== = @@ -151,7 +149,7 @@ void CONFIG_SetDefaultKeys(int type) { int32 i,f; - memset(config.KeyboardKeys, 0xff, sizeof(config.KeyboardKeys)); + memset(ud.config.KeyboardKeys, 0xff, sizeof(ud.config.KeyboardKeys)); if (type == 1) { @@ -159,11 +157,11 @@ void CONFIG_SetDefaultKeys(int type) { f = CONFIG_FunctionNameToNum((char *)oldkeydefaults[i+0]); if (f == -1) continue; - config.KeyboardKeys[f][0] = KB_StringToScanCode((char *)oldkeydefaults[i+1]); - config.KeyboardKeys[f][1] = KB_StringToScanCode((char *)oldkeydefaults[i+2]); + ud.config.KeyboardKeys[f][0] = KB_StringToScanCode((char *)oldkeydefaults[i+1]); + ud.config.KeyboardKeys[f][1] = KB_StringToScanCode((char *)oldkeydefaults[i+2]); - if (f == gamefunc_Show_Console) OSD_CaptureKey(config.KeyboardKeys[f][0]); - else CONTROL_MapKey(f, config.KeyboardKeys[f][0], config.KeyboardKeys[f][1]); + if (f == gamefunc_Show_Console) OSD_CaptureKey(ud.config.KeyboardKeys[f][0]); + else CONTROL_MapKey(f, ud.config.KeyboardKeys[f][0], ud.config.KeyboardKeys[f][1]); } return; } @@ -172,11 +170,11 @@ void CONFIG_SetDefaultKeys(int type) { f = CONFIG_FunctionNameToNum(keydefaults[i+0]); if (f == -1) continue; - config.KeyboardKeys[f][0] = KB_StringToScanCode(keydefaults[i+1]); - config.KeyboardKeys[f][1] = KB_StringToScanCode(keydefaults[i+2]); + ud.config.KeyboardKeys[f][0] = KB_StringToScanCode(keydefaults[i+1]); + ud.config.KeyboardKeys[f][1] = KB_StringToScanCode(keydefaults[i+2]); - if (f == gamefunc_Show_Console) OSD_CaptureKey(config.KeyboardKeys[f][0]); - else CONTROL_MapKey(f, config.KeyboardKeys[f][0], config.KeyboardKeys[f][1]); + if (f == gamefunc_Show_Console) OSD_CaptureKey(ud.config.KeyboardKeys[f][0]); + else CONTROL_MapKey(f, ud.config.KeyboardKeys[f][0], ud.config.KeyboardKeys[f][1]); } } @@ -185,28 +183,28 @@ void CONFIG_SetDefaults(void) // JBF 20031211 int32 i,f; - config.scripthandle = -1; - config.useprecache = 1; - config.ForceSetup = 1; - config.AmbienceToggle = 1; - config.AutoAim = 1; - config.FXDevice = 0; - config.FXVolume = 220; - config.MixRate = 44100; - config.MouseBias = 0; - config.MouseFilter = 0; - config.MusicDevice = 0; - config.MusicToggle = 1; - config.MusicVolume = 200; - myaimmode = ps[0].aim_mode = 1; - config.NumBits = 16; - config.NumChannels = 2; - config.NumVoices = 32; - config.ReverseStereo = 0; - config.RunMode = ud.auto_run = 1; - config.ShowOpponentWeapons = 0; - config.SmoothInput = 1; - config.SoundToggle = 1; + ud.config.scripthandle = -1; + ud.config.useprecache = 1; + ud.config.ForceSetup = 1; + ud.config.AmbienceToggle = 1; + ud.config.AutoAim = 1; + ud.config.FXDevice = 0; + ud.config.FXVolume = 220; + ud.config.MixRate = 44100; + ud.config.MouseBias = 0; + ud.config.MouseFilter = 0; + ud.config.MusicDevice = 0; + ud.config.MusicToggle = 1; + ud.config.MusicVolume = 200; + myaimmode = g_player[0].ps.aim_mode = 1; + ud.config.NumBits = 16; + ud.config.NumChannels = 2; + ud.config.NumVoices = 32; + ud.config.ReverseStereo = 0; + ud.config.RunMode = ud.auto_run = 1; + ud.config.ShowOpponentWeapons = 0; + ud.config.SmoothInput = 1; + ud.config.SoundToggle = 1; ud.automsg = 0; ud.autovote = 0; ud.brightness = 8; @@ -236,9 +234,9 @@ void CONFIG_SetDefaults(void) ud.weaponsway = 1; ud.weaponswitch = 3; // new+empty ud.angleinterpolation = 0; - config.UseJoystick = 0; - config.UseMouse = 1; - config.VoiceToggle = 2; + ud.config.UseJoystick = 0; + ud.config.UseMouse = 1; + ud.config.VoiceToggle = 2; Bstrcpy(ud.rtsname, "DUKE.RTS"); Bstrcpy(myname, "Duke"); @@ -258,56 +256,56 @@ void CONFIG_SetDefaults(void) CONFIG_SetDefaultKeys(0); - memset(config.MouseFunctions, -1, sizeof(config.MouseFunctions)); + memset(ud.config.MouseFunctions, -1, sizeof(ud.config.MouseFunctions)); for (i=0; i=4) continue; - config.MouseFunctions[i][1] = CONFIG_FunctionNameToNum(mouseclickeddefaults[i]); - CONTROL_MapButton(config.MouseFunctions[i][1], i, 1, controldevice_mouse); + ud.config.MouseFunctions[i][1] = CONFIG_FunctionNameToNum(mouseclickeddefaults[i]); + CONTROL_MapButton(ud.config.MouseFunctions[i][1], i, 1, controldevice_mouse); } - memset(config.MouseDigitalFunctions, -1, sizeof(config.MouseDigitalFunctions)); + memset(ud.config.MouseDigitalFunctions, -1, sizeof(ud.config.MouseDigitalFunctions)); for (i=0; i= 0) + if (ud.config.scripthandle >= 0) { for (dummy = 0;dummy < 10;dummy++) { commmacro[13] = dummy+'0'; - SCRIPT_GetString(config.scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]); + SCRIPT_GetString(ud.config.scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]); } - SCRIPT_GetString(config.scripthandle, "Comm Setup","PlayerName",&tempbuf[0]); + SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","PlayerName",&tempbuf[0]); while (Bstrlen(stripcolorcodes(tempbuf)) > 10) tempbuf[Bstrlen(tempbuf)-1] = '\0'; @@ -575,102 +573,102 @@ int32 CONFIG_ReadSetup(void) Bstrncpy(myname,tempbuf,sizeof(myname)-1); myname[sizeof(myname)] = '\0'; - SCRIPT_GetString(config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]); + SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]); - SCRIPT_GetNumber(config.scripthandle, "Comm Setup", "Rate",(int32 *)&packetrate); + SCRIPT_GetNumber(ud.config.scripthandle, "Comm Setup", "Rate",(int32 *)&packetrate); packetrate = min(max(packetrate,50),1000); { extern char defaultduke3dgrp[BMAX_PATH]; if (!Bstrcmp(defaultduke3dgrp,"duke3d.grp")) - SCRIPT_GetString(config.scripthandle, "Misc","SelectedGRP",&duke3dgrp[0]); + SCRIPT_GetString(ud.config.scripthandle, "Misc","SelectedGRP",&duke3dgrp[0]); } - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "Shadows",&ud.shadows); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Shadows",&ud.shadows); if (!NAM) { - SCRIPT_GetString(config.scripthandle, "Screen Setup","Password",&ud.pwlockout[0]); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "Out",&ud.lockout); + SCRIPT_GetString(ud.config.scripthandle, "Screen Setup","Password",&ud.pwlockout[0]); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Out",&ud.lockout); } - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "Detail",&ud.detail); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "Tilt",&ud.screen_tilting); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "Messages",&ud.fta_on); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "ScreenWidth",&config.ScreenWidth); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "ScreenHeight",&config.ScreenHeight); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "ScreenMode",&config.ScreenMode); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "ScreenGamma",&ud.brightness); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "ScreenSize",&ud.screen_size); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Detail",&ud.detail); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Tilt",&ud.screen_tilting); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Messages",&ud.fta_on); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",&ud.config.ScreenWidth); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight",&ud.config.ScreenHeight); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode",&ud.config.ScreenMode); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenGamma",&ud.brightness); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenSize",&ud.screen_size); #if defined(POLYMOST) && defined(USE_OPENGL) - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "ScreenBPP", &config.ScreenBPP); - if (config.ScreenBPP < 8) config.ScreenBPP = 32; + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.config.ScreenBPP); + if (ud.config.ScreenBPP < 8) ud.config.ScreenBPP = 32; #endif #ifdef RENDERTYPEWIN - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "MaxRefreshFreq", (int32*)&maxrefreshfreq); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", (int32*)&maxrefreshfreq); #endif #if defined(POLYMOST) && defined(USE_OPENGL) - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "GLTextureMode", &gltexfiltermode); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "GLAnisotropy", &glanisotropy); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "GLProjectionFix", &glprojectionhacks); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "GLUseTextureCompr", &glusetexcompr); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "GLWidescreen", &glwidescreen); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLTextureMode", &gltexfiltermode); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLAnisotropy", &glanisotropy); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLProjectionFix", &glprojectionhacks); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLUseTextureCompr", &glusetexcompr); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLWidescreen", &glwidescreen); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "GLUseCompressedTextureCache", &glusetexcache); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "GLUseTextureCacheCompression", &glusetexcachecompression); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLUseCompressedTextureCache", &glusetexcache); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLUseTextureCacheCompression", &glusetexcachecompression); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "GLDepthPeeling", &r_depthpeeling); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "GLPeelsCount", &r_peelscount); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLDepthPeeling", &r_depthpeeling); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLPeelsCount", &r_peelscount); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "GLDetailMapping", &r_detailmapping); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "GLGlowMapping", &r_glowmapping); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "GLVertexArrays", &r_vertexarrays); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "GLVBOs", &r_vbos); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "GLVBOCount", &r_vbocount); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLDetailMapping", &r_detailmapping); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLGlowMapping", &r_glowmapping); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVertexArrays", &r_vertexarrays); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVBOs", &r_vbos); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVBOCount", &r_vbocount); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "GLAnimationSmoothing", &r_animsmoothing); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLAnimationSmoothing", &r_animsmoothing); dummy = usemodels; - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "UseModels",&dummy); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "UseModels",&dummy); usemodels = dummy != 0; dummy = usehightile; - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "UseHightile",&dummy); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "UseHightile",&dummy); usehightile = dummy != 0; #endif - SCRIPT_GetNumber(config.scripthandle, "Misc", "Executions",&ud.executions); - SCRIPT_GetNumber(config.scripthandle, "Setup", "ForceSetup",&config.ForceSetup); - SCRIPT_GetNumber(config.scripthandle, "Misc", "RunMode",&config.RunMode); - SCRIPT_GetNumber(config.scripthandle, "Misc", "Crosshairs",&ud.crosshair); - SCRIPT_GetNumber(config.scripthandle, "Misc", "StatusBarScale",&ud.statusbarscale); - SCRIPT_GetNumber(config.scripthandle, "Misc", "ShowLevelStats",&ud.levelstats); - SCRIPT_GetNumber(config.scripthandle, "Misc", "ShowOpponentWeapons",&config.ShowOpponentWeapons); - ud.showweapons = config.ShowOpponentWeapons; - SCRIPT_GetNumber(config.scripthandle, "Misc", "ShowViewWeapon",&ud.drawweapon); - SCRIPT_GetNumber(config.scripthandle, "Misc", "DeathMessages",&ud.deathmsgs); - SCRIPT_GetNumber(config.scripthandle, "Misc", "DemoCams",&ud.democams); - SCRIPT_GetNumber(config.scripthandle, "Misc", "ShowFPS",&ud.tickrate); - SCRIPT_GetNumber(config.scripthandle, "Misc", "Color",&ud.color); + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Executions",&ud.executions); + SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "ForceSetup",&ud.config.ForceSetup); + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "RunMode",&ud.config.RunMode); + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Crosshairs",&ud.crosshair); + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "StatusBarScale",&ud.statusbarscale); + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowLevelStats",&ud.levelstats); + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowOpponentWeapons",&ud.config.ShowOpponentWeapons); + ud.showweapons = ud.config.ShowOpponentWeapons; + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowViewWeapon",&ud.drawweapon); + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "DeathMessages",&ud.deathmsgs); + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "DemoCams",&ud.democams); + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowFPS",&ud.tickrate); + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Color",&ud.color); check_player_color((int *)&ud.color,-1); - ps[0].palookup = ud.pcolor[0] = ud.color; - SCRIPT_GetNumber(config.scripthandle, "Misc", "Team",&dummy); + g_player[0].ps.palookup = g_player[0].pcolor = ud.color; + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Team",&dummy); ud.team = 0; if (dummy < 4 && dummy > -1) ud.team = dummy; - ud.pteam[0] = ud.team; - SCRIPT_GetNumber(config.scripthandle, "Misc", "MPMessageDisplayTime",&ud.msgdisptime); - SCRIPT_GetNumber(config.scripthandle, "Misc", "StatusBarMode",&ud.statusbarmode); - SCRIPT_GetNumber(config.scripthandle, "Misc", "AutoVote",&ud.autovote); - SCRIPT_GetNumber(config.scripthandle, "Misc", "AutoMsg",&ud.automsg); - SCRIPT_GetNumber(config.scripthandle, "Misc", "IDPlayers",&ud.automsg); - SCRIPT_GetNumber(config.scripthandle, "Misc", "ViewBobbing",&ud.viewbob); - SCRIPT_GetNumber(config.scripthandle, "Misc", "WeaponSway",&ud.weaponsway); + g_player[0].pteam = ud.team; + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "MPMessageDisplayTime",&ud.msgdisptime); + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "StatusBarMode",&ud.statusbarmode); + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AutoVote",&ud.autovote); + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AutoMsg",&ud.automsg); + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "IDPlayers",&ud.automsg); + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ViewBobbing",&ud.viewbob); + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "WeaponSway",&ud.weaponsway); - dummy = config.useprecache; - SCRIPT_GetNumber(config.scripthandle, "Misc", "UsePrecache",&dummy); - config.useprecache = dummy != 0; + dummy = ud.config.useprecache; + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "UsePrecache",&dummy); + ud.config.useprecache = dummy != 0; - SCRIPT_GetNumber(config.scripthandle, "Misc","AngleInterpolation",&ud.angleinterpolation); + SCRIPT_GetNumber(ud.config.scripthandle, "Misc","AngleInterpolation",&ud.angleinterpolation); // weapon choices are defaulted in checkcommandline, which may override them if (!CommandWeaponChoice) @@ -678,55 +676,55 @@ int32 CONFIG_ReadSetup(void) { Bsprintf(buf,"WeaponChoice%ld",i); dummy = -1; - SCRIPT_GetNumber(config.scripthandle, "Misc", buf, &dummy); - if (dummy >= 0) ud.wchoice[0][i] = dummy; + SCRIPT_GetNumber(ud.config.scripthandle, "Misc", buf, &dummy); + if (dummy >= 0) g_player[0].wchoice[i] = dummy; } - SCRIPT_GetNumber(config.scripthandle, "Sound Setup", "FXDevice",&config.FXDevice); - SCRIPT_GetNumber(config.scripthandle, "Sound Setup", "MusicDevice",&config.MusicDevice); - SCRIPT_GetNumber(config.scripthandle, "Sound Setup", "FXVolume",&config.FXVolume); - SCRIPT_GetNumber(config.scripthandle, "Sound Setup", "MusicVolume",&config.MusicVolume); - SCRIPT_GetNumber(config.scripthandle, "Sound Setup", "SoundToggle",&config.SoundToggle); - SCRIPT_GetNumber(config.scripthandle, "Sound Setup", "MusicToggle",&config.MusicToggle); - SCRIPT_GetNumber(config.scripthandle, "Sound Setup", "VoiceToggle",&config.VoiceToggle); - SCRIPT_GetNumber(config.scripthandle, "Sound Setup", "AmbienceToggle",&config.AmbienceToggle); - SCRIPT_GetNumber(config.scripthandle, "Sound Setup", "NumVoices",&config.NumVoices); - SCRIPT_GetNumber(config.scripthandle, "Sound Setup", "NumChannels",&config.NumChannels); - SCRIPT_GetNumber(config.scripthandle, "Sound Setup", "NumBits",&config.NumBits); - SCRIPT_GetNumber(config.scripthandle, "Sound Setup", "MixRate",&config.MixRate); - SCRIPT_GetNumber(config.scripthandle, "Sound Setup", "ReverseStereo",&config.ReverseStereo); + SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "FXDevice",&ud.config.FXDevice); + SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MusicDevice",&ud.config.MusicDevice); + SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "FXVolume",&ud.config.FXVolume); + SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MusicVolume",&ud.config.MusicVolume); + SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "SoundToggle",&ud.config.SoundToggle); + SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MusicToggle",&ud.config.MusicToggle); + SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "VoiceToggle",&ud.config.VoiceToggle); + SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "AmbienceToggle",&ud.config.AmbienceToggle); + SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "NumVoices",&ud.config.NumVoices); + SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "NumChannels",&ud.config.NumChannels); + SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "NumBits",&ud.config.NumBits); + SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MixRate",&ud.config.MixRate); + SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "ReverseStereo",&ud.config.ReverseStereo); - SCRIPT_GetNumber(config.scripthandle, "Controls","MouseAimingFlipped",&ud.mouseflip); // mouse aiming inverted - SCRIPT_GetNumber(config.scripthandle, "Controls","MouseAiming",&ud.mouseaiming); // 1=momentary/0=toggle - ps[0].aim_mode = ud.mouseaiming; - SCRIPT_GetNumber(config.scripthandle, "Controls","MouseBias",&config.MouseBias); - SCRIPT_GetNumber(config.scripthandle, "Controls","MouseFilter",&config.MouseFilter); - SCRIPT_GetNumber(config.scripthandle, "Controls","SmoothInput",&config.SmoothInput); - SCRIPT_GetNumber(config.scripthandle, "Controls","UseJoystick",&config.UseJoystick); - SCRIPT_GetNumber(config.scripthandle, "Controls","UseMouse",&config.UseMouse); - SCRIPT_GetNumber(config.scripthandle, "Controls","AimingFlag",(int32 *)&myaimmode); // (if toggle mode) gives state - SCRIPT_GetNumber(config.scripthandle, "Controls","RunKeyBehaviour",&ud.runkey_mode); // JBF 20031125 - SCRIPT_GetNumber(config.scripthandle, "Controls","AutoAim",&config.AutoAim); // JBF 20031125 - ps[0].auto_aim = config.AutoAim; - SCRIPT_GetNumber(config.scripthandle, "Controls","WeaponSwitchMode",&ud.weaponswitch); - ps[0].weaponswitch = ud.weaponswitch; + SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseAimingFlipped",&ud.mouseflip); // mouse aiming inverted + SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseAiming",&ud.mouseaiming); // 1=momentary/0=toggle + g_player[0].ps.aim_mode = ud.mouseaiming; + SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseBias",&ud.config.MouseBias); + SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseFilter",&ud.config.MouseFilter); + SCRIPT_GetNumber(ud.config.scripthandle, "Controls","SmoothInput",&ud.config.SmoothInput); + SCRIPT_GetNumber(ud.config.scripthandle, "Controls","UseJoystick",&ud.config.UseJoystick); + SCRIPT_GetNumber(ud.config.scripthandle, "Controls","UseMouse",&ud.config.UseMouse); + SCRIPT_GetNumber(ud.config.scripthandle, "Controls","AimingFlag",(int32 *)&myaimmode); // (if toggle mode) gives state + SCRIPT_GetNumber(ud.config.scripthandle, "Controls","RunKeyBehaviour",&ud.runkey_mode); // JBF 20031125 + SCRIPT_GetNumber(ud.config.scripthandle, "Controls","AutoAim",&ud.config.AutoAim); // JBF 20031125 + g_player[0].ps.auto_aim = ud.config.AutoAim; + SCRIPT_GetNumber(ud.config.scripthandle, "Controls","WeaponSwitchMode",&ud.weaponswitch); + g_player[0].ps.weaponswitch = ud.weaponswitch; #ifdef _WIN32 - SCRIPT_GetNumber(config.scripthandle, "Updates", "CheckForUpdates", &config.CheckForUpdates); - SCRIPT_GetNumber(config.scripthandle, "Updates", "LastUpdateCheck", &config.LastUpdateCheck); - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "WindowPositioning", (int32 *)&windowpos); + SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", &ud.config.CheckForUpdates); + SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", &ud.config.LastUpdateCheck); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", (int32 *)&windowpos); windowx = -1; - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "WindowPosX", (int32 *)&windowx); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", (int32 *)&windowx); windowy = -1; - SCRIPT_GetNumber(config.scripthandle, "Screen Setup", "WindowPosY", (int32 *)&windowy); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", (int32 *)&windowy); #endif } CONFIG_ReadKeys(); - //CONFIG_SetupMouse(config.scripthandle); - //CONFIG_SetupJoystick(config.scripthandle); - config.setupread = 1; + //CONFIG_SetupMouse(ud.config.scripthandle); + //CONFIG_SetupJoystick(ud.config.scripthandle); + ud.config.setupread = 1; return 0; } @@ -742,199 +740,199 @@ void CONFIG_WriteSetup(void) { int32 dummy; - if (!config.setupread) return; + if (!ud.config.setupread) return; - if (config.scripthandle < 0) - config.scripthandle = SCRIPT_Init(setupfilename); + if (ud.config.scripthandle < 0) + ud.config.scripthandle = SCRIPT_Init(setupfilename); - SCRIPT_PutNumber(config.scripthandle, "Controls","AimingFlag",(long) myaimmode,false,false); - SCRIPT_PutNumber(config.scripthandle, "Controls","AutoAim",config.AutoAim,false,false); - SCRIPT_PutNumber(config.scripthandle, "Controls","MouseAimingFlipped",ud.mouseflip,false,false); - SCRIPT_PutNumber(config.scripthandle, "Controls","MouseAiming",ud.mouseaiming,false,false); - SCRIPT_PutNumber(config.scripthandle, "Controls","MouseBias",config.MouseBias,false,false); - SCRIPT_PutNumber(config.scripthandle, "Controls","MouseFilter",config.MouseFilter,false,false); - SCRIPT_PutNumber(config.scripthandle, "Controls","SmoothInput",config.SmoothInput,false,false); - SCRIPT_PutNumber(config.scripthandle, "Controls","RunKeyBehaviour",ud.runkey_mode,false,false); - SCRIPT_PutNumber(config.scripthandle, "Controls","UseJoystick",config.UseJoystick,false,false); - SCRIPT_PutNumber(config.scripthandle, "Controls","UseMouse",config.UseMouse,false,false); - SCRIPT_PutNumber(config.scripthandle, "Controls","WeaponSwitchMode",ud.weaponswitch,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Controls","AimingFlag",(long) myaimmode,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Controls","AutoAim",ud.config.AutoAim,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseAimingFlipped",ud.mouseflip,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseAiming",ud.mouseaiming,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseBias",ud.config.MouseBias,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseFilter",ud.config.MouseFilter,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Controls","SmoothInput",ud.config.SmoothInput,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Controls","RunKeyBehaviour",ud.runkey_mode,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Controls","UseJoystick",ud.config.UseJoystick,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Controls","UseMouse",ud.config.UseMouse,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Controls","WeaponSwitchMode",ud.weaponswitch,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "AutoMsg",ud.automsg,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "AutoVote",ud.autovote,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "Color",ud.color,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "Crosshairs",ud.crosshair,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "DeathMessages",ud.deathmsgs,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "DemoCams",ud.democams,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AutoMsg",ud.automsg,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AutoVote",ud.autovote,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Color",ud.color,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Crosshairs",ud.crosshair,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "DeathMessages",ud.deathmsgs,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "DemoCams",ud.democams,false,false); ud.executions++; - SCRIPT_PutNumber(config.scripthandle, "Misc", "Executions",ud.executions,false,false); - SCRIPT_PutNumber(config.scripthandle, "Setup", "ForceSetup",config.ForceSetup,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "IDPlayers",ud.idplayers,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "MPMessageDisplayTime",ud.msgdisptime,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "RunMode",config.RunMode,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "ShowFPS",ud.tickrate,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "ShowLevelStats",ud.levelstats,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "ShowOpponentWeapons",config.ShowOpponentWeapons,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "ShowViewWeapon",ud.drawweapon,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "StatusBarMode",ud.statusbarmode,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "StatusBarScale",ud.statusbarscale,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "Team",ud.team,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "UsePrecache",config.useprecache,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "ViewBobbing",ud.viewbob,false,false); - SCRIPT_PutNumber(config.scripthandle, "Misc", "WeaponSway",ud.weaponsway,false,false); -// SCRIPT_PutNumber(config.scripthandle, "Misc", "AngleInterpolation",ud.angleinterpolation,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Executions",ud.executions,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "ForceSetup",ud.config.ForceSetup,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "IDPlayers",ud.idplayers,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "MPMessageDisplayTime",ud.msgdisptime,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "RunMode",ud.config.RunMode,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ShowFPS",ud.tickrate,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ShowLevelStats",ud.levelstats,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ShowOpponentWeapons",ud.config.ShowOpponentWeapons,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ShowViewWeapon",ud.drawweapon,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "StatusBarMode",ud.statusbarmode,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "StatusBarScale",ud.statusbarscale,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Team",ud.team,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "UsePrecache",ud.config.useprecache,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ViewBobbing",ud.viewbob,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "WeaponSway",ud.weaponsway,false,false); +// SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AngleInterpolation",ud.angleinterpolation,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "Detail",ud.detail,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Detail",ud.detail,false,false); #if defined(POLYMOST) && defined(USE_OPENGL) - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "GLAnisotropy",glanisotropy,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "GLProjectionFix",glprojectionhacks,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "GLTextureMode",gltexfiltermode,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "GLUseCompressedTextureCache", glusetexcache,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "GLUseTextureCacheCompression", glusetexcachecompression,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "GLUseTextureCompr",glusetexcompr,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "GLWidescreen",glwidescreen,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLAnisotropy",glanisotropy,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLProjectionFix",glprojectionhacks,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLTextureMode",gltexfiltermode,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLUseCompressedTextureCache", glusetexcache,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLUseTextureCacheCompression", glusetexcachecompression,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLUseTextureCompr",glusetexcompr,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLWidescreen",glwidescreen,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "GLDepthPeeling",r_depthpeeling,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "GLPeelsCount",r_peelscount,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLDepthPeeling",r_depthpeeling,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLPeelsCount",r_peelscount,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "GLDetailMapping", r_detailmapping,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "GLGlowMapping", r_glowmapping,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "GLVertexArrays", r_vertexarrays,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "GLVBOs", r_vbos,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "GLVBOCount", r_vbocount,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLDetailMapping", r_detailmapping,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLGlowMapping", r_glowmapping,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVertexArrays", r_vertexarrays,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVBOs", r_vbos,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVBOCount", r_vbocount,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "GLAnimationSmoothing",r_animsmoothing,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLAnimationSmoothing",r_animsmoothing,false,false); #endif #ifdef RENDERTYPEWIN - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "MaxRefreshFreq",maxrefreshfreq,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq",maxrefreshfreq,false,false); #endif - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "Messages",ud.fta_on,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Messages",ud.fta_on,false,false); if (!NAM) { - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "Out",ud.lockout,false,false); - SCRIPT_PutString(config.scripthandle, "Screen Setup", "Password",ud.pwlockout); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Out",ud.lockout,false,false); + SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "Password",ud.pwlockout); } - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "ScreenBPP",config.ScreenBPP,false,false); // JBF 20040523 - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "ScreenGamma",ud.brightness,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "ScreenHeight",config.ScreenHeight,false,false); // JBF 20031206 - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "ScreenMode",config.ScreenMode,false,false); // JBF 20031206 - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "ScreenSize",ud.screen_size,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "ScreenWidth",config.ScreenWidth,false,false); // JBF 20031206 - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "Shadows",ud.shadows,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "Tilt",ud.screen_tilting,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP",ud.config.ScreenBPP,false,false); // JBF 20040523 + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenGamma",ud.brightness,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight",ud.config.ScreenHeight,false,false); // JBF 20031206 + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode",ud.config.ScreenMode,false,false); // JBF 20031206 + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenSize",ud.screen_size,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",ud.config.ScreenWidth,false,false); // JBF 20031206 + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Shadows",ud.shadows,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Tilt",ud.screen_tilting,false,false); #if defined(POLYMOST) && defined(USE_OPENGL) - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "UseHightile",usehightile,false,false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "UseModels",usemodels,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "UseHightile",usehightile,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "UseModels",usemodels,false,false); #endif - SCRIPT_PutNumber(config.scripthandle, "Sound Setup", "AmbienceToggle",config.AmbienceToggle,false,false); - SCRIPT_PutNumber(config.scripthandle, "Sound Setup", "FXVolume",config.FXVolume,false,false); - SCRIPT_PutNumber(config.scripthandle, "Sound Setup", "MusicToggle",config.MusicToggle,false,false); - SCRIPT_PutNumber(config.scripthandle, "Sound Setup", "MusicVolume",config.MusicVolume,false,false); - SCRIPT_PutNumber(config.scripthandle, "Sound Setup", "NumVoices",config.NumVoices,false,false); - SCRIPT_PutNumber(config.scripthandle, "Sound Setup", "NumChannels",config.NumChannels,false,false); - SCRIPT_PutNumber(config.scripthandle, "Sound Setup", "NumBits",config.NumBits,false,false); - SCRIPT_PutNumber(config.scripthandle, "Sound Setup", "MixRate",config.MixRate,false,false); - SCRIPT_PutNumber(config.scripthandle, "Sound Setup", "ReverseStereo",config.ReverseStereo,false,false); - SCRIPT_PutNumber(config.scripthandle, "Sound Setup", "SoundToggle",config.SoundToggle,false,false); - SCRIPT_PutNumber(config.scripthandle, "Sound Setup", "VoiceToggle",config.VoiceToggle,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "AmbienceToggle",ud.config.AmbienceToggle,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "FXVolume",ud.config.FXVolume,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "MusicToggle",ud.config.MusicToggle,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "MusicVolume",ud.config.MusicVolume,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "NumVoices",ud.config.NumVoices,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "NumChannels",ud.config.NumChannels,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "NumBits",ud.config.NumBits,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "MixRate",ud.config.MixRate,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "ReverseStereo",ud.config.ReverseStereo,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "SoundToggle",ud.config.SoundToggle,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "VoiceToggle",ud.config.VoiceToggle,false,false); #ifdef _WIN32 - SCRIPT_PutNumber(config.scripthandle, "Updates", "CheckForUpdates", config.CheckForUpdates, false, false); - SCRIPT_PutNumber(config.scripthandle, "Updates", "LastUpdateCheck", config.LastUpdateCheck, false, false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "WindowPositioning", windowpos, false, false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "WindowPosX", windowx, false, false); - SCRIPT_PutNumber(config.scripthandle, "Screen Setup", "WindowPosY", windowy, false, false); + SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", ud.config.CheckForUpdates, false, false); + SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, false, false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", windowpos, false, false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", windowx, false, false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", windowy, false, false); #endif // JBF 20031211 for (dummy=0;dummy= (MAXMOUSEBUTTONS-2)) continue; Bsprintf(buf,"MouseButtonClicked%ld",dummy); - SCRIPT_PutString(config.scripthandle,"Controls", buf, CONFIG_FunctionNumToName(config.MouseFunctions[dummy][1])); + SCRIPT_PutString(ud.config.scripthandle,"Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][1])); } for (dummy=0;dummypalette = pal; @@ -266,7 +266,7 @@ void setgamepalette(struct player_struct *player, char *pal, int set) player->palette = pal; } -#define TEXTWRAPLEN (scale(35,config.ScreenWidth,320)) +#define TEXTWRAPLEN (scale(35,ud.config.ScreenWidth,320)) const char *stripcolorcodes(const char *t) { @@ -363,7 +363,7 @@ int gametext_(int small, int starttile, int x,int y,const char *t,int s,int p,in if (ac < starttile || ac > (starttile + 93)) break; - rotatesprite(x<<16,(y<<16)+(small?config.ScreenHeight<<15:0),65536,0,ac,s,p,small?(8|16):(2|orientation),x1,y1,x2,y2); + rotatesprite(x<<16,(y<<16)+(small?ud.config.ScreenHeight<<15:0),65536,0,ac,s,p,small?(8|16):(2|orientation),x1,y1,x2,y2); if ((*t >= '0' && *t <= '9')) x += 8; else x += tilesizx[ac];//(tilesizx[ac]>>small); @@ -494,13 +494,13 @@ void getpackets(void) if (ALT_IS_PRESSED && KB_KeyPressed(sc_Enter)) { - if (setgamemode(!config.ScreenMode,config.ScreenWidth,config.ScreenHeight,config.ScreenBPP)) + if (setgamemode(!ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP)) { OSD_Printf("Failed setting fullscreen video mode.\n"); - if (setgamemode(config.ScreenMode, config.ScreenWidth, config.ScreenHeight, config.ScreenBPP)) + if (setgamemode(ud.config.ScreenMode, ud.config.ScreenWidth, ud.config.ScreenHeight, ud.config.ScreenBPP)) gameexit("Failed to recover from failure to set fullscreen video mode.\n"); } - else config.ScreenMode = !config.ScreenMode; + else ud.config.ScreenMode = !ud.config.ScreenMode; KB_ClearKeyDown(sc_Enter); restorepalette = 1; vscrn(); @@ -510,11 +510,11 @@ void getpackets(void) { KB_ClearKeyDown(sc_F12); screencapture("duke0000.tga",0); - FTA(103,&ps[myconnectindex]); + FTA(103,&g_player[myconnectindex].ps); } // only dispatch commands here when not in a game - if (!(ps[myconnectindex].gm&MODE_GAME)) + if (!(g_player[myconnectindex].ps.gm&MODE_GAME)) { OSD_DispatchQueued(); } @@ -537,24 +537,24 @@ void getpackets(void) case 0: //[0] (receive master sync buffer) j = 1; - if ((movefifoend[other]&(TIMERUPDATESIZ-1)) == 0) + if ((g_player[other].movefifoend&(TIMERUPDATESIZ-1)) == 0) for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) { - if (playerquitflag[i] == 0) continue; + if (g_player[i].playerquitflag == 0) continue; if (i == myconnectindex) otherminlag = (long)((signed char)packbuf[j]); j++; } - osyn = (input *)&inputfifo[(movefifoend[connecthead]-1)&(MOVEFIFOSIZ-1)][0]; - nsyn = (input *)&inputfifo[(movefifoend[connecthead])&(MOVEFIFOSIZ-1)][0]; + osyn = (input *)&inputfifo[(g_player[connecthead].movefifoend-1)&(MOVEFIFOSIZ-1)][0]; + nsyn = (input *)&inputfifo[(g_player[connecthead].movefifoend)&(MOVEFIFOSIZ-1)][0]; k = j; for (i=connecthead;i>=0;i=connectpoint2[i]) - j += playerquitflag[i]+playerquitflag[i]; + j += g_player[i].playerquitflag+g_player[i].playerquitflag; for (i=connecthead;i>=0;i=connectpoint2[i]) { - if (playerquitflag[i] == 0) continue; + if (g_player[i].playerquitflag == 0) continue; l = packbuf[k++]; l += (long)(packbuf[k++]<<8); @@ -579,8 +579,8 @@ void getpackets(void) if (l&1024) nsyn[i].extbits = ((nsyn[i].extbits&0xff00ffff)|((long)packbuf[j++])<<16); if (l&2048) nsyn[i].extbits = ((nsyn[i].extbits&0x00ffffff)|((long)packbuf[j++])<<24); - if (nsyn[i].bits&(1<<26)) playerquitflag[i] = 0; - movefifoend[i]++; + if (nsyn[i].bits&(1<<26)) g_player[i].playerquitflag = 0; + g_player[i].movefifoend++; } while (j != packbufleng) @@ -588,8 +588,8 @@ void getpackets(void) for (i=connecthead;i>=0;i=connectpoint2[i]) if (i != myconnectindex) { - syncval[i][syncvalhead[i]&(MOVEFIFOSIZ-1)] = packbuf[j]; - syncvalhead[i]++; + g_player[i].syncval[g_player[i].syncvalhead&(MOVEFIFOSIZ-1)] = packbuf[j]; + g_player[i].syncvalhead++; } j++; } @@ -598,8 +598,8 @@ void getpackets(void) if (i != myconnectindex) for (j=1;j=0;i=connectpoint2[i]) { @@ -656,8 +656,8 @@ void getpackets(void) j++; } - osyn = (input *)&inputfifo[(movefifoend[other]-1)&(MOVEFIFOSIZ-1)][0]; - nsyn = (input *)&inputfifo[(movefifoend[other])&(MOVEFIFOSIZ-1)][0]; + osyn = (input *)&inputfifo[(g_player[other].movefifoend-1)&(MOVEFIFOSIZ-1)][0]; + nsyn = (input *)&inputfifo[(g_player[other].movefifoend)&(MOVEFIFOSIZ-1)][0]; copybufbyte(&osyn[other],&nsyn[other],sizeof(input)); k = packbuf[j++]; @@ -675,12 +675,12 @@ void getpackets(void) if (k&512) nsyn[other].extbits = ((nsyn[other].extbits&0xffff00ff)|((long)packbuf[j++])<<8); if (k&1024) nsyn[other].extbits = ((nsyn[other].extbits&0xff00ffff)|((long)packbuf[j++])<<16); if (k&2048) nsyn[other].extbits = ((nsyn[other].extbits&0x00ffffff)|((long)packbuf[j++])<<24); - movefifoend[other]++; + g_player[other].movefifoend++; for (i=1;i packbufleng) @@ -688,8 +688,8 @@ void getpackets(void) while (j < packbufleng) { - syncval[other][syncvalhead[other]&(MOVEFIFOSIZ-1)] = packbuf[j++]; - syncvalhead[other]++; + g_player[other].syncval[g_player[other].syncvalhead&(MOVEFIFOSIZ-1)] = packbuf[j++]; + g_player[other].syncvalhead++; } break; @@ -697,9 +697,9 @@ void getpackets(void) break; case 250: - if (playerreadyflag[other] == 0) + if (g_player[other].playerreadyflag == 0) initprintf("Player %ld is ready\n", other); - playerreadyflag[other]++; + g_player[other].playerreadyflag++; break; case 255: gameexit(" "); @@ -784,20 +784,20 @@ void getpackets(void) other = packbuf[1]; for (i=3;packbuf[i];i++) - ud.user_name[other][i-3] = packbuf[i]; - ud.user_name[other][i-3] = 0; + g_player[other].user_name[i-3] = packbuf[i]; + g_player[other].user_name[i-3] = 0; i++; - ps[other].aim_mode = packbuf[i++]; - ps[other].auto_aim = packbuf[i++]; - ps[other].weaponswitch = packbuf[i++]; - ps[other].palookup = ud.pcolor[other] = packbuf[i++]; - ud.pteam[other] = packbuf[i++]; + g_player[other].ps.aim_mode = packbuf[i++]; + g_player[other].ps.auto_aim = packbuf[i++]; + g_player[other].ps.weaponswitch = packbuf[i++]; + g_player[other].ps.palookup = g_player[other].pcolor = packbuf[i++]; + g_player[other].pteam = packbuf[i++]; - /* if(ps[other].team != j && sprite[ps[other].i].picnum == APLAYER) + /* if(g_player[other].ps.team != j && sprite[g_player[other].ps.i].picnum == APLAYER) { - hittype[ps[other].i].extra = 1000; - hittype[ps[other].i].picnum = APLAYERTOP; + hittype[g_player[other].ps.i].extra = 1000; + hittype[g_player[other].ps.i].picnum = APLAYERTOP; } */ break; @@ -813,7 +813,7 @@ void getpackets(void) i = 2; j = i; //This used to be Duke packet #9... now concatenated with Duke packet #6 - for (;i-j<10;i++) ud.wchoice[other][i-j] = packbuf[i]; + for (;i-j<10;i++) g_player[other].wchoice[i-j] = packbuf[i]; break; case 7: @@ -825,7 +825,7 @@ void getpackets(void) if (numlumps == 0) break; - if (config.SoundToggle == 0 || ud.lockout == 1 || config.FXDevice < 0) + if (ud.config.SoundToggle == 0 || ud.lockout == 1 || ud.config.FXDevice < 0) break; rtsptr = (char *)RTS_GetSound(packbuf[1]-1); if (*rtsptr == 'C') @@ -851,7 +851,7 @@ void getpackets(void) j = -1; for(i=connecthead;i>=0;i=connectpoint2[i]) { - if (playerquitflag[i]) { j = i; continue; } + if (g_player[i].playerquitflag) { j = i; continue; } if (i == connecthead) connecthead = connectpoint2[connecthead]; else connectpoint2[j] = connectpoint2[i]; @@ -859,7 +859,7 @@ void getpackets(void) numplayers--; ud.multimode--; - Bsprintf(buf,"%s is history!",ud.user_name[i]); + Bsprintf(buf,"%s is history!",g_player[i].user_name); adduserquote(buf); if (numplayers < 2) @@ -916,7 +916,7 @@ void getpackets(void) { gotvote[(unsigned char)packbuf[2]] = 1; votes[(unsigned char)packbuf[2]] = packbuf[3]; - Bsprintf(tempbuf,"GOT VOTE FROM %s",ud.user_name[(unsigned char)packbuf[2]]); + Bsprintf(tempbuf,"GOT VOTE FROM %s",g_player[(unsigned char)packbuf[2]].user_name); adduserquote(tempbuf); } break; @@ -925,7 +925,7 @@ void getpackets(void) voting = packbuf[2]; vote_episode = packbuf[3]; vote_map = packbuf[4]; - Bsprintf(tempbuf,"%s^00 HAS CALLED A VOTE TO CHANGE MAP TO %s (E%dL%d)",ud.user_name[(unsigned char)packbuf[2]],map[(unsigned char)(packbuf[3]*MAXLEVELS + packbuf[4])].name,packbuf[3]+1,packbuf[4]+1); + Bsprintf(tempbuf,"%s^00 HAS CALLED A VOTE TO CHANGE MAP TO %s (E%dL%d)",g_player[(unsigned char)packbuf[2]].user_name,map[(unsigned char)(packbuf[3]*MAXLEVELS + packbuf[4])].name,packbuf[3]+1,packbuf[4]+1); adduserquote(tempbuf); Bsprintf(tempbuf,"PRESS F1 TO VOTE YES, F2 TO VOTE NO"); adduserquote(tempbuf); @@ -943,7 +943,7 @@ void getpackets(void) i += gotvote[j]; if (i != numplayers) - Bsprintf(tempbuf,"%s^00 HAS CANCELED THE VOTE",ud.user_name[(unsigned char)packbuf[2]]); + Bsprintf(tempbuf,"%s^00 HAS CANCELED THE VOTE",g_player[(unsigned char)packbuf[2]].user_name); else Bsprintf(tempbuf,"VOTE FAILED"); Bmemset(votes,0,sizeof(votes)); Bmemset(gotvote,0,sizeof(gotvote)); @@ -995,7 +995,7 @@ void faketimerhandler(void) for (i=connecthead;i>=0;i=connectpoint2[i]) if (i != myconnectindex) - if (movefifoend[i] < movefifoend[myconnectindex]-200) return; + if (g_player[i].movefifoend < g_player[myconnectindex].movefifoend-200) return; getinput(myconnectindex); @@ -1005,14 +1005,14 @@ void faketimerhandler(void) avghorz += loc.horz; avgbits |= loc.bits; avgextbits |= loc.extbits; - if (movefifoend[myconnectindex]&(movesperpacket-1)) + if (g_player[myconnectindex].movefifoend&(movesperpacket-1)) { - copybufbyte(&inputfifo[(movefifoend[myconnectindex]-1)&(MOVEFIFOSIZ-1)][myconnectindex], - &inputfifo[movefifoend[myconnectindex]&(MOVEFIFOSIZ-1)][myconnectindex],sizeof(input)); - movefifoend[myconnectindex]++; + copybufbyte(&inputfifo[(g_player[myconnectindex].movefifoend-1)&(MOVEFIFOSIZ-1)][myconnectindex], + &inputfifo[g_player[myconnectindex].movefifoend&(MOVEFIFOSIZ-1)][myconnectindex],sizeof(input)); + g_player[myconnectindex].movefifoend++; return; } - nsyn = &inputfifo[movefifoend[myconnectindex]&(MOVEFIFOSIZ-1)][myconnectindex]; + nsyn = &inputfifo[g_player[myconnectindex].movefifoend&(MOVEFIFOSIZ-1)][myconnectindex]; nsyn[0].fvel = avgfvel/movesperpacket; nsyn[0].svel = avgsvel/movesperpacket; nsyn[0].avel = avgavel/movesperpacket; @@ -1020,19 +1020,19 @@ void faketimerhandler(void) nsyn[0].bits = avgbits; nsyn[0].extbits = avgextbits; avgfvel = avgsvel = avgavel = avghorz = avgbits = avgextbits = 0; - movefifoend[myconnectindex]++; + g_player[myconnectindex].movefifoend++; if (numplayers < 2) { if (ud.multimode > 1) for (i=connecthead;i>=0;i=connectpoint2[i]) if (i != myconnectindex) { - //clearbufbyte(&inputfifo[movefifoend[i]&(MOVEFIFOSIZ-1)][i],sizeof(input),0L); + //clearbufbyte(&inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i],sizeof(input),0L); if (ud.playerai) - computergetinput(i,&inputfifo[movefifoend[i]&(MOVEFIFOSIZ-1)][i]); - inputfifo[movefifoend[i]&(MOVEFIFOSIZ-1)][i].svel++; - inputfifo[movefifoend[i]&(MOVEFIFOSIZ-1)][i].fvel++; - movefifoend[i]++; + computergetinput(i,&inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i]); + inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i].svel++; + inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i].fvel++; + g_player[i].movefifoend++; } return; } @@ -1040,12 +1040,12 @@ void faketimerhandler(void) for (i=connecthead;i>=0;i=connectpoint2[i]) if (i != myconnectindex) { - k = (movefifoend[myconnectindex]-1)-movefifoend[i]; - myminlag[i] = min(myminlag[i],k); + k = (g_player[myconnectindex].movefifoend-1)-g_player[i].movefifoend; + g_player[i].myminlag = min(g_player[i].myminlag,k); mymaxlag = max(mymaxlag,k); } - if (((movefifoend[myconnectindex]-1)&(TIMERUPDATESIZ-1)) == 0) + if (((g_player[myconnectindex].movefifoend-1)&(TIMERUPDATESIZ-1)) == 0) { i = mymaxlag-bufferjitter; mymaxlag = 0; @@ -1056,34 +1056,34 @@ void faketimerhandler(void) if (networkmode == 1) { packbuf[0] = 17; - if ((movefifoend[myconnectindex]-1) == 0) packbuf[0] = 16; + if ((g_player[myconnectindex].movefifoend-1) == 0) packbuf[0] = 16; j = 1; //Fix timers and buffer/jitter value - if (((movefifoend[myconnectindex]-1)&(TIMERUPDATESIZ-1)) == 0) + if (((g_player[myconnectindex].movefifoend-1)&(TIMERUPDATESIZ-1)) == 0) { if (myconnectindex != connecthead) { - i = myminlag[connecthead]-otherminlag; + i = g_player[connecthead].myminlag-otherminlag; if (klabs(i) > 8) i >>= 1; else if (klabs(i) > 2) i = ksgn(i); else i = 0; totalclock -= TICSPERFRAME*i; - myminlag[connecthead] -= i; + g_player[connecthead].myminlag -= i; otherminlag += i; } if (myconnectindex == connecthead) for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) - packbuf[j++] = min(max(myminlag[i],-128),127); + packbuf[j++] = min(max(g_player[i].myminlag,-128),127); for (i=connecthead;i>=0;i=connectpoint2[i]) - myminlag[i] = 0x7fffffff; + g_player[i].myminlag = 0x7fffffff; } - osyn = (input *)&inputfifo[(movefifoend[myconnectindex]-2)&(MOVEFIFOSIZ-1)][myconnectindex]; - nsyn = (input *)&inputfifo[(movefifoend[myconnectindex]-1)&(MOVEFIFOSIZ-1)][myconnectindex]; + osyn = (input *)&inputfifo[(g_player[myconnectindex].movefifoend-2)&(MOVEFIFOSIZ-1)][myconnectindex]; + nsyn = (input *)&inputfifo[(g_player[myconnectindex].movefifoend-1)&(MOVEFIFOSIZ-1)][myconnectindex]; k = j; packbuf[j++] = 0; @@ -1122,9 +1122,9 @@ void faketimerhandler(void) if ((nsyn[0].extbits^osyn[0].extbits)&0x00ff0000) packbuf[j++] = ((nsyn[0].extbits>>16)&255), packbuf[k] |= 4; if ((nsyn[0].extbits^osyn[0].extbits)&0xff000000) packbuf[j++] = ((nsyn[0].extbits>>24)&255), packbuf[k] |= 8; - while (syncvalhead[myconnectindex] != syncvaltail) + while (g_player[myconnectindex].syncvalhead != syncvaltail) { - packbuf[j++] = syncval[myconnectindex][syncvaltail&(MOVEFIFOSIZ-1)]; + packbuf[j++] = g_player[myconnectindex].syncval[syncvaltail&(MOVEFIFOSIZ-1)]; syncvaltail++; } @@ -1137,19 +1137,19 @@ void faketimerhandler(void) if (myconnectindex != connecthead) //Slave { //Fix timers and buffer/jitter value - if (((movefifoend[myconnectindex]-1)&(TIMERUPDATESIZ-1)) == 0) + if (((g_player[myconnectindex].movefifoend-1)&(TIMERUPDATESIZ-1)) == 0) { - i = myminlag[connecthead]-otherminlag; + i = g_player[connecthead].myminlag-otherminlag; if (klabs(i) > 8) i >>= 1; else if (klabs(i) > 2) i = ksgn(i); else i = 0; totalclock -= TICSPERFRAME*i; - myminlag[connecthead] -= i; + g_player[connecthead].myminlag -= i; otherminlag += i; for (i=connecthead;i>=0;i=connectpoint2[i]) - myminlag[i] = 0x7fffffff; + g_player[i].myminlag = 0x7fffffff; } packbuf[0] = 1; @@ -1157,8 +1157,8 @@ void faketimerhandler(void) packbuf[2] = 0; j = 3; - osyn = (input *)&inputfifo[(movefifoend[myconnectindex]-2)&(MOVEFIFOSIZ-1)][myconnectindex]; - nsyn = (input *)&inputfifo[(movefifoend[myconnectindex]-1)&(MOVEFIFOSIZ-1)][myconnectindex]; + osyn = (input *)&inputfifo[(g_player[myconnectindex].movefifoend-2)&(MOVEFIFOSIZ-1)][myconnectindex]; + nsyn = (input *)&inputfifo[(g_player[myconnectindex].movefifoend-1)&(MOVEFIFOSIZ-1)][myconnectindex]; if (nsyn[0].fvel != osyn[0].fvel) { @@ -1192,9 +1192,9 @@ void faketimerhandler(void) if ((nsyn[0].extbits^osyn[0].extbits)&0x00ff0000) packbuf[j++] = ((nsyn[0].extbits>>16)&255), packbuf[2] |= 4; if ((nsyn[0].extbits^osyn[0].extbits)&0xff000000) packbuf[j++] = ((nsyn[0].extbits>>24)&255), packbuf[2] |= 8; - while (syncvalhead[myconnectindex] != syncvaltail) + while (g_player[myconnectindex].syncvalhead != syncvaltail) { - packbuf[j++] = syncval[myconnectindex][syncvaltail&(MOVEFIFOSIZ-1)]; + packbuf[j++] = g_player[myconnectindex].syncval[syncvaltail&(MOVEFIFOSIZ-1)]; syncvaltail++; } @@ -1204,7 +1204,7 @@ void faketimerhandler(void) //This allows allow packet resends for (i=connecthead;i>=0;i=connectpoint2[i]) - if (movefifoend[i] <= movefifosendplc) + if (g_player[i].movefifoend <= movefifosendplc) { packbuf[0] = 127; for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) @@ -1215,7 +1215,7 @@ void faketimerhandler(void) while (1) //Master { for (i=connecthead;i>=0;i=connectpoint2[i]) - if (playerquitflag[i] && (movefifoend[i] <= movefifosendplc)) return; + if (g_player[i].playerquitflag && (g_player[i].movefifoend <= movefifosendplc)) return; osyn = (input *)&inputfifo[(movefifosendplc-1)&(MOVEFIFOSIZ-1)][0]; nsyn = (input *)&inputfifo[(movefifosendplc)&(MOVEFIFOSIZ-1)][0]; @@ -1228,19 +1228,19 @@ void faketimerhandler(void) if ((movefifosendplc&(TIMERUPDATESIZ-1)) == 0) { for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) - if (playerquitflag[i]) - packbuf[j++] = min(max(myminlag[i],-128),127); + if (g_player[i].playerquitflag) + packbuf[j++] = min(max(g_player[i].myminlag,-128),127); for (i=connecthead;i>=0;i=connectpoint2[i]) - myminlag[i] = 0x7fffffff; + g_player[i].myminlag = 0x7fffffff; } k = j; for (i=connecthead;i>=0;i=connectpoint2[i]) - j += playerquitflag[i] + playerquitflag[i]; + j += g_player[i].playerquitflag + g_player[i].playerquitflag; for (i=connecthead;i>=0;i=connectpoint2[i]) { - if (playerquitflag[i] == 0) continue; + if (g_player[i].playerquitflag == 0) continue; packbuf[k] = 0; if (nsyn[i].fvel != osyn[i].fvel) @@ -1278,18 +1278,18 @@ void faketimerhandler(void) k++; } - while (syncvalhead[myconnectindex] != syncvaltail) + while (g_player[myconnectindex].syncvalhead != syncvaltail) { - packbuf[j++] = syncval[myconnectindex][syncvaltail&(MOVEFIFOSIZ-1)]; + packbuf[j++] = g_player[myconnectindex].syncval[syncvaltail&(MOVEFIFOSIZ-1)]; syncvaltail++; } for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) - if (playerquitflag[i]) + if (g_player[i].playerquitflag) { sendpacket(i,packbuf,j); if (nsyn[i].bits&(1<<26)) - playerquitflag[i] = 0; + g_player[i].playerquitflag = 0; } movefifosendplc += movesperpacket; @@ -1334,20 +1334,20 @@ static void checksync(void) long i; for (i=connecthead;i>=0;i=connectpoint2[i]) - if (syncvalhead[i] == syncvaltottail) break; + if (g_player[i].syncvalhead == syncvaltottail) break; if (i < 0) { syncstat = 0; do { for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) - if (syncval[i][syncvaltottail&(MOVEFIFOSIZ-1)] != - syncval[connecthead][syncvaltottail&(MOVEFIFOSIZ-1)]) + if (g_player[i].syncval[syncvaltottail&(MOVEFIFOSIZ-1)] != + g_player[connecthead].syncval[syncvaltottail&(MOVEFIFOSIZ-1)]) syncstat = 1; syncvaltottail++; for (i=connecthead;i>=0;i=connectpoint2[i]) - if (syncvalhead[i] == syncvaltottail) break; + if (g_player[i].syncvalhead == syncvaltottail) break; } while (i < 0); } @@ -1520,7 +1520,7 @@ inline int badguy(spritetype *s) void myos(long x, long y, int tilenum, int shade, int orientation) { - int p = sector[ps[screenpeek].cursectnum].floorpal, a = 0; + int p = sector[g_player[screenpeek].ps.cursectnum].floorpal, a = 0; if (orientation&4) a = 1024; @@ -1540,7 +1540,7 @@ void myospal(long x, long y, int tilenum, int shade, int orientation, int p) void myosx(long x, long y, int tilenum, int shade, int orientation) { - int p = sector[ps[screenpeek].cursectnum].floorpal, a = 0; + int p = sector[g_player[screenpeek].ps.cursectnum].floorpal, a = 0; if (orientation&4) a = 1024; @@ -1652,7 +1652,7 @@ static void weaponnum999(char ind,long x,long y,long num1, long num2,char ha) rotatesprite(sbarx(x+25),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,10,0,0,xdim-1,ydim-1); } -static void weapon_amounts(struct player_struct *p,long x,long y,long u) +static void weapon_amounts(player_struct *p,long x,long y,long u) { int cw = p->curr_weapon; @@ -1791,7 +1791,7 @@ void txdigitalnumber(int starttile, long x,long y,long n,int s,int pal,int cs,lo } } -static void displayinventory(struct player_struct *p) +static void displayinventory(player_struct *p) { int n, j = 0, xoff = 0, y; @@ -1878,9 +1878,9 @@ void displayfragbar(void) for (i=connecthead;i>=0;i=connectpoint2[i]) { - minitext(21+(73*(i&3)),2+((i&28)<<1),&ud.user_name[i][0],/*sprite[ps[i].i].pal*/ps[i].palookup,2+8+16); - Bsprintf(tempbuf,"%d",ps[i].frag-ps[i].fraggedself); - minitext(17+50+(73*(i&3)),2+((i&28)<<1),tempbuf,/*sprite[ps[i].i].pal*/ps[i].palookup,2+8+16); + minitext(21+(73*(i&3)),2+((i&28)<<1),&g_player[i].user_name[0],/*sprite[g_player[i].ps.i].pal*/g_player[i].ps.palookup,2+8+16); + Bsprintf(tempbuf,"%d",g_player[i].ps.frag-g_player[i].ps.fraggedself); + minitext(17+50+(73*(i&3)),2+((i&28)<<1),tempbuf,/*sprite[g_player[i].ps.i].pal*/g_player[i].ps.palookup,2+8+16); } } @@ -1888,13 +1888,13 @@ void displayfragbar(void) static void coolgaugetext(int snum) { - struct player_struct *p = &ps[snum]; + player_struct *p = &g_player[snum].ps; long i, j, o, ss = ud.screen_size, u; int permbit = 0; if (ss < 4) return; - if (ps[snum].gm&MODE_MENU) + if (g_player[snum].ps.gm&MODE_MENU) if ((current_menu >= 400 && current_menu <= 405)) return; @@ -1909,7 +1909,7 @@ static void coolgaugetext(int snum) else { for (i=connecthead;i>=0;i=connectpoint2[i]) - if (ps[i].frag != sbar.frag[i]) + if (g_player[i].ps.frag != sbar.frag[i]) { displayfragbar(); break; @@ -1918,7 +1918,7 @@ static void coolgaugetext(int snum) } for (i=connecthead;i>=0;i=connectpoint2[i]) if (i != myconnectindex) - sbar.frag[i] = ps[i].frag; + sbar.frag[i] = g_player[i].ps.frag; } if (ss == 4) //DRAW MINI STATUS BAR: @@ -2319,7 +2319,7 @@ static void tics(void) if (i != frameval[framecnt]) { j=(timer*AVERAGEFRAMES)/(i-frameval[framecnt]); - if (ud.tickrate && !(ps[myconnectindex].gm&MODE_MENU)) + if (ud.tickrate && !(g_player[myconnectindex].ps.gm&MODE_MENU)) { int ii, k = 0, p = 8; @@ -2361,29 +2361,29 @@ static void coords(int snum) else if (ud.multimode > 1) y = 16; } - sprintf(tempbuf,"X= %ld",ps[snum].posx); + sprintf(tempbuf,"X= %ld",g_player[snum].ps.posx); printext256(250L,y,31,-1,tempbuf,0); - sprintf(tempbuf,"Y= %ld",ps[snum].posy); + sprintf(tempbuf,"Y= %ld",g_player[snum].ps.posy); printext256(250L,y+9L,31,-1,tempbuf,0); - Bsprintf(tempbuf,"Z= %ld",ps[snum].posz); + Bsprintf(tempbuf,"Z= %ld",g_player[snum].ps.posz); printext256(250L,y+18L,31,-1,tempbuf,0); - Bsprintf(tempbuf,"A= %d",ps[snum].ang); + Bsprintf(tempbuf,"A= %d",g_player[snum].ps.ang); printext256(250L,y+27L,31,-1,tempbuf,0); - Bsprintf(tempbuf,"H= %ld",ps[snum].horiz); + Bsprintf(tempbuf,"H= %ld",g_player[snum].ps.horiz); printext256(250L,y+36L,31,-1,tempbuf,0); - Bsprintf(tempbuf,"ZV= %ld",ps[snum].poszv); + Bsprintf(tempbuf,"ZV= %ld",g_player[snum].ps.poszv); printext256(250L,y+45L,31,-1,tempbuf,0); - Bsprintf(tempbuf,"OG= %d",ps[snum].on_ground); + Bsprintf(tempbuf,"OG= %d",g_player[snum].ps.on_ground); printext256(250L,y+54L,31,-1,tempbuf,0); - Bsprintf(tempbuf,"AM= %d",ps[snum].ammo_amount[GROW_WEAPON]); + Bsprintf(tempbuf,"AM= %d",g_player[snum].ps.ammo_amount[GROW_WEAPON]); printext256(250L,y+63L,31,-1,tempbuf,0); - Bsprintf(tempbuf,"LFW= %d",ps[snum].last_full_weapon); + Bsprintf(tempbuf,"LFW= %d",g_player[snum].ps.last_full_weapon); printext256(250L,y+72L,31,-1,tempbuf,0); - Bsprintf(tempbuf,"SECTL= %d",sector[ps[snum].cursectnum].lotag); + Bsprintf(tempbuf,"SECTL= %d",sector[g_player[snum].ps.cursectnum].lotag); printext256(250L,y+81L,31,-1,tempbuf,0); Bsprintf(tempbuf,"SEED= %ld",randomseed); printext256(250L,y+90L,31,-1,tempbuf,0); - Bsprintf(tempbuf,"THOLD= %d",ps[snum].transporter_hold); + Bsprintf(tempbuf,"THOLD= %d",g_player[snum].ps.transporter_hold); printext256(250L,y+99L+7,31,-1,tempbuf,0); } @@ -2395,7 +2395,7 @@ static void operatefta(void) quotebot = min(quotebot,j); quotebotgoal = min(quotebotgoal,j); - if (ps[myconnectindex].gm&MODE_TYPE) j -= 8; + if (g_player[myconnectindex].ps.gm&MODE_TYPE) j -= 8; quotebotgoal = j; j = quotebot; for (i=0;i 12) k += 24; } - if (ps[screenpeek].ftq == 115 || ps[screenpeek].ftq == 116 || ps[screenpeek].ftq == 117) + if (g_player[screenpeek].ps.ftq == 115 || g_player[screenpeek].ps.ftq == 116 || g_player[screenpeek].ps.ftq == 117) { k = quotebot-8-4; /* for(i=0;i 4) - gametext(320>>1,k,fta_quotes[ps[screenpeek].ftq],0,2+8+16); + gametext(320>>1,k,fta_quotes[g_player[screenpeek].ps.ftq],0,2+8+16); else - if (j > 2) gametext(320>>1,k,fta_quotes[ps[screenpeek].ftq],0,2+8+16+1); + if (j > 2) gametext(320>>1,k,fta_quotes[g_player[screenpeek].ps.ftq],0,2+8+16+1); else - gametext(320>>1,k,fta_quotes[ps[screenpeek].ftq],0,2+8+16+1+32); + gametext(320>>1,k,fta_quotes[g_player[screenpeek].ps.ftq],0,2+8+16+1+32); } -void FTA(int q,struct player_struct *p) +void FTA(int q,player_struct *p) { if (fta_quotes[p->ftq] == NULL) { @@ -2487,7 +2487,7 @@ void FTA(int q,struct player_struct *p) // || q == 26 || q == 115 || q ==116 || q == 117 || q == 122) { if (p->ftq != q) - if (p == &ps[screenpeek]) + if (p == &g_player[screenpeek].ps) OSD_Printf("%s\n",stripcolorcodes(fta_quotes[q])); p->ftq = q; @@ -2514,8 +2514,8 @@ static void showtwoscreens(void) { setview(0,0,xdim-1,ydim-1); flushperms(); - //ps[myconnectindex].palette = palette; - setgamepalette(&ps[myconnectindex], palette, 1); // JBF 20040308 + //g_player[myconnectindex].ps.palette = palette; + setgamepalette(&g_player[myconnectindex].ps, palette, 1); // JBF 20040308 fadepal(0,0,0, 0,64,7); KB_FlushKeyboardQueue(); rotatesprite(0,0,65536L,0,3291,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); @@ -2543,8 +2543,8 @@ static void showtwoscreens(void) { setview(0,0,xdim-1,ydim-1); flushperms(); - //ps[myconnectindex].palette = palette; - setgamepalette(&ps[myconnectindex], palette, 1); // JBF 20040308 + //g_player[myconnectindex].ps.palette = palette; + setgamepalette(&g_player[myconnectindex].ps, palette, 1); // JBF 20040308 fadepal(0,0,0, 0,64,7); KB_FlushKeyboardQueue(); rotatesprite(0,0,65536L,0,TENSCREEN,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); @@ -2562,7 +2562,7 @@ extern long qsetmode; void gameexit(const char *t) { - if (*t != 0) ps[myconnectindex].palette = (char *) &palette[0]; + if (*t != 0) g_player[myconnectindex].ps.palette = (char *) &palette[0]; if (numplayers > 1) allowtimetocorrecterrorswhenquitting(); @@ -2577,10 +2577,10 @@ void gameexit(const char *t) if (!qe && !cp) { - if (playerswhenstarted > 1 && ps[myconnectindex].gm&MODE_GAME && GTFLAGS(GAMETYPE_FLAG_SCORESHEET) && *t == ' ') + if (playerswhenstarted > 1 && g_player[myconnectindex].ps.gm&MODE_GAME && GTFLAGS(GAMETYPE_FLAG_SCORESHEET) && *t == ' ') { dobonus(1); - setgamemode(config.ScreenMode,config.ScreenWidth,config.ScreenHeight,config.ScreenBPP); + setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP); } if (*t != 0 && *(t+1) != 'V' && *(t+1) != 'Y') @@ -2616,7 +2616,7 @@ static int strget_(int small,int x,int y,char *t,int dalen,int c) short ch; int i; - while ((ch = KB_Getch()) != 0 || (ps[myconnectindex].gm&MODE_MENU && MOUSE_GetButtons()&RIGHT_MOUSE)) + while ((ch = KB_Getch()) != 0 || (g_player[myconnectindex].ps.gm&MODE_MENU && MOUSE_GetButtons()&RIGHT_MOUSE)) { if (ch == asc_BackSpace) { @@ -2634,7 +2634,7 @@ static int strget_(int small,int x,int y,char *t,int dalen,int c) KB_ClearKeyDown(sc_kpad_Enter); return (1); } - else if (ch == asc_Escape || (ps[myconnectindex].gm&MODE_MENU && MOUSE_GetButtons()&RIGHT_MOUSE)) + else if (ch == asc_Escape || (g_player[myconnectindex].ps.gm&MODE_MENU && MOUSE_GetButtons()&RIGHT_MOUSE)) { KB_ClearKeyDown(sc_Escape); MOUSE_ClearButton(RIGHT_MOUSE); @@ -2661,13 +2661,13 @@ static int strget_(int small,int x,int y,char *t,int dalen,int c) for (ii=0;ii>3)%7),c,0,small?(8|16):2+8,0,0,xdim-1,ydim-1); + rotatesprite((x+(small?4:8))<<16,((y+(small?0:4))<<16)+(small?ud.config.ScreenHeight<<15:0),32768,0,SPINNINGNUKEICON+((totalclock>>3)%7),c,0,small?(8|16):2+8,0,0,xdim-1,ydim-1); return (0); } @@ -2705,7 +2705,7 @@ static void typemode(void) { short ch, hitstate, i, j, l; - if (ps[myconnectindex].gm&MODE_SENDTOWHOM) + if (g_player[myconnectindex].ps.gm&MODE_SENDTOWHOM) { if (sendmessagecommand != -1 || ud.multimode < 3 || movesperpacket == 4) { @@ -2727,11 +2727,11 @@ static void typemode(void) i++; } typebuf[i-3] = '\0'; - Bstrcat(recbuf,ud.user_name[myconnectindex]); + Bstrcat(recbuf,g_player[myconnectindex].user_name); } else { - Bstrcat(recbuf,ud.user_name[myconnectindex]); + Bstrcat(recbuf,g_player[myconnectindex].user_name); Bstrcat(recbuf,": "); } @@ -2768,7 +2768,7 @@ static void typemode(void) } sendmessagecommand = -1; - ps[myconnectindex].gm &= ~(MODE_TYPE|MODE_SENDTOWHOM); + g_player[myconnectindex].ps.gm &= ~(MODE_TYPE|MODE_SENDTOWHOM); } else if (sendmessagecommand == -1) { @@ -2785,7 +2785,7 @@ static void typemode(void) } else { - Bsprintf(buf," %d - %s",i+1,ud.user_name[i]); + Bsprintf(buf," %d - %s",i+1,g_player[i].user_name); minitextshade((320>>1)-40-6+1,j+1,buf,26,0,2+8+16); minitext((320>>1)-40-6,j,buf,0,2+8+16); j += 7; @@ -2812,7 +2812,7 @@ static void typemode(void) sendmessagecommand = ud.multimode; if (i == 27) { - ps[myconnectindex].gm &= ~(MODE_TYPE|MODE_SENDTOWHOM); + g_player[myconnectindex].ps.gm &= ~(MODE_TYPE|MODE_SENDTOWHOM); sendmessagecommand = -1; } else @@ -2847,10 +2847,10 @@ static void typemode(void) if (SHIFTS_IS_PRESSED) sendmessagecommand = -1; else sendmessagecommand = ud.multimode; } - ps[myconnectindex].gm |= MODE_SENDTOWHOM; + g_player[myconnectindex].ps.gm |= MODE_SENDTOWHOM; } else if (hitstate == -1) - ps[myconnectindex].gm &= ~(MODE_TYPE|MODE_SENDTOWHOM); + g_player[myconnectindex].ps.gm &= ~(MODE_TYPE|MODE_SENDTOWHOM); else pub = NUMPAGES; } } @@ -2865,8 +2865,8 @@ static void moveclouds(void) for (i=0;i>9); - cloudy[i] += (sintable[ps[screenpeek].ang&2047]>>9); + cloudx[i] += (sintable[(g_player[screenpeek].ps.ang+512)&2047]>>9); + cloudy[i] += (sintable[g_player[screenpeek].ps.ang&2047]>>9); sector[clouds[i]].ceilingxpanning = cloudx[i]>>6; sector[clouds[i]].ceilingypanning = cloudy[i]>>6; @@ -2936,7 +2936,7 @@ static void drawoverheadmap(long cposx, long cposy, long czoom, short cang) } //Draw sprites - k = ps[screenpeek].i; + k = g_player[screenpeek].ps.i; for (i=0;i>3]&(1<<(i&7)))) continue; @@ -3128,9 +3128,9 @@ static void drawoverheadmap(long cposx, long cposy, long czoom, short cang) { if (ud.scrollmode && p == screenpeek) continue; - ox = sprite[ps[p].i].x-cposx; - oy = sprite[ps[p].i].y-cposy; - daang = (sprite[ps[p].i].ang-cang)&2047; + ox = sprite[g_player[p].ps.i].x-cposx; + oy = sprite[g_player[p].ps.i].y-cposy; + daang = (sprite[g_player[p].ps.i].ang-cang)&2047; if (p == screenpeek) { ox = 0; @@ -3142,20 +3142,20 @@ static void drawoverheadmap(long cposx, long cposy, long czoom, short cang) if (p == screenpeek || GTFLAGS(GAMETYPE_FLAG_OTHERPLAYERSINMAP)) { - if (sprite[ps[p].i].xvel > 16 && ps[p].on_ground) + if (sprite[g_player[p].ps.i].xvel > 16 && g_player[p].ps.on_ground) i = APLAYERTOP+((totalclock>>4)&3); else i = APLAYERTOP; - j = klabs(ps[p].truefz-ps[p].posz)>>8; - j = mulscale(czoom*(sprite[ps[p].i].yrepeat+j),yxaspect,16); + j = klabs(g_player[p].ps.truefz-g_player[p].ps.posz)>>8; + j = mulscale(czoom*(sprite[g_player[p].ps.i].yrepeat+j),yxaspect,16); if (j < 22000) j = 22000; else if (j > (65536<<1)) j = (65536<<1); rotatesprite((x1<<4)+(xdim<<15),(y1<<4)+(ydim<<15),j, - daang,i,sprite[ps[p].i].shade,/*sprite[ps[p].i].pal*/sector[ps[p].cursectnum].floorpal, - (sprite[ps[p].i].cstat&2)>>1,windowx1,windowy1,windowx2,windowy2); + daang,i,sprite[g_player[p].ps.i].shade,/*sprite[g_player[p].ps.i].pal*/sector[g_player[p].ps.cursectnum].floorpal, + (sprite[g_player[p].ps.i].cstat&2)>>1,windowx1,windowy1,windowx2,windowy2); } } } @@ -3167,11 +3167,11 @@ void palto(int r,int g,int b,long e) for(i=0;i<768;i+=3) { temparray[i ] = - ps[myconnectindex].palette[i+0]+((((long)r-(long)ps[myconnectindex].palette[i+0])*(long)(e&127))>>6); + g_player[myconnectindex].ps.palette[i+0]+((((long)r-(long)g_player[myconnectindex].ps.palette[i+0])*(long)(e&127))>>6); temparray[i+1] = - ps[myconnectindex].palette[i+1]+((((long)g-(long)ps[myconnectindex].palette[i+1])*(long)(e&127))>>6); + g_player[myconnectindex].ps.palette[i+1]+((((long)g-(long)g_player[myconnectindex].ps.palette[i+1])*(long)(e&127))>>6); temparray[i+2] = - ps[myconnectindex].palette[i+2]+((((long)b-(long)ps[myconnectindex].palette[i+2])*(long)(e&127))>>6); + g_player[myconnectindex].ps.palette[i+2]+((((long)b-(long)g_player[myconnectindex].ps.palette[i+2])*(long)(e&127))>>6); } */ @@ -3190,7 +3190,7 @@ void displayrest(long smoothratio) long a, i, j; char fader=0,fadeg=0,fadeb=0,fadef=0,tintr=0,tintg=0,tintb=0,tintf=0,dotint=0; - struct player_struct *pp = &ps[screenpeek]; + player_struct *pp = &g_player[screenpeek].ps; walltype *wal; long cposx,cposy,cang; @@ -3387,21 +3387,21 @@ void displayrest(long smoothratio) if (pp->invdisptime > 0) displayinventory(pp); - SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); - OnEvent(EVENT_DISPLAYSBAR, ps[screenpeek].i, screenpeek, -1); - if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[screenpeek].ps.i,screenpeek); + OnEvent(EVENT_DISPLAYSBAR, g_player[screenpeek].ps.i, screenpeek, -1); + if (GetGameVarID(g_iReturnVarID,g_player[screenpeek].ps.i,screenpeek) == 0) coolgaugetext(screenpeek); operatefta(); if (KB_KeyPressed(sc_Escape) && ud.overhead_on == 0 && ud.show_help == 0 - && ps[myconnectindex].newowner == -1) + && g_player[myconnectindex].ps.newowner == -1) { - if ((ps[myconnectindex].gm&MODE_MENU) == MODE_MENU && current_menu < 51) + if ((g_player[myconnectindex].ps.gm&MODE_MENU) == MODE_MENU && current_menu < 51) { KB_ClearKeyDown(sc_Escape); - ps[myconnectindex].gm &= ~MODE_MENU; + g_player[myconnectindex].ps.gm &= ~MODE_MENU; if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; @@ -3412,9 +3412,9 @@ void displayrest(long smoothratio) walock[TILE_SAVESHOT] = 199; vscrn(); } - else if ((ps[myconnectindex].gm&MODE_MENU) != MODE_MENU && - ps[myconnectindex].newowner == -1 && - (ps[myconnectindex].gm&MODE_TYPE) != MODE_TYPE) + else if ((g_player[myconnectindex].ps.gm&MODE_MENU) != MODE_MENU && + g_player[myconnectindex].ps.newowner == -1 && + (g_player[myconnectindex].ps.gm&MODE_TYPE) != MODE_TYPE) { KB_ClearKeyDown(sc_Escape); FX_StopAllSounds(); @@ -3422,43 +3422,43 @@ void displayrest(long smoothratio) intomenusounds(); - ps[myconnectindex].gm |= MODE_MENU; + g_player[myconnectindex].ps.gm |= MODE_MENU; if (ud.multimode < 2 && ud.recstat != 2) ready2send = 0; - if (ps[myconnectindex].gm&MODE_GAME) cmenu(50); + if (g_player[myconnectindex].ps.gm&MODE_GAME) cmenu(50); else cmenu(0); screenpeek = myconnectindex; } } - OnEvent(EVENT_DISPLAYREST, ps[screenpeek].i, screenpeek, -1); + OnEvent(EVENT_DISPLAYREST, g_player[screenpeek].ps.i, screenpeek, -1); - if (ps[myconnectindex].newowner == -1 && ud.overhead_on == 0 && ud.crosshair && ud.camerasprite == -1) + if (g_player[myconnectindex].ps.newowner == -1 && ud.overhead_on == 0 && ud.crosshair && ud.camerasprite == -1) { - SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); - OnEvent(EVENT_DISPLAYCROSSHAIR, ps[screenpeek].i, screenpeek, -1); - if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) - rotatesprite((160L-(ps[myconnectindex].look_ang>>1))<<16,100L<<16,ud.crosshair>1?65536L>>(ud.crosshair-1):65536L,0,CROSSHAIR,0,0,2+1,windowx1,windowy1,windowx2,windowy2); + SetGameVarID(g_iReturnVarID,0,g_player[screenpeek].ps.i,screenpeek); + OnEvent(EVENT_DISPLAYCROSSHAIR, g_player[screenpeek].ps.i, screenpeek, -1); + if (GetGameVarID(g_iReturnVarID,g_player[screenpeek].ps.i,screenpeek) == 0) + rotatesprite((160L-(g_player[myconnectindex].ps.look_ang>>1))<<16,100L<<16,ud.crosshair>1?65536L>>(ud.crosshair-1):65536L,0,CROSSHAIR,0,0,2+1,windowx1,windowy1,windowx2,windowy2); } #if 0 if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) { for (i=0;i>1,-160),160); + j = min(max((getincangle(getangle(g_player[i].ps.posx-g_player[myconnectindex].ps.posx,g_player[i].ps.posy-g_player[myconnectindex].ps.posy),g_player[myconnectindex].ps.ang))>>1,-160),160); rotatesprite((160-j)<<16,100L<<16,65536L,0,DUKEICON,0,0,2+1,windowx1,windowy1,windowx2,windowy2); } } } #endif - if (ud.pause_on==1 && (ps[myconnectindex].gm&MODE_MENU) == 0) + if (ud.pause_on==1 && (g_player[myconnectindex].ps.gm&MODE_MENU) == 0) menutext(160,100,0,0,"GAME PAUSED"); - if (ps[myconnectindex].gm&MODE_TYPE) + if (g_player[myconnectindex].ps.gm&MODE_TYPE) typemode(); else menus(); @@ -3471,7 +3471,7 @@ void displayrest(long smoothratio) extern int mdpause; mdpause = 0; - if (ud.pause_on || (ps[myconnectindex].gm&MODE_MENU && numplayers < 2)) + if (ud.pause_on || (g_player[myconnectindex].ps.gm&MODE_MENU && numplayers < 2)) mdpause = 1; } #endif @@ -3479,30 +3479,30 @@ void displayrest(long smoothratio) tics(); // JBF 20040124: display level stats in screen corner - if (ud.levelstats && (ps[myconnectindex].gm&MODE_MENU) == 0) + if (ud.levelstats && (g_player[myconnectindex].ps.gm&MODE_MENU) == 0) { i = (ud.screen_size <= 4)?0:scale(tilesizy[BOTTOMSTATUSBAR],ud.statusbarscale,100); Bsprintf(tempbuf,"Time: %ld:%02ld", - (ps[myconnectindex].player_par/(26*60)), - (ps[myconnectindex].player_par/26)%60); + (g_player[myconnectindex].ps.player_par/(26*60)), + (g_player[myconnectindex].ps.player_par/26)%60); minitext(320-5*12,200-i-6-6-6,tempbuf,0,26); if (ud.player_skill > 3 || (ud.multimode > 1 && !GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY))) - Bsprintf(tempbuf,"Kills: %ld",(ud.multimode>1 &&!GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY))?ps[i].frag-ps[i].fraggedself:ps[myconnectindex].actors_killed); + Bsprintf(tempbuf,"Kills: %ld",(ud.multimode>1 &&!GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY))?g_player[i].ps.frag-g_player[i].ps.fraggedself:g_player[myconnectindex].ps.actors_killed); else - Bsprintf(tempbuf,"Kills: %ld/%ld",ps[myconnectindex].actors_killed, - ps[myconnectindex].max_actors_killed>ps[myconnectindex].actors_killed? - ps[myconnectindex].max_actors_killed:ps[myconnectindex].actors_killed); + Bsprintf(tempbuf,"Kills: %ld/%ld",g_player[myconnectindex].ps.actors_killed, + g_player[myconnectindex].ps.max_actors_killed>g_player[myconnectindex].ps.actors_killed? + g_player[myconnectindex].ps.max_actors_killed:g_player[myconnectindex].ps.actors_killed); minitext(320-5*12,200-i-6-6,tempbuf,0,26); - Bsprintf(tempbuf,"Secrets: %ld/%ld", ps[myconnectindex].secret_rooms,ps[myconnectindex].max_secret_rooms); + Bsprintf(tempbuf,"Secrets: %ld/%ld", g_player[myconnectindex].ps.secret_rooms,g_player[myconnectindex].ps.max_secret_rooms); minitext(320-5*12,200-i-6,tempbuf,0,26); } if (tintf > 0 || dotint) palto(tintr,tintg,tintb,tintf|128); } -static void view(struct player_struct *pp, long *vx, long *vy,long *vz,short *vsectnum, int ang, int horiz) +static void view(player_struct *pp, long *vx, long *vy,long *vz,short *vsectnum, int ang, int horiz) { spritetype *sp = &sprite[pp->i]; long i, hx, hy, hitx, hity, hitz; @@ -3587,7 +3587,7 @@ void drawbackground(void) y1 = 0; y2 = ydim; - if (ps[myconnectindex].gm & MODE_GAME || ud.recstat == 2) + if (g_player[myconnectindex].ps.gm & MODE_GAME || ud.recstat == 2) //if (ud.recstat == 0 || ud.recstat == 1 || (ud.recstat == 2 && ud.reccnt > 0)) // JBF 20040717 { if (ud.screen_size == 8 && ud.statusbarmode == 0) @@ -3859,7 +3859,7 @@ void se40code(long x,long y,long z,long a,long h, long smoothratio) case 43: case 44: case 45: - if (ps[screenpeek].cursectnum == sprite[i].sectnum) + if (g_player[screenpeek].ps.cursectnum == sprite[i].sectnum) SE40_Draw(i,x,y,z,a,h,smoothratio); break; } @@ -3875,7 +3875,7 @@ void displayrooms(int snum,long smoothratio) long dst,j,fz,cz; long tposx,tposy,i; short k; - struct player_struct *p = &ps[snum]; + player_struct *p = &g_player[snum].ps; short tang; long tiltcx,tiltcy,tiltcs=0; // JBF 20030807 #ifdef POLYMOST @@ -3899,7 +3899,7 @@ void displayrooms(int snum,long smoothratio) visibility = p->visibility; - if (ud.pause_on || ps[snum].on_crane > -1) smoothratio = 65536; + if (ud.pause_on || g_player[snum].ps.on_crane > -1) smoothratio = 65536; ud.camerasect = p->cursectnum; @@ -4059,7 +4059,7 @@ void displayrooms(int snum,long smoothratio) if (ud.camerahoriz > 299) ud.camerahoriz = 299; else if (ud.camerahoriz < -99) ud.camerahoriz = -99; - OnEvent(EVENT_DISPLAYROOMS, ps[screenpeek].i, screenpeek, -1); + OnEvent(EVENT_DISPLAYROOMS, g_player[screenpeek].ps.i, screenpeek, -1); #ifdef SE40 se40code(ud.camerax,ud.cameray,ud.cameraz,ud.cameraang,ud.camerahoriz,smoothratio); @@ -4197,7 +4197,7 @@ static void dumpdebugdata(void) } DumpGameVars(fp); fclose(fp); - saveboard("debug.map",&ps[myconnectindex].posx,&ps[myconnectindex].posy,&ps[myconnectindex].posz,&ps[myconnectindex].ang,&ps[myconnectindex].cursectnum); + saveboard("debug.map",&g_player[myconnectindex].ps.posx,&g_player[myconnectindex].ps.posy,&g_player[myconnectindex].ps.posz,&g_player[myconnectindex].ps.ang,&g_player[myconnectindex].ps.cursectnum); } int EGS(int whatsect,long s_x,long s_y,long s_z,int s_pn,int s_s,int s_xr,int s_yr,int s_a,int s_ve,long s_zv,int s_ow,int s_ss) @@ -4508,7 +4508,7 @@ int spawn(int j, int pn) if (actortype[sp->picnum] & 2) hittype[i].actorstayput = sp->sectnum; - ps[myconnectindex].max_actors_killed++; + g_player[myconnectindex].ps.max_actors_killed++; sp->clipdist = 80; if (j >= 0) { @@ -4959,7 +4959,7 @@ int spawn(int j, int pn) break; } - sp->cstat = 32+((ps[sprite[j].yvel].footprintcount&1)<<2); + sp->cstat = 32+((g_player[sprite[j].yvel].ps.footprintcount&1)<<2); sp->ang = sprite[j].ang; } @@ -5013,7 +5013,7 @@ int spawn(int j, int pn) sp->xrepeat = sprite[j].xrepeat; sp->yrepeat = sprite[j].yrepeat; sp->shade = sprite[j].shade; - sp->pal = ps[sprite[j].yvel].palookup; + sp->pal = g_player[sprite[j].yvel].ps.palookup; } case DUKECAR__STATIC: case HELECOPT__STATIC: @@ -5083,12 +5083,12 @@ int spawn(int j, int pn) if (sprite[j].picnum == APLAYER) { snum = sprite[j].yvel; - a = ps[snum].ang-(TRAND&63)+8; //Fine tune + a = g_player[snum].ps.ang-(TRAND&63)+8; //Fine tune T1 = TRAND&1; if (sp->picnum == SHOTGUNSHELL) - sp->z = (6<<8)+ps[snum].pyoff+ps[snum].posz-((ps[snum].horizoff+ps[snum].horiz-100)<<4); - else sp->z = (3<<8)+ps[snum].pyoff+ps[snum].posz-((ps[snum].horizoff+ps[snum].horiz-100)<<4); + sp->z = (6<<8)+g_player[snum].ps.pyoff+g_player[snum].ps.posz-((g_player[snum].ps.horizoff+g_player[snum].ps.horiz-100)<<4); + else sp->z = (3<<8)+g_player[snum].ps.pyoff+g_player[snum].ps.posz-((g_player[snum].ps.horizoff+g_player[snum].ps.horiz-100)<<4); sp->zvel = -(TRAND&255); } else @@ -5271,7 +5271,7 @@ int spawn(int j, int pn) sp->z -= (18<<8); } else sp->z -= (13<<8); - sp->ang = getangle(ps[connecthead].posx-sp->x,ps[connecthead].posy-sp->y); + sp->ang = getangle(g_player[connecthead].ps.posx-sp->x,g_player[connecthead].ps.posy-sp->y); sp->xvel = 48-(TRAND&31); ssp(i,CLIPMASK0); } @@ -5451,7 +5451,7 @@ int spawn(int j, int pn) sp->cstat |= 257; if (sp->picnum != SHARK) - ps[myconnectindex].max_actors_killed++; + g_player[myconnectindex].ps.max_actors_killed++; } if (sp->picnum == ORGANTIC) sp->cstat |= 128; @@ -5530,7 +5530,7 @@ int spawn(int j, int pn) changespritestat(i,5); return i; } - ps[myconnectindex].max_actors_killed++; + g_player[myconnectindex].ps.max_actors_killed++; hittype[i].temp_data[5] = 0; if (ud.monsters_off == 1) { @@ -6430,11 +6430,11 @@ void animatesprites(long x,long y,int a,long smoothratio) } if (t->statnum == 99) continue; - if (s->statnum != 1 && s->picnum == APLAYER && ps[s->yvel].newowner == -1 && s->owner >= 0) + if (s->statnum != 1 && s->picnum == APLAYER && g_player[s->yvel].ps.newowner == -1 && s->owner >= 0) { - t->x -= mulscale16(65536-smoothratio,ps[s->yvel].posx-ps[s->yvel].oposx); - t->y -= mulscale16(65536-smoothratio,ps[s->yvel].posy-ps[s->yvel].oposy); - t->z = ps[s->yvel].oposz + mulscale16(smoothratio,ps[s->yvel].posz-ps[s->yvel].oposz); + t->x -= mulscale16(65536-smoothratio,g_player[s->yvel].ps.posx-g_player[s->yvel].ps.oposx); + t->y -= mulscale16(65536-smoothratio,g_player[s->yvel].ps.posy-g_player[s->yvel].ps.oposy); + t->z = g_player[s->yvel].ps.oposz + mulscale16(smoothratio,g_player[s->yvel].ps.posz-g_player[s->yvel].ps.oposz); t->z += (40<<8); } else if ((s->statnum == 0 && s->picnum != CRANEPOLE) || s->statnum == 10 || s->statnum == 6 || s->statnum == 4 || s->statnum == 5 || s->statnum == 1) @@ -6489,15 +6489,15 @@ void animatesprites(long x,long y,int a,long smoothratio) sqa = getangle( - sprite[s->owner].x-ps[screenpeek].posx, - sprite[s->owner].y-ps[screenpeek].posy); + sprite[s->owner].x-g_player[screenpeek].ps.posx, + sprite[s->owner].y-g_player[screenpeek].ps.posy); sqb = getangle( sprite[s->owner].x-t->x, sprite[s->owner].y-t->y); if (klabs(getincangle(sqa,sqb)) > 512) - if (ldist(&sprite[s->owner],t) < ldist(&sprite[ps[screenpeek].i],&sprite[s->owner])) + if (ldist(&sprite[s->owner],t) < ldist(&sprite[g_player[screenpeek].ps.i],&sprite[s->owner])) t->xrepeat = t->yrepeat = 0; } continue; @@ -6505,7 +6505,7 @@ void animatesprites(long x,long y,int a,long smoothratio) case BURNING2__STATIC: if (sprite[s->owner].statnum == 10) { - if (display_mirror == 0 && sprite[s->owner].yvel == screenpeek && ps[sprite[s->owner].yvel].over_shoulder_on == 0) + if (display_mirror == 0 && sprite[s->owner].yvel == screenpeek && g_player[sprite[s->owner].yvel].ps.over_shoulder_on == 0) t->xrepeat = 0; else { @@ -6595,7 +6595,7 @@ void animatesprites(long x,long y,int a,long smoothratio) if (t->pal == 1) t->z -= (18<<8); - if (ps[p].over_shoulder_on > 0 && ps[p].newowner < 0) + if (g_player[p].ps.over_shoulder_on > 0 && g_player[p].ps.newowner < 0) { t->cstat |= 2; if (screenpeek == myconnectindex && numplayers >= 2) @@ -6610,7 +6610,7 @@ void animatesprites(long x,long y,int a,long smoothratio) if ((display_mirror || screenpeek != p || s->owner == -1) && ud.multimode > 1) { - if (ud.showweapons && sprite[ps[p].i].extra > 0 && ps[p].curr_weapon > 0) + if (ud.showweapons && sprite[g_player[p].ps.i].extra > 0 && g_player[p].ps.curr_weapon > 0) { memcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)t,sizeof(spritetype)); @@ -6622,10 +6622,10 @@ void animatesprites(long x,long y,int a,long smoothratio) tsprite[spritesortcnt].shade = t->shade; tsprite[spritesortcnt].cstat = 0; - tsprite[spritesortcnt].picnum = (ps[p].curr_weapon==GROW_WEAPON?GROWSPRITEICON:weapon_sprites[ps[p].curr_weapon]); + tsprite[spritesortcnt].picnum = (g_player[p].ps.curr_weapon==GROW_WEAPON?GROWSPRITEICON:weapon_sprites[g_player[p].ps.curr_weapon]); if (s->owner >= 0) - tsprite[spritesortcnt].z = ps[p].posz-(12<<8); + tsprite[spritesortcnt].z = g_player[p].ps.posz-(12<<8); else tsprite[spritesortcnt].z = s->z-(51<<8); if (tsprite[spritesortcnt].picnum == HEAVYHBOMB) { @@ -6641,7 +6641,7 @@ void animatesprites(long x,long y,int a,long smoothratio) spritesortcnt++; } - if (sync[p].extbits & (1<<7) && !ud.pause_on) + if (g_player[p].sync.extbits & (1<<7) && !ud.pause_on) { memcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)t,sizeof(spritetype)); @@ -6655,7 +6655,7 @@ void animatesprites(long x,long y,int a,long smoothratio) tsprite[spritesortcnt].picnum = RESPAWNMARKERGREEN; if (s->owner >= 0) - tsprite[spritesortcnt].z = ps[p].posz-(20<<8); + tsprite[spritesortcnt].z = g_player[p].ps.posz-(20<<8); else tsprite[spritesortcnt].z = s->z-(96<<8); tsprite[spritesortcnt].xrepeat = 32; tsprite[spritesortcnt].yrepeat = 32; @@ -6688,28 +6688,28 @@ void animatesprites(long x,long y,int a,long smoothratio) else if ((hittype[i].floorz-s->z) > (64<<8)) k += 60; t->picnum += k; - t->pal = ps[p].palookup; + t->pal = g_player[p].ps.palookup; goto PALONLY; } - if (ps[p].on_crane == -1 && (sector[s->sectnum].lotag&0x7ff) != 1) + if (g_player[p].ps.on_crane == -1 && (sector[s->sectnum].lotag&0x7ff) != 1) { - l = s->z-hittype[ps[p].i].floorz+(3<<8); + l = s->z-hittype[g_player[p].ps.i].floorz+(3<<8); if (l > 1024 && s->yrepeat > 32 && s->extra > 0) s->yoffset = (signed char)(l/(s->yrepeat<<2)); else s->yoffset=0; } - if (ps[p].newowner > -1) + if (g_player[p].ps.newowner > -1) { t4 = *(actorscrptr[APLAYER]+1); t3 = 0; t1 = *(actorscrptr[APLAYER]+2); } - if (ud.camerasprite == -1 && ps[p].newowner == -1) - if (s->owner >= 0 && display_mirror == 0 && ps[p].over_shoulder_on == 0) + if (ud.camerasprite == -1 && g_player[p].ps.newowner == -1) + if (s->owner >= 0 && display_mirror == 0 && g_player[p].ps.over_shoulder_on == 0) if (ud.multimode < 2 || (ud.multimode > 1 && p == screenpeek)) { t->owner = -1; @@ -6861,7 +6861,7 @@ PALONLY: t->cstat |= 4; } - if (ps[screenpeek].heat_amount > 0 && ps[screenpeek].heat_on && (badguy(s) || checkspriteflags(t->owner,SPRITE_FLAG_NVG) || s->picnum == APLAYER || s->statnum == 13)) + if (g_player[screenpeek].ps.heat_amount > 0 && g_player[screenpeek].ps.heat_on && (badguy(s) || checkspriteflags(t->owner,SPRITE_FLAG_NVG) || s->picnum == APLAYER || s->statnum == 13)) { t->pal = 6; t->shade = 0; @@ -6886,7 +6886,7 @@ PALONLY: daz = hittype[i].floorz; if ((s->z-daz) < (8<<8)) - if (ps[screenpeek].posz < daz) + if (g_player[screenpeek].ps.posz < daz) { memcpy((spritetype *)&tsprite[spritesortcnt],(spritetype *)t,sizeof(spritetype)); @@ -6918,8 +6918,8 @@ PALONLY: { int ii; - ii = getangle(tsprite[spritesortcnt].x-ps[screenpeek].posx, - tsprite[spritesortcnt].y-ps[screenpeek].posy); + ii = getangle(tsprite[spritesortcnt].x-g_player[screenpeek].ps.posx, + tsprite[spritesortcnt].y-g_player[screenpeek].ps.posy); tsprite[spritesortcnt].x += sintable[(ii+2560)&2047]>>9; tsprite[spritesortcnt].y += sintable[(ii+2048)&2047]>>9; @@ -6935,7 +6935,7 @@ PALONLY: case LASERLINE__STATIC: if (sector[t->sectnum].lotag == 2) t->pal = 8; t->z = sprite[s->owner].z-(3<<8); - if (lasermode == 2 && ps[screenpeek].heat_on == 0) + if (lasermode == 2 && g_player[screenpeek].ps.heat_on == 0) t->yrepeat = 0; case EXPLOSION2__STATIC: case EXPLOSION2BOT__STATIC: @@ -6950,7 +6950,7 @@ PALONLY: case FLOORFLAME__STATIC: if (t->picnum == EXPLOSION2) { - ps[screenpeek].visibility = -127; + g_player[screenpeek].ps.visibility = -127; lastvisinc = totalclock+32; //restorepalette = 1; // JBF 20040101: why? } @@ -7128,68 +7128,68 @@ enum cheats void CheatGetInventory(void) { - SetGameVarID(g_iReturnVarID, 400, ps[myconnectindex].i, myconnectindex); - OnEvent(EVENT_CHEATGETSTEROIDS, ps[myconnectindex].i, myconnectindex, -1); - if (GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) + SetGameVarID(g_iReturnVarID, 400, g_player[myconnectindex].ps.i, myconnectindex); + OnEvent(EVENT_CHEATGETSTEROIDS, g_player[myconnectindex].ps.i, myconnectindex, -1); + if (GetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps.i, myconnectindex) >=0) { - ps[myconnectindex].steroids_amount = - GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex); + g_player[myconnectindex].ps.steroids_amount = + GetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps.i, myconnectindex); } - SetGameVarID(g_iReturnVarID, 1200, ps[myconnectindex].i, myconnectindex); - OnEvent(EVENT_CHEATGETHEAT, ps[myconnectindex].i, myconnectindex, -1); - if (GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) + SetGameVarID(g_iReturnVarID, 1200, g_player[myconnectindex].ps.i, myconnectindex); + OnEvent(EVENT_CHEATGETHEAT, g_player[myconnectindex].ps.i, myconnectindex, -1); + if (GetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps.i, myconnectindex) >=0) { - ps[myconnectindex].heat_amount = - GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex); + g_player[myconnectindex].ps.heat_amount = + GetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps.i, myconnectindex); } - SetGameVarID(g_iReturnVarID, 200, ps[myconnectindex].i, myconnectindex); - OnEvent(EVENT_CHEATGETBOOT, ps[myconnectindex].i, myconnectindex, -1); - if (GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) + SetGameVarID(g_iReturnVarID, 200, g_player[myconnectindex].ps.i, myconnectindex); + OnEvent(EVENT_CHEATGETBOOT, g_player[myconnectindex].ps.i, myconnectindex, -1); + if (GetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps.i, myconnectindex) >=0) { - ps[myconnectindex].boot_amount = - GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex); + g_player[myconnectindex].ps.boot_amount = + GetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps.i, myconnectindex); } - SetGameVarID(g_iReturnVarID, 100, ps[myconnectindex].i, myconnectindex); - OnEvent(EVENT_CHEATGETSHIELD, ps[myconnectindex].i, myconnectindex, -1); - if (GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) + SetGameVarID(g_iReturnVarID, 100, g_player[myconnectindex].ps.i, myconnectindex); + OnEvent(EVENT_CHEATGETSHIELD, g_player[myconnectindex].ps.i, myconnectindex, -1); + if (GetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps.i, myconnectindex) >=0) { - ps[myconnectindex].shield_amount = - GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex); + g_player[myconnectindex].ps.shield_amount = + GetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps.i, myconnectindex); } - SetGameVarID(g_iReturnVarID, 6400, ps[myconnectindex].i, myconnectindex); - OnEvent(EVENT_CHEATGETSCUBA, ps[myconnectindex].i, myconnectindex, -1); - if (GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) + SetGameVarID(g_iReturnVarID, 6400, g_player[myconnectindex].ps.i, myconnectindex); + OnEvent(EVENT_CHEATGETSCUBA, g_player[myconnectindex].ps.i, myconnectindex, -1); + if (GetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps.i, myconnectindex) >=0) { - ps[myconnectindex].scuba_amount = - GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex); + g_player[myconnectindex].ps.scuba_amount = + GetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps.i, myconnectindex); } - SetGameVarID(g_iReturnVarID, 2400, ps[myconnectindex].i, myconnectindex); - OnEvent(EVENT_CHEATGETHOLODUKE, ps[myconnectindex].i, myconnectindex, -1); - if (GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) + SetGameVarID(g_iReturnVarID, 2400, g_player[myconnectindex].ps.i, myconnectindex); + OnEvent(EVENT_CHEATGETHOLODUKE, g_player[myconnectindex].ps.i, myconnectindex, -1); + if (GetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps.i, myconnectindex) >=0) { - ps[myconnectindex].holoduke_amount = - GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex); + g_player[myconnectindex].ps.holoduke_amount = + GetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps.i, myconnectindex); } - SetGameVarID(g_iReturnVarID, 1600, ps[myconnectindex].i, myconnectindex); - OnEvent(EVENT_CHEATGETJETPACK, ps[myconnectindex].i, myconnectindex, -1); - if (GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) + SetGameVarID(g_iReturnVarID, 1600, g_player[myconnectindex].ps.i, myconnectindex); + OnEvent(EVENT_CHEATGETJETPACK, g_player[myconnectindex].ps.i, myconnectindex, -1); + if (GetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps.i, myconnectindex) >=0) { - ps[myconnectindex].jetpack_amount = - GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex); + g_player[myconnectindex].ps.jetpack_amount = + GetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps.i, myconnectindex); } - SetGameVarID(g_iReturnVarID, max_player_health, ps[myconnectindex].i, myconnectindex); - OnEvent(EVENT_CHEATGETFIRSTAID, ps[myconnectindex].i, myconnectindex, -1); - if (GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex) >=0) + SetGameVarID(g_iReturnVarID, max_player_health, g_player[myconnectindex].ps.i, myconnectindex); + OnEvent(EVENT_CHEATGETFIRSTAID, g_player[myconnectindex].ps.i, myconnectindex, -1); + if (GetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps.i, myconnectindex) >=0) { - ps[myconnectindex].firstaid_amount = - GetGameVarID(g_iReturnVarID, ps[myconnectindex].i, myconnectindex); + g_player[myconnectindex].ps.firstaid_amount = + GetGameVarID(g_iReturnVarID, g_player[myconnectindex].ps.i, myconnectindex); } } @@ -7209,7 +7209,7 @@ static void cheats(void) consolecheat = 1; } - if ((ps[myconnectindex].gm&MODE_TYPE) || (ps[myconnectindex].gm&MODE_MENU)) + if ((g_player[myconnectindex].ps.gm&MODE_TYPE) || (g_player[myconnectindex].ps.gm&MODE_MENU)) return; if (VOLUMEONE && !z) @@ -7222,7 +7222,7 @@ static void cheats(void) if (consolecheat && numplayers < 2 && ud.recstat == 0) goto FOUNDCHEAT; - if (ps[myconnectindex].cheat_phase == 1) + if (g_player[myconnectindex].ps.cheat_phase == 1) { while (KB_KeyWaiting()) { @@ -7230,8 +7230,8 @@ static void cheats(void) if (!((ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9'))) { - ps[myconnectindex].cheat_phase = 0; - // FTA(46,&ps[myconnectindex]); + g_player[myconnectindex].ps.cheat_phase = 0; + // FTA(46,&g_player[myconnectindex].ps); return; } @@ -7241,7 +7241,7 @@ static void cheats(void) if (cheatbuflen > MAXCHEATLEN) { - ps[myconnectindex].cheat_phase = 0; + g_player[myconnectindex].ps.cheat_phase = 0; return; } @@ -7258,7 +7258,7 @@ static void cheats(void) } } - ps[myconnectindex].cheat_phase = 0; + g_player[myconnectindex].ps.cheat_phase = 0; return; FOUNDCHEAT: @@ -7274,34 +7274,34 @@ FOUNDCHEAT: for (weapon = PISTOL_WEAPON;weapon < MAX_WEAPONS-j;weapon++) { - addammo(weapon, &ps[myconnectindex], max_ammo_amount[weapon]); - ps[myconnectindex].gotweapon[weapon] = 1; + addammo(weapon, &g_player[myconnectindex].ps, max_ammo_amount[weapon]); + g_player[myconnectindex].ps.gotweapon[weapon] = 1; } KB_FlushKeyBoardQueue(); - ps[myconnectindex].cheat_phase = 0; - FTA(119,&ps[myconnectindex]); + g_player[myconnectindex].ps.cheat_phase = 0; + FTA(119,&g_player[myconnectindex].ps); return; case CHEAT_INVENTORY: KB_FlushKeyBoardQueue(); - ps[myconnectindex].cheat_phase = 0; + g_player[myconnectindex].ps.cheat_phase = 0; CheatGetInventory(); - FTA(120,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; + FTA(120,&g_player[myconnectindex].ps); + g_player[myconnectindex].ps.cheat_phase = 0; return; case CHEAT_KEYS: - ps[myconnectindex].got_access = 7; + g_player[myconnectindex].ps.got_access = 7; KB_FlushKeyBoardQueue(); - ps[myconnectindex].cheat_phase = 0; - FTA(121,&ps[myconnectindex]); + g_player[myconnectindex].ps.cheat_phase = 0; + FTA(121,&g_player[myconnectindex].ps); return; case CHEAT_DEBUG: debug_on = 1-debug_on; KB_FlushKeyBoardQueue(); - ps[myconnectindex].cheat_phase = 0; + g_player[myconnectindex].ps.cheat_phase = 0; dumpdebugdata(); Bsprintf(tempbuf,"GAMEVARS DUMPED TO DEBUG.CON"); @@ -7313,19 +7313,19 @@ FOUNDCHEAT: case CHEAT_CLIP: ud.clipping = 1-ud.clipping; KB_FlushKeyBoardQueue(); - ps[myconnectindex].cheat_phase = 0; - FTA(112+ud.clipping,&ps[myconnectindex]); + g_player[myconnectindex].ps.cheat_phase = 0; + FTA(112+ud.clipping,&g_player[myconnectindex].ps); return; case CHEAT_RESERVED2: - ps[myconnectindex].gm = MODE_EOL; - ps[myconnectindex].cheat_phase = 0; + g_player[myconnectindex].ps.gm = MODE_EOL; + g_player[myconnectindex].ps.cheat_phase = 0; KB_FlushKeyBoardQueue(); return; case CHEAT_ALLEN: - FTA(79,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; + FTA(79,&g_player[myconnectindex].ps); + g_player[myconnectindex].ps.cheat_phase = 0; KB_ClearKeyDown(sc_N); return; @@ -7337,33 +7337,33 @@ FOUNDCHEAT: { pus = 1; pub = 1; - sprite[ps[myconnectindex].i].cstat = 257; + sprite[g_player[myconnectindex].ps.i].cstat = 257; - hittype[ps[myconnectindex].i].temp_data[0] = 0; - hittype[ps[myconnectindex].i].temp_data[1] = 0; - hittype[ps[myconnectindex].i].temp_data[2] = 0; - hittype[ps[myconnectindex].i].temp_data[3] = 0; - hittype[ps[myconnectindex].i].temp_data[4] = 0; - hittype[ps[myconnectindex].i].temp_data[5] = 0; + hittype[g_player[myconnectindex].ps.i].temp_data[0] = 0; + hittype[g_player[myconnectindex].ps.i].temp_data[1] = 0; + hittype[g_player[myconnectindex].ps.i].temp_data[2] = 0; + hittype[g_player[myconnectindex].ps.i].temp_data[3] = 0; + hittype[g_player[myconnectindex].ps.i].temp_data[4] = 0; + hittype[g_player[myconnectindex].ps.i].temp_data[5] = 0; - sprite[ps[myconnectindex].i].hitag = 0; - sprite[ps[myconnectindex].i].lotag = 0; - sprite[ps[myconnectindex].i].pal = ps[myconnectindex].palookup; + sprite[g_player[myconnectindex].ps.i].hitag = 0; + sprite[g_player[myconnectindex].ps.i].lotag = 0; + sprite[g_player[myconnectindex].ps.i].pal = g_player[myconnectindex].ps.palookup; - FTA(17,&ps[myconnectindex]); + FTA(17,&g_player[myconnectindex].ps); } else { ud.god = 0; - sprite[ps[myconnectindex].i].extra = max_player_health; - hittype[ps[myconnectindex].i].extra = -1; - ps[myconnectindex].last_extra = max_player_health; - FTA(18,&ps[myconnectindex]); + sprite[g_player[myconnectindex].ps.i].extra = max_player_health; + hittype[g_player[myconnectindex].ps.i].extra = -1; + g_player[myconnectindex].ps.last_extra = max_player_health; + FTA(18,&g_player[myconnectindex].ps); } - sprite[ps[myconnectindex].i].extra = max_player_health; - hittype[ps[myconnectindex].i].extra = 0; - ps[myconnectindex].cheat_phase = 0; + sprite[g_player[myconnectindex].ps.i].extra = max_player_health; + hittype[g_player[myconnectindex].ps.i].extra = 0; + g_player[myconnectindex].ps.cheat_phase = 0; KB_FlushKeyBoardQueue(); return; @@ -7374,41 +7374,41 @@ FOUNDCHEAT: { pus = 1; pub = 1; - sprite[ps[myconnectindex].i].cstat = 257; + sprite[g_player[myconnectindex].ps.i].cstat = 257; - hittype[ps[myconnectindex].i].temp_data[0] = 0; - hittype[ps[myconnectindex].i].temp_data[1] = 0; - hittype[ps[myconnectindex].i].temp_data[2] = 0; - hittype[ps[myconnectindex].i].temp_data[3] = 0; - hittype[ps[myconnectindex].i].temp_data[4] = 0; - hittype[ps[myconnectindex].i].temp_data[5] = 0; + hittype[g_player[myconnectindex].ps.i].temp_data[0] = 0; + hittype[g_player[myconnectindex].ps.i].temp_data[1] = 0; + hittype[g_player[myconnectindex].ps.i].temp_data[2] = 0; + hittype[g_player[myconnectindex].ps.i].temp_data[3] = 0; + hittype[g_player[myconnectindex].ps.i].temp_data[4] = 0; + hittype[g_player[myconnectindex].ps.i].temp_data[5] = 0; - sprite[ps[myconnectindex].i].hitag = 0; - sprite[ps[myconnectindex].i].lotag = 0; - sprite[ps[myconnectindex].i].pal = ps[myconnectindex].palookup; + sprite[g_player[myconnectindex].ps.i].hitag = 0; + sprite[g_player[myconnectindex].ps.i].lotag = 0; + sprite[g_player[myconnectindex].ps.i].pal = g_player[myconnectindex].ps.palookup; Bstrcpy(fta_quotes[122],"Scream for me, Long Beach!"); - FTA(122,&ps[myconnectindex]); + FTA(122,&g_player[myconnectindex].ps); CheatGetInventory(); for (weapon = PISTOL_WEAPON;weapon < MAX_WEAPONS;weapon++) - ps[myconnectindex].gotweapon[weapon] = 1; + g_player[myconnectindex].ps.gotweapon[weapon] = 1; for (weapon = PISTOL_WEAPON; weapon < (MAX_WEAPONS); weapon++) - addammo(weapon, &ps[myconnectindex], max_ammo_amount[weapon]); - ps[myconnectindex].got_access = 7; + addammo(weapon, &g_player[myconnectindex].ps, max_ammo_amount[weapon]); + g_player[myconnectindex].ps.got_access = 7; } else { - sprite[ps[myconnectindex].i].extra = max_player_health; - hittype[ps[myconnectindex].i].extra = -1; - ps[myconnectindex].last_extra = max_player_health; - FTA(18,&ps[myconnectindex]); + sprite[g_player[myconnectindex].ps.i].extra = max_player_health; + hittype[g_player[myconnectindex].ps.i].extra = -1; + g_player[myconnectindex].ps.last_extra = max_player_health; + FTA(18,&g_player[myconnectindex].ps); } - sprite[ps[myconnectindex].i].extra = max_player_health; - hittype[ps[myconnectindex].i].extra = 0; - ps[myconnectindex].cheat_phase = 0; + sprite[g_player[myconnectindex].ps.i].extra = max_player_health; + hittype[g_player[myconnectindex].ps.i].extra = 0; + g_player[myconnectindex].ps.cheat_phase = 0; KB_FlushKeyBoardQueue(); Bstrcpy(terminx,terminx); return; @@ -7421,21 +7421,21 @@ FOUNDCHEAT: j = 6; for (weapon = PISTOL_WEAPON;weapon < MAX_WEAPONS-j;weapon++) - ps[myconnectindex].gotweapon[weapon] = 1; + g_player[myconnectindex].ps.gotweapon[weapon] = 1; for (weapon = PISTOL_WEAPON; weapon < (MAX_WEAPONS-j); weapon++) - addammo(weapon, &ps[myconnectindex], max_ammo_amount[weapon]); + addammo(weapon, &g_player[myconnectindex].ps, max_ammo_amount[weapon]); CheatGetInventory(); - ps[myconnectindex].got_access = 7; - FTA(5,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; + g_player[myconnectindex].ps.got_access = 7; + FTA(5,&g_player[myconnectindex].ps); + g_player[myconnectindex].ps.cheat_phase = 0; - // FTA(21,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; + // FTA(21,&g_player[myconnectindex].ps); + g_player[myconnectindex].ps.cheat_phase = 0; KB_FlushKeyBoardQueue(); - ps[myconnectindex].inven_icon = 1; + g_player[myconnectindex].ps.inven_icon = 1; return; case CHEAT_SCOTTY: @@ -7464,7 +7464,7 @@ FOUNDCHEAT: if ((VOLUMEONE && volnume > 0) || volnume > num_volumes-1 || levnume >= MAXLEVELS || map[volnume*MAXLEVELS+levnume].filename == NULL) { - ps[myconnectindex].cheat_phase = 0; + g_player[myconnectindex].ps.cheat_phase = 0; KB_FlushKeyBoardQueue(); return; } @@ -7486,36 +7486,36 @@ FOUNDCHEAT: } if (numplayers > 1 && myconnectindex == connecthead) mpchangemap(ud.m_volume_number,ud.m_level_number); - else ps[myconnectindex].gm |= MODE_RESTART; + else g_player[myconnectindex].ps.gm |= MODE_RESTART; - ps[myconnectindex].cheat_phase = 0; + g_player[myconnectindex].ps.cheat_phase = 0; KB_FlushKeyBoardQueue(); return; case CHEAT_COORDS: - ps[myconnectindex].cheat_phase = 0; + g_player[myconnectindex].ps.cheat_phase = 0; ud.coords = 1-ud.coords; KB_FlushKeyBoardQueue(); return; case CHEAT_VIEW: - if (ps[myconnectindex].over_shoulder_on) - ps[myconnectindex].over_shoulder_on = 0; + if (g_player[myconnectindex].ps.over_shoulder_on) + g_player[myconnectindex].ps.over_shoulder_on = 0; else { - ps[myconnectindex].over_shoulder_on = 1; + g_player[myconnectindex].ps.over_shoulder_on = 1; cameradist = 0; cameraclock = totalclock; } - FTA(22,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; + FTA(22,&g_player[myconnectindex].ps); + g_player[myconnectindex].ps.cheat_phase = 0; KB_FlushKeyBoardQueue(); return; case CHEAT_TIME: - FTA(21,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; + FTA(21,&g_player[myconnectindex].ps); + g_player[myconnectindex].ps.cheat_phase = 0; KB_FlushKeyBoardQueue(); return; @@ -7530,27 +7530,27 @@ FOUNDCHEAT: { if (j&(0xffff-16384)) sector[i].lotag &= (0xffff-16384); - operatesectors(i,ps[myconnectindex].i); + operatesectors(i,g_player[myconnectindex].ps.i); } } - operateforcefields(ps[myconnectindex].i,-1); + operateforcefields(g_player[myconnectindex].ps.i,-1); - FTA(100,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; + FTA(100,&g_player[myconnectindex].ps); + g_player[myconnectindex].ps.cheat_phase = 0; KB_FlushKeyBoardQueue(); return; case CHEAT_CASHMAN: ud.cashman = 1-ud.cashman; KB_ClearKeyDown(sc_N); - ps[myconnectindex].cheat_phase = 0; + g_player[myconnectindex].ps.cheat_phase = 0; return; case CHEAT_ITEMS: CheatGetInventory(); - ps[myconnectindex].got_access = 7; - FTA(5,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; + g_player[myconnectindex].ps.got_access = 7; + FTA(5,&g_player[myconnectindex].ps); + g_player[myconnectindex].ps.cheat_phase = 0; KB_FlushKeyBoardQueue(); return; @@ -7562,7 +7562,7 @@ FOUNDCHEAT: show2dsector[i] = 255; for (i=0;i<(MAXWALLS>>3);i++) show2dwall[i] = 255; - FTA(111,&ps[myconnectindex]); + FTA(111,&g_player[myconnectindex].ps); } else { @@ -7570,36 +7570,36 @@ FOUNDCHEAT: show2dsector[i] = 0; for (i=0;i<(MAXWALLS>>3);i++) show2dwall[i] = 0; - FTA(1,&ps[myconnectindex]); + FTA(1,&g_player[myconnectindex].ps); } - ps[myconnectindex].cheat_phase = 0; + g_player[myconnectindex].ps.cheat_phase = 0; KB_FlushKeyBoardQueue(); return; case CHEAT_TODD: - FTA(99,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; + FTA(99,&g_player[myconnectindex].ps); + g_player[myconnectindex].ps.cheat_phase = 0; KB_FlushKeyBoardQueue(); return; case CHEAT_RATE: ud.tickrate = !ud.tickrate; - ps[myconnectindex].cheat_phase = 0; + g_player[myconnectindex].ps.cheat_phase = 0; KB_FlushKeyBoardQueue(); return; case CHEAT_BETA: - FTA(105,&ps[myconnectindex]); + FTA(105,&g_player[myconnectindex].ps); KB_ClearKeyDown(sc_H); - ps[myconnectindex].cheat_phase = 0; + g_player[myconnectindex].ps.cheat_phase = 0; KB_FlushKeyBoardQueue(); return; case CHEAT_HYPER: - ps[myconnectindex].steroids_amount = 399; - ps[myconnectindex].heat_amount = 1200; - ps[myconnectindex].cheat_phase = 0; - FTA(37,&ps[myconnectindex]); + g_player[myconnectindex].ps.steroids_amount = 399; + g_player[myconnectindex].ps.heat_amount = 1200; + g_player[myconnectindex].ps.cheat_phase = 0; + FTA(37,&g_player[myconnectindex].ps); KB_FlushKeyBoardQueue(); return; @@ -7609,16 +7609,16 @@ FOUNDCHEAT: actor_tog++; if (actor_tog == 3) actor_tog = 0; - ps[screenpeek].cheat_phase = 0; + g_player[screenpeek].ps.cheat_phase = 0; Bsprintf(fta_quotes[122],"MONSTERS: %s",s[(unsigned char)actor_tog]); - FTA(122,&ps[myconnectindex]); + FTA(122,&g_player[myconnectindex].ps); KB_FlushKeyBoardQueue(); return; } case CHEAT_RESERVED: case CHEAT_RESERVED3: ud.eog = 1; - ps[myconnectindex].gm |= MODE_EOL; + g_player[myconnectindex].ps.gm |= MODE_EOL; KB_FlushKeyBoardQueue(); return; } @@ -7629,34 +7629,34 @@ FOUNDCHEAT: { if (KB_KeyPressed((unsigned char)cheatkey[0])) { - if (ps[myconnectindex].cheat_phase >= 0 && numplayers < 2 && ud.recstat == 0) + if (g_player[myconnectindex].ps.cheat_phase >= 0 && numplayers < 2 && ud.recstat == 0) { if (cheatkey[0] == cheatkey[1]) KB_ClearKeyDown((unsigned char)cheatkey[0]); - ps[myconnectindex].cheat_phase = -1; + g_player[myconnectindex].ps.cheat_phase = -1; } } if (KB_KeyPressed((unsigned char)cheatkey[1])) { - if (ps[myconnectindex].cheat_phase == -1) + if (g_player[myconnectindex].ps.cheat_phase == -1) { if (ud.player_skill == 4) { - FTA(22,&ps[myconnectindex]); - ps[myconnectindex].cheat_phase = 0; + FTA(22,&g_player[myconnectindex].ps); + g_player[myconnectindex].ps.cheat_phase = 0; } else { - ps[myconnectindex].cheat_phase = 1; - // FTA(25,&ps[myconnectindex]); + g_player[myconnectindex].ps.cheat_phase = 1; + // FTA(25,&g_player[myconnectindex].ps); cheatbuflen = 0; } KB_FlushKeyboardQueue(); } - else if (ps[myconnectindex].cheat_phase != 0) + else if (g_player[myconnectindex].ps.cheat_phase != 0) { - ps[myconnectindex].cheat_phase = 0; + g_player[myconnectindex].ps.cheat_phase = 0; KB_ClearKeyDown((unsigned char)cheatkey[0]); KB_ClearKeyDown((unsigned char)cheatkey[1]); } @@ -7697,7 +7697,7 @@ static void nonsharedkeys(void) } } - if (!ALT_IS_PRESSED && ud.overhead_on == 0 && (ps[myconnectindex].gm & MODE_TYPE) == 0) + if (!ALT_IS_PRESSED && ud.overhead_on == 0 && (g_player[myconnectindex].ps.gm & MODE_TYPE) == 0) { if (BUTTON(gamefunc_Enlarge_Screen)) { @@ -7745,7 +7745,7 @@ static void nonsharedkeys(void) } } - if (ps[myconnectindex].cheat_phase == 1 || (ps[myconnectindex].gm&(MODE_MENU|MODE_TYPE))) return; + if (g_player[myconnectindex].ps.cheat_phase == 1 || (g_player[myconnectindex].ps.gm&(MODE_MENU|MODE_TYPE))) return; if (BUTTON(gamefunc_See_Coop_View) && (GTFLAGS(GAMETYPE_FLAG_COOPVIEW) || ud.recstat == 2)) { @@ -7759,15 +7759,15 @@ static void nonsharedkeys(void) { CONTROL_ClearButton(gamefunc_Show_Opponents_Weapon); ud.showweapons = 1-ud.showweapons; - config.ShowOpponentWeapons = ud.showweapons; - FTA(82-ud.showweapons,&ps[screenpeek]); + ud.config.ShowOpponentWeapons = ud.showweapons; + FTA(82-ud.showweapons,&g_player[screenpeek].ps); } if (BUTTON(gamefunc_Toggle_Crosshair)) { CONTROL_ClearButton(gamefunc_Toggle_Crosshair); ud.crosshair = (ud.crosshair==3)?0:ud.crosshair+1; - FTA(ud.crosshair?20:21,&ps[screenpeek]); + FTA(ud.crosshair?20:21,&g_player[screenpeek].ps); } if (ud.overhead_on && BUTTON(gamefunc_Map_Follow_Mode)) @@ -7776,11 +7776,11 @@ static void nonsharedkeys(void) ud.scrollmode = 1-ud.scrollmode; if (ud.scrollmode) { - ud.folx = ps[screenpeek].oposx; - ud.foly = ps[screenpeek].oposy; - ud.fola = ps[screenpeek].oang; + ud.folx = g_player[screenpeek].ps.oposx; + ud.foly = g_player[screenpeek].ps.oposy; + ud.fola = g_player[screenpeek].ps.oang; } - FTA(83+ud.scrollmode,&ps[myconnectindex]); + FTA(83+ud.scrollmode,&g_player[myconnectindex].ps); } if (SHIFTS_IS_PRESSED || ALT_IS_PRESSED) @@ -7841,7 +7841,7 @@ static void nonsharedkeys(void) { if (SHIFTS_IS_PRESSED) { - if (i == 5 && ps[myconnectindex].fta > 0 && ps[myconnectindex].ftq == 26) + if (i == 5 && g_player[myconnectindex].ps.fta > 0 && g_player[myconnectindex].ps.ftq == 26) { i = (VOLUMEALL?MAXVOLUMES*MAXLEVELS:6); music_select++; @@ -7852,7 +7852,7 @@ static void nonsharedkeys(void) if (map[(unsigned char)music_select].musicfn != NULL) { Bsprintf(fta_quotes[26],"PLAYING %s",&map[(unsigned char)music_select].musicfn[0]); - FTA(26,&ps[myconnectindex]); + FTA(26,&g_player[myconnectindex].ps); playmusic(&map[(unsigned char)music_select].musicfn[0]); } return; @@ -7884,7 +7884,7 @@ static void nonsharedkeys(void) } if (ud.lockout == 0) - if (config.SoundToggle && ALT_IS_PRESSED && (RTS_NumSounds() > 0) && rtsplaying == 0 && config.VoiceToggle) + if (ud.config.SoundToggle && ALT_IS_PRESSED && (RTS_NumSounds() > 0) && rtsplaying == 0 && ud.config.VoiceToggle) { rtsptr = (char *)RTS_GetSound(i-1); if (*rtsptr == 'C') @@ -7920,7 +7920,7 @@ static void nonsharedkeys(void) { KB_FlushKeyboardQueue(); CONTROL_ClearButton(gamefunc_SendMessage); - ps[myconnectindex].gm |= MODE_TYPE; + g_player[myconnectindex].ps.gm |= MODE_TYPE; typebuf[0] = 0; inputloc = 0; } @@ -7961,9 +7961,9 @@ static void nonsharedkeys(void) return; FAKE_F2: - if (sprite[ps[myconnectindex].i].extra <= 0) + if (sprite[g_player[myconnectindex].ps.i].extra <= 0) { - FTA(118,&ps[myconnectindex]); + FTA(118,&g_player[myconnectindex].ps); return; } cmenu(350); @@ -7975,7 +7975,7 @@ FAKE_F2: clearsoundlocks(); // setview(0,0,xdim-1,ydim-1); - ps[myconnectindex].gm |= MODE_MENU; + g_player[myconnectindex].ps.gm |= MODE_MENU; if (ud.multimode < 2) { @@ -7997,7 +7997,7 @@ FAKE_F3: clearsoundlocks(); // setview(0,0,xdim-1,ydim-1); - ps[myconnectindex].gm |= MODE_MENU; + g_player[myconnectindex].ps.gm |= MODE_MENU; if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 0; @@ -8007,13 +8007,13 @@ FAKE_F3: } } - if (KB_KeyPressed(sc_F4) && config.FXDevice >= 0) + if (KB_KeyPressed(sc_F4) && ud.config.FXDevice >= 0) { KB_ClearKeyDown(sc_F4); FX_StopAllSounds(); clearsoundlocks(); - ps[myconnectindex].gm |= MODE_MENU; + g_player[myconnectindex].ps.gm |= MODE_MENU; if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 0; @@ -8023,7 +8023,7 @@ FAKE_F3: } - if (KB_KeyPressed(sc_F6) && (ps[myconnectindex].gm&MODE_GAME)) + if (KB_KeyPressed(sc_F6) && (g_player[myconnectindex].ps.gm&MODE_GAME)) { KB_ClearKeyDown(sc_F6); @@ -8034,9 +8034,9 @@ FAKE_F3: KB_FlushKeyboardQueue(); - if (sprite[ps[myconnectindex].i].extra <= 0) + if (sprite[g_player[myconnectindex].ps.i].extra <= 0) { - FTA(118,&ps[myconnectindex]); + FTA(118,&g_player[myconnectindex].ps); return; } screencapt = 1; @@ -8057,41 +8057,41 @@ FAKE_F3: if (KB_KeyPressed(sc_F7)) { KB_ClearKeyDown(sc_F7); - if (ps[myconnectindex].over_shoulder_on) - ps[myconnectindex].over_shoulder_on = 0; + if (g_player[myconnectindex].ps.over_shoulder_on) + g_player[myconnectindex].ps.over_shoulder_on = 0; else { - ps[myconnectindex].over_shoulder_on = 1; + g_player[myconnectindex].ps.over_shoulder_on = 1; cameradist = 0; cameraclock = totalclock; } - FTA(109+ps[myconnectindex].over_shoulder_on,&ps[myconnectindex]); + FTA(109+g_player[myconnectindex].ps.over_shoulder_on,&g_player[myconnectindex].ps); } - if (KB_KeyPressed(sc_F5) && config.MusicDevice >= 0) + if (KB_KeyPressed(sc_F5) && ud.config.MusicDevice >= 0) { KB_ClearKeyDown(sc_F5); if (map[(unsigned char)music_select].musicfn != NULL) Bstrcpy(fta_quotes[26],&map[(unsigned char)music_select].musicfn[0]); else fta_quotes[26][0] = '\0'; Bstrcat(fta_quotes[26],". USE SHIFT-F5 TO CHANGE."); - FTA(26,&ps[myconnectindex]); + FTA(26,&g_player[myconnectindex].ps); } if (KB_KeyPressed(sc_F8)) { KB_ClearKeyDown(sc_F8); ud.fta_on = !ud.fta_on; - if (ud.fta_on) FTA(23,&ps[myconnectindex]); + if (ud.fta_on) FTA(23,&g_player[myconnectindex].ps); else { ud.fta_on = 1; - FTA(24,&ps[myconnectindex]); + FTA(24,&g_player[myconnectindex].ps); ud.fta_on = 0; } } - if (KB_KeyPressed(sc_F9) && (ps[myconnectindex].gm&MODE_GAME)) + if (KB_KeyPressed(sc_F9) && (g_player[myconnectindex].ps.gm&MODE_GAME)) { KB_ClearKeyDown(sc_F9); @@ -8109,13 +8109,13 @@ FAKE_F3: if (ud.multimode > 1) { loadplayer(-1-lastsavedpos); - ps[myconnectindex].gm = MODE_GAME; + g_player[myconnectindex].ps.gm = MODE_GAME; } else { i = loadplayer(lastsavedpos); if (i == 0) - ps[myconnectindex].gm = MODE_GAME; + g_player[myconnectindex].ps.gm = MODE_GAME; } } } @@ -8126,7 +8126,7 @@ FAKE_F3: cmenu(500); FX_StopAllSounds(); clearsoundlocks(); - ps[myconnectindex].gm |= MODE_MENU; + g_player[myconnectindex].ps.gm |= MODE_MENU; if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 0; @@ -8140,19 +8140,19 @@ FAKE_F3: j = totalclock-nonsharedtimer; nonsharedtimer += j; if (BUTTON(gamefunc_Enlarge_Screen)) - ps[myconnectindex].zoom += mulscale6(j,max(ps[myconnectindex].zoom,256)); + g_player[myconnectindex].ps.zoom += mulscale6(j,max(g_player[myconnectindex].ps.zoom,256)); if (BUTTON(gamefunc_Shrink_Screen)) - ps[myconnectindex].zoom -= mulscale6(j,max(ps[myconnectindex].zoom,256)); + g_player[myconnectindex].ps.zoom -= mulscale6(j,max(g_player[myconnectindex].ps.zoom,256)); - if ((ps[myconnectindex].zoom > 2048)) - ps[myconnectindex].zoom = 2048; - if ((ps[myconnectindex].zoom < 48)) - ps[myconnectindex].zoom = 48; + if ((g_player[myconnectindex].ps.zoom > 2048)) + g_player[myconnectindex].ps.zoom = 2048; + if ((g_player[myconnectindex].ps.zoom < 48)) + g_player[myconnectindex].ps.zoom = 48; } } - if (KB_KeyPressed(sc_Escape) && ud.overhead_on && ps[myconnectindex].newowner == -1) + if (KB_KeyPressed(sc_Escape) && ud.overhead_on && g_player[myconnectindex].ps.newowner == -1) { KB_ClearKeyDown(sc_Escape); ud.last_overhead = ud.overhead_on; @@ -8165,8 +8165,8 @@ FAKE_F3: { CONTROL_ClearButton(gamefunc_AutoRun); ud.auto_run = 1-ud.auto_run; - config.RunMode = ud.auto_run; - FTA(85+ud.auto_run,&ps[myconnectindex]); + ud.config.RunMode = ud.auto_run; + FTA(85+ud.auto_run,&g_player[myconnectindex].ps); } if (BUTTON(gamefunc_Map)) @@ -8198,9 +8198,9 @@ FAKE_F3: else if (ud.brightness < 0) ud.brightness = (7<<3); - setbrightness(ud.brightness>>2,&ps[myconnectindex].palette[0],0); - if (ud.brightness < 40) FTA(29 + (ud.brightness>>3) ,&ps[myconnectindex]); - else if (ud.brightness < 80) FTA(96 + (ud.brightness>>3) - 5,&ps[myconnectindex]); + setbrightness(ud.brightness>>2,&g_player[myconnectindex].ps.palette[0],0); + if (ud.brightness < 40) FTA(29 + (ud.brightness>>3) ,&g_player[myconnectindex].ps); + else if (ud.brightness < 80) FTA(96 + (ud.brightness>>3) - 5,&g_player[myconnectindex].ps); } } @@ -8615,16 +8615,16 @@ static void checkcommandline(int argc,const char **argv) ud.warp_on = 0; ud.cashman = 0; ud.m_player_skill = ud.player_skill = 2; - ud.wchoice[0][0] = 3; - ud.wchoice[0][1] = 4; - ud.wchoice[0][2] = 5; - ud.wchoice[0][3] = 7; - ud.wchoice[0][4] = 8; - ud.wchoice[0][5] = 6; - ud.wchoice[0][6] = 0; - ud.wchoice[0][7] = 2; - ud.wchoice[0][8] = 9; - ud.wchoice[0][9] = 1; + g_player[0].wchoice[0] = 3; + g_player[0].wchoice[1] = 4; + g_player[0].wchoice[2] = 5; + g_player[0].wchoice[3] = 7; + g_player[0].wchoice[4] = 8; + g_player[0].wchoice[5] = 6; + g_player[0].wchoice[6] = 0; + g_player[0].wchoice[7] = 2; + g_player[0].wchoice[8] = 9; + g_player[0].wchoice[9] = 1; if (argc > 1) { @@ -8989,16 +8989,16 @@ static void checkcommandline(int argc,const char **argv) initprintf("Using favorite weapon order(s).\n"); while (*c) { - ud.wchoice[0][j] = *c-'0'; + g_player[0].wchoice[j] = *c-'0'; c++; j++; } while (j < 10) { if (j == 9) - ud.wchoice[0][9] = 1; + g_player[0].wchoice[9] = 1; else - ud.wchoice[0][j] = 2; + g_player[0].wchoice[j] = 2; j++; } @@ -9006,16 +9006,16 @@ static void checkcommandline(int argc,const char **argv) else { initprintf("Using default weapon orders.\n"); - ud.wchoice[0][0] = 3; - ud.wchoice[0][1] = 4; - ud.wchoice[0][2] = 5; - ud.wchoice[0][3] = 7; - ud.wchoice[0][4] = 8; - ud.wchoice[0][5] = 6; - ud.wchoice[0][6] = 0; - ud.wchoice[0][7] = 2; - ud.wchoice[0][8] = 9; - ud.wchoice[0][9] = 1; + g_player[0].wchoice[0] = 3; + g_player[0].wchoice[1] = 4; + g_player[0].wchoice[2] = 5; + g_player[0].wchoice[3] = 7; + g_player[0].wchoice[4] = 8; + g_player[0].wchoice[5] = 6; + g_player[0].wchoice[6] = 0; + g_player[0].wchoice[7] = 2; + g_player[0].wchoice[8] = 9; + g_player[0].wchoice[9] = 1; } break; case 'v': @@ -9114,11 +9114,11 @@ static void Logo(void) if (!NAM) { fadepal(0,0,0, 0,64,7); - //ps[myconnectindex].palette = drealms; + //g_player[myconnectindex].ps.palette = drealms; //palto(0,0,0,63); if (logoflags & LOGO_FLAG_3DRSCREEN) { - setgamepalette(&ps[myconnectindex], drealms, 11); // JBF 20040308 + setgamepalette(&g_player[myconnectindex].ps, drealms, 11); // JBF 20040308 rotatesprite(0,0,65536L,0,DREALMS,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); nextpage(); fadepal(0,0,0, 63,0,-7); @@ -9129,7 +9129,7 @@ static void Logo(void) getpackets(); if (restorepalette) { - setgamepalette(&ps[myconnectindex],ps[myconnectindex].palette,0); + setgamepalette(&g_player[myconnectindex].ps,g_player[myconnectindex].ps.palette,0); restorepalette = 0; } } @@ -9143,8 +9143,8 @@ static void Logo(void) nextpage(); if (logoflags & LOGO_FLAG_TITLESCREEN) { - //ps[myconnectindex].palette = titlepal; - setgamepalette(&ps[myconnectindex], titlepal, 11); // JBF 20040308 + //g_player[myconnectindex].ps.palette = titlepal; + setgamepalette(&g_player[myconnectindex].ps, titlepal, 11); // JBF 20040308 flushperms(); rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16+64,0,0,xdim-1,ydim-1); KB_FlushKeyboardQueue(); @@ -9213,7 +9213,7 @@ static void Logo(void) getpackets(); if (restorepalette) { - setgamepalette(&ps[myconnectindex],ps[myconnectindex].palette,0); + setgamepalette(&g_player[myconnectindex].ps,g_player[myconnectindex].ps.palette,0); restorepalette = 0; } nextpage(); @@ -9225,7 +9225,7 @@ static void Logo(void) if (ud.multimode > 1) { - setgamepalette(&ps[myconnectindex], titlepal, 11); + setgamepalette(&g_player[myconnectindex].ps, titlepal, 11); rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16+64,0,0,xdim-1,ydim-1); rotatesprite(160<<16,(104)<<16,60<<10,0,DUKENUKEM,0,0,2+8,0,0,xdim-1,ydim-1); @@ -9243,8 +9243,8 @@ static void Logo(void) clearview(0L); nextpage(); - //ps[myconnectindex].palette = palette; - setgamepalette(&ps[myconnectindex], palette, 0); // JBF 20040308 + //g_player[myconnectindex].ps.palette = palette; + setgamepalette(&g_player[myconnectindex].ps, palette, 0); // JBF 20040308 sound(NITEVISION_ONOFF); //palto(0,0,0,0); @@ -9467,8 +9467,8 @@ static void Startup(long argc, const char **argv) if (ud.multimode > 1) sanitizegametype(); - if (g_NoSound) config.SoundToggle = 0; - if (g_NoMusic) config.MusicToggle = 0; + if (g_NoSound) ud.config.SoundToggle = 0; + if (g_NoMusic) ud.config.MusicToggle = 0; if (CommandName) { @@ -9536,12 +9536,12 @@ static void Startup(long argc, const char **argv) CONFIG_SetupMouse(); CONFIG_SetupJoystick(); - CONTROL_JoystickEnabled = (config.UseJoystick && CONTROL_JoyPresent); - CONTROL_MouseEnabled = (config.UseMouse && CONTROL_MousePresent); + CONTROL_JoystickEnabled = (ud.config.UseJoystick && CONTROL_JoyPresent); + CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent); // JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too for (i=0;i=0;i=connectpoint2[i]) @@ -9640,12 +9640,12 @@ static void sendplayerupdate(void) for (i=0;myname[i];i++) buf[l++] = Btoupper(myname[i]); buf[l++] = 0; - buf[l++] = ps[myconnectindex].aim_mode = ud.mouseaiming; - buf[l++] = ps[myconnectindex].auto_aim = config.AutoAim; - buf[l++] = ps[myconnectindex].weaponswitch = ud.weaponswitch; - buf[l++] = ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = ud.color; + buf[l++] = g_player[myconnectindex].ps.aim_mode = ud.mouseaiming; + buf[l++] = g_player[myconnectindex].ps.auto_aim = ud.config.AutoAim; + buf[l++] = g_player[myconnectindex].ps.weaponswitch = ud.weaponswitch; + buf[l++] = g_player[myconnectindex].ps.palookup = g_player[myconnectindex].pcolor = ud.color; - buf[l++] = ud.pteam[myconnectindex] = ud.team; + buf[l++] = g_player[myconnectindex].pteam = ud.team; for (i=connecthead;i>=0;i=connectpoint2[i]) { @@ -9707,7 +9707,7 @@ static void getnames(void) int l; for (l=0;(unsigned)l 1) { @@ -9730,27 +9730,27 @@ void updateplayer(void) return; for (l=0;(unsigned)l 1) { sendplayerupdate(); - if (sprite[ps[myconnectindex].i].picnum == APLAYER && sprite[ps[myconnectindex].i].pal != 1) - sprite[ps[myconnectindex].i].pal = ud.pcolor[myconnectindex]; + if (sprite[g_player[myconnectindex].ps.i].picnum == APLAYER && sprite[g_player[myconnectindex].ps.i].pal != 1) + sprite[g_player[myconnectindex].ps.i].pal = g_player[myconnectindex].pcolor; } else { int j; - ps[myconnectindex].aim_mode = ud.mouseaiming; - ps[myconnectindex].auto_aim = config.AutoAim; - ps[myconnectindex].weaponswitch = ud.weaponswitch; - ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = ud.color; - j = ps[myconnectindex].team; - ud.pteam[myconnectindex] = ud.team; + g_player[myconnectindex].ps.aim_mode = ud.mouseaiming; + g_player[myconnectindex].ps.auto_aim = ud.config.AutoAim; + g_player[myconnectindex].ps.weaponswitch = ud.weaponswitch; + g_player[myconnectindex].ps.palookup = g_player[myconnectindex].pcolor = ud.color; + j = g_player[myconnectindex].ps.team; + g_player[myconnectindex].pteam = ud.team; - if (sprite[ps[myconnectindex].i].picnum == APLAYER && sprite[ps[myconnectindex].i].pal != 1) - sprite[ps[myconnectindex].i].pal = ud.pcolor[myconnectindex]; + if (sprite[g_player[myconnectindex].ps.i].picnum == APLAYER && sprite[g_player[myconnectindex].ps.i].pal != 1) + sprite[g_player[myconnectindex].ps.i].pal = g_player[myconnectindex].pcolor; } } @@ -9796,7 +9796,7 @@ void backtomenu(void) boardfilename[0] = 0; if (ud.recstat == 1) closedemowrite(); ud.warp_on = 0; - ps[myconnectindex].gm = MODE_MENU; + g_player[myconnectindex].ps.gm = MODE_MENU; cmenu(0); KB_FlushKeyboardQueue(); if (VOLUMEALL) wm_setapptitle(HEAD2); @@ -9914,7 +9914,7 @@ void app_main(int argc,const char **argv) #endif #ifdef _WIN32 - config.CheckForUpdates = -1; + ud.config.CheckForUpdates = -1; #endif i = CONFIG_ReadSetup(); @@ -9928,28 +9928,28 @@ void app_main(int argc,const char **argv) "on your hard disk to store textures in your video card's native format, enabling them to load dramatically " "faster after the first time they are loaded.\n\n" "You will generally want to say 'yes' here, especially if using the HRP."); - if (i) config.useprecache = glusetexcompr = glusetexcache = glusetexcachecompression = 1; + if (i) ud.config.useprecache = glusetexcompr = glusetexcache = glusetexcachecompression = 1; else glusetexcache = glusetexcachecompression = 0; } #endif #ifdef _WIN32 - if (config.CheckForUpdates == -1) + if (ud.config.CheckForUpdates == -1) { i=wm_ynbox("Automatic Release Notification", "Would you like EDuke32 to automatically check for new releases " "at startup?"); - config.CheckForUpdates = 0; - if (i) config.CheckForUpdates = 1; + ud.config.CheckForUpdates = 0; + if (i) ud.config.CheckForUpdates = 1; } - if (config.CheckForUpdates == 1) + if (ud.config.CheckForUpdates == 1) { - if (time(NULL) - config.LastUpdateCheck > UPDATEINTERVAL) + if (time(NULL) - ud.config.LastUpdateCheck > UPDATEINTERVAL) { if (getversionfromwebsite(tempbuf)) { - config.LastUpdateCheck = time(NULL); + ud.config.LastUpdateCheck = time(NULL); if (atol(tempbuf) > BUILDDATE) { @@ -10017,7 +10017,7 @@ void app_main(int argc,const char **argv) } #if (defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2)) - if (i < 0 || (!g_NoSetup && config.ForceSetup) || g_CommandSetup) + if (i < 0 || (!g_NoSetup && ud.config.ForceSetup) || g_CommandSetup) { if (quitevent || !startwin_run()) { @@ -10131,10 +10131,10 @@ void app_main(int argc,const char **argv) i = 1; for (j=numplayers;j>2,&ps[myconnectindex].palette[0],0); + setbrightness(ud.brightness>>2,&g_player[myconnectindex].ps.palette[0],0); // ESCESCAPE; @@ -10249,9 +10249,9 @@ void app_main(int argc,const char **argv) if (ud.warp_on > 1 && ud.multimode < 2) { clearview(0L); - //ps[myconnectindex].palette = palette; + //g_player[myconnectindex].ps.palette = palette; //palto(0,0,0,0); - setgamepalette(&ps[myconnectindex], palette, 0); // JBF 20040308 + setgamepalette(&g_player[myconnectindex].ps, palette, 0); // JBF 20040308 rotatesprite(320<<15,200<<15,65536L,0,LOADSCREEN,0,0,2+8+64,0,0,xdim-1,ydim-1); menutext(160,105,0,0,"LOADING SAVED GAME..."); nextpage(); @@ -10305,25 +10305,25 @@ MAIN_LOOP_RESTART: goto MAIN_LOOP_RESTART; } - ud.auto_run = config.RunMode; - ud.showweapons = config.ShowOpponentWeapons; - ps[myconnectindex].aim_mode = ud.mouseaiming; - ps[myconnectindex].auto_aim = config.AutoAim; - ps[myconnectindex].weaponswitch = ud.weaponswitch; - ud.pteam[myconnectindex] = ud.team; + ud.auto_run = ud.config.RunMode; + ud.showweapons = ud.config.ShowOpponentWeapons; + g_player[myconnectindex].ps.aim_mode = ud.mouseaiming; + g_player[myconnectindex].ps.auto_aim = ud.config.AutoAim; + g_player[myconnectindex].ps.weaponswitch = ud.weaponswitch; + g_player[myconnectindex].pteam = ud.team; if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) - ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = getteampal(ud.pteam[myconnectindex]); + g_player[myconnectindex].ps.palookup = g_player[myconnectindex].pcolor = getteampal(g_player[myconnectindex].pteam); else { - if (ud.color) ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = ud.color; - else ps[myconnectindex].palookup = ud.pcolor[myconnectindex]; + if (ud.color) g_player[myconnectindex].ps.palookup = g_player[myconnectindex].pcolor = ud.color; + else g_player[myconnectindex].ps.palookup = g_player[myconnectindex].pcolor; } ud.warp_on = 0; KB_KeyDown[sc_Pause] = 0; // JBF: I hate the pause key - while (!(ps[myconnectindex].gm&MODE_END)) //The whole loop!!!!!!!!!!!!!!!!!! + while (!(g_player[myconnectindex].ps.gm&MODE_END)) //The whole loop!!!!!!!!!!!!!!!!!! { if (handleevents()) { @@ -10339,13 +10339,13 @@ MAIN_LOOP_RESTART: OSD_DispatchQueued(); - if (ud.recstat == 2 || ud.multimode > 1 || (ud.show_help == 0 && (ps[myconnectindex].gm&MODE_MENU) != MODE_MENU)) - if (ps[myconnectindex].gm&MODE_GAME) + if (ud.recstat == 2 || ud.multimode > 1 || (ud.show_help == 0 && (g_player[myconnectindex].ps.gm&MODE_MENU) != MODE_MENU)) + if (g_player[myconnectindex].ps.gm&MODE_GAME) if (moveloop()) continue; - if (ps[myconnectindex].gm&MODE_EOL || ps[myconnectindex].gm&MODE_RESTART) + if (g_player[myconnectindex].ps.gm&MODE_EOL || g_player[myconnectindex].ps.gm&MODE_RESTART) { - if (ps[myconnectindex].gm&MODE_EOL) + if (g_player[myconnectindex].ps.gm&MODE_EOL) { closedemowrite(); @@ -10368,7 +10368,7 @@ MAIN_LOOP_RESTART: { doorders(); } - ps[myconnectindex].gm = MODE_MENU; + g_player[myconnectindex].ps.gm = MODE_MENU; cmenu(0); probey = 0; goto MAIN_LOOP_RESTART; @@ -10382,8 +10382,8 @@ MAIN_LOOP_RESTART: } display_bonus_screen = 1; ready2send = 0; - if (numplayers > 1) ps[myconnectindex].gm = MODE_GAME; - if (enterlevel(ps[myconnectindex].gm)) + if (numplayers > 1) g_player[myconnectindex].ps.gm = MODE_GAME; + if (enterlevel(g_player[myconnectindex].ps.gm)) { backtomenu(); goto MAIN_LOOP_RESTART; @@ -10394,7 +10394,7 @@ MAIN_LOOP_RESTART: cheats(); nonsharedkeys(); - if ((ud.show_help == 0 && ud.multimode < 2 && !(ps[myconnectindex].gm&MODE_MENU)) || ud.multimode > 1 || ud.recstat == 2) + if ((ud.show_help == 0 && ud.multimode < 2 && !(g_player[myconnectindex].ps.gm&MODE_MENU)) || ud.multimode > 1 || ud.recstat == 2) i = min(max((totalclock-ototalclock)*(65536L/TICSPERFRAME),0),65536); else i = 65536; @@ -10410,7 +10410,7 @@ MAIN_LOOP_RESTART: if (gotvote[myconnectindex] == 0 && voting != -1 && voting != myconnectindex) { - Bsprintf(tempbuf,"%s^00 HAS CALLED A VOTE FOR MAP",ud.user_name[voting]); + Bsprintf(tempbuf,"%s^00 HAS CALLED A VOTE FOR MAP",g_player[voting].user_name); gametext(160,40,tempbuf,0,2+8+16); Bsprintf(tempbuf,"%s (E%dL%d)",map[vote_episode*MAXLEVELS + vote_map].name,vote_episode+1,vote_map+1); gametext(160,48,tempbuf,0,2+8+16); @@ -10423,7 +10423,7 @@ MAIN_LOOP_RESTART: // addplayer(); // } - if (ps[myconnectindex].gm&MODE_DEMO) + if (g_player[myconnectindex].ps.gm&MODE_DEMO) goto MAIN_LOOP_RESTART; if (debug_on) caches(); @@ -10432,13 +10432,13 @@ MAIN_LOOP_RESTART: if (VOLUMEONE) { - if (ud.show_help == 0 && show_shareware > 0 && (ps[myconnectindex].gm&MODE_MENU) == 0) + if (ud.show_help == 0 && show_shareware > 0 && (g_player[myconnectindex].ps.gm&MODE_MENU) == 0) rotatesprite((320-50)<<16,9<<16,65536L,0,BETAVERSION,0,0,2+8+16+128,0,0,xdim-1,ydim-1); } nextpage(); - while (!(ps[myconnectindex].gm&MODE_MENU) && ready2send && totalclock >= ototalclock+TICSPERFRAME) + while (!(g_player[myconnectindex].ps.gm&MODE_MENU) && ready2send && totalclock >= ototalclock+TICSPERFRAME) faketimerhandler(); } @@ -10512,8 +10512,6 @@ static int opendemoread(int which_demo) // 0 = mine OSD_Printf("ud.m_respawn_inventory: %d\n",ud.m_respawn_inventory); if (kread(recfilep,(int32 *)&ud.playerai,sizeof(int32)) != sizeof(int32)) goto corrupt; OSD_Printf("ud.playerai: %d\n",ud.playerai); - if (kread(recfilep,(char *)&ud.user_name[0][0],sizeof(ud.user_name)) != sizeof(ud.user_name)) goto corrupt; - OSD_Printf("ud.user_name: %s\n",ud.user_name); if (kread(recfilep,(int32 *)&i,sizeof(int32)) != sizeof(int32)) goto corrupt; if (kread(recfilep,(char *)boardfilename,sizeof(boardfilename)) != sizeof(boardfilename)) goto corrupt; @@ -10528,13 +10526,15 @@ static int opendemoread(int which_demo) // 0 = mine for (i=0;i=0;i=connectpoint2[i]) { - copybufbyte(&sync[i],&recsync[ud.reccnt],sizeof(input)); + copybufbyte(&g_player[i].sync,&recsync[ud.reccnt],sizeof(input)); ud.reccnt++; totalreccnt++; if (ud.reccnt >= RECSYNCBUFSIZ) @@ -10638,7 +10638,7 @@ static long playback(void) RECHECK: - in_menu = ps[myconnectindex].gm&MODE_MENU; + in_menu = g_player[myconnectindex].ps.gm&MODE_MENU; pub = NUMPAGES; pus = NUMPAGES; @@ -10655,10 +10655,10 @@ RECHECK: goto RECHECK; } fadepal(0,0,0, 0,63,7); - setgamepalette(&ps[myconnectindex], palette, 1); // JBF 20040308 + setgamepalette(&g_player[myconnectindex].ps, palette, 1); // JBF 20040308 drawbackground(); menus(); - //ps[myconnectindex].palette = palette; + //g_player[myconnectindex].ps.palette = palette; nextpage(); fadepal(0,0,0, 63,0,-7); ud.reccnt = 0; @@ -10675,7 +10675,7 @@ RECHECK: { FX_StopAllSounds(); clearsoundlocks(); - ps[myconnectindex].gm |= MODE_MENU; + g_player[myconnectindex].ps.gm |= MODE_MENU; } ready2send = 0; @@ -10700,15 +10700,15 @@ RECHECK: foundemo = 0; ud.reccnt = 0; kclose(recfilep); - ps[myconnectindex].gm |= MODE_MENU; + g_player[myconnectindex].ps.gm |= MODE_MENU; goto RECHECK; } } for (j=connecthead;j>=0;j=connectpoint2[j]) { - copybufbyte(&recsync[i],&inputfifo[movefifoend[j]&(MOVEFIFOSIZ-1)][j],sizeof(input)); - movefifoend[j]++; + copybufbyte(&recsync[i],&inputfifo[g_player[j].movefifoend&(MOVEFIFOSIZ-1)][j],sizeof(input)); + g_player[j].movefifoend++; i++; ud.reccnt--; } @@ -10725,31 +10725,31 @@ RECHECK: displayrooms(screenpeek,j); displayrest(j); - if (ud.multimode > 1 && ps[myconnectindex].gm) + if (ud.multimode > 1 && g_player[myconnectindex].ps.gm) getpackets(); if (gotvote[myconnectindex] == 0 && voting != -1 && voting != myconnectindex) gametext(160,60,"PRESS F1 TO VOTE YES, F2 TO VOTE NO",0,2+8+16); } - if ((ps[myconnectindex].gm&MODE_MENU) && (ps[myconnectindex].gm&MODE_EOL)) + if ((g_player[myconnectindex].ps.gm&MODE_MENU) && (g_player[myconnectindex].ps.gm&MODE_EOL)) goto RECHECK; - if (KB_KeyPressed(sc_Escape) && (ps[myconnectindex].gm&MODE_MENU) == 0 && (ps[myconnectindex].gm&MODE_TYPE) == 0) + if (KB_KeyPressed(sc_Escape) && (g_player[myconnectindex].ps.gm&MODE_MENU) == 0 && (g_player[myconnectindex].ps.gm&MODE_TYPE) == 0) { KB_ClearKeyDown(sc_Escape); FX_StopAllSounds(); clearsoundlocks(); - ps[myconnectindex].gm |= MODE_MENU; + g_player[myconnectindex].ps.gm |= MODE_MENU; cmenu(0); intomenusounds(); } - if (ps[myconnectindex].gm&MODE_TYPE) + if (g_player[myconnectindex].ps.gm&MODE_TYPE) { typemode(); - if ((ps[myconnectindex].gm&MODE_TYPE) != MODE_TYPE) - ps[myconnectindex].gm = MODE_MENU; + if ((g_player[myconnectindex].ps.gm&MODE_TYPE) != MODE_TYPE) + g_player[myconnectindex].ps.gm = MODE_MENU; } else { @@ -10763,7 +10763,7 @@ RECHECK: { KB_FlushKeyboardQueue(); CONTROL_ClearButton(gamefunc_SendMessage); - ps[myconnectindex].gm = MODE_TYPE; + g_player[myconnectindex].ps.gm = MODE_TYPE; typebuf[0] = 0; inputloc = 0; } @@ -10780,14 +10780,14 @@ RECHECK: if (VOLUMEONE) { - if (ud.show_help == 0 && (ps[myconnectindex].gm&MODE_MENU) == 0) + if (ud.show_help == 0 && (g_player[myconnectindex].ps.gm&MODE_MENU) == 0) rotatesprite((320-50)<<16,9<<16,65536L,0,BETAVERSION,0,0,2+8+16+128,0,0,xdim-1,ydim-1); } handleevents(); getpackets(); nextpage(); - if (ps[myconnectindex].gm==MODE_END || ps[myconnectindex].gm==MODE_GAME) + if (g_player[myconnectindex].ps.gm==MODE_END || g_player[myconnectindex].ps.gm==MODE_GAME) { if (foundemo) kclose(recfilep); @@ -10810,7 +10810,7 @@ RECHECK: } #endif - if (ps[myconnectindex].gm&MODE_MENU) goto RECHECK; + if (g_player[myconnectindex].ps.gm&MODE_MENU) goto RECHECK; return 1; } @@ -10819,15 +10819,15 @@ static int moveloop() int i; if (numplayers > 1) - while (fakemovefifoplc < movefifoend[myconnectindex]) fakedomovethings(); + while (fakemovefifoplc < g_player[myconnectindex].movefifoend) fakedomovethings(); getpackets(); if (numplayers < 2) bufferjitter = 0; - while (movefifoend[myconnectindex]-movefifoplc > bufferjitter) + while (g_player[myconnectindex].movefifoend-movefifoplc > bufferjitter) { for (i=connecthead;i>=0;i=connectpoint2[i]) - if (movefifoplc == movefifoend[i]) break; + if (movefifoplc == g_player[i].movefifoend) break; if (i >= 0) break; if (domovethings()) return 1; } @@ -10837,12 +10837,12 @@ static int moveloop() static void fakedomovethingscorrect(void) { long i; - struct player_struct *p; + player_struct *p; if (numplayers < 2) return; i = ((movefifoplc-1)&(MOVEFIFOSIZ-1)); - p = &ps[myconnectindex]; + p = &g_player[myconnectindex].ps; if (p->posx == myxbak[i] && p->posy == myybak[i] && p->posz == myzbak[i] && p->horiz == myhorizbak[i] && p->ang == myangbak[i]) return; @@ -10870,14 +10870,14 @@ static void fakedomovethingscorrect(void) myreturntocenter = p->return_to_center; fakemovefifoplc = movefifoplc; - while (fakemovefifoplc < movefifoend[myconnectindex]) + while (fakemovefifoplc < g_player[myconnectindex].movefifoend) fakedomovethings(); } static void fakedomovethings(void) { input *syn; - struct player_struct *p; + player_struct *p; long i, j, k, doubvel, fz, cz, hz, lz, x, y; unsigned long sb_snum; short psect, psectlotag, tempsect, backcstat; @@ -10885,7 +10885,7 @@ static void fakedomovethings(void) syn = (input *)&inputfifo[fakemovefifoplc&(MOVEFIFOSIZ-1)][myconnectindex]; - p = &ps[myconnectindex]; + p = &g_player[myconnectindex].ps; backcstat = sprite[p->i].cstat; sprite[p->i].cstat &= ~257; @@ -11300,7 +11300,7 @@ FAKEHORIZONLY: ENDFAKEPROCESSINPUT: - OnEvent(EVENT_FAKEDOMOVETHINGS, ps[myconnectindex].i, myconnectindex, -1); + OnEvent(EVENT_FAKEDOMOVETHINGS, g_player[myconnectindex].ps.i, myconnectindex, -1); myxbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myx; myybak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myy; @@ -11318,11 +11318,11 @@ static int domovethings(void) char ch; for (i=connecthead;i>=0;i=connectpoint2[i]) - if (sync[i].bits&(1<<17)) + if (g_player[i].sync.bits&(1<<17)) { multiflag = 2; - multiwhat = (sync[i].bits>>18)&1; - multipos = (unsigned)(sync[i].bits>>19)&15; + multiwhat = (g_player[i].sync.bits>>18)&1; + multipos = (unsigned)(g_player[i].sync.bits>>19)&15; multiwho = i; if (multiwhat) @@ -11332,13 +11332,13 @@ static int domovethings(void) if (multiwho != myconnectindex) { - Bsprintf(fta_quotes[122],"%s^00 SAVED A MULTIPLAYER GAME",&ud.user_name[multiwho][0]); - FTA(122,&ps[myconnectindex]); + Bsprintf(fta_quotes[122],"%s^00 SAVED A MULTIPLAYER GAME",&g_player[multiwho].user_name[0]); + FTA(122,&g_player[myconnectindex].ps); } else { Bstrcpy(fta_quotes[122],"MULTIPLAYER GAME SAVED"); - FTA(122,&ps[myconnectindex]); + FTA(122,&g_player[myconnectindex].ps); } break; } @@ -11354,13 +11354,13 @@ static int domovethings(void) { if (multiwho != myconnectindex) { - Bsprintf(fta_quotes[122],"%s^00 LOADED A MULTIPLAYER GAME",&ud.user_name[multiwho][0]); - FTA(122,&ps[myconnectindex]); + Bsprintf(fta_quotes[122],"%s^00 LOADED A MULTIPLAYER GAME",&g_player[multiwho].user_name[0]); + FTA(122,&g_player[myconnectindex].ps); } else { Bstrcpy(fta_quotes[122],"MULTIPLAYER GAME LOADED"); - FTA(122,&ps[myconnectindex]); + FTA(122,&g_player[myconnectindex].ps); } return 1; } @@ -11386,29 +11386,29 @@ static int domovethings(void) short sect,hw,hs; for (i=0;i 2) ps[screenpeek].fta -= 3; + else if (g_player[screenpeek].ps.fta > 2) g_player[screenpeek].ps.fta -= 3; } } @@ -11425,7 +11425,7 @@ static int domovethings(void) everyothertime++; for (i=connecthead;i>=0;i=connectpoint2[i]) - copybufbyte(&inputfifo[movefifoplc&(MOVEFIFOSIZ-1)][i],&sync[i],sizeof(input)); + copybufbyte(&inputfifo[movefifoplc&(MOVEFIFOSIZ-1)][i],&g_player[i].sync,sizeof(input)); movefifoplc++; updateinterpolations(); @@ -11433,7 +11433,7 @@ static int domovethings(void) j = -1; for (i=connecthead;i>=0;i=connectpoint2[i]) { - if ((sync[i].bits&(1<<26)) == 0) + if ((g_player[i].sync.bits&(1<<26)) == 0) { j = i; continue; @@ -11461,10 +11461,10 @@ static int domovethings(void) pus = NUMPAGES; vscrn(); - quickkill(&ps[i]); - deletesprite(ps[i].i); + quickkill(&g_player[i].ps); + deletesprite(g_player[i].ps.i); - Bsprintf(buf,"%s^00 is history!",ud.user_name[i]); + Bsprintf(buf,"%s^00 is history!",g_player[i].user_name); adduserquote(buf); Bstrcpy(fta_quotes[116],buf); @@ -11475,7 +11475,7 @@ static int domovethings(void) voting = -1; } - ps[myconnectindex].ftq = 116, ps[myconnectindex].fta = 180; + g_player[myconnectindex].ps.ftq = 116, g_player[myconnectindex].ps.fta = 180; if (j < 0 && networkmode == 0) gameexit("The server/master player just quit the game; disconnected."); @@ -11485,9 +11485,9 @@ static int domovethings(void) { ch = (char)(randomseed&255); for (i=connecthead;i>=0;i=connectpoint2[i]) - ch += ((ps[i].posx+ps[i].posy+ps[i].posz+ps[i].ang+ps[i].horiz)&255); - syncval[myconnectindex][syncvalhead[myconnectindex]&(MOVEFIFOSIZ-1)] = ch; - syncvalhead[myconnectindex]++; + ch += ((g_player[i].ps.posx+g_player[i].ps.posy+g_player[i].ps.posz+g_player[i].ps.ang+g_player[i].ps.horiz)&255); + g_player[myconnectindex].syncval[g_player[myconnectindex].syncvalhead&(MOVEFIFOSIZ-1)] = ch; + g_player[myconnectindex].syncvalhead++; } if (ud.recstat == 1) record(); @@ -11500,20 +11500,20 @@ static int domovethings(void) for (i=connecthead;i>=0;i=connectpoint2[i]) { - if (sync[i].extbits&(1<<6)) + if (g_player[i].sync.extbits&(1<<6)) { - ps[i].team = ud.pteam[i]; + g_player[i].ps.team = g_player[i].pteam; if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) { - hittype[ps[i].i].picnum = APLAYERTOP; - quickkill(&ps[i]); + hittype[g_player[i].ps.i].picnum = APLAYERTOP; + quickkill(&g_player[i].ps); } } if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) - ps[i].palookup = ud.pcolor[i] = getteampal(ps[i].team); + g_player[i].ps.palookup = g_player[i].pcolor = getteampal(g_player[i].ps.team); - if (sprite[ps[i].i].pal != 1) - sprite[ps[i].i].pal = ud.pcolor[i]; + if (sprite[g_player[i].ps.i].pal != 1) + sprite[g_player[i].ps.i].pal = g_player[i].pcolor; sharedkeys(i); @@ -11549,8 +11549,8 @@ static void doorders(void) setview(0,0,xdim-1,ydim-1); fadepal(0,0,0, 0,63,7); - //ps[myconnectindex].palette = palette; - setgamepalette(&ps[myconnectindex], palette, 1); // JBF 20040308 + //g_player[myconnectindex].ps.palette = palette; + setgamepalette(&g_player[myconnectindex].ps, palette, 1); // JBF 20040308 KB_FlushKeyboardQueue(); rotatesprite(0,0,65536L,0,ORDERING,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); fadepal(0,0,0, 63,0,-7); @@ -11649,11 +11649,11 @@ void dobonus(int bonusonly) case 0: if (ud.lockout == 0) { - setgamepalette(&ps[myconnectindex], endingpal, 11); // JBF 20040308 + setgamepalette(&g_player[myconnectindex].ps, endingpal, 11); // JBF 20040308 clearview(0L); rotatesprite(0,50<<16,65536L,0,VICTORY1,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); nextpage(); - //ps[myconnectindex].palette = endingpal; + //g_player[myconnectindex].ps.palette = endingpal; fadepal(0,0,0, 63,0,-1); KB_FlushKeyboardQueue(); @@ -11711,8 +11711,8 @@ void dobonus(int bonusonly) fadepal(0,0,0, 0,64,1); KB_FlushKeyboardQueue(); - //ps[myconnectindex].palette = palette; - setgamepalette(&ps[myconnectindex], palette, 11); // JBF 20040308 + //g_player[myconnectindex].ps.palette = palette; + setgamepalette(&g_player[myconnectindex].ps, palette, 11); // JBF 20040308 rotatesprite(0,0,65536L,0,3292,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); IFISSOFTMODE fadepal(0,0,0, 63,0,-1); @@ -11745,8 +11745,8 @@ void dobonus(int bonusonly) fadepal(0,0,0, 0,64,1); setview(0,0,xdim-1,ydim-1); KB_FlushKeyboardQueue(); - //ps[myconnectindex].palette = palette; - setgamepalette(&ps[myconnectindex], palette, 11); // JBF 20040308 + //g_player[myconnectindex].ps.palette = palette; + setgamepalette(&g_player[myconnectindex].ps, palette, 11); // JBF 20040308 rotatesprite(0,0,65536L,0,3293,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); IFISSOFTMODE fadepal(0,0,0, 63,0,-1); else nextpage(); @@ -11786,8 +11786,8 @@ void dobonus(int bonusonly) sound(ENDSEQVOL3SND4); KB_FlushKeyBoardQueue(); - //ps[myconnectindex].palette = palette; - setgamepalette(&ps[myconnectindex], palette, 11); // JBF 20040308 + //g_player[myconnectindex].ps.palette = palette; + setgamepalette(&g_player[myconnectindex].ps, palette, 11); // JBF 20040308 IFISSOFTMODE palto(0,0,0,63); clearview(0L); menutext(160,60,0,0,"THANKS TO ALL OUR"); @@ -11916,8 +11916,8 @@ ENDANM: FRAGBONUS: - //ps[myconnectindex].palette = palette; - setgamepalette(&ps[myconnectindex], palette, 11); // JBF 20040308 + //g_player[myconnectindex].ps.palette = palette; + setgamepalette(&g_player[myconnectindex].ps, palette, 11); // JBF 20040308 IFISSOFTMODE palto(0,0,0,63); // JBF 20031228 KB_FlushKeyboardQueue(); totalclock = 0; @@ -11930,7 +11930,7 @@ FRAGBONUS: if (playerswhenstarted > 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_SCORESHEET)) { - if (!(config.MusicToggle == 0 || config.MusicDevice < 0)) + if (!(ud.config.MusicToggle == 0 || ud.config.MusicDevice < 0)) sound(BONUSMUSIC); rotatesprite(0,0,65536L,0,MENUSCREEN,16,0,2+8+16+64,0,0,xdim-1,ydim-1); @@ -11956,26 +11956,26 @@ FRAGBONUS: Bsprintf(tempbuf,"%d",i+1); minitext(30,90+t,tempbuf,0,2+8+16+128); - minitext(38,90+t,ud.user_name[i],ps[i].palookup,2+8+16+128); + minitext(38,90+t,g_player[i].user_name,g_player[i].ps.palookup,2+8+16+128); for (y=0;y9; ii/=10, ij++) ; + for (ii=g_player[myconnectindex].ps.player_par/(26*60), ij=1; ii>9; ii/=10, ij++) ; clockpad = max(clockpad,ij); if (!(ud.volume_number == 0 && ud.last_level-1 == 7)) { @@ -12080,7 +12080,7 @@ FRAGBONUS: handleevents(); AudioUpdate(); - if (ps[myconnectindex].gm&MODE_EOL) + if (g_player[myconnectindex].ps.gm&MODE_EOL) { rotatesprite(0,0,65536L,0,BONUSSCREEN+gfx_offset,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); @@ -12158,7 +12158,7 @@ FRAGBONUS: } if (playerbest > 0) { - gametext(10,yy+9,ps[myconnectindex].player_par>2)+71,yy+9,tempbuf,0,2+8+16); - if (ps[myconnectindex].player_par < playerbest) + if (g_player[myconnectindex].ps.player_par < playerbest) gametext((320>>2)+71+(clockpad*24),yy+9,"New record!",0,2+8+16); yy+=10; @@ -12234,7 +12234,7 @@ FRAGBONUS: bonuscnt++; sound(PIPEBOMB_EXPLODE); } - sprintf(tempbuf,"%-3ld",ps[myconnectindex].actors_killed); + sprintf(tempbuf,"%-3ld",g_player[myconnectindex].ps.actors_killed); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10; if (ud.player_skill > 3) @@ -12245,9 +12245,9 @@ FRAGBONUS: } else { - if ((ps[myconnectindex].max_actors_killed-ps[myconnectindex].actors_killed) < 0) + if ((g_player[myconnectindex].ps.max_actors_killed-g_player[myconnectindex].ps.actors_killed) < 0) sprintf(tempbuf,"%-3d",0); - else sprintf(tempbuf,"%-3ld",ps[myconnectindex].max_actors_killed-ps[myconnectindex].actors_killed); + else sprintf(tempbuf,"%-3ld",g_player[myconnectindex].ps.max_actors_killed-g_player[myconnectindex].ps.actors_killed); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10; } @@ -12271,12 +12271,12 @@ FRAGBONUS: bonuscnt++; sound(PIPEBOMB_EXPLODE); } - sprintf(tempbuf,"%-3ld",ps[myconnectindex].secret_rooms); + sprintf(tempbuf,"%-3ld",g_player[myconnectindex].ps.secret_rooms); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10; - if (ps[myconnectindex].secret_rooms > 0) - sprintf(tempbuf,"%-3ld%%",(100*ps[myconnectindex].secret_rooms/ps[myconnectindex].max_secret_rooms)); - sprintf(tempbuf,"%-3ld",ps[myconnectindex].max_secret_rooms-ps[myconnectindex].secret_rooms); + if (g_player[myconnectindex].ps.secret_rooms > 0) + sprintf(tempbuf,"%-3ld%%",(100*g_player[myconnectindex].ps.secret_rooms/g_player[myconnectindex].ps.max_secret_rooms)); + sprintf(tempbuf,"%-3ld",g_player[myconnectindex].ps.max_secret_rooms-g_player[myconnectindex].ps.secret_rooms); gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10; } diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 828b01f4a..aa581d306 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -945,1011 +945,1011 @@ static void DoPlayer(int iSet, int lVar1, int lLabelID, int lVar2, int lParm2) { case PLAYER_ZOOM: if (iSet) - ps[iPlayer].zoom=lValue; + g_player[iPlayer].ps.zoom=lValue; else - SetGameVarID(lVar2, ps[iPlayer].zoom, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.zoom, g_i, g_p); break; case PLAYER_EXITX: if (iSet) - ps[iPlayer].exitx=lValue; + g_player[iPlayer].ps.exitx=lValue; else - SetGameVarID(lVar2, ps[iPlayer].exitx, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.exitx, g_i, g_p); break; case PLAYER_EXITY: if (iSet) - ps[iPlayer].exity=lValue; + g_player[iPlayer].ps.exity=lValue; else - SetGameVarID(lVar2, ps[iPlayer].exity, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.exity, g_i, g_p); break; case PLAYER_LOOGIEX: lTemp=lParm2; if (iSet) - ps[iPlayer].loogiex[lTemp]=lValue; + g_player[iPlayer].ps.loogiex[lTemp]=lValue; else - SetGameVarID(lVar2, ps[iPlayer].loogiex[lTemp], g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.loogiex[lTemp], g_i, g_p); break; case PLAYER_LOOGIEY: lTemp=lParm2; if (iSet) - ps[iPlayer].loogiey[lTemp]=lValue; + g_player[iPlayer].ps.loogiey[lTemp]=lValue; else - SetGameVarID(lVar2, ps[iPlayer].loogiey[lTemp], g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.loogiey[lTemp], g_i, g_p); break; case PLAYER_NUMLOOGS: if (iSet) - ps[iPlayer].numloogs=lValue; + g_player[iPlayer].ps.numloogs=lValue; else - SetGameVarID(lVar2, ps[iPlayer].numloogs, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.numloogs, g_i, g_p); break; case PLAYER_LOOGCNT: if (iSet) - ps[iPlayer].loogcnt=lValue; + g_player[iPlayer].ps.loogcnt=lValue; else - SetGameVarID(lVar2, ps[iPlayer].loogcnt, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.loogcnt, g_i, g_p); break; case PLAYER_POSX: if (iSet) - ps[iPlayer].posx=lValue; + g_player[iPlayer].ps.posx=lValue; else - SetGameVarID(lVar2, ps[iPlayer].posx, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.posx, g_i, g_p); break; case PLAYER_POSY: if (iSet) - ps[iPlayer].posy=lValue; + g_player[iPlayer].ps.posy=lValue; else - SetGameVarID(lVar2, ps[iPlayer].posy, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.posy, g_i, g_p); break; case PLAYER_POSZ: if (iSet) - ps[iPlayer].posz=lValue; + g_player[iPlayer].ps.posz=lValue; else - SetGameVarID(lVar2, ps[iPlayer].posz, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.posz, g_i, g_p); break; case PLAYER_HORIZ: if (iSet) - ps[iPlayer].horiz=lValue; + g_player[iPlayer].ps.horiz=lValue; else - SetGameVarID(lVar2, ps[iPlayer].horiz, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.horiz, g_i, g_p); break; case PLAYER_OHORIZ: if (iSet) - ps[iPlayer].ohoriz=lValue; + g_player[iPlayer].ps.ohoriz=lValue; else - SetGameVarID(lVar2, ps[iPlayer].ohoriz, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.ohoriz, g_i, g_p); break; case PLAYER_OHORIZOFF: if (iSet) - ps[iPlayer].ohorizoff=lValue; + g_player[iPlayer].ps.ohorizoff=lValue; else - SetGameVarID(lVar2, ps[iPlayer].ohorizoff, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.ohorizoff, g_i, g_p); break; case PLAYER_INVDISPTIME: if (iSet) - ps[iPlayer].invdisptime=lValue; + g_player[iPlayer].ps.invdisptime=lValue; else - SetGameVarID(lVar2, ps[iPlayer].invdisptime, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.invdisptime, g_i, g_p); break; case PLAYER_BOBPOSX: if (iSet) - ps[iPlayer].bobposx=lValue; + g_player[iPlayer].ps.bobposx=lValue; else - SetGameVarID(lVar2, ps[iPlayer].bobposx, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.bobposx, g_i, g_p); break; case PLAYER_BOBPOSY: if (iSet) - ps[iPlayer].bobposy=lValue; + g_player[iPlayer].ps.bobposy=lValue; else - SetGameVarID(lVar2, ps[iPlayer].bobposy, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.bobposy, g_i, g_p); break; case PLAYER_OPOSX: if (iSet) - ps[iPlayer].oposx=lValue; + g_player[iPlayer].ps.oposx=lValue; else - SetGameVarID(lVar2, ps[iPlayer].oposx, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.oposx, g_i, g_p); break; case PLAYER_OPOSY: if (iSet) - ps[iPlayer].oposy=lValue; + g_player[iPlayer].ps.oposy=lValue; else - SetGameVarID(lVar2, ps[iPlayer].oposy, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.oposy, g_i, g_p); break; case PLAYER_OPOSZ: if (iSet) - ps[iPlayer].oposz=lValue; + g_player[iPlayer].ps.oposz=lValue; else - SetGameVarID(lVar2, ps[iPlayer].oposz, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.oposz, g_i, g_p); break; case PLAYER_PYOFF: if (iSet) - ps[iPlayer].pyoff=lValue; + g_player[iPlayer].ps.pyoff=lValue; else - SetGameVarID(lVar2, ps[iPlayer].pyoff, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.pyoff, g_i, g_p); break; case PLAYER_OPYOFF: if (iSet) - ps[iPlayer].opyoff=lValue; + g_player[iPlayer].ps.opyoff=lValue; else - SetGameVarID(lVar2, ps[iPlayer].opyoff, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.opyoff, g_i, g_p); break; case PLAYER_POSXV: if (iSet) - ps[iPlayer].posxv=lValue; + g_player[iPlayer].ps.posxv=lValue; else - SetGameVarID(lVar2, ps[iPlayer].posxv, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.posxv, g_i, g_p); break; case PLAYER_POSYV: if (iSet) - ps[iPlayer].posyv=lValue; + g_player[iPlayer].ps.posyv=lValue; else - SetGameVarID(lVar2, ps[iPlayer].posyv, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.posyv, g_i, g_p); break; case PLAYER_POSZV: if (iSet) - ps[iPlayer].poszv=lValue; + g_player[iPlayer].ps.poszv=lValue; else - SetGameVarID(lVar2, ps[iPlayer].poszv, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.poszv, g_i, g_p); break; case PLAYER_LAST_PISSED_TIME: if (iSet) - ps[iPlayer].last_pissed_time=lValue; + g_player[iPlayer].ps.last_pissed_time=lValue; else - SetGameVarID(lVar2, ps[iPlayer].last_pissed_time, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.last_pissed_time, g_i, g_p); break; case PLAYER_TRUEFZ: if (iSet) - ps[iPlayer].truefz=lValue; + g_player[iPlayer].ps.truefz=lValue; else - SetGameVarID(lVar2, ps[iPlayer].truefz, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.truefz, g_i, g_p); break; case PLAYER_TRUECZ: if (iSet) - ps[iPlayer].truecz=lValue; + g_player[iPlayer].ps.truecz=lValue; else - SetGameVarID(lVar2, ps[iPlayer].truecz, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.truecz, g_i, g_p); break; case PLAYER_PLAYER_PAR: if (iSet) - ps[iPlayer].player_par=lValue; + g_player[iPlayer].ps.player_par=lValue; else - SetGameVarID(lVar2, ps[iPlayer].player_par, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.player_par, g_i, g_p); break; case PLAYER_VISIBILITY: if (iSet) - ps[iPlayer].visibility=lValue; + g_player[iPlayer].ps.visibility=lValue; else - SetGameVarID(lVar2, ps[iPlayer].visibility, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.visibility, g_i, g_p); break; case PLAYER_BOBCOUNTER: if (iSet) - ps[iPlayer].bobcounter=lValue; + g_player[iPlayer].ps.bobcounter=lValue; else - SetGameVarID(lVar2, ps[iPlayer].bobcounter, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.bobcounter, g_i, g_p); break; case PLAYER_WEAPON_SWAY: if (iSet) - ps[iPlayer].weapon_sway=lValue; + g_player[iPlayer].ps.weapon_sway=lValue; else - SetGameVarID(lVar2, ps[iPlayer].weapon_sway, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.weapon_sway, g_i, g_p); break; case PLAYER_PALS_TIME: if (iSet) - ps[iPlayer].pals_time=lValue; + g_player[iPlayer].ps.pals_time=lValue; else - SetGameVarID(lVar2, ps[iPlayer].pals_time, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.pals_time, g_i, g_p); break; case PLAYER_RANDOMFLAMEX: if (iSet) - ps[iPlayer].randomflamex=lValue; + g_player[iPlayer].ps.randomflamex=lValue; else - SetGameVarID(lVar2, ps[iPlayer].randomflamex, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.randomflamex, g_i, g_p); break; case PLAYER_CRACK_TIME: if (iSet) - ps[iPlayer].crack_time=lValue; + g_player[iPlayer].ps.crack_time=lValue; else - SetGameVarID(lVar2, ps[iPlayer].crack_time, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.crack_time, g_i, g_p); break; case PLAYER_AIM_MODE: if (iSet) - ps[iPlayer].aim_mode=lValue; + g_player[iPlayer].ps.aim_mode=lValue; else - SetGameVarID(lVar2, ps[iPlayer].aim_mode, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.aim_mode, g_i, g_p); break; case PLAYER_ANG: if (iSet) - ps[iPlayer].ang=lValue; + g_player[iPlayer].ps.ang=lValue; else - SetGameVarID(lVar2, ps[iPlayer].ang, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.ang, g_i, g_p); break; case PLAYER_OANG: if (iSet) - ps[iPlayer].oang=lValue; + g_player[iPlayer].ps.oang=lValue; else - SetGameVarID(lVar2, ps[iPlayer].oang, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.oang, g_i, g_p); break; case PLAYER_ANGVEL: if (iSet) - ps[iPlayer].angvel=lValue; + g_player[iPlayer].ps.angvel=lValue; else - SetGameVarID(lVar2, ps[iPlayer].angvel, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.angvel, g_i, g_p); break; case PLAYER_CURSECTNUM: if (iSet) - ps[iPlayer].cursectnum=lValue; + g_player[iPlayer].ps.cursectnum=lValue; else - SetGameVarID(lVar2, ps[iPlayer].cursectnum, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.cursectnum, g_i, g_p); break; case PLAYER_LOOK_ANG: if (iSet) - ps[iPlayer].look_ang=lValue; + g_player[iPlayer].ps.look_ang=lValue; else - SetGameVarID(lVar2, ps[iPlayer].look_ang, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.look_ang, g_i, g_p); break; case PLAYER_LAST_EXTRA: if (iSet) - ps[iPlayer].last_extra=lValue; + g_player[iPlayer].ps.last_extra=lValue; else - SetGameVarID(lVar2, ps[iPlayer].last_extra, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.last_extra, g_i, g_p); break; case PLAYER_SUBWEAPON: if (iSet) - ps[iPlayer].subweapon=lValue; + g_player[iPlayer].ps.subweapon=lValue; else - SetGameVarID(lVar2, ps[iPlayer].subweapon, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.subweapon, g_i, g_p); break; case PLAYER_AMMO_AMOUNT: lTemp=lParm2; if (iSet) - ps[iPlayer].ammo_amount[lTemp]=lValue; + g_player[iPlayer].ps.ammo_amount[lTemp]=lValue; else - SetGameVarID(lVar2, ps[iPlayer].ammo_amount[lTemp], g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.ammo_amount[lTemp], g_i, g_p); break; case PLAYER_WACKEDBYACTOR: if (iSet) - ps[iPlayer].wackedbyactor=lValue; + g_player[iPlayer].ps.wackedbyactor=lValue; else - SetGameVarID(lVar2, ps[iPlayer].wackedbyactor, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.wackedbyactor, g_i, g_p); break; case PLAYER_FRAG: if (iSet) - ps[iPlayer].frag=lValue; + g_player[iPlayer].ps.frag=lValue; else - SetGameVarID(lVar2, ps[iPlayer].frag, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.frag, g_i, g_p); break; case PLAYER_FRAGGEDSELF: if (iSet) - ps[iPlayer].fraggedself=lValue; + g_player[iPlayer].ps.fraggedself=lValue; else - SetGameVarID(lVar2, ps[iPlayer].fraggedself, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.fraggedself, g_i, g_p); break; case PLAYER_CURR_WEAPON: if (iSet) - ps[iPlayer].curr_weapon=lValue; + g_player[iPlayer].ps.curr_weapon=lValue; else - SetGameVarID(lVar2, ps[iPlayer].curr_weapon, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.curr_weapon, g_i, g_p); break; case PLAYER_LAST_WEAPON: if (iSet) - ps[iPlayer].last_weapon=lValue; + g_player[iPlayer].ps.last_weapon=lValue; else - SetGameVarID(lVar2, ps[iPlayer].last_weapon, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.last_weapon, g_i, g_p); break; case PLAYER_TIPINCS: if (iSet) - ps[iPlayer].tipincs=lValue; + g_player[iPlayer].ps.tipincs=lValue; else - SetGameVarID(lVar2, ps[iPlayer].tipincs, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.tipincs, g_i, g_p); break; case PLAYER_HORIZOFF: if (iSet) - ps[iPlayer].horizoff=lValue; + g_player[iPlayer].ps.horizoff=lValue; else - SetGameVarID(lVar2, ps[iPlayer].horizoff, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.horizoff, g_i, g_p); break; case PLAYER_WANTWEAPONFIRE: if (iSet) - ps[iPlayer].wantweaponfire=lValue; + g_player[iPlayer].ps.wantweaponfire=lValue; else - SetGameVarID(lVar2, ps[iPlayer].wantweaponfire, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.wantweaponfire, g_i, g_p); break; case PLAYER_HOLODUKE_AMOUNT: if (iSet) - ps[iPlayer].holoduke_amount=lValue; + g_player[iPlayer].ps.holoduke_amount=lValue; else - SetGameVarID(lVar2, ps[iPlayer].holoduke_amount, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.holoduke_amount, g_i, g_p); break; case PLAYER_NEWOWNER: if (iSet) - ps[iPlayer].newowner=lValue; + g_player[iPlayer].ps.newowner=lValue; else - SetGameVarID(lVar2, ps[iPlayer].newowner, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.newowner, g_i, g_p); break; case PLAYER_HURT_DELAY: if (iSet) - ps[iPlayer].hurt_delay=lValue; + g_player[iPlayer].ps.hurt_delay=lValue; else - SetGameVarID(lVar2, ps[iPlayer].hurt_delay, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.hurt_delay, g_i, g_p); break; case PLAYER_HBOMB_HOLD_DELAY: if (iSet) - ps[iPlayer].hbomb_hold_delay=lValue; + g_player[iPlayer].ps.hbomb_hold_delay=lValue; else - SetGameVarID(lVar2, ps[iPlayer].hbomb_hold_delay, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.hbomb_hold_delay, g_i, g_p); break; case PLAYER_JUMPING_COUNTER: if (iSet) - ps[iPlayer].jumping_counter=lValue; + g_player[iPlayer].ps.jumping_counter=lValue; else - SetGameVarID(lVar2, ps[iPlayer].jumping_counter, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.jumping_counter, g_i, g_p); break; case PLAYER_AIRLEFT: if (iSet) - ps[iPlayer].airleft=lValue; + g_player[iPlayer].ps.airleft=lValue; else - SetGameVarID(lVar2, ps[iPlayer].airleft, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.airleft, g_i, g_p); break; case PLAYER_KNEE_INCS: if (iSet) - ps[iPlayer].knee_incs=lValue; + g_player[iPlayer].ps.knee_incs=lValue; else - SetGameVarID(lVar2, ps[iPlayer].knee_incs, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.knee_incs, g_i, g_p); break; case PLAYER_ACCESS_INCS: if (iSet) - ps[iPlayer].access_incs=lValue; + g_player[iPlayer].ps.access_incs=lValue; else - SetGameVarID(lVar2, ps[iPlayer].access_incs, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.access_incs, g_i, g_p); break; case PLAYER_FTA: if (iSet) - ps[iPlayer].fta=lValue; + g_player[iPlayer].ps.fta=lValue; else - SetGameVarID(lVar2, ps[iPlayer].fta, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.fta, g_i, g_p); break; case PLAYER_FTQ: if (iSet) - ps[iPlayer].ftq=lValue; + g_player[iPlayer].ps.ftq=lValue; else - SetGameVarID(lVar2, ps[iPlayer].ftq, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.ftq, g_i, g_p); break; case PLAYER_ACCESS_WALLNUM: if (iSet) - ps[iPlayer].access_wallnum=lValue; + g_player[iPlayer].ps.access_wallnum=lValue; else - SetGameVarID(lVar2, ps[iPlayer].access_wallnum, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.access_wallnum, g_i, g_p); break; case PLAYER_ACCESS_SPRITENUM: if (iSet) - ps[iPlayer].access_spritenum=lValue; + g_player[iPlayer].ps.access_spritenum=lValue; else - SetGameVarID(lVar2, ps[iPlayer].access_spritenum, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.access_spritenum, g_i, g_p); break; case PLAYER_KICKBACK_PIC: if (iSet) - ps[iPlayer].kickback_pic=lValue; + g_player[iPlayer].ps.kickback_pic=lValue; else - SetGameVarID(lVar2, ps[iPlayer].kickback_pic, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.kickback_pic, g_i, g_p); break; case PLAYER_GOT_ACCESS: if (iSet) - ps[iPlayer].got_access=lValue; + g_player[iPlayer].ps.got_access=lValue; else - SetGameVarID(lVar2, ps[iPlayer].got_access, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.got_access, g_i, g_p); break; case PLAYER_WEAPON_ANG: if (iSet) - ps[iPlayer].weapon_ang=lValue; + g_player[iPlayer].ps.weapon_ang=lValue; else - SetGameVarID(lVar2, ps[iPlayer].weapon_ang, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.weapon_ang, g_i, g_p); break; case PLAYER_FIRSTAID_AMOUNT: if (iSet) - ps[iPlayer].firstaid_amount=lValue; + g_player[iPlayer].ps.firstaid_amount=lValue; else - SetGameVarID(lVar2, ps[iPlayer].firstaid_amount, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.firstaid_amount, g_i, g_p); break; case PLAYER_SOMETHINGONPLAYER: if (iSet) - ps[iPlayer].somethingonplayer=lValue; + g_player[iPlayer].ps.somethingonplayer=lValue; else - SetGameVarID(lVar2, ps[iPlayer].somethingonplayer, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.somethingonplayer, g_i, g_p); break; case PLAYER_ON_CRANE: if (iSet) - ps[iPlayer].on_crane=lValue; + g_player[iPlayer].ps.on_crane=lValue; else - SetGameVarID(lVar2, ps[iPlayer].on_crane, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.on_crane, g_i, g_p); break; case PLAYER_I: if (iSet) - ps[iPlayer].i=lValue; + g_player[iPlayer].ps.i=lValue; else - SetGameVarID(lVar2, ps[iPlayer].i, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.i, g_i, g_p); break; case PLAYER_ONE_PARALLAX_SECTNUM: if (iSet) - ps[iPlayer].one_parallax_sectnum=lValue; + g_player[iPlayer].ps.one_parallax_sectnum=lValue; else - SetGameVarID(lVar2, ps[iPlayer].one_parallax_sectnum, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.one_parallax_sectnum, g_i, g_p); break; case PLAYER_OVER_SHOULDER_ON: if (iSet) - ps[iPlayer].over_shoulder_on=lValue; + g_player[iPlayer].ps.over_shoulder_on=lValue; else - SetGameVarID(lVar2, ps[iPlayer].over_shoulder_on, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.over_shoulder_on, g_i, g_p); break; case PLAYER_RANDOM_CLUB_FRAME: if (iSet) - ps[iPlayer].random_club_frame=lValue; + g_player[iPlayer].ps.random_club_frame=lValue; else - SetGameVarID(lVar2, ps[iPlayer].random_club_frame, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.random_club_frame, g_i, g_p); break; case PLAYER_FIST_INCS: if (iSet) - ps[iPlayer].fist_incs=lValue; + g_player[iPlayer].ps.fist_incs=lValue; else - SetGameVarID(lVar2, ps[iPlayer].fist_incs, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.fist_incs, g_i, g_p); break; case PLAYER_ONE_EIGHTY_COUNT: if (iSet) - ps[iPlayer].one_eighty_count=lValue; + g_player[iPlayer].ps.one_eighty_count=lValue; else - SetGameVarID(lVar2, ps[iPlayer].one_eighty_count, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.one_eighty_count, g_i, g_p); break; case PLAYER_CHEAT_PHASE: if (iSet) - ps[iPlayer].cheat_phase=lValue; + g_player[iPlayer].ps.cheat_phase=lValue; else - SetGameVarID(lVar2, ps[iPlayer].cheat_phase, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.cheat_phase, g_i, g_p); break; case PLAYER_DUMMYPLAYERSPRITE: if (iSet) - ps[iPlayer].dummyplayersprite=lValue; + g_player[iPlayer].ps.dummyplayersprite=lValue; else - SetGameVarID(lVar2, ps[iPlayer].dummyplayersprite, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.dummyplayersprite, g_i, g_p); break; case PLAYER_EXTRA_EXTRA8: if (iSet) - ps[iPlayer].extra_extra8=lValue; + g_player[iPlayer].ps.extra_extra8=lValue; else - SetGameVarID(lVar2, ps[iPlayer].extra_extra8, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.extra_extra8, g_i, g_p); break; case PLAYER_QUICK_KICK: if (iSet) - ps[iPlayer].quick_kick=lValue; + g_player[iPlayer].ps.quick_kick=lValue; else - SetGameVarID(lVar2, ps[iPlayer].quick_kick, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.quick_kick, g_i, g_p); break; case PLAYER_HEAT_AMOUNT: if (iSet) - ps[iPlayer].heat_amount=lValue; + g_player[iPlayer].ps.heat_amount=lValue; else - SetGameVarID(lVar2, ps[iPlayer].heat_amount, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.heat_amount, g_i, g_p); break; case PLAYER_ACTORSQU: if (iSet) - ps[iPlayer].actorsqu=lValue; + g_player[iPlayer].ps.actorsqu=lValue; else - SetGameVarID(lVar2, ps[iPlayer].actorsqu, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.actorsqu, g_i, g_p); break; case PLAYER_TIMEBEFOREEXIT: if (iSet) - ps[iPlayer].timebeforeexit=lValue; + g_player[iPlayer].ps.timebeforeexit=lValue; else - SetGameVarID(lVar2, ps[iPlayer].timebeforeexit, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.timebeforeexit, g_i, g_p); break; case PLAYER_CUSTOMEXITSOUND: if (iSet) - ps[iPlayer].customexitsound=lValue; + g_player[iPlayer].ps.customexitsound=lValue; else - SetGameVarID(lVar2, ps[iPlayer].customexitsound, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.customexitsound, g_i, g_p); break; case PLAYER_WEAPRECS: if (iSet) - ps[iPlayer].weaprecs[16]=lValue; + g_player[iPlayer].ps.weaprecs[16]=lValue; else - SetGameVarID(lVar2, ps[iPlayer].weaprecs[16], g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.weaprecs[16], g_i, g_p); break; case PLAYER_WEAPRECCNT: if (iSet) - ps[iPlayer].weapreccnt=lValue; + g_player[iPlayer].ps.weapreccnt=lValue; else - SetGameVarID(lVar2, ps[iPlayer].weapreccnt, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.weapreccnt, g_i, g_p); break; case PLAYER_INTERFACE_TOGGLE_FLAG: if (iSet) - ps[iPlayer].interface_toggle_flag=lValue; + g_player[iPlayer].ps.interface_toggle_flag=lValue; else - SetGameVarID(lVar2, ps[iPlayer].interface_toggle_flag, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.interface_toggle_flag, g_i, g_p); break; case PLAYER_ROTSCRNANG: if (iSet) - ps[iPlayer].rotscrnang=lValue; + g_player[iPlayer].ps.rotscrnang=lValue; else - SetGameVarID(lVar2, ps[iPlayer].rotscrnang, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.rotscrnang, g_i, g_p); break; case PLAYER_DEAD_FLAG: if (iSet) - ps[iPlayer].dead_flag=lValue; + g_player[iPlayer].ps.dead_flag=lValue; else - SetGameVarID(lVar2, ps[iPlayer].dead_flag, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.dead_flag, g_i, g_p); break; case PLAYER_SHOW_EMPTY_WEAPON: if (iSet) - ps[iPlayer].show_empty_weapon=lValue; + g_player[iPlayer].ps.show_empty_weapon=lValue; else - SetGameVarID(lVar2, ps[iPlayer].show_empty_weapon, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.show_empty_weapon, g_i, g_p); break; case PLAYER_SCUBA_AMOUNT: if (iSet) - ps[iPlayer].scuba_amount=lValue; + g_player[iPlayer].ps.scuba_amount=lValue; else - SetGameVarID(lVar2, ps[iPlayer].scuba_amount, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.scuba_amount, g_i, g_p); break; case PLAYER_JETPACK_AMOUNT: if (iSet) - ps[iPlayer].jetpack_amount=lValue; + g_player[iPlayer].ps.jetpack_amount=lValue; else - SetGameVarID(lVar2, ps[iPlayer].jetpack_amount, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.jetpack_amount, g_i, g_p); break; case PLAYER_STEROIDS_AMOUNT: if (iSet) - ps[iPlayer].steroids_amount=lValue; + g_player[iPlayer].ps.steroids_amount=lValue; else - SetGameVarID(lVar2, ps[iPlayer].steroids_amount, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.steroids_amount, g_i, g_p); break; case PLAYER_SHIELD_AMOUNT: if (iSet) - ps[iPlayer].shield_amount=lValue; + g_player[iPlayer].ps.shield_amount=lValue; else - SetGameVarID(lVar2, ps[iPlayer].shield_amount, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.shield_amount, g_i, g_p); break; case PLAYER_HOLODUKE_ON: if (iSet) - ps[iPlayer].holoduke_on=lValue; + g_player[iPlayer].ps.holoduke_on=lValue; else - SetGameVarID(lVar2, ps[iPlayer].holoduke_on, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.holoduke_on, g_i, g_p); break; case PLAYER_PYCOUNT: if (iSet) - ps[iPlayer].pycount=lValue; + g_player[iPlayer].ps.pycount=lValue; else - SetGameVarID(lVar2, ps[iPlayer].pycount, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.pycount, g_i, g_p); break; case PLAYER_WEAPON_POS: if (iSet) - ps[iPlayer].weapon_pos=lValue; + g_player[iPlayer].ps.weapon_pos=lValue; else - SetGameVarID(lVar2, ps[iPlayer].weapon_pos, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.weapon_pos, g_i, g_p); break; case PLAYER_FRAG_PS: if (iSet) - ps[iPlayer].frag_ps=lValue; + g_player[iPlayer].ps.frag_ps=lValue; else - SetGameVarID(lVar2, ps[iPlayer].frag_ps, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.frag_ps, g_i, g_p); break; case PLAYER_TRANSPORTER_HOLD: if (iSet) - ps[iPlayer].transporter_hold=lValue; + g_player[iPlayer].ps.transporter_hold=lValue; else - SetGameVarID(lVar2, ps[iPlayer].transporter_hold, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.transporter_hold, g_i, g_p); break; case PLAYER_LAST_FULL_WEAPON: if (iSet) - ps[iPlayer].last_full_weapon=lValue; + g_player[iPlayer].ps.last_full_weapon=lValue; else - SetGameVarID(lVar2, ps[iPlayer].last_full_weapon, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.last_full_weapon, g_i, g_p); break; case PLAYER_FOOTPRINTSHADE: if (iSet) - ps[iPlayer].footprintshade=lValue; + g_player[iPlayer].ps.footprintshade=lValue; else - SetGameVarID(lVar2, ps[iPlayer].footprintshade, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.footprintshade, g_i, g_p); break; case PLAYER_BOOT_AMOUNT: if (iSet) - ps[iPlayer].boot_amount=lValue; + g_player[iPlayer].ps.boot_amount=lValue; else - SetGameVarID(lVar2, ps[iPlayer].boot_amount, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.boot_amount, g_i, g_p); break; case PLAYER_SCREAM_VOICE: if (iSet) - ps[iPlayer].scream_voice=lValue; + g_player[iPlayer].ps.scream_voice=lValue; else - SetGameVarID(lVar2, ps[iPlayer].scream_voice, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.scream_voice, g_i, g_p); break; case PLAYER_GM: if (iSet) - ps[iPlayer].gm=lValue; + g_player[iPlayer].ps.gm=lValue; else - SetGameVarID(lVar2, ps[iPlayer].gm, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.gm, g_i, g_p); break; case PLAYER_ON_WARPING_SECTOR: if (iSet) - ps[iPlayer].on_warping_sector=lValue; + g_player[iPlayer].ps.on_warping_sector=lValue; else - SetGameVarID(lVar2, ps[iPlayer].on_warping_sector, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.on_warping_sector, g_i, g_p); break; case PLAYER_FOOTPRINTCOUNT: if (iSet) - ps[iPlayer].footprintcount=lValue; + g_player[iPlayer].ps.footprintcount=lValue; else - SetGameVarID(lVar2, ps[iPlayer].footprintcount, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.footprintcount, g_i, g_p); break; case PLAYER_HBOMB_ON: if (iSet) - ps[iPlayer].hbomb_on=lValue; + g_player[iPlayer].ps.hbomb_on=lValue; else - SetGameVarID(lVar2, ps[iPlayer].hbomb_on, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.hbomb_on, g_i, g_p); break; case PLAYER_JUMPING_TOGGLE: if (iSet) - ps[iPlayer].jumping_toggle=lValue; + g_player[iPlayer].ps.jumping_toggle=lValue; else - SetGameVarID(lVar2, ps[iPlayer].jumping_toggle, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.jumping_toggle, g_i, g_p); break; case PLAYER_RAPID_FIRE_HOLD: if (iSet) - ps[iPlayer].rapid_fire_hold=lValue; + g_player[iPlayer].ps.rapid_fire_hold=lValue; else - SetGameVarID(lVar2, ps[iPlayer].rapid_fire_hold, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.rapid_fire_hold, g_i, g_p); break; case PLAYER_ON_GROUND: if (iSet) - ps[iPlayer].on_ground=lValue; + g_player[iPlayer].ps.on_ground=lValue; else - SetGameVarID(lVar2, ps[iPlayer].on_ground, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.on_ground, g_i, g_p); break; case PLAYER_NAME: if (iSet) - ps[iPlayer].name[32]=lValue; + g_player[iPlayer].ps.name[32]=lValue; else - SetGameVarID(lVar2, ps[iPlayer].name[32], g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.name[32], g_i, g_p); break; case PLAYER_INVEN_ICON: if (iSet) - ps[iPlayer].inven_icon=lValue; + g_player[iPlayer].ps.inven_icon=lValue; else - SetGameVarID(lVar2, ps[iPlayer].inven_icon, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.inven_icon, g_i, g_p); break; case PLAYER_BUTTONPALETTE: if (iSet) - ps[iPlayer].buttonpalette=lValue; + g_player[iPlayer].ps.buttonpalette=lValue; else - SetGameVarID(lVar2, ps[iPlayer].buttonpalette, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.buttonpalette, g_i, g_p); break; case PLAYER_JETPACK_ON: if (iSet) - ps[iPlayer].jetpack_on=lValue; + g_player[iPlayer].ps.jetpack_on=lValue; else - SetGameVarID(lVar2, ps[iPlayer].jetpack_on, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.jetpack_on, g_i, g_p); break; case PLAYER_SPRITEBRIDGE: if (iSet) - ps[iPlayer].spritebridge=lValue; + g_player[iPlayer].ps.spritebridge=lValue; else - SetGameVarID(lVar2, ps[iPlayer].spritebridge, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.spritebridge, g_i, g_p); break; case PLAYER_LASTRANDOMSPOT: if (iSet) - ps[iPlayer].lastrandomspot=lValue; + g_player[iPlayer].ps.lastrandomspot=lValue; else - SetGameVarID(lVar2, ps[iPlayer].lastrandomspot, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.lastrandomspot, g_i, g_p); break; case PLAYER_SCUBA_ON: if (iSet) - ps[iPlayer].scuba_on=lValue; + g_player[iPlayer].ps.scuba_on=lValue; else - SetGameVarID(lVar2, ps[iPlayer].scuba_on, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.scuba_on, g_i, g_p); break; case PLAYER_FOOTPRINTPAL: if (iSet) - ps[iPlayer].footprintpal=lValue; + g_player[iPlayer].ps.footprintpal=lValue; else - SetGameVarID(lVar2, ps[iPlayer].footprintpal, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.footprintpal, g_i, g_p); break; case PLAYER_HEAT_ON: if (iSet) { - if (ps[iPlayer].heat_on != lValue) + if (g_player[iPlayer].ps.heat_on != lValue) { - ps[iPlayer].heat_on=lValue; - setpal(&ps[iPlayer]); + g_player[iPlayer].ps.heat_on=lValue; + setpal(&g_player[iPlayer].ps); } } else - SetGameVarID(lVar2, ps[iPlayer].heat_on, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.heat_on, g_i, g_p); break; case PLAYER_HOLSTER_WEAPON: if (iSet) - ps[iPlayer].holster_weapon=lValue; + g_player[iPlayer].ps.holster_weapon=lValue; else - SetGameVarID(lVar2, ps[iPlayer].holster_weapon, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.holster_weapon, g_i, g_p); break; case PLAYER_FALLING_COUNTER: if (iSet) - ps[iPlayer].falling_counter=lValue; + g_player[iPlayer].ps.falling_counter=lValue; else - SetGameVarID(lVar2, ps[iPlayer].falling_counter, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.falling_counter, g_i, g_p); break; case PLAYER_GOTWEAPON: lTemp=lParm2; if (iSet) - ps[iPlayer].gotweapon[lTemp]=lValue; + g_player[iPlayer].ps.gotweapon[lTemp]=lValue; else - SetGameVarID(lVar2, ps[iPlayer].gotweapon[lTemp], g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.gotweapon[lTemp], g_i, g_p); break; case PLAYER_REFRESH_INVENTORY: if (iSet) - ps[iPlayer].refresh_inventory=lValue; + g_player[iPlayer].ps.refresh_inventory=lValue; else - SetGameVarID(lVar2, ps[iPlayer].refresh_inventory, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.refresh_inventory, g_i, g_p); break; // case PLAYER_PALETTE: // if(iSet) // { - // ps[iPlayer].palette=lValue; + // g_player[iPlayer].ps.palette=lValue; // } // else // { - // SetGameVarID(lVar2, ps[iPlayer].palette, g_i, g_p); + // SetGameVarID(lVar2, g_player[iPlayer].ps.palette, g_i, g_p); // } // break; case PLAYER_TOGGLE_KEY_FLAG: if (iSet) - ps[iPlayer].toggle_key_flag=lValue; + g_player[iPlayer].ps.toggle_key_flag=lValue; else - SetGameVarID(lVar2, ps[iPlayer].toggle_key_flag, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.toggle_key_flag, g_i, g_p); break; case PLAYER_KNUCKLE_INCS: if (iSet) - ps[iPlayer].knuckle_incs=lValue; + g_player[iPlayer].ps.knuckle_incs=lValue; else - SetGameVarID(lVar2, ps[iPlayer].knuckle_incs, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.knuckle_incs, g_i, g_p); break; case PLAYER_WALKING_SND_TOGGLE: if (iSet) - ps[iPlayer].walking_snd_toggle=lValue; + g_player[iPlayer].ps.walking_snd_toggle=lValue; else - SetGameVarID(lVar2, ps[iPlayer].walking_snd_toggle, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.walking_snd_toggle, g_i, g_p); break; case PLAYER_PALOOKUP: if (iSet) - ps[iPlayer].palookup=lValue; + g_player[iPlayer].ps.palookup=lValue; else - SetGameVarID(lVar2, ps[iPlayer].palookup, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.palookup, g_i, g_p); break; case PLAYER_HARD_LANDING: if (iSet) - ps[iPlayer].hard_landing=lValue; + g_player[iPlayer].ps.hard_landing=lValue; else - SetGameVarID(lVar2, ps[iPlayer].hard_landing, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.hard_landing, g_i, g_p); break; case PLAYER_MAX_SECRET_ROOMS: if (iSet) - ps[iPlayer].max_secret_rooms=lValue; + g_player[iPlayer].ps.max_secret_rooms=lValue; else - SetGameVarID(lVar2, ps[iPlayer].max_secret_rooms, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.max_secret_rooms, g_i, g_p); break; case PLAYER_SECRET_ROOMS: if (iSet) - ps[iPlayer].secret_rooms=lValue; + g_player[iPlayer].ps.secret_rooms=lValue; else - SetGameVarID(lVar2, ps[iPlayer].secret_rooms, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.secret_rooms, g_i, g_p); break; case PLAYER_PALS: lTemp=lParm2; if (iSet) - ps[iPlayer].pals[lTemp]=lValue; + g_player[iPlayer].ps.pals[lTemp]=lValue; else - SetGameVarID(lVar2, ps[iPlayer].pals[lTemp], g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.pals[lTemp], g_i, g_p); break; case PLAYER_MAX_ACTORS_KILLED: if (iSet) - ps[iPlayer].max_actors_killed=lValue; + g_player[iPlayer].ps.max_actors_killed=lValue; else - SetGameVarID(lVar2, ps[iPlayer].max_actors_killed, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.max_actors_killed, g_i, g_p); break; case PLAYER_ACTORS_KILLED: if (iSet) - ps[iPlayer].actors_killed=lValue; + g_player[iPlayer].ps.actors_killed=lValue; else - SetGameVarID(lVar2, ps[iPlayer].actors_killed, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.actors_killed, g_i, g_p); break; case PLAYER_RETURN_TO_CENTER: if (iSet) - ps[iPlayer].return_to_center=lValue; + g_player[iPlayer].ps.return_to_center=lValue; else - SetGameVarID(lVar2, ps[iPlayer].return_to_center, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.return_to_center, g_i, g_p); break; case PLAYER_RUNSPEED: if (iSet) - ps[iPlayer].runspeed=lValue; + g_player[iPlayer].ps.runspeed=lValue; else - SetGameVarID(lVar2, ps[iPlayer].runspeed, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.runspeed, g_i, g_p); break; case PLAYER_SBS: if (iSet) - ps[iPlayer].sbs=lValue; + g_player[iPlayer].ps.sbs=lValue; else - SetGameVarID(lVar2, ps[iPlayer].sbs, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.sbs, g_i, g_p); break; case PLAYER_RELOADING: if (iSet) - ps[iPlayer].reloading=lValue; + g_player[iPlayer].ps.reloading=lValue; else - SetGameVarID(lVar2, ps[iPlayer].reloading, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.reloading, g_i, g_p); break; case PLAYER_AUTO_AIM: if (iSet) - ps[iPlayer].auto_aim=lValue; + g_player[iPlayer].ps.auto_aim=lValue; else - SetGameVarID(lVar2, ps[iPlayer].auto_aim, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.auto_aim, g_i, g_p); break; case PLAYER_MOVEMENT_LOCK: if (iSet) - ps[iPlayer].movement_lock=lValue; + g_player[iPlayer].ps.movement_lock=lValue; else - SetGameVarID(lVar2, ps[iPlayer].movement_lock, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.movement_lock, g_i, g_p); break; case PLAYER_SOUND_PITCH: if (iSet) - ps[iPlayer].sound_pitch=lValue; + g_player[iPlayer].ps.sound_pitch=lValue; else - SetGameVarID(lVar2, ps[iPlayer].sound_pitch, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.sound_pitch, g_i, g_p); break; case PLAYER_WEAPONSWITCH: if (iSet) - ps[iPlayer].weaponswitch=lValue; + g_player[iPlayer].ps.weaponswitch=lValue; else - SetGameVarID(lVar2, ps[iPlayer].weaponswitch, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.weaponswitch, g_i, g_p); break; case PLAYER_TEAM: if (iSet) - ps[iPlayer].team=lValue; + g_player[iPlayer].ps.team=lValue; else - SetGameVarID(lVar2, ps[iPlayer].team, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].ps.team, g_i, g_p); break; default: @@ -1979,44 +1979,44 @@ static void DoInput(int iSet, int lVar1, int lLabelID, int lVar2) { case INPUT_AVEL: if (iSet) - sync[iPlayer].avel=lValue; + g_player[iPlayer].sync.avel=lValue; else - SetGameVarID(lVar2, sync[iPlayer].avel, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].sync.avel, g_i, g_p); break; case INPUT_HORZ: if (iSet) - sync[iPlayer].horz=lValue; + g_player[iPlayer].sync.horz=lValue; else - SetGameVarID(lVar2, sync[iPlayer].horz, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].sync.horz, g_i, g_p); break; case INPUT_FVEL: if (iSet) - sync[iPlayer].fvel=lValue; + g_player[iPlayer].sync.fvel=lValue; else - SetGameVarID(lVar2, sync[iPlayer].fvel, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].sync.fvel, g_i, g_p); break; case INPUT_SVEL: if (iSet) - sync[iPlayer].svel=lValue; + g_player[iPlayer].sync.svel=lValue; else - SetGameVarID(lVar2, sync[iPlayer].svel, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].sync.svel, g_i, g_p); break; case INPUT_BITS: if (iSet) - sync[iPlayer].bits=lValue; + g_player[iPlayer].sync.bits=lValue; else - SetGameVarID(lVar2, sync[iPlayer].bits, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].sync.bits, g_i, g_p); break; case INPUT_EXTBITS: if (iSet) - sync[iPlayer].extbits=lValue; + g_player[iPlayer].sync.extbits=lValue; else - SetGameVarID(lVar2, sync[iPlayer].extbits, g_i, g_p); + SetGameVarID(lVar2, g_player[iPlayer].sync.extbits, g_i, g_p); break; default: break; @@ -2973,8 +2973,8 @@ void OnEvent(int iEventID, int iActor, int iPlayer, long lDist) // if player was set to squish, first stop that... if (g_p >= 0) { - if (ps[g_p].actorsqu == g_i) - ps[g_p].actorsqu = -1; + if (g_player[g_p].ps.actorsqu == g_i) + g_player[g_p].ps.actorsqu = -1; } deletesprite(g_i); } @@ -3011,7 +3011,7 @@ static int ifsquished(int i, int p) if (squishme) { - FTA(10,&ps[p]); + FTA(10,&g_player[p].ps); if (badguy(&sprite[i])) sprite[i].xvel = 0; @@ -3027,7 +3027,7 @@ static int ifsquished(int i, int p) return 0; } -static void forceplayerangle(struct player_struct *p) +static void forceplayerangle(player_struct *p) { int n = 128-(TRAND&255); @@ -3238,7 +3238,7 @@ static void alterang(int a) { int aang = g_sp->ang, angdif, goalang; long ticselapsed = (g_t[0])&31, *moveptr = (long *)g_t[1]; - int j = ps[g_p].holoduke_on; + int j = g_player[g_p].ps.holoduke_on; g_sp->xvel += (*moveptr-g_sp->xvel)/5; if (g_sp->zvel < 648) g_sp->zvel += ((*(moveptr+1)<<4)-g_sp->zvel)/5; @@ -3249,7 +3249,7 @@ static void alterang(int a) if (j >= 0 && cansee(sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].sectnum,g_sp->x,g_sp->y,g_sp->z,g_sp->sectnum)) g_sp->owner = j; - else g_sp->owner = ps[g_p].i; + else g_sp->owner = g_player[g_p].ps.i; if (sprite[g_sp->owner].picnum == APLAYER) goalang = getangle(hittype[g_i].lastvx-g_sp->x,hittype[g_i].lastvy-g_sp->y); @@ -3286,7 +3286,7 @@ static void alterang(int a) { goalang = furthestangle(g_i,j); g_sp->ang = goalang; - g_sp->owner = ps[g_p].i; + g_sp->owner = g_player[g_p].ps.i; } if (a&fleeenemy) @@ -3309,9 +3309,9 @@ static void move(void) if (a&face_player) { - if (ps[g_p].newowner >= 0) - goalang = getangle(ps[g_p].oposx-g_sp->x,ps[g_p].oposy-g_sp->y); - else goalang = getangle(ps[g_p].posx-g_sp->x,ps[g_p].posy-g_sp->y); + if (g_player[g_p].ps.newowner >= 0) + goalang = getangle(g_player[g_p].ps.oposx-g_sp->x,g_player[g_p].ps.oposy-g_sp->y); + else goalang = getangle(g_player[g_p].ps.posx-g_sp->x,g_player[g_p].ps.posy-g_sp->y); angdif = getincangle(g_sp->ang,goalang)>>2; if ((angdif > -8 && angdif < 0) || (angdif < 8 && angdif > 0)) angdif *= 2; @@ -3323,9 +3323,9 @@ static void move(void) if (a&face_player_slow) { - if (ps[g_p].newowner >= 0) - goalang = getangle(ps[g_p].oposx-g_sp->x,ps[g_p].oposy-g_sp->y); - else goalang = getangle(ps[g_p].posx-g_sp->x,ps[g_p].posy-g_sp->y); + if (g_player[g_p].ps.newowner >= 0) + goalang = getangle(g_player[g_p].ps.oposx-g_sp->x,g_player[g_p].ps.oposy-g_sp->y); + else goalang = getangle(g_player[g_p].ps.posx-g_sp->x,g_player[g_p].ps.posy-g_sp->y); angdif = getincangle(g_sp->ang,goalang)>>4; if ((angdif > -8 && angdif < 0) || (angdif < 8 && angdif > 0)) angdif *= 2; @@ -3340,8 +3340,8 @@ static void move(void) if (a&face_player_smart) { - long newx = ps[g_p].posx+(ps[g_p].posxv/768); - long newy = ps[g_p].posy+(ps[g_p].posyv/768); + long newx = g_player[g_p].ps.posx+(g_player[g_p].ps.posxv/768); + long newy = g_player[g_p].ps.posy+(g_player[g_p].ps.posyv/768); goalang = getangle(newx-g_sp->x,newy-g_sp->y); angdif = getincangle(g_sp->ang,goalang)>>2; @@ -3445,29 +3445,29 @@ static void move(void) { daxvel = -(1024-g_x); - angdif = getangle(ps[g_p].posx-g_sp->x,ps[g_p].posy-g_sp->y); + angdif = getangle(g_player[g_p].ps.posx-g_sp->x,g_player[g_p].ps.posy-g_sp->y); if (g_x < 512) { - ps[g_p].posxv = 0; - ps[g_p].posyv = 0; + g_player[g_p].ps.posxv = 0; + g_player[g_p].ps.posyv = 0; } else { - ps[g_p].posxv = mulscale(ps[g_p].posxv,ps[g_p].runspeed-0x2000,16); - ps[g_p].posyv = mulscale(ps[g_p].posyv,ps[g_p].runspeed-0x2000,16); + g_player[g_p].ps.posxv = mulscale(g_player[g_p].ps.posxv,g_player[g_p].ps.runspeed-0x2000,16); + g_player[g_p].ps.posyv = mulscale(g_player[g_p].ps.posyv,g_player[g_p].ps.runspeed-0x2000,16); } } else if (g_sp->picnum != DRONE && g_sp->picnum != SHARK && g_sp->picnum != COMMANDER) { if (hittype[g_i].bposz != g_sp->z || (ud.multimode < 2 && ud.player_skill < 2)) { - if ((g_t[0]&1) || ps[g_p].actorsqu == g_i) return; + if ((g_t[0]&1) || g_player[g_p].ps.actorsqu == g_i) return; else daxvel <<= 1; } else { - if ((g_t[0]&3) || ps[g_p].actorsqu == g_i) return; + if ((g_t[0]&3) || g_player[g_p].ps.actorsqu == g_i) return; else daxvel <<= 2; } } @@ -3611,7 +3611,7 @@ static int parse(void) break; case CON_IFCANSEETARGET: - j = cansee(g_sp->x,g_sp->y,g_sp->z-((TRAND&41)<<8),g_sp->sectnum,ps[g_p].posx,ps[g_p].posy,ps[g_p].posz/*-((TRAND&41)<<8)*/,sprite[ps[g_p].i].sectnum); + j = cansee(g_sp->x,g_sp->y,g_sp->z-((TRAND&41)<<8),g_sp->sectnum,g_player[g_p].ps.posx,g_player[g_p].ps.posy,g_player[g_p].ps.posz/*-((TRAND&41)<<8)*/,sprite[g_player[g_p].ps.i].sectnum); parseifelse(j); if (j) hittype[g_i].timetosleep = SLEEPTIME; break; @@ -3627,9 +3627,9 @@ static int parse(void) // select sprite for monster to target // if holoduke is on, let them target holoduke first. // - if (ps[g_p].holoduke_on >= 0) + if (g_player[g_p].ps.holoduke_on >= 0) { - s = &sprite[ps[g_p].holoduke_on]; + s = &sprite[g_player[g_p].ps.holoduke_on]; j = cansee(g_sp->x,g_sp->y,g_sp->z-(TRAND&((32<<8)-1)),g_sp->sectnum, s->x,s->y,s->z,s->sectnum); @@ -3637,10 +3637,10 @@ static int parse(void) { // they can't see player's holoduke // check for player... - s = &sprite[ps[g_p].i]; + s = &sprite[g_player[g_p].ps.i]; } } - else s = &sprite[ps[g_p].i]; // holoduke not on. look for player + else s = &sprite[g_player[g_p].ps.i]; // holoduke not on. look for player // can they see player, (or player's holoduke) j = cansee(g_sp->x,g_sp->y,g_sp->z-(TRAND&((47<<8))),g_sp->sectnum, @@ -3752,15 +3752,15 @@ static int parse(void) { if (*insptr == 0) { - for (j=0;j < ps[g_p].weapreccnt;j++) - if (ps[g_p].weaprecs[j] == g_sp->picnum) + for (j=0;j < g_player[g_p].ps.weapreccnt;j++) + if (g_player[g_p].ps.weaprecs[j] == g_sp->picnum) break; - parseifelse(j < ps[g_p].weapreccnt && g_sp->owner == g_i); + parseifelse(j < g_player[g_p].ps.weapreccnt && g_sp->owner == g_i); } - else if (ps[g_p].weapreccnt < 16) + else if (g_player[g_p].ps.weapreccnt < 16) { - ps[g_p].weaprecs[ps[g_p].weapreccnt++] = g_sp->picnum; + g_player[g_p].ps.weaprecs[g_player[g_p].ps.weapreccnt++] = g_sp->picnum; parseifelse(g_sp->owner == g_i); } else parseifelse(0); @@ -3771,14 +3771,14 @@ static int parse(void) case CON_GETLASTPAL: insptr++; if (g_sp->picnum == APLAYER) - g_sp->pal = ps[g_sp->yvel].palookup; + g_sp->pal = g_player[g_sp->yvel].ps.palookup; else g_sp->pal = hittype[g_i].tempang; hittype[g_i].tempang = 0; break; case CON_TOSSWEAPON: insptr++; - checkweapons(&ps[g_sp->yvel]); + checkweapons(&g_player[g_sp->yvel].ps); break; case CON_NULLOP: @@ -3796,11 +3796,11 @@ static int parse(void) if (ud.multimode > 1 && g_sp->picnum == APLAYER) { - if (ps[otherp].quick_kick == 0) - ps[otherp].quick_kick = 14; + if (g_player[otherp].ps.quick_kick == 0) + g_player[otherp].ps.quick_kick = 14; } - else if (g_sp->picnum != APLAYER && ps[g_p].quick_kick == 0) - ps[g_p].quick_kick = 14; + else if (g_sp->picnum != APLAYER && g_player[g_p].ps.quick_kick == 0) + g_player[g_p].ps.quick_kick = 14; break; case CON_SIZETO: @@ -3852,7 +3852,7 @@ static int parse(void) case CON_GLOBALSOUND: insptr++; if (g_p == screenpeek || (gametype_flags[ud.coop]&GAMETYPE_FLAG_COOPSOUND)) - spritesound((short) *insptr,ps[screenpeek].i); + spritesound((short) *insptr,g_player[screenpeek].ps.i); insptr++; break; @@ -3863,7 +3863,7 @@ static int parse(void) case CON_TIP: insptr++; - ps[g_p].tipincs = 26; + g_player[g_p].ps.tipincs = 26; break; case CON_FALL: @@ -3960,17 +3960,17 @@ static int parse(void) return 1; case CON_ADDAMMO: insptr++; - if (ps[g_p].ammo_amount[*insptr] >= max_ammo_amount[*insptr]) + if (g_player[g_p].ps.ammo_amount[*insptr] >= max_ammo_amount[*insptr]) { killit_flag = 2; break; } - addammo(*insptr, &ps[g_p], *(insptr+1)); - if (ps[g_p].curr_weapon == KNEE_WEAPON) - if (ps[g_p].gotweapon[*insptr]) + addammo(*insptr, &g_player[g_p].ps, *(insptr+1)); + if (g_player[g_p].ps.curr_weapon == KNEE_WEAPON) + if (g_player[g_p].ps.gotweapon[*insptr]) { - if (!(ps[g_p].weaponswitch & 1)) addweaponnoswitch(&ps[g_p], *insptr); - else addweapon(&ps[g_p], *insptr); + if (!(g_player[g_p].ps.weaponswitch & 1)) addweaponnoswitch(&g_player[g_p].ps, *insptr); + else addweapon(&g_player[g_p].ps, *insptr); } insptr += 2; break; @@ -3997,7 +3997,7 @@ static int parse(void) case CON_ADDKILLS: insptr++; - ps[g_p].actors_killed += *insptr++; + g_player[g_p].ps.actors_killed += *insptr++; hittype[g_i].actorstayput = -1; break; @@ -4013,22 +4013,22 @@ static int parse(void) case CON_ADDWEAPON: insptr++; - if (ps[g_p].gotweapon[*insptr] == 0) + if (g_player[g_p].ps.gotweapon[*insptr] == 0) { - if (!(ps[g_p].weaponswitch & 1)) addweaponnoswitch(&ps[g_p], *insptr); - else addweapon(&ps[g_p], *insptr); + if (!(g_player[g_p].ps.weaponswitch & 1)) addweaponnoswitch(&g_player[g_p].ps, *insptr); + else addweapon(&g_player[g_p].ps, *insptr); } - else if (ps[g_p].ammo_amount[*insptr] >= max_ammo_amount[*insptr]) + else if (g_player[g_p].ps.ammo_amount[*insptr] >= max_ammo_amount[*insptr]) { killit_flag = 2; break; } - addammo(*insptr, &ps[g_p], *(insptr+1)); - if (ps[g_p].curr_weapon == KNEE_WEAPON) - if (ps[g_p].gotweapon[*insptr]) + addammo(*insptr, &g_player[g_p].ps, *(insptr+1)); + if (g_player[g_p].ps.curr_weapon == KNEE_WEAPON) + if (g_player[g_p].ps.gotweapon[*insptr]) { - if (!(ps[g_p].weaponswitch & 1)) addweaponnoswitch(&ps[g_p], *insptr); - else addweapon(&ps[g_p], *insptr); + if (!(g_player[g_p].ps.weaponswitch & 1)) addweaponnoswitch(&g_player[g_p].ps, *insptr); + else addweapon(&g_player[g_p].ps, *insptr); } insptr+=2; break; @@ -4040,23 +4040,23 @@ static int parse(void) case CON_ENDOFGAME: insptr++; - ps[g_p].timebeforeexit = *insptr++; - ps[g_p].customexitsound = -1; + g_player[g_p].ps.timebeforeexit = *insptr++; + g_player[g_p].ps.customexitsound = -1; ud.eog = 1; break; case CON_ADDPHEALTH: insptr++; - if (ps[g_p].newowner >= 0) + if (g_player[g_p].ps.newowner >= 0) { - ps[g_p].newowner = -1; - ps[g_p].posx = ps[g_p].oposx; - ps[g_p].posy = ps[g_p].oposy; - ps[g_p].posz = ps[g_p].oposz; - ps[g_p].ang = ps[g_p].oang; - updatesector(ps[g_p].posx,ps[g_p].posy,&ps[g_p].cursectnum); - setpal(&ps[g_p]); + g_player[g_p].ps.newowner = -1; + g_player[g_p].ps.posx = g_player[g_p].ps.oposx; + g_player[g_p].ps.posy = g_player[g_p].ps.oposy; + g_player[g_p].ps.posz = g_player[g_p].ps.oposz; + g_player[g_p].ps.ang = g_player[g_p].ps.oang; + updatesector(g_player[g_p].ps.posx,g_player[g_p].ps.posy,&g_player[g_p].ps.cursectnum); + setpal(&g_player[g_p].ps); j = headspritestat[1]; while (j >= 0) @@ -4067,7 +4067,7 @@ static int parse(void) } } - j = sprite[ps[g_p].i].extra; + j = sprite[g_player[g_p].ps.i].extra; if (g_sp->picnum != ATOMICHEALTH) { @@ -4100,12 +4100,12 @@ static int parse(void) { if ((j - *insptr) < (max_player_health>>2) && j >= (max_player_health>>2)) - spritesound(DUKE_GOTHEALTHATLOW,ps[g_p].i); + spritesound(DUKE_GOTHEALTHATLOW,g_player[g_p].ps.i); - ps[g_p].last_extra = j; + g_player[g_p].ps.last_extra = j; } - sprite[ps[g_p].i].extra = j; + sprite[g_player[g_p].ps.i].extra = j; } insptr++; @@ -4137,22 +4137,22 @@ static int parse(void) case CON_ADDWEAPONVAR: insptr++; - if (ps[g_p].gotweapon[GetGameVarID(*(insptr),g_i,g_p)] == 0) + if (g_player[g_p].ps.gotweapon[GetGameVarID(*(insptr),g_i,g_p)] == 0) { - if (!(ps[g_p].weaponswitch & 1)) addweaponnoswitch(&ps[g_p], GetGameVarID(*(insptr),g_i,g_p)); - else addweapon(&ps[g_p], GetGameVarID(*(insptr),g_i,g_p)); + if (!(g_player[g_p].ps.weaponswitch & 1)) addweaponnoswitch(&g_player[g_p].ps, GetGameVarID(*(insptr),g_i,g_p)); + else addweapon(&g_player[g_p].ps, GetGameVarID(*(insptr),g_i,g_p)); } - else if (ps[g_p].ammo_amount[GetGameVarID(*(insptr),g_i,g_p)] >= max_ammo_amount[GetGameVarID(*(insptr),g_i,g_p)]) + else if (g_player[g_p].ps.ammo_amount[GetGameVarID(*(insptr),g_i,g_p)] >= max_ammo_amount[GetGameVarID(*(insptr),g_i,g_p)]) { killit_flag = 2; break; } - addammo(GetGameVarID(*(insptr),g_i,g_p), &ps[g_p], GetGameVarID(*(insptr+1),g_i,g_p)); - if (ps[g_p].curr_weapon == KNEE_WEAPON) - if (ps[g_p].gotweapon[GetGameVarID(*(insptr),g_i,g_p)]) + addammo(GetGameVarID(*(insptr),g_i,g_p), &g_player[g_p].ps, GetGameVarID(*(insptr+1),g_i,g_p)); + if (g_player[g_p].ps.curr_weapon == KNEE_WEAPON) + if (g_player[g_p].ps.gotweapon[GetGameVarID(*(insptr),g_i,g_p)]) { - if (!(ps[g_p].weaponswitch & 1)) addweaponnoswitch(&ps[g_p], GetGameVarID(*(insptr),g_i,g_p)); - else addweapon(&ps[g_p], GetGameVarID(*(insptr),g_i,g_p)); + if (!(g_player[g_p].ps.weaponswitch & 1)) addweaponnoswitch(&g_player[g_p].ps, GetGameVarID(*(insptr),g_i,g_p)); + else addweapon(&g_player[g_p].ps, GetGameVarID(*(insptr),g_i,g_p)); } insptr+=2; break; @@ -4304,8 +4304,8 @@ static int parse(void) case CON_GETPNAME: if (fta_quotes[i] != NULL) { - if (ud.user_name[j][0]) - Bstrcpy(fta_quotes[i],ud.user_name[j]); + if (g_player[j].user_name[0]) + Bstrcpy(fta_quotes[i],g_player[j].user_name); else Bsprintf(fta_quotes[i],"%d",j); } else OSD_Printf("%s %d null quote %d\n",__FILE__,__LINE__,i); @@ -4354,7 +4354,7 @@ static int parse(void) mpchangemap(volnume,levnume); else { - ps[myconnectindex].gm |= MODE_EOL; + g_player[myconnectindex].ps.gm |= MODE_EOL; display_bonus_screen = 0; } // MODE_RESTART; @@ -4651,7 +4651,7 @@ static int parse(void) spritesound((short)j,g_i); break; case CON_GLOBALSOUNDVAR: - spritesound((short)j,ps[screenpeek].i); + spritesound((short)j,g_player[screenpeek].ps.i); break; case CON_STOPSOUNDVAR: if (isspritemakingsound(g_i,j)) @@ -4677,15 +4677,15 @@ static int parse(void) { int32 i=0; insptr++; - if (config.scripthandle < 0) break; + if (ud.config.scripthandle < 0) break; switch (tw) { case CON_SAVEGAMEVAR: i=GetGameVarID(*insptr, g_i, g_p); - SCRIPT_PutNumber(config.scripthandle, "Gamevars",aGameVars[*insptr++].szLabel,i,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Gamevars",aGameVars[*insptr++].szLabel,i,false,false); break; case CON_READGAMEVAR: - SCRIPT_GetNumber(config.scripthandle, "Gamevars",aGameVars[*insptr].szLabel,&i); + SCRIPT_GetNumber(ud.config.scripthandle, "Gamevars",aGameVars[*insptr].szLabel,&i); SetGameVarID(*insptr++, i, g_i, g_p); break; } @@ -4720,7 +4720,7 @@ static int parse(void) setview(x1,y1,x2,y2); #if 0 - if (!ud.pause_on && ((ud.show_help == 0 && ud.multimode < 2 && !(ps[myconnectindex].gm&MODE_MENU)) || ud.multimode > 1 || ud.recstat == 2)) + if (!ud.pause_on && ((ud.show_help == 0 && ud.multimode < 2 && !(g_player[myconnectindex].ps.gm&MODE_MENU)) || ud.multimode > 1 || ud.recstat == 2)) smoothratio = min(max((totalclock-ototalclock)*(65536L/TICSPERFRAME),0),65536); #endif dointerpolations(smoothratio); @@ -5087,7 +5087,7 @@ static int parse(void) case CON_QUAKE: insptr++; earthquaketime = (char)GetGameVarID(*insptr++,g_i,g_p); - spritesound(EARTHQUAKE,ps[screenpeek].i); + spritesound(EARTHQUAKE,g_player[screenpeek].ps.i); break; case CON_IFMOVE: @@ -5104,21 +5104,21 @@ static int parse(void) { if (lastsavedpos >= 0 && ud.recstat != 2) { - ps[g_p].gm = MODE_MENU; + g_player[g_p].ps.gm = MODE_MENU; KB_ClearKeyDown(sc_Space); cmenu(15000); } - else ps[g_p].gm = MODE_RESTART; + else g_player[g_p].ps.gm = MODE_RESTART; killit_flag = 2; } else { pickrandomspot(g_p); - g_sp->x = hittype[g_i].bposx = ps[g_p].bobposx = ps[g_p].oposx = ps[g_p].posx; - g_sp->y = hittype[g_i].bposy = ps[g_p].bobposy = ps[g_p].oposy =ps[g_p].posy; - g_sp->z = hittype[g_i].bposy = ps[g_p].oposz =ps[g_p].posz; - updatesector(ps[g_p].posx,ps[g_p].posy,&ps[g_p].cursectnum); - setsprite(ps[g_p].i,ps[g_p].posx,ps[g_p].posy,ps[g_p].posz+PHEIGHT); + g_sp->x = hittype[g_i].bposx = g_player[g_p].ps.bobposx = g_player[g_p].ps.oposx = g_player[g_p].ps.posx; + g_sp->y = hittype[g_i].bposy = g_player[g_p].ps.bobposy = g_player[g_p].ps.oposy =g_player[g_p].ps.posy; + g_sp->z = hittype[g_i].bposy = g_player[g_p].ps.oposz =g_player[g_p].ps.posz; + updatesector(g_player[g_p].ps.posx,g_player[g_p].ps.posy,&g_player[g_p].ps.cursectnum); + setsprite(g_player[g_p].ps.i,g_player[g_p].ps.posx,g_player[g_p].ps.posy,g_player[g_p].ps.posz+PHEIGHT); g_sp->cstat = 257; g_sp->shade = -12; @@ -5127,27 +5127,27 @@ static int parse(void) g_sp->yrepeat = 36; g_sp->owner = g_i; g_sp->xoffset = 0; - g_sp->pal = ps[g_p].palookup; + g_sp->pal = g_player[g_p].ps.palookup; - ps[g_p].last_extra = g_sp->extra = max_player_health; - ps[g_p].wantweaponfire = -1; - ps[g_p].horiz = 100; - ps[g_p].on_crane = -1; - ps[g_p].frag_ps = g_p; - ps[g_p].horizoff = 0; - ps[g_p].opyoff = 0; - ps[g_p].wackedbyactor = -1; - ps[g_p].shield_amount = max_armour_amount; - ps[g_p].dead_flag = 0; - ps[g_p].pals_time = 0; - ps[g_p].footprintcount = 0; - ps[g_p].weapreccnt = 0; - ps[g_p].fta = 0; - ps[g_p].ftq = 0; - ps[g_p].posxv = ps[g_p].posyv = 0; - ps[g_p].rotscrnang = 0; - ps[g_p].runspeed = dukefriction; - ps[g_p].falling_counter = 0; + g_player[g_p].ps.last_extra = g_sp->extra = max_player_health; + g_player[g_p].ps.wantweaponfire = -1; + g_player[g_p].ps.horiz = 100; + g_player[g_p].ps.on_crane = -1; + g_player[g_p].ps.frag_ps = g_p; + g_player[g_p].ps.horizoff = 0; + g_player[g_p].ps.opyoff = 0; + g_player[g_p].ps.wackedbyactor = -1; + g_player[g_p].ps.shield_amount = max_armour_amount; + g_player[g_p].ps.dead_flag = 0; + g_player[g_p].ps.pals_time = 0; + g_player[g_p].ps.footprintcount = 0; + g_player[g_p].ps.weapreccnt = 0; + g_player[g_p].ps.fta = 0; + g_player[g_p].ps.ftq = 0; + g_player[g_p].ps.posxv = g_player[g_p].ps.posyv = 0; + g_player[g_p].ps.rotscrnang = 0; + g_player[g_p].ps.runspeed = dukefriction; + g_player[g_p].ps.falling_counter = 0; hittype[g_i].extra = -1; hittype[g_i].owner = g_i; @@ -5157,20 +5157,20 @@ static int parse(void) hittype[g_i].tempang = 0; hittype[g_i].actorstayput = -1; hittype[g_i].dispicnum = 0; - hittype[g_i].owner = ps[g_p].i; + hittype[g_i].owner = g_player[g_p].ps.i; resetinventory(g_p); resetweapons(g_p); - ps[g_p].reloading = 0; + g_player[g_p].ps.reloading = 0; - ps[g_p].movement_lock = 0; + g_player[g_p].ps.movement_lock = 0; - OnEvent(EVENT_RESETPLAYER, ps[g_p].i, g_p, -1); + OnEvent(EVENT_RESETPLAYER, g_player[g_p].ps.i, g_p, -1); cameradist = 0; cameraclock = totalclock; } - setpal(&ps[g_p]); + setpal(&g_player[g_p].ps); //AddLog("EOF: resetplayer"); } break; @@ -5203,59 +5203,59 @@ static int parse(void) switch (*(insptr-1)) { case GET_STEROIDS: - ps[g_p].steroids_amount = *insptr; - ps[g_p].inven_icon = 2; + g_player[g_p].ps.steroids_amount = *insptr; + g_player[g_p].ps.inven_icon = 2; break; case GET_SHIELD: - ps[g_p].shield_amount += *insptr;// 100; - if (ps[g_p].shield_amount > max_player_health) - ps[g_p].shield_amount = max_player_health; + g_player[g_p].ps.shield_amount += *insptr;// 100; + if (g_player[g_p].ps.shield_amount > max_player_health) + g_player[g_p].ps.shield_amount = max_player_health; break; case GET_SCUBA: - ps[g_p].scuba_amount = *insptr;// 1600; - ps[g_p].inven_icon = 6; + g_player[g_p].ps.scuba_amount = *insptr;// 1600; + g_player[g_p].ps.inven_icon = 6; break; case GET_HOLODUKE: - ps[g_p].holoduke_amount = *insptr;// 1600; - ps[g_p].inven_icon = 3; + g_player[g_p].ps.holoduke_amount = *insptr;// 1600; + g_player[g_p].ps.inven_icon = 3; break; case GET_JETPACK: - ps[g_p].jetpack_amount = *insptr;// 1600; - ps[g_p].inven_icon = 4; + g_player[g_p].ps.jetpack_amount = *insptr;// 1600; + g_player[g_p].ps.inven_icon = 4; break; case GET_ACCESS: switch (g_sp->pal) { case 0: - ps[g_p].got_access |= 1; + g_player[g_p].ps.got_access |= 1; break; case 21: - ps[g_p].got_access |= 2; + g_player[g_p].ps.got_access |= 2; break; case 23: - ps[g_p].got_access |= 4; + g_player[g_p].ps.got_access |= 4; break; } break; case GET_HEATS: - ps[g_p].heat_amount = *insptr; - ps[g_p].inven_icon = 5; + g_player[g_p].ps.heat_amount = *insptr; + g_player[g_p].ps.inven_icon = 5; break; case GET_FIRSTAID: - ps[g_p].inven_icon = 1; - ps[g_p].firstaid_amount = *insptr; + g_player[g_p].ps.inven_icon = 1; + g_player[g_p].ps.firstaid_amount = *insptr; break; case GET_BOOTS: - ps[g_p].inven_icon = 7; - ps[g_p].boot_amount = *insptr; + g_player[g_p].ps.inven_icon = 7; + g_player[g_p].ps.boot_amount = *insptr; break; } insptr++; @@ -5273,47 +5273,47 @@ static int parse(void) l = *insptr; j = 0; - s = sprite[ps[g_p].i].xvel; + s = sprite[g_player[g_p].ps.i].xvel; - if ((l&8) && ps[g_p].on_ground && (sync[g_p].bits&2)) + if ((l&8) && g_player[g_p].ps.on_ground && (g_player[g_p].sync.bits&2)) j = 1; - else if ((l&16) && ps[g_p].jumping_counter == 0 && !ps[g_p].on_ground && - ps[g_p].poszv > 2048) + else if ((l&16) && g_player[g_p].ps.jumping_counter == 0 && !g_player[g_p].ps.on_ground && + g_player[g_p].ps.poszv > 2048) j = 1; - else if ((l&32) && ps[g_p].jumping_counter > 348) + else if ((l&32) && g_player[g_p].ps.jumping_counter > 348) j = 1; else if ((l&1) && s >= 0 && s < 8) j = 1; - else if ((l&2) && s >= 8 && !(sync[g_p].bits&(1<<5))) + else if ((l&2) && s >= 8 && !(g_player[g_p].sync.bits&(1<<5))) j = 1; - else if ((l&4) && s >= 8 && sync[g_p].bits&(1<<5)) + else if ((l&4) && s >= 8 && g_player[g_p].sync.bits&(1<<5)) j = 1; - else if ((l&64) && ps[g_p].posz < (g_sp->z-(48<<8))) + else if ((l&64) && g_player[g_p].ps.posz < (g_sp->z-(48<<8))) j = 1; - else if ((l&128) && s <= -8 && !(sync[g_p].bits&(1<<5))) + else if ((l&128) && s <= -8 && !(g_player[g_p].sync.bits&(1<<5))) j = 1; - else if ((l&256) && s <= -8 && (sync[g_p].bits&(1<<5))) + else if ((l&256) && s <= -8 && (g_player[g_p].sync.bits&(1<<5))) j = 1; - else if ((l&512) && (ps[g_p].quick_kick > 0 || (ps[g_p].curr_weapon == KNEE_WEAPON && ps[g_p].kickback_pic > 0))) + else if ((l&512) && (g_player[g_p].ps.quick_kick > 0 || (g_player[g_p].ps.curr_weapon == KNEE_WEAPON && g_player[g_p].ps.kickback_pic > 0))) j = 1; - else if ((l&1024) && sprite[ps[g_p].i].xrepeat < 32) + else if ((l&1024) && sprite[g_player[g_p].ps.i].xrepeat < 32) j = 1; - else if ((l&2048) && ps[g_p].jetpack_on) + else if ((l&2048) && g_player[g_p].ps.jetpack_on) j = 1; - else if ((l&4096) && ps[g_p].steroids_amount > 0 && ps[g_p].steroids_amount < 400) + else if ((l&4096) && g_player[g_p].ps.steroids_amount > 0 && g_player[g_p].ps.steroids_amount < 400) j = 1; - else if ((l&8192) && ps[g_p].on_ground) + else if ((l&8192) && g_player[g_p].ps.on_ground) j = 1; - else if ((l&16384) && sprite[ps[g_p].i].xrepeat > 32 && sprite[ps[g_p].i].extra > 0 && ps[g_p].timebeforeexit == 0) + else if ((l&16384) && sprite[g_player[g_p].ps.i].xrepeat > 32 && sprite[g_player[g_p].ps.i].extra > 0 && g_player[g_p].ps.timebeforeexit == 0) j = 1; - else if ((l&32768) && sprite[ps[g_p].i].extra <= 0) + else if ((l&32768) && sprite[g_player[g_p].ps.i].extra <= 0) j = 1; else if ((l&65536L)) { if (g_sp->picnum == APLAYER && ud.multimode > 1) - j = getincangle(ps[otherp].ang,getangle(ps[g_p].posx-ps[otherp].posx,ps[g_p].posy-ps[otherp].posy)); + j = getincangle(g_player[otherp].ps.ang,getangle(g_player[g_p].ps.posx-g_player[otherp].ps.posx,g_player[g_p].ps.posy-g_player[otherp].ps.posy)); else - j = getincangle(ps[g_p].ang,getangle(g_sp->x-ps[g_p].posx,g_sp->y-ps[g_p].posy)); + j = getincangle(g_player[g_p].ps.ang,getangle(g_sp->x-g_player[g_p].ps.posx,g_sp->y-g_player[g_p].ps.posy)); if (j > -128 && j < 128) j = 1; @@ -5342,13 +5342,13 @@ static int parse(void) case CON_WACKPLAYER: insptr++; - forceplayerangle(&ps[g_p]); + forceplayerangle(&g_player[g_p].ps); return 0; case CON_FLASH: insptr++; sprite[g_i].shade = -127; - ps[g_p].visibility = -127; + g_player[g_p].ps.visibility = -127; lastvisinc = totalclock+32; return 0; @@ -5364,7 +5364,7 @@ static int parse(void) break; case CON_IFHITSPACE: - parseifelse(sync[g_p].bits&(1<<29)); + parseifelse(g_player[g_p].sync.bits&(1<<29)); break; case CON_IFOUTSIDE: @@ -5439,9 +5439,9 @@ static int parse(void) case CON_PALFROM: insptr++; - ps[g_p].pals_time = *insptr++; + g_player[g_p].ps.pals_time = *insptr++; for (j=0;j<3;j++) - ps[g_p].pals[j] = *insptr++; + g_player[g_p].ps.pals[j] = *insptr++; break; case CON_QSPRINTF: @@ -5879,7 +5879,7 @@ static int parse(void) case CON_LOCKPLAYER: insptr++; - ps[g_p].transporter_hold=GetGameVarID(*insptr++, g_i, g_p); + g_player[g_p].ps.transporter_hold=GetGameVarID(*insptr++, g_i, g_p); break; case CON_CHECKAVAILWEAPON: @@ -5895,20 +5895,20 @@ static int parse(void) if (j < MAXPLAYERS) { if (tw == CON_CHECKAVAILWEAPON) - checkavailweapon(&ps[j]); - else checkavailinven(&ps[j]); + checkavailweapon(&g_player[j].ps); + else checkavailinven(&g_player[j].ps); } break; case CON_GETPLAYERANGLE: insptr++; - SetGameVarID(*insptr++, ps[g_p].ang, g_i, g_p); + SetGameVarID(*insptr++, g_player[g_p].ps.ang, g_i, g_p); break; case CON_SETPLAYERANGLE: insptr++; - ps[g_p].ang=GetGameVarID(*insptr++, g_i, g_p); - ps[g_p].ang &= 2047; + g_player[g_p].ps.ang=GetGameVarID(*insptr++, g_i, g_p); + g_player[g_p].ps.ang &= 2047; break; case CON_GETACTORANGLE: @@ -6246,7 +6246,7 @@ static int parse(void) case CON_IFPHEALTHL: insptr++; - parseifelse(sprite[ps[g_p].i].extra < *insptr); + parseifelse(sprite[g_player[g_p].ps.i].extra < *insptr); break; case CON_IFPINVENTORY: @@ -6256,44 +6256,44 @@ static int parse(void) switch (*insptr++) { case GET_STEROIDS: - if (ps[g_p].steroids_amount != *insptr) + if (g_player[g_p].ps.steroids_amount != *insptr) j = 1; break; case GET_SHIELD: - if (ps[g_p].shield_amount != max_player_health) + if (g_player[g_p].ps.shield_amount != max_player_health) j = 1; break; case GET_SCUBA: - if (ps[g_p].scuba_amount != *insptr) j = 1; + if (g_player[g_p].ps.scuba_amount != *insptr) j = 1; break; case GET_HOLODUKE: - if (ps[g_p].holoduke_amount != *insptr) j = 1; + if (g_player[g_p].ps.holoduke_amount != *insptr) j = 1; break; case GET_JETPACK: - if (ps[g_p].jetpack_amount != *insptr) j = 1; + if (g_player[g_p].ps.jetpack_amount != *insptr) j = 1; break; case GET_ACCESS: switch (g_sp->pal) { case 0: - if (ps[g_p].got_access&1) j = 1; + if (g_player[g_p].ps.got_access&1) j = 1; break; case 21: - if (ps[g_p].got_access&2) j = 1; + if (g_player[g_p].ps.got_access&2) j = 1; break; case 23: - if (ps[g_p].got_access&4) j = 1; + if (g_player[g_p].ps.got_access&4) j = 1; break; } break; case GET_HEATS: - if (ps[g_p].heat_amount != *insptr) j = 1; + if (g_player[g_p].ps.heat_amount != *insptr) j = 1; break; case GET_FIRSTAID: - if (ps[g_p].firstaid_amount != *insptr) j = 1; + if (g_player[g_p].ps.firstaid_amount != *insptr) j = 1; break; case GET_BOOTS: - if (ps[g_p].boot_amount != *insptr) j = 1; + if (g_player[g_p].ps.boot_amount != *insptr) j = 1; break; } @@ -6303,20 +6303,20 @@ static int parse(void) case CON_PSTOMP: insptr++; - if (ps[g_p].knee_incs == 0 && sprite[ps[g_p].i].xrepeat >= 40) - if (cansee(g_sp->x,g_sp->y,g_sp->z-(4<<8),g_sp->sectnum,ps[g_p].posx,ps[g_p].posy,ps[g_p].posz+(16<<8),sprite[ps[g_p].i].sectnum)) + if (g_player[g_p].ps.knee_incs == 0 && sprite[g_player[g_p].ps.i].xrepeat >= 40) + if (cansee(g_sp->x,g_sp->y,g_sp->z-(4<<8),g_sp->sectnum,g_player[g_p].ps.posx,g_player[g_p].ps.posy,g_player[g_p].ps.posz+(16<<8),sprite[g_player[g_p].ps.i].sectnum)) { for (j=0;jang)); + j = klabs(getincangle(g_player[g_p].ps.ang,g_sp->ang)); parseifelse(j <= *insptr); break; @@ -6466,7 +6466,7 @@ void LoadActor(long iActor) if (g_sp->sectnum < 0 || g_sp->sectnum >= MAXSECTORS) { // if(badguy(g_sp)) - // ps[g_p].actors_killed++; + // g_player[g_p].ps.actors_killed++; deletesprite(g_i); return; } @@ -6478,8 +6478,8 @@ void LoadActor(long iActor) // if player was set to squish, first stop that... if (g_p >= 0) { - if (ps[g_p].actorsqu == g_i) - ps[g_p].actorsqu = -1; + if (g_player[g_p].ps.actorsqu == g_i) + g_player[g_p].ps.actorsqu = -1; } deletesprite(g_i); } @@ -6504,7 +6504,7 @@ void execute(int iActor,int iPlayer,long lDist) if (g_sp->sectnum < 0 || g_sp->sectnum >= MAXSECTORS) { if (badguy(g_sp)) - ps[g_p].actors_killed++; + g_player[g_p].ps.actors_killed++; deletesprite(g_i); return; } @@ -6529,8 +6529,8 @@ void execute(int iActor,int iPlayer,long lDist) if (killit_flag == 1) { // if player was set to squish, first stop that... - if (ps[g_p].actorsqu == g_i) - ps[g_p].actorsqu = -1; + if (g_player[g_p].ps.actorsqu == g_i) + g_player[g_p].ps.actorsqu = -1; deletesprite(g_i); } else diff --git a/polymer/eduke32/source/global.c b/polymer/eduke32/source/global.c index 80cbb4f34..44bc471f8 100644 --- a/polymer/eduke32/source/global.c +++ b/polymer/eduke32/source/global.c @@ -33,11 +33,11 @@ long neartaghitdist,lockclock,max_player_health,max_armour_amount,max_ammo_amoun long gc=176; // long temp_data[MAXSPRITES][6]; -struct weaponhit hittype[MAXSPRITES]; -struct spriteinterpolate sprpos[MAXSPRITES]; +weaponhit hittype[MAXSPRITES]; +spriteinterpolate sprpos[MAXSPRITES]; short spriteq[1024],spriteqloc,spriteqamount=64; -struct animwalltype animwall[MAXANIMWALLS]; +animwalltype animwall[MAXANIMWALLS]; short numanimwalls; long *animateptr[MAXANIMATES], animategoal[MAXANIMATES], animatevel[MAXANIMATES], animatecnt; // long oanimateval[MAXANIMATES]; @@ -86,32 +86,26 @@ SOUNDOWNER SoundOwner[NUM_SOUNDS][4]; char numplayersprites,loadfromgrouponly=0,earthquaketime; long fricxv,fricyv; -struct player_orig po[MAXPLAYERS]; -struct player_struct ps[MAXPLAYERS]; -struct user_defs ud; +playerdata_t g_player[MAXPLAYERS]; +input inputfifo[MOVEFIFOSIZ][MAXPLAYERS]; +user_defs ud; char pus, pub; -char syncstat, syncval[MAXPLAYERS][MOVEFIFOSIZ]; -long syncvalhead[MAXPLAYERS], syncvaltail, syncvaltottail; +char syncstat; +long syncvaltail, syncvaltottail; -input sync[MAXPLAYERS], loc; +input loc; input recsync[RECSYNCBUFSIZ]; long avgfvel, avgsvel, avgavel, avghorz, avgbits, avgextbits; - -input inputfifo[MOVEFIFOSIZ][MAXPLAYERS]; - long movefifosendplc; //Multiplayer syncing variables short screenpeek; -long movefifoend[MAXPLAYERS]; - //Game recording variables -char playerreadyflag[MAXPLAYERS],ready2send; -char playerquitflag[MAXPLAYERS]; +char ready2send; long vel, svel, angvel, horiz, ototalclock, respawnactortime=768, respawnitemtime=768, groupfile; long *scriptptr,*insptr,*labelcode,labelcnt,defaultlabelcnt,*labeltype; @@ -153,7 +147,7 @@ int condebug; //GLOBAL.C - replace the end "my's" with this long myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel; short myhoriz, omyhoriz, myhorizoff, omyhorizoff; -short myang, omyang, mycursectnum, myjumpingcounter,frags[MAXPLAYERS][MAXPLAYERS]; +short myang, omyang, mycursectnum, myjumpingcounter; char myjumpingtoggle, myonground, myhardlanding, myreturntocenter; signed char multiwho, multipos, multiwhat, multiflag; @@ -169,7 +163,7 @@ int networkmode = 255, movesperpacket = 1,gamequit = 0,everyothertime; long numfreezebounces=3,rpgblastradius,pipebombblastradius,tripbombblastradius,shrinkerblastradius,morterblastradius,bouncemineblastradius,seenineblastradius; STATUSBARTYPE sbar; -long myminlag[MAXPLAYERS], mymaxlag, otherminlag, bufferjitter = 1; +long mymaxlag, otherminlag, bufferjitter = 1; short numclouds,clouds[128],cloudx[128],cloudy[128]; long cloudtotalclock = 0,totalmemory = 0; long numinterpolations = 0, startofdynamicinterpolations = 0; diff --git a/polymer/eduke32/source/jfaud_sounds.cpp b/polymer/eduke32/source/jfaud_sounds.cpp index 27c994d65..9b8aa61a9 100644 --- a/polymer/eduke32/source/jfaud_sounds.cpp +++ b/polymer/eduke32/source/jfaud_sounds.cpp @@ -365,8 +365,8 @@ int xyzsound(short num, short i, long x, long y, long z) num >= NUM_SOUNDS || ((soundm[num] & SOUNDM_PARENT) && ud.lockout) || // parental mode SoundToggle == 0 || - (ps[myconnectindex].timebeforeexit > 0 && ps[myconnectindex].timebeforeexit <= 26*3) || - (ps[myconnectindex].gm & MODE_MENU) + (g_player[myconnectindex].ps.timebeforeexit > 0 && g_player[myconnectindex].ps.timebeforeexit <= 26*3) || + (g_player[myconnectindex].ps.gm & MODE_MENU) ) return -1; if (soundm[num] & SOUNDM_PLAYER) { @@ -410,8 +410,8 @@ int xyzsound(short num, short i, long x, long y, long z) refdist *= d; } if (PN != MUSICANDSFX && - !cansee(ps[screenpeek].oposx,ps[screenpeek].oposy,ps[screenpeek].oposz-(24<<8), - ps[screenpeek].cursectnum,SX,SY,SZ-(24<<8),SECT) ) + !cansee(g_player[screenpeek].ps.oposx,g_player[screenpeek].ps.oposy,g_player[screenpeek].ps.oposz-(24<<8), + g_player[screenpeek].ps.cursectnum,SX,SY,SZ-(24<<8),SECT) ) gain *= OCCLUDEDFACTOR; switch(num) @@ -421,10 +421,10 @@ int xyzsound(short num, short i, long x, long y, long z) case RPG_EXPLODE: gain = 1.0; global = 1; - if (sector[ps[screenpeek].cursectnum].lotag == 2) pitch -= translatepitch(1024); + if (sector[g_player[screenpeek].ps.cursectnum].lotag == 2) pitch -= translatepitch(1024); break; default: - if(sector[ps[screenpeek].cursectnum].lotag == 2 && (soundm[num]&SOUNDM_DUKE) == 0) + if(sector[g_player[screenpeek].ps.cursectnum].lotag == 2 && (soundm[num]&SOUNDM_DUKE) == 0) pitch = translatepitch(-768); //if( sndist > 31444 && PN != MUSICANDSFX) // return -1; @@ -575,11 +575,11 @@ void pan3dsound(void) jfaud->AgeCache(); if(ud.camerasprite == -1) { - cx = ps[screenpeek].oposx; - cy = ps[screenpeek].oposy; - cz = ps[screenpeek].oposz; - cs = ps[screenpeek].cursectnum; - ca = ps[screenpeek].ang+ps[screenpeek].look_ang; + cx = g_player[screenpeek].ps.oposx; + cy = g_player[screenpeek].ps.oposy; + cz = g_player[screenpeek].ps.oposz; + cs = g_player[screenpeek].ps.cursectnum; + ca = g_player[screenpeek].ps.ang+g_player[screenpeek].ps.look_ang; } else { cx = sprite[ud.camerasprite].x; cy = sprite[ud.camerasprite].y; diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index f231df4de..d26ad68a6 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -560,7 +560,7 @@ void sendquit(void) { if (gamequit == 0 && (numplayers > 1)) { - if (ps[myconnectindex].gm&MODE_GAME) + if (g_player[myconnectindex].ps.gm&MODE_GAME) { gamequit = 1; quittimer = totalclock+120; @@ -607,14 +607,14 @@ void menus(void) buttonstat = MOUSE_GetButtons(); } - if ((ps[myconnectindex].gm&MODE_MENU) == 0) + if ((g_player[myconnectindex].ps.gm&MODE_MENU) == 0) { walock[TILE_LOADSHOT] = 1; return; } - ps[myconnectindex].gm &= (0xff-MODE_TYPE); - ps[myconnectindex].fta = 0; + g_player[myconnectindex].ps.gm &= (0xff-MODE_TYPE); + g_player[myconnectindex].ps.fta = 0; x = 0; @@ -679,7 +679,7 @@ void menus(void) ready2send = 1; totalclock = ototalclock; } - ps[myconnectindex].gm &= ~MODE_MENU; + g_player[myconnectindex].ps.gm &= ~MODE_MENU; } break; @@ -829,11 +829,11 @@ void menus(void) break; case 3: - i = config.AutoAim; + i = ud.config.AutoAim; if (x == io) - config.AutoAim = (config.AutoAim == 2) ? 0 : config.AutoAim+1; - modval(0,2,(int *)&config.AutoAim,1,probey==3); - if (config.AutoAim != i) + ud.config.AutoAim = (ud.config.AutoAim == 2) ? 0 : ud.config.AutoAim+1; + modval(0,2,(int *)&ud.config.AutoAim,1,probey==3); + if (ud.config.AutoAim != i) updateplayer(); break; @@ -957,7 +957,7 @@ void menus(void) case 3: { char *s[] = { "Off", "All weapons", "Hitscan only" }; - gametext(d-50,yy,s[config.AutoAim],MENUHIGHLIGHT(io),2+8+16); + gametext(d-50,yy,s[ud.config.AutoAim],MENUHIGHLIGHT(io),2+8+16); } break; @@ -1320,7 +1320,7 @@ void menus(void) if (KB_KeyPressed(sc_Escape) || KB_KeyPressed(sc_N) || RMB) { - if (sprite[ps[myconnectindex].i].extra <= 0) + if (sprite[g_player[myconnectindex].ps.i].extra <= 0) { if (enterlevel(MODE_GAME)) backtomenu(); return; @@ -1329,7 +1329,7 @@ void menus(void) KB_ClearKeyDown(sc_N); KB_ClearKeyDown(sc_Escape); - ps[myconnectindex].gm &= ~MODE_MENU; + g_player[myconnectindex].ps.gm &= ~MODE_MENU; if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; @@ -1346,13 +1346,13 @@ void menus(void) if (ud.multimode > 1) { loadplayer(-1-lastsavedpos); - ps[myconnectindex].gm = MODE_GAME; + g_player[myconnectindex].ps.gm = MODE_GAME; } else { c = loadplayer(lastsavedpos); if (c == 0) - ps[myconnectindex].gm = MODE_GAME; + g_player[myconnectindex].ps.gm = MODE_GAME; } } @@ -1506,10 +1506,10 @@ void menus(void) if (ud.multimode > 1) { - if (ps[myconnectindex].gm&MODE_GAME) + if (g_player[myconnectindex].ps.gm&MODE_GAME) { loadplayer(-1-lastsavedpos); - ps[myconnectindex].gm = MODE_GAME; + g_player[myconnectindex].ps.gm = MODE_GAME; } else { @@ -1532,7 +1532,7 @@ void menus(void) { c = loadplayer(lastsavedpos); if (c == 0) - ps[myconnectindex].gm = MODE_GAME; + g_player[myconnectindex].ps.gm = MODE_GAME; } break; @@ -1545,9 +1545,9 @@ void menus(void) KB_ClearKeyDown(sc_N); KB_ClearKeyDown(sc_Escape); sound(EXITMENUSOUND); - if (ps[myconnectindex].gm&MODE_GAME) + if (g_player[myconnectindex].ps.gm&MODE_GAME) { - ps[myconnectindex].gm &= ~MODE_MENU; + g_player[myconnectindex].ps.gm &= ~MODE_MENU; if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; @@ -1579,7 +1579,7 @@ void menus(void) ready2send = 1; totalclock = ototalclock; } - ps[myconnectindex].gm &= ~MODE_MENU; + g_player[myconnectindex].ps.gm &= ~MODE_MENU; sound(EXITMENUSOUND); break; } @@ -1963,9 +1963,9 @@ cheat_for_port_credits: if (KB_KeyPressed(sc_Q)) cmenu(500); - if (x == -1 && (ps[myconnectindex].gm&MODE_GAME || ud.recstat == 2)) + if (x == -1 && (g_player[myconnectindex].ps.gm&MODE_GAME || ud.recstat == 2)) { - ps[myconnectindex].gm &= ~MODE_MENU; + g_player[myconnectindex].ps.gm &= ~MODE_MENU; if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; @@ -2064,7 +2064,7 @@ cheat_for_port_credits: cmenu(500); break; case -1: - ps[myconnectindex].gm &= ~MODE_MENU; + g_player[myconnectindex].ps.gm &= ~MODE_MENU; if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; @@ -2144,7 +2144,7 @@ cheat_for_port_credits: } else if (x == -1) { - if (ps[myconnectindex].gm&MODE_GAME) cmenu(50); + if (g_player[myconnectindex].ps.gm&MODE_GAME) cmenu(50); else cmenu(0); } @@ -2499,9 +2499,9 @@ cheat_for_port_credits: break; case 3: enabled = usehightile; - if (enabled && x==io) config.useprecache = !config.useprecache; - if (enabled) modval(0,1,(int *)&config.useprecache,1,probey==io); - gametextpal(d,yy, config.useprecache && enabled ? "On" : "Off", enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE, 0); + if (enabled && x==io) ud.config.useprecache = !ud.config.useprecache; + if (enabled) modval(0,1,(int *)&ud.config.useprecache,1,probey==io); + gametextpal(d,yy, ud.config.useprecache && enabled ? "On" : "Off", enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE, 0); break; case 4: enabled = usehightile; @@ -2510,13 +2510,13 @@ cheat_for_port_credits: gametextpal(d,yy, glusetexcompr && enabled ? "On" : "Off", enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE, 0); break; case 5: - enabled = (glusetexcompr && usehightile && config.useprecache); + enabled = (glusetexcompr && usehightile && ud.config.useprecache); if (enabled && x==io) glusetexcache = !glusetexcache; if (enabled) modval(0,1,(int *)&glusetexcache,1,probey==io); gametextpal(d,yy, glusetexcache && enabled ? "On" : "Off", enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE, 0); break; case 6: - enabled = (glusetexcompr && usehightile && config.useprecache && glusetexcache); + enabled = (glusetexcompr && usehightile && ud.config.useprecache && glusetexcache); if (enabled && x==io) glusetexcachecompression = !glusetexcachecompression; if (enabled) modval(0,1,(int *)&glusetexcachecompression,1,probey==io); gametextpal(d,yy, glusetexcachecompression && enabled ? "On" : "Off", enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE, 0); @@ -2679,8 +2679,8 @@ cheat_for_port_credits: case 7: if (x==io) ud.showweapons = 1-ud.showweapons; modval(0,1,(int *)&ud.showweapons,1,probey==io); - config.ShowOpponentWeapons = ud.showweapons; - gametextpal(d,yy, config.ShowOpponentWeapons ? "On" : "Off", MENUHIGHLIGHT(io), 0); + ud.config.ShowOpponentWeapons = ud.showweapons; + gametextpal(d,yy, ud.config.ShowOpponentWeapons ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; case 8: if (x==io) ud.democams = 1-ud.democams; @@ -2690,13 +2690,13 @@ cheat_for_port_credits: case 9: if (x==io) { - enabled = !((ps[myconnectindex].gm&MODE_GAME) && ud.m_recstat != 1); - if ((ps[myconnectindex].gm&MODE_GAME)) closedemowrite(); + enabled = !((g_player[myconnectindex].ps.gm&MODE_GAME) && ud.m_recstat != 1); + if ((g_player[myconnectindex].ps.gm&MODE_GAME)) closedemowrite(); else ud.m_recstat = !ud.m_recstat; } - if ((ps[myconnectindex].gm&MODE_GAME) && ud.m_recstat != 1) + if ((g_player[myconnectindex].ps.gm&MODE_GAME) && ud.m_recstat != 1) enabled = 0; - gametextpal(d,yy,ud.m_recstat?((ud.m_recstat && enabled && ps[myconnectindex].gm&MODE_GAME)?"Running":"On"):"Off",enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE,enabled?0:1); + gametextpal(d,yy,ud.m_recstat?((ud.m_recstat && enabled && g_player[myconnectindex].ps.gm&MODE_GAME)?"Running":"On"):"Off",enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE,enabled?0:1); break; case 10: if (x==io) cmenu(201); @@ -2834,18 +2834,18 @@ cheat_for_port_credits: gametextpal(d,yy, ud.idplayers ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; case 7: - if (x==io) config.ForceSetup = 1-config.ForceSetup; - modval(0,1,(int *)&config.ForceSetup,1,probey==io); - gametextpal(d,yy, config.ForceSetup ? "On" : "Off", MENUHIGHLIGHT(io), 0); + if (x==io) ud.config.ForceSetup = 1-ud.config.ForceSetup; + modval(0,1,(int *)&ud.config.ForceSetup,1,probey==io); + gametextpal(d,yy, ud.config.ForceSetup ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; #ifdef _WIN32 case 8: - i = config.CheckForUpdates; - if (x==io) config.CheckForUpdates = 1-config.CheckForUpdates; - modval(0,1,(int *)&config.CheckForUpdates,1,probey==io); - if (config.CheckForUpdates != i) - config.LastUpdateCheck = 0; - gametextpal(d,yy, config.CheckForUpdates ? "On" : "Off", MENUHIGHLIGHT(io), 0); + i = ud.config.CheckForUpdates; + if (x==io) ud.config.CheckForUpdates = 1-ud.config.CheckForUpdates; + modval(0,1,(int *)&ud.config.CheckForUpdates,1,probey==io); + if (ud.config.CheckForUpdates != i) + ud.config.LastUpdateCheck = 0; + gametextpal(d,yy, ud.config.CheckForUpdates ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; case 9: #else @@ -2878,7 +2878,7 @@ cheat_for_port_credits: switch (x) { case -1: - if (ps[myconnectindex].gm&MODE_GAME) cmenu(50); + if (g_player[myconnectindex].ps.gm&MODE_GAME) cmenu(50); else cmenu(0); break; @@ -3170,10 +3170,10 @@ cheat_for_port_credits: curvidset = newvidset; changesmade = 0; - config.ScreenMode = fullscreen; - config.ScreenWidth = xdim; - config.ScreenHeight = ydim; - config.ScreenBPP = bpp; + ud.config.ScreenMode = fullscreen; + ud.config.ScreenWidth = xdim; + ud.config.ScreenHeight = ydim; + ud.config.ScreenBPP = bpp; } break; @@ -3236,7 +3236,7 @@ cheat_for_port_credits: if (x==4) { ud.brightness = ss; - setbrightness(ud.brightness>>2,&ps[myconnectindex].palette[0],0); + setbrightness(ud.brightness>>2,&g_player[myconnectindex].ps.palette[0],0); } } @@ -3339,8 +3339,8 @@ cheat_for_port_credits: } else if (KB_KeyPressed(sc_Delete)) { - config.KeyboardKeys[probey][currentlist] = 0; - CONTROL_MapKey(probey, config.KeyboardKeys[probey][0], config.KeyboardKeys[probey][1]); + ud.config.KeyboardKeys[probey][currentlist] = 0; + CONTROL_MapKey(probey, ud.config.KeyboardKeys[probey][0], ud.config.KeyboardKeys[probey][1]); sound(KICK_HIT); KB_ClearKeyDown(sc_Delete); } @@ -3354,14 +3354,14 @@ cheat_for_port_credits: for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; minitextshade(70,34+l*8,tempbuf,(m+l == probey)?0:16,1,10+16); - //strcpy(tempbuf, KB_ScanCodeToString(config.KeyboardKeys[m+l][0])); - strcpy(tempbuf, (char *)getkeyname(config.KeyboardKeys[m+l][0])); + //strcpy(tempbuf, KB_ScanCodeToString(ud.config.KeyboardKeys[m+l][0])); + strcpy(tempbuf, (char *)getkeyname(ud.config.KeyboardKeys[m+l][0])); if (!tempbuf[0]) strcpy(tempbuf, " -"); minitextshade(70+100,34+l*8,tempbuf, (m+l == probey && !currentlist?0:16),2,10+16); - //strcpy(tempbuf, KB_ScanCodeToString(config.KeyboardKeys[m+l][1])); - strcpy(tempbuf, (char *)getkeyname(config.KeyboardKeys[m+l][1])); + //strcpy(tempbuf, KB_ScanCodeToString(ud.config.KeyboardKeys[m+l][1])); + strcpy(tempbuf, (char *)getkeyname(ud.config.KeyboardKeys[m+l][1])); if (!tempbuf[0]) strcpy(tempbuf, " -"); minitextshade(70+120+34,34+l*8,tempbuf, (m+l == probey && currentlist?0:16),2,10+16); @@ -3397,11 +3397,11 @@ cheat_for_port_credits: { sound(PISTOL_BODYHIT); - config.KeyboardKeys[function][whichkey] = KB_GetLastScanCode(); + ud.config.KeyboardKeys[function][whichkey] = KB_GetLastScanCode(); if (function == gamefunc_Show_Console) OSD_CaptureKey(KB_GetLastScanCode()); else - CONTROL_MapKey(function, config.KeyboardKeys[function][0], config.KeyboardKeys[function][1]); + CONTROL_MapKey(function, ud.config.KeyboardKeys[function][0], ud.config.KeyboardKeys[function][1]); } cmenu(204); @@ -3459,9 +3459,9 @@ cheat_for_port_credits: function = 0; whichkey = x; if (x < (MAXMOUSEBUTTONS-2)*2) - probey = config.MouseFunctions[x>>1][x&1]; + probey = ud.config.MouseFunctions[x>>1][x&1]; else - probey = config.MouseFunctions[x-4][0]; + probey = ud.config.MouseFunctions[x-4][0]; if (probey < 0) probey = NUMGAMEFUNCTIONS-1; break; } @@ -3474,16 +3474,16 @@ cheat_for_port_credits: if (l&1) { Bstrcpy(tempbuf, "Double "); - m = config.MouseFunctions[l>>1][1]; + m = ud.config.MouseFunctions[l>>1][1]; } else - m = config.MouseFunctions[l>>1][0]; + m = ud.config.MouseFunctions[l>>1][0]; Bstrcat(tempbuf, mousebuttonnames[l>>1]); } else { Bstrcpy(tempbuf, mousebuttonnames[l-(MAXMOUSEBUTTONS-2)]); - m = config.MouseFunctions[l-(MAXMOUSEBUTTONS-2)][0]; + m = ud.config.MouseFunctions[l-(MAXMOUSEBUTTONS-2)][0]; } minitextshade(c+20,36+l*8,tempbuf,(l==probey)?0:16,1,10+16); @@ -3574,12 +3574,12 @@ cheat_for_port_credits: { if (whichkey < (MAXMOUSEBUTTONS-2)*2) { - config.MouseFunctions[whichkey>>1][whichkey&1] = x; + ud.config.MouseFunctions[whichkey>>1][whichkey&1] = x; CONTROL_MapButton(x, whichkey>>1, whichkey&1, controldevice_mouse); } else { - config.MouseFunctions[whichkey-(MAXMOUSEBUTTONS-2)][0] = x; + ud.config.MouseFunctions[whichkey-(MAXMOUSEBUTTONS-2)][0] = x; CONTROL_MapButton(x, whichkey-(MAXMOUSEBUTTONS-2), 0, controldevice_mouse); } cmenu(205); @@ -3587,7 +3587,7 @@ cheat_for_port_credits: } else if (function == 1) { - config.MouseDigitalFunctions[whichkey>>1][whichkey&1] = x; + ud.config.MouseDigitalFunctions[whichkey>>1][whichkey&1] = x; CONTROL_MapDigitalAxis(whichkey>>1, x, whichkey&1, controldevice_mouse); cmenu(212); probey = 3+(whichkey^2); @@ -3596,12 +3596,12 @@ cheat_for_port_credits: { if (whichkey < 2*joynumbuttons) { - config.JoystickFunctions[whichkey>>1][whichkey&1] = x; + ud.config.JoystickFunctions[whichkey>>1][whichkey&1] = x; CONTROL_MapButton(x, whichkey>>1, whichkey&1, controldevice_joystick); } else { - config.JoystickFunctions[joynumbuttons + (whichkey-2*joynumbuttons)][0] = x; + ud.config.JoystickFunctions[joynumbuttons + (whichkey-2*joynumbuttons)][0] = x; CONTROL_MapButton(x, joynumbuttons + (whichkey-2*joynumbuttons), 0, controldevice_joystick); } cmenu(207); @@ -3609,7 +3609,7 @@ cheat_for_port_credits: } else if (function == 3) { - config.JoystickDigitalFunctions[whichkey>>1][whichkey&1] = x; + ud.config.JoystickDigitalFunctions[whichkey>>1][whichkey&1] = x; CONTROL_MapDigitalAxis(whichkey>>1, x, whichkey&1, controldevice_joystick); cmenu((whichkey>>2)+208); probey = 1+((whichkey>>1)&1)*4+(whichkey&1); @@ -3739,7 +3739,7 @@ cheat_for_port_credits: function = 1; whichkey = (x-3)^2; // flip the actual axis number cmenu(211); - probey = config.MouseDigitalFunctions[whichkey>>1][whichkey&1]; + probey = ud.config.MouseDigitalFunctions[whichkey>>1][whichkey&1]; if (probey < 0) probey = NUMGAMEFUNCTIONS-1; break; } @@ -3755,79 +3755,79 @@ cheat_for_port_credits: } menutext(c,46,MENUHIGHLIGHT(0),0,"X-AXIS SCALE"); - l = (config.MouseAnalogueScale[0]+262144) >> 13; + l = (ud.config.MouseAnalogueScale[0]+262144) >> 13; bar(c+160+40,46,(short *)&l,1,x==0,MENUHIGHLIGHT(0),0); l = (l<<13)-262144; - if (l != config.MouseAnalogueScale[0]) + if (l != ud.config.MouseAnalogueScale[0]) { CONTROL_SetAnalogAxisScale(0, l, controldevice_mouse); - config.MouseAnalogueScale[0] = l; + ud.config.MouseAnalogueScale[0] = l; } Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0); gametext(c+160-16,46-8,tempbuf,MENUHIGHLIGHT(0),2+8+16); menutext(c,46+16,MENUHIGHLIGHT(1),0,"Y-AXIS SCALE"); - l = (config.MouseAnalogueScale[1]+262144) >> 13; + l = (ud.config.MouseAnalogueScale[1]+262144) >> 13; bar(c+160+40,46+16,(short *)&l,1,x==1,MENUHIGHLIGHT(1),0); l = (l<<13)-262144; - if (l != config.MouseAnalogueScale[1]) + if (l != ud.config.MouseAnalogueScale[1]) { CONTROL_SetAnalogAxisScale(1, l, controldevice_mouse); - config.MouseAnalogueScale[1] = l; + ud.config.MouseAnalogueScale[1] = l; } Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0); gametext(c+160-16,46+16-8,tempbuf,MENUHIGHLIGHT(1),2+8+16); menutext(c,46+16+16,MENUHIGHLIGHT(2),0,"DEAD ZONE"); - l = config.MouseFilter>>1; + l = ud.config.MouseFilter>>1; bar(c+160+40,46+16+16,(short *)&l,2,x==2,MENUHIGHLIGHT(2),0); - config.MouseFilter = l<<1; + ud.config.MouseFilter = l<<1; menutext(c,46+16+16+16+8,/*(MENUHIGHLIGHT(3))+(MENUHIGHLIGHT(4))+(MENUHIGHLIGHT(5))+(MENUHIGHLIGHT(6))-24*/0,0,"DIGITAL AXES ACTIONS"); - if (config.MouseFilter == 0) + if (ud.config.MouseFilter == 0) Bsprintf(tempbuf," OFF"); - else if (config.MouseFilter < 48) + else if (ud.config.MouseFilter < 48) Bsprintf(tempbuf," LOW"); - else if (config.MouseFilter < 96) + else if (ud.config.MouseFilter < 96) Bsprintf(tempbuf," MED"); - else if (config.MouseFilter < 128) + else if (ud.config.MouseFilter < 128) Bsprintf(tempbuf,"HIGH"); gametext(c+160-16,46+16+16-8,tempbuf,MENUHIGHLIGHT(2),2+8+16); gametextpal(c+10,90+16,"UP:",MENUHIGHLIGHT(3),10); - if (config.MouseDigitalFunctions[1][0] < 0) + if (ud.config.MouseDigitalFunctions[1][0] < 0) strcpy(tempbuf, " -NONE-"); else - strcpy(tempbuf, CONFIG_FunctionNumToName(config.MouseDigitalFunctions[1][0])); + strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[1][0])); for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; minitextshade(c+10+60,91+16,tempbuf,MENUHIGHLIGHT(3),0,10+16); gametextpal(c+10,90+16+10,"DOWN:",MENUHIGHLIGHT(4),10); - if (config.MouseDigitalFunctions[1][1] < 0) + if (ud.config.MouseDigitalFunctions[1][1] < 0) strcpy(tempbuf, " -NONE-"); else - strcpy(tempbuf, CONFIG_FunctionNumToName(config.MouseDigitalFunctions[1][1])); + strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[1][1])); for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; minitextshade(c+10+60,91+16+10,tempbuf,MENUHIGHLIGHT(4),0,10+16); gametextpal(c+10,90+16+10+10,"LEFT:",MENUHIGHLIGHT(5),10); - if (config.MouseDigitalFunctions[0][0] < 0) + if (ud.config.MouseDigitalFunctions[0][0] < 0) strcpy(tempbuf, " -NONE-"); else - strcpy(tempbuf, CONFIG_FunctionNumToName(config.MouseDigitalFunctions[0][0])); + strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[0][0])); for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; minitextshade(c+10+60,91+16+10+10,tempbuf,MENUHIGHLIGHT(5),0,10+16); gametextpal(c+10,90+16+10+10+10,"RIGHT:",MENUHIGHLIGHT(6),10); - if (config.MouseDigitalFunctions[0][1] < 0) + if (ud.config.MouseDigitalFunctions[0][1] < 0) strcpy(tempbuf, " -NONE-"); else - strcpy(tempbuf, CONFIG_FunctionNumToName(config.MouseDigitalFunctions[0][1])); + strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[0][1])); for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; minitextshade(c+10+60,91+16+10+10+10,tempbuf,MENUHIGHLIGHT(6),0,10+16); @@ -3882,11 +3882,11 @@ cheat_for_port_credits: cmenu(211); if (x < 2*joynumbuttons) { - probey = config.JoystickFunctions[x>>1][x&1]; + probey = ud.config.JoystickFunctions[x>>1][x&1]; } else { - probey = config.JoystickFunctions[joynumbuttons + (x-2*joynumbuttons)][0]; + probey = ud.config.JoystickFunctions[joynumbuttons + (x-2*joynumbuttons)][0]; } if (probey < 0) probey = NUMGAMEFUNCTIONS-1; break; @@ -3906,7 +3906,7 @@ cheat_for_port_credits: if (m+l < 2*joynumbuttons) { sprintf(tempbuf, "%s%s", ((l+m)&1)?"Double ":"", getjoyname(1,(l+m)>>1)); - x = config.JoystickFunctions[(l+m)>>1][(l+m)&1]; + x = ud.config.JoystickFunctions[(l+m)>>1][(l+m)&1]; } else { @@ -3914,7 +3914,7 @@ cheat_for_port_credits: { "Up", "Right", "Down", "Left" }; sprintf(tempbuf, "Hat %s", directions[(l+m)-2*joynumbuttons]); - x = config.JoystickFunctions[joynumbuttons + ((l+m)-2*joynumbuttons)][0]; + x = ud.config.JoystickFunctions[joynumbuttons + ((l+m)-2*joynumbuttons)][0]; } minitextshade(80-4,33+l*8,tempbuf,(m+l == probey)?0:16,1,10+16); @@ -4003,19 +4003,19 @@ cheat_for_port_credits: function = 3; whichkey = ((thispage*2+(x==5||x==6)) << 1) + (x==2||x==6); cmenu(211); - probey = config.JoystickDigitalFunctions[whichkey>>1][whichkey&1]; + probey = ud.config.JoystickDigitalFunctions[whichkey>>1][whichkey&1]; if (probey < 0) probey = NUMGAMEFUNCTIONS-1; break; case 3: // analogues case 7: - l = config.JoystickAnalogueAxes[thispage*2+(x==7)]; + l = ud.config.JoystickAnalogueAxes[thispage*2+(x==7)]; if (l == analog_turning) l = analog_strafing; else if (l == analog_strafing) l = analog_lookingupanddown; else if (l == analog_lookingupanddown) l = analog_moving; else if (l == analog_moving) l = -1; else l = analog_turning; - config.JoystickAnalogueAxes[thispage*2+(x==7)] = l; + ud.config.JoystickAnalogueAxes[thispage*2+(x==7)] = l; CONTROL_MapAnalogAxis(thispage*2+(x==7),l,controldevice_joystick); { extern int32 mouseyaxismode; // player.c @@ -4034,38 +4034,38 @@ cheat_for_port_credits: menutext(42,32+64,0,0,tempbuf); } gametext(76,38,"SCALE",0,2+8+16); - l = (config.JoystickAnalogueScale[thispage*2]+262144) >> 13; + l = (ud.config.JoystickAnalogueScale[thispage*2]+262144) >> 13; bar(140+56,38+8,(short *)&l,1,x==0,0,0); l = (l<<13)-262144; - if (l != config.JoystickAnalogueScale[thispage*2]) + if (l != ud.config.JoystickAnalogueScale[thispage*2]) { CONTROL_SetAnalogAxisScale(thispage*2, l, controldevice_joystick); - config.JoystickAnalogueScale[thispage*2] = l; + ud.config.JoystickAnalogueScale[thispage*2] = l; } Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0); gametext(140,38,tempbuf,0,2+8+16); gametext(76,38+15,"DIGITAL",0,2+8+16); - if (config.JoystickDigitalFunctions[thispage*2][0] < 0) + if (ud.config.JoystickDigitalFunctions[thispage*2][0] < 0) strcpy(tempbuf, " -NONE-"); else - strcpy(tempbuf, CONFIG_FunctionNumToName(config.JoystickDigitalFunctions[thispage*2][0])); + strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2][0])); for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; minitext(140+12,38+15,tempbuf,0,10+16); - if (config.JoystickDigitalFunctions[thispage*2][1] < 0) + if (ud.config.JoystickDigitalFunctions[thispage*2][1] < 0) strcpy(tempbuf, " -NONE-"); else - strcpy(tempbuf, CONFIG_FunctionNumToName(config.JoystickDigitalFunctions[thispage*2][1])); + strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2][1])); for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; minitext(140+12+72,38+15,tempbuf,0,10+16); gametext(76,38+15+15,"ANALOG",0,2+8+16); - if (CONFIG_AnalogNumToName(config.JoystickAnalogueAxes[thispage*2])) + if (CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[thispage*2])) { - p = CONFIG_AnalogNumToName(config.JoystickAnalogueAxes[thispage*2]); + p = CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[thispage*2]); if (p) { gametext(140+12,38+15+15, strchr(p,'_')+1, 0, 2+8+16); @@ -4075,38 +4075,38 @@ cheat_for_port_credits: if (twothispage) { gametext(76,38+64,"SCALE",0,2+8+16); - l = (config.JoystickAnalogueScale[thispage*2+1]+262144) >> 13; + l = (ud.config.JoystickAnalogueScale[thispage*2+1]+262144) >> 13; bar(140+56,38+8+64,(short *)&l,1,x==4,0,0); l = (l<<13)-262144; - if (l != config.JoystickAnalogueScale[thispage*2+1]) + if (l != ud.config.JoystickAnalogueScale[thispage*2+1]) { CONTROL_SetAnalogAxisScale(thispage*2+1, l, controldevice_joystick); - config.JoystickAnalogueScale[thispage*2+1] = l; + ud.config.JoystickAnalogueScale[thispage*2+1] = l; } Bsprintf(tempbuf,"%s%.2f",l>=0?" ":"",(float)l/65536.0); gametext(140,38+64,tempbuf,0,2+8+16); gametext(76,38+64+15,"DIGITAL",0,2+8+16); - if (config.JoystickDigitalFunctions[thispage*2+1][0] < 0) + if (ud.config.JoystickDigitalFunctions[thispage*2+1][0] < 0) strcpy(tempbuf, " -NONE-"); else - strcpy(tempbuf, CONFIG_FunctionNumToName(config.JoystickDigitalFunctions[thispage*2+1][0])); + strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2+1][0])); for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; minitext(140+12,38+15+64,tempbuf,0,10+16); - if (config.JoystickDigitalFunctions[thispage*2+1][1] < 0) + if (ud.config.JoystickDigitalFunctions[thispage*2+1][1] < 0) strcpy(tempbuf, " -NONE-"); else - strcpy(tempbuf, CONFIG_FunctionNumToName(config.JoystickDigitalFunctions[thispage*2+1][1])); + strcpy(tempbuf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[thispage*2+1][1])); for (i=0;tempbuf[i];i++) if (tempbuf[i]=='_') tempbuf[i] = ' '; minitext(140+12+72,38+15+64,tempbuf,0,10+16); gametext(76,38+64+15+15,"ANALOG",0,2+8+16); - if (CONFIG_AnalogNumToName(config.JoystickAnalogueAxes[thispage*2+1])) + if (CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[thispage*2+1])) { - p = CONFIG_AnalogNumToName(config.JoystickAnalogueAxes[thispage*2+1]); + p = CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[thispage*2+1]); if (p) { gametext(140+12,38+64+15+15, strchr(p,'_')+1, 0, 2+8+16); @@ -4161,8 +4161,8 @@ cheat_for_port_credits: gametext(128,48+30*(m-first)-8,"DEAD",0,2+8+16); gametext(128,48+30*(m-first)-8+15,"SATU",0,2+8+16); - dx = odx = min(64,64l*config.JoystickAnalogueDead[m]/10000l); - dy = ody = min(64,64l*config.JoystickAnalogueSaturate[m]/10000l); + dx = odx = min(64,64l*ud.config.JoystickAnalogueDead[m]/10000l); + dy = ody = min(64,64l*ud.config.JoystickAnalogueSaturate[m]/10000l); bar(217,48+30*(m-first),(short *)&dx,4,x==((m-first)*2),0,0); bar(217,48+30*(m-first)+15,(short *)&dy,4,x==((m-first)*2+1),0,0); @@ -4172,10 +4172,10 @@ cheat_for_port_credits: Bsprintf(tempbuf,"%3d%%",100*dy/64); gametext(217-49,48+30*(m-first)-8+15,tempbuf,0,2+8+16); - if (dx != odx) config.JoystickAnalogueDead[m] = 10000l*dx/64l; - if (dy != ody) config.JoystickAnalogueSaturate[m] = 10000l*dy/64l; + if (dx != odx) ud.config.JoystickAnalogueDead[m] = 10000l*dx/64l; + if (dy != ody) ud.config.JoystickAnalogueSaturate[m] = 10000l*dy/64l; if (dx != odx || dy != ody) - setjoydeadzone(m,config.JoystickAnalogueDead[m],config.JoystickAnalogueSaturate[m]); + setjoydeadzone(m,ud.config.JoystickAnalogueDead[m],ud.config.JoystickAnalogueSaturate[m]); } //gametext(160,158,"DEAD = DEAD ZONE, SAT. = SATURATION",0,2+8+16); if (joynumaxes>4) @@ -4198,9 +4198,9 @@ cheat_for_port_credits: switch (x) { case -1: - if (ps[myconnectindex].gm&MODE_GAME && current_menu == 701) + if (g_player[myconnectindex].ps.gm&MODE_GAME && current_menu == 701) { - ps[myconnectindex].gm &= ~MODE_MENU; + g_player[myconnectindex].ps.gm &= ~MODE_MENU; if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; @@ -4212,10 +4212,10 @@ cheat_for_port_credits: probey = 1; break; case 0: - if (config.FXDevice >= 0) + if (ud.config.FXDevice >= 0) { - config.SoundToggle = 1-config.SoundToggle; - if (config.SoundToggle == 0) + ud.config.SoundToggle = 1-ud.config.SoundToggle; + if (ud.config.SoundToggle == 0) { FX_StopAllSounds(); clearsoundlocks(); @@ -4224,13 +4224,13 @@ cheat_for_port_credits: } break; case 1: - if (config.MusicDevice >= 0 && (numplayers < 2 || config.MusicToggle)) + if (ud.config.MusicDevice >= 0 && (numplayers < 2 || ud.config.MusicToggle)) { - config.MusicToggle = 1-config.MusicToggle; - if (config.MusicToggle == 0) MUSIC_Pause(); + ud.config.MusicToggle = 1-ud.config.MusicToggle; + if (ud.config.MusicToggle == 0) MUSIC_Pause(); else { - if (ud.recstat != 2 && ps[myconnectindex].gm&MODE_GAME) + if (ud.recstat != 2 && g_player[myconnectindex].ps.gm&MODE_GAME) { if (map[(unsigned char)music_select].musicfn != NULL) playmusic(&map[(unsigned char)music_select].musicfn[0]); @@ -4244,21 +4244,21 @@ cheat_for_port_credits: break; case 4: - if (config.SoundToggle && (config.FXDevice >= 0)) + if (ud.config.SoundToggle && (ud.config.FXDevice >= 0)) { - config.VoiceToggle = (config.VoiceToggle == 2) ? 0 : config.VoiceToggle+1; + ud.config.VoiceToggle = (ud.config.VoiceToggle == 2) ? 0 : ud.config.VoiceToggle+1; } onbar = 0; break; case 5: - if (config.SoundToggle && (config.FXDevice >= 0)) config.AmbienceToggle = 1-config.AmbienceToggle; + if (ud.config.SoundToggle && (ud.config.FXDevice >= 0)) ud.config.AmbienceToggle = 1-ud.config.AmbienceToggle; onbar = 0; break; case 6: - if (config.SoundToggle && (config.FXDevice >= 0)) + if (ud.config.SoundToggle && (ud.config.FXDevice >= 0)) { - config.ReverseStereo = 1-config.ReverseStereo; - FX_SetReverseStereo(config.ReverseStereo); + ud.config.ReverseStereo = 1-ud.config.ReverseStereo; + FX_SetReverseStereo(ud.config.ReverseStereo); } onbar = 0; break; @@ -4267,48 +4267,48 @@ cheat_for_port_credits: break; } - menutext(c+151+40,50,MENUHIGHLIGHT(0),(config.FXDevice<0),config.SoundToggle && config.FXDevice >= 0?"ON":"OFF"); + menutext(c+151+40,50,MENUHIGHLIGHT(0),(ud.config.FXDevice<0),ud.config.SoundToggle && ud.config.FXDevice >= 0?"ON":"OFF"); - menutext(c+151+40,50+16,MENUHIGHLIGHT(1),(config.MusicDevice<0||(numplayers > 1 && !config.MusicToggle)),(config.MusicToggle && (config.MusicDevice >= 0))?"ON":"OFF"); + menutext(c+151+40,50+16,MENUHIGHLIGHT(1),(ud.config.MusicDevice<0||(numplayers > 1 && !ud.config.MusicToggle)),(ud.config.MusicToggle && (ud.config.MusicDevice >= 0))?"ON":"OFF"); - menutext(c,50,MENUHIGHLIGHT(0),(config.FXDevice<0),"SOUND"); - menutext(c,50+16+16,MENUHIGHLIGHT(2),(config.FXDevice<0)||config.SoundToggle==0,"SOUND VOLUME"); + menutext(c,50,MENUHIGHLIGHT(0),(ud.config.FXDevice<0),"SOUND"); + menutext(c,50+16+16,MENUHIGHLIGHT(2),(ud.config.FXDevice<0)||ud.config.SoundToggle==0,"SOUND VOLUME"); { - l = config.FXVolume; - config.FXVolume >>= 2; - bar(c+167+40,50+16+16,(short *)&config.FXVolume,4,(config.FXDevice>=0)&&x==2,MENUHIGHLIGHT(2),config.SoundToggle==0||(config.FXDevice<0)); - if (l != config.FXVolume) - config.FXVolume <<= 2; - if (l != config.FXVolume) - FX_SetVolume((short) config.FXVolume); + l = ud.config.FXVolume; + ud.config.FXVolume >>= 2; + bar(c+167+40,50+16+16,(short *)&ud.config.FXVolume,4,(ud.config.FXDevice>=0)&&x==2,MENUHIGHLIGHT(2),ud.config.SoundToggle==0||(ud.config.FXDevice<0)); + if (l != ud.config.FXVolume) + ud.config.FXVolume <<= 2; + if (l != ud.config.FXVolume) + FX_SetVolume((short) ud.config.FXVolume); } - menutext(c,50+16,MENUHIGHLIGHT(1),(config.MusicDevice<0||(numplayers > 1 && !config.MusicToggle)),"MUSIC"); - menutext(c,50+16+16+16,MENUHIGHLIGHT(3),(config.MusicDevice<0)||config.MusicToggle==0,"MUSIC VOLUME"); + menutext(c,50+16,MENUHIGHLIGHT(1),(ud.config.MusicDevice<0||(numplayers > 1 && !ud.config.MusicToggle)),"MUSIC"); + menutext(c,50+16+16+16,MENUHIGHLIGHT(3),(ud.config.MusicDevice<0)||ud.config.MusicToggle==0,"MUSIC VOLUME"); { - l = config.MusicVolume; - config.MusicVolume >>= 2; + l = ud.config.MusicVolume; + ud.config.MusicVolume >>= 2; bar(c+167+40,50+16+16+16, - (short *)&config.MusicVolume,4, - (config.MusicDevice>=0) && x==3,MENUHIGHLIGHT(3), - config.MusicToggle==0||(config.MusicDevice<0)); - config.MusicVolume <<= 2; - if (l != config.MusicVolume) - MUSIC_SetVolume((short) config.MusicVolume); + (short *)&ud.config.MusicVolume,4, + (ud.config.MusicDevice>=0) && x==3,MENUHIGHLIGHT(3), + ud.config.MusicToggle==0||(ud.config.MusicDevice<0)); + ud.config.MusicVolume <<= 2; + if (l != ud.config.MusicVolume) + MUSIC_SetVolume((short) ud.config.MusicVolume); } - menutext(c,50+16+16+16+16,MENUHIGHLIGHT(4),(config.FXDevice<0)||config.SoundToggle==0,"DUKE TALK"); - menutext(c,50+16+16+16+16+16,MENUHIGHLIGHT(5),(config.FXDevice<0)||config.SoundToggle==0,"AMBIENCE"); + menutext(c,50+16+16+16+16,MENUHIGHLIGHT(4),(ud.config.FXDevice<0)||ud.config.SoundToggle==0,"DUKE TALK"); + menutext(c,50+16+16+16+16+16,MENUHIGHLIGHT(5),(ud.config.FXDevice<0)||ud.config.SoundToggle==0,"AMBIENCE"); - menutext(c,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),(config.FXDevice<0)||config.SoundToggle==0,"FLIP STEREO"); + menutext(c,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),(ud.config.FXDevice<0)||ud.config.SoundToggle==0,"FLIP STEREO"); { char *s[] = { "OFF", "LOCAL", "ALL" }; - menutext(c+151+40,50+16+16+16+16,MENUHIGHLIGHT(4),(config.FXDevice<0)||config.SoundToggle==0,s[config.VoiceToggle]); + menutext(c+151+40,50+16+16+16+16,MENUHIGHLIGHT(4),(ud.config.FXDevice<0)||ud.config.SoundToggle==0,s[ud.config.VoiceToggle]); } - menutext(c+151+40,50+16+16+16+16+16,MENUHIGHLIGHT(5),(config.FXDevice<0)||config.SoundToggle==0,config.AmbienceToggle?"ON":"OFF"); + menutext(c+151+40,50+16+16+16+16+16,MENUHIGHLIGHT(5),(ud.config.FXDevice<0)||ud.config.SoundToggle==0,ud.config.AmbienceToggle?"ON":"OFF"); - menutext(c+151+40,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),(config.FXDevice<0)||config.SoundToggle==0,config.ReverseStereo?"ON":"OFF"); + menutext(c+151+40,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),(ud.config.FXDevice<0)||ud.config.SoundToggle==0,ud.config.ReverseStereo?"ON":"OFF"); break; @@ -4354,7 +4354,7 @@ cheat_for_port_credits: if (x == -1) { // readsavenames(); - ps[myconnectindex].gm = MODE_GAME; + g_player[myconnectindex].ps.gm = MODE_GAME; if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; @@ -4376,7 +4376,7 @@ cheat_for_port_credits: saveplayer(-1-(current_menu-360)); else saveplayer(current_menu-360); lastsavedpos = current_menu-360; - ps[myconnectindex].gm = MODE_GAME; + g_player[myconnectindex].ps.gm = MODE_GAME; if (ud.multimode < 2 && ud.recstat != 2) { @@ -4441,16 +4441,16 @@ cheat_for_port_credits: case -1: if (current_menu == 300) { - if ((ps[myconnectindex].gm&MODE_GAME) != MODE_GAME) + if ((g_player[myconnectindex].ps.gm&MODE_GAME) != MODE_GAME) { cmenu(0); break; } else - ps[myconnectindex].gm &= ~MODE_MENU; + g_player[myconnectindex].ps.gm &= ~MODE_MENU; } else - ps[myconnectindex].gm = MODE_GAME; + g_player[myconnectindex].ps.gm = MODE_GAME; if (ud.multimode < 2 && ud.recstat != 2) { @@ -4544,7 +4544,7 @@ DISPLAYNAMES: if (KB_KeyPressed(sc_Escape)) { - if (ps[myconnectindex].gm&MODE_GAME) + if (g_player[myconnectindex].ps.gm&MODE_GAME) cmenu(50); else cmenu(0); return; @@ -4604,7 +4604,7 @@ VOLUME_ALL_40x: if (x == -1) { - if (ps[myconnectindex].gm&MODE_GAME) + if (g_player[myconnectindex].ps.gm&MODE_GAME) cmenu(50); else cmenu(0); return; @@ -4642,8 +4642,8 @@ VOLUME_ALL_40x: { KB_ClearKeyDown(sc_N); quittimer = 0; - if (ps[myconnectindex].gm&MODE_DEMO && ud.recstat == 2) - ps[myconnectindex].gm = MODE_DEMO; + if (g_player[myconnectindex].ps.gm&MODE_DEMO && ud.recstat == 2) + g_player[myconnectindex].ps.gm = MODE_DEMO; else { if (current_menu == 502) @@ -4651,9 +4651,9 @@ VOLUME_ALL_40x: cmenu(last_menu); probey = last_menu_pos; } - else if (!(ps[myconnectindex].gm & MODE_GAME || ud.recstat == 2)) + else if (!(g_player[myconnectindex].ps.gm & MODE_GAME || ud.recstat == 2)) cmenu(0); - else ps[myconnectindex].gm &= ~MODE_MENU; + else g_player[myconnectindex].ps.gm &= ~MODE_MENU; if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; @@ -4671,7 +4671,7 @@ VOLUME_ALL_40x: if (KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) || KB_KeyPressed(sc_Y) || LMB) { KB_FlushKeyboardQueue(); - ps[myconnectindex].gm = MODE_DEMO; + g_player[myconnectindex].ps.gm = MODE_DEMO; if (ud.recstat == 1) closedemowrite(); cmenu(0); @@ -4681,7 +4681,7 @@ VOLUME_ALL_40x: if (x == -1 || KB_KeyPressed(sc_N) || RMB) { - ps[myconnectindex].gm &= ~MODE_MENU; + g_player[myconnectindex].ps.gm &= ~MODE_MENU; if (ud.multimode < 2 && ud.recstat != 2) { ready2send = 1; @@ -4694,7 +4694,7 @@ VOLUME_ALL_40x: case 601: displayfragbar(); rotatesprite(160<<16,29<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(320>>1,34,0,0,&ud.user_name[myconnectindex][0]); + menutext(320>>1,34,0,0,&g_player[myconnectindex].user_name[0]); sprintf(tempbuf,"Waiting for master"); gametext(160,50,tempbuf,0,2+8+16); @@ -4724,7 +4724,7 @@ VOLUME_ALL_40x: x = probe(186,124,0,0); if (voting != myconnectindex) - ps[myconnectindex].gm &= ~MODE_MENU; + g_player[myconnectindex].ps.gm &= ~MODE_MENU; if (x == -1) { @@ -4752,9 +4752,9 @@ VOLUME_ALL_40x: plrvotes += votes[i]; j += gotvote[i]; } - if (j == numplayers || !ps[myconnectindex].i || (plrvotes > (numplayers>>1)) || (!networkmode && myconnectindex == connecthead)) + if (j == numplayers || !g_player[myconnectindex].ps.i || (plrvotes > (numplayers>>1)) || (!networkmode && myconnectindex == connecthead)) { - if (plrvotes > (numplayers>>1) || !ps[myconnectindex].i || (!networkmode && myconnectindex == connecthead)) + if (plrvotes > (numplayers>>1) || !g_player[myconnectindex].ps.i || (!networkmode && myconnectindex == connecthead)) { if (ud.m_player_skill == 3) ud.m_respawn_monsters = 1; else ud.m_respawn_monsters = 0; @@ -4799,8 +4799,8 @@ VOLUME_ALL_40x: } Bsprintf(fta_quotes[116],"VOTE FAILED"); - FTA(116,&ps[myconnectindex]); - ps[myconnectindex].gm &= ~MODE_MENU; + FTA(116,&g_player[myconnectindex].ps); + g_player[myconnectindex].ps.gm &= ~MODE_MENU; } } else @@ -4811,10 +4811,10 @@ VOLUME_ALL_40x: } case 600: c = (320>>1) - 120; - if ((ps[myconnectindex].gm&MODE_GAME) != MODE_GAME) + if ((g_player[myconnectindex].ps.gm&MODE_GAME) != MODE_GAME) displayfragbar(); rotatesprite(160<<16,26<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); - menutext(160,31,0,0,&ud.user_name[myconnectindex][0]); + menutext(160,31,0,0,&g_player[myconnectindex].user_name[0]); x = probe(c,57-8,16,8); @@ -4853,7 +4853,7 @@ VOLUME_ALL_40x: { case -1: ud.m_recstat = 0; - if (ps[myconnectindex].gm&MODE_GAME) cmenu(50); + if (g_player[myconnectindex].ps.gm&MODE_GAME) cmenu(50); else cmenu(0); break; case 0: @@ -4923,7 +4923,7 @@ VOLUME_ALL_40x: case 7: if (voting == -1) { - if (ps[myconnectindex].i) + if (g_player[myconnectindex].ps.i) { Bmemset(votes,0,sizeof(votes)); Bmemset(gotvote,0,sizeof(gotvote)); @@ -5021,7 +5021,7 @@ VOLUME_ALL_40x: break; } - if ((ps[myconnectindex].gm&MODE_MENU) != MODE_MENU) + if ((g_player[myconnectindex].ps.gm&MODE_MENU) != MODE_MENU) { vscrn(); cameraclock = totalclock; diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 53602e458..a4c00c4ad 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -112,7 +112,7 @@ static int osdcmd_changelevel(const osdfuncparm_t *parm) ud.m_volume_number = volume; ud.m_level_number = level; - if (ps[myconnectindex].i) + if (g_player[myconnectindex].ps.i) { int i; @@ -136,12 +136,12 @@ static int osdcmd_changelevel(const osdfuncparm_t *parm) if ((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY) && !(gametype_flags[ud.m_coop] & GAMETYPE_FLAG_TDM)) ud.m_noexits = 0; - ps[myconnectindex].gm |= MODE_MENU; + g_player[myconnectindex].ps.gm |= MODE_MENU; cmenu(603); } return OSDCMD_OK; } - if (ps[myconnectindex].gm & MODE_GAME) + if (g_player[myconnectindex].ps.gm & MODE_GAME) { // in-game behave like a cheat osdcmd_cheatsinfo_stat.cheatnum = 2; @@ -214,7 +214,7 @@ static int osdcmd_map(const osdfuncparm_t *parm) ud.m_volume_number = 0; ud.m_level_number = 7; - if (ps[myconnectindex].i) + if (g_player[myconnectindex].ps.i) { int i; @@ -238,7 +238,7 @@ static int osdcmd_map(const osdfuncparm_t *parm) if ((gametype_flags[ud.m_coop] & GAMETYPE_FLAG_PLAYERSFRIENDLY) && !(gametype_flags[ud.m_coop] & GAMETYPE_FLAG_TDM)) ud.m_noexits = 0; - ps[myconnectindex].gm |= MODE_MENU; + g_player[myconnectindex].ps.gm |= MODE_MENU; cmenu(603); } return OSDCMD_OK; @@ -263,7 +263,7 @@ static int osdcmd_map(const osdfuncparm_t *parm) static int osdcmd_god(const osdfuncparm_t *parm) { - if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME) + if (numplayers == 1 && g_player[myconnectindex].ps.gm & MODE_GAME) { osdcmd_cheatsinfo_stat.cheatnum = 0; } @@ -277,7 +277,7 @@ static int osdcmd_god(const osdfuncparm_t *parm) static int osdcmd_noclip(const osdfuncparm_t *parm) { - if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME) + if (numplayers == 1 && g_player[myconnectindex].ps.gm & MODE_GAME) { osdcmd_cheatsinfo_stat.cheatnum = 20; } @@ -359,9 +359,9 @@ static int osdcmd_restartsound(const osdfuncparm_t *parm) FX_StopAllSounds(); clearsoundlocks(); - if (config.MusicToggle == 1) + if (ud.config.MusicToggle == 1) { - if (ud.recstat != 2 && ps[myconnectindex].gm&MODE_GAME) + if (ud.recstat != 2 && g_player[myconnectindex].ps.gm&MODE_GAME) { if (map[(unsigned char)music_select].musicfn != NULL) playmusic(&map[(unsigned char)music_select].musicfn[0]); @@ -375,9 +375,9 @@ static int osdcmd_restartsound(const osdfuncparm_t *parm) static int osdcmd_restartvid(const osdfuncparm_t *parm) { resetvideomode(); - if (setgamemode(config.ScreenMode,config.ScreenWidth,config.ScreenHeight,config.ScreenBPP)) + if (setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP)) gameexit("restartvid: Reset failed...\n"); - onvideomodechange(config.ScreenBPP>8); + onvideomodechange(ud.config.ScreenBPP>8); vscrn(); return OSDCMD_OK; @@ -385,8 +385,8 @@ static int osdcmd_restartvid(const osdfuncparm_t *parm) static int osdcmd_vidmode(const osdfuncparm_t *parm) { - int newbpp = config.ScreenBPP, newwidth = config.ScreenWidth, - newheight = config.ScreenHeight, newfs = config.ScreenMode; + int newbpp = ud.config.ScreenBPP, newwidth = ud.config.ScreenWidth, + newheight = ud.config.ScreenHeight, newfs = ud.config.ScreenMode; if (parm->numparms < 1 || parm->numparms > 4) return OSDCMD_SHOWHELP; switch (parm->numparms) @@ -411,14 +411,14 @@ static int osdcmd_vidmode(const osdfuncparm_t *parm) if (setgamemode(newfs,newwidth,newheight,newbpp)) { initprintf("vidmode: Mode change failed!\n"); - if (setgamemode(config.ScreenMode, config.ScreenWidth, config.ScreenHeight, config.ScreenBPP)) + if (setgamemode(ud.config.ScreenMode, ud.config.ScreenWidth, ud.config.ScreenHeight, ud.config.ScreenBPP)) gameexit("vidmode: Reset failed!\n"); } - config.ScreenBPP = newbpp; - config.ScreenWidth = newwidth; - config.ScreenHeight = newheight; - config.ScreenMode = newfs; - onvideomodechange(config.ScreenBPP>8); + ud.config.ScreenBPP = newbpp; + ud.config.ScreenWidth = newwidth; + ud.config.ScreenHeight = newheight; + ud.config.ScreenMode = newfs; + onvideomodechange(ud.config.ScreenBPP>8); vscrn(); return OSDCMD_OK; } @@ -445,7 +445,7 @@ static int osdcmd_spawn(const osdfuncparm_t *parm) short ang=0; short set=0, idx; - if (numplayers > 1 || !(ps[myconnectindex].gm & MODE_GAME)) + if (numplayers > 1 || !(g_player[myconnectindex].ps.gm & MODE_GAME)) { OSD_Printf("spawn: Can't spawn sprites in multiplayer games or demos\n"); return OSDCMD_OK; @@ -507,7 +507,7 @@ static int osdcmd_spawn(const osdfuncparm_t *parm) return OSDCMD_SHOWHELP; } - idx = spawn(ps[myconnectindex].i, (short)picnum); + idx = spawn(g_player[myconnectindex].ps.i, (short)picnum); if (set & 1) sprite[idx].pal = (char)pal; if (set & 2) sprite[idx].cstat = (short)cstat; if (set & 4) sprite[idx].ang = ang; @@ -542,7 +542,7 @@ static int osdcmd_setvar(const osdfuncparm_t *parm) for (i=0;iparms[0])<<2; - setbrightness(ud.brightness>>2,&ps[screenpeek].palette[0],0); + setbrightness(ud.brightness>>2,&g_player[screenpeek].ps.palette[0],0); OSD_Printf("gamma %d\n",ud.brightness>>2); return OSDCMD_OK; } @@ -766,9 +766,9 @@ static int osdcmd_give(const osdfuncparm_t *parm) { int i; - if (numplayers == 1 && ps[myconnectindex].gm & MODE_GAME) + if (numplayers == 1 && g_player[myconnectindex].ps.gm & MODE_GAME) { - if (ps[myconnectindex].dead_flag != 0) + if (g_player[myconnectindex].ps.dead_flag != 0) { OSD_Printf("give: Cannot give while dead.\n"); return OSDCMD_OK; @@ -783,7 +783,7 @@ static int osdcmd_give(const osdfuncparm_t *parm) } else if (!Bstrcasecmp(parm->parms[0], "health")) { - sprite[ps[myconnectindex].i].extra = 200; + sprite[g_player[myconnectindex].ps.i].extra = 200; return OSDCMD_OK; } else if (!Bstrcasecmp(parm->parms[0], "weapons")) @@ -795,13 +795,13 @@ static int osdcmd_give(const osdfuncparm_t *parm) { for (i=PISTOL_WEAPON;iparms[0], "armor")) { - ps[myconnectindex].shield_amount = 100; + g_player[myconnectindex].ps.shield_amount = 100; return OSDCMD_OK; } else if (!Bstrcasecmp(parm->parms[0], "keys")) @@ -829,20 +829,20 @@ void onvideomodechange(int newmode) if (newmode) { - if (ps[screenpeek].palette == palette || - ps[screenpeek].palette == waterpal || - ps[screenpeek].palette == titlepal || - ps[screenpeek].palette == animpal || - ps[screenpeek].palette == endingpal || - ps[screenpeek].palette == drealms || - ps[screenpeek].palette == slimepal) - pal = ps[screenpeek].palette; + if (g_player[screenpeek].ps.palette == palette || + g_player[screenpeek].ps.palette == waterpal || + g_player[screenpeek].ps.palette == titlepal || + g_player[screenpeek].ps.palette == animpal || + g_player[screenpeek].ps.palette == endingpal || + g_player[screenpeek].ps.palette == drealms || + g_player[screenpeek].ps.palette == slimepal) + pal = g_player[screenpeek].ps.palette; else pal = palette; } else { - pal = ps[screenpeek].palette; + pal = g_player[screenpeek].ps.palette; } setbrightness(ud.brightness>>2, pal, 0); @@ -856,12 +856,12 @@ static int osdcmd_usemousejoy(const osdfuncparm_t *parm) { if (showval) { - OSD_Printf("usemouse is %d\n", config.UseMouse); + OSD_Printf("usemouse is %d\n", ud.config.UseMouse); } else { - config.UseMouse = (atoi(parm->parms[0]) != 0); - CONTROL_MouseEnabled = (config.UseMouse && CONTROL_MousePresent); + ud.config.UseMouse = (atoi(parm->parms[0]) != 0); + CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent); } return OSDCMD_OK; } @@ -869,12 +869,12 @@ static int osdcmd_usemousejoy(const osdfuncparm_t *parm) { if (showval) { - OSD_Printf("usejoystick is %d\n", config.UseJoystick); + OSD_Printf("usejoystick is %d\n", ud.config.UseJoystick); } else { - config.UseJoystick = (atoi(parm->parms[0]) != 0); - CONTROL_JoystickEnabled = (config.UseJoystick && CONTROL_JoyPresent); + ud.config.UseJoystick = (atoi(parm->parms[0]) != 0); + CONTROL_JoystickEnabled = (ud.config.UseJoystick && CONTROL_JoyPresent); } return OSDCMD_OK; } diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 4000516a5..2fda03a6e 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -39,7 +39,7 @@ long g_weapon_xoffset; int32 turnheldtime; //MED int32 lastcontroltime; //MED -void setpal(struct player_struct *p) +void setpal(player_struct *p) { if (p->heat_on) p->palette = slimepal; else if ((sector[p->cursectnum].ceilingpicnum >= FLOORSLIME)&&(sector[p->cursectnum].ceilingpicnum <=FLOORSLIME+2)) @@ -55,7 +55,7 @@ void setpal(struct player_struct *p) restorepalette = 1; } -static void incur_damage(struct player_struct *p) +static void incur_damage(player_struct *p) { long damage = 0L, shield_damage = 0L; @@ -94,7 +94,7 @@ static void incur_damage(struct player_struct *p) } -void quickkill(struct player_struct *p) +void quickkill(player_struct *p) { p->pals[0] = 48; p->pals[1] = 48; @@ -129,9 +129,9 @@ static void tracers(long x1,long y1,long z1,long x2,long y2,long z2,long n) if (sect >= 0) { if (sector[sect].lotag == 2) - EGS(sect,x1,y1,z1,WATERBUBBLE,-32,4+(TRAND&3),4+(TRAND&3),TRAND&2047,0,0,ps[0].i,5); + EGS(sect,x1,y1,z1,WATERBUBBLE,-32,4+(TRAND&3),4+(TRAND&3),TRAND&2047,0,0,g_player[0].ps.i,5); else - EGS(sect,x1,y1,z1,SMALLSMOKE,-32,14,14,0,0,0,ps[0].i,5); + EGS(sect,x1,y1,z1,SMALLSMOKE,-32,14,14,0,0,0,g_player[0].ps.i,5); } } } @@ -167,7 +167,7 @@ static void hitscantrail(long x1, long y1, long z1, long x2, long y2, long z2, i updatesector(x1,y1,§); if (sect >= 0) { - j = EGS(sect,x1,y1,z1,projectile[atwith].trail,-32,projectile[atwith].txrepeat,projectile[atwith].tyrepeat,ang,0,0,ps[0].i,0); + j = EGS(sect,x1,y1,z1,projectile[atwith].trail,-32,projectile[atwith].txrepeat,projectile[atwith].tyrepeat,ang,0,0,g_player[0].ps.i,0); changespritestat(j,1); } else continue; @@ -201,9 +201,9 @@ static int aim(spritetype *s,int aang,int atwith) if (s->picnum == APLAYER) { - if (!ps[s->yvel].auto_aim) + if (!g_player[s->yvel].ps.auto_aim) return -1; - if (ps[s->yvel].auto_aim == 2) + if (g_player[s->yvel].ps.auto_aim == 2) { if (checkspriteflagsp(atwith,SPRITE_FLAG_PROJECTILE) && (projectile[atwith].workslike & PROJECTILE_FLAG_RPG)) return -1; @@ -228,8 +228,8 @@ static int aim(spritetype *s,int aang,int atwith) j = -1; - gotshrinker = (s->picnum == APLAYER && *aplWeaponWorksLike[ps[s->yvel].curr_weapon] == SHRINKER_WEAPON); - gotfreezer = (s->picnum == APLAYER && *aplWeaponWorksLike[ps[s->yvel].curr_weapon] == FREEZE_WEAPON); + gotshrinker = (s->picnum == APLAYER && *aplWeaponWorksLike[g_player[s->yvel].ps.curr_weapon] == SHRINKER_WEAPON); + gotfreezer = (s->picnum == APLAYER && *aplWeaponWorksLike[g_player[s->yvel].ps.curr_weapon] == FREEZE_WEAPON); smax = 0x7fffffff; @@ -253,7 +253,7 @@ static int aim(spritetype *s,int aang,int atwith) { if (PN == APLAYER && // ud.ffire == 0 && - (GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) || (GTFLAGS(GAMETYPE_FLAG_TDM) && ps[sprite[i].yvel].team == ps[s->yvel].team)) && + (GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) || (GTFLAGS(GAMETYPE_FLAG_TDM) && g_player[sprite[i].yvel].ps.team == g_player[s->yvel].ps.team)) && s->picnum == APLAYER && s != &sprite[i]) continue; @@ -281,7 +281,7 @@ static int aim(spritetype *s,int aang,int atwith) if (sdist > 512 && sdist < smax) { if (s->picnum == APLAYER) - a = (klabs(scale(SZ-s->z,10,sdist)-(ps[s->yvel].horiz+ps[s->yvel].horizoff-100)) < 100); + a = (klabs(scale(SZ-s->z,10,sdist)-(g_player[s->yvel].ps.horiz+g_player[s->yvel].ps.horizoff-100)) < 100); else a = 1; if (PN == ORGANTIC || PN == ROTATEGUN) @@ -313,12 +313,12 @@ int shoot(int i,int atwith) { p = s->yvel; - sx = ps[p].posx; - sy = ps[p].posy; - sz = ps[p].posz+ps[p].pyoff+(4<<8); - sa = ps[p].ang; + sx = g_player[p].ps.posx; + sy = g_player[p].ps.posy; + sz = g_player[p].ps.posz+g_player[p].ps.pyoff+(4<<8); + sa = g_player[p].ps.ang; - ps[p].crack_time = 777; + g_player[p].ps.crack_time = 777; } else { @@ -360,13 +360,13 @@ int shoot(int i,int atwith) { if (p >= 0) { - zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; + zvel = (100-g_player[p].ps.horiz-g_player[p].ps.horizoff)<<5; sz += (6<<8); sa += 15; } else if (!(projectile[atwith].workslike & PROJECTILE_FLAG_NOAIM)) { - j = ps[findplayer(s,&x)].i; + j = g_player[findplayer(s,&x)].ps.i; zvel = ((sprite[j].z-sz)<<8) / (x+1); sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } @@ -511,7 +511,7 @@ int shoot(int i,int atwith) if (projectile[atwith].sound > -1) spritesound(projectile[atwith].sound,j); } - if (p >= 0 && ps[p].steroids_amount > 0 && ps[p].steroids_amount < 400) + if (p >= 0 && g_player[p].ps.steroids_amount > 0 && g_player[p].ps.steroids_amount < 400) sprite[j].extra += (max_player_health>>2); if (hitspr >= 0 && sprite[hitspr].picnum != ACCESSSWITCH && sprite[hitspr].picnum != ACCESSSWITCH2) @@ -536,10 +536,10 @@ int shoot(int i,int atwith) } else if (p >= 0 && zvel > 0 && sector[hitsect].lotag == 1) { - j = spawn(ps[p].i,WATERSPLASH2); + j = spawn(g_player[p].ps.i,WATERSPLASH2); sprite[j].x = hitx; sprite[j].y = hity; - sprite[j].ang = ps[p].ang; // Total tweek + sprite[j].ang = g_player[p].ps.ang; // Total tweek sprite[j].xvel = 32; ssp(i,CLIPMASK0); sprite[j].xvel = 0; @@ -573,7 +573,7 @@ int shoot(int i,int atwith) dal -= (8<<8); return -1; } - zvel = ((sprite[j].z-sz-dal)<<8) / ldist(&sprite[ps[p].i], &sprite[j]) ; + zvel = ((sprite[j].z-sz-dal)<<8) / ldist(&sprite[g_player[p].ps.i], &sprite[j]) ; sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } @@ -587,9 +587,9 @@ int shoot(int i,int atwith) if (projectile[atwith].workslike & PROJECTILE_FLAG_ACCURATE_AUTOAIM) { - if (!ps[p].auto_aim) + if (!g_player[p].ps.auto_aim) { - zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; + zvel = (100-g_player[p].ps.horiz-g_player[p].ps.horizoff)<<5; if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; hitscan(sx,sy,sz,sect,sintable[(sa+512)&2047],sintable[sa&2047], zvel<<6,&hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); @@ -603,7 +603,7 @@ int shoot(int i,int atwith) if (j == -1) { sa += (angRange/2)-(TRAND&(angRange-1)); - zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; + zvel = (100-g_player[p].ps.horiz-g_player[p].ps.horizoff)<<5; zvel += (zRange/2)-(TRAND&(zRange-1)); } } @@ -613,7 +613,7 @@ int shoot(int i,int atwith) if (j == -1) { // no target - zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; + zvel = (100-g_player[p].ps.horiz-g_player[p].ps.horizoff)<<5; } zvel += (zRange/2)-(TRAND&(zRange-1)); } @@ -623,7 +623,7 @@ int shoot(int i,int atwith) { j = findplayer(s,&x); sz -= (4<<8); - zvel = ((ps[j].posz-sz) <<8) / (ldist(&sprite[ps[j].i], s)); + zvel = ((g_player[j].ps.posz-sz) <<8) / (ldist(&sprite[g_player[j].ps.i], s)); if (s->picnum != BOSS1) { zvel += 128-(TRAND&255); @@ -632,7 +632,7 @@ int shoot(int i,int atwith) else { zvel += 128-(TRAND&255); - sa = getangle(ps[j].posx-sx,ps[j].posy-sy)+64-(TRAND&127); + sa = getangle(g_player[j].ps.posx-sx,g_player[j].ps.posy-sy)+64-(TRAND&127); } } @@ -701,7 +701,7 @@ int shoot(int i,int atwith) if (hitspr >= 0) { checkhitsprite(hitspr,k); - if (sprite[hitspr].picnum == APLAYER && (ud.ffire == 1 || (!GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) && GTFLAGS(GAMETYPE_FLAG_TDM) && ps[sprite[hitspr].yvel].team != ps[sprite[i].yvel].team))) + if (sprite[hitspr].picnum == APLAYER && (ud.ffire == 1 || (!GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) && GTFLAGS(GAMETYPE_FLAG_TDM) && g_player[sprite[hitspr].yvel].ps.team != g_player[sprite[i].yvel].ps.team))) { l = spawn(k,JIBS6); sprite[k].xrepeat = sprite[k].yrepeat = 0; @@ -892,12 +892,12 @@ DOSKIPBULLETHOLE: if (j >= 0) { dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)+(8<<8); - zvel = ((sprite[j].z-sz-dal)*vel) / ldist(&sprite[ps[p].i], &sprite[j]); + zvel = ((sprite[j].z-sz-dal)*vel) / ldist(&sprite[g_player[p].ps.i], &sprite[j]); if (sprite[j].picnum != RECON) sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } - // else zvel = (100-ps[p].horiz-ps[p].horizoff)*81; - else zvel = ((100-ps[p].horiz-ps[p].horizoff)*(projectile[atwith].vel/8)); + // else zvel = (100-g_player[p].ps.horiz-g_player[p].ps.horizoff)*81; + else zvel = ((100-g_player[p].ps.horiz-g_player[p].ps.horizoff)*(projectile[atwith].vel/8)); if (projectile[atwith].sound > -1) spritesound(projectile[atwith].sound,i); } else @@ -905,10 +905,10 @@ DOSKIPBULLETHOLE: if (!(projectile[atwith].workslike & PROJECTILE_FLAG_NOAIM)) { j = findplayer(s,&x); - sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy); + sa = getangle(g_player[j].ps.oposx-sx,g_player[j].ps.oposy-sy); - l = ldist(&sprite[ps[j].i],s); - zvel = ((ps[j].oposz-sz)*vel) / l; + l = ldist(&sprite[g_player[j].ps.i],s); + zvel = ((g_player[j].ps.oposz-sz)*vel) / l; if (badguy(s) && (s->hitag&face_player_smart)) sa = s->ang+(TRAND&31)-16; @@ -992,13 +992,13 @@ DOSKIPBULLETHOLE: { if (p >= 0) { - zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; + zvel = (100-g_player[p].ps.horiz-g_player[p].ps.horizoff)<<5; sz += (6<<8); sa += 15; } else { - j = ps[findplayer(s,&x)].i; + j = g_player[findplayer(s,&x)].ps.i; zvel = ((sprite[j].z-sz)<<8) / (x+1); sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } @@ -1075,7 +1075,7 @@ DOSKIPBULLETHOLE: hittype[k].temp_data[8] = hitspr; } - if (p >= 0 && ps[p].steroids_amount > 0 && ps[p].steroids_amount < 400) + if (p >= 0 && g_player[p].ps.steroids_amount > 0 && g_player[p].ps.steroids_amount < 400) sprite[j].extra += (max_player_health>>2); if (hitspr >= 0 && sprite[hitspr].picnum != ACCESSSWITCH && sprite[hitspr].picnum != ACCESSSWITCH2) @@ -1100,10 +1100,10 @@ DOSKIPBULLETHOLE: } else if (p >= 0 && zvel > 0 && sector[hitsect].lotag == 1) { - j = spawn(ps[p].i,WATERSPLASH2); + j = spawn(g_player[p].ps.i,WATERSPLASH2); sprite[j].x = hitx; sprite[j].y = hity; - sprite[j].ang = ps[p].ang; // Total tweek + sprite[j].ang = g_player[p].ps.ang; // Total tweek sprite[j].xvel = 32; ssp(i,CLIPMASK0); sprite[j].xvel = 0; @@ -1140,7 +1140,7 @@ DOSKIPBULLETHOLE: dal -= (8<<8); } - zvel = ((sprite[j].z-sz-dal)<<8) / ldist(&sprite[ps[p].i], &sprite[j]) ; + zvel = ((sprite[j].z-sz-dal)<<8) / ldist(&sprite[g_player[p].ps.i], &sprite[j]) ; sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } @@ -1157,9 +1157,9 @@ DOSKIPBULLETHOLE: if (atwith == SHOTSPARK1__STATIC && !WW2GI && !NAM) { - if (!ps[p].auto_aim) + if (!g_player[p].ps.auto_aim) { - zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; + zvel = (100-g_player[p].ps.horiz-g_player[p].ps.horizoff)<<5; if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; hitscan(sx,sy,sz,sect,sintable[(sa+512)&2047],sintable[sa&2047], zvel<<6,&hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); @@ -1173,7 +1173,7 @@ DOSKIPBULLETHOLE: if (j == -1) { sa += (angRange/2)-(TRAND&(angRange-1)); - zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; + zvel = (100-g_player[p].ps.horiz-g_player[p].ps.horizoff)<<5; zvel += (zRange/2)-(TRAND&(zRange-1)); } } @@ -1183,7 +1183,7 @@ DOSKIPBULLETHOLE: if (j == -1) { // no target - zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; + zvel = (100-g_player[p].ps.horiz-g_player[p].ps.horizoff)<<5; } zvel += (zRange/2)-(TRAND&(zRange-1)); } @@ -1194,7 +1194,7 @@ DOSKIPBULLETHOLE: { j = findplayer(s,&x); sz -= (4<<8); - zvel = ((ps[j].posz-sz) <<8) / (ldist(&sprite[ps[j].i], s)); + zvel = ((g_player[j].ps.posz-sz) <<8) / (ldist(&sprite[g_player[j].ps.i], s)); if (s->picnum != BOSS1) { zvel += 128-(TRAND&255); @@ -1203,7 +1203,7 @@ DOSKIPBULLETHOLE: else { zvel += 128-(TRAND&255); - sa = getangle(ps[j].posx-sx,ps[j].posy-sy)+64-(TRAND&127); + sa = getangle(g_player[j].ps.posx-sx,g_player[j].ps.posy-sy)+64-(TRAND&127); } } @@ -1253,7 +1253,7 @@ DOSKIPBULLETHOLE: if (hitspr >= 0) { checkhitsprite(hitspr,k); - if (sprite[hitspr].picnum == APLAYER && (ud.ffire == 1 || (!GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) && GTFLAGS(GAMETYPE_FLAG_TDM) && ps[sprite[hitspr].yvel].team != ps[sprite[i].yvel].team))) + if (sprite[hitspr].picnum == APLAYER && (ud.ffire == 1 || (!GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) && GTFLAGS(GAMETYPE_FLAG_TDM) && g_player[sprite[hitspr].yvel].ps.team != g_player[sprite[i].yvel].ps.team))) { l = spawn(k,JIBS6); sprite[k].xrepeat = sprite[k].yrepeat = 0; @@ -1426,18 +1426,18 @@ SKIPBULLETHOLE: if (j >= 0) { dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)-(12<<8); - zvel = ((sprite[j].z-sz-dal)*vel) / ldist(&sprite[ps[p].i], &sprite[j]) ; + zvel = ((sprite[j].z-sz-dal)*vel) / ldist(&sprite[g_player[p].ps.i], &sprite[j]) ; sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } else - zvel = (100-ps[p].horiz-ps[p].horizoff)*98; + zvel = (100-g_player[p].ps.horiz-g_player[p].ps.horizoff)*98; } else { j = findplayer(s,&x); - // sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy); + // sa = getangle(g_player[j].ps.oposx-sx,g_player[j].ps.oposy-sy); sa += 16-(TRAND&31); - zvel = (((ps[j].oposz - sz + (3<<8)))*vel) / ldist(&sprite[ps[j].i],s); + zvel = (((g_player[j].ps.oposz - sz + (3<<8)))*vel) / ldist(&sprite[g_player[j].ps.i],s); } if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; oldzvel = zvel; @@ -1526,18 +1526,18 @@ SKIPBULLETHOLE: if (j >= 0) { dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1)+(8<<8); - zvel = ((sprite[j].z-sz-dal)*vel) / ldist(&sprite[ps[p].i], &sprite[j]); + zvel = ((sprite[j].z-sz-dal)*vel) / ldist(&sprite[g_player[p].ps.i], &sprite[j]); if (sprite[j].picnum != RECON) sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } - else zvel = (100-ps[p].horiz-ps[p].horizoff)*81; + else zvel = (100-g_player[p].ps.horiz-g_player[p].ps.horizoff)*81; if (atwith == RPG) spritesound(RPG_SHOOT,i); } else { j = findplayer(s,&x); - sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy); + sa = getangle(g_player[j].ps.oposx-sx,g_player[j].ps.oposy-sy); if (PN == BOSS3) sz -= (32<<8); else if (PN == BOSS2) @@ -1546,8 +1546,8 @@ SKIPBULLETHOLE: sz += 24<<8; } - l = ldist(&sprite[ps[j].i],s); - zvel = ((ps[j].oposz-sz)*vel) / l; + l = ldist(&sprite[g_player[j].ps.i],s); + zvel = ((g_player[j].ps.oposz-sz)*vel) / l; if (badguy(s) && (s->hitag&face_player_smart)) sa = s->ang+(TRAND&31)-16; @@ -1608,13 +1608,13 @@ SKIPBULLETHOLE: } } - else if (*aplWeaponWorksLike[ps[p].curr_weapon] == DEVISTATOR_WEAPON) + else if (*aplWeaponWorksLike[g_player[p].ps.curr_weapon] == DEVISTATOR_WEAPON) { sprite[j].extra >>= 2; sprite[j].ang += 16-(TRAND&31); sprite[j].zvel += 256-(TRAND&511); - if (ps[p].hbomb_hold_delay) + if (g_player[p].ps.hbomb_hold_delay) { sprite[j].x -= sintable[sa&2047]/644; sprite[j].y -= sintable[(sa+1024+512)&2047]/644; @@ -1639,10 +1639,10 @@ SKIPBULLETHOLE: case HANDHOLDINGLASER__STATIC: if (p >= 0) - zvel = (100-ps[p].horiz-ps[p].horizoff)*32; + zvel = (100-g_player[p].ps.horiz-g_player[p].ps.horizoff)*32; else zvel = 0; if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; - hitscan(sx,sy,sz-ps[p].pyoff,sect, + hitscan(sx,sy,sz-g_player[p].ps.pyoff,sect, sintable[(sa+512)&2047], sintable[sa&2047], zvel<<6,&hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); @@ -1664,12 +1664,12 @@ SKIPBULLETHOLE: if (j == 1) { - long lTripBombControl=GetGameVar("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE, ps[p].i, p); + long lTripBombControl=GetGameVar("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE, g_player[p].ps.i, p); k = EGS(hitsect,hitx,hity,hitz,TRIPBOMB,-16,4,5,sa,0,0,i,6); if (lTripBombControl & TRIPBOMB_TIMER) { - long lLifetime=GetGameVar("STICKYBOMB_LIFETIME", NAM_GRENADE_LIFETIME, ps[p].i, p); - long lLifetimeVar=GetGameVar("STICKYBOMB_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, ps[p].i, p); + long lLifetime=GetGameVar("STICKYBOMB_LIFETIME", NAM_GRENADE_LIFETIME, g_player[p].ps.i, p); + long lLifetimeVar=GetGameVar("STICKYBOMB_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, g_player[p].ps.i, p); // set timer. blows up when at zero.... hittype[k].temp_data[7]=lLifetime + mulscale(krand(),lLifetimeVar, 14) @@ -1694,7 +1694,7 @@ SKIPBULLETHOLE: if (s->extra >= 0) s->shade = -96; - j = ps[findplayer(s,&x)].i; + j = g_player[findplayer(s,&x)].ps.i; x = ldist(&sprite[j],s); zvel = -x>>1; @@ -1730,13 +1730,13 @@ SKIPBULLETHOLE: dal -= (8<<8); } - zvel = ((sprite[j].z-sz-dal)<<8) / (ldist(&sprite[ps[p].i], &sprite[j])); + zvel = ((sprite[j].z-sz-dal)<<8) / (ldist(&sprite[g_player[p].ps.i], &sprite[j])); sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } else { sa += 16-(TRAND&31); - zvel = (100-ps[p].horiz-ps[p].horizoff)<<5; + zvel = (100-g_player[p].ps.horiz-g_player[p].ps.horizoff)<<5; zvel += 128-(TRAND&255); } @@ -1746,7 +1746,7 @@ SKIPBULLETHOLE: { j = findplayer(s,&x); sz -= (4<<8); - zvel = ((ps[j].posz-sz) <<8) / (ldist(&sprite[ps[j].i], s)); + zvel = ((g_player[j].ps.posz-sz) <<8) / (ldist(&sprite[g_player[j].ps.i], s)); zvel += 128-(TRAND&255); sa += 32-(TRAND&63); } @@ -1817,16 +1817,16 @@ SKIPBULLETHOLE: if (j >= 0) { dal = ((sprite[j].xrepeat*tilesizy[sprite[j].picnum])<<1); - zvel = ((sprite[j].z-sz-dal-(4<<8))*768) / (ldist(&sprite[ps[p].i], &sprite[j])); + zvel = ((sprite[j].z-sz-dal-(4<<8))*768) / (ldist(&sprite[g_player[p].ps.i], &sprite[j])); sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } - else zvel = (100-ps[p].horiz-ps[p].horizoff)*98; + else zvel = (100-g_player[p].ps.horiz-g_player[p].ps.horizoff)*98; } else if (s->statnum != 3) { j = findplayer(s,&x); - l = ldist(&sprite[ps[j].i],s); - zvel = ((ps[j].oposz-sz)*512) / l ; + l = ldist(&sprite[g_player[j].ps.i],s); + zvel = ((g_player[j].ps.oposz-sz)*512) / l ; } else zvel = 0; if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; @@ -1849,17 +1849,17 @@ static void displayloogie(int snum) { long i, a, x, y, z; - if (ps[snum].loogcnt == 0) return; + if (g_player[snum].ps.loogcnt == 0) return; - y = (ps[snum].loogcnt<<2); - for (i=0;i>5; - z = 4096+((ps[snum].loogcnt+i)<<9); - x = (-sync[snum].avel)+(sintable[((ps[snum].loogcnt+i)<<6)&2047]>>10); + a = klabs(sintable[((g_player[snum].ps.loogcnt+i)<<5)&2047])>>5; + z = 4096+((g_player[snum].ps.loogcnt+i)<<9); + x = (-g_player[snum].sync.avel)+(sintable[((g_player[snum].ps.loogcnt+i)<<6)&2047]>>10); rotatesprite( - (ps[snum].loogiex[i]+x)<<16,(200+ps[snum].loogiey[i]-y)<<16,z-(i<<8),256-a, + (g_player[snum].ps.loogiex[i]+x)<<16,(200+g_player[snum].ps.loogiey[i]-y)<<16,z-(i<<8),256-a, LOOGIE,0,0,2,0,0,xdim-1,ydim-1); } } @@ -1869,11 +1869,11 @@ static int animatefist(int gs,int snum) int looking_arc,fisti,fistpal; long fistzoom, fistz; - fisti = ps[snum].fist_incs; + fisti = g_player[snum].ps.fist_incs; if (fisti > 32) fisti = 32; if (fisti <= 0) return 0; - looking_arc = klabs(ps[snum].look_ang)/9; + looking_arc = klabs(g_player[snum].ps.look_ang)/9; fistzoom = 65536L - (sintable[(512+(fisti<<6))&2047]<<2); if (fistzoom > 90612L) @@ -1882,13 +1882,13 @@ static int animatefist(int gs,int snum) fistzoom = 40290; fistz = 194 + (sintable[((6+fisti)<<7)&2047]>>9); - if (sprite[ps[snum].i].pal == 1) + if (sprite[g_player[snum].ps.i].pal == 1) fistpal = 1; else - fistpal = sector[ps[snum].cursectnum].floorpal; + fistpal = sector[g_player[snum].ps.cursectnum].floorpal; rotatesprite( - (-fisti+222+(sync[snum].avel>>4))<<16, + (-fisti+222+(g_player[snum].sync.avel>>4))<<16, (looking_arc+fistz)<<16, fistzoom,0,FIST,gs,fistpal,2,0,0,xdim-1,ydim-1); @@ -1900,22 +1900,22 @@ static int animateknee(int gs,int snum) short knee_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-72,-32,-8}; int looking_arc, pal; - if (ps[snum].knee_incs > 11 || ps[snum].knee_incs == 0 || sprite[ps[snum].i].extra <= 0) return 0; + if (g_player[snum].ps.knee_incs > 11 || g_player[snum].ps.knee_incs == 0 || sprite[g_player[snum].ps.i].extra <= 0) return 0; - looking_arc = knee_y[ps[snum].knee_incs] + klabs(ps[snum].look_ang)/9; + looking_arc = knee_y[g_player[snum].ps.knee_incs] + klabs(g_player[snum].ps.look_ang)/9; - looking_arc -= (ps[snum].hard_landing<<3); + looking_arc -= (g_player[snum].ps.hard_landing<<3); - if (sprite[ps[snum].i].pal == 1) + if (sprite[g_player[snum].ps.i].pal == 1) pal = 1; else { - pal = sector[ps[snum].cursectnum].floorpal; + pal = sector[g_player[snum].ps.cursectnum].floorpal; if (pal == 0) - pal = ps[snum].palookup; + pal = g_player[snum].ps.palookup; } - myospal(105+(sync[snum].avel>>4)-(ps[snum].look_ang>>1)+(knee_y[ps[snum].knee_incs]>>2),looking_arc+280-((ps[snum].horiz-ps[snum].horizoff)>>4),KNEE,gs,4,pal); + myospal(105+(g_player[snum].sync.avel>>4)-(g_player[snum].ps.look_ang>>1)+(knee_y[g_player[snum].ps.knee_incs]>>2),looking_arc+280-((g_player[snum].ps.horiz-g_player[snum].ps.horizoff)>>4),KNEE,gs,4,pal); return 1; } @@ -1925,25 +1925,25 @@ static int animateknuckles(int gs,int snum) short knuckle_frames[] = {0,1,2,2,3,3,3,2,2,1,0}; int looking_arc, pal; - if (ps[snum].knuckle_incs == 0 || sprite[ps[snum].i].extra <= 0) return 0; + if (g_player[snum].ps.knuckle_incs == 0 || sprite[g_player[snum].ps.i].extra <= 0) return 0; - looking_arc = klabs(ps[snum].look_ang)/9; + looking_arc = klabs(g_player[snum].ps.look_ang)/9; - looking_arc -= (ps[snum].hard_landing<<3); + looking_arc -= (g_player[snum].ps.hard_landing<<3); - if (sprite[ps[snum].i].pal == 1) + if (sprite[g_player[snum].ps.i].pal == 1) pal = 1; else - pal = sector[ps[snum].cursectnum].floorpal; + pal = sector[g_player[snum].ps.cursectnum].floorpal; - myospal(160+(sync[snum].avel>>4)-(ps[snum].look_ang>>1),looking_arc+180-((ps[snum].horiz-ps[snum].horizoff)>>4),CRACKKNUCKLES+knuckle_frames[ps[snum].knuckle_incs>>1],gs,4,pal); + myospal(160+(g_player[snum].sync.avel>>4)-(g_player[snum].ps.look_ang>>1),looking_arc+180-((g_player[snum].ps.horiz-g_player[snum].ps.horizoff)>>4),CRACKKNUCKLES+knuckle_frames[g_player[snum].ps.knuckle_incs>>1],gs,4,pal); return 1; } long lastvisinc; -void DoFire(struct player_struct *p) +void DoFire(player_struct *p) { int i, snum = sprite[p->i].yvel; @@ -1996,7 +1996,7 @@ void DoFire(struct player_struct *p) } } -void DoSpawn(struct player_struct *p) +void DoSpawn(player_struct *p) { int j, snum = sprite[p->i].yvel; @@ -2022,12 +2022,12 @@ void displaymasks(int snum) { int p; - if (sprite[ps[snum].i].pal == 1) + if (sprite[g_player[snum].ps.i].pal == 1) p = 1; else - p = sector[ps[snum].cursectnum].floorpal; + p = sector[g_player[snum].ps.cursectnum].floorpal; - if (ps[snum].scuba_on) + if (g_player[snum].ps.scuba_on) { rotatesprite(43<<16,(200-tilesizy[SCUBAMASK])<<16,65536,0,SCUBAMASK,0,p,2+16,windowx1,windowy1,windowx2,windowy2); rotatesprite((320-43)<<16,(200-tilesizy[SCUBAMASK])<<16,65536,1024,SCUBAMASK,0,p,2+4+16,windowx1,windowy1,windowx2,windowy2); @@ -2039,23 +2039,23 @@ static int animatetip(int gs,int snum) int p,looking_arc; short tip_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16}; - if (ps[snum].tipincs == 0) return 0; + if (g_player[snum].ps.tipincs == 0) return 0; - looking_arc = klabs(ps[snum].look_ang)/9; - looking_arc -= (ps[snum].hard_landing<<3); + looking_arc = klabs(g_player[snum].ps.look_ang)/9; + looking_arc -= (g_player[snum].ps.hard_landing<<3); - if (sprite[ps[snum].i].pal == 1) + if (sprite[g_player[snum].ps.i].pal == 1) p = 1; else - p = sector[ps[snum].cursectnum].floorpal; + p = sector[g_player[snum].ps.cursectnum].floorpal; - /* if(ps[snum].access_spritenum >= 0) - p = sprite[ps[snum].access_spritenum].pal; + /* if(g_player[snum].ps.access_spritenum >= 0) + p = sprite[g_player[snum].ps.access_spritenum].pal; else - p = wall[ps[snum].access_wallnum].pal; + p = wall[g_player[snum].ps.access_wallnum].pal; */ - myospal(170+(sync[snum].avel>>4)-(ps[snum].look_ang>>1), - (tip_y[ps[snum].tipincs]>>1)+looking_arc+240-((ps[snum].horiz-ps[snum].horizoff)>>4),TIP+((26-ps[snum].tipincs)>>4),gs,0,p); + myospal(170+(g_player[snum].sync.avel>>4)-(g_player[snum].ps.look_ang>>1), + (tip_y[g_player[snum].ps.tipincs]>>1)+looking_arc+240-((g_player[snum].ps.horiz-g_player[snum].ps.horizoff)>>4),TIP+((26-g_player[snum].ps.tipincs)>>4),gs,0,p); return 1; } @@ -2066,21 +2066,21 @@ static int animateaccess(int gs,int snum) int looking_arc; int p; - if (ps[snum].access_incs == 0 || sprite[ps[snum].i].extra <= 0) return 0; + if (g_player[snum].ps.access_incs == 0 || sprite[g_player[snum].ps.i].extra <= 0) return 0; - looking_arc = access_y[ps[snum].access_incs] + klabs(ps[snum].look_ang)/9; - looking_arc -= (ps[snum].hard_landing<<3); + looking_arc = access_y[g_player[snum].ps.access_incs] + klabs(g_player[snum].ps.look_ang)/9; + looking_arc -= (g_player[snum].ps.hard_landing<<3); - if (ps[snum].access_spritenum >= 0) - p = sprite[ps[snum].access_spritenum].pal; + if (g_player[snum].ps.access_spritenum >= 0) + p = sprite[g_player[snum].ps.access_spritenum].pal; else p = 0; // else - // p = wall[ps[snum].access_wallnum].pal; + // p = wall[g_player[snum].ps.access_wallnum].pal; - if ((ps[snum].access_incs-3) > 0 && (ps[snum].access_incs-3)>>3) - myospal(170+(sync[snum].avel>>4)-(ps[snum].look_ang>>1)+(access_y[ps[snum].access_incs]>>2),looking_arc+266-((ps[snum].horiz-ps[snum].horizoff)>>4),HANDHOLDINGLASER+(ps[snum].access_incs>>3),gs,0,p); + if ((g_player[snum].ps.access_incs-3) > 0 && (g_player[snum].ps.access_incs-3)>>3) + myospal(170+(g_player[snum].sync.avel>>4)-(g_player[snum].ps.look_ang>>1)+(access_y[g_player[snum].ps.access_incs]>>2),looking_arc+266-((g_player[snum].ps.horiz-g_player[snum].ps.horizoff)>>4),HANDHOLDINGLASER+(g_player[snum].ps.access_incs>>3),gs,0,p); else - myospal(170+(sync[snum].avel>>4)-(ps[snum].look_ang>>1)+(access_y[ps[snum].access_incs]>>2),looking_arc+266-((ps[snum].horiz-ps[snum].horizoff)>>4),HANDHOLDINGACCESS,gs,4,p); + myospal(170+(g_player[snum].sync.avel>>4)-(g_player[snum].ps.look_ang>>1)+(access_y[g_player[snum].ps.access_incs]>>2),looking_arc+266-((g_player[snum].ps.horiz-g_player[snum].ps.horizoff)>>4),HANDHOLDINGACCESS,gs,4,p); return 1; } @@ -2106,7 +2106,7 @@ static void myospalw(long x, long y, int tilenum, int shade, int orientation, in case HANDREMOTE_WEAPON: case HANDBOMB_WEAPON: case SHOTGUN_WEAPON: - rotatesprite(160<<16,(180+(ps[screenpeek].weapon_pos*ps[screenpeek].weapon_pos))<<16,scale(65536,ud.statusbarscale,100),0,g_currentweapon==GROW_WEAPON?GROWSPRITEICON:weapon_sprites[g_currentweapon],0,0,2,windowx1,windowy1,windowx2,windowy2); + rotatesprite(160<<16,(180+(g_player[screenpeek].ps.weapon_pos*g_player[screenpeek].ps.weapon_pos))<<16,scale(65536,ud.statusbarscale,100),0,g_currentweapon==GROW_WEAPON?GROWSPRITEICON:weapon_sprites[g_currentweapon],0,0,2,windowx1,windowy1,windowx2,windowy2); break; } } @@ -2119,7 +2119,7 @@ void displayweapon(int snum) long gun_pos, looking_arc, cw; long weapon_xoffset, i, j; int o = 0,pal; - struct player_struct *p = &ps[snum]; + player_struct *p = &g_player[snum].ps; short *kb = &p->kickback_pic; int gs; @@ -2213,9 +2213,9 @@ void displayweapon(int snum) case KNEE_WEAPON: - SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); - OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[screenpeek].ps.i,screenpeek); + OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps.i,screenpeek, -1); + if (GetGameVarID(g_iReturnVarID,g_player[screenpeek].ps.i,screenpeek) == 0) { if ((*kb) > 0) { @@ -2240,9 +2240,9 @@ void displayweapon(int snum) case TRIPBOMB_WEAPON: - SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); - OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[screenpeek].ps.i,screenpeek); + OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps.i,screenpeek, -1); + if (GetGameVarID(g_iReturnVarID,g_player[screenpeek].ps.i,screenpeek) == 0) { if (sprite[p->i].pal == 1) pal = 1; @@ -2269,9 +2269,9 @@ void displayweapon(int snum) case RPG_WEAPON: - SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); - OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[screenpeek].ps.i,screenpeek); + OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps.i,screenpeek, -1); + if (GetGameVarID(g_iReturnVarID,g_player[screenpeek].ps.i,screenpeek) == 0) { if (sprite[p->i].pal == 1) pal = 1; @@ -2296,9 +2296,9 @@ void displayweapon(int snum) case SHOTGUN_WEAPON: - SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); - OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[screenpeek].ps.i,screenpeek); + OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps.i,screenpeek, -1); + if (GetGameVarID(g_iReturnVarID,g_player[screenpeek].ps.i,screenpeek) == 0) { if (sprite[p->i].pal == 1) pal = 1; @@ -2381,9 +2381,9 @@ void displayweapon(int snum) case CHAINGUN_WEAPON: - SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); - OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[screenpeek].ps.i,screenpeek); + OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps.i,screenpeek, -1); + if (GetGameVarID(g_iReturnVarID,g_player[screenpeek].ps.i,screenpeek) == 0) { if (sprite[p->i].pal == 1) pal = 1; @@ -2431,9 +2431,9 @@ void displayweapon(int snum) case PISTOL_WEAPON: - SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); - OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[screenpeek].ps.i,screenpeek); + OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps.i,screenpeek, -1); + if (GetGameVarID(g_iReturnVarID,g_player[screenpeek].ps.i,screenpeek) == 0) { if (sprite[p->i].pal == 1) pal = 1; @@ -2486,9 +2486,9 @@ void displayweapon(int snum) break; case HANDBOMB_WEAPON: { - SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); - OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[screenpeek].ps.i,screenpeek); + OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps.i,screenpeek, -1); + if (GetGameVarID(g_iReturnVarID,g_player[screenpeek].ps.i,screenpeek) == 0) { if (sprite[p->i].pal == 1) pal = 1; @@ -2521,9 +2521,9 @@ void displayweapon(int snum) case HANDREMOTE_WEAPON: { - SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); - OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[screenpeek].ps.i,screenpeek); + OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps.i,screenpeek, -1); + if (GetGameVarID(g_iReturnVarID,g_player[screenpeek].ps.i,screenpeek) == 0) { signed char remote_frames[] = {0,1,1,2,1,1,0,0,0,0,0}; if (sprite[p->i].pal == 1) @@ -2542,9 +2542,9 @@ void displayweapon(int snum) case DEVISTATOR_WEAPON: - SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); - OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[screenpeek].ps.i,screenpeek); + OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps.i,screenpeek, -1); + if (GetGameVarID(g_iReturnVarID,g_player[screenpeek].ps.i,screenpeek) == 0) { if (sprite[p->i].pal == 1) pal = 1; @@ -2578,9 +2578,9 @@ void displayweapon(int snum) case FREEZE_WEAPON: - SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); - OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[screenpeek].ps.i,screenpeek); + OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps.i,screenpeek, -1); + if (GetGameVarID(g_iReturnVarID,g_player[screenpeek].ps.i,screenpeek) == 0) { if (sprite[p->i].pal == 1) pal = 1; @@ -2606,9 +2606,9 @@ void displayweapon(int snum) case GROW_WEAPON: - SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); - OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[screenpeek].ps.i,screenpeek); + OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps.i,screenpeek, -1); + if (GetGameVarID(g_iReturnVarID,g_player[screenpeek].ps.i,screenpeek) == 0) { weapon_xoffset += 28; looking_arc += 18; @@ -2648,9 +2648,9 @@ void displayweapon(int snum) case SHRINKER_WEAPON: - SetGameVarID(g_iReturnVarID,0,ps[screenpeek].i,screenpeek); - OnEvent(EVENT_DRAWWEAPON,ps[screenpeek].i,screenpeek, -1); - if (GetGameVarID(g_iReturnVarID,ps[screenpeek].i,screenpeek) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[screenpeek].ps.i,screenpeek); + OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps.i,screenpeek, -1); + if (GetGameVarID(g_iReturnVarID,g_player[screenpeek].ps.i,screenpeek) == 0) { weapon_xoffset += 28; looking_arc += 18; @@ -2716,7 +2716,7 @@ void getinput(int snum) int32 turnamount; int32 keymove; int32 momx = 0,momy = 0; - struct player_struct *p = &ps[snum]; + player_struct *p = &g_player[snum].ps; if ((p->gm&MODE_MENU) || (p->gm&MODE_TYPE) || (ud.pause_on && !KB_KeyPressed(sc_Pause)) || (numplayers > 1 && totalclock < 10)) // HACK: kill getinput() for the first 10 tics of a new map in multi { @@ -2728,7 +2728,7 @@ void getinput(int snum) loc.avel = angvel = 0; loc.horz = horiz = 0; loc.bits = (((long)gamequit)<<26); - loc.extbits = (ud.pteam[snum] != ps[snum].team)<<6; + loc.extbits = (g_player[snum].pteam != g_player[snum].ps.team)<<6; loc.extbits |= (1<<7); return; } @@ -2749,7 +2749,7 @@ void getinput(int snum) { int32 i; if (myaimmode) i = analog_lookingupanddown; - else i = config.MouseAnalogueAxes[1]; + else i = ud.config.MouseAnalogueAxes[1]; if (i != mouseyaxismode) { @@ -2760,39 +2760,39 @@ void getinput(int snum) CONTROL_GetInput(&info); - if (config.MouseFilter) + if (ud.config.MouseFilter) { if (info.dpitch > 0) { - if (info.dpitch > config.MouseFilter) - info.dpitch -= config.MouseFilter; + if (info.dpitch > ud.config.MouseFilter) + info.dpitch -= ud.config.MouseFilter; else info.dpitch = 0; } else if (info.dpitch < 0) { - if (info.dpitch < -config.MouseFilter) - info.dpitch += config.MouseFilter; + if (info.dpitch < -ud.config.MouseFilter) + info.dpitch += ud.config.MouseFilter; else info.dpitch = 0; } if (info.dyaw > 0) { - if (info.dyaw > config.MouseFilter) - info.dyaw -= config.MouseFilter; + if (info.dyaw > ud.config.MouseFilter) + info.dyaw -= ud.config.MouseFilter; else info.dyaw = 0; } else if (info.dyaw < 0) { - if (info.dyaw < -config.MouseFilter) - info.dyaw += config.MouseFilter; + if (info.dyaw < -ud.config.MouseFilter) + info.dyaw += ud.config.MouseFilter; else info.dyaw = 0; } } - if (config.MouseBias) + if (ud.config.MouseBias) { if (klabs(info.dyaw) > klabs(info.dpitch)) - info.dpitch /= config.MouseBias; - else info.dyaw /= config.MouseBias; + info.dpitch /= ud.config.MouseBias; + else info.dyaw /= ud.config.MouseBias; } tics = totalclock-lastcontroltime; @@ -2820,7 +2820,7 @@ void getinput(int snum) loc.bits |= BUTTON(gamefunc_Look_Left)<<6; loc.bits |= BUTTON(gamefunc_Look_Right)<<7; - if (aplWeaponFlags[ps[snum].curr_weapon][snum] & WEAPON_FLAG_SEMIAUTO && BUTTON(gamefunc_Fire)) + if (aplWeaponFlags[g_player[snum].ps.curr_weapon][snum] & WEAPON_FLAG_SEMIAUTO && BUTTON(gamefunc_Fire)) CONTROL_ClearButton(gamefunc_Fire); if (jump_input > 0) @@ -2883,7 +2883,7 @@ void getinput(int snum) svel = vel = angvel = horiz = 0; - if (config.SmoothInput) + if (ud.config.SmoothInput) { if (BUTTON(gamefunc_Strafe)) { @@ -2935,9 +2935,9 @@ void getinput(int snum) if (BUTTON(gamefunc_Strafe)) { - if (BUTTON(gamefunc_Turn_Left) && !(ps[snum].movement_lock&4)) + if (BUTTON(gamefunc_Turn_Left) && !(g_player[snum].ps.movement_lock&4)) svel -= -keymove; - if (BUTTON(gamefunc_Turn_Right) && !(ps[snum].movement_lock&8)) + if (BUTTON(gamefunc_Turn_Right) && !(g_player[snum].ps.movement_lock&8)) svel -= keymove; } else @@ -2962,13 +2962,13 @@ void getinput(int snum) turnheldtime=0; } - if (BUTTON(gamefunc_Strafe_Left) && !(ps[snum].movement_lock&4)) + if (BUTTON(gamefunc_Strafe_Left) && !(g_player[snum].ps.movement_lock&4)) svel += keymove; - if (BUTTON(gamefunc_Strafe_Right) && !(ps[snum].movement_lock&8)) + if (BUTTON(gamefunc_Strafe_Right) && !(g_player[snum].ps.movement_lock&8)) svel += -keymove; - if (BUTTON(gamefunc_Move_Forward) && !(ps[snum].movement_lock&1)) + if (BUTTON(gamefunc_Move_Forward) && !(g_player[snum].ps.movement_lock&1)) vel += keymove; - if (BUTTON(gamefunc_Move_Backward) && !(ps[snum].movement_lock&2)) + if (BUTTON(gamefunc_Move_Backward) && !(g_player[snum].ps.movement_lock&2)) vel += -keymove; if (vel < -MAXVEL) vel = -MAXVEL; @@ -2986,7 +2986,7 @@ void getinput(int snum) loc.extbits |= BUTTON(gamefunc_Strafe_Right)<<3; loc.extbits |= BUTTON(gamefunc_Turn_Left)<<4; loc.extbits |= BUTTON(gamefunc_Turn_Right)<<5; - loc.extbits |= (ud.pteam[snum] != ps[snum].team)<<6; + loc.extbits |= (g_player[snum].pteam != g_player[snum].ps.team)<<6; if (ud.scrollmode && ud.overhead_on) { @@ -3019,11 +3019,11 @@ void getinput(int snum) loc.horz = horiz; } -static int doincrements(struct player_struct *p) +static int doincrements(player_struct *p) { int snum = sprite[p->i].yvel; - // j = sync[snum].avel; + // j = g_player[snum].sync.avel; // p->weapon_ang = -(j/5); if (p->invdisptime > 0) @@ -3212,7 +3212,7 @@ static int doincrements(struct player_struct *p) spritesound(DUKE_CRACK_FIRST,p->i); } - else if (p->knuckle_incs == 22 || (sync[snum].bits&(1<<2))) + else if (p->knuckle_incs == 22 || (g_player[snum].sync.bits&(1<<2))) p->knuckle_incs=0; return 1; @@ -3225,7 +3225,7 @@ short weapon_sprites[MAX_WEAPONS] = { KNEE__STATIC, FIRSTGUNSPRITE__STATIC, SHOT TRIPBOMBSPRITE__STATIC, FREEZESPRITE__STATIC, HEAVYHBOMB__STATIC, SHRINKERSPRITE__STATIC }; -void checkweapons(struct player_struct *p) +void checkweapons(player_struct *p) { int cw, snum = sprite[p->i].yvel; @@ -3254,7 +3254,7 @@ void processinput(int snum) unsigned long sb_snum; int psect, psectlotag; short *kb, tempsect; - struct player_struct *p = &ps[snum]; + player_struct *p = &g_player[snum].ps; int pi = p->i; spritetype *s = &sprite[pi]; @@ -3264,7 +3264,7 @@ void processinput(int snum) OnEvent(EVENT_PROCESSINPUT, pi, snum, -1); - if (p->cheat_phase <= 0) sb_snum = sync[snum].bits; + if (p->cheat_phase <= 0) sb_snum = g_player[snum].sync.bits; else sb_snum = 0; if ((sb_snum&(1<<2))) @@ -3412,7 +3412,7 @@ void processinput(int snum) } } for (i=connecthead;i>=0;i=connectpoint2[i]) - ps[i].gm = MODE_EOL; + g_player[i].ps.gm = MODE_EOL; p->fist_incs = 0; return; @@ -3435,7 +3435,7 @@ void processinput(int snum) else if (p->timebeforeexit == 1) { for (i=connecthead;i>=0;i=connectpoint2[i]) - ps[i].gm = MODE_EOL; + g_player[i].ps.gm = MODE_EOL; if (ud.from_bonus) { ud.level_number = ud.from_bonus; @@ -3457,12 +3457,12 @@ void processinput(int snum) p->select_dir = 0; else { - if(sync[snum].fvel > 127) + if(g_player[snum].sync.fvel > 127) { p->select_dir = 0; activatewarpelevators(pi,-1); } - else if(sync[snum].fvel <= -127) + else if(g_player[snum].sync.fvel <= -127) { p->select_dir = 0; activatewarpelevators(pi,1); @@ -3527,30 +3527,30 @@ void processinput(int snum) { if (p->frag_ps != snum) { - if (GTFLAGS(GAMETYPE_FLAG_TDM) && ps[p->frag_ps].team == ps[snum].team) - ps[p->frag_ps].fraggedself++; + if (GTFLAGS(GAMETYPE_FLAG_TDM) && g_player[p->frag_ps].ps.team == g_player[snum].ps.team) + g_player[p->frag_ps].ps.fraggedself++; else { - ps[p->frag_ps].frag++; - frags[p->frag_ps][snum]++; + g_player[p->frag_ps].ps.frag++; + g_player[p->frag_ps].frags[snum]++; } if (snum == screenpeek) { - Bsprintf(fta_quotes[115],"KILLED BY %s",&ud.user_name[p->frag_ps][0]); + Bsprintf(fta_quotes[115],"KILLED BY %s",&g_player[p->frag_ps].user_name[0]); FTA(115,p); } else { - Bsprintf(fta_quotes[116],"KILLED %s",&ud.user_name[snum][0]); - FTA(116,&ps[p->frag_ps]); + Bsprintf(fta_quotes[116],"KILLED %s",&g_player[snum].user_name[0]); + FTA(116,&g_player[p->frag_ps].ps); } if (ud.deathmsgs) { char name1[32],name2[32]; - if (GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) || (GTFLAGS(GAMETYPE_FLAG_TDM) && ps[snum].team == ps[p->frag_ps].team)) + if (GTFLAGS(GAMETYPE_FLAG_PLAYERSFRIENDLY) || (GTFLAGS(GAMETYPE_FLAG_TDM) && g_player[snum].ps.team == g_player[p->frag_ps].ps.team)) i = 9; else { @@ -3562,7 +3562,7 @@ void processinput(int snum) else i = 0; break; case SHOTSPARK1__STATIC: - switch (ps[p->frag_ps].curr_weapon) + switch (g_player[p->frag_ps].ps.curr_weapon) { default: case PISTOL_WEAPON: @@ -3593,11 +3593,11 @@ void processinput(int snum) break; } } - Bstrcpy(name1,&ud.user_name[snum][0]); - Bstrcpy(name2,&ud.user_name[p->frag_ps][0]); + Bstrcpy(name1,&g_player[snum].user_name[0]); + Bstrcpy(name2,&g_player[p->frag_ps].user_name[0]); Bsprintf(tempbuf,fta_quotes[PPDEATHSTRINGS+i+(mulscale(krand(), 3, 16)*10)],name1,name2); - if (config.ScreenWidth >= 800) + if (ud.config.ScreenWidth >= 800) adduserquote(tempbuf); else OSD_Printf("%s\n",stripcolorcodes(tempbuf)); } @@ -3612,13 +3612,13 @@ void processinput(int snum) else if (hittype[p->i].picnum == NUKEBUTTON) i = 1; else i = 0; - Bsprintf(tempbuf,fta_quotes[PSDEATHSTRINGS+i],&ud.user_name[snum][0]); + Bsprintf(tempbuf,fta_quotes[PSDEATHSTRINGS+i],&g_player[snum].user_name[0]); } - else Bsprintf(tempbuf,fta_quotes[PSDEATHSTRINGS+3],&ud.user_name[snum][0],p->team+1); + else Bsprintf(tempbuf,fta_quotes[PSDEATHSTRINGS+3],&g_player[snum].user_name[0],p->team+1); if (ud.deathmsgs) { - if (config.ScreenWidth >= 800) + if (ud.config.ScreenWidth >= 800) adduserquote(tempbuf); else OSD_Printf("%s\n",stripcolorcodes(tempbuf)); } @@ -3738,7 +3738,7 @@ void processinput(int snum) if (p->on_crane >= 0) goto HORIZONLY; - j = ksgn(sync[snum].avel); + j = ksgn(g_player[snum].sync.avel); /* if( j && ud.screen_tilting == 2) { @@ -4176,10 +4176,10 @@ void processinput(int snum) p->posxv = 0; p->posyv = 0; } - else if (sync[snum].avel) //p->ang += syncangvel * constant + else if (g_player[snum].sync.avel) //p->ang += syncangvel * constant { //ENGINE calculates angvel for you - long tempang = sync[snum].avel<<1; + long tempang = g_player[snum].sync.avel<<1; if (psectlotag == 2) p->angvel =(tempang-(tempang>>3))*ksgn(doubvel); else p->angvel = tempang*ksgn(doubvel); @@ -4285,25 +4285,25 @@ void processinput(int snum) } } - if (sync[snum].extbits&(1)) + if (g_player[snum].sync.extbits&(1)) OnEvent(EVENT_MOVEFORWARD,pi,snum, -1); - if (sync[snum].extbits&(1<<1)) + if (g_player[snum].sync.extbits&(1<<1)) OnEvent(EVENT_MOVEBACKWARD,pi,snum, -1); - if (sync[snum].extbits&(1<<2)) + if (g_player[snum].sync.extbits&(1<<2)) OnEvent(EVENT_STRAFELEFT,pi,snum, -1); - if (sync[snum].extbits&(1<<3)) + if (g_player[snum].sync.extbits&(1<<3)) OnEvent(EVENT_STRAFERIGHT,pi,snum, -1); - if (sync[snum].extbits&(1<<4) || sync[snum].avel < 0) + if (g_player[snum].sync.extbits&(1<<4) || g_player[snum].sync.avel < 0) OnEvent(EVENT_TURNLEFT,pi,snum, -1); - if (sync[snum].extbits&(1<<5) || sync[snum].avel > 0) + if (g_player[snum].sync.extbits&(1<<5) || g_player[snum].sync.avel > 0) OnEvent(EVENT_TURNRIGHT,pi,snum, -1); - if (p->posxv || p->posyv || sync[snum].fvel || sync[snum].svel) + if (p->posxv || p->posyv || g_player[snum].sync.fvel || g_player[snum].sync.svel) { p->crack_time = 777; @@ -4344,8 +4344,8 @@ void processinput(int snum) if (p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400) doubvel <<= 1; - p->posxv += ((sync[snum].fvel*doubvel)<<6); - p->posyv += ((sync[snum].svel*doubvel)<<6); + p->posxv += ((g_player[snum].sync.fvel*doubvel)<<6); + p->posyv += ((g_player[snum].sync.svel*doubvel)<<6); if ((aplWeaponWorksLike[p->curr_weapon] == KNEE_WEAPON && *kb > 10 && p->on_ground) || (p->on_ground && (sb_snum&2))) { @@ -4551,7 +4551,7 @@ HORIZONLY: if (p->horiz > 95 && p->horiz < 105) p->horiz = 100; if (p->horizoff > -5 && p->horizoff < 5) p->horizoff = 0; } - p->horiz += sync[snum].horz; + p->horiz += g_player[snum].sync.horz; if (p->horiz > 299) p->horiz = 299; else if (p->horiz < -99) p->horiz = -99; @@ -4610,8 +4610,8 @@ HORIZONLY: if (sprite[p->actorsqu].picnum == APLAYER) { - quickkill(&ps[sprite[p->actorsqu].yvel]); - ps[sprite[p->actorsqu].yvel].frag_ps = snum; + quickkill(&g_player[sprite[p->actorsqu].yvel].ps); + g_player[sprite[p->actorsqu].yvel].ps.frag_ps = snum; } else if (badguy(&sprite[p->actorsqu])) { @@ -5123,64 +5123,64 @@ int getspritescore(long snum, long dapicnum) return(120); case FREEZEAMMO__STATIC: - if (ps[snum].ammo_amount[FREEZE_WEAPON] < max_ammo_amount[FREEZE_WEAPON]) return(10); + if (g_player[snum].ps.ammo_amount[FREEZE_WEAPON] < max_ammo_amount[FREEZE_WEAPON]) return(10); return(1); case AMMO__STATIC: - if (ps[snum].ammo_amount[PISTOL_WEAPON] < max_ammo_amount[PISTOL_WEAPON]) return(10); + if (g_player[snum].ps.ammo_amount[PISTOL_WEAPON] < max_ammo_amount[PISTOL_WEAPON]) return(10); return(1); case BATTERYAMMO__STATIC: - if (ps[snum].ammo_amount[CHAINGUN_WEAPON] < max_ammo_amount[CHAINGUN_WEAPON]) return(20); + if (g_player[snum].ps.ammo_amount[CHAINGUN_WEAPON] < max_ammo_amount[CHAINGUN_WEAPON]) return(20); return(1); case DEVISTATORAMMO__STATIC: - if (ps[snum].ammo_amount[DEVISTATOR_WEAPON] < max_ammo_amount[DEVISTATOR_WEAPON]) return(25); + if (g_player[snum].ps.ammo_amount[DEVISTATOR_WEAPON] < max_ammo_amount[DEVISTATOR_WEAPON]) return(25); return(1); case RPGAMMO__STATIC: - if (ps[snum].ammo_amount[RPG_WEAPON] < max_ammo_amount[RPG_WEAPON]) return(50); + if (g_player[snum].ps.ammo_amount[RPG_WEAPON] < max_ammo_amount[RPG_WEAPON]) return(50); return(1); case CRYSTALAMMO__STATIC: - if (ps[snum].ammo_amount[SHRINKER_WEAPON] < max_ammo_amount[SHRINKER_WEAPON]) return(10); + if (g_player[snum].ps.ammo_amount[SHRINKER_WEAPON] < max_ammo_amount[SHRINKER_WEAPON]) return(10); return(1); case HBOMBAMMO__STATIC: - if (ps[snum].ammo_amount[HANDBOMB_WEAPON] < max_ammo_amount[HANDBOMB_WEAPON]) return(30); + if (g_player[snum].ps.ammo_amount[HANDBOMB_WEAPON] < max_ammo_amount[HANDBOMB_WEAPON]) return(30); return(1); case SHOTGUNAMMO__STATIC: - if (ps[snum].ammo_amount[SHOTGUN_WEAPON] < max_ammo_amount[SHOTGUN_WEAPON]) return(25); + if (g_player[snum].ps.ammo_amount[SHOTGUN_WEAPON] < max_ammo_amount[SHOTGUN_WEAPON]) return(25); return(1); case COLA__STATIC: - if (sprite[ps[snum].i].extra < 100) return(10); + if (sprite[g_player[snum].ps.i].extra < 100) return(10); return(1); case SIXPAK__STATIC: - if (sprite[ps[snum].i].extra < 100) return(30); + if (sprite[g_player[snum].ps.i].extra < 100) return(30); return(1); case FIRSTAID__STATIC: - if (ps[snum].firstaid_amount < 100) return(100); + if (g_player[snum].ps.firstaid_amount < 100) return(100); return(1); case SHIELD__STATIC: - if (ps[snum].shield_amount < 100) return(50); + if (g_player[snum].ps.shield_amount < 100) return(50); return(1); case STEROIDS__STATIC: - if (ps[snum].steroids_amount < 400) return(30); + if (g_player[snum].ps.steroids_amount < 400) return(30); return(1); case AIRTANK__STATIC: - if (ps[snum].scuba_amount < 6400) return(30); + if (g_player[snum].ps.scuba_amount < 6400) return(30); return(1); case JETPACK__STATIC: - if (ps[snum].jetpack_amount < 1600) return(100); + if (g_player[snum].ps.jetpack_amount < 1600) return(100); return(1); case HEATSENSOR__STATIC: - if (ps[snum].heat_amount < 1200) return(5); + if (g_player[snum].ps.heat_amount < 1200) return(5); return(1); case ACCESSCARD__STATIC: return(1); case BOOTS__STATIC: - if (ps[snum].boot_amount < 200) return(15); + if (g_player[snum].ps.boot_amount < 200) return(15); return(1); case ATOMICHEALTH__STATIC: - if (sprite[ps[snum].i].extra < max_player_health<<1) return(50); + if (sprite[g_player[snum].ps.i].extra < max_player_health<<1) return(50); return(1); case HOLODUKE__STATIC: - if (ps[snum].holoduke_amount < 2400) return(5); + if (g_player[snum].ps.holoduke_amount < 2400) return(5); return(1); case MUSICANDSFX__STATIC: return(1); @@ -5216,7 +5216,7 @@ void computergetinput(long snum, input *syn) long dist, daang, zang, fightdist, damyang, damysect; long startsect, endsect, splc, send, startwall, endwall; short dasect, dawall, daspr; - struct player_struct *p = &ps[snum]; + player_struct *p = &g_player[snum].ps; walltype *wal; syn->fvel = 0; @@ -5242,26 +5242,26 @@ void computergetinput(long snum, input *syn) if (!(numframes&7)) { - x2 = sprite[ps[goalplayer[snum]].i].x; - y2 = sprite[ps[goalplayer[snum]].i].y; - z2 = sprite[ps[goalplayer[snum]].i].z; + x2 = sprite[g_player[goalplayer[snum]].ps.i].x; + y2 = sprite[g_player[goalplayer[snum]].ps.i].y; + z2 = sprite[g_player[goalplayer[snum]].ps.i].z; - if (!cansee(x1,y1,z1-(48<<8),damysect,x2,y2,z2-(48<<8),sprite[ps[goalplayer[snum]].i].sectnum)) + if (!cansee(x1,y1,z1-(48<<8),damysect,x2,y2,z2-(48<<8),sprite[g_player[goalplayer[snum]].ps.i].sectnum)) goalplayer[snum] = snum; } - if ((goalplayer[snum] == snum) || (ps[goalplayer[snum]].dead_flag != 0)) + if ((goalplayer[snum] == snum) || (g_player[goalplayer[snum]].ps.dead_flag != 0)) { j = 0x7fffffff; for (i=connecthead;i>=0;i=connectpoint2[i]) - if (i != snum && !(GTFLAGS(GAMETYPE_FLAG_TDM) && ps[snum].team == ps[i].team)) + if (i != snum && !(GTFLAGS(GAMETYPE_FLAG_TDM) && g_player[snum].ps.team == g_player[i].ps.team)) { - dist = ksqrt((sprite[ps[i].i].x-x1)*(sprite[ps[i].i].x-x1)+(sprite[ps[i].i].y-y1)*(sprite[ps[i].i].y-y1)); + dist = ksqrt((sprite[g_player[i].ps.i].x-x1)*(sprite[g_player[i].ps.i].x-x1)+(sprite[g_player[i].ps.i].y-y1)*(sprite[g_player[i].ps.i].y-y1)); - x2 = sprite[ps[i].i].x; - y2 = sprite[ps[i].i].y; - z2 = sprite[ps[i].i].z; - if (!cansee(x1,y1,z1-(48<<8),damysect,x2,y2,z2-(48<<8),sprite[ps[i].i].sectnum)) + x2 = sprite[g_player[i].ps.i].x; + y2 = sprite[g_player[i].ps.i].y; + z2 = sprite[g_player[i].ps.i].z; + if (!cansee(x1,y1,z1-(48<<8),damysect,x2,y2,z2-(48<<8),sprite[g_player[i].ps.i].sectnum)) dist <<= 1; if (dist < j) @@ -5273,9 +5273,9 @@ void computergetinput(long snum, input *syn) } } - x2 = sprite[ps[goalplayer[snum]].i].x; - y2 = sprite[ps[goalplayer[snum]].i].y; - z2 = sprite[ps[goalplayer[snum]].i].z; + x2 = sprite[g_player[goalplayer[snum]].ps.i].x; + y2 = sprite[g_player[goalplayer[snum]].ps.i].y; + z2 = sprite[g_player[goalplayer[snum]].ps.i].z; if (p->dead_flag) syn->bits |= (1<<29); if ((p->firstaid_amount > 0) && (p->last_extra < 100)) @@ -5335,10 +5335,10 @@ void computergetinput(long snum, input *syn) } } - if ((ps[goalplayer[snum]].dead_flag == 0) && - ((cansee(x1,y1,z1,damysect,x2,y2,z2,sprite[ps[goalplayer[snum]].i].sectnum)) || - (cansee(x1,y1,z1-(24<<8),damysect,x2,y2,z2-(24<<8),sprite[ps[goalplayer[snum]].i].sectnum)) || - (cansee(x1,y1,z1-(48<<8),damysect,x2,y2,z2-(48<<8),sprite[ps[goalplayer[snum]].i].sectnum)))) + if ((g_player[goalplayer[snum]].ps.dead_flag == 0) && + ((cansee(x1,y1,z1,damysect,x2,y2,z2,sprite[g_player[goalplayer[snum]].ps.i].sectnum)) || + (cansee(x1,y1,z1-(24<<8),damysect,x2,y2,z2-(24<<8),sprite[g_player[goalplayer[snum]].ps.i].sectnum)) || + (cansee(x1,y1,z1-(48<<8),damysect,x2,y2,z2-(48<<8),sprite[g_player[goalplayer[snum]].ps.i].sectnum)))) { syn->bits |= (1<<2); @@ -5356,20 +5356,20 @@ void computergetinput(long snum, input *syn) } - fightdist = fdmatrix[p->curr_weapon][ps[goalplayer[snum]].curr_weapon]; + fightdist = fdmatrix[p->curr_weapon][g_player[goalplayer[snum]].ps.curr_weapon]; if (fightdist < 128) fightdist = 128; dist = ksqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); if (dist == 0) dist = 1; - daang = getangle(x2+(ps[goalplayer[snum]].posxv>>14)-x1,y2+(ps[goalplayer[snum]].posyv>>14)-y1); + daang = getangle(x2+(g_player[goalplayer[snum]].ps.posxv>>14)-x1,y2+(g_player[goalplayer[snum]].ps.posyv>>14)-y1); zang = 100-((z2-z1)*8)/dist; fightdist = max(fightdist,(klabs(z2-z1)>>4)); - if (sprite[ps[goalplayer[snum]].i].yrepeat < 32) + if (sprite[g_player[goalplayer[snum]].ps.i].yrepeat < 32) { fightdist = 0; syn->bits &= ~(1<<2); } - if (sprite[ps[goalplayer[snum]].i].pal == 1) + if (sprite[g_player[goalplayer[snum]].ps.i].pal == 1) { fightdist = 0; syn->bits &= ~(1<<2); @@ -5390,8 +5390,8 @@ void computergetinput(long snum, input *syn) i += sintable[((j+4245)<<5)&2047]; i += sintable[((j+6745)<<4)&2047]; i += sintable[((j+15685)<<3)&2047]; - dx = sintable[(sprite[ps[goalplayer[snum]].i].ang+512)&2047]; - dy = sintable[sprite[ps[goalplayer[snum]].i].ang&2047]; + dx = sintable[(sprite[g_player[goalplayer[snum]].ps.i].ang+512)&2047]; + dy = sintable[sprite[g_player[goalplayer[snum]].ps.i].ang&2047]; if ((x1-x2)*dy > (y1-y2)*dx) i += 8192; else i -= 8192; syn->fvel += ((sintable[(daang+1024)&2047]*i)>>17); @@ -5409,7 +5409,7 @@ void computergetinput(long snum, input *syn) { goalwall[snum] = -1; startsect = sprite[p->i].sectnum; - endsect = sprite[ps[goalplayer[snum]].i].sectnum; + endsect = sprite[g_player[goalplayer[snum]].ps.i].sectnum; clearbufbyte(dashow2dsector,(MAXSECTORS+7)>>3,0L); searchsect[0] = startsect; diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index d56d2c2ef..8b521b6b5 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -275,8 +275,8 @@ static int getsound(unsigned int num) short fp; long l; - if (num >= NUM_SOUNDS || config.SoundToggle == 0) return 0; - if (config.FXDevice < 0) return 0; + if (num >= NUM_SOUNDS || ud.config.SoundToggle == 0) return 0; + if (ud.config.FXDevice < 0) return 0; if (!sounds[num][0]) return 0; fp = kopen4load(sounds[num],loadfromgrouponly); @@ -301,7 +301,7 @@ static void precachenecessarysounds(void) { int i, j; - if (config.FXDevice < 0) return; + if (ud.config.FXDevice < 0) return; j = 0; for (i=0;i>3] & pow2char[i&7]) for (k=0; k 0) + if (j != snum && g_player[j].ps.team == g_player[snum].ps.team && sprite[g_player[j].ps.i].extra > 0) { for (k=0;kbobposx = p->oposx = p->posx = po[i].ox; - p->bobposy = p->oposy = p->posy = po[i].oy; - p->oposz = p->posz = po[i].oz; - p->ang = po[i].oa; - p->cursectnum = po[i].os; + p->bobposx = p->oposx = p->posx = g_player[i].po.ox; + p->bobposy = p->oposy = p->posy = g_player[i].po.oy; + p->oposz = p->posz = g_player[i].po.oz; + p->ang = g_player[i].po.oa; + p->cursectnum = g_player[i].po.os; } static void resetplayerstats(int snum) { - struct player_struct *p = &ps[snum]; + player_struct *p = &g_player[snum].ps; ud.show_help = 0; ud.showallmap = 0; @@ -686,7 +686,7 @@ static void resetplayerstats(int snum) void resetweapons(int snum) { int weapon; - struct player_struct *p = &ps[snum]; + player_struct *p = &g_player[snum].ps; for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++) p->gotweapon[weapon] = 0; @@ -710,7 +710,7 @@ void resetweapons(int snum) void resetinventory(int snum) { - struct player_struct *p = &ps[snum]; + player_struct *p = &g_player[snum].ps; p->inven_icon = 0; p->boot_amount = 0; @@ -731,7 +731,7 @@ void resetinventory(int snum) static void resetprestat(int snum,int g) { - struct player_struct *p = &ps[snum]; + player_struct *p = &g_player[snum].ps; int i; spriteqloc = 0; @@ -872,20 +872,20 @@ static void prelevel(char g) if (sector[i].ceilingpicnum == CLOUDYSKIES && numclouds < 127) clouds[numclouds++] = i; - if (ps[0].one_parallax_sectnum == -1) - ps[0].one_parallax_sectnum = i; + if (g_player[0].ps.one_parallax_sectnum == -1) + g_player[0].ps.one_parallax_sectnum = i; } if (sector[i].lotag == 32767) //Found a secret room { - ps[0].max_secret_rooms++; + g_player[0].ps.max_secret_rooms++; continue; } if (sector[i].lotag == -1) { - ps[0].exitx = wall[sector[i].wallptr].x; - ps[0].exity = wall[sector[i].wallptr].y; + g_player[0].ps.exitx = wall[sector[i].wallptr].x; + g_player[0].ps.exity = wall[sector[i].wallptr].y; continue; } } @@ -898,8 +898,8 @@ static void prelevel(char g) LoadActor(i); if (sprite[i].lotag == -1 && (sprite[i].cstat&16)) { - ps[0].exitx = SX; - ps[0].exity = SY; + g_player[0].ps.exitx = SX; + g_player[0].ps.exity = SY; } else switch (dynamictostatic[PN]) { @@ -1155,13 +1155,13 @@ static void prelevel(char g) void newgame(int vn,int ln,int sk) { - struct player_struct *p = &ps[0]; + player_struct *p = &g_player[0].ps; int i; handleevents(); getpackets(); - if (globalskillsound >= 0 && config.FXDevice >= 0 && config.SoundToggle) + if (globalskillsound >= 0 && ud.config.FXDevice >= 0 && ud.config.SoundToggle) { while (issoundplaying(-1,globalskillsound)) { @@ -1280,65 +1280,65 @@ static void resetpspritevars(char g) char aimmode[MAXPLAYERS],autoaim[MAXPLAYERS],weaponswitch[MAXPLAYERS]; STATUSBARTYPE tsbar[MAXPLAYERS]; - EGS(ps[0].cursectnum,ps[0].posx,ps[0].posy,ps[0].posz, - APLAYER,0,0,0,ps[0].ang,0,0,0,10); + EGS(g_player[0].ps.cursectnum,g_player[0].ps.posx,g_player[0].ps.posy,g_player[0].ps.posz, + APLAYER,0,0,0,g_player[0].ps.ang,0,0,0,10); if (ud.recstat != 2) for (i=0;i 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && ud.last_level >= 0) { for (j=0;j 1 && (gametype_flags[ud.coop]&GAMETYPE_FLAG_PRESERVEINVENTORYDEATH) && ud.last_level >= 0) { for (j=0;jx; - po[(unsigned char)numplayersprites].oy = s->y; - po[(unsigned char)numplayersprites].oz = s->z; - po[(unsigned char)numplayersprites].oa = s->ang; - po[(unsigned char)numplayersprites].os = s->sectnum; + g_player[(unsigned char)numplayersprites].po.ox = s->x; + g_player[(unsigned char)numplayersprites].po.oy = s->y; + g_player[(unsigned char)numplayersprites].po.oz = s->z; + g_player[(unsigned char)numplayersprites].po.oa = s->ang; + g_player[(unsigned char)numplayersprites].po.os = s->sectnum; numplayersprites++; if (j >= 0) @@ -1379,17 +1379,17 @@ static void resetpspritevars(char g) s->xoffset = 0; s->clipdist = 64; - if ((g&MODE_EOL) != MODE_EOL || ps[j].last_extra == 0) + if ((g&MODE_EOL) != MODE_EOL || g_player[j].ps.last_extra == 0) { - ps[j].last_extra = max_player_health; + g_player[j].ps.last_extra = max_player_health; s->extra = max_player_health; - ps[j].runspeed = dukefriction; + g_player[j].ps.runspeed = dukefriction; } - else s->extra = ps[j].last_extra; + else s->extra = g_player[j].ps.last_extra; s->yvel = j; - if (!ud.pcolor[j] && ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)) + if (!g_player[j].pcolor && ud.multimode > 1 && !(gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)) { if (s->pal == 0) { @@ -1397,7 +1397,7 @@ static void resetpspritevars(char g) for (;k= 17) @@ -1405,34 +1405,34 @@ static void resetpspritevars(char g) k=0; } } - ud.pcolor[j] = s->pal = ps[j].palookup = which_palookup++; + g_player[j].pcolor = s->pal = g_player[j].ps.palookup = which_palookup++; if (which_palookup >= 17) which_palookup = 9; } - else ud.pcolor[j] = ps[j].palookup = s->pal; + else g_player[j].pcolor = g_player[j].ps.palookup = s->pal; } else { - int k = ud.pcolor[j]; + int k = g_player[j].pcolor; if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) { - k = getteampal(ud.pteam[j]); - ps[j].team = ud.pteam[j]; + k = getteampal(g_player[j].pteam); + g_player[j].ps.team = g_player[j].pteam; } - s->pal = ps[j].palookup = k; + s->pal = g_player[j].ps.palookup = k; } - ps[j].i = i; - ps[j].frag_ps = j; + g_player[j].ps.i = i; + g_player[j].ps.frag_ps = j; hittype[i].owner = i; - hittype[i].bposx = ps[j].bobposx = ps[j].oposx = ps[j].posx = s->x; - hittype[i].bposy = ps[j].bobposy = ps[j].oposy = ps[j].posy = s->y; - hittype[i].bposz = ps[j].oposz = ps[j].posz = s->z; - ps[j].oang = ps[j].ang = s->ang; + hittype[i].bposx = g_player[j].ps.bobposx = g_player[j].ps.oposx = g_player[j].ps.posx = s->x; + hittype[i].bposy = g_player[j].ps.bobposy = g_player[j].ps.oposy = g_player[j].ps.posy = s->y; + hittype[i].bposz = g_player[j].ps.oposz = g_player[j].ps.posz = s->z; + g_player[j].ps.oang = g_player[j].ps.ang = s->ang; - updatesector(s->x,s->y,&ps[j].cursectnum); + updatesector(s->x,s->y,&g_player[j].ps.cursectnum); j = connectpoint2[j]; @@ -1447,8 +1447,10 @@ static inline void clearfrags(void) int i = 0; while (i=0;i=connectpoint2[i]) { - if (playerreadyflag[i] < playerreadyflag[myconnectindex]) break; + if (g_player[i].playerreadyflag < g_player[myconnectindex].playerreadyflag) break; if ((!networkmode) && (myconnectindex != connecthead)) { i = -1; @@ -1508,6 +1510,8 @@ extern int jump_input; void clearfifo(void) { + int i = 0; + syncvaltail = 0L; syncvaltottail = 0L; syncstat = 0; @@ -1519,33 +1523,34 @@ void clearfifo(void) avgfvel = avgsvel = avgavel = avghorz = avgbits = avgextbits = 0; otherminlag = mymaxlag = 0; - clearbufbyte(myminlag,MAXPLAYERS<<2,0L); - clearbufbyte(&loc,sizeof(input),0L); - clearbufbyte(&sync[0],sizeof(sync),0L); - clearbufbyte(inputfifo,sizeof(input)*MOVEFIFOSIZ*MAXPLAYERS,0L); - - clearbuf(movefifoend,MAXPLAYERS,0L); - clearbuf(syncvalhead,MAXPLAYERS,0L); - clearbuf(myminlag,MAXPLAYERS,0L); - + clearbufbyte(&loc,sizeof(input),0L); + clearbufbyte(inputfifo,sizeof(input)*MOVEFIFOSIZ*MAXPLAYERS,0L); + for (;i=0;i=connectpoint2[i]) - switch (dynamictostatic[sector[sprite[ps[i].i].sectnum].floorpicnum]) + switch (dynamictostatic[sector[sprite[g_player[i].ps.i].sectnum].floorpicnum]) { case HURTRAIL__STATIC: case FLOORSLIME__STATIC: case FLOORPLASMA__STATIC: resetweapons(i); resetinventory(i); - ps[i].gotweapon[PISTOL_WEAPON] = 0; - ps[i].ammo_amount[PISTOL_WEAPON] = 0; - ps[i].curr_weapon = KNEE_WEAPON; - ps[i].kickback_pic = 0; + g_player[i].ps.gotweapon[PISTOL_WEAPON] = 0; + g_player[i].ps.ammo_amount[PISTOL_WEAPON] = 0; + g_player[i].ps.curr_weapon = KNEE_WEAPON; + g_player[i].ps.kickback_pic = 0; break; } @@ -1791,11 +1796,11 @@ int enterlevel(int g) resetmys(); - //ps[myconnectindex].palette = palette; + //g_player[myconnectindex].ps.palette = palette; //palto(0,0,0,0); - setgamepalette(&ps[myconnectindex], palette, 0); // JBF 20040308 + setgamepalette(&g_player[myconnectindex].ps, palette, 0); // JBF 20040308 - setpal(&ps[myconnectindex]); + setpal(&g_player[myconnectindex].ps); flushperms(); everyothertime = 0; @@ -1818,8 +1823,9 @@ int enterlevel(int g) drawbackground(); displayrooms(myconnectindex,65536); - clearbufbyte(playerquitflag,MAXPLAYERS,0x01010101); - ps[myconnectindex].over_shoulder_on = 0; + for (i=0;i=0;i=connectpoint2[i]) - if (sprite[ps[i].i].sectnum == sect) return i; + if (sprite[g_player[i].ps.i].sectnum == sect) return i; return -1; } @@ -220,7 +220,7 @@ int findplayer(spritetype *s,long *d) if (ud.multimode < 2) { - *d = klabs(ps[myconnectindex].oposx-s->x) + klabs(ps[myconnectindex].oposy-s->y) + ((klabs(ps[myconnectindex].oposz-s->z+(28<<8)))>>4); + *d = klabs(g_player[myconnectindex].ps.oposx-s->x) + klabs(g_player[myconnectindex].ps.oposy-s->y) + ((klabs(g_player[myconnectindex].ps.oposz-s->z+(28<<8)))>>4); return myconnectindex; } @@ -229,8 +229,8 @@ int findplayer(spritetype *s,long *d) for (j=connecthead;j>=0;j=connectpoint2[j]) { - x = klabs(ps[j].oposx-s->x) + klabs(ps[j].oposy-s->y) + ((klabs(ps[j].oposz-s->z+(28<<8)))>>4); - if (x < closest && sprite[ps[j].i].extra > 0) + x = klabs(g_player[j].ps.oposx-s->x) + klabs(g_player[j].ps.oposy-s->y) + ((klabs(g_player[j].ps.oposz-s->z+(28<<8)))>>4); + if (x < closest && sprite[g_player[j].ps.i].extra > 0) { closest_player = j; closest = x; @@ -250,9 +250,9 @@ int findotherplayer(int p,long *d) closest_player = p; for (j=connecthead;j>=0;j=connectpoint2[j]) - if (p != j && sprite[ps[j].i].extra > 0) + if (p != j && sprite[g_player[j].ps.i].extra > 0) { - x = klabs(ps[j].oposx-ps[p].posx) + klabs(ps[j].oposy-ps[p].posy) + (klabs(ps[j].oposz-ps[p].posz)>>4); + 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) { @@ -306,17 +306,17 @@ void doanimations(void) if (animateptr[i] == §or[animatesect[i]].floorz) { for (p=connecthead;p>=0;p=connectpoint2[p]) - if (ps[p].cursectnum == dasect) - if ((sector[dasect].floorz-ps[p].posz) < (64<<8)) - if (sprite[ps[p].i].owner >= 0) + if (g_player[p].ps.cursectnum == dasect) + if ((sector[dasect].floorz-g_player[p].ps.posz) < (64<<8)) + if (sprite[g_player[p].ps.i].owner >= 0) { - ps[p].posz += v; - ps[p].poszv = 0; + g_player[p].ps.posz += v; + g_player[p].ps.poszv = 0; if (p == myconnectindex) { myz += v; myzvel = 0; - myzbak[((movefifoplc-1)&(MOVEFIFOSIZ-1))] = ps[p].posz; + myzbak[((movefifoplc-1)&(MOVEFIFOSIZ-1))] = g_player[p].ps.posz; } } @@ -389,10 +389,10 @@ void animatecamsprite(void) { T1 = 0; - if (ps[screenpeek].newowner >= 0) - OW = ps[screenpeek].newowner; + if (g_player[screenpeek].ps.newowner >= 0) + OW = g_player[screenpeek].ps.newowner; - else if (OW >= 0 && dist(&sprite[ps[screenpeek].i],&sprite[i]) < 2048) + else if (OW >= 0 && dist(&sprite[g_player[screenpeek].ps.i],&sprite[i]) < 2048) { if (waloff[TILE_VIEWSCR] == 0) allocatepermanenttile(TILE_VIEWSCR,tilesizx[PN],tilesizy[PN]); @@ -1033,8 +1033,8 @@ void operateactivators(int low,int snum) if (snum >= 0) { if (sector[SECT].lotag&16384) - FTA(4,&ps[snum]); - else FTA(8,&ps[snum]); + FTA(4,&g_player[snum].ps); + else FTA(8,&g_player[snum].ps); } } else @@ -1199,35 +1199,35 @@ int checkhitswitch(int snum,long w,int switchtype) break; case ACCESSSWITCH__STATIC: case ACCESSSWITCH2__STATIC: - if (ps[snum].access_incs == 0) + if (g_player[snum].ps.access_incs == 0) { if (switchpal == 0) { - if ((ps[snum].got_access&1)) - ps[snum].access_incs = 1; - else FTA(70,&ps[snum]); + if ((g_player[snum].ps.got_access&1)) + g_player[snum].ps.access_incs = 1; + else FTA(70,&g_player[snum].ps); } else if (switchpal == 21) { - if (ps[snum].got_access&2) - ps[snum].access_incs = 1; - else FTA(71,&ps[snum]); + if (g_player[snum].ps.got_access&2) + g_player[snum].ps.access_incs = 1; + else FTA(71,&g_player[snum].ps); } else if (switchpal == 23) { - if (ps[snum].got_access&4) - ps[snum].access_incs = 1; - else FTA(72,&ps[snum]); + if (g_player[snum].ps.got_access&4) + g_player[snum].ps.access_incs = 1; + else FTA(72,&g_player[snum].ps); } - if (ps[snum].access_incs == 1) + if (g_player[snum].ps.access_incs == 1) { if (switchtype == 0) - ps[snum].access_wallnum = w; + g_player[snum].ps.access_wallnum = w; else - ps[snum].access_spritenum = w; + g_player[snum].ps.access_spritenum = w; } return 0; @@ -1417,7 +1417,7 @@ int checkhitswitch(int snum,long w,int switchtype) if (lotag == (short) 65535) { - ps[myconnectindex].gm = MODE_EOL; + g_player[myconnectindex].ps.gm = MODE_EOL; if (ud.from_bonus) { ud.level_number = ud.from_bonus; @@ -1480,17 +1480,17 @@ int checkhitswitch(int snum,long w,int switchtype) if (picnum == ALIENSWITCH || picnum == ALIENSWITCH+1) { if (switchtype == 1) - xyzsound(ALIEN_SWITCH1,w,sx,sy,ps[snum].posz); - else xyzsound(ALIEN_SWITCH1,ps[snum].i,sx,sy,ps[snum].posz); + xyzsound(ALIEN_SWITCH1,w,sx,sy,g_player[snum].ps.posz); + else xyzsound(ALIEN_SWITCH1,g_player[snum].ps.i,sx,sy,g_player[snum].ps.posz); } else { if (switchtype == 1) - xyzsound(SWITCH_ON,w,sx,sy,ps[snum].posz); - else xyzsound(SWITCH_ON,ps[snum].i,sx,sy,ps[snum].posz); + xyzsound(SWITCH_ON,w,sx,sy,g_player[snum].ps.posz); + else xyzsound(SWITCH_ON,g_player[snum].ps.i,sx,sy,g_player[snum].ps.posz); } if (numdips != correctdips) break; - xyzsound(END_OF_LEVEL_WARN,ps[snum].i,sx,sy,ps[snum].posz); + xyzsound(END_OF_LEVEL_WARN,g_player[snum].ps.i,sx,sy,g_player[snum].ps.posz); } case DIPSWITCH2__STATIC: //case DIPSWITCH2+1: @@ -1548,11 +1548,11 @@ int checkhitswitch(int snum,long w,int switchtype) case 25: hittype[x].temp_data[4] = !hittype[x].temp_data[4]; if (hittype[x].temp_data[4]) - FTA(15,&ps[snum]); - else FTA(2,&ps[snum]); + FTA(15,&g_player[snum].ps); + else FTA(2,&g_player[snum].ps); break; case 21: - FTA(2,&ps[screenpeek]); + FTA(2,&g_player[screenpeek].ps); break; } } @@ -1560,7 +1560,7 @@ int checkhitswitch(int snum,long w,int switchtype) } operateactivators(lotag,snum); - operateforcefields(ps[snum].i,lotag); + operateforcefields(g_player[snum].ps.i,lotag); operatemasterswitches(lotag); if (picnum == DIPSWITCH || picnum == DIPSWITCH+1 || @@ -1570,14 +1570,14 @@ int checkhitswitch(int snum,long w,int switchtype) if (hitag == 0 && isadoorwall(picnum) == 0) { if (switchtype == 1) - xyzsound(SWITCH_ON,w,sx,sy,ps[snum].posz); - else xyzsound(SWITCH_ON,ps[snum].i,sx,sy,ps[snum].posz); + xyzsound(SWITCH_ON,w,sx,sy,g_player[snum].ps.posz); + else xyzsound(SWITCH_ON,g_player[snum].ps.i,sx,sy,g_player[snum].ps.posz); } else if (hitag != 0) { if (switchtype == 1 && (soundm[hitag]&4) == 0) - xyzsound(hitag,w,sx,sy,ps[snum].posz); - else spritesound(hitag,ps[snum].i); + xyzsound(hitag,w,sx,sy,g_player[snum].ps.posz); + else spritesound(hitag,g_player[snum].ps.i); } return 1; @@ -1705,7 +1705,7 @@ void checkhitwall(int spr,int dawallnum,long x,long y,long z,int atwith) if (wal->nextwall >= 0) wall[wal->nextwall].cstat = 0; - i = EGS(sn,x,y,z,SECTOREFFECTOR,0,0,0,ps[0].ang,0,0,spr,3); + i = EGS(sn,x,y,z,SECTOREFFECTOR,0,0,0,g_player[0].ps.ang,0,0,spr,3); SLT = 128; T2 = 5; T3 = dawallnum; @@ -1870,7 +1870,7 @@ void checkhitwall(int spr,int dawallnum,long x,long y,long z,int atwith) } } -void checkplayerhurt(struct player_struct *p,int j) +void checkplayerhurt(player_struct *p,int j) { if ((j&49152) == 49152) { @@ -1954,8 +1954,8 @@ int checkhitceiling(int sn) case TECHLIGHT2__STATIC: case TECHLIGHT4__STATIC: - ceilingglass(ps[myconnectindex].i,sn,10); - spritesound(GLASS_BREAKING,ps[screenpeek].i); + ceilingglass(g_player[myconnectindex].ps.i,sn,10); + spritesound(GLASS_BREAKING,g_player[screenpeek].ps.i); if (sector[sn].ceilingpicnum == WALLLIGHT1) sector[sn].ceilingpicnum = WALLLIGHTBUST1; @@ -2414,7 +2414,7 @@ void checkhitsprite(int i,int sn) j = sprite[sn].owner; if (j >= 0 && sprite[j].picnum == APLAYER && PN != ROTATEGUN && PN != DRONE) - if (ps[sprite[j].yvel].curr_weapon == SHOTGUN_WEAPON) + if (g_player[sprite[j].yvel].ps.curr_weapon == SHOTGUN_WEAPON) { shoot(i,BLOODSPLAT3); shoot(i,BLOODSPLAT1); @@ -2455,16 +2455,16 @@ void checkhitsprite(int i,int sn) if (sprite[i].statnum == 10) { p = sprite[i].yvel; - if (ps[p].newowner >= 0) + if (g_player[p].ps.newowner >= 0) { - ps[p].newowner = -1; - ps[p].posx = ps[p].oposx; - ps[p].posy = ps[p].oposy; - ps[p].posz = ps[p].oposz; - ps[p].ang = ps[p].oang; + g_player[p].ps.newowner = -1; + g_player[p].ps.posx = g_player[p].ps.oposx; + g_player[p].ps.posy = g_player[p].ps.oposy; + g_player[p].ps.posz = g_player[p].ps.oposz; + g_player[p].ps.ang = g_player[p].ps.oang; - updatesector(ps[p].posx,ps[p].posy,&ps[p].cursectnum); - setpal(&ps[p]); + updatesector(g_player[p].ps.posx,g_player[p].ps.posy,&g_player[p].ps.cursectnum); + setpal(&g_player[p].ps); j = headspritestat[1]; while (j >= 0) @@ -2517,8 +2517,8 @@ void allignwarpelevators(void) void sharedkeys(int snum) { int i, k, dainv; - unsigned long sb_snum = sync[snum].bits, j; - struct player_struct *p = &ps[snum]; + unsigned long sb_snum = g_player[snum].sync.bits, j; + player_struct *p = &g_player[snum].ps; if (p->cheat_phase == 1) return; @@ -2560,9 +2560,9 @@ void sharedkeys(int snum) if ((sb_snum&(1<<22)) && p->quick_kick == 0) if (p->curr_weapon != KNEE_WEAPON || p->kickback_pic == 0) { - SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum); - OnEvent(EVENT_QUICKKICK,ps[snum].i,snum, -1); - if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum); + OnEvent(EVENT_QUICKKICK,g_player[snum].ps.i,snum, -1); + if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0) { p->quick_kick = 14; FTA(80,p); @@ -2590,7 +2590,7 @@ void sharedkeys(int snum) } else { - if (config.MusicToggle) MUSIC_Continue(); + if (ud.config.MusicToggle) MUSIC_Continue(); pub = NUMPAGES; pus = NUMPAGES; } @@ -2602,9 +2602,9 @@ void sharedkeys(int snum) if (sb_snum&(1<<30) && p->newowner == -1) // inventory button generates event for selected item { - SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum); - OnEvent(EVENT_INVENTORY,ps[snum].i,snum, -1); - if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum); + OnEvent(EVENT_INVENTORY,g_player[snum].ps.i,snum, -1); + if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0) { switch (p->inven_icon) { @@ -2629,9 +2629,9 @@ void sharedkeys(int snum) if (sb_snum&(1<<15)) { - SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum); - OnEvent(EVENT_USENIGHTVISION,ps[snum].i,snum, -1); - if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0 + SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum); + OnEvent(EVENT_USENIGHTVISION,g_player[snum].ps.i,snum, -1); + if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0 && p->heat_amount > 0) { p->heat_on = !p->heat_on; @@ -2644,9 +2644,9 @@ void sharedkeys(int snum) if ((sb_snum&(1<<12))) { - SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum); - OnEvent(EVENT_USESTEROIDS,ps[snum].i,snum, -1); - if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum); + OnEvent(EVENT_USESTEROIDS,g_player[snum].ps.i,snum, -1); + if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0) { if (p->steroids_amount == 400) { @@ -2731,15 +2731,15 @@ CHECKINV1: if (sb_snum&(1<<20)) // Inventory_Left { - SetGameVarID(g_iReturnVarID,dainv,ps[snum].i,snum); - OnEvent(EVENT_INVENTORYLEFT,ps[snum].i,snum, -1); - dainv=GetGameVarID(g_iReturnVarID,ps[snum].i,snum); + SetGameVarID(g_iReturnVarID,dainv,g_player[snum].ps.i,snum); + OnEvent(EVENT_INVENTORYLEFT,g_player[snum].ps.i,snum, -1); + dainv=GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum); } if (sb_snum&(1<<27)) // Inventory_Right { - SetGameVarID(g_iReturnVarID,dainv,ps[snum].i,snum); - OnEvent(EVENT_INVENTORYRIGHT,ps[snum].i,snum, -1); - dainv=GetGameVarID(g_iReturnVarID,ps[snum].i,snum); + SetGameVarID(g_iReturnVarID,dainv,g_player[snum].ps.i,snum); + OnEvent(EVENT_INVENTORYRIGHT,g_player[snum].ps.i,snum, -1); + dainv=GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum); } p->inven_icon = dainv; @@ -3054,9 +3054,9 @@ CHECKINV1: if (p->holoduke_on == -1) { - SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum); - OnEvent(EVENT_HOLODUKEON,ps[snum].i,snum, -1); - if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum); + OnEvent(EVENT_HOLODUKEON,g_player[snum].ps.i,snum, -1); + if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0) { if (p->holoduke_amount > 0) { @@ -3079,9 +3079,9 @@ CHECKINV1: } else { - SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum); - OnEvent(EVENT_HOLODUKEOFF,ps[snum].i,snum, -1); - if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum); + OnEvent(EVENT_HOLODUKEOFF,g_player[snum].ps.i,snum, -1); + if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0) { spritesound(TELEPORTER,p->holoduke_on); p->holoduke_on = -1; @@ -3092,9 +3092,9 @@ CHECKINV1: if (sb_snum&(1<<16)) { - SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum); - OnEvent(EVENT_USEMEDKIT,ps[snum].i,snum, -1); - if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum); + OnEvent(EVENT_USEMEDKIT,g_player[snum].ps.i,snum, -1); + if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0) { if (p->firstaid_amount > 0 && sprite[p->i].extra < max_player_health) { @@ -3119,9 +3119,9 @@ CHECKINV1: if (sb_snum&(1<<25) && p->newowner == -1) { - SetGameVarID(g_iReturnVarID,0,ps[snum].i,snum); - OnEvent(EVENT_USEJETPACK,ps[snum].i,snum, -1); - if (GetGameVarID(g_iReturnVarID,ps[snum].i,snum) == 0) + SetGameVarID(g_iReturnVarID,0,g_player[snum].ps.i,snum); + OnEvent(EVENT_USEJETPACK,g_player[snum].ps.i,snum, -1); + if (GetGameVarID(g_iReturnVarID,g_player[snum].ps.i,snum) == 0) { if (p->jetpack_amount > 0) { @@ -3187,7 +3187,7 @@ long hitasprite(int i,short *hitsp) return (FindDistance2D(sx-SX,sy-SY)); } -static long hitawall(struct player_struct *p,short *hitw) +static long hitawall(player_struct *p,short *hitw) { long sx,sy,sz; short sect,hs; @@ -3204,7 +3204,7 @@ static long hitawall(struct player_struct *p,short *hitw) void checksectors(int snum) { long i = -1,oldz; - struct player_struct *p = &ps[snum]; + player_struct *p = &g_player[snum].ps; short j,hitscanwall; switch (sector[p->cursectnum].lotag) @@ -3217,7 +3217,7 @@ void checksectors(int snum) return; case -1: for (i=connecthead;i>=0;i=connectpoint2[i]) - ps[i].gm = MODE_EOL; + g_player[i].ps.gm = MODE_EOL; sector[p->cursectnum].lotag = 0; if (ud.from_bonus) { @@ -3253,33 +3253,33 @@ void checksectors(int snum) if (p->gm&MODE_TYPE || sprite[p->i].extra <= 0) return; - if ((sync[snum].bits&(1<<29))) + if ((g_player[snum].sync.bits&(1<<29))) { SetGameVarID(g_iReturnVarID,0,p->i,snum); OnEvent(EVENT_USE, p->i, snum, -1); if (GetGameVarID(g_iReturnVarID,p->i,snum) != 0) - sync[snum].bits &= ~(1<<29); + g_player[snum].sync.bits &= ~(1<<29); } - if (ud.cashman && sync[snum].bits&(1<<29)) + if (ud.cashman && g_player[snum].sync.bits&(1<<29)) lotsofmoney(p->i,2); if (p->newowner >= 0) { - if (klabs(sync[snum].svel) > 768 || klabs(sync[snum].fvel) > 768) + if (klabs(g_player[snum].sync.svel) > 768 || klabs(g_player[snum].sync.fvel) > 768) { i = -1; goto CLEARCAMERAS; } } - if (!(sync[snum].bits&(1<<29)) && !(sync[snum].bits&(1<<31))) + if (!(g_player[snum].sync.bits&(1<<29)) && !(g_player[snum].sync.bits&(1<<31))) p->toggle_key_flag = 0; else if (!p->toggle_key_flag) { - if ((sync[snum].bits&(1<<31))) + if ((g_player[snum].sync.bits&(1<<31))) { if (p->newowner >= 0) { @@ -3498,7 +3498,7 @@ CLEARCAMERAS: } } - if ((sync[snum].bits&(1<<29)) == 0) return; + if ((g_player[snum].sync.bits&(1<<29)) == 0) return; else if (p->newowner >= 0) { i = -1; diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index d41e23ed8..a42cf76cc 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -49,13 +49,13 @@ void SoundStartup(void) int32 status; // if they chose None lets return - if (config.FXDevice < 0) return; + if (ud.config.FXDevice < 0) return; - status = FX_Init(config.FXDevice, config.NumVoices, config.NumChannels, config.NumBits, config.MixRate); + status = FX_Init(ud.config.FXDevice, ud.config.NumVoices, ud.config.NumChannels, ud.config.NumBits, ud.config.MixRate); if (status == FX_Ok) { - FX_SetVolume(config.FXVolume); - if (config.ReverseStereo == 1) + FX_SetVolume(ud.config.FXVolume); + if (ud.config.ReverseStereo == 1) { FX_SetReverseStereo(!FX_GetReverseStereo()); } @@ -82,7 +82,7 @@ void SoundShutdown(void) int32 status; // if they chose None lets return - if (config.FXDevice < 0) + if (ud.config.FXDevice < 0) return; status = FX_Shutdown(); @@ -106,14 +106,14 @@ void MusicStartup(void) int32 status; // if they chose None lets return - if (config.MusicDevice < 0) + if (ud.config.MusicDevice < 0) return; - status = MUSIC_Init(config.MusicDevice, 0); + status = MUSIC_Init(ud.config.MusicDevice, 0); if (status == MUSIC_Ok) { - MUSIC_SetVolume(config.MusicVolume); + MUSIC_SetVolume(ud.config.MusicVolume); } else { @@ -144,7 +144,7 @@ void MusicShutdown(void) int32 status; // if they chose None lets return - if (config.MusicDevice < 0) + if (ud.config.MusicDevice < 0) return; status = MUSIC_Shutdown(); @@ -195,8 +195,8 @@ void playmusic(const char *fn) if (fn == NULL) return; - if (config.MusicToggle == 0) return; - if (config.MusicDevice < 0) return; + if (ud.config.MusicToggle == 0) return; + if (ud.config.MusicDevice < 0) return; fp = kopen4load((char *)fn,0); @@ -217,11 +217,11 @@ void playmusic(const char *fn) if (fn == NULL) return; - if (config.MusicToggle == 0) return; - if (config.MusicDevice < 0) return; + if (ud.config.MusicToggle == 0) return; + if (ud.config.MusicDevice < 0) return; // FIXME: I need this to get the music volume initialized (not sure why) -- Jim Bentler - MUSIC_SetVolume(MusicVolume); + MUSIC_SetVolume(ud.config.MusicVolume); PlayMusic((char *)fn); #endif } @@ -230,14 +230,14 @@ int loadsound(unsigned int num) { long fp, l; - if (num >= NUM_SOUNDS || config.SoundToggle == 0) return 0; - if (config.FXDevice < 0) return 0; + if (num >= NUM_SOUNDS || ud.config.SoundToggle == 0) return 0; + if (ud.config.FXDevice < 0) return 0; fp = kopen4load(sounds[num],loadfromgrouponly); if (fp == -1) { // Bsprintf(fta_quotes[113],"Sound %s(#%d) not found.",sounds[num],num); -// FTA(113,&ps[myconnectindex]); +// FTA(113,&g_player[myconnectindex].ps); initprintf("Sound %s(#%d) not found.\n",sounds[num],num); return 0; } @@ -262,13 +262,13 @@ int xyzsound(int num,int i,long x,long y,long z) // if(num != 358) return 0; if (num >= NUM_SOUNDS || - config.FXDevice < 0 || + ud.config.FXDevice < 0 || ((soundm[num]&8) && ud.lockout) || - config.SoundToggle == 0 || + ud.config.SoundToggle == 0 || Sound[num].num > 3 || FX_VoiceAvailable(soundpr[num]) == 0 || - (ps[myconnectindex].timebeforeexit > 0 && ps[myconnectindex].timebeforeexit <= 26*3) || - ps[myconnectindex].gm&MODE_MENU) return -1; + (g_player[myconnectindex].ps.timebeforeexit > 0 && g_player[myconnectindex].ps.timebeforeexit <= 26*3) || + g_player[myconnectindex].ps.gm&MODE_MENU) return -1; if (soundm[num]&128) { @@ -278,9 +278,9 @@ int xyzsound(int num,int i,long x,long y,long z) if (soundm[num]&4) { - if (config.VoiceToggle==0) + if (ud.config.VoiceToggle==0) return -1; - else if (ud.multimode > 1 && PN == APLAYER && sprite[i].yvel != screenpeek && config.VoiceToggle!=2) + else if (ud.multimode > 1 && PN == APLAYER && sprite[i].yvel != screenpeek && ud.config.VoiceToggle!=2) return -1; for (j=0;j>4); @@ -323,18 +323,18 @@ int xyzsound(int num,int i,long x,long y,long z) case RPG_EXPLODE: if (sndist > (6144)) sndist = 6144; - if (sector[ps[screenpeek].cursectnum].lotag == 2) + if (sector[g_player[screenpeek].ps.cursectnum].lotag == 2) pitch -= 1024; break; default: - if (sector[ps[screenpeek].cursectnum].lotag == 2 && (soundm[num]&4) == 0) + if (sector[g_player[screenpeek].ps.cursectnum].lotag == 2 && (soundm[num]&4) == 0) pitch = -768; if (sndist > 31444 && PN != MUSICANDSFX) return -1; break; } - if (ps[screenpeek].sound_pitch) pitch += ps[screenpeek].sound_pitch; + if (g_player[screenpeek].ps.sound_pitch) pitch += g_player[screenpeek].ps.sound_pitch; if (Sound[num].num > 0 && PN != MUSICANDSFX) { @@ -409,9 +409,9 @@ void sound(int num) int voice; long start; - if (config.FXDevice < 0) return; - if (config.SoundToggle==0) return; - if (config.VoiceToggle==0 && (soundm[num]&4)) return; + if (ud.config.FXDevice < 0) return; + if (ud.config.SoundToggle==0) return; + if (ud.config.VoiceToggle==0 && (soundm[num]&4)) return; if ((soundm[num]&8) && ud.lockout) return; if (FX_VoiceAvailable(soundpr[num]) == 0) return; if (num > NUM_SOUNDS-1 || !sounds[num]) @@ -420,7 +420,6 @@ void sound(int num) return; } - pitchs = soundps[num]; pitche = soundpe[num]; cx = klabs(pitche-pitchs); @@ -516,11 +515,11 @@ void pan3dsound(void) if (ud.camerasprite == -1) { - cx = ps[screenpeek].oposx; - cy = ps[screenpeek].oposy; - cz = ps[screenpeek].oposz; - cs = ps[screenpeek].cursectnum; - ca = ps[screenpeek].ang+ps[screenpeek].look_ang; + cx = g_player[screenpeek].ps.oposx; + cy = g_player[screenpeek].ps.oposy; + cz = g_player[screenpeek].ps.oposz; + cs = g_player[screenpeek].ps.cursectnum; + ca = g_player[screenpeek].ps.ang+g_player[screenpeek].ps.look_ang; } else { diff --git a/polymer/eduke32/source/startgtk.game.c b/polymer/eduke32/source/startgtk.game.c index ed60cdd11..0d0472093 100755 --- a/polymer/eduke32/source/startgtk.game.c +++ b/polymer/eduke32/source/startgtk.game.c @@ -744,14 +744,14 @@ int startwin_run(void) SetPage(TAB_CONFIG); - settings.fullscreen = ScreenMode; - settings.xdim3d = ScreenWidth; - settings.ydim3d = ScreenHeight; - settings.bpp3d = ScreenBPP; - settings.forcesetup = g_ForceSetup; - settings.usemouse = UseMouse; - settings.usejoy = UseJoystick; - settings.game = gametype; + settings.fullscreen = ud.config.ScreenMode; + settings.xdim3d = ud.config.ScreenWidth; + settings.ydim3d = ud.config.ScreenHeight; + settings.bpp3d = ud.config.ScreenBPP; + settings.forcesetup = ud.config.ForceSetup; + settings.usemouse = ud.config.UseMouse; + settings.usejoy = ud.config.UseJoystick; + settings.game = g_GameType; strncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH); PopulateForm(-1); @@ -760,15 +760,15 @@ int startwin_run(void) SetPage(TAB_MESSAGES); if (retval) { - ScreenMode = settings.fullscreen; - ScreenWidth = settings.xdim3d; - ScreenHeight = settings.ydim3d; - ScreenBPP = settings.bpp3d; - g_ForceSetup = settings.forcesetup; - UseMouse = settings.usemouse; - UseJoystick = settings.usejoy; + ud.config.ScreenMode = settings.fullscreen; + ud.config.ScreenWidth = settings.xdim3d; + ud.config.ScreenHeight = settings.ydim3d; + ud.config.ScreenBPP = settings.bpp3d; + ud.config.ForceSetup = settings.forcesetup; + ud.config.UseMouse = settings.usemouse; + ud.config.UseJoystick = settings.usejoy; duke3dgrp = settings.selectedgrp; - gametype = settings.game; + g_GameType = settings.game; } return retval; diff --git a/polymer/eduke32/source/startwin.game.c b/polymer/eduke32/source/startwin.game.c index 22b3d63fb..c7086b976 100755 --- a/polymer/eduke32/source/startwin.game.c +++ b/polymer/eduke32/source/startwin.game.c @@ -575,13 +575,13 @@ int startwin_run(void) SetPage(TAB_CONFIG); EnableConfig(1); - settings.fullscreen = config.ScreenMode; - settings.xdim = config.ScreenWidth; - settings.ydim = config.ScreenHeight; - settings.bpp = config.ScreenBPP; - settings.forcesetup = config.ForceSetup; - settings.usemouse = config.UseMouse; - settings.usejoy = config.UseJoystick; + settings.fullscreen = ud.config.ScreenMode; + settings.xdim = ud.config.ScreenWidth; + settings.ydim = ud.config.ScreenHeight; + settings.bpp = ud.config.ScreenBPP; + settings.forcesetup = ud.config.ForceSetup; + settings.usemouse = ud.config.UseMouse; + settings.usejoy = ud.config.UseJoystick; settings.game = g_GameType; strncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH); PopulateForm(-1); @@ -607,13 +607,13 @@ int startwin_run(void) EnableConfig(0); if (done) { - config.ScreenMode = settings.fullscreen; - config.ScreenWidth = settings.xdim; - config.ScreenHeight = settings.ydim; - config.ScreenBPP = settings.bpp; - config.ForceSetup = settings.forcesetup; - config.UseMouse = settings.usemouse; - config.UseJoystick = settings.usejoy; + ud.config.ScreenMode = settings.fullscreen; + ud.config.ScreenWidth = settings.xdim; + ud.config.ScreenHeight = settings.ydim; + ud.config.ScreenBPP = settings.bpp; + ud.config.ForceSetup = settings.forcesetup; + ud.config.UseMouse = settings.usemouse; + ud.config.UseJoystick = settings.usejoy; duke3dgrp = settings.selectedgrp; g_GameType = settings.game; }