mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Remove commented out AI Duke opponent code.
git-svn-id: https://svn.eduke32.com/eduke32@2982 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
b8ed142c6b
commit
a9d3103373
4 changed files with 0 additions and 605 deletions
|
@ -10657,18 +10657,6 @@ MAIN_LOOP_RESTART:
|
|||
Bmemcpy(&inputfifo[0][myconnectindex], &avg, sizeof(input_t));
|
||||
Bmemset(&avg, 0, sizeof(input_t));
|
||||
|
||||
/*
|
||||
if (ud.playerai && (g_netServer || ud.multimode > 1))
|
||||
{
|
||||
for (TRAVERSE_CONNECT(i))
|
||||
if (i != myconnectindex)
|
||||
{
|
||||
//clearbufbyte(&inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i],sizeof(input_t),0L);
|
||||
computergetinput(i,&inputfifo[0][i]);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
do
|
||||
{
|
||||
int32_t clockbeforetic;
|
||||
|
|
|
@ -297,7 +297,6 @@ void P_DoQuote(int32_t q,DukePlayer_t *p);
|
|||
extern int32_t textsc(int32_t sc);
|
||||
void P_SetGamePalette(DukePlayer_t *player,uint8_t palid,int32_t set);
|
||||
int32_t app_main(int32_t argc,const char **argv);
|
||||
void computergetinput(int32_t snum,input_t *syn);
|
||||
void fadepal(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step);
|
||||
//void fadepaltile(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step,int32_t tile);
|
||||
|
||||
|
|
|
@ -5506,594 +5506,3 @@ HORIZONLY:
|
|||
|
||||
P_ProcessWeapon(snum);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
//UPDATE THIS FILE OVER THE OLD GETSPRITESCORE/COMPUTERGETINPUT FUNCTIONS
|
||||
static int32_t getspritescore(int32_t snum, int32_t dapicnum)
|
||||
{
|
||||
switch (DYNAMICTILEMAP(dapicnum))
|
||||
{
|
||||
case FIRSTGUNSPRITE__STATIC:
|
||||
return(20);
|
||||
case CHAINGUNSPRITE__STATIC:
|
||||
return(50);
|
||||
case RPGSPRITE__STATIC:
|
||||
return(200);
|
||||
case FREEZESPRITE__STATIC:
|
||||
return(25);
|
||||
case SHRINKERSPRITE__STATIC:
|
||||
return(80);
|
||||
case HEAVYHBOMB__STATIC:
|
||||
return(60);
|
||||
case TRIPBOMBSPRITE__STATIC:
|
||||
return(50);
|
||||
case SHOTGUNSPRITE__STATIC:
|
||||
return(120);
|
||||
case DEVISTATORSPRITE__STATIC:
|
||||
return(120);
|
||||
|
||||
case FREEZEAMMO__STATIC:
|
||||
if (g_player[snum].ps->ammo_amount[FREEZE_WEAPON] < g_player[snum].ps->max_ammo_amount[FREEZE_WEAPON]) return(10);
|
||||
return(1);
|
||||
case AMMO__STATIC:
|
||||
if (g_player[snum].ps->ammo_amount[PISTOL_WEAPON] < g_player[snum].ps->max_ammo_amount[PISTOL_WEAPON]) return(10);
|
||||
return(1);
|
||||
case BATTERYAMMO__STATIC:
|
||||
if (g_player[snum].ps->ammo_amount[CHAINGUN_WEAPON] < g_player[snum].ps->max_ammo_amount[CHAINGUN_WEAPON]) return(20);
|
||||
return(1);
|
||||
case DEVISTATORAMMO__STATIC:
|
||||
if (g_player[snum].ps->ammo_amount[DEVISTATOR_WEAPON] < g_player[snum].ps->max_ammo_amount[DEVISTATOR_WEAPON]) return(25);
|
||||
return(1);
|
||||
case RPGAMMO__STATIC:
|
||||
if (g_player[snum].ps->ammo_amount[RPG_WEAPON] < g_player[snum].ps->max_ammo_amount[RPG_WEAPON]) return(50);
|
||||
return(1);
|
||||
case CRYSTALAMMO__STATIC:
|
||||
if (g_player[snum].ps->ammo_amount[SHRINKER_WEAPON] < g_player[snum].ps->max_ammo_amount[SHRINKER_WEAPON]) return(10);
|
||||
return(1);
|
||||
case HBOMBAMMO__STATIC:
|
||||
if (g_player[snum].ps->ammo_amount[HANDBOMB_WEAPON] < g_player[snum].ps->max_ammo_amount[HANDBOMB_WEAPON]) return(30);
|
||||
return(1);
|
||||
case SHOTGUNAMMO__STATIC:
|
||||
if (g_player[snum].ps->ammo_amount[SHOTGUN_WEAPON] < g_player[snum].ps->max_ammo_amount[SHOTGUN_WEAPON]) return(25);
|
||||
return(1);
|
||||
|
||||
case COLA__STATIC:
|
||||
if (sprite[g_player[snum].ps->i].extra < g_player[snum].ps->max_player_health) return(10);
|
||||
return(1);
|
||||
case SIXPAK__STATIC:
|
||||
if (sprite[g_player[snum].ps->i].extra < g_player[snum].ps->max_player_health) return(30);
|
||||
return(1);
|
||||
case FIRSTAID__STATIC:
|
||||
if (g_player[snum].ps->inv_amount[GET_FIRSTAID] < g_player[snum].ps->max_player_health) return(100);
|
||||
return(1);
|
||||
case SHIELD__STATIC:
|
||||
if (g_player[snum].ps->inv_amount[GET_SHIELD] < g_player[snum].ps->max_shield_amount) return(50);
|
||||
return(1);
|
||||
case STEROIDS__STATIC:
|
||||
if (g_player[snum].ps->inv_amount[GET_STEROIDS] < 400) return(30);
|
||||
return(1);
|
||||
case AIRTANK__STATIC:
|
||||
if (g_player[snum].ps->inv_amount[GET_SCUBA] < 6400) return(30);
|
||||
return(1);
|
||||
case JETPACK__STATIC:
|
||||
if (g_player[snum].ps->inv_amount[GET_JETPACK] < 1600) return(100);
|
||||
return(1);
|
||||
case HEATSENSOR__STATIC:
|
||||
if (g_player[snum].ps->inv_amount[GET_HEATS] < 1200) return(5);
|
||||
return(1);
|
||||
case ACCESSCARD__STATIC:
|
||||
return(1);
|
||||
case BOOTS__STATIC:
|
||||
if (g_player[snum].ps->inv_amount[GET_BOOTS] < 200) return(15);
|
||||
return(1);
|
||||
case ATOMICHEALTH__STATIC:
|
||||
if (sprite[g_player[snum].ps->i].extra < g_player[snum].ps->max_player_health<<1) return(50);
|
||||
return(1);
|
||||
case HOLODUKE__STATIC:
|
||||
if (g_player[snum].ps->inv_amount[GET_HOLODUKE] < 2400) return(5);
|
||||
return(1);
|
||||
case MUSICANDSFX__STATIC:
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int32_t fdmatrix[12][12] =
|
||||
{
|
||||
//KNEE PIST SHOT CHAIN RPG PIPE SHRI DEVI WALL FREE HAND EXPA
|
||||
{ 128, -1, -1, -1, 128, -1, -1, -1, 128, -1, 128, -1 }, //KNEE
|
||||
{ 1024,1024,1024,1024,2560, 128,2560,2560,1024,2560,2560,2560 }, //PIST
|
||||
{ 512, 512, 512, 512,2560, 128,2560,2560,1024,2560,2560,2560 }, //SHOT
|
||||
{ 512, 512, 512, 512,2560, 128,2560,2560,1024,2560,2560,2560 }, //CHAIN
|
||||
{ 2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560 }, //RPG
|
||||
{ 512, 512, 512, 512,2048, 512,2560,2560, 512,2560,2560,2560 }, //PIPE
|
||||
{ 128, 128, 128, 128,2560, 128,2560,2560, 128, 128, 128, 128 }, //SHRI
|
||||
{ 1536,1536,1536,1536,2560,1536,1536,1536,1536,1536,1536,1536 }, //DEVI
|
||||
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, //WALL
|
||||
{ 128, 128, 128, 128,2560, 128,2560,2560, 128, 128, 128, 128 }, //FREE
|
||||
{ 2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560,2560 }, //HAND
|
||||
{ 128, 128, 128, 128,2560, 128,2560,2560, 128, 128, 128, 128 } //EXPA
|
||||
};
|
||||
|
||||
static int32_t goalx[MAXPLAYERS], goaly[MAXPLAYERS], goalz[MAXPLAYERS];
|
||||
static int32_t goalsect[MAXPLAYERS], goalwall[MAXPLAYERS], goalsprite[MAXPLAYERS], goalspritescore[MAXPLAYERS];
|
||||
static int32_t goalplayer[MAXPLAYERS], clipmovecount[MAXPLAYERS];
|
||||
|
||||
static int16_t searchsect[MAXSECTORS], searchparent[MAXSECTORS];
|
||||
static char dashow2dsector[(MAXSECTORS+7)>>3];
|
||||
|
||||
void computergetinput(int32_t snum, input_t *syn)
|
||||
{
|
||||
int32_t i, j, k, l, x1, y1, z1, x2, y2, z2, x3, y3, z3, dx, dy;
|
||||
int32_t dist, daang, zang, fightdist, damyang, damysect;
|
||||
int32_t startsect, endsect, splc, send, startwall, endwall;
|
||||
hitdata_t hit;
|
||||
DukePlayer_t *p = g_player[snum].ps;
|
||||
walltype *wal;
|
||||
|
||||
syn->fvel = 0;
|
||||
syn->svel = 0;
|
||||
syn->avel = 0;
|
||||
syn->horz = 0;
|
||||
syn->bits = 0;
|
||||
syn->extbits = 0;
|
||||
|
||||
x1 = sprite[p->i].x;
|
||||
y1 = sprite[p->i].y;
|
||||
z1 = sprite[p->i].z;
|
||||
damyang = sprite[p->i].ang;
|
||||
damysect = sprite[p->i].sectnum;
|
||||
if ((numplayers >= 2) && (snum == myconnectindex))
|
||||
{
|
||||
x1 = my.x;
|
||||
y1 = my.y;
|
||||
z1 = my.z+PHEIGHT;
|
||||
damyang = myang;
|
||||
damysect = mycursectnum;
|
||||
}
|
||||
|
||||
if (!(numframes&7))
|
||||
{
|
||||
x2 = sprite[g_player[goalplayer[snum]].ps->i].x;
|
||||
y2 = sprite[g_player[goalplayer[snum]].ps->i].y;
|
||||
z2 = sprite[g_player[goalplayer[snum]].ps->i].z;
|
||||
|
||||
if (!cansee(x1,y1,z1-(48<<8),damysect,x2,y2,z2-(48<<8),sprite[g_player[goalplayer[snum]].ps->i].sectnum))
|
||||
goalplayer[snum] = snum;
|
||||
}
|
||||
|
||||
if ((goalplayer[snum] == snum) || (g_player[goalplayer[snum]].ps->dead_flag != 0))
|
||||
{
|
||||
j = 0x7fffffff;
|
||||
for (TRAVERSE_CONNECT(i))
|
||||
if (i != snum && !(GTFLAGS(GAMETYPE_TDM) && g_player[snum].ps->team == g_player[i].ps->team))
|
||||
{
|
||||
const spritetype *const pspr = &sprite[g_player[i].ps->i];
|
||||
|
||||
dist = ksqrt(uhypsq(pspr->x-x1, pspr->y-y1));
|
||||
|
||||
x2 = sprite[g_player[i].ps->i].x;
|
||||
y2 = sprite[g_player[i].ps->i].y;
|
||||
z2 = sprite[g_player[i].ps->i].z;
|
||||
if (!cansee(x1,y1,z1-(48<<8),damysect,x2,y2,z2-(48<<8),sprite[g_player[i].ps->i].sectnum))
|
||||
dist <<= 1;
|
||||
|
||||
if (dist < j)
|
||||
{
|
||||
j = dist;
|
||||
goalplayer[snum] = i;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
x2 = sprite[g_player[goalplayer[snum]].ps->i].x;
|
||||
y2 = sprite[g_player[goalplayer[snum]].ps->i].y;
|
||||
z2 = sprite[g_player[goalplayer[snum]].ps->i].z;
|
||||
|
||||
if (p->dead_flag) syn->bits |= BIT(SK_OPEN);
|
||||
if ((p->inv_amount[GET_FIRSTAID] > 0) && (p->last_extra < 100))
|
||||
syn->bits |= BIT(SK_MEDKIT);
|
||||
|
||||
for (j=headspritestat[STAT_PROJECTILE]; j>=0; j=nextspritestat[j])
|
||||
{
|
||||
switch (DYNAMICTILEMAP(sprite[j].picnum))
|
||||
{
|
||||
case TONGUE__STATIC:
|
||||
k = 4;
|
||||
break;
|
||||
case FREEZEBLAST__STATIC:
|
||||
k = 4;
|
||||
break;
|
||||
case SHRINKSPARK__STATIC:
|
||||
k = 16;
|
||||
break;
|
||||
case RPG__STATIC:
|
||||
k = 16;
|
||||
break;
|
||||
default:
|
||||
k = 0;
|
||||
break;
|
||||
}
|
||||
if (k)
|
||||
{
|
||||
x3 = sprite[j].x;
|
||||
y3 = sprite[j].y;
|
||||
z3 = sprite[j].z;
|
||||
for (l=0; l<=8; l++)
|
||||
{
|
||||
if (tmulscale11(x3-x1,x3-x1,y3-y1,y3-y1,(z3-z1)>>4,(z3-z1)>>4) < 3072)
|
||||
{
|
||||
dx = sintable[(sprite[j].ang+512)&2047];
|
||||
dy = sintable[sprite[j].ang&2047];
|
||||
if ((x1-x3)*dy > (y1-y3)*dx) i = -k*512;
|
||||
else i = k*512;
|
||||
syn->fvel -= mulscale17(dy,i);
|
||||
syn->svel += mulscale17(dx,i);
|
||||
}
|
||||
if (l < 7)
|
||||
{
|
||||
x3 += (mulscale14(sprite[j].xvel,sintable[(sprite[j].ang+512)&2047])<<2);
|
||||
y3 += (mulscale14(sprite[j].xvel,sintable[sprite[j].ang&2047])<<2);
|
||||
z3 += (sprite[j].zvel<<2);
|
||||
}
|
||||
else
|
||||
{
|
||||
hitscan((const vec3_t *)&sprite[j],sprite[j].sectnum,
|
||||
mulscale14(sprite[j].xvel,sintable[(sprite[j].ang+512)&2047]),
|
||||
mulscale14(sprite[j].xvel,sintable[sprite[j].ang&2047]),
|
||||
(int32_t)sprite[j].zvel,
|
||||
&hit,CLIPMASK1);
|
||||
x3 = hit.pos.x;
|
||||
y3 = hit.pos.y;
|
||||
z3 = hit.pos.z;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((g_player[goalplayer[snum]].ps->dead_flag == 0) &&
|
||||
((cansee(x1,y1,z1,damysect,x2,y2,z2,sprite[g_player[goalplayer[snum]].ps->i].sectnum)) ||
|
||||
(cansee(x1,y1,z1-(24<<8),damysect,x2,y2,z2-(24<<8),sprite[g_player[goalplayer[snum]].ps->i].sectnum)) ||
|
||||
(cansee(x1,y1,z1-(48<<8),damysect,x2,y2,z2-(48<<8),sprite[g_player[goalplayer[snum]].ps->i].sectnum))))
|
||||
{
|
||||
syn->bits |= BIT(SK_FIRE);
|
||||
|
||||
if ((p->curr_weapon == HANDBOMB_WEAPON) && (!(rand()&7)))
|
||||
syn->bits &= ~BIT(SK_FIRE);
|
||||
|
||||
if (p->curr_weapon == TRIPBOMB_WEAPON)
|
||||
syn->bits |= ((rand()%MAX_WEAPONS)<<SK_WEAPON_BITS);
|
||||
|
||||
if (p->curr_weapon == RPG_WEAPON)
|
||||
{
|
||||
vec3_t vect;
|
||||
vect.x = x1;
|
||||
vect.y = y1;
|
||||
vect.z = z1-PHEIGHT;
|
||||
hitscan((const vec3_t *)&vect,damysect,sintable[(damyang+512)&2047],sintable[damyang&2047],
|
||||
(100-p->horiz-p->horizoff)*32,&hit,CLIPMASK1);
|
||||
x3 = hit.pos.x;
|
||||
y3 = hit.pos.y;
|
||||
z3 = hit.pos.z;
|
||||
if ((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1) < 2560*2560) syn->bits &= ~BIT(SK_FIRE);
|
||||
}
|
||||
|
||||
|
||||
fightdist = fdmatrix[p->curr_weapon][g_player[goalplayer[snum]].ps->curr_weapon];
|
||||
if (fightdist < 128) fightdist = 128;
|
||||
dist = ksqrt(uhypsq(x2-x1, y2-y1));
|
||||
if (dist == 0) dist = 1;
|
||||
daang = getangle(x2+(g_player[goalplayer[snum]].ps->vel.x>>14)-x1,y2+(g_player[goalplayer[snum]].ps->vel.y>>14)-y1);
|
||||
zang = 100-((z2-z1)*8)/dist;
|
||||
fightdist = max(fightdist,(klabs(z2-z1)>>4));
|
||||
|
||||
if (sprite[g_player[goalplayer[snum]].ps->i].yrepeat < 32)
|
||||
{
|
||||
fightdist = 0;
|
||||
syn->bits &= ~BIT(SK_FIRE);
|
||||
}
|
||||
if (sprite[g_player[goalplayer[snum]].ps->i].pal == 1)
|
||||
{
|
||||
fightdist = 0;
|
||||
syn->bits &= ~BIT(SK_FIRE);
|
||||
}
|
||||
|
||||
if (dist < 256) syn->bits |= BIT(SK_QUICK_KICK);
|
||||
|
||||
x3 = x2+((x1-x2)*fightdist/dist);
|
||||
y3 = y2+((y1-y2)*fightdist/dist);
|
||||
syn->fvel += (x3-x1)*2047/dist;
|
||||
syn->svel += (y3-y1)*2047/dist;
|
||||
|
||||
//Strafe attack
|
||||
if (fightdist)
|
||||
{
|
||||
j = totalclock+snum*13468;
|
||||
i = sintable[(j<<6)&2047];
|
||||
i += sintable[((j+4245)<<5)&2047];
|
||||
i += sintable[((j+6745)<<4)&2047];
|
||||
i += sintable[((j+15685)<<3)&2047];
|
||||
dx = sintable[(sprite[g_player[goalplayer[snum]].ps->i].ang+512)&2047];
|
||||
dy = sintable[sprite[g_player[goalplayer[snum]].ps->i].ang&2047];
|
||||
if ((x1-x2)*dy > (y1-y2)*dx) i += 8192;
|
||||
else i -= 8192;
|
||||
syn->fvel += ((sintable[(daang+1024)&2047]*i)>>17);
|
||||
syn->svel += ((sintable[(daang+512)&2047]*i)>>17);
|
||||
}
|
||||
|
||||
syn->avel = min(max((((daang+1024-damyang)&2047)-1024)>>1,-127),127);
|
||||
syn->horz = min(max((zang-p->horiz),-MAXHORIZ),MAXHORIZ);
|
||||
syn->bits |= BIT(SK_AIMMODE);
|
||||
return;
|
||||
}
|
||||
|
||||
goalsect[snum] = -1;
|
||||
if (goalsect[snum] < 0)
|
||||
{
|
||||
goalwall[snum] = -1;
|
||||
startsect = sprite[p->i].sectnum;
|
||||
endsect = sprite[g_player[goalplayer[snum]].ps->i].sectnum;
|
||||
|
||||
clearbufbyte(dashow2dsector,(MAXSECTORS+7)>>3,0L);
|
||||
searchsect[0] = startsect;
|
||||
searchparent[0] = -1;
|
||||
dashow2dsector[startsect>>3] |= (1<<(startsect&7));
|
||||
for (splc=0,send=1; splc<send; splc++)
|
||||
{
|
||||
startwall = sector[searchsect[splc]].wallptr;
|
||||
endwall = startwall + sector[searchsect[splc]].wallnum;
|
||||
for (i=startwall,wal=&wall[startwall]; i<endwall; i++,wal++)
|
||||
{
|
||||
j = wal->nextsector;
|
||||
if (j < 0) continue;
|
||||
|
||||
dx = ((wall[wal->point2].x+wal->x)>>1);
|
||||
dy = ((wall[wal->point2].y+wal->y)>>1);
|
||||
if ((getceilzofslope(j,dx,dy) > getflorzofslope(j,dx,dy)-(28<<8)) && ((sector[j].lotag < 15) || (sector[j].lotag > 22)))
|
||||
continue;
|
||||
if (getflorzofslope(j,dx,dy) < getflorzofslope(searchsect[splc],dx,dy)-(72<<8))
|
||||
continue;
|
||||
if ((dashow2dsector[j>>3]&(1<<(j&7))) == 0)
|
||||
{
|
||||
dashow2dsector[j>>3] |= (1<<(j&7));
|
||||
searchsect[send] = (int16_t)j;
|
||||
searchparent[send] = (int16_t)splc;
|
||||
send++;
|
||||
if (j == endsect)
|
||||
{
|
||||
clearbufbyte(dashow2dsector,(MAXSECTORS+7)>>3,0L);
|
||||
for (k=send-1; k>=0; k=searchparent[k])
|
||||
dashow2dsector[searchsect[k]>>3] |= (1<<(searchsect[k]&7));
|
||||
|
||||
for (k=send-1; k>=0; k=searchparent[k])
|
||||
if (!searchparent[k]) break;
|
||||
|
||||
goalsect[snum] = searchsect[k];
|
||||
startwall = sector[goalsect[snum]].wallptr;
|
||||
endwall = startwall+sector[goalsect[snum]].wallnum;
|
||||
x3 = y3 = 0;
|
||||
for (i=startwall; i<endwall; i++)
|
||||
{
|
||||
x3 += wall[i].x;
|
||||
y3 += wall[i].y;
|
||||
}
|
||||
x3 /= (endwall-startwall);
|
||||
y3 /= (endwall-startwall);
|
||||
|
||||
startwall = sector[startsect].wallptr;
|
||||
endwall = startwall+sector[startsect].wallnum;
|
||||
l = 0;
|
||||
k = startwall;
|
||||
for (i=startwall; i<endwall; i++)
|
||||
{
|
||||
if (wall[i].nextsector != goalsect[snum]) continue;
|
||||
dx = wall[wall[i].point2].x-wall[i].x;
|
||||
dy = wall[wall[i].point2].y-wall[i].y;
|
||||
|
||||
//if (dx*(y1-wall[i].y) <= dy*(x1-wall[i].x))
|
||||
// if (dx*(y2-wall[i].y) >= dy*(x2-wall[i].x))
|
||||
if ((x3-x1)*(wall[i].y-y1) <= (y3-y1)*(wall[i].x-x1))
|
||||
if ((x3-x1)*(wall[wall[i].point2].y-y1) >= (y3-y1)*(wall[wall[i].point2].x-x1))
|
||||
{
|
||||
k = i;
|
||||
break;
|
||||
}
|
||||
|
||||
dist = ksqrt(uhypsq(dx,dy));
|
||||
if (dist > l)
|
||||
{
|
||||
l = dist;
|
||||
k = i;
|
||||
}
|
||||
|
||||
}
|
||||
goalwall[snum] = k;
|
||||
daang = ((getangle(wall[wall[k].point2].x-wall[k].x,wall[wall[k].point2].y-wall[k].y)+1536)&2047);
|
||||
goalx[snum] = ((wall[k].x+wall[wall[k].point2].x)>>1)+(sintable[(daang+512)&2047]>>8);
|
||||
goaly[snum] = ((wall[k].y+wall[wall[k].point2].y)>>1)+(sintable[daang&2047]>>8);
|
||||
goalz[snum] = sector[goalsect[snum]].floorz-(32<<8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i=headspritesect[searchsect[splc]]; i>=0; i=nextspritesect[i])
|
||||
if (sprite[i].lotag == 7)
|
||||
{
|
||||
j = sprite[sprite[i].owner].sectnum;
|
||||
if ((dashow2dsector[j>>3]&(1<<(j&7))) == 0)
|
||||
{
|
||||
dashow2dsector[j>>3] |= (1<<(j&7));
|
||||
searchsect[send] = (int16_t)j;
|
||||
searchparent[send] = (int16_t)splc;
|
||||
send++;
|
||||
if (j == endsect)
|
||||
{
|
||||
clearbufbyte(dashow2dsector,(MAXSECTORS+7)>>3,0L);
|
||||
for (k=send-1; k>=0; k=searchparent[k])
|
||||
dashow2dsector[searchsect[k]>>3] |= (1<<(searchsect[k]&7));
|
||||
|
||||
for (k=send-1; k>=0; k=searchparent[k])
|
||||
if (!searchparent[k]) break;
|
||||
|
||||
goalsect[snum] = searchsect[k];
|
||||
startwall = sector[startsect].wallptr;
|
||||
endwall = startwall+sector[startsect].wallnum;
|
||||
l = 0;
|
||||
k = startwall;
|
||||
for (i=startwall; i<endwall; i++)
|
||||
{
|
||||
dx = wall[wall[i].point2].x-wall[i].x;
|
||||
dy = wall[wall[i].point2].y-wall[i].y;
|
||||
dist = ksqrt(uhypsq(dx,dy));
|
||||
if ((wall[i].nextsector == goalsect[snum]) && (dist > l))
|
||||
{
|
||||
l = dist;
|
||||
k = i;
|
||||
}
|
||||
|
||||
}
|
||||
goalwall[snum] = k;
|
||||
daang = ((getangle(wall[wall[k].point2].x-wall[k].x,wall[wall[k].point2].y-wall[k].y)+1536)&2047);
|
||||
goalx[snum] = ((wall[k].x+wall[wall[k].point2].x)>>1)+(sintable[(daang+512)&2047]>>8);
|
||||
goaly[snum] = ((wall[k].y+wall[wall[k].point2].y)>>1)+(sintable[daang&2047]>>8);
|
||||
goalz[snum] = sector[goalsect[snum]].floorz-(32<<8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (goalwall[snum] >= 0) break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((goalsect[snum] < 0) || (goalwall[snum] < 0))
|
||||
{
|
||||
if (goalsprite[snum] < 0 || !cansee(x1,y1,z1-(32<<8),damysect,sprite[goalsprite[snum]].x,sprite[goalsprite[snum]].y,sprite[goalsprite[snum]].z-(4<<8),i))
|
||||
{
|
||||
int32_t bestsprite = -1, spritescore = 0;
|
||||
|
||||
for (k=0; k<16; k++)
|
||||
{
|
||||
i = (rand()%numsectors);
|
||||
for (j=headspritesect[i]; j>=0; j=nextspritesect[j])
|
||||
{
|
||||
if ((sprite[j].xrepeat <= 0) || (sprite[j].yrepeat <= 0)) continue;
|
||||
if (getspritescore(snum,sprite[j].picnum) <= 0) continue;
|
||||
if (cansee(x1,y1,z1-(32<<8),damysect,sprite[j].x,sprite[j].y,sprite[j].z-(4<<8),i))
|
||||
{
|
||||
if (getspritescore(snum,sprite[j].picnum) > spritescore)
|
||||
{
|
||||
spritescore = getspritescore(snum,sprite[j].picnum);
|
||||
bestsprite = j;
|
||||
}
|
||||
// break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bestsprite != -1 && (goalsprite[snum] < 0 || spritescore > goalspritescore[snum]))
|
||||
{
|
||||
goalx[snum] = sprite[bestsprite].x;
|
||||
goaly[snum] = sprite[bestsprite].y;
|
||||
goalz[snum] = sprite[bestsprite].z;
|
||||
goalsprite[snum] = bestsprite;
|
||||
goalspritescore[snum] = spritescore;
|
||||
}
|
||||
}
|
||||
x2 = goalx[snum];
|
||||
y2 = goaly[snum];
|
||||
dist = ksqrt(uhypsq(x2-x1, y2-y1));
|
||||
if (!dist) return;
|
||||
daang = getangle(x2-x1,y2-y1);
|
||||
syn->fvel += (x2-x1)*2047/dist;
|
||||
syn->svel += (y2-y1)*2047/dist;
|
||||
syn->avel = min(max((((daang+1024-damyang)&2047)-1024)>>3,-127),127);
|
||||
}
|
||||
else if (goalsprite[snum] != -1)
|
||||
{
|
||||
if (!cansee(x1,y1,z1-(32<<8),damysect,sprite[goalsprite[snum]].x,sprite[goalsprite[snum]].y,sprite[goalsprite[snum]].z-(4<<8),i))
|
||||
{
|
||||
goalspritescore[snum] = 0;
|
||||
goalsprite[snum] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
vec3_t vect;
|
||||
int16_t dasect = p->cursectnum;
|
||||
Bmemcpy(&vect,p,sizeof(vec3_t));
|
||||
|
||||
i = clipmove(&vect,&dasect,p->vel.x,p->vel.y,164L,4L<<8,4L<<8,CLIPMASK0);
|
||||
if (!i)
|
||||
{
|
||||
Bmemcpy(&vect,p,sizeof(vec3_t));
|
||||
vect.z += (24<<8);
|
||||
dasect = p->cursectnum;
|
||||
i = clipmove(&vect,&dasect,p->vel.x,p->vel.y,164L,4L<<8,4L<<8,CLIPMASK0);
|
||||
}
|
||||
}
|
||||
if (i)
|
||||
{
|
||||
clipmovecount[snum]++;
|
||||
|
||||
j = 0;
|
||||
if ((i&0xc000) == 32768) //Hit a wall (49152 for sprite)
|
||||
if (wall[i&(MAXWALLS-1)].nextsector >= 0)
|
||||
{
|
||||
if (getflorzofslope(wall[i&(MAXWALLS-1)].nextsector,p->pos.x,p->pos.y) <= p->pos.z+(24<<8)) j |= 1;
|
||||
if (getceilzofslope(wall[i&(MAXWALLS-1)].nextsector,p->pos.x,p->pos.y) >= p->pos.z-(24<<8)) j |= 2;
|
||||
}
|
||||
if ((i&0xc000) == 49152) j = 1;
|
||||
if (j&1) if (clipmovecount[snum] == 4) syn->bits |= BIT(SK_JUMP);
|
||||
if (j&2) syn->bits |= BIT(SK_CROUCH);
|
||||
|
||||
//Strafe attack
|
||||
daang = getangle(x2-x1,y2-y1);
|
||||
if ((i&0xc000) == 32768)
|
||||
daang = getangle(wall[wall[i&(MAXWALLS-1)].point2].x-wall[i&(MAXWALLS-1)].x,wall[wall[i&(MAXWALLS-1)].point2].y-wall[i&(MAXWALLS-1)].y);
|
||||
j = totalclock+snum*13468;
|
||||
i = sintable[(j<<6)&2047];
|
||||
i += sintable[((j+4245)<<5)&2047];
|
||||
i += sintable[((j+6745)<<4)&2047];
|
||||
i += sintable[((j+15685)<<3)&2047];
|
||||
syn->fvel += ((sintable[(daang+1024)&2047]*i)>>17);
|
||||
syn->svel += ((sintable[(daang+512)&2047]*i)>>17);
|
||||
|
||||
if ((clipmovecount[snum]&31) == 2) syn->bits |= BIT(SK_OPEN);
|
||||
if ((clipmovecount[snum]&31) == 17) syn->bits |= BIT(SK_QUICK_KICK);
|
||||
if (clipmovecount[snum] > 32)
|
||||
{
|
||||
goalsect[snum] = -1;
|
||||
goalwall[snum] = -1;
|
||||
clipmovecount[snum] = 0;
|
||||
}
|
||||
|
||||
if (goalsprite[snum] != -1)
|
||||
{
|
||||
if (!cansee(x1,y1,z1-(32<<8),damysect,sprite[goalsprite[snum]].x,sprite[goalsprite[snum]].y,sprite[goalsprite[snum]].z-(4<<8),i))
|
||||
{
|
||||
goalsprite[snum] = -1;
|
||||
goalspritescore[snum] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
clipmovecount[snum] = 0;
|
||||
|
||||
if ((goalsect[snum] >= 0) && (goalwall[snum] >= 0))
|
||||
{
|
||||
x2 = goalx[snum];
|
||||
y2 = goaly[snum];
|
||||
dist = ksqrt(uhypsq(x2-x1, y2-y1));
|
||||
if (!dist) return;
|
||||
daang = getangle(x2-x1,y2-y1);
|
||||
if ((goalwall[snum] >= 0) && (dist < 4096))
|
||||
daang = ((getangle(wall[wall[goalwall[snum]].point2].x-wall[goalwall[snum]].x,wall[wall[goalwall[snum]].point2].y-wall[goalwall[snum]].y)+1536)&2047);
|
||||
syn->fvel += (x2-x1)*2047/dist;
|
||||
syn->svel += (y2-y1)*2047/dist;
|
||||
syn->avel = min(max((((daang+1024-damyang)&2047)-1024)>>3,-127),127);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -277,7 +277,6 @@ extern int32_t ticrandomseed;
|
|||
|
||||
int32_t A_GetHitscanRange(int32_t i);
|
||||
int32_t A_Shoot(int32_t i,int32_t atwith);
|
||||
//void computergetinput(int32_t snum,input_t *syn);
|
||||
void getinput(int32_t snum);
|
||||
void P_AddAmmo(int32_t weapon,DukePlayer_t *p,int32_t amount);
|
||||
void P_AddWeapon(DukePlayer_t *p,int32_t weapon);
|
||||
|
|
Loading…
Reference in a new issue