Weapon system changes... added an extra flag to the weapons and reworked portions of the system in order to more correctly emulate Duke 1.5

git-svn-id: https://svn.eduke32.com/eduke32@166 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-05-14 09:16:25 +00:00
parent 8ce6a025e6
commit cc750739ca
5 changed files with 40 additions and 29 deletions

View file

@ -793,7 +793,8 @@ enum weaponflags {
WEAPON_FLAG_SPAWNTYPE2 = 4096, // spawn like shotgun shells
WEAPON_FLAG_SPAWNTYPE3 = 8192, // spawn like chaingun shells
WEAPON_FLAG_SEMIAUTO = 16384, // cancel button press after each shot
WEAPON_FLAG_RELOAD_TIMING = 32768 // special casing for pistol reload sounds
WEAPON_FLAG_RELOAD_TIMING = 32768, // special casing for pistol reload sounds
WEAPON_FLAG_RESET = 65536 // cycle weapon back to frame 1 if fire is held, 0 if not
};
#define TRIPBOMB_TRIPWIRE 1

View file

@ -8458,8 +8458,8 @@ void sanitizegametype()
}
Bsprintf(tempbuf,"%s\n",gametype_names[ud.m_coop]);
initprintf(tempbuf);
if(gametype_flags[ud.m_coop] & GAMETYPE_FLAG_ITEMRESPAWN) ud.m_respawn_items = 1;
else ud.m_respawn_items = 0;
if(gametype_flags[ud.m_coop] & GAMETYPE_FLAG_ITEMRESPAWN)
ud.m_respawn_items = ud.m_respawn_inventory = 1;
// initprintf("ud.m_coop=%i after sanitisation\n",ud.m_coop);
}

View file

@ -5001,11 +5001,11 @@ void AddSystemVars()
Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",PISTOL_WEAPON);
AddGameVar(aszBuf, 2, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",PISTOL_WEAPON);
AddGameVar(aszBuf, 6, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
AddGameVar(aszBuf, 5, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",PISTOL_WEAPON);
AddGameVar(aszBuf, 0, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_FLAGS",PISTOL_WEAPON);
AddGameVar(aszBuf, WEAPON_FLAG_AUTOMATIC | WEAPON_FLAG_RELOAD_TIMING, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
AddGameVar(aszBuf, WEAPON_FLAG_RELOAD_TIMING, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_SHOOTS",PISTOL_WEAPON);
AddGameVar(aszBuf, SHOTSPARK1, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",PISTOL_WEAPON);
@ -5071,14 +5071,13 @@ void AddSystemVars()
Bsprintf(aszBuf,"WEAPON%d_RELOAD",CHAINGUN_WEAPON);
AddGameVar(aszBuf, 0, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",CHAINGUN_WEAPON);
AddGameVar(aszBuf, 4, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
AddGameVar(aszBuf, 3, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",CHAINGUN_WEAPON);
AddGameVar(aszBuf, 10, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
AddGameVar(aszBuf, 12, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",CHAINGUN_WEAPON);
AddGameVar(aszBuf, 0, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_FLAGS",CHAINGUN_WEAPON);
AddGameVar(aszBuf, WEAPON_FLAG_AUTOMATIC | WEAPON_FLAG_FIREEVERYTHIRD | WEAPON_FLAG_AMMOPERSHOT \
| WEAPON_FLAG_SPAWNTYPE3, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
AddGameVar(aszBuf, WEAPON_FLAG_AUTOMATIC | WEAPON_FLAG_FIREEVERYTHIRD | WEAPON_FLAG_AMMOPERSHOT | WEAPON_FLAG_SPAWNTYPE3 | WEAPON_FLAG_RESET, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_SHOOTS",CHAINGUN_WEAPON);
AddGameVar(aszBuf, CHAINGUN, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",CHAINGUN_WEAPON);
@ -5218,7 +5217,7 @@ void AddSystemVars()
Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",DEVISTATOR_WEAPON);
AddGameVar(aszBuf, 3, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",DEVISTATOR_WEAPON);
AddGameVar(aszBuf, 5, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
AddGameVar(aszBuf, 6, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",DEVISTATOR_WEAPON);
AddGameVar(aszBuf, 5, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_FLAGS",DEVISTATOR_WEAPON);
@ -5290,11 +5289,11 @@ void AddSystemVars()
Bsprintf(aszBuf,"WEAPON%d_FIREDELAY",FREEZE_WEAPON);
AddGameVar(aszBuf, 3, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",FREEZE_WEAPON);
AddGameVar(aszBuf, 8, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
AddGameVar(aszBuf, 5, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",FREEZE_WEAPON);
AddGameVar(aszBuf, 0, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_FLAGS",FREEZE_WEAPON);
AddGameVar(aszBuf, WEAPON_FLAG_FIREEVERYTHIRD | WEAPON_FLAG_AUTOMATIC, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
AddGameVar(aszBuf, WEAPON_FLAG_RESET, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_SHOOTS",FREEZE_WEAPON);
AddGameVar(aszBuf, FREEZEBLAST, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM);
Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",FREEZE_WEAPON);

View file

@ -2394,7 +2394,7 @@ void displayweapon(short snum)
myospalw(i+weapon_xoffset-4+184-(p->look_ang>>1),i+looking_arc-((*kb)>>1)+208-gun_pos,
CHAINGUN+5+((*kb-4)/5),gs,o,pal);
}
if(*kb < *aplWeaponTotalTime[CHAINGUN_WEAPON]-2)
if(*kb < *aplWeaponTotalTime[CHAINGUN_WEAPON]-4)
{
i = rand()&7;
myospalw(i+weapon_xoffset-4+162-(p->look_ang>>1),i+looking_arc-((*kb)>>1)+208-gun_pos,
@ -4955,16 +4955,19 @@ SHOOTINCODE:
}
else *kb = 0;
}
else *kb=0;
else if( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RESET)
{
if( sb_snum&(1<<2) ) *kb = 1;
else *kb = 0;
}
else *kb = 0;
}
}
else if ( *kb > aplWeaponFireDelay[p->curr_weapon][snum] && (*kb) < aplWeaponTotalTime[p->curr_weapon][snum]
else if ( *kb >= aplWeaponFireDelay[p->curr_weapon][snum] && (*kb) < aplWeaponTotalTime[p->curr_weapon][snum]
&& (aplWeaponWorksLike[p->curr_weapon][snum] & KNEE_WEAPON ? 1 : p->ammo_amount[p->curr_weapon] > 0))
{
if ( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_AUTOMATIC)
{
if( ( sb_snum&(1<<2) ) == 0 )
*kb = aplWeaponTotalTime[p->curr_weapon][snum];
if ( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_FIREEVERYTHIRD)
{
if( ((*(kb))%3) == 0 )
@ -4973,17 +4976,30 @@ SHOOTINCODE:
DoSpawn(p);
}
}
if( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_FIREEVERYOTHER)
else if( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_FIREEVERYOTHER)
{
DoFire(p);
DoSpawn(p);
}
else
{
if(*kb == aplWeaponFireDelay[p->curr_weapon][snum])
{
DoFire(p);
DoSpawn(p);
}
}
if(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RESET && (*kb) > aplWeaponTotalTime[p->curr_weapon][snum]-3)
{
if( sb_snum&(1<<2) ) *kb = 1;
else *kb = 0;
}
}
else
{
if(*kb == aplWeaponFireDelay[p->curr_weapon][snum])
DoFire(p);
}
}
else if(*kb == aplWeaponFireDelay[p->curr_weapon][snum]
&& (aplWeaponWorksLike[p->curr_weapon][snum]==KNEE_WEAPON ? 1 : p->ammo_amount[p->curr_weapon] > 0))
{
DoFire(p);
}
}
}
@ -5214,7 +5230,7 @@ void computergetinput(long snum, input *syn)
}
syn->avel = min(max((((daang+1024-damyang)&2047)-1024)>>1,-127),127);
syn->horz = min(max((zang-p->horiz)>>1,-MAXHORIZ),MAXHORIZ);
syn->horz = min(max((zang-p->horiz),-MAXHORIZ),MAXHORIZ);
syn->bits |= (1<<23);
return;
}

View file

@ -1063,16 +1063,11 @@ void newgame(char vn,char ln,char sk)
p->curr_weapon = i;
p->gotweapon[i] = 1;
p->ammo_amount[i] = 48;
}
else if(aplWeaponWorksLike[i][0]==KNEE_WEAPON)
{
p->gotweapon[i] = 1;
}
else if(aplWeaponWorksLike[i][0]==HANDREMOTE_WEAPON)
{
p->gotweapon[i] = 1;
}
}
p->last_weapon = -1;
}