Consolidate badly named HUD weapon globals ("g_looking_angSR1") into struct.

git-svn-id: https://svn.eduke32.com/eduke32@3408 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-01-19 18:28:48 +00:00
parent 7acd1ad743
commit fb1db25c4e
5 changed files with 42 additions and 48 deletions

View file

@ -59,14 +59,6 @@ extern int32_t g_iActorVarID;
extern intptr_t *apScriptGameEvent[MAXGAMEEVENTS];
extern int32_t otherp;
extern int32_t g_currentweapon;
extern int32_t g_gun_pos;
extern int32_t g_looking_arc;
extern int32_t g_currentweapon;
extern int32_t g_weapon_xoffset;
extern int32_t g_gs;
extern int32_t g_kb;
extern int32_t g_looking_angSR1;
extern int32_t lastvisinc;
extern char CheatStrings[][MAXCHEATLEN];
extern char g_szScriptFileName[BMAX_PATH];

View file

@ -1313,13 +1313,13 @@ static void Gv_AddSystemVars(void)
Gv_NewVar("myconnectindex", (intptr_t)&myconnectindex, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("screenpeek", (intptr_t)&screenpeek, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("currentweapon",(intptr_t)&g_currentweapon, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("gs",(intptr_t)&g_gs, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("looking_arc",(intptr_t)&g_looking_arc, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("gun_pos",(intptr_t)&g_gun_pos, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("weapon_xoffset",(intptr_t)&g_weapon_xoffset, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("weaponcount",(intptr_t)&g_kb, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("looking_angSR1",(intptr_t)&g_looking_angSR1, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("currentweapon",(intptr_t)&hudweap.cur, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("gs",(intptr_t)&hudweap.shade, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("looking_arc",(intptr_t)&hudweap.lookhoriz, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("gun_pos",(intptr_t)&hudweap.gunposy, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("weapon_xoffset",(intptr_t)&hudweap.gunposx, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("weaponcount",(intptr_t)&hudweap.count, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("looking_angSR1",(intptr_t)&hudweap.lookhalfang, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("xdim",(intptr_t)&xdim, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
Gv_NewVar("ydim",(intptr_t)&ydim, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
Gv_NewVar("windowx1",(intptr_t)&windowx1, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
@ -1489,13 +1489,13 @@ void Gv_RefreshPointers(void)
aGameVars[Gv_GetVarIndex("myconnectindex")].val.lValue = (intptr_t)&myconnectindex;
aGameVars[Gv_GetVarIndex("screenpeek")].val.lValue = (intptr_t)&screenpeek;
aGameVars[Gv_GetVarIndex("currentweapon")].val.lValue = (intptr_t)&g_currentweapon;
aGameVars[Gv_GetVarIndex("gs")].val.lValue = (intptr_t)&g_gs;
aGameVars[Gv_GetVarIndex("looking_arc")].val.lValue = (intptr_t)&g_looking_arc;
aGameVars[Gv_GetVarIndex("gun_pos")].val.lValue = (intptr_t)&g_gun_pos;
aGameVars[Gv_GetVarIndex("weapon_xoffset")].val.lValue = (intptr_t)&g_weapon_xoffset;
aGameVars[Gv_GetVarIndex("weaponcount")].val.lValue = (intptr_t)&g_kb;
aGameVars[Gv_GetVarIndex("looking_angSR1")].val.lValue = (intptr_t)&g_looking_angSR1;
aGameVars[Gv_GetVarIndex("currentweapon")].val.lValue = (intptr_t)&hudweap.cur;
aGameVars[Gv_GetVarIndex("gs")].val.lValue = (intptr_t)&hudweap.shade;
aGameVars[Gv_GetVarIndex("looking_arc")].val.lValue = (intptr_t)&hudweap.lookhoriz;
aGameVars[Gv_GetVarIndex("gun_pos")].val.lValue = (intptr_t)&hudweap.gunposy;
aGameVars[Gv_GetVarIndex("weapon_xoffset")].val.lValue = (intptr_t)&hudweap.gunposx;
aGameVars[Gv_GetVarIndex("weaponcount")].val.lValue = (intptr_t)&hudweap.count;
aGameVars[Gv_GetVarIndex("looking_angSR1")].val.lValue = (intptr_t)&hudweap.lookhalfang;
aGameVars[Gv_GetVarIndex("xdim")].val.lValue = (intptr_t)&xdim;
aGameVars[Gv_GetVarIndex("ydim")].val.lValue = (intptr_t)&ydim;
aGameVars[Gv_GetVarIndex("windowx1")].val.lValue = (intptr_t)&windowx1;

View file

@ -316,6 +316,13 @@ typedef struct {
uint32_t revision;
} playerdata_t;
typedef struct {
int32_t cur, count;
int32_t gunposx, lookhalfang;
int32_t gunposy, lookhoriz;
int32_t shade;
} hudweapon_t;
typedef struct {
int32_t workslike, cstat; // 8b
int32_t hitradius, range, flashcolor; // 12b

View file

@ -28,14 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "enet/enet.h"
int32_t lastvisinc;
int32_t g_currentweapon;
int32_t g_gun_pos;
int32_t g_looking_arc;
int32_t g_weapon_offset;
int32_t g_gs;
int32_t g_kb;
int32_t g_looking_angSR1;
int32_t g_weapon_xoffset;
hudweapon_t hudweap;
static int32_t g_snum;
extern int32_t g_levelTextTime, ticrandomseed;
@ -1775,7 +1769,7 @@ static void G_DrawTileScaled(int32_t x, int32_t y, int32_t tilenum, int32_t shad
int32_t wy[2] = { windowy1, windowy2 };
int32_t yofs = 0;
switch (g_currentweapon)
switch (hudweap.cur)
{
case DEVISTATOR_WEAPON:
case TRIPBOMB_WEAPON:
@ -1862,7 +1856,7 @@ static void G_DrawWeaponTile(int32_t x, int32_t y, int32_t tilenum, int32_t shad
const DukePlayer_t *const ps = g_player[screenpeek].ps;
const int32_t sc = scale(65536,ud.statusbarscale,100);
switch (g_currentweapon)
switch (hudweap.cur)
{
case PISTOL_WEAPON:
case CHAINGUN_WEAPON:
@ -1876,7 +1870,7 @@ static void G_DrawWeaponTile(int32_t x, int32_t y, int32_t tilenum, int32_t shad
case HANDBOMB_WEAPON:
case SHOTGUN_WEAPON:
rotatesprite_win(160<<16,(180+(ps->weapon_pos*ps->weapon_pos))<<16,
sc,0,g_currentweapon==GROW_WEAPON?GROWSPRITEICON:WeaponPickupSprites[g_currentweapon],
sc,0,hudweap.cur==GROW_WEAPON?GROWSPRITEICON:WeaponPickupSprites[hudweap.cur],
0,0,2);
return;
default:
@ -2152,13 +2146,13 @@ void P_DisplayWeapon(int32_t snum)
else
cw = PWEAPON(snum, p->curr_weapon, WorksLike);
g_gun_pos=gun_pos;
g_looking_arc=looking_arc;
g_currentweapon=cw;
g_weapon_xoffset=weapon_xoffset;
g_gs=gs;
g_kb=*kb;
g_looking_angSR1=p->look_ang>>1;
hudweap.gunposy=gun_pos;
hudweap.lookhoriz=looking_arc;
hudweap.cur=cw;
hudweap.gunposx=weapon_xoffset;
hudweap.shade=gs;
hudweap.count=*kb;
hudweap.lookhalfang=p->look_ang>>1;
if (VM_OnEvent(EVENT_DISPLAYWEAPON, p->i, screenpeek, -1, 0) == 0)
{

View file

@ -304,6 +304,14 @@ extern intptr_t *aplWeaponSelectSound[MAX_WEAPONS]; // Sound for wea
extern intptr_t *aplWeaponFlashColor[MAX_WEAPONS]; // Color for polymer muzzle flash
#endif
// KEEPINSYNC lunatic/defs.ilua
typedef struct {
int32_t cur, count; // "cur" is the only member that is *used*
int32_t gunposx, lookhalfang; // weapon_xoffset, ps->look_ang>>1
int32_t gunposy, lookhoriz; // gun_pos, looking_arc
int32_t shade;
} hudweapon_t;
#pragma pack(push,1)
extern input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
extern playerspawn_t g_playerSpawnPoints[MAXPLAYERS];
@ -312,18 +320,11 @@ extern playerdata_t g_player[MAXPLAYERS];
//extern char dashow2dsector[(MAXSECTORS+7)>>3];
//extern int16_t searchsect[MAXSECTORS],searchparent[MAXSECTORS];
extern int16_t WeaponPickupSprites[MAX_WEAPONS];
extern int32_t g_currentweapon;
extern int32_t g_gs;
extern int32_t g_gun_pos;
extern int32_t g_kb;
extern hudweapon_t hudweap;
extern int32_t g_levelTextTime;
extern int32_t g_looking_angSR1;
extern int32_t g_looking_arc;
extern int32_t g_myAimMode;
extern int32_t g_numObituaries;
extern int32_t g_numSelfObituaries;
extern int32_t g_weapon_offset;
extern int32_t g_weapon_xoffset;
extern int32_t g_emuJumpTics;
extern int32_t lastvisinc;
extern int32_t mouseyaxismode;