Change all references to .items to .g_items because fteqw assumes too much and ruins the 3d-view when certain bits are set.

This commit is contained in:
Marco Cawthorne 2019-03-13 17:19:59 +01:00
parent 2e736389d7
commit d18d7bf561
20 changed files with 66 additions and 45 deletions

View file

@ -36,7 +36,7 @@ void HUD_DrawWeaponSelect_Forward(void)
pSeat->fHUDWeaponSelectTime = time + 3;
if (!(pl.items & g_weapons[pSeat->fHUDWeaponSelected].id)) {
if (!(pl.g_items & g_weapons[pSeat->fHUDWeaponSelected].id)) {
HUD_DrawWeaponSelect_Forward();
}
}
@ -62,7 +62,7 @@ void HUD_DrawWeaponSelect_Back(void)
pSeat->fHUDWeaponSelectTime = time + 3;
if (!(pl.items & g_weapons[pSeat->fHUDWeaponSelected].id)) {
if (!(pl.g_items & g_weapons[pSeat->fHUDWeaponSelected].id)) {
HUD_DrawWeaponSelect_Back();
}
}
@ -89,7 +89,7 @@ int Weapon_InSlotPos(int slot, int pos)
player pl = (player)pSeat->ePlayer;
for (int i = 1; i < g_weapons.length; i++) {
if (g_weapons[i].slot == slot && g_weapons[i].slot_pos == pos) {
if (pl.items & g_weapons[i].id) {
if (pl.g_items & g_weapons[i].id) {
return i;
} else {
return -1;

View file

@ -31,7 +31,7 @@ void Player_ReadEntity(float flIsNew)
pl.velocity[2] = readcoord();
pl.flags = readfloat();
pl.activeweapon = readbyte();
pl.items = readfloat();
pl.g_items = readfloat();
pl.health = readbyte();
pl.armor = readbyte();
pl.movetype = readfloat();

View file

@ -95,3 +95,4 @@ enum {
};
void m_hide(void);
void cvar_init(void);

View file

@ -8,6 +8,21 @@
var int g_initialized = FALSE;
void cvar_init(void)
{
/* TODO: Shove these into defaults.cfg instead of forcing them */
localcmd("seta con_textsize -12\n");
localcmd("seta scr_conalpha 1\n");
localcmd("seta cl_idlefps 0\n");
localcmd("seta r_shadow_realtime_dlight 0\n");
localcmd("seta gl_mindist 4\n"); // Thanks Valve for v_shotgun.mdl
localcmd("seta _pext_infoblobs 1\n");
/* Hack! */
localcmd("seta gl_font 0\n");
localcmd("seta gl_font CONCHARS?fmt=h\n");
}
void m_init(void)
{
vector g_btnsize;
@ -21,18 +36,7 @@ void m_init(void)
localcmd("plug_load ffmpeg\n");
/* TODO: Shove these into defaults.cfg instead of forcing them */
localcmd("con_textsize -12\n");
localcmd("scr_conalpha 1\n");
localcmd("cl_idlefps 0\n");
localcmd("r_shadow_realtime_dlight 0\n");
localcmd("gl_mindist 4\n"); // Thanks Valve for v_shotgun.mdl
localcmd("_pext_infoblobs 1\n");
/* Hack! */
localcmd("gl_font 0\n");
localcmd("gl_font CONCHARS?fmt=h\n");
cvar_init();
shaderforname("logo_avi", "{\n{\nvideomap av:media/logo.avi\n}\n}");
for (int i = 0; i < g_bmp.length; i++) {

View file

@ -180,7 +180,7 @@ void customgame_btnactivate_start(void)
localcmd(sprintf("gamedir \"%s\"\n", games[nextgame].gamedir));
localcmd("snd_restart\nwait\nvid_reload\nmenu_restart\nmenu_customgame\n");
// TODO: Re-init important menu bits and bobs.
cvar_init();
//m_shutdown();
//m_init();
}

View file

@ -57,7 +57,7 @@ void Game_DecodeChangeParms(void)
pl.velocity[0] = parm7;
pl.velocity[1] = parm8;
pl.velocity[2] = parm9;
pl.items = parm10;
pl.g_items = parm10;
pl.activeweapon = parm11;
}
void Game_SetChangeParms(void)
@ -72,7 +72,7 @@ void Game_SetChangeParms(void)
parm7 = pl.velocity[0];
parm8 = pl.velocity[1];
parm9 = pl.velocity[2];
parm10 = pl.items;
parm10 = pl.g_items;
parm11 = pl.activeweapon;
}

View file

@ -57,7 +57,7 @@ void Game_DecodeChangeParms(void)
pl.velocity[0] = parm7;
pl.velocity[1] = parm8;
pl.velocity[2] = parm9;
pl.items = parm10;
pl.g_items = parm10;
pl.activeweapon = parm11;
}
void Game_SetChangeParms(void)
@ -72,7 +72,7 @@ void Game_SetChangeParms(void)
parm7 = pl.velocity[0];
parm8 = pl.velocity[1];
parm9 = pl.velocity[2];
parm10 = pl.items;
parm10 = pl.g_items;
parm11 = pl.activeweapon;
}

View file

@ -15,7 +15,7 @@ void Player_Death(void)
{
player pl = (player)self;
pl.movetype = MOVETYPE_NONE;
pl.health = pl.armor = pl.activeweapon = pl.items = 0;
pl.health = pl.armor = pl.activeweapon = pl.g_items = 0;
PutClientInServer();
}
@ -101,7 +101,7 @@ float Player_SendEntity(entity ePEnt, float fChanged)
WriteCoord(MSG_ENTITY, pl.velocity[2]);
WriteFloat(MSG_ENTITY, pl.flags);
WriteByte(MSG_ENTITY, pl.activeweapon);
WriteFloat(MSG_ENTITY, pl.items);
WriteFloat(MSG_ENTITY, pl.g_items);
WriteByte(MSG_ENTITY, pl.health);
WriteByte(MSG_ENTITY, pl.armor);
WriteFloat(MSG_ENTITY, pl.movetype);

View file

@ -4,26 +4,34 @@ class player
float health;
float armor;
float w_attack_next; /* When the weapon is done firing */
float w_idle_next; /* When to play the next idle animation */
/* When the weapon is done firing */
float w_attack_next;
/* When to play the next idle animation */
float w_idle_next;
int a_ammo1; // Magazine/Clip
int a_ammo2; // Rest in the inventory
int a_ammo3; // Special ammo
/* Magazine/Clip */
int a_ammo1;
/* Rest in the inventory */
int a_ammo2;
/* Special ammo */
int a_ammo3;
/* We can't use the default .items field, because FTE will assume
* effects of some bits. Such as invisibility, quad, etc. */
int g_items;
float items;
float activeweapon;
float viewzoom;
vector view_ofs;
/* Weapon specific */
int cannon_mag;
int glock_mag;
int mp5_mag;
int python_mag;
int shotgun_mag;
int crossbow_mag;
int rpg_mag;
int cannon_mag;
#ifdef CSQC
/* External model */
@ -37,8 +45,8 @@ class player
vector netorigin;
vector netvelocity;
float netflags;
float net_w_attack_next; /* When the weapon is done firing */
float net_w_idle_next; /* When to play the next idle animation */
float net_w_attack_next;
float net_w_idle_next;
virtual void() gun_offset;
virtual void() draw;

View file

@ -193,7 +193,7 @@ void Weapons_PlaySound(entity t, float ch, string s, float vol, float at)
int Weapons_IsPresent(player pl, int w)
{
if (pl.items & g_weapons[w].id) {
if (pl.g_items & g_weapons[w].id) {
return TRUE;
} else {
return FALSE;
@ -205,7 +205,7 @@ void Weapons_AddItem(player pl, int w)
{
entity oldself = self;
self = pl;
pl.items |= g_weapons[w].id;
pl.g_items |= g_weapons[w].id;
pl.activeweapon = w;
if (g_weapons[w].pickup != __NULL__) {

View file

@ -4,14 +4,22 @@ class player
float health;
float armor;
float w_attack_next; /* When the weapon is done firing */
float w_idle_next; /* When to play the next idle animation */
/* When the weapon is done firing */
float w_attack_next;
/* When to play the next idle animation */
float w_idle_next;
int a_ammo1; // Magazine/Clip
int a_ammo2; // Rest in the inventory
int a_ammo3; // Special ammo
/* Magazine/Clip */
int a_ammo1;
/* Rest in the inventory */
int a_ammo2;
/* Special ammo */
int a_ammo3;
/* We can't use the default .items field, because FTE will assume
* effects of some bits. Such as invisibility, quad, etc. */
int g_items;
float items;
float activeweapon;
float viewzoom;
vector view_ofs;
@ -31,13 +39,13 @@ class player
int p_model_bone;
float pitch;
float lastweapon;
/* Prediction */
vector netorigin;
vector netvelocity;
float netflags;
float net_w_attack_next; /* When the weapon is done firing */
float net_w_idle_next; /* When to play the next idle animation */
float net_w_attack_next;
float net_w_idle_next;
virtual void() gun_offset;
virtual void() draw;

View file

@ -190,7 +190,7 @@ void Weapons_PlaySound(entity t, float ch, string s, float vol, float at)
int Weapons_IsPresent(player pl, int w)
{
if (pl.items & g_weapons[w].id) {
if (pl.g_items & g_weapons[w].id) {
return TRUE;
} else {
return FALSE;
@ -202,7 +202,7 @@ void Weapons_AddItem(player pl, int w)
{
entity oldself = self;
self = pl;
pl.items |= g_weapons[w].id;
pl.g_items |= g_weapons[w].id;
pl.activeweapon = w;
if (g_weapons[w].pickup != __NULL__) {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.