2006-04-13 20:47:06 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
2010-05-25 10:56:00 +00:00
|
|
|
Copyright (C) 2010 EDuke32 developers and contributors
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-25 10:56:00 +00:00
|
|
|
This file is part of EDuke32.
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
EDuke32 is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2014-07-20 08:55:56 +00:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2006-04-13 20:47:06 +00:00
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "duke3d.h"
|
2012-06-03 16:09:33 +00:00
|
|
|
#include "common_game.h"
|
2006-05-04 23:51:11 +00:00
|
|
|
#include "osd.h"
|
2010-08-02 08:13:51 +00:00
|
|
|
#include "player.h"
|
2010-08-02 08:19:28 +00:00
|
|
|
#include "demo.h"
|
2009-12-14 05:23:29 +00:00
|
|
|
#include "enet/enet.h"
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-04-15 19:02:48 +00:00
|
|
|
#ifdef __ANDROID__
|
|
|
|
#include "android.h"
|
|
|
|
#endif
|
|
|
|
|
2012-05-14 18:12:27 +00:00
|
|
|
int32_t lastvisinc;
|
2013-01-19 18:28:48 +00:00
|
|
|
hudweapon_t hudweap;
|
|
|
|
|
2012-08-16 21:48:33 +00:00
|
|
|
static int32_t g_snum;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-12-14 05:23:29 +00:00
|
|
|
extern int32_t g_levelTextTime, ticrandomseed;
|
2008-09-15 02:47:02 +00:00
|
|
|
|
2009-01-31 00:02:14 +00:00
|
|
|
int32_t g_numObituaries = 0;
|
|
|
|
int32_t g_numSelfObituaries = 0;
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
void P_UpdateScreenPal(DukePlayer_t *p)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2011-05-29 12:30:38 +00:00
|
|
|
int32_t intowater = 0;
|
2012-08-22 22:49:27 +00:00
|
|
|
const int32_t sect = p->cursectnum;
|
2011-05-29 12:30:38 +00:00
|
|
|
|
2011-01-17 03:49:34 +00:00
|
|
|
if (p->heat_on) p->palette = SLIMEPAL;
|
2012-08-22 22:49:27 +00:00
|
|
|
else if (sect < 0) p->palette = BASEPAL;
|
|
|
|
else if (sector[sect].ceilingpicnum >= FLOORSLIME && sector[sect].ceilingpicnum <= FLOORSLIME+2)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2011-01-17 03:49:34 +00:00
|
|
|
p->palette = SLIMEPAL;
|
2011-05-29 12:30:38 +00:00
|
|
|
intowater = 1;
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sector[p->cursectnum].lotag == ST_2_UNDERWATER) p->palette = WATERPAL;
|
2011-01-17 03:49:34 +00:00
|
|
|
else p->palette = BASEPAL;
|
2011-05-29 12:30:38 +00:00
|
|
|
intowater = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2012-08-22 22:49:27 +00:00
|
|
|
|
2011-05-29 12:30:38 +00:00
|
|
|
g_restorePalette = 1+intowater;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
static void P_IncurDamage(DukePlayer_t *p)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-03-12 05:50:30 +00:00
|
|
|
int32_t damage;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_INCURDAMAGE, p->i, P_Get(p->i)) != 0)
|
2012-10-14 22:10:29 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 22:10:29 +00:00
|
|
|
sprite[p->i].extra -= p->extra_extra8>>8;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 22:10:29 +00:00
|
|
|
damage = sprite[p->i].extra - p->last_extra;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 22:10:29 +00:00
|
|
|
if (damage >= 0)
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 22:10:29 +00:00
|
|
|
p->extra_extra8 = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 22:10:29 +00:00
|
|
|
if (p->inv_amount[GET_SHIELD] > 0)
|
|
|
|
{
|
|
|
|
int32_t shield_damage = damage * (20 + (krand()%30)) / 100;
|
|
|
|
damage -= shield_damage;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 22:10:29 +00:00
|
|
|
p->inv_amount[GET_SHIELD] += shield_damage;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 22:10:29 +00:00
|
|
|
if (p->inv_amount[GET_SHIELD] < 0)
|
|
|
|
{
|
|
|
|
damage += p->inv_amount[GET_SHIELD];
|
|
|
|
p->inv_amount[GET_SHIELD] = 0;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2012-10-14 22:10:29 +00:00
|
|
|
sprite[p->i].extra = p->last_extra + damage;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
void P_QuickKill(DukePlayer_t *p)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-05-05 22:24:50 +00:00
|
|
|
P_PalFrom(p, 48, 48,48,48);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
sprite[p->i].extra = 0;
|
|
|
|
sprite[p->i].cstat |= 32768;
|
2012-10-14 22:10:29 +00:00
|
|
|
|
2009-01-31 00:02:14 +00:00
|
|
|
if (ud.god == 0)
|
|
|
|
A_DoGuts(p->i,JIBS6,8);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
static void A_DoWaterTracers(int32_t x1,int32_t y1,int32_t z1,int32_t x2,int32_t y2,int32_t z2,int32_t n)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t i, xv, yv, zv;
|
|
|
|
int16_t sect = -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
i = n+1;
|
2014-10-25 03:29:21 +00:00
|
|
|
xv = tabledivide32_noinline(x2-x1, i);
|
|
|
|
yv = tabledivide32_noinline(y2-y1, i);
|
|
|
|
zv = tabledivide32_noinline(z2-z1, i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if ((klabs(x1-x2)+klabs(y1-y2)) < 3084)
|
2006-04-13 20:47:06 +00:00
|
|
|
return;
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=n; i>0; i--)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
x1 += xv;
|
|
|
|
y1 += yv;
|
|
|
|
z1 += zv;
|
|
|
|
updatesector(x1,y1,§);
|
2009-08-28 23:08:00 +00:00
|
|
|
if (sect < 0)
|
|
|
|
break;
|
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sector[sect].lotag == ST_2_UNDERWATER)
|
2009-08-28 23:08:00 +00:00
|
|
|
A_InsertSprite(sect,x1,y1,z1,WATERBUBBLE,-32,4+(krand()&3),4+(krand()&3),krand()&2047,0,0,g_player[0].ps->i,5);
|
|
|
|
else
|
|
|
|
A_InsertSprite(sect,x1,y1,z1,SMALLSMOKE,-32,14,14,0,0,0,g_player[0].ps->i,5);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-13 04:40:56 +00:00
|
|
|
static void A_HitscanProjTrail(const vec3_t *sv, const vec3_t *dv, int32_t ang, int32_t atwith)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t n, j, i;
|
|
|
|
int16_t sect = -1;
|
2009-01-13 04:40:56 +00:00
|
|
|
vec3_t srcvect;
|
|
|
|
vec3_t destvect;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-01-01 15:24:39 +00:00
|
|
|
const projectile_t *const proj = &ProjectileData[atwith];
|
|
|
|
|
2009-01-13 12:23:18 +00:00
|
|
|
Bmemcpy(&destvect, dv, sizeof(vec3_t));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-10-25 03:29:21 +00:00
|
|
|
srcvect.x = sv->x + tabledivide32_noinline(sintable[(348+ang+512)&2047], proj->offset);
|
|
|
|
srcvect.y = sv->y + tabledivide32_noinline(sintable[(ang+348)&2047], proj->offset);
|
2013-01-01 15:24:39 +00:00
|
|
|
srcvect.z = sv->z + 1024+(proj->toffset<<8);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-01-13 04:40:56 +00:00
|
|
|
n = ((FindDistance2D(srcvect.x-destvect.x,srcvect.y-destvect.y))>>8)+1;
|
2006-07-30 01:48:52 +00:00
|
|
|
|
2014-10-25 03:29:21 +00:00
|
|
|
destvect.x = tabledivide32_noinline((destvect.x-srcvect.x), n);
|
|
|
|
destvect.y = tabledivide32_noinline((destvect.y-srcvect.y), n);
|
|
|
|
destvect.z = tabledivide32_noinline((destvect.z-srcvect.z), n);
|
2009-01-13 04:40:56 +00:00
|
|
|
|
|
|
|
srcvect.x += destvect.x>>2;
|
|
|
|
srcvect.y += destvect.y>>2;
|
|
|
|
srcvect.z += (destvect.z>>2);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-01-01 15:24:39 +00:00
|
|
|
for (i=proj->tnum; i>0; i--)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-13 04:40:56 +00:00
|
|
|
srcvect.x += destvect.x;
|
|
|
|
srcvect.y += destvect.y;
|
|
|
|
srcvect.z += destvect.z;
|
|
|
|
updatesector(srcvect.x,srcvect.y,§);
|
2009-08-09 05:32:17 +00:00
|
|
|
if (sect < 0)
|
|
|
|
break;
|
2009-01-13 04:40:56 +00:00
|
|
|
getzsofslope(sect,srcvect.x,srcvect.y,&n,&j);
|
2009-08-09 05:32:17 +00:00
|
|
|
if (srcvect.z > j || srcvect.z < n)
|
2008-07-17 23:14:32 +00:00
|
|
|
break;
|
2013-01-01 15:24:39 +00:00
|
|
|
j = A_InsertSprite(sect,srcvect.x,srcvect.y,srcvect.z,proj->trail,-32,
|
|
|
|
proj->txrepeat,proj->tyrepeat,ang,0,0,g_player[0].ps->i,0);
|
2012-05-05 22:24:33 +00:00
|
|
|
changespritestat(j, STAT_ACTOR);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t A_GetHitscanRange(int32_t i)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-03-12 05:50:30 +00:00
|
|
|
int32_t zoff = (PN == APLAYER) ? PHEIGHT : 0;
|
2012-08-10 19:12:01 +00:00
|
|
|
hitdata_t hit;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-01-13 12:23:18 +00:00
|
|
|
SZ -= zoff;
|
|
|
|
hitscan((const vec3_t *)&sprite[i],SECT,
|
2006-04-13 20:47:06 +00:00
|
|
|
sintable[(SA+512)&2047],
|
|
|
|
sintable[SA&2047],
|
2012-08-10 19:12:01 +00:00
|
|
|
0,&hit,CLIPMASK1);
|
2009-01-13 12:23:18 +00:00
|
|
|
SZ += zoff;
|
2010-03-12 05:50:30 +00:00
|
|
|
|
2012-08-10 19:12:01 +00:00
|
|
|
return (FindDistance2D(hit.pos.x-SX,hit.pos.y-SY));
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2013-07-13 21:05:01 +00:00
|
|
|
static int32_t A_FindTargetSprite(const spritetype *s, int32_t aang, int32_t atwith)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t gotshrinker,gotfreezer;
|
|
|
|
int32_t i, j, a, k, cans;
|
2013-07-13 21:05:01 +00:00
|
|
|
static const int32_t aimstats[] = {
|
|
|
|
STAT_PLAYER, STAT_DUMMYPLAYER, STAT_ACTOR, STAT_ZOMBIEACTOR
|
|
|
|
};
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t dx1, dy1, dx2, dy2, dx3, dy3, smax, sdist;
|
|
|
|
int32_t xv, yv;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-12-28 17:04:27 +00:00
|
|
|
const int32_t snum = s->picnum == APLAYER ? P_GetP(s) : -1;
|
|
|
|
|
2006-11-15 01:16:55 +00:00
|
|
|
if (s->picnum == APLAYER)
|
|
|
|
{
|
2013-12-28 17:04:27 +00:00
|
|
|
if (!g_player[snum].ps->auto_aim)
|
2006-04-15 18:40:10 +00:00
|
|
|
return -1;
|
2012-10-14 22:10:29 +00:00
|
|
|
|
2013-12-28 17:04:27 +00:00
|
|
|
if (g_player[snum].ps->auto_aim == 2)
|
2006-04-15 18:40:10 +00:00
|
|
|
{
|
2014-02-22 19:38:52 +00:00
|
|
|
if (A_CheckSpriteTileFlags(atwith,SFLAG_PROJECTILE) && (ProjectileData[atwith].workslike & PROJECTILE_RPG))
|
2006-04-15 18:40:10 +00:00
|
|
|
return -1;
|
2013-07-13 21:05:01 +00:00
|
|
|
|
|
|
|
switch (DYNAMICTILEMAP(atwith))
|
|
|
|
{
|
|
|
|
case TONGUE__STATIC:
|
|
|
|
case FREEZEBLAST__STATIC:
|
|
|
|
case SHRINKSPARK__STATIC:
|
|
|
|
case SHRINKER__STATIC:
|
|
|
|
case RPG__STATIC:
|
|
|
|
case FIRELASER__STATIC:
|
|
|
|
case SPIT__STATIC:
|
|
|
|
case COOLEXPLOSION1__STATIC:
|
|
|
|
return -1;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2006-04-15 18:40:10 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-28 00:46:09 +00:00
|
|
|
|
|
|
|
a = s->ang;
|
|
|
|
|
|
|
|
j = -1;
|
|
|
|
|
2014-10-25 03:27:01 +00:00
|
|
|
gotshrinker = (s->picnum == APLAYER && PWEAPON(snum, g_player[snum].ps->curr_weapon, WorksLike) == SHRINKER_WEAPON);
|
|
|
|
gotfreezer = (s->picnum == APLAYER && PWEAPON(snum, g_player[snum].ps->curr_weapon, WorksLike) == FREEZE_WEAPON);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-09-02 14:04:16 +00:00
|
|
|
smax = INT32_MAX;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
dx1 = sintable[(a+512-aang)&2047];
|
|
|
|
dy1 = sintable[(a-aang)&2047];
|
|
|
|
dx2 = sintable[(a+512+aang)&2047];
|
|
|
|
dy2 = sintable[(a+aang)&2047];
|
|
|
|
|
|
|
|
dx3 = sintable[(a+512)&2047];
|
|
|
|
dy3 = sintable[a&2047];
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (k=0; k<4; k++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (j >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
break;
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=headspritestat[aimstats[k]]; i >= 0; i=nextspritestat[i])
|
2006-11-14 21:35:50 +00:00
|
|
|
if (sprite[i].xrepeat > 0 && sprite[i].extra >= 0 && (sprite[i].cstat&(257+32768)) == 257)
|
2008-11-20 14:06:36 +00:00
|
|
|
if (A_CheckEnemySprite(&sprite[i]) || k < 2)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (A_CheckEnemySprite(&sprite[i]) || PN == APLAYER || PN == SHARK)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-28 17:04:27 +00:00
|
|
|
if (PN == APLAYER && s->picnum == APLAYER && s != &sprite[i] &&
|
2006-04-13 20:47:06 +00:00
|
|
|
// ud.ffire == 0 &&
|
2010-03-12 05:50:30 +00:00
|
|
|
(GTFLAGS(GAMETYPE_PLAYERSFRIENDLY) || (GTFLAGS(GAMETYPE_TDM) &&
|
2013-12-28 17:04:27 +00:00
|
|
|
g_player[P_Get(i)].ps->team == g_player[snum].ps->team)))
|
2006-04-13 20:47:06 +00:00
|
|
|
continue;
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (gotshrinker && sprite[i].xrepeat < 30)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-15 01:16:55 +00:00
|
|
|
if (PN == SHARK)
|
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (sprite[i].xrepeat < 20) continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
continue;
|
2006-11-13 23:12:47 +00:00
|
|
|
}
|
2006-12-10 06:49:01 +00:00
|
|
|
else if (!(PN >= GREENSLIME && PN <= GREENSLIME+7))
|
2006-04-13 20:47:06 +00:00
|
|
|
continue;
|
|
|
|
}
|
2006-11-13 23:12:47 +00:00
|
|
|
if (gotfreezer && sprite[i].pal == 1) continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
xv = (SX-s->x);
|
|
|
|
yv = (SY-s->y);
|
|
|
|
|
2012-10-14 22:10:29 +00:00
|
|
|
if ((dy1*xv <= dx1*yv) && (dy2*xv >= dx2*yv))
|
|
|
|
{
|
|
|
|
sdist = mulscale(dx3,xv,14) + mulscale(dy3,yv,14);
|
|
|
|
|
|
|
|
if (sdist > 512 && sdist < smax)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-10-14 22:10:29 +00:00
|
|
|
if (s->picnum == APLAYER)
|
2013-12-28 17:04:27 +00:00
|
|
|
{
|
|
|
|
const DukePlayer_t *const ps = g_player[P_GetP(s)].ps;
|
|
|
|
a = (klabs(scale(SZ-s->z,10,sdist)-(ps->horiz+ps->horizoff-100)) < 100);
|
|
|
|
}
|
2012-10-14 22:10:29 +00:00
|
|
|
else a = 1;
|
|
|
|
|
|
|
|
if (PN == ORGANTIC || PN == ROTATEGUN)
|
|
|
|
cans = cansee(SX,SY,SZ,SECT,s->x,s->y,s->z-(32<<8),s->sectnum);
|
|
|
|
else cans = cansee(SX,SY,SZ-(32<<8),SECT,s->x,s->y,s->z-(32<<8),s->sectnum);
|
|
|
|
|
|
|
|
if (a && cans)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-10-14 22:10:29 +00:00
|
|
|
smax = sdist;
|
|
|
|
j = i;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2012-10-14 22:10:29 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return j;
|
|
|
|
}
|
|
|
|
|
2012-09-02 13:58:45 +00:00
|
|
|
static void A_SetHitData(int32_t i, const hitdata_t *hit)
|
|
|
|
{
|
|
|
|
actor[i].t_data[6] = hit->wall;
|
|
|
|
actor[i].t_data[7] = hit->sect;
|
|
|
|
actor[i].t_data[8] = hit->sprite;
|
|
|
|
}
|
|
|
|
|
2012-09-02 13:59:50 +00:00
|
|
|
static int32_t CheckShootSwitchTile(int32_t pn)
|
|
|
|
{
|
|
|
|
return pn == DIPSWITCH || pn == DIPSWITCH+1 ||
|
|
|
|
pn == DIPSWITCH2 || pn == DIPSWITCH2+1 ||
|
|
|
|
pn == DIPSWITCH3 || pn == DIPSWITCH3+1 ||
|
|
|
|
pn == HANDSWITCH || pn == HANDSWITCH+1;
|
|
|
|
}
|
|
|
|
|
2013-02-07 21:00:58 +00:00
|
|
|
static int32_t safeldist(int32_t spritenum1, const spritetype *s2)
|
|
|
|
{
|
|
|
|
int32_t dst = ldist(&sprite[spritenum1], s2);
|
|
|
|
return dst ? dst : 1;
|
|
|
|
}
|
|
|
|
|
2012-09-02 14:03:10 +00:00
|
|
|
// flags:
|
|
|
|
// 1: do sprite center adjustment (cen-=(8<<8)) for GREENSLIME or ROTATEGUN
|
|
|
|
// 2: do auto getangle only if not RECON (if clear, do unconditionally)
|
|
|
|
static int32_t GetAutoAimAngle(int32_t i, int32_t p, int32_t atwith,
|
|
|
|
int32_t cen_add, int32_t flags,
|
|
|
|
const vec3_t *srcvect, int32_t vel,
|
|
|
|
int32_t *zvel, int16_t *sa)
|
|
|
|
{
|
2013-01-01 15:24:33 +00:00
|
|
|
int32_t j = -1;
|
2012-09-02 14:03:10 +00:00
|
|
|
|
|
|
|
Bassert((unsigned)p < MAXPLAYERS);
|
|
|
|
|
2013-01-02 22:33:37 +00:00
|
|
|
#ifdef LUNATIC
|
2014-09-30 04:03:17 +00:00
|
|
|
g_player[p].ps->autoaimang = g_player[p].ps->auto_aim == 3 ? AUTO_AIM_ANGLE<<1 : AUTO_AIM_ANGLE;
|
2013-01-02 22:33:37 +00:00
|
|
|
#else
|
2014-09-30 04:03:17 +00:00
|
|
|
Gv_SetVar(g_iAimAngleVarID, g_player[p].ps->auto_aim == 3 ? AUTO_AIM_ANGLE<<1 : AUTO_AIM_ANGLE, i, p);
|
2013-01-02 22:33:37 +00:00
|
|
|
#endif
|
2012-10-14 22:10:29 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
VM_OnEvent(EVENT_GETAUTOAIMANGLE, i, p);
|
2012-09-02 14:03:10 +00:00
|
|
|
|
|
|
|
{
|
2013-01-02 22:33:37 +00:00
|
|
|
#ifdef LUNATIC
|
|
|
|
int32_t aimang = g_player[p].ps->autoaimang;
|
|
|
|
#else
|
2012-09-02 14:03:10 +00:00
|
|
|
int32_t aimang = Gv_GetVar(g_iAimAngleVarID, i, p);
|
2013-01-02 22:33:37 +00:00
|
|
|
#endif
|
2012-09-02 14:03:10 +00:00
|
|
|
if (aimang > 0)
|
|
|
|
j = A_FindTargetSprite(&sprite[i], aimang, atwith);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (j >= 0)
|
|
|
|
{
|
|
|
|
const spritetype *const spr = &sprite[j];
|
2014-09-30 04:14:21 +00:00
|
|
|
int32_t cen = 2*(spr->yrepeat*tilesiz[spr->picnum].y) + cen_add;
|
2012-09-02 14:03:10 +00:00
|
|
|
int32_t dst;
|
|
|
|
|
|
|
|
if (flags)
|
|
|
|
{
|
|
|
|
int32_t pn = spr->picnum;
|
|
|
|
if ((pn >= GREENSLIME && pn <= GREENSLIME+7) || spr->picnum==ROTATEGUN)
|
|
|
|
{
|
|
|
|
cen -= (8<<8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-07 21:00:58 +00:00
|
|
|
dst = safeldist(g_player[p].ps->i, &sprite[j]);
|
2014-10-25 03:29:21 +00:00
|
|
|
*zvel = tabledivide32_noinline((spr->z - srcvect->z - cen)*vel, dst);
|
2012-09-02 14:03:10 +00:00
|
|
|
|
|
|
|
if (!(flags&2) || sprite[j].picnum != RECON)
|
|
|
|
*sa = getangle(spr->x-srcvect->x, spr->y-srcvect->y);
|
|
|
|
}
|
|
|
|
|
|
|
|
return j;
|
|
|
|
}
|
|
|
|
|
2013-01-01 15:24:14 +00:00
|
|
|
static void Proj_MaybeSpawn(int32_t k, int32_t atwith, const hitdata_t *hit)
|
|
|
|
{
|
2013-01-01 15:24:36 +00:00
|
|
|
// atwith < 0 is for hard-coded projectiles
|
|
|
|
int32_t spawntile = atwith < 0 ? -atwith : ProjectileData[atwith].spawns;
|
|
|
|
|
|
|
|
if (spawntile >= 0)
|
2013-01-01 15:24:14 +00:00
|
|
|
{
|
2013-01-01 15:24:36 +00:00
|
|
|
int32_t wh = A_Spawn(k, spawntile);
|
2013-01-01 15:24:33 +00:00
|
|
|
|
2013-01-01 15:24:36 +00:00
|
|
|
if (atwith >= 0)
|
|
|
|
{
|
|
|
|
if (ProjectileData[atwith].sxrepeat > 4)
|
|
|
|
sprite[wh].xrepeat = ProjectileData[atwith].sxrepeat;
|
|
|
|
if (ProjectileData[atwith].syrepeat > 4)
|
|
|
|
sprite[wh].yrepeat = ProjectileData[atwith].syrepeat;
|
|
|
|
}
|
2013-01-01 15:24:33 +00:00
|
|
|
|
2013-01-01 15:24:14 +00:00
|
|
|
A_SetHitData(wh, hit);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-01 15:24:36 +00:00
|
|
|
// <extra>: damage that this shotspark does
|
2013-01-01 15:24:33 +00:00
|
|
|
static int32_t Proj_InsertShotspark(const hitdata_t *hit, int32_t i, int32_t atwith,
|
|
|
|
int32_t xyrepeat, int32_t ang, int32_t extra)
|
2013-01-01 15:24:14 +00:00
|
|
|
{
|
2013-01-01 15:24:33 +00:00
|
|
|
int32_t k = A_InsertSprite(hit->sect, hit->pos.x, hit->pos.y, hit->pos.z,
|
|
|
|
SHOTSPARK1,-15, xyrepeat,xyrepeat, ang,0,0,i,4);
|
|
|
|
sprite[k].extra = extra;
|
|
|
|
// This is a hack to allow you to detect which weapon spawned a SHOTSPARK1:
|
|
|
|
sprite[k].yvel = atwith;
|
2013-01-01 15:24:14 +00:00
|
|
|
A_SetHitData(k, hit);
|
|
|
|
|
|
|
|
return k;
|
|
|
|
}
|
|
|
|
|
2013-01-01 15:24:33 +00:00
|
|
|
static int32_t Proj_GetExtra(int32_t atwith)
|
|
|
|
{
|
|
|
|
int32_t extra = ProjectileData[atwith].extra;
|
|
|
|
if (ProjectileData[atwith].extra_rand > 0)
|
|
|
|
extra += (krand()%ProjectileData[atwith].extra_rand);
|
|
|
|
return extra;
|
|
|
|
}
|
|
|
|
|
2013-01-01 15:24:31 +00:00
|
|
|
static void Proj_MaybeAddSpread(int32_t not_accurate_p, int32_t *zvel, int16_t *sa,
|
|
|
|
int32_t zRange, int32_t angRange)
|
|
|
|
{
|
|
|
|
if (not_accurate_p)
|
|
|
|
{
|
2013-04-29 19:24:12 +00:00
|
|
|
// Ranges <= 1 mean no spread at all. A range of 1 calls krand() though.
|
|
|
|
if (zRange > 0)
|
|
|
|
*zvel += zRange/2 - krand()%zRange;
|
|
|
|
if (angRange > 0)
|
|
|
|
*sa += angRange/2 - krand()%angRange;
|
2013-01-01 15:24:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-07 21:01:12 +00:00
|
|
|
|
2013-06-30 20:38:50 +00:00
|
|
|
static int32_t g_overrideShootZvel = 0; // a boolean
|
|
|
|
static int32_t g_shootZvel; // the actual zvel if the above is !=0
|
2013-02-07 21:01:12 +00:00
|
|
|
|
2013-06-30 20:38:50 +00:00
|
|
|
static int32_t A_GetShootZvel(int32_t defaultzvel)
|
2013-02-07 21:01:12 +00:00
|
|
|
{
|
2013-06-30 20:38:50 +00:00
|
|
|
return g_overrideShootZvel ? g_shootZvel : defaultzvel;
|
2013-02-07 21:01:12 +00:00
|
|
|
}
|
|
|
|
|
2013-01-01 15:24:31 +00:00
|
|
|
// Prepare hitscan weapon fired from player p.
|
|
|
|
static void P_PreFireHitscan(int32_t i, int32_t p, int32_t atwith,
|
|
|
|
vec3_t *srcvect, int32_t *zvel, int16_t *sa,
|
|
|
|
int32_t accurate_autoaim_p,
|
|
|
|
int32_t not_accurate_p)
|
|
|
|
{
|
|
|
|
int32_t angRange=32;
|
|
|
|
int32_t zRange=256;
|
|
|
|
|
|
|
|
int32_t j = GetAutoAimAngle(i, p, atwith, 5<<8, 0+1, srcvect, 256, zvel, sa);
|
2013-01-02 22:33:37 +00:00
|
|
|
DukePlayer_t *const ps = g_player[p].ps;
|
2013-01-01 15:24:31 +00:00
|
|
|
|
2013-01-02 22:33:37 +00:00
|
|
|
#ifdef LUNATIC
|
|
|
|
ps->angrange = angRange;
|
|
|
|
ps->zrange = zRange;
|
|
|
|
#else
|
2013-01-01 15:24:31 +00:00
|
|
|
Gv_SetVar(g_iAngRangeVarID,angRange, i,p);
|
|
|
|
Gv_SetVar(g_iZRangeVarID,zRange,i,p);
|
2013-01-02 22:33:37 +00:00
|
|
|
#endif
|
2013-01-01 15:24:31 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
VM_OnEvent(EVENT_GETSHOTRANGE, i, p);
|
2013-01-02 22:33:37 +00:00
|
|
|
|
2013-01-19 18:28:32 +00:00
|
|
|
#ifdef LUNATIC
|
2013-01-02 22:33:37 +00:00
|
|
|
angRange = ps->angrange;
|
|
|
|
zRange = ps->zrange;
|
|
|
|
#else
|
2013-01-01 15:24:31 +00:00
|
|
|
angRange=Gv_GetVar(g_iAngRangeVarID,i,p);
|
|
|
|
zRange=Gv_GetVar(g_iZRangeVarID,i,p);
|
|
|
|
#endif
|
2013-01-02 22:33:37 +00:00
|
|
|
|
2013-01-01 15:24:31 +00:00
|
|
|
if (accurate_autoaim_p)
|
|
|
|
{
|
|
|
|
if (!ps->auto_aim)
|
|
|
|
{
|
|
|
|
hitdata_t hit;
|
|
|
|
|
2013-06-30 20:38:50 +00:00
|
|
|
*zvel = A_GetShootZvel((100-ps->horiz-ps->horizoff)<<5);
|
2013-01-01 15:24:31 +00:00
|
|
|
|
|
|
|
hitscan(srcvect, sprite[i].sectnum, sintable[(*sa+512)&2047], sintable[*sa&2047],
|
|
|
|
*zvel<<6,&hit,CLIPMASK1);
|
|
|
|
|
|
|
|
if (hit.sprite != -1)
|
|
|
|
{
|
|
|
|
const int32_t hitstatnumsbitmap =
|
|
|
|
((1<<STAT_ACTOR) | (1<<STAT_ZOMBIEACTOR) | (1<<STAT_PLAYER) | (1<<STAT_DUMMYPLAYER));
|
|
|
|
const int32_t st = sprite[hit.sprite].statnum;
|
|
|
|
|
|
|
|
if (st>=0 && st<=30 && (hitstatnumsbitmap&(1<<st)))
|
|
|
|
j = hit.sprite;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (j == -1)
|
|
|
|
{
|
|
|
|
*zvel = (100-ps->horiz-ps->horizoff)<<5;
|
|
|
|
Proj_MaybeAddSpread(not_accurate_p, zvel, sa, zRange, angRange);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (j == -1) // no target
|
|
|
|
*zvel = (100-ps->horiz-ps->horizoff)<<5;
|
|
|
|
Proj_MaybeAddSpread(not_accurate_p, zvel, sa, zRange, angRange);
|
|
|
|
}
|
|
|
|
|
|
|
|
srcvect->z -= (2<<8);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Hitscan weapon fired from actor (sprite s);
|
|
|
|
static void A_PreFireHitscan(const spritetype *s, vec3_t *srcvect, int32_t *zvel, int16_t *sa,
|
|
|
|
int32_t not_accurate_p)
|
|
|
|
{
|
2013-04-15 10:48:13 +00:00
|
|
|
const int32_t j = A_FindPlayer(s, NULL);
|
2013-01-01 15:24:31 +00:00
|
|
|
const DukePlayer_t *targetps = g_player[j].ps;
|
|
|
|
|
2013-04-15 10:48:13 +00:00
|
|
|
const int32_t d = safeldist(targetps->i, s);
|
2014-10-25 03:29:21 +00:00
|
|
|
*zvel = tabledivide32_noinline((targetps->pos.z-srcvect->z)<<8, d);
|
2013-01-01 15:24:31 +00:00
|
|
|
|
|
|
|
srcvect->z -= (4<<8);
|
|
|
|
|
|
|
|
if (s->picnum != BOSS1)
|
|
|
|
{
|
|
|
|
Proj_MaybeAddSpread(not_accurate_p, zvel, sa, 256, 64);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*sa = getangle(targetps->pos.x-srcvect->x, targetps->pos.y-srcvect->y);
|
|
|
|
|
|
|
|
Proj_MaybeAddSpread(not_accurate_p, zvel, sa, 256, 128);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-01 15:24:36 +00:00
|
|
|
static int32_t Proj_DoHitscan(int32_t i, int32_t cstatmask,
|
|
|
|
const vec3_t *srcvect, int32_t zvel, int16_t sa,
|
|
|
|
hitdata_t *hit)
|
2013-01-01 15:24:33 +00:00
|
|
|
{
|
|
|
|
spritetype *const s = &sprite[i];
|
|
|
|
|
|
|
|
s->cstat &= ~cstatmask;
|
|
|
|
|
2013-06-30 20:38:50 +00:00
|
|
|
zvel = A_GetShootZvel(zvel);
|
2013-01-01 15:24:33 +00:00
|
|
|
|
|
|
|
hitscan(srcvect, s->sectnum,
|
|
|
|
sintable[(sa+512)&2047],
|
|
|
|
sintable[sa&2047],
|
|
|
|
zvel<<6, hit, CLIPMASK1);
|
|
|
|
|
|
|
|
s->cstat |= cstatmask;
|
|
|
|
|
|
|
|
return (hit->sect < 0);
|
|
|
|
}
|
|
|
|
|
2013-01-01 15:24:42 +00:00
|
|
|
static void Proj_DoRandDecalSize(int32_t spritenum, int32_t atwith)
|
|
|
|
{
|
|
|
|
const projectile_t *const proj = &ProjectileData[atwith];
|
|
|
|
|
|
|
|
if (proj->workslike & PROJECTILE_RANDDECALSIZE)
|
|
|
|
{
|
|
|
|
int32_t wh = (krand()&proj->xrepeat);
|
|
|
|
if (wh < proj->yrepeat)
|
|
|
|
wh = proj->yrepeat;
|
|
|
|
sprite[spritenum].xrepeat = wh;
|
|
|
|
sprite[spritenum].yrepeat = wh;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite[spritenum].xrepeat = proj->xrepeat;
|
|
|
|
sprite[spritenum].yrepeat = proj->yrepeat;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int32_t SectorContainsSE13(int32_t sectnum)
|
|
|
|
{
|
|
|
|
int32_t i;
|
|
|
|
if (sectnum >= 0)
|
|
|
|
for (SPRITES_OF_SECT(sectnum, i))
|
|
|
|
if (sprite[i].statnum == STAT_EFFECTOR && sprite[i].lotag == SE_13_EXPLOSIVE)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Maybe handle bit 2 (swap wall bottoms).
|
|
|
|
// (in that case walltype *hitwal may be stale)
|
2014-11-22 12:29:25 +00:00
|
|
|
static inline void HandleHitWall(hitdata_t *hit)
|
2013-01-01 15:24:42 +00:00
|
|
|
{
|
|
|
|
const walltype *const hitwal = &wall[hit->wall];
|
|
|
|
|
|
|
|
if ((hitwal->cstat&2) && redwallp(hitwal))
|
|
|
|
if (hit->pos.z >= sector[hitwal->nextsector].floorz)
|
|
|
|
hit->wall = hitwal->nextwall;
|
|
|
|
}
|
|
|
|
|
2013-12-20 18:31:26 +00:00
|
|
|
// Maybe damage a ceiling or floor as the consequence of projectile impact.
|
|
|
|
// Returns 1 if projectile hit a parallaxed ceiling.
|
|
|
|
// NOTE: Compare with Proj_MaybeDamageCF() in actors.c
|
|
|
|
static int32_t Proj_MaybeDamageCF2(int32_t zvel, int32_t hitsect)
|
|
|
|
{
|
|
|
|
if (zvel < 0)
|
|
|
|
{
|
|
|
|
Bassert(hitsect >= 0);
|
|
|
|
|
|
|
|
if (sector[hitsect].ceilingstat&1)
|
|
|
|
return 1;
|
|
|
|
|
2013-12-20 18:31:29 +00:00
|
|
|
Sect_DamageCeilingOrFloor(0, hitsect);
|
|
|
|
}
|
|
|
|
else if (zvel > 0)
|
|
|
|
{
|
|
|
|
Bassert(hitsect >= 0);
|
|
|
|
|
|
|
|
if (sector[hitsect].floorstat&1)
|
|
|
|
{
|
|
|
|
// Keep original Duke3D behavior: pass projectiles through
|
|
|
|
// parallaxed ceilings, but NOT through such floors.
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
Sect_DamageCeilingOrFloor(1, hitsect);
|
2013-12-20 18:31:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-01-01 15:24:36 +00:00
|
|
|
// Finish shooting hitscan weapon from player <p>. <k> is the inserted SHOTSPARK1.
|
|
|
|
// * <spawnatimpacttile> is passed to Proj_MaybeSpawn()
|
|
|
|
// * <decaltile> and <damagewalltile> are for wall impact
|
|
|
|
// * <damagewalltile> is passed to A_DamageWall()
|
|
|
|
// * <flags> is for decals upon wall impact:
|
|
|
|
// 1: handle random decal size (tile <atwith>)
|
|
|
|
// 2: set cstat to wall-aligned + random x/y flip
|
|
|
|
//
|
|
|
|
// TODO: maybe split into 3 cases (hit neither wall nor sprite, hit sprite, hit wall)?
|
|
|
|
static int32_t P_PostFireHitscan(int32_t p, int32_t k, hitdata_t *hit, int32_t i, int32_t atwith, int32_t zvel,
|
|
|
|
int32_t spawnatimpacttile, int32_t decaltile, int32_t damagewalltile,
|
|
|
|
int32_t flags)
|
|
|
|
{
|
|
|
|
if (hit->wall == -1 && hit->sprite == -1)
|
|
|
|
{
|
2013-12-20 18:31:26 +00:00
|
|
|
if (Proj_MaybeDamageCF2(zvel, hit->sect))
|
2013-01-01 15:24:36 +00:00
|
|
|
{
|
2013-12-20 18:31:26 +00:00
|
|
|
sprite[k].xrepeat = 0;
|
|
|
|
sprite[k].yrepeat = 0;
|
|
|
|
return -1;
|
2013-01-01 15:24:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Proj_MaybeSpawn(k, spawnatimpacttile, hit);
|
|
|
|
}
|
|
|
|
else if (hit->sprite >= 0)
|
|
|
|
{
|
|
|
|
A_DamageObject(hit->sprite, k);
|
|
|
|
|
|
|
|
if (sprite[hit->sprite].picnum == APLAYER &&
|
|
|
|
(ud.ffire == 1 || (!GTFLAGS(GAMETYPE_PLAYERSFRIENDLY) && GTFLAGS(GAMETYPE_TDM) &&
|
2013-12-28 17:04:27 +00:00
|
|
|
g_player[P_Get(hit->sprite)].ps->team != g_player[P_Get(i)].ps->team)))
|
2013-01-01 15:24:36 +00:00
|
|
|
{
|
|
|
|
int32_t l = A_Spawn(k, JIBS6);
|
|
|
|
sprite[k].xrepeat = sprite[k].yrepeat = 0;
|
|
|
|
sprite[l].z += (4<<8);
|
|
|
|
sprite[l].xvel = 16;
|
|
|
|
sprite[l].xrepeat = sprite[l].yrepeat = 24;
|
|
|
|
sprite[l].ang += 64-(krand()&127);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Proj_MaybeSpawn(k, spawnatimpacttile, hit);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p >= 0 && CheckShootSwitchTile(sprite[hit->sprite].picnum))
|
|
|
|
{
|
|
|
|
P_ActivateSwitch(p, hit->sprite, 1);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (hit->wall >= 0)
|
|
|
|
{
|
|
|
|
const walltype *const hitwal = &wall[hit->wall];
|
|
|
|
|
|
|
|
Proj_MaybeSpawn(k, spawnatimpacttile, hit);
|
|
|
|
|
|
|
|
if (CheckDoorTile(hitwal->picnum) == 1)
|
|
|
|
goto SKIPBULLETHOLE;
|
|
|
|
|
|
|
|
if (p >= 0 && CheckShootSwitchTile(hitwal->picnum))
|
|
|
|
{
|
|
|
|
P_ActivateSwitch(p, hit->wall, 0);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hitwal->hitag != 0 || (hitwal->nextwall >= 0 && wall[hitwal->nextwall].hitag != 0))
|
|
|
|
goto SKIPBULLETHOLE;
|
|
|
|
|
|
|
|
if (hit->sect >= 0 && sector[hit->sect].lotag == 0)
|
|
|
|
if (hitwal->overpicnum != BIGFORCE && (hitwal->cstat&16) == 0)
|
|
|
|
if ((hitwal->nextsector >= 0 && sector[hitwal->nextsector].lotag == 0) ||
|
|
|
|
(hitwal->nextsector == -1 && sector[hit->sect].lotag == 0))
|
|
|
|
{
|
|
|
|
int32_t l;
|
|
|
|
|
2013-01-01 15:24:42 +00:00
|
|
|
if (SectorContainsSE13(hitwal->nextsector))
|
|
|
|
goto SKIPBULLETHOLE;
|
2013-01-01 15:24:36 +00:00
|
|
|
|
|
|
|
for (SPRITES_OF(STAT_MISC, l))
|
|
|
|
if (sprite[l].picnum == decaltile)
|
|
|
|
if (dist(&sprite[l],&sprite[k]) < (12+(krand()&7)))
|
|
|
|
goto SKIPBULLETHOLE;
|
|
|
|
|
|
|
|
if (decaltile >= 0)
|
|
|
|
{
|
|
|
|
l = A_Spawn(k, decaltile);
|
|
|
|
|
2014-02-22 19:38:52 +00:00
|
|
|
if (!A_CheckSpriteFlags(l, SFLAG_DECAL))
|
|
|
|
actor[l].flags |= SFLAG_DECAL;
|
2013-01-01 15:24:36 +00:00
|
|
|
|
|
|
|
sprite[l].xvel = -1;
|
|
|
|
sprite[l].ang = getangle(hitwal->x-wall[hitwal->point2].x,
|
|
|
|
hitwal->y-wall[hitwal->point2].y)+512;
|
|
|
|
if (flags&1)
|
2013-01-01 15:24:42 +00:00
|
|
|
Proj_DoRandDecalSize(l, atwith);
|
2013-01-01 15:24:36 +00:00
|
|
|
|
|
|
|
if (flags&2)
|
|
|
|
sprite[l].cstat = 16+(krand()&(8+4));
|
|
|
|
|
|
|
|
sprite[l].x -= sintable[(sprite[l].ang+2560)&2047]>>13;
|
|
|
|
sprite[l].y -= sintable[(sprite[l].ang+2048)&2047]>>13;
|
|
|
|
|
|
|
|
A_SetSprite(l, CLIPMASK0);
|
|
|
|
|
|
|
|
// BULLETHOLE already adds itself to the deletion queue in
|
|
|
|
// A_Spawn(). However, some other tiles do as well.
|
|
|
|
if (decaltile != BULLETHOLE)
|
|
|
|
A_AddToDeleteQueue(l);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SKIPBULLETHOLE:
|
2013-01-01 15:24:42 +00:00
|
|
|
HandleHitWall(hit);
|
2013-01-01 15:24:36 +00:00
|
|
|
|
|
|
|
A_DamageWall(k, hit->wall, &hit->pos, damagewalltile);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Finish shooting hitscan weapon from actor (sprite <i>).
|
|
|
|
static int32_t A_PostFireHitscan(const hitdata_t *hit, int32_t i, int32_t atwith, int32_t sa, int32_t extra,
|
|
|
|
int32_t spawnatimpacttile, int32_t damagewalltile)
|
|
|
|
{
|
|
|
|
int32_t k = Proj_InsertShotspark(hit, i, atwith, 24, sa, extra);
|
|
|
|
|
|
|
|
if (hit->sprite >= 0)
|
|
|
|
{
|
|
|
|
A_DamageObject(hit->sprite, k);
|
|
|
|
|
|
|
|
if (sprite[hit->sprite].picnum != APLAYER)
|
|
|
|
Proj_MaybeSpawn(k, spawnatimpacttile, hit);
|
|
|
|
else
|
|
|
|
sprite[k].xrepeat = sprite[k].yrepeat = 0;
|
|
|
|
}
|
|
|
|
else if (hit->wall >= 0)
|
|
|
|
A_DamageWall(k, hit->wall, &hit->pos, damagewalltile);
|
|
|
|
|
|
|
|
return k;
|
|
|
|
}
|
|
|
|
|
2013-01-01 15:24:42 +00:00
|
|
|
// Common "spawn blood?" predicate.
|
|
|
|
// minzdiff: minimal "step" height for blood to be spawned
|
|
|
|
static int32_t Proj_CheckBlood(const vec3_t *srcvect, const hitdata_t *hit,
|
|
|
|
int32_t projrange, int32_t minzdiff)
|
|
|
|
{
|
2014-10-25 03:36:34 +00:00
|
|
|
const walltype * hitwal;
|
2013-01-01 15:24:42 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (hit->wall < 0 || hit->sect < 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
hitwal = &wall[hit->wall];
|
|
|
|
|
|
|
|
if (FindDistance2D(srcvect->x-hit->pos.x, srcvect->y-hit->pos.y) < projrange)
|
|
|
|
if (hitwal->overpicnum != BIGFORCE && (hitwal->cstat&16) == 0)
|
|
|
|
if (sector[hit->sect].lotag == 0)
|
|
|
|
if (hitwal->nextsector < 0 ||
|
|
|
|
(sector[hitwal->nextsector].lotag == 0 && sector[hit->sect].lotag == 0 &&
|
|
|
|
sector[hit->sect].floorz-sector[hitwal->nextsector].floorz > minzdiff))
|
2013-01-01 15:24:42 +00:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Proj_HandleKnee(hitdata_t *hit, int32_t i, int32_t p, int32_t atwith, int32_t sa,
|
|
|
|
const projectile_t *proj, int32_t inserttile,
|
|
|
|
int32_t addrandextra, int32_t spawnatimpacttile, int32_t soundnum)
|
|
|
|
{
|
|
|
|
const DukePlayer_t *const ps = p >= 0 ? g_player[p].ps : NULL;
|
|
|
|
|
|
|
|
int32_t j = A_InsertSprite(hit->sect,hit->pos.x,hit->pos.y,hit->pos.z,
|
|
|
|
inserttile,-15,0,0,sa,32,0,i,4);
|
|
|
|
|
|
|
|
if (proj != NULL)
|
|
|
|
{
|
|
|
|
// Custom projectiles.
|
|
|
|
SpriteProjectile[j].workslike = ProjectileData[sprite[j].picnum].workslike;
|
|
|
|
sprite[j].extra = proj->extra;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (addrandextra > 0)
|
|
|
|
sprite[j].extra += (krand()&addrandextra);
|
|
|
|
|
|
|
|
if (p >= 0)
|
|
|
|
{
|
|
|
|
if (spawnatimpacttile >= 0)
|
|
|
|
{
|
|
|
|
int32_t k = A_Spawn(j, spawnatimpacttile);
|
|
|
|
sprite[k].z -= (8<<8);
|
|
|
|
A_SetHitData(k, hit);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (soundnum >= 0)
|
|
|
|
A_PlaySound(soundnum, j);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p >= 0 && ps->inv_amount[GET_STEROIDS] > 0 && ps->inv_amount[GET_STEROIDS] < 400)
|
|
|
|
sprite[j].extra += (ps->max_player_health>>2);
|
|
|
|
|
|
|
|
if (hit->sprite >= 0 && sprite[hit->sprite].picnum != ACCESSSWITCH && sprite[hit->sprite].picnum != ACCESSSWITCH2)
|
|
|
|
{
|
|
|
|
A_DamageObject(hit->sprite, j);
|
|
|
|
if (p >= 0)
|
|
|
|
P_ActivateSwitch(p, hit->sprite,1);
|
|
|
|
}
|
|
|
|
else if (hit->wall >= 0)
|
|
|
|
{
|
|
|
|
HandleHitWall(hit);
|
|
|
|
|
|
|
|
if (wall[hit->wall].picnum != ACCESSSWITCH && wall[hit->wall].picnum != ACCESSSWITCH2)
|
|
|
|
{
|
|
|
|
A_DamageWall(j, hit->wall, &hit->pos, atwith);
|
|
|
|
if (p >= 0)
|
|
|
|
P_ActivateSwitch(p, hit->wall,0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-04 01:23:55 +00:00
|
|
|
#define MinibossScale(s) (((s)*sprite[i].yrepeat)/80)
|
2013-08-06 23:53:34 +00:00
|
|
|
|
|
|
|
static int32_t A_ShootCustom(const int32_t i, const int32_t atwith, int16_t sa, vec3_t * const srcvect)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
/* Custom projectiles */
|
|
|
|
projectile_t *const proj = &ProjectileData[atwith];
|
|
|
|
int32_t j, k = -1, l;
|
2013-04-15 10:48:13 +00:00
|
|
|
int32_t vel, zvel = 0;
|
2012-08-10 19:12:01 +00:00
|
|
|
hitdata_t hit;
|
2012-08-28 21:42:49 +00:00
|
|
|
spritetype *const s = &sprite[i];
|
|
|
|
const int16_t sect = s->sectnum;
|
2013-12-28 17:04:27 +00:00
|
|
|
const int32_t p = (s->picnum == APLAYER) ? P_GetP(s) : -1;
|
2012-08-10 19:11:56 +00:00
|
|
|
DukePlayer_t *const ps = p >= 0 ? g_player[p].ps : NULL;
|
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
#ifdef POLYMER
|
2014-10-25 03:36:34 +00:00
|
|
|
if (getrendermode() == REND_POLYMER && proj->flashcolor)
|
2013-02-07 21:01:12 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
int32_t x = ((sintable[(s->ang + 512) & 2047]) >> 7), y = ((sintable[(s->ang) & 2047]) >> 7);
|
|
|
|
|
|
|
|
s->x += x;
|
|
|
|
s->y += y;
|
|
|
|
G_AddGameLight(0, i, PHEIGHT, 8192, proj->flashcolor, PR_LIGHT_PRIO_MAX_GAME);
|
|
|
|
actor[i].lightcount = 2;
|
|
|
|
s->x -= x;
|
|
|
|
s->y -= y;
|
2013-02-07 21:01:12 +00:00
|
|
|
}
|
2013-08-06 23:53:34 +00:00
|
|
|
#endif // POLYMER
|
2013-02-07 21:01:12 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->offset == 0)
|
|
|
|
proj->offset = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
switch (proj->workslike & PROJECTILE_TYPE_MASK)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
case PROJECTILE_HITSCAN:
|
|
|
|
if (s->extra >= 0) s->shade = proj->shade;
|
2009-01-13 04:40:56 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (p >= 0)
|
|
|
|
P_PreFireHitscan(i, p, atwith, srcvect, &zvel, &sa,
|
|
|
|
proj->workslike & PROJECTILE_ACCURATE_AUTOAIM,
|
|
|
|
!(proj->workslike & PROJECTILE_ACCURATE));
|
|
|
|
else
|
|
|
|
A_PreFireHitscan(s, srcvect, &zvel, &sa,
|
|
|
|
!(proj->workslike & PROJECTILE_ACCURATE));
|
2009-04-13 06:01:50 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (Proj_DoHitscan(i, (proj->cstat >= 0) ? proj->cstat : 256 + 1,
|
|
|
|
srcvect, zvel, sa, &hit))
|
|
|
|
return -1;
|
2009-04-13 06:01:50 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->range > 0 && klabs(srcvect->x - hit.pos.x) + klabs(srcvect->y - hit.pos.y) > proj->range)
|
|
|
|
return -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->trail >= 0)
|
|
|
|
A_HitscanProjTrail(srcvect, &hit.pos, sa, atwith);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->workslike & PROJECTILE_WATERBUBBLES)
|
2009-04-14 07:15:08 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
if ((krand() & 15) == 0 && sector[hit.sect].lotag == ST_2_UNDERWATER)
|
|
|
|
A_DoWaterTracers(hit.pos.x, hit.pos.y, hit.pos.z,
|
|
|
|
srcvect->x, srcvect->y, srcvect->z, 8 - (ud.multimode >> 1));
|
2009-04-14 07:15:08 +00:00
|
|
|
}
|
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (p >= 0)
|
|
|
|
{
|
|
|
|
k = Proj_InsertShotspark(&hit, i, atwith, 10, sa, Proj_GetExtra(atwith));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (P_PostFireHitscan(p, k, &hit, i, atwith, zvel,
|
|
|
|
atwith, proj->decal, atwith, 1 + 2) < 0)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
k = A_PostFireHitscan(&hit, i, atwith, sa, Proj_GetExtra(atwith),
|
|
|
|
atwith, atwith);
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if ((krand() & 255) < 4 && proj->isound >= 0)
|
|
|
|
S_PlaySound3D(proj->isound, k, &hit.pos);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
return -1;
|
|
|
|
|
|
|
|
case PROJECTILE_RPG:
|
|
|
|
if (s->extra >= 0) s->shade = proj->shade;
|
|
|
|
|
|
|
|
vel = proj->vel;
|
|
|
|
|
|
|
|
j = -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (p >= 0)
|
|
|
|
{
|
2013-12-28 17:04:36 +00:00
|
|
|
// NOTE: j is a SPRITE_INDEX
|
|
|
|
j = GetAutoAimAngle(i, p, atwith, 8<<8, 0+2, srcvect, vel, &zvel, &sa);
|
2013-08-06 23:53:34 +00:00
|
|
|
|
|
|
|
if (j < 0)
|
2013-12-28 17:04:36 +00:00
|
|
|
zvel = (100-ps->horiz-ps->horizoff)*(proj->vel/8);
|
2013-08-06 23:53:34 +00:00
|
|
|
|
|
|
|
if (proj->sound >= 0)
|
|
|
|
A_PlaySound(proj->sound, i);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!(proj->workslike & PROJECTILE_NOAIM))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-28 17:04:36 +00:00
|
|
|
// NOTE: j is a player index
|
2013-08-06 23:53:34 +00:00
|
|
|
j = A_FindPlayer(s, NULL);
|
2013-12-28 17:04:36 +00:00
|
|
|
sa = getangle(g_player[j].ps->opos.x-srcvect->x, g_player[j].ps->opos.y-srcvect->y);
|
2013-01-01 15:24:39 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
l = safeldist(g_player[j].ps->i, s);
|
2014-10-25 03:29:21 +00:00
|
|
|
zvel = tabledivide32_noinline((g_player[j].ps->opos.z - srcvect->z)*vel, l);
|
2013-01-01 15:24:39 +00:00
|
|
|
|
2014-03-16 14:37:50 +00:00
|
|
|
if (A_CheckEnemySprite(s) && (AC_MOVFLAGS(s, &actor[i]) & face_player_smart))
|
2013-08-06 23:53:34 +00:00
|
|
|
sa = s->ang + (krand() & 31) - 16;
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (numplayers > 1 && g_netClient) return -1;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2013-12-28 17:04:36 +00:00
|
|
|
// l may be a SPRITE_INDEX, see above
|
|
|
|
l = (p >= 0 && j >= 0) ? j : -1;
|
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
zvel = A_GetShootZvel(zvel);
|
|
|
|
j = A_InsertSprite(sect,
|
2014-10-25 03:29:21 +00:00
|
|
|
srcvect->x + tabledivide32_noinline(sintable[(348 + sa + 512) & 2047], proj->offset),
|
|
|
|
srcvect->y + tabledivide32_noinline(sintable[(sa + 348) & 2047], proj->offset),
|
2013-08-06 23:53:34 +00:00
|
|
|
srcvect->z - (1 << 8), atwith, 0, 14, 14, sa, vel, zvel, i, 4);
|
2012-11-11 17:57:09 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
sprite[j].xrepeat = proj->xrepeat;
|
|
|
|
sprite[j].yrepeat = proj->yrepeat;
|
2012-11-11 17:57:09 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->extra_rand > 0)
|
|
|
|
sprite[j].extra += (krand()&proj->extra_rand);
|
2012-11-11 17:57:09 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (!(proj->workslike & PROJECTILE_BOUNCESOFFWALLS))
|
2013-12-28 17:04:36 +00:00
|
|
|
sprite[j].yvel = l; // NOT_BOUNCESOFFWALLS_YVEL
|
2013-08-06 23:53:34 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (proj->bounces >= 1) sprite[j].yvel = proj->bounces;
|
|
|
|
else sprite[j].yvel = g_numFreezeBounces;
|
|
|
|
sprite[j].zvel -= (2 << 4);
|
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->cstat >= 0) sprite[j].cstat = proj->cstat;
|
|
|
|
else sprite[j].cstat = 128;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->clipdist != 255) sprite[j].clipdist = proj->clipdist;
|
|
|
|
else sprite[j].clipdist = 40;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
{
|
|
|
|
int32_t picnum = sprite[j].picnum; // why?
|
|
|
|
Bmemcpy(&SpriteProjectile[j], &ProjectileData[picnum], sizeof(projectile_t));
|
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
return j;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
case PROJECTILE_KNEE:
|
|
|
|
if (p >= 0)
|
|
|
|
{
|
|
|
|
zvel = (100 - ps->horiz - ps->horizoff) << 5;
|
|
|
|
srcvect->z += (6 << 8);
|
|
|
|
sa += 15;
|
|
|
|
}
|
|
|
|
else if (!(proj->workslike & PROJECTILE_NOAIM))
|
|
|
|
{
|
|
|
|
int32_t x;
|
|
|
|
j = g_player[A_FindPlayer(s, &x)].ps->i;
|
2014-10-25 03:29:21 +00:00
|
|
|
zvel = tabledivide32_noinline((sprite[j].z - srcvect->z) << 8, x + 1);
|
2013-08-06 23:53:34 +00:00
|
|
|
sa = getangle(sprite[j].x - srcvect->x, sprite[j].y - srcvect->y);
|
|
|
|
}
|
2013-01-01 15:24:42 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
Proj_DoHitscan(i, 0, srcvect, zvel, sa, &hit);
|
2013-01-01 15:24:42 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (hit.sect < 0) return -1;
|
2013-01-01 15:24:42 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->range == 0)
|
|
|
|
proj->range = 1024;
|
2013-01-01 15:24:42 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->range > 0 && klabs(srcvect->x - hit.pos.x) + klabs(srcvect->y - hit.pos.y) > proj->range)
|
2009-01-13 12:23:18 +00:00
|
|
|
return -1;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
Proj_HandleKnee(&hit, i, p, atwith, sa,
|
|
|
|
proj, atwith,
|
|
|
|
proj->extra_rand,
|
|
|
|
proj->spawns, proj->sound);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
return -1;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
case PROJECTILE_BLOOD:
|
|
|
|
sa += 64 - (krand() & 127);
|
|
|
|
if (p < 0) sa += 1024;
|
|
|
|
zvel = 1024 - (krand() & 2047);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
Proj_DoHitscan(i, 0, srcvect, zvel, sa, &hit);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (proj->range == 0)
|
|
|
|
proj->range = 1024;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (Proj_CheckBlood(srcvect, &hit, proj->range,
|
2014-09-30 04:14:21 +00:00
|
|
|
mulscale3(proj->yrepeat, tilesiz[proj->decal].y) << 8))
|
2013-08-06 23:53:34 +00:00
|
|
|
{
|
|
|
|
const walltype *const hitwal = &wall[hit.wall];
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (FindDistance2D(hitwal->x - wall[hitwal->point2].x, hitwal->y - wall[hitwal->point2].y) >
|
2014-09-30 04:14:21 +00:00
|
|
|
(mulscale3(proj->xrepeat + 8, tilesiz[proj->decal].x)))
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
if (SectorContainsSE13(hitwal->nextsector))
|
|
|
|
return -1;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (hitwal->nextwall >= 0 && wall[hitwal->nextwall].hitag != 0)
|
2013-01-01 15:24:36 +00:00
|
|
|
return -1;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (hitwal->hitag == 0 && proj->decal >= 0)
|
|
|
|
{
|
|
|
|
k = A_Spawn(i, proj->decal);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2014-02-22 19:38:52 +00:00
|
|
|
if (!A_CheckSpriteFlags(k, SFLAG_DECAL))
|
|
|
|
actor[k].flags |= SFLAG_DECAL;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
sprite[k].xvel = -1;
|
|
|
|
sprite[k].ang = getangle(hitwal->x - wall[hitwal->point2].x,
|
|
|
|
hitwal->y - wall[hitwal->point2].y) + 512;
|
|
|
|
Bmemcpy(&sprite[k], &hit.pos, sizeof(vec3_t));
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
Proj_DoRandDecalSize(k, atwith);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
sprite[k].z += sprite[k].yrepeat << 8;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
// sprite[k].cstat = 16+(krand()&12);
|
|
|
|
sprite[k].cstat = 16;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (krand() & 1)
|
|
|
|
sprite[k].cstat |= 4;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (krand() & 1)
|
|
|
|
sprite[k].cstat |= 8;
|
|
|
|
|
|
|
|
sprite[k].shade = sector[sprite[k].sectnum].floorshade;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
sprite[k].x -= sintable[(sprite[k].ang + 2560) & 2047] >> 13;
|
|
|
|
sprite[k].y -= sintable[(sprite[k].ang + 2048) & 2047] >> 13;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
A_SetSprite(k, CLIPMASK0);
|
|
|
|
A_AddToDeleteQueue(k);
|
|
|
|
changespritestat(k, 5);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
}
|
2013-08-06 23:53:34 +00:00
|
|
|
}
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
return -1;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
default:
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2009-12-14 05:23:29 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
int32_t A_ShootWithZvel(int32_t i, int32_t atwith, int32_t override_zvel)
|
|
|
|
{
|
|
|
|
int16_t sa;
|
|
|
|
vec3_t srcvect;
|
|
|
|
spritetype *const s = &sprite[i];
|
2013-12-28 17:04:27 +00:00
|
|
|
const int32_t p = (s->picnum == APLAYER) ? P_GetP(s) : -1;
|
2013-08-06 23:53:34 +00:00
|
|
|
DukePlayer_t *const ps = p >= 0 ? g_player[p].ps : NULL;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
Bassert(atwith >= 0);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
if (override_zvel != SHOOT_HARDCODED_ZVEL)
|
|
|
|
{
|
|
|
|
g_overrideShootZvel = 1;
|
|
|
|
g_shootZvel = override_zvel;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g_overrideShootZvel = 0;
|
|
|
|
|
|
|
|
if (s->picnum == APLAYER)
|
|
|
|
{
|
|
|
|
Bmemcpy(&srcvect,ps,sizeof(vec3_t));
|
|
|
|
srcvect.z += ps->pyoff+(4<<8);
|
|
|
|
sa = ps->ang;
|
|
|
|
|
|
|
|
ps->crack_time = 777;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sa = s->ang;
|
|
|
|
Bmemcpy(&srcvect,s,sizeof(vec3_t));
|
2014-09-30 04:14:21 +00:00
|
|
|
srcvect.z -= (((s->yrepeat*tilesiz[s->picnum].y)<<1)-(4<<8));
|
2013-08-06 23:53:34 +00:00
|
|
|
|
|
|
|
if (s->picnum != ROTATEGUN)
|
|
|
|
{
|
|
|
|
srcvect.z -= (7<<8);
|
|
|
|
|
|
|
|
if (A_CheckEnemySprite(s) && PN != COMMANDER)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
srcvect.x += (sintable[(sa+1024+96)&2047]>>7);
|
|
|
|
srcvect.y += (sintable[(sa+512+96)&2047]>>7);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
2013-08-06 23:53:34 +00:00
|
|
|
}
|
2013-02-07 21:00:58 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
#ifdef POLYMER
|
|
|
|
switch (DYNAMICTILEMAP(atwith))
|
|
|
|
{
|
|
|
|
case FIRELASER__STATIC:
|
|
|
|
case SHOTGUN__STATIC:
|
|
|
|
case SHOTSPARK1__STATIC:
|
|
|
|
case CHAINGUN__STATIC:
|
|
|
|
case RPG__STATIC:
|
|
|
|
case MORTER__STATIC:
|
2012-11-11 17:57:09 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
int32_t x = ((sintable[(s->ang+512)&2047])>>7), y = ((sintable[(s->ang)&2047])>>7);
|
|
|
|
s->x += x;
|
|
|
|
s->y += y;
|
|
|
|
G_AddGameLight(0, i, PHEIGHT, 8192, 255+(95<<8), PR_LIGHT_PRIO_MAX_GAME);
|
|
|
|
actor[i].lightcount = 2;
|
|
|
|
s->x -= x;
|
|
|
|
s->y -= y;
|
2012-11-11 17:57:09 +00:00
|
|
|
}
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
break;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
2013-08-06 23:53:34 +00:00
|
|
|
#endif // POLYMER
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
2013-08-06 23:53:34 +00:00
|
|
|
|
2014-02-22 19:38:52 +00:00
|
|
|
if (A_CheckSpriteTileFlags(atwith, SFLAG_PROJECTILE))
|
2013-08-06 23:53:34 +00:00
|
|
|
return A_ShootCustom(i, atwith, sa, &srcvect);
|
|
|
|
else
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
int32_t j, k = -1, l;
|
|
|
|
int32_t vel, zvel = 0;
|
|
|
|
hitdata_t hit;
|
|
|
|
const int16_t sect = s->sectnum;
|
|
|
|
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(atwith))
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
|
|
|
case BLOODSPLAT1__STATIC:
|
|
|
|
case BLOODSPLAT2__STATIC:
|
|
|
|
case BLOODSPLAT3__STATIC:
|
|
|
|
case BLOODSPLAT4__STATIC:
|
2010-07-19 15:14:00 +00:00
|
|
|
sa += 64 - (krand()&127);
|
|
|
|
if (p < 0) sa += 1024;
|
2009-01-14 00:49:26 +00:00
|
|
|
zvel = 1024-(krand()&2047);
|
2013-04-15 18:50:21 +00:00
|
|
|
// fall-through
|
2009-01-14 00:49:26 +00:00
|
|
|
case KNEE__STATIC:
|
|
|
|
if (atwith == KNEE)
|
|
|
|
{
|
|
|
|
if (p >= 0)
|
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
zvel = (100-ps->horiz-ps->horizoff)<<5;
|
2009-01-14 00:49:26 +00:00
|
|
|
srcvect.z += (6<<8);
|
|
|
|
sa += 15;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-15 10:48:13 +00:00
|
|
|
int32_t x;
|
2009-01-14 00:49:26 +00:00
|
|
|
j = g_player[A_FindPlayer(s,&x)].ps->i;
|
2014-10-25 03:29:21 +00:00
|
|
|
zvel = tabledivide32_noinline((sprite[j].z-srcvect.z)<<8, x+1);
|
2009-01-14 00:49:26 +00:00
|
|
|
sa = getangle(sprite[j].x-srcvect.x,sprite[j].y-srcvect.y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-07 21:01:06 +00:00
|
|
|
Proj_DoHitscan(i, 0, &srcvect, zvel, sa, &hit);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2009-01-31 00:02:14 +00:00
|
|
|
if (atwith >= BLOODSPLAT1 && atwith <= BLOODSPLAT4)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2013-01-01 15:24:42 +00:00
|
|
|
if (Proj_CheckBlood(&srcvect, &hit, 1024, 16<<8))
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2013-01-01 15:24:42 +00:00
|
|
|
const walltype *const hitwal = &wall[hit.wall];
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-01-01 15:24:42 +00:00
|
|
|
if (SectorContainsSE13(hitwal->nextsector))
|
|
|
|
return -1;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-01-01 15:24:42 +00:00
|
|
|
if (hitwal->nextwall >= 0 && wall[hitwal->nextwall].hitag != 0)
|
|
|
|
return -1;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-01-01 15:24:42 +00:00
|
|
|
if (hitwal->hitag == 0)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2013-01-01 15:24:42 +00:00
|
|
|
k = A_Spawn(i,atwith);
|
|
|
|
sprite[k].xvel = -12;
|
|
|
|
sprite[k].ang = getangle(hitwal->x-wall[hitwal->point2].x,
|
|
|
|
hitwal->y-wall[hitwal->point2].y)+512;
|
|
|
|
Bmemcpy(&sprite[k], &hit.pos, sizeof(vec3_t));
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-01-01 15:24:42 +00:00
|
|
|
sprite[k].cstat |= (krand()&4);
|
|
|
|
A_SetSprite(k,CLIPMASK0);
|
|
|
|
setsprite(k, (vec3_t *)&sprite[k]);
|
|
|
|
if (PN == OOZFILTER || PN == NEWBEAST)
|
|
|
|
sprite[k].pal = 6;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-01 15:24:42 +00:00
|
|
|
return -1;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
2013-01-01 15:24:42 +00:00
|
|
|
|
|
|
|
if (hit.sect < 0) break;
|
|
|
|
|
|
|
|
if (klabs(srcvect.x-hit.pos.x)+klabs(srcvect.y-hit.pos.y) < 1024)
|
|
|
|
Proj_HandleKnee(&hit, i, p, atwith, sa,
|
|
|
|
NULL, KNEE, 7, SMALLSMOKE, KICK_HIT);
|
2009-01-14 00:49:26 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SHOTSPARK1__STATIC:
|
|
|
|
case SHOTGUN__STATIC:
|
|
|
|
case CHAINGUN__STATIC:
|
|
|
|
if (s->extra >= 0) s->shade = -96;
|
|
|
|
|
|
|
|
if (p >= 0)
|
2013-02-01 19:56:26 +00:00
|
|
|
P_PreFireHitscan(i, p, atwith, &srcvect, &zvel, &sa,
|
|
|
|
atwith == SHOTSPARK1__STATIC && !WW2GI && !NAM,
|
|
|
|
1);
|
2009-01-14 00:49:26 +00:00
|
|
|
else
|
2013-01-01 15:24:31 +00:00
|
|
|
A_PreFireHitscan(s, &srcvect, &zvel, &sa, 1);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-01-01 15:24:33 +00:00
|
|
|
if (Proj_DoHitscan(i, 256+1, &srcvect, zvel, sa, &hit))
|
|
|
|
return -1;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if ((krand()&15) == 0 && sector[hit.sect].lotag == ST_2_UNDERWATER)
|
2012-08-10 19:12:01 +00:00
|
|
|
A_DoWaterTracers(hit.pos.x,hit.pos.y,hit.pos.z,
|
2009-01-14 00:49:26 +00:00
|
|
|
srcvect.x,srcvect.y,srcvect.z,8-(ud.multimode>>1));
|
|
|
|
|
|
|
|
if (p >= 0)
|
|
|
|
{
|
2013-01-01 15:24:33 +00:00
|
|
|
k = Proj_InsertShotspark(&hit, i, atwith, 10, sa,
|
|
|
|
G_InitialActorStrength(atwith) + (krand()%6));
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-01-01 15:24:36 +00:00
|
|
|
if (P_PostFireHitscan(p, k, &hit, i, atwith, zvel,
|
|
|
|
-SMALLSMOKE, BULLETHOLE, SHOTSPARK1, 0) < 0)
|
|
|
|
return -1;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-01-01 15:24:36 +00:00
|
|
|
k = A_PostFireHitscan(&hit, i, atwith, sa, G_InitialActorStrength(atwith),
|
|
|
|
-SMALLSMOKE, SHOTSPARK1);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((krand()&255) < 4)
|
2013-01-01 15:24:36 +00:00
|
|
|
S_PlaySound3D(PISTOL_RICOCHET, k, &hit.pos);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
2013-08-06 23:53:00 +00:00
|
|
|
case GROWSPARK__STATIC:
|
|
|
|
if (p >= 0)
|
|
|
|
P_PreFireHitscan(i, p, atwith, &srcvect, &zvel, &sa, 1, 1);
|
|
|
|
else
|
|
|
|
A_PreFireHitscan(s, &srcvect, &zvel, &sa, 1);
|
|
|
|
|
|
|
|
if (Proj_DoHitscan(i, 256 + 1, &srcvect, zvel, sa, &hit))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
j = A_InsertSprite(hit.sect,hit.pos.x,hit.pos.y,hit.pos.z,GROWSPARK,-16,28,28,sa,0,0,i,1);
|
|
|
|
|
|
|
|
sprite[j].pal = 2;
|
|
|
|
sprite[j].cstat |= 130;
|
|
|
|
sprite[j].xrepeat = sprite[j].yrepeat = 1;
|
|
|
|
|
|
|
|
if (hit.wall == -1 && hit.sprite == -1 && hit.sect >= 0)
|
|
|
|
{
|
2013-12-20 18:31:26 +00:00
|
|
|
Proj_MaybeDamageCF2(zvel, hit.sect);
|
2013-08-06 23:53:00 +00:00
|
|
|
}
|
|
|
|
else if (hit.sprite >= 0) A_DamageObject(hit.sprite,j);
|
|
|
|
else if (hit.wall >= 0 && wall[hit.wall].picnum != ACCESSSWITCH && wall[hit.wall].picnum != ACCESSSWITCH2)
|
|
|
|
A_DamageWall(j,hit.wall,&hit.pos,atwith);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
case FIRELASER__STATIC:
|
|
|
|
case SPIT__STATIC:
|
|
|
|
case COOLEXPLOSION1__STATIC:
|
2013-02-07 21:01:06 +00:00
|
|
|
{
|
|
|
|
int32_t tsiz;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
if (s->extra >= 0) s->shade = -96;
|
|
|
|
|
2013-08-06 23:53:34 +00:00
|
|
|
switch (atwith)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2013-08-06 23:53:34 +00:00
|
|
|
case SPIT__STATIC:
|
|
|
|
vel = 292;
|
|
|
|
break;
|
|
|
|
case COOLEXPLOSION1__STATIC:
|
|
|
|
if (s->picnum == BOSS2) vel = 644;
|
|
|
|
else vel = 348;
|
|
|
|
srcvect.z -= (4<<7);
|
|
|
|
break;
|
|
|
|
case FIRELASER__STATIC:
|
|
|
|
default:
|
|
|
|
vel = 840;
|
|
|
|
srcvect.z -= (4<<7);
|
|
|
|
break;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (p >= 0)
|
|
|
|
{
|
2012-09-02 14:03:10 +00:00
|
|
|
j = GetAutoAimAngle(i, p, atwith, -(12<<8), 0, &srcvect, vel, &zvel, &sa);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2012-09-02 14:03:10 +00:00
|
|
|
if (j < 0)
|
2012-08-10 19:11:56 +00:00
|
|
|
zvel = (100-ps->horiz-ps->horizoff)*98;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-15 10:48:13 +00:00
|
|
|
j = A_FindPlayer(s, NULL);
|
2010-05-02 23:27:30 +00:00
|
|
|
// sa = getangle(g_player[j].ps->opos.x-sx,g_player[j].ps->opos.y-sy);
|
2009-01-14 00:49:26 +00:00
|
|
|
sa += 16-(krand()&31);
|
2013-02-07 21:00:58 +00:00
|
|
|
hit.pos.x = safeldist(g_player[j].ps->i, s);
|
2014-10-25 03:29:21 +00:00
|
|
|
zvel = tabledivide32_noinline((g_player[j].ps->opos.z - srcvect.z + (3<<8))*vel, hit.pos.x);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
2013-02-07 21:01:12 +00:00
|
|
|
|
2013-06-30 20:38:50 +00:00
|
|
|
zvel = A_GetShootZvel(zvel);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
if (atwith == SPIT)
|
|
|
|
{
|
2013-02-07 21:01:06 +00:00
|
|
|
tsiz = 18;
|
2010-07-19 15:14:00 +00:00
|
|
|
srcvect.z -= (10<<8);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
2010-07-19 15:14:00 +00:00
|
|
|
else if (p >= 0)
|
2013-02-07 21:01:06 +00:00
|
|
|
tsiz = 7;
|
2009-01-14 00:49:26 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (atwith == FIRELASER)
|
|
|
|
{
|
|
|
|
if (p >= 0)
|
2013-02-07 21:01:06 +00:00
|
|
|
tsiz = 34;
|
2009-01-14 00:49:26 +00:00
|
|
|
else
|
2013-02-07 21:01:06 +00:00
|
|
|
tsiz = 18;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
else
|
2013-02-07 21:01:06 +00:00
|
|
|
tsiz = 18;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
|
2010-07-19 15:14:00 +00:00
|
|
|
j = A_InsertSprite(sect,srcvect.x,srcvect.y,srcvect.z,
|
2013-02-07 21:01:06 +00:00
|
|
|
atwith,-127,tsiz,tsiz,sa,vel,zvel,i,4);
|
2010-07-19 15:14:00 +00:00
|
|
|
sprite[j].extra += (krand()&7);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2010-07-19 15:14:00 +00:00
|
|
|
if (atwith == COOLEXPLOSION1)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2010-07-19 15:14:00 +00:00
|
|
|
sprite[j].shade = 0;
|
|
|
|
if (PN == BOSS2)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2010-07-19 15:14:00 +00:00
|
|
|
l = sprite[j].xvel;
|
2013-03-04 01:23:55 +00:00
|
|
|
sprite[j].xvel = MinibossScale(1024);
|
2010-07-19 15:14:00 +00:00
|
|
|
A_SetSprite(j,CLIPMASK0);
|
|
|
|
sprite[j].xvel = l;
|
|
|
|
sprite[j].ang += 128-(krand()&255);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
2010-07-19 15:14:00 +00:00
|
|
|
}
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2010-07-19 15:14:00 +00:00
|
|
|
sprite[j].cstat = 128;
|
|
|
|
sprite[j].clipdist = 4;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2010-07-19 15:14:00 +00:00
|
|
|
sa = s->ang+32-(krand()&63);
|
2013-04-15 10:48:13 +00:00
|
|
|
zvel += 512-(krand()&1023);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
return j;
|
2013-02-07 21:01:06 +00:00
|
|
|
}
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
case FREEZEBLAST__STATIC:
|
|
|
|
srcvect.z += (3<<8);
|
|
|
|
case RPG__STATIC:
|
2013-04-15 10:48:13 +00:00
|
|
|
// XXX: "CODEDUP"
|
2009-01-14 00:49:26 +00:00
|
|
|
if (s->extra >= 0) s->shade = -96;
|
|
|
|
|
|
|
|
vel = 644;
|
|
|
|
|
|
|
|
j = -1;
|
|
|
|
|
|
|
|
if (p >= 0)
|
|
|
|
{
|
2013-12-28 17:04:36 +00:00
|
|
|
// NOTE: j is a SPRITE_INDEX
|
2012-09-02 14:03:10 +00:00
|
|
|
j = GetAutoAimAngle(i, p, atwith, 8<<8, 0+2, &srcvect, vel, &zvel, &sa);
|
|
|
|
|
|
|
|
if (j < 0)
|
|
|
|
zvel = (100-ps->horiz-ps->horizoff)*81;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
if (atwith == RPG)
|
|
|
|
A_PlaySound(RPG_SHOOT,i);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-12-28 17:04:36 +00:00
|
|
|
// NOTE: j is a player index
|
2013-04-15 10:48:13 +00:00
|
|
|
j = A_FindPlayer(s, NULL);
|
2013-12-28 17:04:36 +00:00
|
|
|
sa = getangle(g_player[j].ps->opos.x-srcvect.x, g_player[j].ps->opos.y-srcvect.y);
|
2009-01-14 00:49:26 +00:00
|
|
|
if (PN == BOSS3)
|
2013-03-04 01:23:55 +00:00
|
|
|
srcvect.z -= MinibossScale(32<<8);
|
2009-01-14 00:49:26 +00:00
|
|
|
else if (PN == BOSS2)
|
|
|
|
{
|
|
|
|
vel += 128;
|
2013-03-04 01:23:55 +00:00
|
|
|
srcvect.z += MinibossScale(24<<8);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
|
2013-02-07 21:00:58 +00:00
|
|
|
l = safeldist(g_player[j].ps->i, s);
|
2014-10-25 03:29:21 +00:00
|
|
|
zvel = tabledivide32_noinline((g_player[j].ps->opos.z - srcvect.z)*vel, l);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2014-03-16 14:37:50 +00:00
|
|
|
if (A_CheckEnemySprite(s) && (AC_MOVFLAGS(s, &actor[i]) & face_player_smart))
|
2009-01-14 00:49:26 +00:00
|
|
|
sa = s->ang+(krand()&31)-16;
|
|
|
|
}
|
|
|
|
|
2013-12-28 17:04:36 +00:00
|
|
|
if (numplayers > 1 && g_netClient)
|
|
|
|
return -1;
|
2009-12-14 05:23:29 +00:00
|
|
|
|
2013-12-28 17:04:36 +00:00
|
|
|
// l may be a SPRITE_INDEX, see above
|
|
|
|
l = (p >= 0 && j >= 0) ? j : -1;
|
2009-12-14 05:23:29 +00:00
|
|
|
|
2013-06-30 20:38:50 +00:00
|
|
|
zvel = A_GetShootZvel(zvel);
|
2009-01-14 00:49:26 +00:00
|
|
|
j = A_InsertSprite(sect,
|
|
|
|
srcvect.x+(sintable[(348+sa+512)&2047]/448),
|
|
|
|
srcvect.y+(sintable[(sa+348)&2047]/448),
|
|
|
|
srcvect.z-(1<<8),atwith,0,14,14,sa,vel,zvel,i,4);
|
|
|
|
|
|
|
|
sprite[j].extra += (krand()&7);
|
|
|
|
if (atwith != FREEZEBLAST)
|
2013-12-28 17:04:36 +00:00
|
|
|
sprite[j].yvel = l; // RPG_YVEL
|
2009-01-14 00:49:26 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite[j].yvel = g_numFreezeBounces;
|
|
|
|
sprite[j].xrepeat >>= 1;
|
|
|
|
sprite[j].yrepeat >>= 1;
|
|
|
|
sprite[j].zvel -= (2<<4);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p == -1)
|
|
|
|
{
|
|
|
|
if (PN == BOSS3)
|
|
|
|
{
|
|
|
|
if (krand()&1)
|
|
|
|
{
|
2013-03-04 01:23:55 +00:00
|
|
|
sprite[j].x -= MinibossScale(sintable[sa&2047]>>6);
|
|
|
|
sprite[j].y -= MinibossScale(sintable[(sa+1024+512)&2047]>>6);
|
|
|
|
sprite[j].ang -= MinibossScale(8);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-04 01:23:55 +00:00
|
|
|
sprite[j].x += MinibossScale(sintable[sa&2047]>>6);
|
|
|
|
sprite[j].y += MinibossScale(sintable[(sa+1024+512)&2047]>>6);
|
|
|
|
sprite[j].ang += MinibossScale(4);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
2013-03-04 01:23:55 +00:00
|
|
|
sprite[j].xrepeat = MinibossScale(42);
|
|
|
|
sprite[j].yrepeat = MinibossScale(42);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
else if (PN == BOSS2)
|
|
|
|
{
|
2013-03-04 01:23:55 +00:00
|
|
|
sprite[j].x -= MinibossScale(sintable[sa&2047]/56);
|
|
|
|
sprite[j].y -= MinibossScale(sintable[(sa+1024+512)&2047]/56);
|
|
|
|
sprite[j].ang -= MinibossScale(8)+(krand()&255)-128;
|
2009-01-14 00:49:26 +00:00
|
|
|
sprite[j].xrepeat = 24;
|
|
|
|
sprite[j].yrepeat = 24;
|
|
|
|
}
|
|
|
|
else if (atwith != FREEZEBLAST)
|
|
|
|
{
|
|
|
|
sprite[j].xrepeat = 30;
|
|
|
|
sprite[j].yrepeat = 30;
|
|
|
|
sprite[j].extra >>= 2;
|
|
|
|
}
|
|
|
|
}
|
2014-10-25 03:27:01 +00:00
|
|
|
else if (PWEAPON(p, g_player[p].ps->curr_weapon, WorksLike) == DEVISTATOR_WEAPON)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
|
|
|
sprite[j].extra >>= 2;
|
|
|
|
sprite[j].ang += 16-(krand()&31);
|
|
|
|
sprite[j].zvel += 256-(krand()&511);
|
|
|
|
|
|
|
|
if (g_player[p].ps->hbomb_hold_delay)
|
|
|
|
{
|
|
|
|
sprite[j].x -= sintable[sa&2047]/644;
|
|
|
|
sprite[j].y -= sintable[(sa+1024+512)&2047]/644;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite[j].x += sintable[sa&2047]>>8;
|
|
|
|
sprite[j].y += sintable[(sa+1024+512)&2047]>>8;
|
|
|
|
}
|
|
|
|
sprite[j].xrepeat >>= 1;
|
|
|
|
sprite[j].yrepeat >>= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite[j].cstat = 128;
|
|
|
|
if (atwith == RPG)
|
|
|
|
sprite[j].clipdist = 4;
|
|
|
|
else
|
|
|
|
sprite[j].clipdist = 40;
|
|
|
|
|
|
|
|
return j;
|
|
|
|
|
|
|
|
case HANDHOLDINGLASER__STATIC:
|
2012-08-28 21:42:49 +00:00
|
|
|
{
|
|
|
|
const int32_t zoff = (p>=0) ? g_player[p].ps->pyoff : 0;
|
2009-01-14 00:49:26 +00:00
|
|
|
if (p >= 0)
|
2012-08-10 19:11:56 +00:00
|
|
|
zvel = (100-ps->horiz-ps->horizoff)*32;
|
2009-01-14 00:49:26 +00:00
|
|
|
else zvel = 0;
|
|
|
|
|
2012-08-28 21:42:49 +00:00
|
|
|
srcvect.z -= zoff;
|
2013-02-07 21:01:06 +00:00
|
|
|
Proj_DoHitscan(i, 0, &srcvect, zvel, sa, &hit);
|
2012-08-28 21:42:49 +00:00
|
|
|
srcvect.z += zoff;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
j = 0;
|
2012-08-10 19:12:01 +00:00
|
|
|
if (hit.sprite >= 0) break;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2012-08-10 19:12:01 +00:00
|
|
|
if (hit.wall >= 0 && hit.sect >= 0)
|
|
|
|
if (((hit.pos.x-srcvect.x)*(hit.pos.x-srcvect.x)+(hit.pos.y-srcvect.y)*(hit.pos.y-srcvect.y)) < (290*290))
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2012-10-14 20:41:21 +00:00
|
|
|
// ST_2_UNDERWATER
|
2012-08-10 19:12:01 +00:00
|
|
|
if (wall[hit.wall].nextsector >= 0)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2012-08-10 19:12:01 +00:00
|
|
|
if (sector[wall[hit.wall].nextsector].lotag <= 2 && sector[hit.sect].lotag <= 2)
|
2009-01-14 00:49:26 +00:00
|
|
|
j = 1;
|
|
|
|
}
|
2012-08-10 19:12:01 +00:00
|
|
|
else if (sector[hit.sect].lotag <= 2)
|
2009-01-14 00:49:26 +00:00
|
|
|
j = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (j == 1)
|
|
|
|
{
|
2012-08-28 21:42:49 +00:00
|
|
|
int32_t lTripBombControl = (p < 0) ? 0 :
|
2013-01-20 21:16:58 +00:00
|
|
|
#ifdef LUNATIC
|
|
|
|
g_player[p].ps->tripbombControl;
|
|
|
|
#else
|
2012-08-28 21:42:49 +00:00
|
|
|
Gv_GetVarByLabel("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE, g_player[p].ps->i, p);
|
2013-01-20 21:16:58 +00:00
|
|
|
#endif
|
2012-08-10 19:12:01 +00:00
|
|
|
k = A_InsertSprite(hit.sect,hit.pos.x,hit.pos.y,hit.pos.z,TRIPBOMB,-16,4,5,sa,0,0,i,6);
|
2009-01-14 00:49:26 +00:00
|
|
|
if (lTripBombControl & TRIPBOMB_TIMER)
|
|
|
|
{
|
2013-01-20 21:16:58 +00:00
|
|
|
#ifdef LUNATIC
|
|
|
|
int32_t lLifetime = g_player[p].ps->tripbombLifetime;
|
|
|
|
int32_t lLifetimeVar = g_player[p].ps->tripbombLifetimeVar;
|
|
|
|
#else
|
2009-01-14 00:49:26 +00:00
|
|
|
int32_t lLifetime=Gv_GetVarByLabel("STICKYBOMB_LIFETIME", NAM_GRENADE_LIFETIME, g_player[p].ps->i, p);
|
|
|
|
int32_t lLifetimeVar=Gv_GetVarByLabel("STICKYBOMB_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, g_player[p].ps->i, p);
|
2013-01-20 21:16:58 +00:00
|
|
|
#endif
|
2009-01-14 00:49:26 +00:00
|
|
|
// set timer. blows up when at zero....
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[k].t_data[7]=lLifetime
|
2010-08-02 08:13:51 +00:00
|
|
|
+ mulscale(krand(),lLifetimeVar, 14)
|
|
|
|
- lLifetimeVar;
|
2014-01-12 14:54:34 +00:00
|
|
|
// TIMER_CONTROL
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[k].t_data[6]=1;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
sprite[k].hitag = k;
|
2012-08-28 21:42:49 +00:00
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
A_PlaySound(LASERTRIP_ONWALL,k);
|
|
|
|
sprite[k].xvel = -20;
|
|
|
|
A_SetSprite(k,CLIPMASK0);
|
|
|
|
sprite[k].cstat = 16;
|
|
|
|
|
2012-08-28 21:42:49 +00:00
|
|
|
{
|
|
|
|
int32_t p2 = wall[hit.wall].point2;
|
|
|
|
int32_t a = getangle(wall[hit.wall].x-wall[p2].x, wall[hit.wall].y-wall[p2].y)-512;
|
|
|
|
actor[k].t_data[5] = sprite[k].ang = a;
|
|
|
|
}
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
return j?k:-1;
|
2012-08-28 21:42:49 +00:00
|
|
|
}
|
2013-04-15 10:48:13 +00:00
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
case BOUNCEMINE__STATIC:
|
|
|
|
case MORTER__STATIC:
|
2013-04-15 10:48:13 +00:00
|
|
|
{
|
|
|
|
int32_t x;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
if (s->extra >= 0) s->shade = -96;
|
|
|
|
|
2013-04-15 10:48:13 +00:00
|
|
|
j = g_player[A_FindPlayer(s, NULL)].ps->i;
|
2009-01-14 00:49:26 +00:00
|
|
|
x = ldist(&sprite[j],s);
|
|
|
|
|
|
|
|
zvel = -x>>1;
|
|
|
|
|
|
|
|
if (zvel < -4096)
|
|
|
|
zvel = -2048;
|
|
|
|
vel = x>>4;
|
2013-02-07 21:01:12 +00:00
|
|
|
|
2013-06-30 20:38:50 +00:00
|
|
|
zvel = A_GetShootZvel(zvel);
|
2009-01-14 00:49:26 +00:00
|
|
|
A_InsertSprite(sect,
|
|
|
|
srcvect.x+(sintable[(512+sa+512)&2047]>>8),
|
|
|
|
srcvect.y+(sintable[(sa+512)&2047]>>8),
|
|
|
|
srcvect.z+(6<<8),atwith,-64,32,32,sa,vel,zvel,i,1);
|
|
|
|
break;
|
2013-04-15 10:48:13 +00:00
|
|
|
}
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
case SHRINKER__STATIC:
|
|
|
|
if (s->extra >= 0) s->shade = -96;
|
|
|
|
if (p >= 0)
|
|
|
|
{
|
2012-09-02 14:03:10 +00:00
|
|
|
j = GetAutoAimAngle(i, p, atwith, 4<<8, 0, &srcvect, 768, &zvel, &sa);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2012-09-02 14:03:10 +00:00
|
|
|
if (j < 0)
|
|
|
|
zvel = (100-ps->horiz-ps->horizoff)*98;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
2012-10-14 20:41:21 +00:00
|
|
|
else if (s->statnum != STAT_EFFECTOR)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2013-04-15 10:48:13 +00:00
|
|
|
j = A_FindPlayer(s, NULL);
|
2013-02-07 21:00:58 +00:00
|
|
|
l = safeldist(g_player[j].ps->i, s);
|
2014-10-25 03:29:21 +00:00
|
|
|
zvel = tabledivide32_noinline((g_player[j].ps->opos.z-srcvect.z)*512, l);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
else zvel = 0;
|
2013-02-07 21:01:12 +00:00
|
|
|
|
2013-06-30 20:38:50 +00:00
|
|
|
zvel = A_GetShootZvel(zvel);
|
2009-01-14 00:49:26 +00:00
|
|
|
j = A_InsertSprite(sect,
|
|
|
|
srcvect.x+(sintable[(512+sa+512)&2047]>>12),
|
|
|
|
srcvect.y+(sintable[(sa+512)&2047]>>12),
|
|
|
|
srcvect.z+(2<<8),SHRINKSPARK,-16,28,28,sa,768,zvel,i,4);
|
|
|
|
|
|
|
|
sprite[j].cstat = 128;
|
|
|
|
sprite[j].clipdist = 32;
|
|
|
|
|
|
|
|
return j;
|
|
|
|
}
|
|
|
|
}
|
2013-02-07 21:01:12 +00:00
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2012-08-19 12:47:55 +00:00
|
|
|
|
|
|
|
//////////////////// HUD WEAPON / MISC. DISPLAY CODE ////////////////////
|
|
|
|
|
2010-03-12 05:50:30 +00:00
|
|
|
static void P_DisplaySpit(int32_t snum)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2012-08-10 19:11:56 +00:00
|
|
|
DukePlayer_t *const ps = g_player[snum].ps;
|
2014-11-07 22:07:12 +00:00
|
|
|
const int32_t loogcnt = ps->loogcnt;
|
|
|
|
const int32_t y = loogcnt<<2;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2014-11-07 22:07:12 +00:00
|
|
|
if (loogcnt == 0)
|
2012-05-05 22:23:44 +00:00
|
|
|
return;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2014-11-07 22:07:12 +00:00
|
|
|
for (int32_t i=0; i < ps->numloogs; i++)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2014-11-07 22:07:12 +00:00
|
|
|
int32_t a = klabs(sintable[((loogcnt+i)<<5)&2047])>>5;
|
|
|
|
int32_t z = 4096 + ((loogcnt+i)<<9);
|
|
|
|
int32_t x = (-g_player[snum].sync->avel>>1) + (sintable[((loogcnt+i)<<6)&2047]>>10);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2012-02-02 17:35:05 +00:00
|
|
|
rotatesprite_fs(
|
2014-11-07 22:07:12 +00:00
|
|
|
(ps->loogiex[i]+x)<<16, (200+ps->loogiey[i]-y)<<16,
|
|
|
|
z-(i<<8), 256-a,
|
2012-02-02 17:35:05 +00:00
|
|
|
LOOGIE,0,0,2);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-01 15:24:14 +00:00
|
|
|
static int32_t P_GetHudPal(const DukePlayer_t *p)
|
2012-03-22 22:47:47 +00:00
|
|
|
{
|
|
|
|
if (sprite[p->i].pal == 1)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (p->cursectnum >= 0)
|
|
|
|
{
|
|
|
|
int32_t dapal = sector[p->cursectnum].floorpal;
|
|
|
|
if (!g_noFloorPal[dapal])
|
|
|
|
return dapal;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-03-12 05:50:30 +00:00
|
|
|
static int32_t P_DisplayFist(int32_t gs,int32_t snum)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
|
|
|
int32_t looking_arc,fisti,fistpal;
|
|
|
|
int32_t fistzoom, fistz;
|
|
|
|
|
2012-08-19 13:00:19 +00:00
|
|
|
int32_t wx[2] = { windowx1, windowx2 };
|
|
|
|
|
2012-08-19 12:47:55 +00:00
|
|
|
const DukePlayer_t *const ps = g_player[snum].ps;
|
|
|
|
|
|
|
|
fisti = ps->fist_incs;
|
2009-01-14 00:49:26 +00:00
|
|
|
if (fisti > 32) fisti = 32;
|
|
|
|
if (fisti <= 0) return 0;
|
|
|
|
|
2012-08-19 12:47:55 +00:00
|
|
|
looking_arc = klabs(ps->look_ang)/9;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2012-05-05 22:23:44 +00:00
|
|
|
fistzoom = 65536 - (sintable[(512+(fisti<<6))&2047]<<2);
|
|
|
|
fistzoom = clamp(fistzoom, 40920, 90612);
|
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
fistz = 194 + (sintable[((6+fisti)<<7)&2047]>>9);
|
|
|
|
|
2013-01-01 15:24:14 +00:00
|
|
|
fistpal = P_GetHudPal(ps);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2014-01-12 14:04:51 +00:00
|
|
|
#ifdef SPLITSCREEN_MOD_HACKS
|
2012-08-20 21:29:54 +00:00
|
|
|
// XXX: this is outdated, doesn't handle above/below split.
|
2012-08-22 22:51:38 +00:00
|
|
|
if (g_fakeMultiMode==2)
|
2012-08-19 13:00:19 +00:00
|
|
|
wx[(g_snum==0)] = (wx[0]+wx[1])/2+1;
|
2014-01-12 14:04:51 +00:00
|
|
|
#endif
|
2012-08-19 13:00:19 +00:00
|
|
|
|
|
|
|
rotatesprite(
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
(-fisti+222+(g_player[snum].sync->avel>>5))<<16,
|
2009-01-14 00:49:26 +00:00
|
|
|
(looking_arc+fistz)<<16,
|
2012-08-19 13:00:19 +00:00
|
|
|
fistzoom,0,FIST,gs,fistpal,2,
|
|
|
|
wx[0],windowy1,wx[1],windowy2);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-08-19 12:47:55 +00:00
|
|
|
#define DRAWEAP_CENTER 262144
|
2013-08-06 23:53:34 +00:00
|
|
|
#define weapsc(sc) scale(sc, ud.weaponscale, 100)
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-04-21 19:55:11 +00:00
|
|
|
static int32_t g_dts_yadd;
|
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
static void G_DrawTileScaled(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p)
|
|
|
|
{
|
2012-08-19 13:00:08 +00:00
|
|
|
int32_t ang = 0;
|
2009-01-14 00:49:26 +00:00
|
|
|
int32_t xoff = 192;
|
|
|
|
|
2012-08-19 13:00:08 +00:00
|
|
|
int32_t wx[2] = { windowx1, windowx2 };
|
2012-08-20 21:28:48 +00:00
|
|
|
int32_t wy[2] = { windowy1, windowy2 };
|
|
|
|
int32_t yofs = 0;
|
2012-08-16 21:48:33 +00:00
|
|
|
|
2013-01-19 18:28:48 +00:00
|
|
|
switch (hudweap.cur)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
|
|
|
case DEVISTATOR_WEAPON:
|
|
|
|
case TRIPBOMB_WEAPON:
|
|
|
|
xoff = 160;
|
|
|
|
break;
|
|
|
|
default:
|
2012-08-19 12:47:55 +00:00
|
|
|
if (orientation & DRAWEAP_CENTER)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
|
|
|
xoff = 160;
|
2012-08-19 12:47:55 +00:00
|
|
|
orientation &= ~DRAWEAP_CENTER;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-01-01 15:24:14 +00:00
|
|
|
// bit 4 means "flip x" for G_DrawTileScaled
|
2009-01-14 00:49:26 +00:00
|
|
|
if (orientation&4)
|
2012-08-19 13:00:08 +00:00
|
|
|
ang = 1024;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2014-01-12 14:04:51 +00:00
|
|
|
#ifdef SPLITSCREEN_MOD_HACKS
|
2012-08-22 22:51:38 +00:00
|
|
|
if (g_fakeMultiMode==2)
|
2012-08-16 21:48:33 +00:00
|
|
|
{
|
2012-08-20 21:28:48 +00:00
|
|
|
const int32_t sidebyside = (ud.screen_size!=0);
|
|
|
|
|
2012-08-16 21:48:33 +00:00
|
|
|
// splitscreen HACK
|
2012-08-20 21:28:48 +00:00
|
|
|
orientation &= ~(1024|512|256);
|
|
|
|
if (sidebyside)
|
|
|
|
{
|
|
|
|
orientation &= ~8;
|
|
|
|
wx[(g_snum==0)] = (wx[0]+wx[1])/2 + 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
orientation |= 8;
|
|
|
|
if (g_snum==0)
|
|
|
|
yofs = -(100<<16);
|
|
|
|
wy[(g_snum==0)] = (wy[0]+wy[1])/2 + 2;
|
|
|
|
}
|
2012-08-16 21:48:33 +00:00
|
|
|
}
|
2014-01-12 14:04:51 +00:00
|
|
|
#endif
|
2012-08-16 21:48:33 +00:00
|
|
|
|
2011-03-04 08:50:58 +00:00
|
|
|
#ifdef USE_OPENGL
|
2012-12-30 20:34:34 +00:00
|
|
|
if (getrendermode() >= REND_POLYMOST && usemodels && md_tilehasmodel(tilenum,p) >= 0)
|
2009-01-14 00:49:26 +00:00
|
|
|
y += (224-weapsc(224));
|
|
|
|
#endif
|
2012-08-19 13:00:08 +00:00
|
|
|
rotatesprite(weapsc(x<<16) + ((xoff-weapsc(xoff))<<16),
|
2013-04-21 19:55:11 +00:00
|
|
|
weapsc((y<<16) + g_dts_yadd) + ((200-weapsc(200))<<16) + yofs,
|
2012-08-19 13:00:08 +00:00
|
|
|
weapsc(65536L),ang,tilenum,shade,p,(2|orientation),
|
2012-08-20 21:28:48 +00:00
|
|
|
wx[0],wy[0], wx[1],wy[1]);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
static void G_DrawWeaponTile(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p,
|
|
|
|
uint8_t slot)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
static int32_t shadef[2] = { 0, 0 }, palf[2] = { 0, 0 };
|
2011-07-28 21:09:24 +00:00
|
|
|
|
|
|
|
// sanity checking the slot value
|
|
|
|
if (slot > 1)
|
|
|
|
slot = 1;
|
2010-06-07 09:03:16 +00:00
|
|
|
|
|
|
|
// basic fading between player weapon shades
|
2011-07-28 21:09:24 +00:00
|
|
|
if (shadef[slot] != shade && (!p || palf[slot] == p))
|
2010-06-07 09:03:16 +00:00
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
shadef[slot] += (shade - shadef[slot]) >> 2;
|
2010-06-07 09:03:16 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (!((shade - shadef[slot]) >> 2))
|
2014-03-23 14:29:09 +00:00
|
|
|
shadef[slot] = logapproach(shadef[slot], shade);
|
2010-06-07 09:03:16 +00:00
|
|
|
}
|
|
|
|
else
|
2011-07-28 21:09:24 +00:00
|
|
|
shadef[slot] = shade;
|
2010-06-07 09:03:16 +00:00
|
|
|
|
2011-07-28 21:09:24 +00:00
|
|
|
palf[slot] = p;
|
2010-06-07 09:03:16 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
switch (ud.drawweapon)
|
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
case 1:
|
2013-04-21 19:55:11 +00:00
|
|
|
#ifdef USE_OPENGL
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (getrendermode() >= REND_POLYMOST)
|
|
|
|
if (tilenum >= CHAINGUN + 1 && tilenum <= CHAINGUN + 4)
|
|
|
|
if (!usemodels || md_tilehasmodel(tilenum, p) < 0)
|
|
|
|
{
|
|
|
|
// HACK: Draw the upper part of the chaingun two screen
|
|
|
|
// pixels (not texels; multiplied by weapon scale) lower
|
|
|
|
// first, preventing ugly horizontal seam.
|
|
|
|
g_dts_yadd = tabledivide32_noinline(65536 * 2 * 200, ydim);
|
|
|
|
G_DrawTileScaled(x, y, tilenum, shadef[slot], orientation, p);
|
|
|
|
g_dts_yadd = 0;
|
|
|
|
}
|
2013-04-21 19:55:11 +00:00
|
|
|
#endif
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
G_DrawTileScaled(x, y, tilenum, shadef[slot], orientation, p);
|
|
|
|
return;
|
2013-04-21 19:55:11 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
const DukePlayer_t *const ps = g_player[screenpeek].ps;
|
|
|
|
const int32_t sc = scale(65536, ud.statusbarscale, 100);
|
2012-08-20 21:29:54 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if ((unsigned)hudweap.cur < MAX_WEAPONS && hudweap.cur != KNEE_WEAPON)
|
|
|
|
rotatesprite_win(160 << 16, (180 + (ps->weapon_pos * ps->weapon_pos)) << 16, sc, 0,
|
|
|
|
hudweap.cur == GROW_WEAPON ? GROWSPRITEICON : WeaponPickupSprites[hudweap.cur], 0,
|
|
|
|
0, 2);
|
|
|
|
return;
|
|
|
|
}
|
2012-08-20 21:29:54 +00:00
|
|
|
}
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
static inline void G_DrawWeaponTileWithID(int32_t id, int32_t x, int32_t y, int32_t tilenum, int32_t shade,
|
|
|
|
int32_t orientation, int32_t p, uint8_t slot)
|
|
|
|
{
|
|
|
|
int oldid = guniqhudid;
|
|
|
|
|
|
|
|
guniqhudid = id;
|
|
|
|
G_DrawWeaponTile(x, y, tilenum, shade, orientation, p, slot);
|
|
|
|
guniqhudid = oldid;
|
|
|
|
}
|
|
|
|
|
2010-03-12 05:50:30 +00:00
|
|
|
static int32_t P_DisplayKnee(int32_t gs,int32_t snum)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2012-08-19 12:47:55 +00:00
|
|
|
static const int8_t knee_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-72,-32,-8};
|
2012-03-22 22:47:47 +00:00
|
|
|
int32_t looking_arc, pal;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2012-08-19 12:47:55 +00:00
|
|
|
const DukePlayer_t *const ps = g_player[snum].ps;
|
|
|
|
|
2013-01-26 17:07:48 +00:00
|
|
|
if (ps->knee_incs == 0 || ps->knee_incs >= ARRAY_SIZE(knee_y) || sprite[ps->i].extra <= 0)
|
|
|
|
return 0;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2012-08-19 12:47:55 +00:00
|
|
|
looking_arc = knee_y[ps->knee_incs] + klabs(ps->look_ang)/9;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2012-08-19 12:47:55 +00:00
|
|
|
looking_arc -= (ps->hard_landing<<3);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-01-01 15:24:14 +00:00
|
|
|
pal = P_GetHudPal(ps);
|
2012-03-22 22:47:47 +00:00
|
|
|
if (pal == 0)
|
2012-08-19 12:47:55 +00:00
|
|
|
pal = ps->palookup;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
G_DrawTileScaled(105+(g_player[snum].sync->avel>>5)-(ps->look_ang>>1)+(knee_y[ps->knee_incs]>>2),
|
2012-08-19 12:47:55 +00:00
|
|
|
looking_arc+280-((ps->horiz-ps->horizoff)>>4),KNEE,gs,4+DRAWEAP_CENTER,pal);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-03-12 05:50:30 +00:00
|
|
|
static int32_t P_DisplayKnuckles(int32_t gs,int32_t snum)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2012-08-19 12:47:55 +00:00
|
|
|
static const int8_t knuckle_frames[] = {0,1,2,2,3,3,3,2,2,1,0};
|
2012-03-22 22:47:47 +00:00
|
|
|
int32_t looking_arc, pal;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2012-08-19 12:47:55 +00:00
|
|
|
const DukePlayer_t *const ps = g_player[snum].ps;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-04-13 03:51:17 +00:00
|
|
|
if (ps->knuckle_incs == 0 || (unsigned) (ps->knuckle_incs>>1) >= ARRAY_SIZE(knuckle_frames) || sprite[ps->i].extra <= 0)
|
2013-01-26 17:07:48 +00:00
|
|
|
return 0;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2012-08-19 12:47:55 +00:00
|
|
|
looking_arc = klabs(ps->look_ang)/9;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2012-08-19 12:47:55 +00:00
|
|
|
looking_arc -= (ps->hard_landing<<3);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-01-01 15:24:14 +00:00
|
|
|
pal = P_GetHudPal(ps);
|
2012-08-19 12:47:55 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
G_DrawTileScaled(160+(g_player[snum].sync->avel>>5)-(ps->look_ang>>1),
|
2012-08-19 12:47:55 +00:00
|
|
|
looking_arc+180-((ps->horiz-ps->horizoff)>>4),
|
|
|
|
CRACKKNUCKLES+knuckle_frames[ps->knuckle_incs>>1],gs,4+DRAWEAP_CENTER,pal);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2013-07-13 21:05:01 +00:00
|
|
|
#if !defined LUNATIC
|
|
|
|
// Set C-CON's WEAPON and WORKSLIKE gamevars.
|
2013-01-20 21:16:54 +00:00
|
|
|
void P_SetWeaponGamevars(int32_t snum, const DukePlayer_t *p)
|
|
|
|
{
|
|
|
|
Gv_SetVar(g_iWeaponVarID, p->curr_weapon, p->i, snum);
|
|
|
|
Gv_SetVar(g_iWorksLikeVarID,
|
|
|
|
((unsigned)p->curr_weapon < MAX_WEAPONS) ? PWEAPON(snum, p->curr_weapon, WorksLike) : -1,
|
|
|
|
p->i, snum);
|
|
|
|
}
|
2013-07-13 21:05:01 +00:00
|
|
|
#endif
|
2013-01-20 21:16:54 +00:00
|
|
|
|
2013-12-28 17:04:31 +00:00
|
|
|
static void P_FireWeapon(int32_t snum)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2013-12-28 17:04:31 +00:00
|
|
|
int32_t i;
|
|
|
|
DukePlayer_t *const p = g_player[snum].ps;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_DOFIRE, p->i, snum) || p->weapon_pos != 0)
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
return;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, WorksLike) != KNEE_WEAPON)
|
|
|
|
p->ammo_amount[p->curr_weapon]--;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, FireSound) > 0)
|
|
|
|
A_PlaySound(PWEAPON(snum, p->curr_weapon, FireSound), p->i);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
P_SetWeaponGamevars(snum, p);
|
|
|
|
// OSD_Printf("doing %d %d %d\n",PWEAPON(snum, p->curr_weapon, Shoots),p->curr_weapon,snum);
|
|
|
|
A_Shoot(p->i, PWEAPON(snum, p->curr_weapon, Shoots));
|
2010-03-12 05:50:30 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
for (i = PWEAPON(snum, p->curr_weapon, ShotsPerBurst) - 1; i > 0; i--)
|
|
|
|
{
|
|
|
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_FIREEVERYOTHER)
|
|
|
|
{
|
|
|
|
// this makes the projectiles fire on a delay from player code
|
|
|
|
actor[p->i].t_data[7] = (PWEAPON(snum, p->curr_weapon, ShotsPerBurst)) << 1;
|
|
|
|
}
|
|
|
|
else
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_AMMOPERSHOT &&
|
|
|
|
PWEAPON(snum, p->curr_weapon, WorksLike) != KNEE_WEAPON)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (p->ammo_amount[p->curr_weapon] > 0)
|
|
|
|
p->ammo_amount[p->curr_weapon]--;
|
|
|
|
else
|
|
|
|
break;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
2013-07-13 21:05:01 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
A_Shoot(p->i, PWEAPON(snum, p->curr_weapon, Shoots));
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
}
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (!(PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_NOVISIBLE))
|
|
|
|
{
|
2009-04-23 07:09:24 +00:00
|
|
|
#ifdef POLYMER
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
spritetype *s = &sprite[p->i];
|
|
|
|
int32_t x = ((sintable[(s->ang + 512) & 2047]) >> 7), y = ((sintable[(s->ang) & 2047]) >> 7);
|
2009-04-12 21:52:49 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
s->x += x;
|
|
|
|
s->y += y;
|
|
|
|
G_AddGameLight(0, p->i, PHEIGHT, 8192, PWEAPON(snum, p->curr_weapon, FlashColor), PR_LIGHT_PRIO_MAX_GAME);
|
|
|
|
actor[p->i].lightcount = 2;
|
|
|
|
s->x -= x;
|
|
|
|
s->y -= y;
|
|
|
|
#endif // POLYMER
|
|
|
|
p->visibility = 0;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-28 17:04:31 +00:00
|
|
|
static void P_DoWeaponSpawn(int32_t snum)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2013-12-28 17:04:31 +00:00
|
|
|
int32_t j;
|
|
|
|
const DukePlayer_t *const p = g_player[snum].ps;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-07-13 21:05:01 +00:00
|
|
|
// NOTE: For the 'Spawn' member, 0 means 'none', too (originally so,
|
|
|
|
// i.e. legacy). The check for <0 was added to the check because mod
|
|
|
|
// authors (rightly) assumed that -1 is the no-op value.
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, Spawn) <= 0) // <=0 : AMC TC beta/RC2 has WEAPONx_SPAWN -1
|
2009-01-14 00:49:26 +00:00
|
|
|
return;
|
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
j = A_Spawn(p->i, PWEAPON(snum, p->curr_weapon, Spawn));
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
if ((PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_SPAWNTYPE3))
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
|
|
|
// like chaingun shells
|
|
|
|
sprite[j].ang += 1024;
|
|
|
|
sprite[j].ang &= 2047;
|
|
|
|
sprite[j].xvel += 32;
|
|
|
|
sprite[j].z += (3<<8);
|
|
|
|
}
|
|
|
|
|
|
|
|
A_SetSprite(j,CLIPMASK0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-03-12 05:50:30 +00:00
|
|
|
void P_DisplayScuba(int32_t snum)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
|
|
|
if (g_player[snum].ps->scuba_on)
|
|
|
|
{
|
2013-01-01 15:24:14 +00:00
|
|
|
int32_t p = P_GetHudPal(g_player[snum].ps);
|
2012-03-24 15:59:39 +00:00
|
|
|
|
2012-08-19 13:01:24 +00:00
|
|
|
g_snum = snum;
|
2013-04-16 22:37:31 +00:00
|
|
|
#ifdef USE_OPENGL
|
|
|
|
if (getrendermode() >= REND_POLYMOST)
|
2014-09-30 04:14:21 +00:00
|
|
|
G_DrawTileScaled(44, (200-tilesiz[SCUBAMASK].y), SCUBAMASK, 0, 2+16+DRAWEAP_CENTER, p);
|
2013-04-16 22:37:31 +00:00
|
|
|
#endif
|
2014-09-30 04:14:21 +00:00
|
|
|
G_DrawTileScaled(43, (200-tilesiz[SCUBAMASK].y), SCUBAMASK, 0, 2+16+DRAWEAP_CENTER, p);
|
|
|
|
G_DrawTileScaled(320-43, (200-tilesiz[SCUBAMASK].y), SCUBAMASK, 0, 2+4+16+DRAWEAP_CENTER, p);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
static const int8_t access_tip_y [] ={
|
|
|
|
0, -8, -16, -32, -64, -84, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -96, -72, -64, -32, -16,
|
|
|
|
/* EDuke32: */ 0, 16, 32, 48,
|
|
|
|
// At y coord 64, the hand is already not shown.
|
|
|
|
};
|
2012-08-19 12:47:55 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
static int32_t P_DisplayTip(int32_t gs, int32_t snum)
|
|
|
|
{
|
2012-08-19 12:47:55 +00:00
|
|
|
const DukePlayer_t *const ps = g_player[snum].ps;
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
int y, looking_arc, p = 0;
|
2012-08-19 12:47:55 +00:00
|
|
|
|
2013-03-31 18:58:09 +00:00
|
|
|
if (ps->tipincs == 0)
|
2013-01-26 17:07:48 +00:00
|
|
|
return 0;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-03-31 18:58:09 +00:00
|
|
|
// Report that the tipping hand has been drawn so that the otherwise
|
|
|
|
// selected weapon is not drawn.
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if ((unsigned)ps->tipincs >= ARRAY_SIZE(access_tip_y))
|
2013-03-31 18:58:09 +00:00
|
|
|
return 1;
|
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
looking_arc = (klabs(ps->look_ang) / 9) - (ps->hard_landing << 3);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-01-01 15:24:14 +00:00
|
|
|
p = P_GetHudPal(ps);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
y = access_tip_y[ps->tipincs] >> 1;
|
|
|
|
|
|
|
|
guniqhudid = 201;
|
|
|
|
|
|
|
|
G_DrawTileScaled(170 + (g_player[snum].sync->avel >> 5) - (ps->look_ang >> 1),
|
|
|
|
y + looking_arc + 240 - ((ps->horiz - ps->horizoff) >> 4), TIP + ((26 - ps->tipincs) >> 4), gs,
|
|
|
|
DRAWEAP_CENTER, p);
|
2011-12-09 19:12:01 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
guniqhudid = 0;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
static int32_t P_DisplayAccess(int32_t gs, int32_t snum)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
2012-08-19 12:47:55 +00:00
|
|
|
const DukePlayer_t *const ps = g_player[snum].ps;
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
int y, looking_arc, p = 0;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (ps->access_incs == 0)
|
2013-01-26 17:07:48 +00:00
|
|
|
return 0;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if ((unsigned)ps->access_incs >= ARRAY_SIZE(access_tip_y)-4 || sprite[ps->i].extra <= 0)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
looking_arc = access_tip_y[ps->access_incs] + (klabs(ps->look_ang) / 9) - (ps->hard_landing << 3);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2012-08-19 12:47:55 +00:00
|
|
|
if (ps->access_spritenum >= 0)
|
|
|
|
p = sprite[ps->access_spritenum].pal;
|
2010-05-02 23:27:30 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
y = access_tip_y[ps->access_incs] >> 2;
|
|
|
|
|
|
|
|
guniqhudid = 200;
|
|
|
|
|
|
|
|
if ((ps->access_incs - 3) > 0 && (ps->access_incs - 3) >> 3)
|
2012-02-13 21:38:00 +00:00
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
G_DrawTileScaled(170 + (g_player[snum].sync->avel >> 5) - (ps->look_ang >> 1) + y,
|
|
|
|
looking_arc + 266 - ((ps->horiz - ps->horizoff) >> 4),
|
|
|
|
HANDHOLDINGLASER + (ps->access_incs >> 3), gs, DRAWEAP_CENTER, p);
|
2012-02-13 21:38:00 +00:00
|
|
|
}
|
2009-01-14 00:49:26 +00:00
|
|
|
else
|
2012-02-13 21:38:00 +00:00
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
G_DrawTileScaled(170 + (g_player[snum].sync->avel >> 5) - (ps->look_ang >> 1) + y,
|
|
|
|
looking_arc + 266 - ((ps->horiz - ps->horizoff) >> 4), HANDHOLDINGACCESS, gs,
|
|
|
|
4 + DRAWEAP_CENTER, p);
|
2012-02-13 21:38:00 +00:00
|
|
|
}
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
guniqhudid = 0;
|
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int32_t fistsign;
|
|
|
|
|
|
|
|
void P_DisplayWeapon(int32_t snum)
|
|
|
|
{
|
|
|
|
int32_t gun_pos, looking_arc, cw;
|
|
|
|
int32_t weapon_xoffset, i, j;
|
|
|
|
int32_t o = 0,pal = 0;
|
2012-08-10 19:11:56 +00:00
|
|
|
DukePlayer_t *const p = g_player[snum].ps;
|
2013-01-01 15:24:14 +00:00
|
|
|
const uint8_t *const kb = &p->kickback_pic;
|
2009-01-14 00:49:26 +00:00
|
|
|
int32_t gs;
|
|
|
|
|
2012-08-16 21:48:33 +00:00
|
|
|
g_snum = snum;
|
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
looking_arc = klabs(p->look_ang)/9;
|
|
|
|
|
|
|
|
gs = sprite[p->i].shade;
|
|
|
|
if (gs > 24) gs = 24;
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->newowner >= 0 || ud.camerasprite >= 0 || p->over_shoulder_on > 0 || (sprite[p->i].pal != 1 && sprite[p->i].extra <= 0) ||
|
2010-08-02 08:13:51 +00:00
|
|
|
P_DisplayFist(gs,snum) || P_DisplayKnuckles(gs,snum) || P_DisplayTip(gs,snum) || P_DisplayAccess(gs,snum))
|
2009-01-14 00:49:26 +00:00
|
|
|
return;
|
|
|
|
|
2010-03-12 05:50:30 +00:00
|
|
|
P_DisplayKnee(gs,snum);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
gun_pos = 80-(p->weapon_pos*p->weapon_pos);
|
|
|
|
|
|
|
|
weapon_xoffset = (160)-90;
|
|
|
|
|
|
|
|
if (ud.weaponsway)
|
|
|
|
{
|
|
|
|
weapon_xoffset -= (sintable[((p->weapon_sway>>1)+512)&2047]/(1024+512));
|
|
|
|
|
|
|
|
if (sprite[p->i].xrepeat < 32)
|
|
|
|
gun_pos -= klabs(sintable[(p->weapon_sway<<2)&2047]>>9);
|
|
|
|
else gun_pos -= klabs(sintable[(p->weapon_sway>>1)&2047]>>10);
|
|
|
|
}
|
|
|
|
else gun_pos -= 16;
|
|
|
|
|
|
|
|
weapon_xoffset -= 58 + p->weapon_ang;
|
|
|
|
gun_pos -= (p->hard_landing<<3);
|
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
cw = PWEAPON(snum, (p->last_weapon >= 0) ? p->last_weapon : p->curr_weapon, WorksLike);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-01-19 18:28:48 +00:00
|
|
|
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;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_DISPLAYWEAPON, p->i, screenpeek) == 0)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
|
|
|
j = 14-p->quick_kick;
|
|
|
|
if (j != 14 || p->last_quick_kick)
|
|
|
|
{
|
2013-01-01 15:24:14 +00:00
|
|
|
pal = P_GetHudPal(p);
|
2012-03-22 22:47:47 +00:00
|
|
|
if (pal == 0)
|
|
|
|
pal = p->palookup;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
guniqhudid = 100;
|
|
|
|
if (j < 6 || j > 12)
|
|
|
|
G_DrawTileScaled(weapon_xoffset+80-(p->look_ang>>1),
|
2012-08-19 12:47:55 +00:00
|
|
|
looking_arc+250-gun_pos,KNEE,gs,o|4|DRAWEAP_CENTER,pal);
|
2009-01-14 00:49:26 +00:00
|
|
|
else G_DrawTileScaled(weapon_xoffset+160-16-(p->look_ang>>1),
|
2012-08-19 13:01:30 +00:00
|
|
|
looking_arc+214-gun_pos,KNEE+1,gs,o|4|DRAWEAP_CENTER,pal);
|
2009-01-14 00:49:26 +00:00
|
|
|
guniqhudid = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sprite[p->i].xrepeat < 40)
|
|
|
|
{
|
2013-01-01 15:24:14 +00:00
|
|
|
pal = P_GetHudPal(p);
|
2012-08-19 13:01:30 +00:00
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
if (p->jetpack_on == 0)
|
|
|
|
{
|
|
|
|
i = sprite[p->i].xvel;
|
2013-03-27 01:38:42 +00:00
|
|
|
looking_arc += 32-(i>>3);
|
|
|
|
fistsign += i>>3;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
2012-08-19 13:01:30 +00:00
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
cw = weapon_xoffset;
|
|
|
|
weapon_xoffset += sintable[(fistsign)&2047]>>10;
|
2012-08-19 13:01:30 +00:00
|
|
|
G_DrawTileScaled(weapon_xoffset+250-(p->look_ang>>1),
|
|
|
|
looking_arc+258-(klabs(sintable[(fistsign)&2047]>>8)),
|
|
|
|
FIST,gs,o, pal);
|
2010-05-02 23:27:30 +00:00
|
|
|
weapon_xoffset = cw - (sintable[(fistsign)&2047]>>10);
|
2012-08-19 13:01:30 +00:00
|
|
|
G_DrawTileScaled(weapon_xoffset+40-(p->look_ang>>1),
|
|
|
|
looking_arc+200+(klabs(sintable[(fistsign)&2047]>>8)),
|
|
|
|
FIST,gs,o|4, pal);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
2012-05-14 18:12:27 +00:00
|
|
|
else
|
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
const int doanim = !(sprite[p->i].pal == 1 || ud.pause_on || g_player[myconnectindex].ps->gm&MODE_MENU);
|
|
|
|
const int hla = p->look_ang >> 1;
|
|
|
|
|
2013-01-01 15:24:14 +00:00
|
|
|
pal = P_GetHudPal(p);
|
2012-05-14 18:12:27 +00:00
|
|
|
|
|
|
|
switch (cw)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
|
|
|
case KNEE_WEAPON:
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_DRAWWEAPON, g_player[screenpeek].ps->i, screenpeek) || *kb == 0)
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
break;
|
2012-03-22 22:47:47 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (pal == 0)
|
|
|
|
pal = p->palookup;
|
|
|
|
|
|
|
|
guniqhudid = cw;
|
|
|
|
if (*kb < 5 || *kb > 9)
|
|
|
|
G_DrawTileScaled(weapon_xoffset + 220 - hla, looking_arc + 250 - gun_pos, KNEE,
|
|
|
|
gs, o, pal);
|
|
|
|
else
|
|
|
|
G_DrawTileScaled(weapon_xoffset + 160 - hla, looking_arc + 214 - gun_pos, KNEE + 1,
|
|
|
|
gs, o, pal);
|
|
|
|
guniqhudid = 0;
|
2009-01-14 00:49:26 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TRIPBOMB_WEAPON:
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_DRAWWEAPON, g_player[screenpeek].ps->i, screenpeek))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
break;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
weapon_xoffset += 8;
|
|
|
|
gun_pos -= 10;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if ((*kb) > 6)
|
|
|
|
looking_arc += ((*kb) << 3);
|
|
|
|
else if ((*kb) < 4)
|
|
|
|
{
|
|
|
|
G_DrawWeaponTileWithID(cw << 2, weapon_xoffset + 142 - hla,
|
|
|
|
looking_arc + 234 - gun_pos, HANDHOLDINGLASER + 3, gs, o, pal, 0);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
|
|
|
|
G_DrawWeaponTileWithID(cw, weapon_xoffset + 130 - hla, looking_arc + 249 - gun_pos,
|
|
|
|
HANDHOLDINGLASER + ((*kb) >> 2), gs, o, pal, 0);
|
|
|
|
|
|
|
|
G_DrawWeaponTileWithID(cw << 1, weapon_xoffset + 152 - hla,
|
|
|
|
looking_arc + 249 - gun_pos, HANDHOLDINGLASER + ((*kb) >> 2), gs, o | 4,
|
|
|
|
pal, 0);
|
2009-01-14 00:49:26 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case RPG_WEAPON:
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
break;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
weapon_xoffset -= sintable[(768 + ((*kb) << 7)) & 2047] >> 11;
|
|
|
|
gun_pos += sintable[(768 + ((*kb) << 7)) & 2047] >> 11;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (*kb > 0 && *kb < 8)
|
|
|
|
{
|
|
|
|
G_DrawWeaponTileWithID(cw << 1, weapon_xoffset + 164, (looking_arc << 1) + 176 - gun_pos,
|
|
|
|
RPGGUN + ((*kb) >> 1), gs, o | 512, pal, 0);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
|
|
|
|
G_DrawWeaponTileWithID(cw, weapon_xoffset + 164, (looking_arc << 1) + 176 - gun_pos, RPGGUN, gs,
|
|
|
|
o | 512, pal, 0);
|
2009-01-14 00:49:26 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SHOTGUN_WEAPON:
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_DRAWWEAPON, g_player[screenpeek].ps->i, screenpeek))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
break;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
weapon_xoffset -= 8;
|
|
|
|
|
|
|
|
switch (*kb)
|
|
|
|
{
|
2009-01-14 00:49:26 +00:00
|
|
|
case 1:
|
|
|
|
case 2:
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
G_DrawWeaponTileWithID(cw << 1, weapon_xoffset + 168 - hla, looking_arc + 201 - gun_pos,
|
|
|
|
SHOTGUN + 2, -128, o, pal, 0);
|
2009-01-14 00:49:26 +00:00
|
|
|
case 0:
|
|
|
|
case 6:
|
|
|
|
case 7:
|
|
|
|
case 8:
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
G_DrawWeaponTileWithID(cw, weapon_xoffset + 146 - hla, looking_arc + 202 - gun_pos,
|
|
|
|
SHOTGUN, gs, o, pal, 0);
|
2009-01-14 00:49:26 +00:00
|
|
|
break;
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
case 3:
|
|
|
|
case 4:
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
gun_pos -= 40;
|
|
|
|
weapon_xoffset += 20;
|
|
|
|
|
|
|
|
G_DrawWeaponTileWithID(cw << 1, weapon_xoffset + 178 - hla, looking_arc + 194 - gun_pos,
|
|
|
|
SHOTGUN + 1 + ((*(kb)-1) >> 1), -128, o, pal, 0);
|
2009-01-14 00:49:26 +00:00
|
|
|
case 5:
|
|
|
|
case 9:
|
|
|
|
case 10:
|
|
|
|
case 11:
|
|
|
|
case 12:
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
G_DrawWeaponTileWithID(cw, weapon_xoffset + 158 - hla, looking_arc + 220 - gun_pos,
|
|
|
|
SHOTGUN + 3, gs, o, pal, 0);
|
2009-01-14 00:49:26 +00:00
|
|
|
break;
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
case 13:
|
|
|
|
case 14:
|
|
|
|
case 15:
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
G_DrawWeaponTileWithID(cw, 32 + weapon_xoffset + 166 - hla, looking_arc + 210 - gun_pos,
|
|
|
|
SHOTGUN + 4, gs, o, pal, 0);
|
2009-01-14 00:49:26 +00:00
|
|
|
break;
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
case 16:
|
|
|
|
case 17:
|
|
|
|
case 18:
|
|
|
|
case 19:
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
case 24:
|
|
|
|
case 25:
|
|
|
|
case 26:
|
|
|
|
case 27:
|
|
|
|
G_DrawWeaponTileWithID(cw, 64 + weapon_xoffset + 170 - hla, looking_arc + 196 - gun_pos,
|
|
|
|
SHOTGUN + 5, gs, o, pal, 0);
|
2009-01-14 00:49:26 +00:00
|
|
|
break;
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
case 20:
|
|
|
|
case 21:
|
|
|
|
case 22:
|
|
|
|
case 23:
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
G_DrawWeaponTileWithID(cw, 64 + weapon_xoffset + 176 - hla, looking_arc + 196 - gun_pos,
|
|
|
|
SHOTGUN + 6, gs, o, pal, 0);
|
2009-01-14 00:49:26 +00:00
|
|
|
break;
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
|
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
case 28:
|
|
|
|
case 29:
|
|
|
|
case 30:
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
G_DrawWeaponTileWithID(cw, 32 + weapon_xoffset + 156 - hla, looking_arc + 206 - gun_pos,
|
|
|
|
SHOTGUN + 4, gs, o, pal, 0);
|
2009-01-14 00:49:26 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CHAINGUN_WEAPON:
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_DRAWWEAPON, g_player[screenpeek].ps->i, screenpeek))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
break;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (*kb > 0)
|
|
|
|
{
|
|
|
|
gun_pos -= sintable[(*kb)<<7]>>12;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (doanim)
|
|
|
|
weapon_xoffset += 1-(rand()&3);
|
|
|
|
}
|
2012-05-14 18:12:27 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
switch (*kb)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
G_DrawWeaponTileWithID(cw, weapon_xoffset+178-(p->look_ang>>1),looking_arc+233-gun_pos,
|
|
|
|
CHAINGUN+1,gs,o,pal,0);
|
|
|
|
break;
|
2012-05-14 18:12:27 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
default:
|
|
|
|
if (*kb > PWEAPON(screenpeek, CHAINGUN_WEAPON, FireDelay) && *kb < PWEAPON(screenpeek, CHAINGUN_WEAPON, TotalTime))
|
|
|
|
{
|
|
|
|
i = 0;
|
|
|
|
if (doanim) i = rand()&7;
|
|
|
|
G_DrawWeaponTileWithID(cw<<2, i+weapon_xoffset-4+140-(p->look_ang>>1),i+looking_arc-((*kb)>>1)+208-gun_pos,
|
|
|
|
CHAINGUN+5+((*kb-4)/5),gs,o,pal,0);
|
|
|
|
if (doanim) i = rand()&7;
|
|
|
|
G_DrawWeaponTileWithID(cw<<2, 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,0);
|
|
|
|
}
|
2012-05-14 18:12:27 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (*kb < PWEAPON(screenpeek, CHAINGUN_WEAPON, TotalTime)-4)
|
|
|
|
{
|
|
|
|
i = 0;
|
|
|
|
if (doanim) i = rand()&7;
|
|
|
|
G_DrawWeaponTileWithID(cw<<2, i+weapon_xoffset-4+162-(p->look_ang>>1),i+looking_arc-((*kb)>>1)+208-gun_pos,
|
|
|
|
CHAINGUN+5+((*kb-2)/5),gs,o,pal,0);
|
|
|
|
G_DrawWeaponTileWithID(cw, weapon_xoffset+178-(p->look_ang>>1),looking_arc+233-gun_pos,
|
|
|
|
CHAINGUN+1+((*kb)>>1),gs,o,pal,0);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
else G_DrawWeaponTileWithID(cw, weapon_xoffset+178-(p->look_ang>>1),looking_arc+233-gun_pos,
|
|
|
|
CHAINGUN+1,gs,o,pal,0);
|
2013-04-21 19:55:11 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
break;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
|
|
|
|
G_DrawWeaponTileWithID(cw<<1, weapon_xoffset+168-(p->look_ang>>1),looking_arc+260-gun_pos,
|
|
|
|
CHAINGUN,gs,o,pal,0);
|
2009-01-14 00:49:26 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PISTOL_WEAPON:
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
break;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if ((*kb) < PWEAPON(screenpeek, PISTOL_WEAPON, TotalTime)+1)
|
|
|
|
{
|
|
|
|
static uint8_t kb_frames [] ={ 0, 1, 2 };
|
|
|
|
int32_t l = 195-12+weapon_xoffset;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if ((*kb) == PWEAPON(screenpeek, PISTOL_WEAPON, FireDelay))
|
|
|
|
l -= 3;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
G_DrawWeaponTileWithID(cw, (l-(p->look_ang>>1)), (looking_arc+244-gun_pos), FIRSTGUN+kb_frames[*kb>2 ? 0 : *kb], gs, 2, pal, 0);
|
|
|
|
}
|
|
|
|
else if ((*kb) < PWEAPON(screenpeek, PISTOL_WEAPON, Reload)-17)
|
|
|
|
G_DrawWeaponTileWithID(cw, 194-(p->look_ang>>1), looking_arc+230-gun_pos, FIRSTGUN+4, gs, o|512, pal, 0);
|
|
|
|
else if ((*kb) < PWEAPON(screenpeek, PISTOL_WEAPON, Reload)-12)
|
|
|
|
{
|
|
|
|
G_DrawWeaponTileWithID(cw<<1, 244-((*kb)<<3)-(p->look_ang>>1), looking_arc+130-gun_pos+((*kb)<<4), FIRSTGUN+6, gs, o|512, pal, 0);
|
|
|
|
G_DrawWeaponTileWithID(cw, 224-(p->look_ang>>1), looking_arc+220-gun_pos, FIRSTGUN+5, gs, o|512, pal, 0);
|
|
|
|
}
|
|
|
|
else if ((*kb) < PWEAPON(screenpeek, PISTOL_WEAPON, Reload)-7)
|
|
|
|
{
|
|
|
|
G_DrawWeaponTileWithID(cw<<1, 124+((*kb)<<1)-(p->look_ang>>1), looking_arc+430-gun_pos-((*kb)<<3), FIRSTGUN+6, gs, o|512, pal, 0);
|
|
|
|
G_DrawWeaponTileWithID(cw, 224-(p->look_ang>>1), looking_arc+220-gun_pos, FIRSTGUN+5, gs, o|512, pal, 0);
|
|
|
|
}
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
else if ((*kb) < PWEAPON(screenpeek, PISTOL_WEAPON, Reload)-4)
|
|
|
|
{
|
|
|
|
G_DrawWeaponTileWithID(cw<<2, 184-(p->look_ang>>1), looking_arc+235-gun_pos, FIRSTGUN+8, gs, o|512, pal, 0);
|
|
|
|
G_DrawWeaponTileWithID(cw, 224-(p->look_ang>>1), looking_arc+210-gun_pos, FIRSTGUN+5, gs, o|512, pal, 0);
|
|
|
|
}
|
|
|
|
else if ((*kb) < PWEAPON(screenpeek, PISTOL_WEAPON, Reload)-2)
|
|
|
|
{
|
|
|
|
G_DrawWeaponTileWithID(cw<<2, 164-(p->look_ang>>1), looking_arc+245-gun_pos, FIRSTGUN+8, gs, o|512, pal, 0);
|
|
|
|
G_DrawWeaponTileWithID(cw, 224-(p->look_ang>>1), looking_arc+220-gun_pos, FIRSTGUN+5, gs, o|512, pal, 0);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
else if ((*kb) < PWEAPON(screenpeek, PISTOL_WEAPON, Reload))
|
|
|
|
G_DrawWeaponTileWithID(cw, 194-(p->look_ang>>1), looking_arc+235-gun_pos, FIRSTGUN+5, gs, o|512, pal, 0);
|
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
break;
|
2012-08-19 12:47:55 +00:00
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
case HANDBOMB_WEAPON:
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_DRAWWEAPON, g_player[screenpeek].ps->i, screenpeek))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
break;
|
|
|
|
else
|
2012-08-19 12:47:55 +00:00
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
static uint8_t throw_frames [] ={ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2 };
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (*kb >= PWEAPON(screenpeek, p->curr_weapon, TotalTime) || *kb >= ARRAY_SIZE(throw_frames))
|
|
|
|
break;
|
2013-06-27 23:04:39 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (*kb)
|
|
|
|
{
|
|
|
|
if ((*kb) < 7)
|
|
|
|
gun_pos -= 10 * (*kb); // D
|
|
|
|
else if ((*kb) < 12)
|
|
|
|
gun_pos += 20 * ((*kb) - 10); // U
|
|
|
|
else if ((*kb) < 20)
|
|
|
|
gun_pos -= 9 * ((*kb) - 14); // D
|
|
|
|
|
|
|
|
gun_pos += 10;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
|
|
|
|
G_DrawWeaponTileWithID(cw, weapon_xoffset + 190 - hla, looking_arc + 260 - gun_pos,
|
|
|
|
HANDTHROW + throw_frames[(*kb)], gs, o, pal, 0);
|
2012-08-19 12:47:55 +00:00
|
|
|
}
|
2012-05-14 18:12:27 +00:00
|
|
|
break;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
case HANDREMOTE_WEAPON:
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
break;
|
|
|
|
else
|
2012-08-19 12:47:55 +00:00
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
static uint8_t remote_frames [] ={ 0, 1, 1, 2, 1, 1, 0, 0, 0, 0, 0 };
|
2012-05-14 18:12:27 +00:00
|
|
|
|
2013-06-27 23:04:39 +00:00
|
|
|
if (*kb >= ARRAY_SIZE(remote_frames))
|
|
|
|
break;
|
|
|
|
|
2012-08-19 12:47:55 +00:00
|
|
|
weapon_xoffset = -48;
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
G_DrawWeaponTileWithID(cw, weapon_xoffset + 150 - hla, looking_arc + 258 - gun_pos,
|
|
|
|
HANDREMOTE + remote_frames[(*kb)], gs, o, pal, 0);
|
2012-08-19 12:47:55 +00:00
|
|
|
}
|
2012-05-14 18:12:27 +00:00
|
|
|
break;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
case DEVISTATOR_WEAPON:
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_DRAWWEAPON, g_player[screenpeek].ps->i, screenpeek))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
if ((*kb) < (PWEAPON(screenpeek, DEVISTATOR_WEAPON, TotalTime) + 1) && (*kb) > 0)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
static uint8_t cycloidy [] ={ 0, 4, 12, 24, 12, 4, 0 };
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (*kb >= ARRAY_SIZE(cycloidy))
|
|
|
|
break;
|
2013-06-27 23:04:39 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
i = ksgn((*kb) >> 2);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (p->hbomb_hold_delay)
|
|
|
|
{
|
|
|
|
G_DrawWeaponTileWithID(
|
|
|
|
cw, (cycloidy[*kb] >> 1) + weapon_xoffset + 268 - hla,
|
|
|
|
cycloidy[*kb] + looking_arc + 238 - gun_pos, DEVISTATOR + i, -32, o, pal, 0);
|
|
|
|
G_DrawWeaponTileWithID(cw << 1, weapon_xoffset + 30 - hla,
|
|
|
|
looking_arc + 240 - gun_pos, DEVISTATOR, gs, o | 4, pal, 0);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
G_DrawWeaponTileWithID(cw<<1, -(cycloidy[*kb] >> 1) + weapon_xoffset + 30 - hla,
|
|
|
|
cycloidy[*kb] + looking_arc + 240 - gun_pos, DEVISTATOR + i, -32, o | 4,
|
|
|
|
pal, 0);
|
|
|
|
G_DrawWeaponTileWithID(cw, weapon_xoffset + 268 - hla, looking_arc + 238 - gun_pos,
|
|
|
|
DEVISTATOR, gs, o, pal, 0);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
}
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
G_DrawWeaponTileWithID(cw, weapon_xoffset + 268 - hla, looking_arc + 238 - gun_pos,
|
|
|
|
DEVISTATOR, gs, o, pal, 0);
|
|
|
|
G_DrawWeaponTileWithID(cw<<1, weapon_xoffset + 30 - hla, looking_arc + 240 - gun_pos,
|
|
|
|
DEVISTATOR, gs, o | 4, pal, 0);
|
|
|
|
}
|
2009-01-14 00:49:26 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FREEZE_WEAPON:
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_DRAWWEAPON,g_player[screenpeek].ps->i,screenpeek))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
if ((*kb) < (PWEAPON(snum, p->curr_weapon, TotalTime)+1) && (*kb) > 0)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
static uint8_t cat_frames[] = { 0,0,1,1,2,2 };
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (*kb%6 >= ARRAY_SIZE(cat_frames))
|
|
|
|
break;
|
2013-06-27 23:04:39 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (doanim)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
weapon_xoffset += rand()&3;
|
|
|
|
looking_arc += rand()&3;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
gun_pos -= 16;
|
|
|
|
G_DrawWeaponTileWithID(cw<<1, weapon_xoffset+210-(p->look_ang>>1),looking_arc+261-gun_pos,FREEZE+2,-32,o|512,pal,0);
|
|
|
|
G_DrawWeaponTileWithID(cw, weapon_xoffset+210-(p->look_ang>>1),looking_arc+235-gun_pos,FREEZE+3+cat_frames[*kb%6],-32,o|512,pal,0);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
else
|
|
|
|
G_DrawWeaponTileWithID(cw, weapon_xoffset+210-(p->look_ang>>1),looking_arc+261-gun_pos,FREEZE,gs,o|512,pal,0);
|
2009-01-14 00:49:26 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GROW_WEAPON:
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
case SHRINKER_WEAPON:
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_DRAWWEAPON, g_player[screenpeek].ps->i, screenpeek))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
break;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
weapon_xoffset += 28;
|
|
|
|
looking_arc += 18;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if ((*kb) < PWEAPON(snum, p->curr_weapon, TotalTime) && (*kb) > 0)
|
|
|
|
{
|
|
|
|
if (doanim)
|
2012-05-05 22:23:44 +00:00
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
weapon_xoffset += rand() & 3;
|
|
|
|
gun_pos += (rand() & 3);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
G_DrawWeaponTileWithID(cw << 1, weapon_xoffset + 184 - hla, looking_arc + 240 - gun_pos,
|
|
|
|
SHRINKER + 3 + ((*kb) & 3), -32, o, cw == GROW_WEAPON ? 2 : 0, 1);
|
|
|
|
G_DrawWeaponTileWithID(cw, weapon_xoffset + 188 - hla, looking_arc + 240 - gun_pos,
|
|
|
|
cw == GROW_WEAPON ? SHRINKER - 1 : SHRINKER + 1, gs, o, pal, 0);
|
|
|
|
}
|
|
|
|
else
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
G_DrawWeaponTileWithID(cw << 1, weapon_xoffset + 184 - hla, looking_arc + 240 - gun_pos,
|
|
|
|
SHRINKER + 2, 16 - (sintable[p->random_club_frame & 2047] >> 10), o,
|
|
|
|
cw == GROW_WEAPON ? 2 : 0, 1);
|
|
|
|
G_DrawWeaponTileWithID(cw, weapon_xoffset + 188 - hla, looking_arc + 240 - gun_pos,
|
|
|
|
cw == GROW_WEAPON ? SHRINKER - 2 : SHRINKER, gs, o, pal, 0);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2012-05-14 18:12:27 +00:00
|
|
|
}
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
2012-05-14 18:12:27 +00:00
|
|
|
|
2010-03-12 05:50:30 +00:00
|
|
|
P_DisplaySpit(snum);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define TURBOTURNTIME (TICRATE/8) // 7
|
|
|
|
#define NORMALTURN 15
|
|
|
|
#define PREAMBLETURN 5
|
|
|
|
#define NORMALKEYMOVE 40
|
|
|
|
#define MAXVEL ((NORMALKEYMOVE*2)+10)
|
|
|
|
#define MAXSVEL ((NORMALKEYMOVE*2)+10)
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
#define MAXANGVEL 255
|
2009-01-14 00:49:26 +00:00
|
|
|
#define MAXHORIZ 127
|
|
|
|
|
|
|
|
int32_t g_myAimMode = 0, g_myAimStat = 0, g_oldAimStat = 0;
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t mouseyaxismode = -1;
|
2011-02-25 21:50:19 +00:00
|
|
|
int32_t g_emuJumpTics = 0;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2013-06-27 23:04:39 +00:00
|
|
|
void P_GetInput(int32_t snum)
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
int32_t j;
|
2009-01-14 00:49:26 +00:00
|
|
|
static ControlInfo info[2];
|
2010-07-19 15:14:00 +00:00
|
|
|
static int32_t turnheldtime; //MED
|
|
|
|
static int32_t lastcontroltime; //MED
|
|
|
|
|
|
|
|
int32_t tics, running;
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t turnamount;
|
|
|
|
int32_t keymove;
|
2009-01-14 00:49:26 +00:00
|
|
|
DukePlayer_t *p = g_player[snum].ps;
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
static input_t in;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2010-05-07 20:45:40 +00:00
|
|
|
if ((p->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !KB_KeyPressed(sc_Pause)))
|
2009-01-14 00:49:26 +00:00
|
|
|
{
|
|
|
|
if (!(p->gm&MODE_MENU))
|
|
|
|
CONTROL_GetInput(&info[0]);
|
2010-05-08 20:15:24 +00:00
|
|
|
|
|
|
|
Bmemset(&info[1], 0, sizeof(input_t));
|
|
|
|
Bmemset(&loc, 0, sizeof(input_t));
|
2009-01-14 00:49:26 +00:00
|
|
|
loc.bits = (((int32_t)g_gameQuit)<<SK_GAMEQUIT);
|
|
|
|
loc.extbits = (g_player[snum].pteam != g_player[snum].ps->team)<<6;
|
|
|
|
loc.extbits |= (1<<7);
|
2010-05-08 20:15:24 +00:00
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ud.mouseaiming)
|
|
|
|
g_myAimMode = BUTTON(gamefunc_Mouse_Aiming);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_oldAimStat = g_myAimStat;
|
|
|
|
g_myAimStat = BUTTON(gamefunc_Mouse_Aiming);
|
|
|
|
if (g_myAimStat > g_oldAimStat)
|
|
|
|
{
|
|
|
|
g_myAimMode ^= 1;
|
2011-02-25 21:50:19 +00:00
|
|
|
P_DoQuote(QUOTE_MOUSE_AIMING_OFF+g_myAimMode,p);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
j = (g_myAimMode) ? analog_lookingupanddown : ud.config.MouseAnalogueAxes[1];
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2010-05-08 20:15:24 +00:00
|
|
|
if (j != mouseyaxismode)
|
|
|
|
{
|
|
|
|
CONTROL_MapAnalogAxis(1, j, controldevice_mouse);
|
|
|
|
mouseyaxismode = j;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CONTROL_GetInput(&info[0]);
|
|
|
|
|
|
|
|
if (ud.config.MouseDeadZone)
|
|
|
|
{
|
|
|
|
if (info[0].dpitch > 0)
|
|
|
|
{
|
|
|
|
if (info[0].dpitch > ud.config.MouseDeadZone)
|
|
|
|
info[0].dpitch -= ud.config.MouseDeadZone;
|
|
|
|
else info[0].dpitch = 0;
|
|
|
|
}
|
|
|
|
else if (info[0].dpitch < 0)
|
|
|
|
{
|
|
|
|
if (info[0].dpitch < -ud.config.MouseDeadZone)
|
|
|
|
info[0].dpitch += ud.config.MouseDeadZone;
|
|
|
|
else info[0].dpitch = 0;
|
|
|
|
}
|
|
|
|
if (info[0].dyaw > 0)
|
|
|
|
{
|
|
|
|
if (info[0].dyaw > ud.config.MouseDeadZone)
|
|
|
|
info[0].dyaw -= ud.config.MouseDeadZone;
|
|
|
|
else info[0].dyaw = 0;
|
|
|
|
}
|
|
|
|
else if (info[0].dyaw < 0)
|
|
|
|
{
|
|
|
|
if (info[0].dyaw < -ud.config.MouseDeadZone)
|
|
|
|
info[0].dyaw += ud.config.MouseDeadZone;
|
|
|
|
else info[0].dyaw = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ud.config.MouseBias)
|
|
|
|
{
|
|
|
|
if (klabs(info[0].dyaw) > klabs(info[0].dpitch))
|
2014-10-25 03:29:21 +00:00
|
|
|
info[0].dpitch = tabledivide32_noinline(info[0].dpitch, ud.config.MouseBias);
|
|
|
|
else info[0].dyaw = tabledivide32_noinline(info[0].dyaw, ud.config.MouseBias);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tics = totalclock-lastcontroltime;
|
|
|
|
lastcontroltime = totalclock;
|
|
|
|
|
|
|
|
// JBF: Run key behaviour is selectable
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
running = (ud.runkey_mode) ? (BUTTON(gamefunc_Run) | ud.auto_run) : (ud.auto_run ^ BUTTON(gamefunc_Run));
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
in.svel = in.fvel = in.avel = in.horz = 0;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
if (BUTTON(gamefunc_Strafe))
|
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
in.svel = -(info[0].dyaw+info[1].dyaw)/8;
|
2009-01-14 00:49:26 +00:00
|
|
|
info[1].dyaw = (info[1].dyaw+info[0].dyaw) % 8;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
in.avel = (info[0].dyaw+info[1].dyaw)/32;
|
|
|
|
info[1].dyaw = (info[1].dyaw+info[0].dyaw) % 32;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ud.mouseflip)
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
in.horz = -(info[0].dpitch+info[1].dpitch)/(314-128);
|
|
|
|
else in.horz = (info[0].dpitch+info[1].dpitch)/(314-128);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
|
|
|
info[1].dpitch = (info[1].dpitch+info[0].dpitch) % (314-128);
|
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
in.svel -= info[0].dx;
|
2009-01-14 00:49:26 +00:00
|
|
|
info[1].dz = info[0].dz % (1<<6);
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
in.fvel = -info[0].dz>>6;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2010-07-19 15:14:00 +00:00
|
|
|
// OSD_Printf("running: %d\n", running);
|
2009-01-14 00:49:26 +00:00
|
|
|
if (running)
|
|
|
|
{
|
|
|
|
turnamount = NORMALTURN<<1;
|
|
|
|
keymove = NORMALKEYMOVE<<1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
turnamount = NORMALTURN;
|
|
|
|
keymove = NORMALKEYMOVE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (BUTTON(gamefunc_Strafe))
|
|
|
|
{
|
|
|
|
if (BUTTON(gamefunc_Turn_Left) && !(g_player[snum].ps->movement_lock&4))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
in.svel -= -keymove;
|
2009-01-14 00:49:26 +00:00
|
|
|
if (BUTTON(gamefunc_Turn_Right) && !(g_player[snum].ps->movement_lock&8))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
in.svel -= keymove;
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (BUTTON(gamefunc_Turn_Left))
|
|
|
|
{
|
|
|
|
turnheldtime += tics;
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
in.avel -= (turnheldtime>=TURBOTURNTIME) ? (turnamount<<1) : (PREAMBLETURN<<1);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
else if (BUTTON(gamefunc_Turn_Right))
|
|
|
|
{
|
|
|
|
turnheldtime += tics;
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
in.avel += (turnheldtime>=TURBOTURNTIME) ? (turnamount<<1) : (PREAMBLETURN<<1);
|
2009-01-14 00:49:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
turnheldtime=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (BUTTON(gamefunc_Strafe_Left) && !(g_player[snum].ps->movement_lock&4))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
in.svel += keymove;
|
2009-01-14 00:49:26 +00:00
|
|
|
if (BUTTON(gamefunc_Strafe_Right) && !(g_player[snum].ps->movement_lock&8))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
in.svel += -keymove;
|
2009-01-14 00:49:26 +00:00
|
|
|
if (BUTTON(gamefunc_Move_Forward) && !(g_player[snum].ps->movement_lock&1))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
in.fvel += keymove;
|
2009-01-14 00:49:26 +00:00
|
|
|
if (BUTTON(gamefunc_Move_Backward) && !(g_player[snum].ps->movement_lock&2))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
in.fvel += -keymove;
|
2009-01-14 00:49:26 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
in.fvel = clamp(in.fvel, -MAXVEL, MAXVEL);
|
|
|
|
in.svel = clamp(in.svel, -MAXSVEL, MAXSVEL);
|
|
|
|
in.avel = clamp(in.avel, -MAXANGVEL, MAXANGVEL);
|
|
|
|
in.horz = clamp(in.horz, -MAXHORIZ, MAXHORIZ);
|
2009-01-14 00:49:26 +00:00
|
|
|
|
2014-10-29 17:08:03 +00:00
|
|
|
for (j = gamefunc_Weapon_10; j >= gamefunc_Weapon_1; j--)
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
{
|
|
|
|
if (BUTTON(j))
|
|
|
|
{
|
|
|
|
j -= (gamefunc_Weapon_1 - 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-29 17:08:03 +00:00
|
|
|
if (j == gamefunc_Weapon_1-1)
|
|
|
|
j = 0;
|
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (BUTTON(gamefunc_Previous_Weapon) || (BUTTON(gamefunc_Dpad_Select) && in.fvel < 0))
|
2010-06-22 21:50:01 +00:00
|
|
|
j = 11;
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
if (BUTTON(gamefunc_Next_Weapon) || (BUTTON(gamefunc_Dpad_Select) && in.fvel > 0))
|
2010-06-22 21:50:01 +00:00
|
|
|
j = 12;
|
|
|
|
|
|
|
|
if (BUTTON(gamefunc_Jump) && p->on_ground)
|
2011-02-25 21:50:19 +00:00
|
|
|
g_emuJumpTics = 4;
|
2010-06-22 21:50:01 +00:00
|
|
|
|
2011-02-25 21:50:19 +00:00
|
|
|
loc.bits = (g_emuJumpTics > 0 || BUTTON(gamefunc_Jump))<<SK_JUMP;
|
2010-06-22 21:50:01 +00:00
|
|
|
|
2011-02-25 21:50:19 +00:00
|
|
|
if (g_emuJumpTics > 0)
|
|
|
|
g_emuJumpTics--;
|
2010-06-22 21:50:01 +00:00
|
|
|
|
|
|
|
loc.bits |= BUTTON(gamefunc_Crouch)<<SK_CROUCH;
|
|
|
|
loc.bits |= BUTTON(gamefunc_Fire)<<SK_FIRE;
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
loc.bits |= (BUTTON(gamefunc_Aim_Up) || (BUTTON(gamefunc_Dpad_Aiming) && in.fvel > 0))<<SK_AIM_UP;
|
|
|
|
loc.bits |= (BUTTON(gamefunc_Aim_Down) || (BUTTON(gamefunc_Dpad_Aiming) && in.fvel < 0))<<SK_AIM_DOWN;
|
2014-10-29 17:08:03 +00:00
|
|
|
loc.bits |= ((ud.runkey_mode) ? (ud.auto_run | BUTTON(gamefunc_Run)) : (BUTTON(gamefunc_Run) ^ ud.auto_run))<<SK_RUN;
|
2010-06-22 21:50:01 +00:00
|
|
|
loc.bits |= BUTTON(gamefunc_Look_Left)<<SK_LOOK_LEFT;
|
|
|
|
loc.bits |= BUTTON(gamefunc_Look_Right)<<SK_LOOK_RIGHT;
|
|
|
|
loc.bits |= j<<SK_WEAPON_BITS;
|
|
|
|
loc.bits |= BUTTON(gamefunc_Steroids)<<SK_STEROIDS;
|
|
|
|
loc.bits |= BUTTON(gamefunc_Look_Up)<<SK_LOOK_UP;
|
|
|
|
loc.bits |= BUTTON(gamefunc_Look_Down)<<SK_LOOK_DOWN;
|
|
|
|
loc.bits |= BUTTON(gamefunc_NightVision)<<SK_NIGHTVISION;
|
|
|
|
loc.bits |= BUTTON(gamefunc_MedKit)<<SK_MEDKIT;
|
|
|
|
loc.bits |= BUTTON(gamefunc_Center_View)<<SK_CENTER_VIEW;
|
|
|
|
loc.bits |= BUTTON(gamefunc_Holster_Weapon)<<SK_HOLSTER;
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
loc.bits |= (BUTTON(gamefunc_Inventory_Left) || (BUTTON(gamefunc_Dpad_Select) && (in.svel > 0 || in.avel < 0))) <<SK_INV_LEFT;
|
2010-06-22 21:50:01 +00:00
|
|
|
loc.bits |= KB_KeyPressed(sc_Pause)<<SK_PAUSE;
|
|
|
|
loc.bits |= BUTTON(gamefunc_Quick_Kick)<<SK_QUICK_KICK;
|
|
|
|
loc.bits |= g_myAimMode<<SK_AIMMODE;
|
|
|
|
loc.bits |= BUTTON(gamefunc_Holo_Duke)<<SK_HOLODUKE;
|
|
|
|
loc.bits |= BUTTON(gamefunc_Jetpack)<<SK_JETPACK;
|
2013-05-04 16:36:08 +00:00
|
|
|
loc.bits |= (g_gameQuit<<SK_GAMEQUIT);
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
loc.bits |= (BUTTON(gamefunc_Inventory_Right) || (BUTTON(gamefunc_Dpad_Select) && (in.svel < 0 || in.avel > 0))) <<SK_INV_RIGHT;
|
2010-06-22 21:50:01 +00:00
|
|
|
loc.bits |= BUTTON(gamefunc_TurnAround)<<SK_TURNAROUND;
|
|
|
|
loc.bits |= BUTTON(gamefunc_Open)<<SK_OPEN;
|
|
|
|
loc.bits |= BUTTON(gamefunc_Inventory)<<SK_INVENTORY;
|
2013-05-04 16:36:08 +00:00
|
|
|
loc.bits |= ((uint32_t)KB_KeyPressed(sc_Escape))<<SK_ESCAPE;
|
2010-06-22 21:50:01 +00:00
|
|
|
|
|
|
|
if (BUTTON(gamefunc_Dpad_Select))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
in.fvel = in.svel = in.avel = 0;
|
2010-06-22 21:50:01 +00:00
|
|
|
|
|
|
|
if (BUTTON(gamefunc_Dpad_Aiming))
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
in.fvel = 0;
|
2010-06-22 21:50:01 +00:00
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, g_player[snum].ps->curr_weapon, Flags) & WEAPON_SEMIAUTO && BUTTON(gamefunc_Fire))
|
2010-07-03 08:53:57 +00:00
|
|
|
CONTROL_ClearButton(gamefunc_Fire);
|
|
|
|
|
2014-10-29 17:08:03 +00:00
|
|
|
loc.extbits = (BUTTON(gamefunc_Move_Forward) || (in.fvel > 0));
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
loc.extbits |= (BUTTON(gamefunc_Move_Backward) || (in.fvel < 0))<<1;
|
|
|
|
loc.extbits |= (BUTTON(gamefunc_Strafe_Left) || (in.svel > 0))<<2;
|
|
|
|
loc.extbits |= (BUTTON(gamefunc_Strafe_Right) || (in.svel < 0))<<3;
|
2011-04-07 01:16:29 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (VM_HaveEvent(EVENT_PROCESSINPUT) || VM_HaveEvent(EVENT_TURNLEFT))
|
2009-01-14 00:49:26 +00:00
|
|
|
loc.extbits |= BUTTON(gamefunc_Turn_Left)<<4;
|
2011-04-07 01:16:29 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (VM_HaveEvent(EVENT_PROCESSINPUT) || VM_HaveEvent(EVENT_TURNRIGHT))
|
2009-01-14 00:49:26 +00:00
|
|
|
loc.extbits |= BUTTON(gamefunc_Turn_Right)<<5;
|
2011-04-07 01:16:29 +00:00
|
|
|
|
2009-01-14 00:49:26 +00:00
|
|
|
// used for changing team
|
|
|
|
loc.extbits |= (g_player[snum].pteam != g_player[snum].ps->team)<<6;
|
|
|
|
|
|
|
|
if (ud.scrollmode && ud.overhead_on)
|
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
ud.folfvel = in.fvel;
|
|
|
|
ud.folavel = in.avel;
|
2010-06-22 21:50:01 +00:00
|
|
|
loc.fvel = loc.svel = loc.avel = loc.horz = 0;
|
2009-01-14 00:49:26 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
loc.fvel =
|
2014-11-22 12:28:12 +00:00
|
|
|
mulscale9(in.fvel, sintable[(p->ang + 2560) & 2047]) + (mulscale9(in.svel, sintable[(p->ang + 2048) & 2047]));
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
loc.svel =
|
2014-11-22 12:28:12 +00:00
|
|
|
mulscale9(in.fvel, sintable[(p->ang + 2048) & 2047]) + (mulscale9(in.svel, sintable[(p->ang + 1536) & 2047]));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
loc.avel = in.avel;
|
|
|
|
loc.horz = in.horz;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2013-12-28 17:04:31 +00:00
|
|
|
static int32_t P_DoCounters(int32_t snum)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-28 17:04:31 +00:00
|
|
|
DukePlayer_t *const p = g_player[snum].ps;
|
2007-02-05 01:33:08 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
// j = g_player[snum].sync->avel;
|
|
|
|
// p->weapon_ang = -(j/5);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (p->invdisptime > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
p->invdisptime--;
|
|
|
|
|
2013-03-31 18:58:09 +00:00
|
|
|
if (p->tipincs > 0)
|
|
|
|
p->tipincs--;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (p->last_pissed_time > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-05-14 18:12:27 +00:00
|
|
|
switch (--p->last_pissed_time)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-05-14 18:12:27 +00:00
|
|
|
case GAMETICSPERSEC*219:
|
|
|
|
{
|
|
|
|
A_PlaySound(FLUSH_TOILET,p->i);
|
|
|
|
if (snum == screenpeek || GTFLAGS(GAMETYPE_COOPSOUND))
|
|
|
|
A_PlaySound(DUKE_PISSRELIEF,p->i);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GAMETICSPERSEC*218:
|
|
|
|
{
|
|
|
|
p->holster_weapon = 0;
|
2013-06-27 23:04:57 +00:00
|
|
|
p->weapon_pos = WEAPON_POS_RAISE;
|
2012-05-14 18:12:27 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (p->crack_time > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-05-14 18:12:27 +00:00
|
|
|
if (--p->crack_time == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
p->knuckle_incs = 1;
|
|
|
|
p->crack_time = 777;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-15 05:53:15 +00:00
|
|
|
if (p->inv_amount[GET_STEROIDS] > 0 && p->inv_amount[GET_STEROIDS] < 400)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-05-14 18:12:27 +00:00
|
|
|
if (--p->inv_amount[GET_STEROIDS] == 0)
|
2008-12-01 10:44:18 +00:00
|
|
|
P_SelectNextInvItem(p);
|
2012-05-14 18:12:27 +00:00
|
|
|
|
2009-12-15 05:53:15 +00:00
|
|
|
if (!(p->inv_amount[GET_STEROIDS]&7))
|
2008-11-20 14:06:36 +00:00
|
|
|
if (snum == screenpeek || GTFLAGS(GAMETYPE_COOPSOUND))
|
|
|
|
A_PlaySound(DUKE_HARTBEAT,p->i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2009-12-15 05:53:15 +00:00
|
|
|
if (p->heat_on && p->inv_amount[GET_HEATS] > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-05-14 18:12:27 +00:00
|
|
|
if (--p->inv_amount[GET_HEATS] == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
p->heat_on = 0;
|
2008-12-01 10:44:18 +00:00
|
|
|
P_SelectNextInvItem(p);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(NITEVISION_ONOFF,p->i);
|
|
|
|
P_UpdateScreenPal(p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
if (p->holoduke_on >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-05-14 18:12:27 +00:00
|
|
|
if (--p->inv_amount[GET_HOLODUKE] <= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(TELEPORTER,p->i);
|
2006-04-13 20:47:06 +00:00
|
|
|
p->holoduke_on = -1;
|
2008-12-01 10:44:18 +00:00
|
|
|
P_SelectNextInvItem(p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-15 05:53:15 +00:00
|
|
|
if (p->jetpack_on && p->inv_amount[GET_JETPACK] > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-05-14 18:12:27 +00:00
|
|
|
if (--p->inv_amount[GET_JETPACK] <= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
p->jetpack_on = 0;
|
2008-12-01 10:44:18 +00:00
|
|
|
P_SelectNextInvItem(p);
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(DUKE_JETPACK_OFF,p->i);
|
2009-07-15 01:26:38 +00:00
|
|
|
S_StopEnvSound(DUKE_JETPACK_IDLE,p->i);
|
|
|
|
S_StopEnvSound(DUKE_JETPACK_ON,p->i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (p->quick_kick > 0 && sprite[p->i].pal != 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-09-11 09:24:45 +00:00
|
|
|
p->last_quick_kick = p->quick_kick+1;
|
2012-05-14 18:12:27 +00:00
|
|
|
|
|
|
|
if (--p->quick_kick == 8)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_Shoot(p->i,KNEE);
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
2008-09-11 09:24:45 +00:00
|
|
|
else if (p->last_quick_kick > 0) p->last_quick_kick--;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (p->access_incs && sprite[p->i].pal != 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
p->access_incs++;
|
2006-11-13 23:12:47 +00:00
|
|
|
if (sprite[p->i].extra <= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
p->access_incs = 12;
|
2012-05-14 18:12:27 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (p->access_incs == 12)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (p->access_spritenum >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
P_ActivateSwitch(snum,p->access_spritenum,1);
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (sprite[p->access_spritenum].pal)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case 0:
|
|
|
|
p->got_access &= (0xffff-0x1);
|
|
|
|
break;
|
|
|
|
case 21:
|
|
|
|
p->got_access &= (0xffff-0x2);
|
|
|
|
break;
|
|
|
|
case 23:
|
|
|
|
p->got_access &= (0xffff-0x4);
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
p->access_spritenum = -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
P_ActivateSwitch(snum,p->access_wallnum,0);
|
2006-11-13 23:12:47 +00:00
|
|
|
switch (wall[p->access_wallnum].pal)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case 0:
|
|
|
|
p->got_access &= (0xffff-0x1);
|
|
|
|
break;
|
|
|
|
case 21:
|
|
|
|
p->got_access &= (0xffff-0x2);
|
|
|
|
break;
|
|
|
|
case 23:
|
|
|
|
p->got_access &= (0xffff-0x4);
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (p->access_incs > 20)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
p->access_incs = 0;
|
2013-06-27 23:04:57 +00:00
|
|
|
p->weapon_pos = WEAPON_POS_RAISE;
|
2006-04-13 20:47:06 +00:00
|
|
|
p->kickback_pic = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if (p->cursectnum >= 0 && p->scuba_on == 0 && sector[p->cursectnum].lotag == ST_2_UNDERWATER)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-12-15 05:53:15 +00:00
|
|
|
if (p->inv_amount[GET_SCUBA] > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
p->scuba_on = 1;
|
2012-11-04 23:41:05 +00:00
|
|
|
p->inven_icon = ICON_SCUBA;
|
2011-02-25 21:50:19 +00:00
|
|
|
P_DoQuote(QUOTE_SCUBA_ON,p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (p->airleft > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
p->airleft--;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->extra_extra8 += 32;
|
2007-08-27 23:11:49 +00:00
|
|
|
if (p->last_extra < (p->max_player_health>>1) && (p->last_extra&3) == 0)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(DUKE_LONGTERM_PAIN,p->i);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-12-15 05:53:15 +00:00
|
|
|
else if (p->inv_amount[GET_SCUBA] > 0 && p->scuba_on)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-12-15 05:53:15 +00:00
|
|
|
p->inv_amount[GET_SCUBA]--;
|
|
|
|
if (p->inv_amount[GET_SCUBA] == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
p->scuba_on = 0;
|
2008-12-01 10:44:18 +00:00
|
|
|
P_SelectNextInvItem(p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (p->knuckle_incs)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-05-14 18:12:27 +00:00
|
|
|
if (++p->knuckle_incs == 10)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-13 23:12:47 +00:00
|
|
|
if (totalclock > 1024)
|
2008-11-20 14:06:36 +00:00
|
|
|
if (snum == screenpeek || GTFLAGS(GAMETYPE_COOPSOUND))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (rand()&1)
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(DUKE_CRACK,p->i);
|
|
|
|
else A_PlaySound(DUKE_CRACK2,p->i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
A_PlaySound(DUKE_CRACK_FIRST,p->i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else if (p->knuckle_incs == 22 || TEST_SYNC_KEY(g_player[snum].sync->bits, SK_FIRE))
|
2006-04-13 20:47:06 +00:00
|
|
|
p->knuckle_incs=0;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int16_t WeaponPickupSprites[MAX_WEAPONS] = { KNEE__STATIC, FIRSTGUNSPRITE__STATIC, SHOTGUNSPRITE__STATIC,
|
2008-11-20 14:06:36 +00:00
|
|
|
CHAINGUNSPRITE__STATIC, RPGSPRITE__STATIC, HEAVYHBOMB__STATIC, SHRINKERSPRITE__STATIC, DEVISTATORSPRITE__STATIC,
|
|
|
|
TRIPBOMBSPRITE__STATIC, FREEZESPRITE__STATIC, HEAVYHBOMB__STATIC, SHRINKERSPRITE__STATIC
|
2009-01-13 04:40:56 +00:00
|
|
|
};
|
2008-11-21 12:14:05 +00:00
|
|
|
// this is used for player deaths
|
2013-12-28 17:04:31 +00:00
|
|
|
void P_DropWeapon(int32_t snum)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-28 17:04:31 +00:00
|
|
|
const DukePlayer_t *const p = g_player[snum].ps;
|
2013-12-28 17:04:27 +00:00
|
|
|
int32_t cw = PWEAPON(snum, p->curr_weapon, WorksLike);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-12-28 17:04:27 +00:00
|
|
|
if ((unsigned)cw >= MAX_WEAPONS)
|
|
|
|
return;
|
2012-05-14 18:12:27 +00:00
|
|
|
|
2009-01-31 00:02:14 +00:00
|
|
|
if (krand()&1)
|
2012-05-14 18:12:27 +00:00
|
|
|
A_Spawn(p->i, WeaponPickupSprites[cw]);
|
2009-01-31 00:02:14 +00:00
|
|
|
else switch (cw)
|
2009-02-19 09:39:19 +00:00
|
|
|
{
|
2009-01-31 00:02:14 +00:00
|
|
|
case RPG_WEAPON:
|
|
|
|
case HANDBOMB_WEAPON:
|
2012-05-14 18:12:27 +00:00
|
|
|
A_Spawn(p->i, EXPLOSION2);
|
2009-01-31 00:02:14 +00:00
|
|
|
break;
|
2009-02-19 09:39:19 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2009-01-18 07:32:35 +00:00
|
|
|
void P_AddAmmo(int32_t weapon,DukePlayer_t *p,int32_t amount)
|
|
|
|
{
|
|
|
|
p->ammo_amount[weapon] += amount;
|
|
|
|
|
|
|
|
if (p->ammo_amount[weapon] > p->max_ammo_amount[weapon])
|
|
|
|
p->ammo_amount[weapon] = p->max_ammo_amount[weapon];
|
|
|
|
}
|
|
|
|
|
2013-12-26 19:45:00 +00:00
|
|
|
static void P_AddWeaponNoSwitch(DukePlayer_t *p, int32_t weapon)
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
2013-12-28 17:04:27 +00:00
|
|
|
int32_t snum = P_Get(p->i); // PASS_SNUM?
|
2009-01-18 07:32:35 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if ((p->gotweapon & (1<<weapon)) == 0)
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->gotweapon |= (1<<weapon);
|
2012-05-14 18:12:27 +00:00
|
|
|
|
2009-01-18 07:32:35 +00:00
|
|
|
if (weapon == SHRINKER_WEAPON)
|
2010-05-02 23:27:30 +00:00
|
|
|
p->gotweapon |= (1<<GROW_WEAPON);
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, SelectSound) > 0)
|
|
|
|
S_StopEnvSound(PWEAPON(snum, p->curr_weapon, SelectSound),p->i);
|
2010-08-08 00:06:26 +00:00
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, weapon, SelectSound) > 0)
|
|
|
|
A_PlaySound(PWEAPON(snum, weapon, SelectSound),p->i);
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
|
|
|
|
2013-12-28 17:04:31 +00:00
|
|
|
static void P_ChangeWeapon(DukePlayer_t *p, int32_t weapon)
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
2013-12-28 17:04:27 +00:00
|
|
|
int32_t i = 0, snum = P_Get(p->i); // PASS_SNUM?
|
2013-12-26 19:44:56 +00:00
|
|
|
const int8_t curr_weapon = p->curr_weapon;
|
2009-01-18 07:32:35 +00:00
|
|
|
|
2013-12-28 17:04:27 +00:00
|
|
|
if (p->reloading)
|
|
|
|
return;
|
2009-01-18 07:32:35 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (p->curr_weapon != weapon && VM_HaveEvent(EVENT_CHANGEWEAPON))
|
2014-11-22 12:29:25 +00:00
|
|
|
i = VM_OnEventWithReturn(EVENT_CHANGEWEAPON,p->i, snum, weapon);
|
2012-09-13 07:06:11 +00:00
|
|
|
|
|
|
|
if (i == -1)
|
2012-08-27 03:53:59 +00:00
|
|
|
return;
|
2013-12-26 19:44:56 +00:00
|
|
|
|
|
|
|
if (i != -2)
|
2012-09-13 07:06:11 +00:00
|
|
|
p->curr_weapon = weapon;
|
|
|
|
|
2009-01-18 07:32:35 +00:00
|
|
|
p->random_club_frame = 0;
|
|
|
|
|
2012-05-14 18:12:27 +00:00
|
|
|
if (p->weapon_pos == 0)
|
2015-01-13 12:56:36 +00:00
|
|
|
{
|
2012-05-14 18:12:27 +00:00
|
|
|
p->weapon_pos = -1;
|
2015-01-13 12:56:36 +00:00
|
|
|
p->last_weapon = curr_weapon;
|
|
|
|
}
|
2015-01-11 04:51:17 +00:00
|
|
|
else if ((unsigned)p->weapon_pos < WEAPON_POS_RAISE)
|
2015-01-13 12:56:36 +00:00
|
|
|
{
|
2015-01-11 04:51:17 +00:00
|
|
|
p->weapon_pos = -p->weapon_pos;
|
2015-01-13 12:56:36 +00:00
|
|
|
p->last_weapon = curr_weapon;
|
|
|
|
}
|
|
|
|
else if (p->last_weapon == weapon)
|
|
|
|
{
|
|
|
|
p->last_weapon = -1;
|
|
|
|
p->weapon_pos = -p->weapon_pos;
|
|
|
|
}
|
2012-05-14 18:12:27 +00:00
|
|
|
|
|
|
|
if (p->holster_weapon)
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
2014-03-22 09:25:51 +00:00
|
|
|
#ifdef __ANDROID__
|
2014-04-12 08:45:50 +00:00
|
|
|
CONTROL_Android_SetLastWeapon(p->last_weapon);
|
2014-03-22 09:25:51 +00:00
|
|
|
#endif
|
|
|
|
|
2013-06-27 23:04:57 +00:00
|
|
|
p->weapon_pos = WEAPON_POS_RAISE;
|
2009-01-18 07:32:35 +00:00
|
|
|
p->holster_weapon = 0;
|
|
|
|
p->last_weapon = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
p->kickback_pic = 0;
|
|
|
|
|
2013-01-20 21:16:54 +00:00
|
|
|
P_SetWeaponGamevars(snum, p);
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
|
|
|
|
2013-12-26 19:45:00 +00:00
|
|
|
void P_AddWeapon(DukePlayer_t *p, int32_t weapon, int32_t doswitch)
|
2012-09-13 07:06:11 +00:00
|
|
|
{
|
|
|
|
P_AddWeaponNoSwitch(p, weapon);
|
2013-12-26 19:45:00 +00:00
|
|
|
if (doswitch)
|
|
|
|
P_ChangeWeapon(p, weapon);
|
2012-09-13 07:06:11 +00:00
|
|
|
}
|
|
|
|
|
2009-01-18 07:32:35 +00:00
|
|
|
void P_SelectNextInvItem(DukePlayer_t *p)
|
|
|
|
{
|
2009-12-15 05:53:15 +00:00
|
|
|
if (p->inv_amount[GET_FIRSTAID] > 0)
|
2012-11-04 23:41:05 +00:00
|
|
|
p->inven_icon = ICON_FIRSTAID;
|
2009-12-15 05:53:15 +00:00
|
|
|
else if (p->inv_amount[GET_STEROIDS] > 0)
|
2012-11-04 23:41:05 +00:00
|
|
|
p->inven_icon = ICON_STEROIDS;
|
2009-12-15 05:53:15 +00:00
|
|
|
else if (p->inv_amount[GET_JETPACK] > 0)
|
2012-11-04 23:41:05 +00:00
|
|
|
p->inven_icon = ICON_JETPACK;
|
2012-05-14 18:12:27 +00:00
|
|
|
else if (p->inv_amount[GET_HOLODUKE] > 0)
|
2012-11-04 23:41:05 +00:00
|
|
|
p->inven_icon = ICON_HOLODUKE;
|
2009-12-15 05:53:15 +00:00
|
|
|
else if (p->inv_amount[GET_HEATS] > 0)
|
2012-11-04 23:41:05 +00:00
|
|
|
p->inven_icon = ICON_HEATS;
|
2009-12-15 05:53:15 +00:00
|
|
|
else if (p->inv_amount[GET_SCUBA] > 0)
|
2012-11-04 23:41:05 +00:00
|
|
|
p->inven_icon = ICON_SCUBA;
|
2009-12-15 05:53:15 +00:00
|
|
|
else if (p->inv_amount[GET_BOOTS] > 0)
|
2012-11-04 23:41:05 +00:00
|
|
|
p->inven_icon = ICON_BOOTS;
|
|
|
|
else p->inven_icon = ICON_NONE;
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void P_CheckWeapon(DukePlayer_t *p)
|
|
|
|
{
|
2012-09-13 07:06:11 +00:00
|
|
|
int32_t i, snum, weapon;
|
2009-01-18 07:32:35 +00:00
|
|
|
|
2013-12-26 19:44:56 +00:00
|
|
|
if (p->reloading)
|
|
|
|
return;
|
2009-01-18 07:32:35 +00:00
|
|
|
|
|
|
|
if (p->wantweaponfire >= 0)
|
|
|
|
{
|
2012-09-13 07:06:11 +00:00
|
|
|
weapon = p->wantweaponfire;
|
2009-01-18 07:32:35 +00:00
|
|
|
p->wantweaponfire = -1;
|
|
|
|
|
2013-12-26 19:44:56 +00:00
|
|
|
if (weapon == p->curr_weapon)
|
|
|
|
return;
|
|
|
|
|
2012-09-13 07:06:11 +00:00
|
|
|
if ((p->gotweapon & (1<<weapon)) && p->ammo_amount[weapon] > 0)
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
2013-12-26 19:45:00 +00:00
|
|
|
P_AddWeapon(p, weapon, 1);
|
2009-01-18 07:32:35 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-13 07:06:11 +00:00
|
|
|
weapon = p->curr_weapon;
|
2012-05-14 18:12:27 +00:00
|
|
|
|
2012-09-13 07:06:11 +00:00
|
|
|
if ((p->gotweapon & (1<<weapon)) && (p->ammo_amount[weapon] > 0 || !(p->weaponswitch & 2)))
|
2009-01-18 07:32:35 +00:00
|
|
|
return;
|
|
|
|
|
2013-12-28 17:04:27 +00:00
|
|
|
snum = P_Get(p->i);
|
2009-01-18 07:32:35 +00:00
|
|
|
|
2013-12-26 19:44:56 +00:00
|
|
|
for (i=0; i<=FREEZE_WEAPON; i++)
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
2012-09-13 07:06:11 +00:00
|
|
|
weapon = g_player[snum].wchoice[i];
|
2013-12-26 19:44:56 +00:00
|
|
|
if (VOLUMEONE && weapon > SHRINKER_WEAPON)
|
|
|
|
continue;
|
2009-01-18 07:32:35 +00:00
|
|
|
|
2013-12-26 19:44:56 +00:00
|
|
|
if (weapon == KNEE_WEAPON)
|
|
|
|
weapon = FREEZE_WEAPON;
|
2012-09-13 07:06:11 +00:00
|
|
|
else weapon--;
|
2009-01-18 07:32:35 +00:00
|
|
|
|
2013-12-26 19:44:56 +00:00
|
|
|
if (weapon == KNEE_WEAPON || ((p->gotweapon & (1<<weapon)) && p->ammo_amount[weapon] > 0))
|
2009-01-18 07:32:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-12-26 19:44:56 +00:00
|
|
|
if (i == HANDREMOTE_WEAPON)
|
|
|
|
weapon = KNEE_WEAPON;
|
2009-01-18 07:32:35 +00:00
|
|
|
|
|
|
|
// Found the weapon
|
|
|
|
|
2012-09-13 07:06:11 +00:00
|
|
|
P_ChangeWeapon(p, weapon);
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
|
|
|
|
2013-02-24 16:05:47 +00:00
|
|
|
#ifdef LUNATIC
|
|
|
|
void P_CheckWeaponI(int32_t snum)
|
|
|
|
{
|
|
|
|
P_CheckWeapon(g_player[snum].ps);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-12-26 19:45:14 +00:00
|
|
|
static void DoWallTouchDamage(const DukePlayer_t *p, int32_t obj)
|
|
|
|
{
|
|
|
|
vec3_t davect;
|
|
|
|
|
|
|
|
davect.x = p->pos.x + (sintable[(p->ang+512)&2047]>>9);
|
|
|
|
davect.y = p->pos.y + (sintable[p->ang&2047]>>9);
|
|
|
|
davect.z = p->pos.z;
|
|
|
|
|
|
|
|
A_DamageWall(p->i, obj, &davect, -1);
|
|
|
|
}
|
|
|
|
|
2013-01-20 21:17:19 +00:00
|
|
|
static void P_CheckTouchDamage(DukePlayer_t *p, int32_t obj)
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
if ((obj = VM_OnEventWithReturn(EVENT_CHECKTOUCHDAMAGE, p->i, P_Get(p->i), obj)) == -1)
|
2012-05-16 00:45:10 +00:00
|
|
|
return;
|
2012-05-14 18:12:27 +00:00
|
|
|
|
2012-05-17 23:54:43 +00:00
|
|
|
if ((obj&49152) == 49152)
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
2013-12-26 19:45:14 +00:00
|
|
|
obj &= MAXSPRITES-1;
|
2009-01-18 07:32:35 +00:00
|
|
|
|
2012-05-17 23:54:43 +00:00
|
|
|
if (sprite[obj].picnum == CACTUS)
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
|
|
|
if (p->hurt_delay < 8)
|
|
|
|
{
|
|
|
|
sprite[p->i].extra -= 5;
|
|
|
|
|
|
|
|
p->hurt_delay = 16;
|
2012-05-05 22:24:50 +00:00
|
|
|
P_PalFrom(p, 32, 32,0,0);
|
2013-12-26 19:45:14 +00:00
|
|
|
A_PlaySound(DUKE_LONGTERM_PAIN, p->i);
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-12-26 19:45:14 +00:00
|
|
|
if ((obj&49152) != 32768)
|
|
|
|
return;
|
|
|
|
|
2012-05-17 23:54:43 +00:00
|
|
|
obj &= (MAXWALLS-1);
|
2009-01-18 07:32:35 +00:00
|
|
|
|
2013-12-26 19:45:14 +00:00
|
|
|
if (p->hurt_delay > 0)
|
|
|
|
{
|
|
|
|
p->hurt_delay--;
|
|
|
|
}
|
|
|
|
else if (wall[obj].cstat & FORCEFIELD_CSTAT)
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
2013-12-26 19:45:14 +00:00
|
|
|
int32_t switchpicnum = G_GetForcefieldPicnum(obj);
|
2009-01-18 07:32:35 +00:00
|
|
|
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(switchpicnum))
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
|
|
|
case W_FORCEFIELD__STATIC:
|
|
|
|
sprite[p->i].extra -= 5;
|
|
|
|
|
|
|
|
p->hurt_delay = 16;
|
2012-05-05 22:24:50 +00:00
|
|
|
P_PalFrom(p, 32, 32,0,0);
|
2009-01-18 07:32:35 +00:00
|
|
|
|
2011-02-25 21:50:19 +00:00
|
|
|
p->vel.x = -(sintable[(p->ang+512)&2047]<<8);
|
|
|
|
p->vel.y = -(sintable[(p->ang)&2047]<<8);
|
2009-01-18 07:32:35 +00:00
|
|
|
A_PlaySound(DUKE_LONGTERM_PAIN,p->i);
|
|
|
|
|
2013-12-26 19:45:14 +00:00
|
|
|
DoWallTouchDamage(p, obj);
|
2009-01-18 07:32:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BIGFORCE__STATIC:
|
2009-04-26 05:57:42 +00:00
|
|
|
p->hurt_delay = GAMETICSPERSEC;
|
2013-12-26 19:45:14 +00:00
|
|
|
DoWallTouchDamage(p, obj);
|
2009-01-18 07:32:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-20 21:17:19 +00:00
|
|
|
static int32_t P_CheckFloorDamage(DukePlayer_t *p, int32_t tex)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
spritetype *s = &sprite[p->i];
|
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
if ((unsigned)(tex = VM_OnEventWithReturn(EVENT_CHECKFLOORDAMAGE, p->i, P_Get(p->i), tex)) >= MAXTILES)
|
2012-05-16 00:45:10 +00:00
|
|
|
return 0;
|
2012-05-14 18:12:27 +00:00
|
|
|
|
2012-05-17 23:54:43 +00:00
|
|
|
switch (DYNAMICTILEMAP(tex))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
case HURTRAIL__STATIC:
|
|
|
|
if (rnd(32))
|
|
|
|
{
|
|
|
|
if (p->inv_amount[GET_BOOTS] > 0)
|
2012-05-14 18:12:27 +00:00
|
|
|
return 1;
|
2010-05-02 23:27:30 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!A_CheckSoundPlaying(p->i,DUKE_LONGTERM_PAIN))
|
|
|
|
A_PlaySound(DUKE_LONGTERM_PAIN,p->i);
|
2012-05-05 22:24:50 +00:00
|
|
|
|
|
|
|
P_PalFrom(p, 32, 64,64,64);
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
s->extra -= 1+(krand()&3);
|
|
|
|
if (!A_CheckSoundPlaying(p->i,SHORT_CIRCUIT))
|
|
|
|
A_PlaySound(SHORT_CIRCUIT,p->i);
|
2012-05-14 18:12:27 +00:00
|
|
|
|
|
|
|
return 0;
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FLOORSLIME__STATIC:
|
|
|
|
if (rnd(16))
|
|
|
|
{
|
|
|
|
if (p->inv_amount[GET_BOOTS] > 0)
|
2012-05-14 18:12:27 +00:00
|
|
|
return 1;
|
2010-05-02 23:27:30 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!A_CheckSoundPlaying(p->i,DUKE_LONGTERM_PAIN))
|
|
|
|
A_PlaySound(DUKE_LONGTERM_PAIN,p->i);
|
2012-05-05 22:24:50 +00:00
|
|
|
|
|
|
|
P_PalFrom(p, 32, 0,8,0);
|
2010-05-02 23:27:30 +00:00
|
|
|
s->extra -= 1+(krand()&3);
|
2012-05-14 18:12:27 +00:00
|
|
|
|
|
|
|
return 0;
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FLOORPLASMA__STATIC:
|
|
|
|
if (rnd(32))
|
|
|
|
{
|
|
|
|
if (p->inv_amount[GET_BOOTS] > 0)
|
2012-05-14 18:12:27 +00:00
|
|
|
return 1;
|
2010-05-02 23:27:30 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!A_CheckSoundPlaying(p->i,DUKE_LONGTERM_PAIN))
|
|
|
|
A_PlaySound(DUKE_LONGTERM_PAIN,p->i);
|
2012-05-05 22:24:50 +00:00
|
|
|
|
|
|
|
P_PalFrom(p, 32, 8,0,0);
|
2010-05-02 23:27:30 +00:00
|
|
|
s->extra -= 1+(krand()&3);
|
2012-05-14 18:12:27 +00:00
|
|
|
|
|
|
|
return 0;
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-05-14 18:12:27 +00:00
|
|
|
return 0;
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-28 17:04:27 +00:00
|
|
|
int32_t P_FindOtherPlayer(int32_t p, int32_t *d)
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
|
|
|
int32_t j, closest_player = p;
|
2012-09-02 14:04:16 +00:00
|
|
|
int32_t x, closest = INT32_MAX;
|
2009-01-18 07:32:35 +00:00
|
|
|
|
2012-02-21 19:33:33 +00:00
|
|
|
for (TRAVERSE_CONNECT(j))
|
|
|
|
if (p != j && sprite[g_player[j].ps->i].extra > 0)
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
2012-02-21 19:33:33 +00:00
|
|
|
x = klabs(g_player[j].ps->opos.x-g_player[p].ps->pos.x) +
|
|
|
|
klabs(g_player[j].ps->opos.y-g_player[p].ps->pos.y) +
|
|
|
|
(klabs(g_player[j].ps->opos.z-g_player[p].ps->pos.z)>>4);
|
|
|
|
|
|
|
|
if (x < closest)
|
|
|
|
{
|
|
|
|
closest_player = j;
|
|
|
|
closest = x;
|
|
|
|
}
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
*d = closest;
|
|
|
|
return closest_player;
|
|
|
|
}
|
|
|
|
|
2009-12-14 05:23:29 +00:00
|
|
|
void P_FragPlayer(int32_t snum)
|
|
|
|
{
|
|
|
|
DukePlayer_t *p = g_player[snum].ps;
|
|
|
|
spritetype *s = &sprite[p->i];
|
|
|
|
|
2010-07-19 15:14:00 +00:00
|
|
|
if (g_netServer || g_netClient)
|
|
|
|
randomseed = ticrandomseed;
|
2009-12-14 05:23:29 +00:00
|
|
|
|
|
|
|
if (s->pal != 1)
|
|
|
|
{
|
2012-05-05 22:24:50 +00:00
|
|
|
P_PalFrom(p, 63, 63,0,0);
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
p->pos.z -= (16<<8);
|
2009-12-14 05:23:29 +00:00
|
|
|
s->z -= (16<<8);
|
|
|
|
|
|
|
|
p->dead_flag = (512-((krand()&1)<<10)+(krand()&255)-512)&2047;
|
|
|
|
if (p->dead_flag == 0)
|
|
|
|
p->dead_flag++;
|
2012-12-09 13:24:44 +00:00
|
|
|
#ifndef NETCODE_DISABLE
|
2010-01-16 23:08:17 +00:00
|
|
|
if (g_netServer)
|
2009-12-14 09:54:11 +00:00
|
|
|
{
|
|
|
|
packbuf[0] = PACKET_FRAG;
|
|
|
|
packbuf[1] = snum;
|
|
|
|
packbuf[2] = p->frag_ps;
|
2010-05-02 23:27:30 +00:00
|
|
|
packbuf[3] = actor[p->i].picnum;
|
2010-07-19 15:14:00 +00:00
|
|
|
*(int32_t *)&packbuf[4] = ticrandomseed;
|
|
|
|
packbuf[8] = myconnectindex;
|
2009-12-14 09:54:11 +00:00
|
|
|
|
2010-07-19 15:14:00 +00:00
|
|
|
enet_host_broadcast(g_netServer, CHAN_GAMESTATE, enet_packet_create(packbuf, 9, ENET_PACKET_FLAG_RELIABLE));
|
2009-12-14 09:54:11 +00:00
|
|
|
}
|
2012-12-09 13:24:44 +00:00
|
|
|
#endif
|
2009-12-14 05:23:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
p->jetpack_on = 0;
|
|
|
|
p->holoduke_on = -1;
|
|
|
|
|
|
|
|
S_StopEnvSound(DUKE_JETPACK_IDLE,p->i);
|
2010-06-22 21:50:01 +00:00
|
|
|
if (p->scream_voice > FX_Ok)
|
2009-12-14 05:23:29 +00:00
|
|
|
{
|
|
|
|
FX_StopSound(p->scream_voice);
|
2010-06-22 21:50:01 +00:00
|
|
|
S_Cleanup();
|
2009-12-14 05:23:29 +00:00
|
|
|
// S_TestSoundCallback(DUKE_SCREAM);
|
|
|
|
p->scream_voice = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s->pal != 1 && (s->cstat&32768) == 0) s->cstat = 0;
|
|
|
|
|
2010-01-16 23:08:17 +00:00
|
|
|
if ((g_netServer || ud.multimode > 1) && (s->pal != 1 || (s->cstat&32768)))
|
2009-12-14 05:23:29 +00:00
|
|
|
{
|
|
|
|
if (p->frag_ps != snum)
|
|
|
|
{
|
|
|
|
if (GTFLAGS(GAMETYPE_TDM) && g_player[p->frag_ps].ps->team == g_player[snum].ps->team)
|
|
|
|
g_player[p->frag_ps].ps->fraggedself++;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_player[p->frag_ps].ps->frag++;
|
|
|
|
g_player[p->frag_ps].frags[snum]++;
|
2009-12-15 05:53:15 +00:00
|
|
|
g_player[snum].frags[snum]++; // deaths
|
2009-12-14 05:23:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (snum == screenpeek)
|
|
|
|
{
|
2012-03-26 05:07:12 +00:00
|
|
|
Bsprintf(ScriptQuotes[QUOTE_RESERVED],"Killed by %s",&g_player[p->frag_ps].user_name[0]);
|
2011-02-25 21:50:19 +00:00
|
|
|
P_DoQuote(QUOTE_RESERVED,p);
|
2009-12-14 05:23:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-03-26 05:07:12 +00:00
|
|
|
Bsprintf(ScriptQuotes[QUOTE_RESERVED2],"Killed %s",&g_player[snum].user_name[0]);
|
2011-02-25 21:50:19 +00:00
|
|
|
P_DoQuote(QUOTE_RESERVED2,g_player[p->frag_ps].ps);
|
2009-12-14 05:23:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (ud.obituaries)
|
|
|
|
{
|
2010-08-02 08:13:51 +00:00
|
|
|
Bsprintf(tempbuf,ScriptQuotes[OBITQUOTEINDEX+(krand()%g_numObituaries)],
|
2010-01-23 22:12:02 +00:00
|
|
|
&g_player[p->frag_ps].user_name[0],
|
|
|
|
&g_player[snum].user_name[0]);
|
2009-12-14 05:23:29 +00:00
|
|
|
G_AddUserQuote(tempbuf);
|
|
|
|
}
|
|
|
|
else krand();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[p->i].picnum != APLAYERTOP)
|
2009-12-14 05:23:29 +00:00
|
|
|
{
|
|
|
|
p->fraggedself++;
|
2013-04-07 15:20:41 +00:00
|
|
|
if ((unsigned)p->wackedbyactor < MAXTILES && A_CheckEnemyTile(sprite[p->wackedbyactor].picnum))
|
2010-08-02 08:13:51 +00:00
|
|
|
Bsprintf(tempbuf,ScriptQuotes[OBITQUOTEINDEX+(krand()%g_numObituaries)],"A monster",&g_player[snum].user_name[0]);
|
2010-05-02 23:27:30 +00:00
|
|
|
else if (actor[p->i].picnum == NUKEBUTTON)
|
2009-12-14 05:23:29 +00:00
|
|
|
Bsprintf(tempbuf,"^02%s^02 tried to leave",&g_player[snum].user_name[0]);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// random suicide death string
|
2010-08-02 08:13:51 +00:00
|
|
|
Bsprintf(tempbuf,ScriptQuotes[SUICIDEQUOTEINDEX+(krand()%g_numSelfObituaries)],&g_player[snum].user_name[0]);
|
2009-12-14 05:23:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else Bsprintf(tempbuf,"^02%s^02 switched to team %d",&g_player[snum].user_name[0],p->team+1);
|
|
|
|
|
|
|
|
if (ud.obituaries)
|
|
|
|
G_AddUserQuote(tempbuf);
|
|
|
|
}
|
|
|
|
p->frag_ps = snum;
|
|
|
|
pus = NUMPAGES;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-20 21:16:58 +00:00
|
|
|
#ifdef LUNATIC
|
|
|
|
# define PIPEBOMB_CONTROL(snum) (g_player[snum].ps->pipebombControl)
|
|
|
|
#else
|
|
|
|
# define PIPEBOMB_CONTROL(snum) (Gv_GetVarByLabel("PIPEBOMB_CONTROL", PIPEBOMB_REMOTE, -1, snum))
|
|
|
|
#endif
|
|
|
|
|
2013-01-01 15:24:14 +00:00
|
|
|
static void P_ProcessWeapon(int32_t snum)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-29 15:21:28 +00:00
|
|
|
DukePlayer_t *const p = g_player[snum].ps;
|
|
|
|
uint8_t *const kb = &p->kickback_pic;
|
|
|
|
const int32_t shrunk = (sprite[p->i].yrepeat < 32);
|
2010-05-02 23:27:30 +00:00
|
|
|
uint32_t sb_snum = g_player[snum].sync->bits;
|
|
|
|
int32_t i, j, k;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
switch (p->weapon_pos)
|
|
|
|
{
|
2014-02-02 22:18:21 +00:00
|
|
|
case WEAPON_POS_LOWER:
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->last_weapon >= 0)
|
|
|
|
{
|
2013-06-27 23:04:57 +00:00
|
|
|
p->weapon_pos = WEAPON_POS_RAISE;
|
2010-05-02 23:27:30 +00:00
|
|
|
p->last_weapon = -1;
|
|
|
|
}
|
|
|
|
else if (p->holster_weapon == 0)
|
2013-06-27 23:04:57 +00:00
|
|
|
p->weapon_pos = WEAPON_POS_RAISE;
|
2010-05-02 23:27:30 +00:00
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
p->weapon_pos--;
|
|
|
|
break;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_FIRE))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-01-20 21:16:54 +00:00
|
|
|
P_SetWeaponGamevars(snum, p);
|
2012-05-16 00:45:10 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_PRESSEDFIRE, p->i, snum) != 0)
|
2008-11-20 14:06:36 +00:00
|
|
|
sb_snum &= ~BIT(SK_FIRE);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_HOLSTER)) // 'Holster Weapon
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-01-20 21:16:54 +00:00
|
|
|
P_SetWeaponGamevars(snum, p);
|
2012-05-16 00:45:10 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_HOLSTER, p->i, snum) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-10-25 03:27:01 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, WorksLike) != KNEE_WEAPON)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
if (p->holster_weapon == 0 && p->weapon_pos == 0)
|
|
|
|
{
|
|
|
|
p->holster_weapon = 1;
|
|
|
|
p->weapon_pos = -1;
|
2011-02-25 21:50:19 +00:00
|
|
|
P_DoQuote(QUOTE_WEAPON_LOWERED,p);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
2013-06-27 23:04:57 +00:00
|
|
|
else if (p->holster_weapon == 1 && p->weapon_pos == WEAPON_POS_LOWER)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
p->holster_weapon = 0;
|
2013-06-27 23:04:57 +00:00
|
|
|
p->weapon_pos = WEAPON_POS_RAISE;
|
2011-02-25 21:50:19 +00:00
|
|
|
P_DoQuote(QUOTE_WEAPON_RAISED,p);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_HOLSTER_CLEARS_CLIP)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
2013-07-13 21:05:01 +00:00
|
|
|
const int32_t cw=p->curr_weapon, clipcnt = PWEAPON(snum, cw, Clip);
|
|
|
|
|
|
|
|
if (p->ammo_amount[cw] > clipcnt && (p->ammo_amount[cw] % clipcnt) != 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
2013-07-13 21:05:01 +00:00
|
|
|
p->ammo_amount[cw] -= p->ammo_amount[cw] % clipcnt;
|
|
|
|
(*kb) = PWEAPON(snum, cw, TotalTime);
|
2010-05-02 23:27:30 +00:00
|
|
|
sb_snum &= ~BIT(SK_FIRE); // not firing...
|
|
|
|
}
|
2013-07-13 21:05:01 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
return;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_GLOWS)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->random_club_frame += 64; // Glowing
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->kickback_pic == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
spritetype *s = &sprite[p->i];
|
|
|
|
int32_t x = ((sintable[(s->ang+512)&2047])>>7), y = ((sintable[(s->ang)&2047])>>7);
|
|
|
|
int32_t r = 1024+(sintable[p->random_club_frame&2047]>>3);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
s->x += x;
|
|
|
|
s->y += y;
|
2012-12-28 17:18:16 +00:00
|
|
|
G_AddGameLight(0, p->i, PHEIGHT, max(r, 0), PWEAPON(snum, p->curr_weapon, FlashColor),PR_LIGHT_PRIO_HIGH_GAME);
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[p->i].lightcount = 2;
|
|
|
|
s->x -= x;
|
|
|
|
s->y -= y;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
// this is a hack for WEAPON_FIREEVERYOTHER
|
|
|
|
if (actor[p->i].t_data[7])
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[p->i].t_data[7]--;
|
|
|
|
if (p->last_weapon == -1 && actor[p->i].t_data[7] != 0 && ((actor[p->i].t_data[7] & 1) == 0))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_AMMOPERSHOT)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->ammo_amount[p->curr_weapon] > 0)
|
|
|
|
p->ammo_amount[p->curr_weapon]--;
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[p->i].t_data[7] = 0;
|
|
|
|
P_CheckWeapon(p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2010-03-12 05:50:30 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[p->i].t_data[7] != 0)
|
2012-12-28 17:18:16 +00:00
|
|
|
A_Shoot(p->i,PWEAPON(snum, p->curr_weapon, Shoots));
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->rapid_fire_hold == 1)
|
|
|
|
{
|
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_FIRE)) return;
|
|
|
|
p->rapid_fire_hold = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (shrunk || p->tipincs || p->access_incs)
|
|
|
|
sb_snum &= ~BIT(SK_FIRE);
|
|
|
|
else if (shrunk == 0 && (sb_snum&(1<<2)) && (*kb) == 0 && p->fist_incs == 0 &&
|
2010-08-02 08:13:51 +00:00
|
|
|
p->last_weapon == -1 && (p->weapon_pos == 0 || p->holster_weapon == 1))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->crack_time = 777;
|
|
|
|
|
|
|
|
if (p->holster_weapon == 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-06-27 23:04:57 +00:00
|
|
|
if (p->last_pissed_time <= (GAMETICSPERSEC*218) && p->weapon_pos == WEAPON_POS_LOWER)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->holster_weapon = 0;
|
2013-06-27 23:04:57 +00:00
|
|
|
p->weapon_pos = WEAPON_POS_RAISE;
|
2011-02-25 21:50:19 +00:00
|
|
|
P_DoQuote(QUOTE_WEAPON_RAISED,p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-01-20 21:16:54 +00:00
|
|
|
P_SetWeaponGamevars(snum, p);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_FIRE, p->i, snum) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-10-25 03:36:34 +00:00
|
|
|
// this event is deprecated
|
2014-11-22 12:29:25 +00:00
|
|
|
VM_OnEvent(EVENT_FIREWEAPON, p->i, snum);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
switch (PWEAPON(snum, p->curr_weapon, WorksLike))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
case HANDBOMB_WEAPON:
|
|
|
|
p->hbomb_hold_delay = 0;
|
|
|
|
if (p->ammo_amount[p->curr_weapon] > 0)
|
|
|
|
{
|
|
|
|
(*kb)=1;
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, InitialSound) > 0)
|
|
|
|
A_PlaySound(PWEAPON(snum, p->curr_weapon, InitialSound), p->i);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
case HANDREMOTE_WEAPON:
|
|
|
|
p->hbomb_hold_delay = 0;
|
|
|
|
(*kb) = 1;
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, InitialSound) > 0)
|
|
|
|
A_PlaySound(PWEAPON(snum, p->curr_weapon, InitialSound), p->i);
|
2010-05-02 23:27:30 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
case SHOTGUN_WEAPON:
|
|
|
|
if (p->ammo_amount[p->curr_weapon] > 0 && p->random_club_frame == 0)
|
|
|
|
{
|
|
|
|
(*kb)=1;
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, InitialSound) > 0)
|
|
|
|
A_PlaySound(PWEAPON(snum, p->curr_weapon, InitialSound), p->i);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
break;
|
2010-03-12 05:50:30 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
case TRIPBOMB_WEAPON:
|
|
|
|
if (p->ammo_amount[p->curr_weapon] > 0)
|
|
|
|
{
|
2012-08-10 19:12:01 +00:00
|
|
|
hitdata_t hit;
|
2010-05-02 23:27:30 +00:00
|
|
|
hitscan((const vec3_t *)p,
|
2010-08-02 08:13:51 +00:00
|
|
|
p->cursectnum, sintable[(p->ang+512)&2047],
|
|
|
|
sintable[p->ang&2047], (100-p->horiz-p->horizoff)*32,
|
2012-08-10 19:12:01 +00:00
|
|
|
&hit,CLIPMASK1);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:12:01 +00:00
|
|
|
if (hit.sect < 0 || hit.sprite >= 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
// ST_2_UNDERWATER
|
2012-08-10 19:12:01 +00:00
|
|
|
if (hit.wall >= 0 && sector[hit.sect].lotag > 2)
|
2010-05-02 23:27:30 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:12:01 +00:00
|
|
|
if (hit.wall >= 0 && wall[hit.wall].overpicnum >= 0)
|
|
|
|
if (wall[hit.wall].overpicnum == BIGFORCE)
|
2010-05-02 23:27:30 +00:00
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-10 19:12:01 +00:00
|
|
|
j = headspritesect[hit.sect];
|
2010-05-02 23:27:30 +00:00
|
|
|
while (j >= 0)
|
|
|
|
{
|
|
|
|
if (sprite[j].picnum == TRIPBOMB &&
|
2012-08-10 19:12:01 +00:00
|
|
|
klabs(sprite[j].z-hit.pos.z) < (12<<8) &&
|
|
|
|
((sprite[j].x-hit.pos.x)*(sprite[j].x-hit.pos.x)+
|
|
|
|
(sprite[j].y-hit.pos.y)*(sprite[j].y-hit.pos.y)) < (290*290))
|
2010-05-02 23:27:30 +00:00
|
|
|
break;
|
|
|
|
j = nextspritesect[j];
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
// ST_2_UNDERWATER
|
2012-08-10 19:12:01 +00:00
|
|
|
if (j == -1 && hit.wall >= 0 && (wall[hit.wall].cstat&16) == 0)
|
|
|
|
if ((wall[hit.wall].nextsector >= 0 &&
|
|
|
|
sector[wall[hit.wall].nextsector].lotag <= 2) ||
|
|
|
|
(wall[hit.wall].nextsector == -1 && sector[hit.sect].lotag <= 2))
|
|
|
|
if (((hit.pos.x-p->pos.x)*(hit.pos.x-p->pos.x) +
|
|
|
|
(hit.pos.y-p->pos.y)*(hit.pos.y-p->pos.y)) < (290*290))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
p->pos.z = p->opos.z;
|
2011-02-25 21:50:19 +00:00
|
|
|
p->vel.z = 0;
|
2010-05-02 23:27:30 +00:00
|
|
|
(*kb) = 1;
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, InitialSound) > 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
A_PlaySound(PWEAPON(snum, p->curr_weapon, InitialSound), p->i);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
case PISTOL_WEAPON:
|
|
|
|
case CHAINGUN_WEAPON:
|
|
|
|
case SHRINKER_WEAPON:
|
|
|
|
case GROW_WEAPON:
|
|
|
|
case FREEZE_WEAPON:
|
|
|
|
case RPG_WEAPON:
|
|
|
|
if (p->ammo_amount[p->curr_weapon] > 0)
|
|
|
|
{
|
|
|
|
(*kb) = 1;
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, InitialSound) > 0)
|
|
|
|
A_PlaySound(PWEAPON(snum, p->curr_weapon, InitialSound), p->i);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
case DEVISTATOR_WEAPON:
|
|
|
|
if (p->ammo_amount[p->curr_weapon] > 0)
|
|
|
|
{
|
|
|
|
(*kb) = 1;
|
|
|
|
p->hbomb_hold_delay = !p->hbomb_hold_delay;
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, InitialSound) > 0)
|
|
|
|
A_PlaySound(PWEAPON(snum, p->curr_weapon, InitialSound), p->i);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
case KNEE_WEAPON:
|
|
|
|
if (p->quick_kick == 0)
|
|
|
|
{
|
|
|
|
(*kb) = 1;
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, InitialSound) > 0)
|
|
|
|
A_PlaySound(PWEAPON(snum, p->curr_weapon, InitialSound), p->i);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else if (*kb)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, WorksLike) == HANDBOMB_WEAPON)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, HoldDelay) && ((*kb) == PWEAPON(snum, p->curr_weapon, FireDelay)) && TEST_SYNC_KEY(sb_snum, SK_FIRE))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
p->rapid_fire_hold = 1;
|
|
|
|
return;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
if (++(*kb) == PWEAPON(snum, p->curr_weapon, HoldDelay))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
p->ammo_amount[p->curr_weapon]--;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (numplayers < 2 || g_netServer)
|
|
|
|
{
|
2013-01-20 21:16:58 +00:00
|
|
|
int32_t lPipeBombControl;
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->on_ground && TEST_SYNC_KEY(sb_snum, SK_CROUCH))
|
|
|
|
{
|
|
|
|
k = 15;
|
|
|
|
i = ((p->horiz+p->horizoff-100)*20);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
k = 140;
|
|
|
|
i = -512-((p->horiz+p->horizoff-100)*20);
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
j = A_InsertSprite(p->cursectnum,
|
2010-08-02 08:13:51 +00:00
|
|
|
p->pos.x+(sintable[(p->ang+512)&2047]>>6),
|
|
|
|
p->pos.y+(sintable[p->ang&2047]>>6),
|
2012-12-28 17:18:16 +00:00
|
|
|
p->pos.z,PWEAPON(snum, p->curr_weapon, Shoots),-16,9,9,
|
2010-08-02 08:13:51 +00:00
|
|
|
p->ang,(k+(p->hbomb_hold_delay<<5)),i,p->i,1);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-01-20 21:16:58 +00:00
|
|
|
lPipeBombControl = PIPEBOMB_CONTROL(snum);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (lPipeBombControl & PIPEBOMB_TIMER)
|
|
|
|
{
|
2013-01-20 21:16:58 +00:00
|
|
|
#ifdef LUNATIC
|
|
|
|
int32_t ltime = g_player[snum].ps->pipebombLifetime;
|
|
|
|
int32_t lv = g_player[snum].ps->pipebombLifetimeVar;
|
|
|
|
#else
|
|
|
|
int32_t ltime = Gv_GetVarByLabel("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, -1, snum);
|
2010-05-02 23:27:30 +00:00
|
|
|
int32_t lv=Gv_GetVarByLabel("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, -1, snum);
|
2013-01-20 21:16:58 +00:00
|
|
|
#endif
|
|
|
|
actor[j].t_data[7]= ltime
|
2010-08-02 08:13:51 +00:00
|
|
|
+ mulscale(krand(),lv, 14)
|
|
|
|
- lv;
|
2014-01-12 14:54:34 +00:00
|
|
|
// TIMER_CONTROL
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[j].t_data[6]=1;
|
|
|
|
}
|
|
|
|
else actor[j].t_data[6]=2;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (k == 15)
|
|
|
|
{
|
|
|
|
sprite[j].yvel = 3;
|
|
|
|
sprite[j].z += (8<<8);
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (A_GetHitscanRange(p->i) < 512)
|
|
|
|
{
|
|
|
|
sprite[j].ang += 1024;
|
|
|
|
sprite[j].zvel /= 3;
|
|
|
|
sprite[j].xvel /= 3;
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
p->hbomb_on = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2012-12-28 17:18:16 +00:00
|
|
|
else if ((*kb) < PWEAPON(snum, p->curr_weapon, HoldDelay) && TEST_SYNC_KEY(sb_snum, SK_FIRE))
|
2010-05-02 23:27:30 +00:00
|
|
|
p->hbomb_hold_delay++;
|
2012-12-28 17:18:16 +00:00
|
|
|
else if ((*kb) > PWEAPON(snum, p->curr_weapon, TotalTime))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
(*kb) = 0;
|
2013-06-27 23:04:57 +00:00
|
|
|
p->weapon_pos = WEAPON_POS_RAISE;
|
2013-01-20 21:16:58 +00:00
|
|
|
if (PIPEBOMB_CONTROL(snum) == PIPEBOMB_REMOTE)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
p->curr_weapon = HANDREMOTE_WEAPON;
|
|
|
|
p->last_weapon = -1;
|
|
|
|
}
|
|
|
|
else P_CheckWeapon(p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2012-12-28 17:18:16 +00:00
|
|
|
else if (PWEAPON(snum, p->curr_weapon, WorksLike) == HANDREMOTE_WEAPON)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if (++(*kb) == PWEAPON(snum, p->curr_weapon, FireDelay))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_BOMB_TRIGGER)
|
2010-05-02 23:27:30 +00:00
|
|
|
p->hbomb_on = 0;
|
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, Shoots) != 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if (!(PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_NOVISIBLE))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
lastvisinc = totalclock+32;
|
|
|
|
p->visibility = 0;
|
|
|
|
}
|
2013-01-20 21:16:54 +00:00
|
|
|
|
|
|
|
P_SetWeaponGamevars(snum, p);
|
2012-12-28 17:18:16 +00:00
|
|
|
A_Shoot(p->i, PWEAPON(snum, p->curr_weapon, Shoots));
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
if ((*kb) >= PWEAPON(snum, p->curr_weapon, TotalTime))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
(*kb) = 0;
|
2013-12-26 19:44:56 +00:00
|
|
|
if ((p->ammo_amount[HANDBOMB_WEAPON] > 0) && PIPEBOMB_CONTROL(snum) == PIPEBOMB_REMOTE)
|
2013-12-26 19:45:00 +00:00
|
|
|
P_AddWeapon(p, HANDBOMB_WEAPON, 1);
|
2010-05-02 23:27:30 +00:00
|
|
|
else P_CheckWeapon(p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
// the basic weapon...
|
|
|
|
(*kb)++;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_CHECKATRELOAD)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, WorksLike) == TRIPBOMB_WEAPON)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if ((*kb) >= PWEAPON(snum, p->curr_weapon, TotalTime))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
(*kb) = 0;
|
|
|
|
P_CheckWeapon(p);
|
2013-06-27 23:04:57 +00:00
|
|
|
p->weapon_pos = WEAPON_POS_LOWER;
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
}
|
2012-12-28 17:18:16 +00:00
|
|
|
else if (*kb >= PWEAPON(snum, p->curr_weapon, Reload))
|
2010-05-02 23:27:30 +00:00
|
|
|
P_CheckWeapon(p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2012-12-28 17:18:16 +00:00
|
|
|
else if (PWEAPON(snum, p->curr_weapon, WorksLike)!=KNEE_WEAPON && *kb >= PWEAPON(snum, p->curr_weapon, FireDelay))
|
2010-05-02 23:27:30 +00:00
|
|
|
P_CheckWeapon(p);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_STANDSTILL
|
|
|
|
&& *kb < (PWEAPON(snum, p->curr_weapon, FireDelay)+1))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->pos.z = p->opos.z;
|
2011-02-25 21:50:19 +00:00
|
|
|
p->vel.z = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-08-07 22:38:15 +00:00
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
if (*kb == PWEAPON(snum, p->curr_weapon, Sound2Time))
|
|
|
|
if (PWEAPON(snum, p->curr_weapon, Sound2Sound) > 0)
|
|
|
|
A_PlaySound(PWEAPON(snum, p->curr_weapon, Sound2Sound),p->i);
|
2010-08-07 22:38:15 +00:00
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
if (*kb == PWEAPON(snum, p->curr_weapon, SpawnTime))
|
2013-12-28 17:04:31 +00:00
|
|
|
P_DoWeaponSpawn(snum);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
if ((*kb) >= PWEAPON(snum, p->curr_weapon, TotalTime))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if (/*!(PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_CHECKATRELOAD) && */ p->reloading == 1 ||
|
|
|
|
(PWEAPON(snum, p->curr_weapon, Reload) > PWEAPON(snum, p->curr_weapon, TotalTime) && p->ammo_amount[p->curr_weapon] > 0
|
|
|
|
&& (PWEAPON(snum, p->curr_weapon, Clip)) && (((p->ammo_amount[p->curr_weapon]%(PWEAPON(snum, p->curr_weapon, Clip)))==0))))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
int32_t i = PWEAPON(snum, p->curr_weapon, Reload) - PWEAPON(snum, p->curr_weapon, TotalTime);
|
2009-07-09 02:29:48 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
p->reloading = 1;
|
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
if ((*kb) != (PWEAPON(snum, p->curr_weapon, TotalTime)))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if ((*kb) == (PWEAPON(snum, p->curr_weapon, TotalTime)+1))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, ReloadSound1) > 0)
|
|
|
|
A_PlaySound(PWEAPON(snum, p->curr_weapon, ReloadSound1),p->i);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
2012-12-28 17:18:16 +00:00
|
|
|
else if (((*kb) == (PWEAPON(snum, p->curr_weapon, Reload) - (i/3)) &&
|
|
|
|
!(PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_RELOAD_TIMING)) ||
|
|
|
|
((*kb) == (PWEAPON(snum, p->curr_weapon, Reload) - i+4) &&
|
|
|
|
(PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_RELOAD_TIMING)))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, ReloadSound2) > 0)
|
|
|
|
A_PlaySound(PWEAPON(snum, p->curr_weapon, ReloadSound2),p->i);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
2012-12-28 17:18:16 +00:00
|
|
|
else if ((*kb) >= (PWEAPON(snum, p->curr_weapon, Reload)))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
*kb=0;
|
|
|
|
p->reloading = 0;
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_AUTOMATIC &&
|
|
|
|
(PWEAPON(snum, p->curr_weapon, WorksLike)==KNEE_WEAPON?1:p->ammo_amount[p->curr_weapon] > 0))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_FIRE))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_RANDOMRESTART)
|
2010-05-02 23:27:30 +00:00
|
|
|
*kb = 1+(krand()&3);
|
|
|
|
else *kb=1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else *kb = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else *kb = 0;
|
2008-11-20 14:06:36 +00:00
|
|
|
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_RESET &&
|
|
|
|
((PWEAPON(snum, p->curr_weapon, WorksLike) == KNEE_WEAPON)?1:p->ammo_amount[p->curr_weapon] > 0))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_FIRE)) *kb = 1;
|
|
|
|
else *kb = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-12-28 17:18:16 +00:00
|
|
|
else if (*kb >= PWEAPON(snum, p->curr_weapon, FireDelay) && (*kb) < PWEAPON(snum, p->curr_weapon, TotalTime)
|
|
|
|
&& ((PWEAPON(snum, p->curr_weapon, WorksLike) == KNEE_WEAPON)?1:p->ammo_amount[p->curr_weapon] > 0))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_AUTOMATIC)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if (!(PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_SEMIAUTO))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_FIRE) == 0 && PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_RESET)
|
2010-05-02 23:27:30 +00:00
|
|
|
*kb = 0;
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_FIREEVERYTHIRD)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (((*(kb))%3) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-28 17:04:31 +00:00
|
|
|
P_FireWeapon(snum);
|
|
|
|
P_DoWeaponSpawn(snum);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
2012-12-28 17:18:16 +00:00
|
|
|
else if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_FIREEVERYOTHER)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
2013-12-28 17:04:31 +00:00
|
|
|
P_FireWeapon(snum);
|
|
|
|
P_DoWeaponSpawn(snum);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if (*kb == PWEAPON(snum, p->curr_weapon, FireDelay))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-28 17:04:31 +00:00
|
|
|
P_FireWeapon(snum);
|
|
|
|
// P_DoWeaponSpawn(snum);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_RESET &&
|
|
|
|
(*kb) > PWEAPON(snum, p->curr_weapon, TotalTime)-PWEAPON(snum, p->curr_weapon, HoldDelay) &&
|
|
|
|
((PWEAPON(snum, p->curr_weapon, WorksLike) == KNEE_WEAPON) || p->ammo_amount[p->curr_weapon] > 0))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_FIRE)) *kb = 1;
|
|
|
|
else *kb = 0;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_FIREEVERYOTHER)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-12-28 17:04:31 +00:00
|
|
|
P_FireWeapon(snum);
|
|
|
|
P_DoWeaponSpawn(snum);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-12-28 17:18:16 +00:00
|
|
|
if (*kb == PWEAPON(snum, p->curr_weapon, FireDelay))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
2013-12-28 17:04:31 +00:00
|
|
|
P_FireWeapon(snum);
|
|
|
|
// P_DoWeaponSpawn(snum);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-12-28 17:18:16 +00:00
|
|
|
else if (*kb == PWEAPON(snum, p->curr_weapon, FireDelay))
|
2013-12-28 17:04:31 +00:00
|
|
|
P_FireWeapon(snum);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-01-20 21:17:19 +00:00
|
|
|
static int32_t P_DoFist(DukePlayer_t *p)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
// the fist punching NUKEBUTTON
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (++p->fist_incs == 28)
|
2007-08-25 01:05:00 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (ud.recstat == 1) G_CloseDemoWrite();
|
|
|
|
S_PlaySound(PIPEBOMB_EXPLODE);
|
2012-05-05 22:24:50 +00:00
|
|
|
|
|
|
|
P_PalFrom(p, 48, 64,64,64);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->fist_incs > 42)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
int32_t i;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-02-21 19:33:33 +00:00
|
|
|
for (TRAVERSE_CONNECT(i))
|
|
|
|
g_player[i].ps->gm = MODE_EOL;
|
2010-05-02 23:27:30 +00:00
|
|
|
|
|
|
|
if (p->buttonpalette && ud.from_bonus == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
ud.from_bonus = ud.level_number+1;
|
2010-05-25 10:56:00 +00:00
|
|
|
if (ud.secretlevel > 0 && ud.secretlevel <= MAXLEVELS)
|
2010-05-02 23:27:30 +00:00
|
|
|
ud.level_number = ud.secretlevel-1;
|
|
|
|
ud.m_level_number = ud.level_number;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ud.from_bonus)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
ud.m_level_number = ud.level_number = ud.from_bonus;
|
|
|
|
ud.from_bonus = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (ud.level_number == ud.secretlevel && ud.from_bonus > 0)
|
|
|
|
ud.level_number = ud.from_bonus;
|
|
|
|
else ud.level_number++;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (ud.level_number > MAXLEVELS-1)
|
|
|
|
ud.level_number = 0;
|
|
|
|
ud.m_level_number = ud.level_number;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
p->fist_incs = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2007-01-24 03:42:54 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2007-01-24 03:42:54 +00:00
|
|
|
|
2011-04-28 21:28:33 +00:00
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
static void getzsofslope_player(int16_t sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz)
|
|
|
|
{
|
|
|
|
int32_t i, didceil=0, didflor=0;
|
|
|
|
|
|
|
|
if ((sector[sectnum].ceilingstat&512)==0)
|
|
|
|
{
|
2012-10-01 17:52:18 +00:00
|
|
|
i = yax_getneighborsect(dax, day, sectnum, YAX_CEILING);
|
2011-04-28 21:28:33 +00:00
|
|
|
if (i >= 0)
|
|
|
|
{
|
|
|
|
*ceilz = getceilzofslope(i, dax,day);
|
|
|
|
didceil = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((sector[sectnum].floorstat&512)==0)
|
|
|
|
{
|
2012-10-01 17:52:18 +00:00
|
|
|
i = yax_getneighborsect(dax, day, sectnum, YAX_FLOOR);
|
2011-04-28 21:28:33 +00:00
|
|
|
if (i >= 0)
|
|
|
|
{
|
|
|
|
*florz = getflorzofslope(i, dax,day);
|
|
|
|
didflor = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!didceil || !didflor)
|
|
|
|
{
|
|
|
|
int32_t cz, fz;
|
|
|
|
getzsofslope(sectnum, dax, day, &cz, &fz);
|
|
|
|
|
|
|
|
if (!didceil)
|
|
|
|
*ceilz = cz;
|
|
|
|
if (!didflor)
|
|
|
|
*florz = fz;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-11-11 17:56:57 +00:00
|
|
|
void P_UpdatePosWhenViewingCam(DukePlayer_t *p)
|
|
|
|
{
|
|
|
|
int32_t i = p->newowner;
|
|
|
|
|
2013-11-04 18:21:07 +00:00
|
|
|
Bmemcpy(&p->pos, &sprite[i], sizeof(vec3_t));
|
2012-11-11 17:56:57 +00:00
|
|
|
p->ang = SA;
|
|
|
|
p->vel.x = p->vel.y = sprite[p->i].xvel = 0;
|
|
|
|
p->look_ang = 0;
|
|
|
|
p->rotscrnang = 0;
|
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
void P_ProcessInput(int32_t snum)
|
|
|
|
{
|
2012-08-16 21:48:21 +00:00
|
|
|
DukePlayer_t *const p = g_player[snum].ps;
|
|
|
|
spritetype *const s = &sprite[p->i];
|
2007-01-24 03:42:54 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
uint32_t sb_snum = g_player[snum].sync->bits;
|
2007-01-24 03:42:54 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
int32_t j, i, k, doubvel = TICSPERFRAME, shrunk;
|
|
|
|
int32_t fz, cz, hz, lz, truefdist, x, y, psectlotag;
|
2012-12-29 15:21:28 +00:00
|
|
|
const uint8_t *const kb = &p->kickback_pic;
|
2010-05-02 23:27:30 +00:00
|
|
|
int16_t tempsect;
|
2007-01-24 03:42:54 +00:00
|
|
|
|
2011-03-05 01:41:38 +00:00
|
|
|
if (g_player[snum].playerquitflag == 0)
|
|
|
|
return;
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
p->player_par++;
|
2007-01-24 03:42:54 +00:00
|
|
|
|
2014-11-22 12:29:25 +00:00
|
|
|
VM_OnEvent(EVENT_PROCESSINPUT, p->i, snum);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->cheat_phase > 0) sb_snum = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->cursectnum == -1)
|
|
|
|
{
|
2012-03-11 17:38:50 +00:00
|
|
|
if (s->extra > 0 && ud.noclip == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
P_QuickKill(p);
|
|
|
|
A_PlaySound(SQUISHED,p->i);
|
|
|
|
}
|
|
|
|
p->cursectnum = 0;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
psectlotag = sector[p->cursectnum].lotag;
|
|
|
|
p->spritebridge = p->sbs = 0;
|
2009-11-14 02:30:47 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
shrunk = (s->yrepeat < 32);
|
|
|
|
getzrange((vec3_t *)p,p->cursectnum,&cz,&hz,&fz,&lz,163L,CLIPMASK0);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2011-04-28 21:28:33 +00:00
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
getzsofslope_player(p->cursectnum,p->pos.x,p->pos.y,&p->truecz,&p->truefz);
|
|
|
|
#else
|
2010-05-02 23:27:30 +00:00
|
|
|
getzsofslope(p->cursectnum,p->pos.x,p->pos.y,&p->truecz,&p->truefz);
|
2011-04-28 21:28:33 +00:00
|
|
|
#endif
|
2010-05-02 23:27:30 +00:00
|
|
|
j = p->truefz;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
truefdist = klabs(p->pos.z-j);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if ((lz&49152) == 16384 && psectlotag == 1 && truefdist > PHEIGHT+(16<<8))
|
|
|
|
psectlotag = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[p->i].floorz = fz;
|
|
|
|
actor[p->i].ceilingz = cz;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
p->ohoriz = p->horiz;
|
|
|
|
p->ohorizoff = p->horizoff;
|
|
|
|
|
|
|
|
// calculates automatic view angle for playing without a mouse
|
2012-10-14 20:41:21 +00:00
|
|
|
if (p->aim_mode == 0 && p->on_ground && psectlotag != ST_2_UNDERWATER && (sector[p->cursectnum].floorstat&2))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
x = p->pos.x+(sintable[(p->ang+512)&2047]>>5);
|
|
|
|
y = p->pos.y+(sintable[p->ang&2047]>>5);
|
|
|
|
tempsect = p->cursectnum;
|
|
|
|
updatesector(x,y,&tempsect);
|
|
|
|
if (tempsect >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
k = getflorzofslope(p->cursectnum,x,y);
|
|
|
|
if (p->cursectnum == tempsect)
|
|
|
|
p->horizoff += mulscale16(j-k,160);
|
|
|
|
else if (klabs(getflorzofslope(tempsect,x,y)-k) <= (4<<8))
|
|
|
|
p->horizoff += mulscale16(j-k,160);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->horizoff > 0) p->horizoff -= ((p->horizoff>>3)+1);
|
|
|
|
else if (p->horizoff < 0) p->horizoff += (((-p->horizoff)>>3)+1);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (hz >= 0 && (hz&49152) == 49152)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
hz &= (MAXSPRITES-1);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (sprite[hz].statnum == STAT_ACTOR && sprite[hz].extra >= 0)
|
|
|
|
{
|
|
|
|
hz = 0;
|
|
|
|
cz = p->truecz;
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (lz >= 0 && (lz&49152) == 49152)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
j = lz&(MAXSPRITES-1);
|
|
|
|
|
2014-08-17 19:42:01 +00:00
|
|
|
if ((sprite[j].cstat&33) == 33 || (sprite[j].cstat&17) == 17 ||
|
|
|
|
clipshape_idx_for_sprite(&sprite[j], -1) >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-11-16 18:47:21 +00:00
|
|
|
if ((sprite[j].xvel&1) == 0) // EDuke32 extension
|
|
|
|
{
|
|
|
|
psectlotag = 0;
|
|
|
|
p->footprintcount = 0;
|
|
|
|
p->spritebridge = 1;
|
|
|
|
p->sbs = j;
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
else if (A_CheckEnemySprite(&sprite[j]) && sprite[j].xrepeat > 24 && klabs(s->z-sprite[j].z) < (84<<8))
|
|
|
|
{
|
|
|
|
// I think this is what makes the player slide off enemies... might be a good sprite flag to add later
|
|
|
|
j = getangle(sprite[j].x-p->pos.x,sprite[j].y-p->pos.y);
|
2011-02-25 21:50:19 +00:00
|
|
|
p->vel.x -= sintable[(j+512)&2047]<<4;
|
|
|
|
p->vel.y -= sintable[j&2047]<<4;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (s->extra > 0)
|
|
|
|
P_IncurDamage(p);
|
|
|
|
else
|
2009-01-13 12:23:18 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
s->extra = 0;
|
|
|
|
p->inv_amount[GET_SHIELD] = 0;
|
2009-01-13 12:23:18 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
p->last_extra = s->extra;
|
|
|
|
|
|
|
|
if (p->loogcnt > 0) p->loogcnt--;
|
|
|
|
else p->loogcnt = 0;
|
|
|
|
|
|
|
|
if (p->fist_incs && P_DoFist(p)) return;
|
|
|
|
|
|
|
|
if (p->timebeforeexit > 1 && p->last_extra > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (--p->timebeforeexit == GAMETICSPERSEC*5)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
FX_StopAllSounds();
|
|
|
|
S_ClearSoundLocks();
|
|
|
|
|
|
|
|
if (p->customexitsound >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
S_PlaySound(p->customexitsound);
|
2011-02-25 21:50:19 +00:00
|
|
|
P_DoQuote(QUOTE_WEREGONNAFRYYOURASS,p);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p->timebeforeexit == 1)
|
|
|
|
{
|
2012-02-21 19:33:33 +00:00
|
|
|
for (TRAVERSE_CONNECT(i))
|
|
|
|
g_player[i].ps->gm = MODE_EOL;
|
2010-05-02 23:27:30 +00:00
|
|
|
|
|
|
|
ud.m_level_number = ud.level_number++;
|
|
|
|
|
|
|
|
if (ud.from_bonus)
|
|
|
|
{
|
|
|
|
ud.m_level_number = ud.level_number = ud.from_bonus;
|
|
|
|
ud.from_bonus = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->pals.f > 0)
|
2013-06-20 18:31:50 +00:00
|
|
|
{
|
2013-06-30 20:38:48 +00:00
|
|
|
#if !defined LUNATIC
|
2010-05-02 23:27:30 +00:00
|
|
|
p->pals.f--;
|
2013-06-20 18:31:50 +00:00
|
|
|
#else
|
|
|
|
if (p->palsfadespeed > 0)
|
|
|
|
{
|
|
|
|
// <palsfadespeed> is the tint fade speed is in
|
|
|
|
// decrements/P_ProcessInput() calls.
|
|
|
|
p->pals.f = max(p->pals.f - p->palsfadespeed, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// <palsfadespeed> is a negated count of how many times we
|
|
|
|
// (P_ProcessInput()) should be called before decrementing the tint
|
|
|
|
// fading by one. <palsfadenext> is the live counter.
|
|
|
|
if (p->palsfadenext < 0)
|
|
|
|
p->palsfadenext++;
|
|
|
|
|
|
|
|
if (p->palsfadenext == 0)
|
|
|
|
{
|
|
|
|
p->palsfadenext = p->palsfadespeed;
|
|
|
|
p->pals.f--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->fta > 0 && --p->fta == 0)
|
|
|
|
{
|
|
|
|
pub = pus = NUMPAGES;
|
|
|
|
p->ftq = 0;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (g_levelTextTime > 0)
|
|
|
|
g_levelTextTime--;
|
|
|
|
|
|
|
|
if (s->extra <= 0)
|
2010-03-12 05:50:30 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (ud.recstat == 1 && (!g_netServer && ud.multimode < 2))
|
|
|
|
G_CloseDemoWrite();
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if ((numplayers < 2 || g_netServer) && p->dead_flag == 0)
|
|
|
|
P_FragPlayer(snum);
|
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if (psectlotag == ST_2_UNDERWATER)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->on_warping_sector == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (klabs(p->pos.z-fz) > (PHEIGHT>>1))
|
|
|
|
p->pos.z += 348;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s->z -= 512;
|
|
|
|
s->zvel = -348;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
|
|
|
|
clipmove((vec3_t *)p,&p->cursectnum,
|
|
|
|
0,0,164L,(4L<<8),(4L<<8),CLIPMASK0);
|
|
|
|
// p->bobcounter += 32;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2013-11-04 18:21:07 +00:00
|
|
|
Bmemcpy(&p->opos, &p->pos, sizeof(vec3_t));
|
2010-05-02 23:27:30 +00:00
|
|
|
p->oang = p->ang;
|
|
|
|
p->opyoff = p->pyoff;
|
|
|
|
|
|
|
|
p->horiz = 100;
|
|
|
|
p->horizoff = 0;
|
|
|
|
|
|
|
|
updatesector(p->pos.x,p->pos.y,&p->cursectnum);
|
|
|
|
|
|
|
|
pushmove((vec3_t *)p,&p->cursectnum,128L,(4L<<8),(20L<<8),CLIPMASK0);
|
|
|
|
|
|
|
|
if (fz > cz+(16<<8) && s->pal != 1)
|
|
|
|
p->rotscrnang = (p->dead_flag + ((fz+p->pos.z)>>7))&2047;
|
|
|
|
|
|
|
|
p->on_warping_sector = 0;
|
|
|
|
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->transporter_hold > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->transporter_hold--;
|
|
|
|
if (p->transporter_hold == 0 && p->on_warping_sector)
|
|
|
|
p->transporter_hold = 2;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else if (p->transporter_hold < 0)
|
|
|
|
p->transporter_hold++;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->newowner >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-11-11 17:56:57 +00:00
|
|
|
P_UpdatePosWhenViewingCam(p);
|
2013-12-28 17:04:31 +00:00
|
|
|
P_DoCounters(snum);
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2014-10-25 03:27:01 +00:00
|
|
|
if (PWEAPON(snum, p->curr_weapon, WorksLike) == HANDREMOTE_WEAPON)
|
2010-05-02 23:27:30 +00:00
|
|
|
P_ProcessWeapon(snum);
|
|
|
|
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2010-05-25 10:56:00 +00:00
|
|
|
p->rotscrnang -= (p->rotscrnang>>1);
|
|
|
|
|
|
|
|
if (p->rotscrnang && !(p->rotscrnang>>1))
|
|
|
|
p->rotscrnang -= ksgn(p->rotscrnang);
|
2010-05-02 23:27:30 +00:00
|
|
|
|
|
|
|
p->look_ang -= (p->look_ang>>2);
|
|
|
|
|
2010-05-25 10:56:00 +00:00
|
|
|
if (p->look_ang && !(p->look_ang>>2))
|
|
|
|
p->look_ang -= ksgn(p->look_ang);
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_LOOK_LEFT))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
// look_left
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_LOOKLEFT,p->i,snum) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->look_ang -= 152;
|
|
|
|
p->rotscrnang += 24;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_LOOK_RIGHT))
|
2007-08-25 01:05:00 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
// look_right
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_LOOKRIGHT,p->i,snum) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->look_ang += 152;
|
|
|
|
p->rotscrnang -= 24;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->on_crane >= 0)
|
|
|
|
goto HORIZONLY;
|
|
|
|
|
|
|
|
j = ksgn(g_player[snum].sync->avel);
|
|
|
|
|
|
|
|
if (s->xvel < 32 || p->on_ground == 0 || p->bobcounter == 1024)
|
2007-08-25 01:05:00 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if ((p->weapon_sway&2047) > (1024+96))
|
|
|
|
p->weapon_sway -= 96;
|
|
|
|
else if ((p->weapon_sway&2047) < (1024-96))
|
|
|
|
p->weapon_sway += 96;
|
|
|
|
else p->weapon_sway = 1024;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else p->weapon_sway = p->bobcounter;
|
2010-03-12 05:50:30 +00:00
|
|
|
|
2012-07-01 22:11:14 +00:00
|
|
|
// NOTE: This silently wraps if the difference is too great, e.g. used to do
|
2012-06-26 19:49:56 +00:00
|
|
|
// that when teleported by silent SE7s.
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
s->xvel = ksqrt(uhypsq(p->pos.x-p->bobpos.x, p->pos.y-p->bobpos.y));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->on_ground)
|
|
|
|
p->bobcounter += sprite[p->i].xvel>>1;
|
|
|
|
|
2012-05-14 18:12:27 +00:00
|
|
|
if (ud.noclip == 0 && ((uint16_t)p->cursectnum >= MAXSECTORS || sector[p->cursectnum].floorpicnum == MIRROR))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->pos.x = p->opos.x;
|
|
|
|
p->pos.y = p->opos.y;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->opos.x = p->pos.x;
|
|
|
|
p->opos.y = p->pos.y;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
p->bobpos.x = p->pos.x;
|
|
|
|
p->bobpos.y = p->pos.y;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
p->opos.z = p->pos.z;
|
|
|
|
p->opyoff = p->pyoff;
|
|
|
|
p->oang = p->ang;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->one_eighty_count < 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->one_eighty_count += 128;
|
|
|
|
p->ang += 128;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
// Shrinking code
|
|
|
|
|
|
|
|
i = 40;
|
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if (psectlotag == ST_2_UNDERWATER)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
// under water
|
|
|
|
p->jumping_counter = 0;
|
|
|
|
|
|
|
|
p->pycount += 32;
|
|
|
|
p->pycount &= 2047;
|
|
|
|
p->pyoff = sintable[p->pycount]>>7;
|
2010-03-12 05:50:30 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (!A_CheckSoundPlaying(p->i,DUKE_UNDERWATER))
|
|
|
|
A_PlaySound(DUKE_UNDERWATER,p->i);
|
2010-03-12 05:50:30 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_JUMP))
|
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_SWIMUP,p->i,snum) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
// jump
|
2011-02-25 21:50:19 +00:00
|
|
|
if (p->vel.z > 0) p->vel.z = 0;
|
|
|
|
p->vel.z -= 348;
|
|
|
|
if (p->vel.z < -(256*6)) p->vel.z = -(256*6);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (TEST_SYNC_KEY(sb_snum, SK_CROUCH))
|
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_SWIMDOWN,p->i,snum) == 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
// crouch
|
2011-02-25 21:50:19 +00:00
|
|
|
if (p->vel.z < 0) p->vel.z = 0;
|
|
|
|
p->vel.z += 348;
|
|
|
|
if (p->vel.z > (256*6)) p->vel.z = (256*6);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// normal view
|
2011-02-25 21:50:19 +00:00
|
|
|
if (p->vel.z < 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
2011-02-25 21:50:19 +00:00
|
|
|
p->vel.z += 256;
|
|
|
|
if (p->vel.z > 0)
|
|
|
|
p->vel.z = 0;
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
2011-02-25 21:50:19 +00:00
|
|
|
if (p->vel.z > 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
2011-02-25 21:50:19 +00:00
|
|
|
p->vel.z -= 256;
|
|
|
|
if (p->vel.z < 0)
|
|
|
|
p->vel.z = 0;
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
}
|
2010-03-12 05:50:30 +00:00
|
|
|
|
2011-02-25 21:50:19 +00:00
|
|
|
if (p->vel.z > 2048)
|
|
|
|
p->vel.z >>= 1;
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2011-02-25 21:50:19 +00:00
|
|
|
p->pos.z += p->vel.z;
|
2010-05-02 23:27:30 +00:00
|
|
|
|
|
|
|
if (p->pos.z > (fz-(15<<8)))
|
|
|
|
p->pos.z += ((fz-(15<<8))-p->pos.z)>>1;
|
|
|
|
|
|
|
|
if (p->pos.z < cz)
|
|
|
|
{
|
|
|
|
p->pos.z = cz;
|
2011-02-25 21:50:19 +00:00
|
|
|
p->vel.z = 0;
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (p->scuba_on && (krand()&255) < 8)
|
|
|
|
{
|
|
|
|
j = A_Spawn(p->i,WATERBUBBLE);
|
|
|
|
sprite[j].x +=
|
|
|
|
sintable[(p->ang+512+64-(g_globalRandom&128))&2047]>>6;
|
|
|
|
sprite[j].y +=
|
|
|
|
sintable[(p->ang+64-(g_globalRandom&128))&2047]>>6;
|
|
|
|
sprite[j].xrepeat = 3;
|
|
|
|
sprite[j].yrepeat = 2;
|
|
|
|
sprite[j].z = p->pos.z+(8<<8);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else if (p->jetpack_on)
|
|
|
|
{
|
|
|
|
p->on_ground = 0;
|
|
|
|
p->jumping_counter = 0;
|
|
|
|
p->hard_landing = 0;
|
|
|
|
p->falling_counter = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
p->pycount += 32;
|
|
|
|
p->pycount &= 2047;
|
|
|
|
p->pyoff = sintable[p->pycount]>>7;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->jetpack_on < 11)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->jetpack_on++;
|
|
|
|
p->pos.z -= (p->jetpack_on<<7); //Goin up
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else if (p->jetpack_on == 11 && !A_CheckSoundPlaying(p->i,DUKE_JETPACK_IDLE))
|
|
|
|
A_PlaySound(DUKE_JETPACK_IDLE,p->i);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (shrunk) j = 512;
|
|
|
|
else j = 2048;
|
|
|
|
|
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_JUMP)) //A (soar high)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
// jump
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_SOARUP,p->i,snum) == 0)
|
2009-07-12 01:55:34 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->pos.z -= j;
|
|
|
|
p->crack_time = 777;
|
2009-07-12 01:55:34 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
2009-07-12 01:55:34 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_CROUCH)) //Z (soar low)
|
|
|
|
{
|
|
|
|
// crouch
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_SOARDOWN,p->i,snum) == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->pos.z += j;
|
|
|
|
p->crack_time = 777;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if (shrunk == 0 && (psectlotag == 0 || psectlotag == ST_2_UNDERWATER)) k = 32;
|
2010-05-02 23:27:30 +00:00
|
|
|
else k = 16;
|
2008-07-28 21:23:10 +00:00
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if (psectlotag != ST_2_UNDERWATER && p->scuba_on == 1)
|
2010-05-02 23:27:30 +00:00
|
|
|
p->scuba_on = 0;
|
2009-07-09 02:29:48 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->pos.z > (fz-(k<<8)))
|
|
|
|
p->pos.z += ((fz-(k<<8))-p->pos.z)>>1;
|
|
|
|
if (p->pos.z < (actor[p->i].ceilingz+(18<<8)))
|
|
|
|
p->pos.z = actor[p->i].ceilingz+(18<<8);
|
2009-07-09 02:29:48 +00:00
|
|
|
}
|
2012-10-14 20:41:21 +00:00
|
|
|
else if (psectlotag != ST_2_UNDERWATER)
|
2008-07-26 02:12:44 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->airleft = 15 * GAMETICSPERSEC; // 13 seconds
|
|
|
|
|
|
|
|
if (p->scuba_on == 1)
|
|
|
|
p->scuba_on = 0;
|
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if (psectlotag == ST_1_ABOVE_WATER && p->spritebridge == 0)
|
2008-07-26 02:12:44 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (shrunk == 0)
|
2008-07-26 02:12:44 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
i = 34;
|
|
|
|
p->pycount += 32;
|
|
|
|
p->pycount &= 2047;
|
|
|
|
p->pyoff = sintable[p->pycount]>>6;
|
|
|
|
}
|
|
|
|
else i = 12;
|
|
|
|
|
|
|
|
if (shrunk == 0 && truefdist <= PHEIGHT)
|
|
|
|
{
|
|
|
|
if (p->on_ground == 1)
|
2008-07-26 02:12:44 +00:00
|
|
|
{
|
2013-04-07 15:20:37 +00:00
|
|
|
if (p->dummyplayersprite < 0)
|
|
|
|
p->dummyplayersprite = A_Spawn(p->i,PLAYERONWATER);
|
2010-05-02 23:27:30 +00:00
|
|
|
sprite[p->dummyplayersprite].pal = sprite[p->i].pal;
|
|
|
|
sprite[p->dummyplayersprite].cstat |= 32768;
|
|
|
|
|
|
|
|
p->footprintcount = 6;
|
|
|
|
if (sector[p->cursectnum].floorpicnum == FLOORSLIME)
|
|
|
|
p->footprintpal = 8;
|
|
|
|
else p->footprintpal = 0;
|
|
|
|
p->footprintshade = 0;
|
2008-07-26 02:12:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (p->footprintcount > 0 && p->on_ground)
|
|
|
|
if (p->cursectnum >= 0 && (sector[p->cursectnum].floorstat&2) != 2)
|
|
|
|
{
|
|
|
|
for (j=headspritesect[p->cursectnum]; j>=0; j=nextspritesect[j])
|
|
|
|
if (sprite[j].picnum == FOOTPRINTS || sprite[j].picnum == FOOTPRINTS2 ||
|
2010-08-02 08:13:51 +00:00
|
|
|
sprite[j].picnum == FOOTPRINTS3 || sprite[j].picnum == FOOTPRINTS4)
|
2010-05-02 23:27:30 +00:00
|
|
|
if (klabs(sprite[j].x-p->pos.x) < 384 && klabs(sprite[j].y-p->pos.y) < 384)
|
2010-08-02 08:13:51 +00:00
|
|
|
break;
|
2010-03-12 05:50:30 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (j < 0)
|
|
|
|
{
|
|
|
|
if (p->cursectnum >= 0 && sector[p->cursectnum].lotag == 0 && sector[p->cursectnum].hitag == 0)
|
2011-05-12 23:31:13 +00:00
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
if (yax_getbunch(p->cursectnum, YAX_FLOOR) < 0 || (sector[p->cursectnum].floorstat&512))
|
|
|
|
#endif
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
switch (krand()&3)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
j = A_Spawn(p->i,FOOTPRINTS);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
j = A_Spawn(p->i,FOOTPRINTS2);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
j = A_Spawn(p->i,FOOTPRINTS3);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
j = A_Spawn(p->i,FOOTPRINTS4);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
sprite[j].pal = p->footprintpal;
|
|
|
|
sprite[j].shade = p->footprintshade;
|
|
|
|
p->footprintcount--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->pos.z < (fz-(i<<8))) //falling
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
// not jumping or crouching
|
|
|
|
|
|
|
|
if (!TEST_SYNC_KEY(sb_snum, SK_JUMP) && !TEST_SYNC_KEY(sb_snum, SK_CROUCH) &&
|
|
|
|
p->on_ground && (sector[p->cursectnum].floorstat&2) && p->pos.z >= (fz-(i<<8)-(16<<8)))
|
|
|
|
p->pos.z = fz-(i<<8);
|
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->on_ground = 0;
|
2011-02-25 21:50:19 +00:00
|
|
|
p->vel.z += (g_spriteGravity+80); // (TICSPERFRAME<<6);
|
|
|
|
if (p->vel.z >= (4096+2048)) p->vel.z = (4096+2048);
|
|
|
|
if (p->vel.z > 2400 && p->falling_counter < 255)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
p->falling_counter++;
|
2010-06-22 21:50:01 +00:00
|
|
|
if (p->falling_counter >= 38 && p->scream_voice <= FX_Ok)
|
2013-11-28 21:18:04 +00:00
|
|
|
{
|
|
|
|
int32_t voice = A_PlaySound(DUKE_SCREAM,p->i);
|
|
|
|
if (voice <= 127) // XXX: p->scream_voice is an int8_t
|
|
|
|
p->scream_voice = voice;
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
|
2011-02-25 21:50:19 +00:00
|
|
|
if ((p->pos.z+p->vel.z) >= (fz-(i<<8)) && p->cursectnum >= 0) // hit the ground
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sector[p->cursectnum].lotag != ST_1_ABOVE_WATER)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
if (p->falling_counter > 62)
|
|
|
|
P_QuickKill(p);
|
|
|
|
else if (p->falling_counter > 9)
|
|
|
|
{
|
2013-04-21 19:55:03 +00:00
|
|
|
// Falling damage.
|
2010-05-02 23:27:30 +00:00
|
|
|
s->extra -= p->falling_counter-(krand()&3);
|
2013-04-21 19:55:03 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (s->extra <= 0)
|
|
|
|
{
|
|
|
|
A_PlaySound(SQUISHED,p->i);
|
2012-05-05 22:24:50 +00:00
|
|
|
|
|
|
|
// P_PalFrom(p, 63, 63,0,0);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
A_PlaySound(DUKE_LAND,p->i);
|
|
|
|
A_PlaySound(DUKE_LAND_HURT,p->i);
|
|
|
|
}
|
|
|
|
|
2012-05-05 22:24:50 +00:00
|
|
|
P_PalFrom(p, 32, 16,0,0);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
2011-02-25 21:50:19 +00:00
|
|
|
else if (p->vel.z > 2048)
|
2010-05-02 23:27:30 +00:00
|
|
|
A_PlaySound(DUKE_LAND,p->i);
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->falling_counter = 0;
|
2010-03-12 05:50:30 +00:00
|
|
|
|
2010-06-22 21:50:01 +00:00
|
|
|
if (p->scream_voice > FX_Ok)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
FX_StopSound(p->scream_voice);
|
2010-06-22 21:50:01 +00:00
|
|
|
S_Cleanup();
|
2010-05-02 23:27:30 +00:00
|
|
|
p->scream_voice = -1;
|
|
|
|
}
|
2010-03-12 05:50:30 +00:00
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if (psectlotag != ST_1_ABOVE_WATER && psectlotag != ST_2_UNDERWATER && p->on_ground == 0 && p->vel.z > (6144>>1))
|
2011-02-25 21:50:19 +00:00
|
|
|
p->hard_landing = p->vel.z>>10;
|
2010-05-02 23:27:30 +00:00
|
|
|
|
|
|
|
p->on_ground = 1;
|
|
|
|
|
|
|
|
if (i==40)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
//Smooth on the ground
|
2010-03-12 05:50:30 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
k = ((fz-(i<<8))-p->pos.z)>>1;
|
|
|
|
if (klabs(k) < 256) k = 0;
|
|
|
|
p->pos.z += k;
|
2011-02-25 21:50:19 +00:00
|
|
|
p->vel.z -= 768;
|
|
|
|
if (p->vel.z < 0) p->vel.z = 0;
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
else if (p->jumping_counter == 0)
|
|
|
|
{
|
|
|
|
p->pos.z += ((fz-(i<<7))-p->pos.z)>>1; //Smooth on the water
|
|
|
|
if (p->on_warping_sector == 0 && p->pos.z > fz-(16<<8))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->pos.z = fz-(16<<8);
|
2011-02-25 21:50:19 +00:00
|
|
|
p->vel.z >>= 1;
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
p->on_warping_sector = 0;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_CROUCH))
|
|
|
|
{
|
|
|
|
// crouching
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_CROUCH,p->i,snum) == 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
p->pos.z += (2048+768);
|
|
|
|
p->crack_time = 777;
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
// jumping
|
|
|
|
if (!TEST_SYNC_KEY(sb_snum, SK_JUMP) && p->jumping_toggle == 1)
|
|
|
|
p->jumping_toggle = 0;
|
|
|
|
else if (TEST_SYNC_KEY(sb_snum, SK_JUMP) && p->jumping_toggle == 0)
|
|
|
|
{
|
|
|
|
if (p->jumping_counter == 0)
|
|
|
|
if ((fz-cz) > (56<<8))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_JUMP,p->i,snum) == 0)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->jumping_counter = 1;
|
|
|
|
p->jumping_toggle = 1;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->jumping_counter && !TEST_SYNC_KEY(sb_snum, SK_JUMP))
|
|
|
|
p->jumping_toggle = 0;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->jumping_counter)
|
|
|
|
{
|
|
|
|
if (!TEST_SYNC_KEY(sb_snum, SK_JUMP) && p->jumping_toggle == 1)
|
|
|
|
p->jumping_toggle = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->jumping_counter < (1024+256))
|
|
|
|
{
|
2012-10-14 20:41:21 +00:00
|
|
|
if (psectlotag == ST_1_ABOVE_WATER && p->jumping_counter > 768)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
p->jumping_counter = 0;
|
2011-02-25 21:50:19 +00:00
|
|
|
p->vel.z = -512;
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-02-25 21:50:19 +00:00
|
|
|
p->vel.z -= (sintable[(2048-128+p->jumping_counter)&2047])/12;
|
2010-05-02 23:27:30 +00:00
|
|
|
p->jumping_counter += 180;
|
|
|
|
p->on_ground = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
p->jumping_counter = 0;
|
2011-02-25 21:50:19 +00:00
|
|
|
p->vel.z = 0;
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-25 21:50:19 +00:00
|
|
|
p->pos.z += p->vel.z;
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if ((psectlotag != ST_2_UNDERWATER || cz != sector[p->cursectnum].ceilingz) && p->pos.z < (cz+(4<<8)))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
p->jumping_counter = 0;
|
2011-02-25 21:50:19 +00:00
|
|
|
if (p->vel.z < 0)
|
|
|
|
p->vel.x = p->vel.y = 0;
|
|
|
|
p->vel.z = 128;
|
2010-05-02 23:27:30 +00:00
|
|
|
p->pos.z = cz+(4<<8);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
|
|
|
|
if (p->fist_incs || p->transporter_hold > 2 || p->hard_landing || p->access_incs > 0 || p->knee_incs > 0 ||
|
2014-10-25 03:27:01 +00:00
|
|
|
(PWEAPON(snum, p->curr_weapon, WorksLike) == TRIPBOMB_WEAPON &&
|
|
|
|
*kb > 1 && *kb < PWEAPON(snum, p->curr_weapon, FireDelay)))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
doubvel = 0;
|
2011-02-25 21:50:19 +00:00
|
|
|
p->vel.x = 0;
|
|
|
|
p->vel.y = 0;
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
else if (g_player[snum].sync->avel) //p->ang += syncangvel * constant
|
|
|
|
{
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
int32_t tempang = g_player[snum].sync->avel;
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if (psectlotag == ST_2_UNDERWATER) p->angvel =(tempang-(tempang>>3))*ksgn(doubvel);
|
2010-05-02 23:27:30 +00:00
|
|
|
else p->angvel = tempang*ksgn(doubvel);
|
|
|
|
|
|
|
|
p->ang += p->angvel;
|
|
|
|
p->ang &= 2047;
|
|
|
|
p->crack_time = 777;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->spritebridge == 0)
|
|
|
|
{
|
|
|
|
j = sector[s->sectnum].floorpicnum;
|
|
|
|
|
|
|
|
if (j == PURPLELAVA || sector[s->sectnum].ceilingpicnum == PURPLELAVA)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->inv_amount[GET_BOOTS] > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->inv_amount[GET_BOOTS]--;
|
2012-11-04 23:41:05 +00:00
|
|
|
p->inven_icon = ICON_BOOTS;
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->inv_amount[GET_BOOTS] <= 0)
|
|
|
|
P_SelectNextInvItem(p);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (!A_CheckSoundPlaying(p->i,DUKE_LONGTERM_PAIN))
|
|
|
|
A_PlaySound(DUKE_LONGTERM_PAIN,p->i);
|
2012-05-05 22:24:50 +00:00
|
|
|
|
|
|
|
P_PalFrom(p, 32, 0,8,0);
|
2010-05-02 23:27:30 +00:00
|
|
|
s->extra--;
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->on_ground && truefdist <= PHEIGHT+(16<<8) && P_CheckFloorDamage(p, j))
|
|
|
|
{
|
2011-02-25 21:50:19 +00:00
|
|
|
P_DoQuote(QUOTE_BOOTS_ON, p);
|
2010-05-02 23:27:30 +00:00
|
|
|
p->inv_amount[GET_BOOTS] -= 2;
|
|
|
|
if (p->inv_amount[GET_BOOTS] <= 0)
|
|
|
|
{
|
|
|
|
p->inv_amount[GET_BOOTS] = 0;
|
|
|
|
P_SelectNextInvItem(p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (g_player[snum].sync->extbits&(1))
|
2014-11-22 12:29:25 +00:00
|
|
|
VM_OnEvent(EVENT_MOVEFORWARD,p->i,snum);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (g_player[snum].sync->extbits&(1<<1))
|
2014-11-22 12:29:25 +00:00
|
|
|
VM_OnEvent(EVENT_MOVEBACKWARD,p->i,snum);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (g_player[snum].sync->extbits&(1<<2))
|
2014-11-22 12:29:25 +00:00
|
|
|
VM_OnEvent(EVENT_STRAFELEFT,p->i,snum);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (g_player[snum].sync->extbits&(1<<3))
|
2014-11-22 12:29:25 +00:00
|
|
|
VM_OnEvent(EVENT_STRAFERIGHT,p->i,snum);
|
2010-03-12 05:50:30 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (g_player[snum].sync->extbits&(1<<4) || g_player[snum].sync->avel < 0)
|
2014-11-22 12:29:25 +00:00
|
|
|
VM_OnEvent(EVENT_TURNLEFT,p->i,snum);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (g_player[snum].sync->extbits&(1<<5) || g_player[snum].sync->avel > 0)
|
2014-11-22 12:29:25 +00:00
|
|
|
VM_OnEvent(EVENT_TURNRIGHT,p->i,snum);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2011-02-25 21:50:19 +00:00
|
|
|
if (p->vel.x || p->vel.y || g_player[snum].sync->fvel || g_player[snum].sync->svel)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
p->crack_time = 777;
|
2010-03-12 05:50:30 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
k = sintable[p->bobcounter&2047]>>12;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if ((truefdist < PHEIGHT+(8<<8)) && (k == 1 || k == 3))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->walking_snd_toggle == 0 && p->on_ground)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
switch (psectlotag)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
case 0:
|
|
|
|
if (lz >= 0 && (lz&49152) == 49152)
|
|
|
|
j = sprite[lz&(MAXSPRITES-1)].picnum;
|
|
|
|
else j = sector[p->cursectnum].floorpicnum;
|
|
|
|
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(j))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
case PANNEL1__STATIC:
|
|
|
|
case PANNEL2__STATIC:
|
|
|
|
A_PlaySound(DUKE_WALKINDUCTS,p->i);
|
|
|
|
p->walking_snd_toggle = 1;
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
break;
|
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
case ST_1_ABOVE_WATER:
|
2010-05-02 23:27:30 +00:00
|
|
|
if (!p->spritebridge)
|
|
|
|
{
|
|
|
|
if ((krand()&1) == 0)
|
|
|
|
A_PlaySound(DUKE_ONWATER,p->i);
|
|
|
|
p->walking_snd_toggle = 1;
|
|
|
|
}
|
|
|
|
break;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
else if (p->walking_snd_toggle > 0)
|
|
|
|
p->walking_snd_toggle--;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (p->jetpack_on == 0 && p->inv_amount[GET_STEROIDS] > 0 && p->inv_amount[GET_STEROIDS] < 400)
|
|
|
|
doubvel <<= 1;
|
|
|
|
|
2014-11-22 12:28:12 +00:00
|
|
|
p->vel.x += (((g_player[snum].sync->fvel) * doubvel) << 6);
|
|
|
|
p->vel.y += (((g_player[snum].sync->svel) * doubvel) << 6);
|
2010-05-02 23:27:30 +00:00
|
|
|
|
|
|
|
j = 0;
|
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if (psectlotag == ST_2_UNDERWATER)
|
2010-05-02 23:27:30 +00:00
|
|
|
j = 0x1400;
|
2012-12-28 17:18:16 +00:00
|
|
|
else if (p->on_ground && (TEST_SYNC_KEY(sb_snum, SK_CROUCH) || (*kb > 10 && PWEAPON(snum, p->curr_weapon, WorksLike) == KNEE_WEAPON)))
|
2010-05-02 23:27:30 +00:00
|
|
|
j = 0x2000;
|
|
|
|
|
2014-11-22 12:28:12 +00:00
|
|
|
p->vel.x = mulscale16(p->vel.x, p->runspeed - j);
|
|
|
|
p->vel.y = mulscale16(p->vel.y, p->runspeed - j);
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2011-02-25 21:50:19 +00:00
|
|
|
if (klabs(p->vel.x) < 2048 && klabs(p->vel.y) < 2048)
|
|
|
|
p->vel.x = p->vel.y = 0;
|
2010-05-14 12:40:24 +00:00
|
|
|
|
|
|
|
if (shrunk)
|
|
|
|
{
|
2011-02-25 21:50:19 +00:00
|
|
|
p->vel.x = mulscale16(p->vel.x,p->runspeed-(p->runspeed>>1)+(p->runspeed>>2));
|
|
|
|
p->vel.y = mulscale16(p->vel.y,p->runspeed-(p->runspeed>>1)+(p->runspeed>>2));
|
2010-05-14 12:40:24 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HORIZONLY:
|
2012-10-29 04:29:17 +00:00
|
|
|
if (psectlotag == ST_1_ABOVE_WATER || p->spritebridge == 1) i = p->autostep_sbw;
|
|
|
|
else i = p->autostep;
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if (p->cursectnum >= 0 && sector[p->cursectnum].lotag == ST_2_UNDERWATER) k = 0;
|
2010-05-02 23:27:30 +00:00
|
|
|
else k = 1;
|
|
|
|
|
2012-03-11 17:38:50 +00:00
|
|
|
if (ud.noclip)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
2011-02-25 21:50:19 +00:00
|
|
|
p->pos.x += p->vel.x>>14;
|
|
|
|
p->pos.y += p->vel.y>>14;
|
2010-05-02 23:27:30 +00:00
|
|
|
updatesector(p->pos.x,p->pos.y,&p->cursectnum);
|
|
|
|
changespritesect(p->i,p->cursectnum);
|
|
|
|
}
|
2011-04-28 21:28:33 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
#ifdef YAX_ENABLE
|
2011-09-01 18:38:13 +00:00
|
|
|
int32_t sect = p->cursectnum;
|
|
|
|
int16_t cb, fb;
|
|
|
|
|
|
|
|
if (sect >= 0)
|
|
|
|
yax_getbunches(sect, &cb, &fb);
|
|
|
|
|
2013-07-09 18:23:41 +00:00
|
|
|
// This updatesectorz conflicts with Duke3D's way of teleporting through water,
|
2011-05-12 23:31:13 +00:00
|
|
|
// so make it a bit conditional... OTOH, this way we have an ugly z jump when
|
|
|
|
// changing from above water to underwater
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sect >= 0 && !(sector[sect].lotag==ST_1_ABOVE_WATER && p->on_ground && fb>=0))
|
2011-05-12 23:31:13 +00:00
|
|
|
{
|
2011-09-01 18:38:13 +00:00
|
|
|
if ((fb>=0 && !(sector[sect].floorstat&512)) || (cb>=0 && !(sector[sect].ceilingstat&512)))
|
2011-08-10 11:47:23 +00:00
|
|
|
{
|
2011-09-01 18:38:13 +00:00
|
|
|
p->cursectnum += MAXSECTORS; // skip initial z check, restored by updatesectorz
|
2011-05-12 23:31:13 +00:00
|
|
|
updatesectorz(p->pos.x,p->pos.y,p->pos.z,&p->cursectnum);
|
2011-08-10 11:47:23 +00:00
|
|
|
}
|
2011-05-12 23:31:13 +00:00
|
|
|
}
|
2011-04-28 21:28:33 +00:00
|
|
|
#endif
|
2014-11-22 12:28:12 +00:00
|
|
|
if ((j = clipmove((vec3_t *)p, &p->cursectnum, p->vel.x + (p->fric.x << 9), p->vel.y + (p->fric.y << 9), 164L,
|
|
|
|
(4L << 8), i, CLIPMASK0)))
|
2011-04-28 21:28:33 +00:00
|
|
|
P_CheckTouchDamage(p, j);
|
2014-11-22 12:28:12 +00:00
|
|
|
|
|
|
|
p->fric.x = p->fric.y = 0;
|
2011-04-28 21:28:33 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2012-08-20 21:23:48 +00:00
|
|
|
// This makes the player view lower when shrunk. NOTE that it can get the
|
|
|
|
// view below the sector floor (and does, when on the ground).
|
2012-10-14 20:41:21 +00:00
|
|
|
if (p->jetpack_on == 0 && psectlotag != ST_2_UNDERWATER && psectlotag != ST_1_ABOVE_WATER && shrunk)
|
2010-05-02 23:27:30 +00:00
|
|
|
p->pos.z += 32<<8;
|
|
|
|
|
|
|
|
if (p->jetpack_on == 0)
|
|
|
|
{
|
|
|
|
if (s->xvel > 16)
|
|
|
|
{
|
2012-10-14 20:41:21 +00:00
|
|
|
if (psectlotag != ST_1_ABOVE_WATER && psectlotag != ST_2_UNDERWATER && p->on_ground)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
p->pycount += 52;
|
|
|
|
p->pycount &= 2047;
|
|
|
|
p->pyoff =
|
|
|
|
klabs(s->xvel*sintable[p->pycount])/1596;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2012-10-14 20:41:21 +00:00
|
|
|
else if (psectlotag != ST_2_UNDERWATER && psectlotag != ST_1_ABOVE_WATER)
|
2010-05-02 23:27:30 +00:00
|
|
|
p->pyoff = 0;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
// RBG***
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
p->pos.z += PHEIGHT;
|
|
|
|
setsprite(p->i,(vec3_t *)&p->pos.x);
|
|
|
|
p->pos.z -= PHEIGHT;
|
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
// ST_2_UNDERWATER
|
2011-08-10 11:47:23 +00:00
|
|
|
if (p->cursectnum >= 0 && psectlotag < 3)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
2013-12-01 18:27:52 +00:00
|
|
|
const sectortype *sec = §or[p->cursectnum];
|
2010-05-02 23:27:30 +00:00
|
|
|
// p->cursectnum = s->sectnum;
|
|
|
|
|
2013-12-01 18:27:52 +00:00
|
|
|
if (!ud.noclip && sec->lotag == ST_31_TWO_WAY_TRAIN)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
2013-12-01 18:27:52 +00:00
|
|
|
// TRAIN_SECTOR_TO_SE_INDEX
|
|
|
|
if ((unsigned)sec->hitag < MAXSPRITES && sprite[sec->hitag].xvel
|
|
|
|
&& actor[sec->hitag].t_data[0] == 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
P_QuickKill(p);
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if (p->cursectnum >= 0 && truefdist < PHEIGHT && p->on_ground &&
|
|
|
|
psectlotag != ST_1_ABOVE_WATER && shrunk == 0 && sector[p->cursectnum].lotag == ST_1_ABOVE_WATER)
|
2010-05-02 23:27:30 +00:00
|
|
|
if (!A_CheckSoundPlaying(p->i,DUKE_ONWATER))
|
|
|
|
A_PlaySound(DUKE_ONWATER,p->i);
|
|
|
|
|
2010-06-07 09:03:16 +00:00
|
|
|
if (p->cursectnum >=0 && p->cursectnum != s->sectnum)
|
|
|
|
changespritesect(p->i, p->cursectnum);
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2012-03-11 17:38:50 +00:00
|
|
|
if (p->cursectnum >= 0 && ud.noclip == 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
j = (pushmove((vec3_t *)p,&p->cursectnum,164L,(4L<<8),(4L<<8),CLIPMASK0) < 0 && A_GetFurthestAngle(p->i,8) < 512);
|
|
|
|
|
|
|
|
if (klabs(actor[p->i].floorz-actor[p->i].ceilingz) < (48<<8) || j)
|
|
|
|
{
|
|
|
|
if (!(sector[s->sectnum].lotag&0x8000) && (isanunderoperator(sector[s->sectnum].lotag) ||
|
|
|
|
isanearoperator(sector[s->sectnum].lotag)))
|
2011-02-25 21:50:19 +00:00
|
|
|
G_ActivateBySector(s->sectnum,p->i);
|
2010-05-02 23:27:30 +00:00
|
|
|
if (j)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
P_QuickKill(p);
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
|
|
|
else if (klabs(fz-cz) < (32<<8) && isanunderoperator(sector[p->cursectnum].lotag))
|
2011-02-25 21:50:19 +00:00
|
|
|
G_ActivateBySector(p->cursectnum,p->i);
|
2010-05-02 23:27:30 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
i = 0;
|
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_CENTER_VIEW) || p->hard_landing)
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_RETURNTOCENTER,p->i,snum) == 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
p->return_to_center = 9;
|
2006-05-21 00:05:50 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_LOOK_UP))
|
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_LOOKUP,p->i,snum) == 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
p->return_to_center = 9;
|
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_RUN)) p->horiz += 12;
|
|
|
|
p->horiz += 12;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
2006-05-21 00:05:50 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_LOOK_DOWN))
|
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_LOOKDOWN,p->i,snum) == 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
p->return_to_center = 9;
|
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_RUN)) p->horiz -= 12;
|
|
|
|
p->horiz -= 12;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
2010-03-12 05:50:30 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_AIM_UP))
|
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_AIMUP,p->i,snum) == 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_RUN)) p->horiz += 6;
|
|
|
|
p->horiz += 6;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
2006-05-14 09:28:18 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_AIM_DOWN))
|
|
|
|
{
|
2014-11-22 12:29:25 +00:00
|
|
|
if (VM_OnEvent(EVENT_AIMDOWN,p->i,snum) == 0)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
if (TEST_SYNC_KEY(sb_snum, SK_RUN)) p->horiz -= 6;
|
|
|
|
p->horiz -= 6;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->return_to_center > 0 && !TEST_SYNC_KEY(sb_snum, SK_LOOK_UP) && !TEST_SYNC_KEY(sb_snum, SK_LOOK_DOWN))
|
|
|
|
{
|
|
|
|
p->return_to_center--;
|
|
|
|
p->horiz += 33-(p->horiz/3);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->hard_landing > 0)
|
|
|
|
{
|
|
|
|
p->hard_landing--;
|
|
|
|
p->horiz -= (p->hard_landing<<4);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i)
|
|
|
|
{
|
|
|
|
if (p->horiz > 95 && p->horiz < 105) p->horiz = 100;
|
|
|
|
if (p->horizoff > -5 && p->horizoff < 5) p->horizoff = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
p->horiz += g_player[snum].sync->horz;
|
|
|
|
|
|
|
|
if (p->horiz > HORIZ_MAX) p->horiz = HORIZ_MAX;
|
|
|
|
else if (p->horiz < HORIZ_MIN) p->horiz = HORIZ_MIN;
|
|
|
|
|
|
|
|
//Shooting code/changes
|
|
|
|
|
|
|
|
if (p->show_empty_weapon > 0)
|
|
|
|
{
|
|
|
|
p->show_empty_weapon--;
|
|
|
|
if (p->show_empty_weapon == 0 && (p->weaponswitch & 2) && p->ammo_amount[p->curr_weapon] <= 0)
|
|
|
|
{
|
|
|
|
if (p->last_full_weapon == GROW_WEAPON)
|
|
|
|
p->subweapon |= (1<<GROW_WEAPON);
|
|
|
|
else if (p->last_full_weapon == SHRINKER_WEAPON)
|
|
|
|
p->subweapon &= ~(1<<GROW_WEAPON);
|
2013-12-26 19:45:00 +00:00
|
|
|
P_AddWeapon(p, p->last_full_weapon, 1);
|
2010-05-02 23:27:30 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->knee_incs > 0)
|
|
|
|
{
|
|
|
|
p->horiz -= 48;
|
|
|
|
p->return_to_center = 9;
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
if (++p->knee_incs > 15)
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
p->knee_incs = 0;
|
|
|
|
p->holster_weapon = 0;
|
|
|
|
p->weapon_pos = klabs(p->weapon_pos);
|
|
|
|
|
|
|
|
if (p->actorsqu >= 0 && sprite[p->actorsqu].statnum != MAXSTATUS && dist(&sprite[p->i],&sprite[p->actorsqu]) < 1400)
|
2006-04-18 00:24:24 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
A_DoGuts(p->actorsqu,JIBS6,7);
|
|
|
|
A_Spawn(p->actorsqu,BLOODPOOL);
|
|
|
|
A_PlaySound(SQUISHED,p->actorsqu);
|
|
|
|
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(sprite[p->actorsqu].picnum))
|
2006-04-18 00:24:24 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
case FEM1__STATIC:
|
|
|
|
case FEM2__STATIC:
|
|
|
|
case FEM3__STATIC:
|
|
|
|
case FEM4__STATIC:
|
|
|
|
case FEM5__STATIC:
|
|
|
|
case FEM6__STATIC:
|
|
|
|
case FEM7__STATIC:
|
|
|
|
case FEM8__STATIC:
|
|
|
|
case FEM9__STATIC:
|
|
|
|
case FEM10__STATIC:
|
|
|
|
case PODFEM1__STATIC:
|
|
|
|
case NAKED1__STATIC:
|
|
|
|
case STATUE__STATIC:
|
|
|
|
if (sprite[p->actorsqu].yvel)
|
|
|
|
G_OperateRespawns(sprite[p->actorsqu].yvel);
|
2012-03-11 17:38:13 +00:00
|
|
|
A_DeleteSprite(p->actorsqu);
|
2010-05-02 23:27:30 +00:00
|
|
|
break;
|
|
|
|
case APLAYER__STATIC:
|
2013-12-28 17:04:27 +00:00
|
|
|
{
|
|
|
|
int32_t snum = P_Get(p->actorsqu);
|
|
|
|
P_QuickKill(g_player[snum].ps);
|
|
|
|
g_player[snum].ps->frag_ps = snum;
|
2010-05-02 23:27:30 +00:00
|
|
|
break;
|
2013-12-28 17:04:27 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
default:
|
|
|
|
if (A_CheckEnemySprite(&sprite[p->actorsqu]))
|
|
|
|
p->actors_killed++;
|
2012-03-11 17:38:13 +00:00
|
|
|
A_DeleteSprite(p->actorsqu);
|
2010-05-02 23:27:30 +00:00
|
|
|
break;
|
2006-04-18 00:24:24 +00:00
|
|
|
}
|
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
p->actorsqu = -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
else if (p->actorsqu >= 0)
|
|
|
|
p->ang += G_GetAngleDelta(p->ang,getangle(sprite[p->actorsqu].x-p->pos.x,sprite[p->actorsqu].y-p->pos.y))>>2;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2013-12-28 17:04:31 +00:00
|
|
|
if (P_DoCounters(snum))
|
|
|
|
return;
|
2010-05-02 23:27:30 +00:00
|
|
|
|
|
|
|
P_ProcessWeapon(snum);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|