mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Minor fixes and a couple of improvements to the fake AI players
git-svn-id: https://svn.eduke32.com/eduke32@419 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
cd4e66b71a
commit
ccb6ff7141
7 changed files with 83 additions and 63 deletions
|
@ -5945,8 +5945,7 @@ long getlinehighlight(long xplc, long yplc)
|
|||
closest = wall[closest].nextwall;
|
||||
}
|
||||
if ((pointhighlight&0xc000) == 16384) return (-1);
|
||||
else return(closest);
|
||||
|
||||
return(closest);
|
||||
}
|
||||
|
||||
long getpointhighlight(long xplc, long yplc)
|
||||
|
|
|
@ -886,6 +886,7 @@ int getexternaladdress(char *buffer)
|
|||
return(1);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
int getversionfromwebsite(char *buffer) // FIXME: this probably belongs in game land
|
||||
{
|
||||
int bytes_sent, i=0, j=0;
|
||||
|
@ -950,16 +951,16 @@ int getversionfromwebsite(char *buffer) // FIXME: this probably belongs in game
|
|||
for (i=0;(unsigned)i<strlen(tempbuf);i++) // HACK: all of this needs to die a fiery death; we just skip to the content
|
||||
{ // instead of actually parsing any of the http headers
|
||||
if (i > 4)
|
||||
if (tempbuf[i-1] == '\n' && tempbuf[i-2] == '\r' && tempbuf[i-3] == '\n' && tempbuf[i-4] == '\r')
|
||||
{
|
||||
while (j < 9)
|
||||
if (tempbuf[i-1] == '\n' && tempbuf[i-2] == '\r' && tempbuf[i-3] == '\n' && tempbuf[i-4] == '\r')
|
||||
{
|
||||
ver[j] = tempbuf[i];
|
||||
i++, j++;
|
||||
while (j < 9)
|
||||
{
|
||||
ver[j] = tempbuf[i];
|
||||
i++, j++;
|
||||
}
|
||||
ver[j] = '\0';
|
||||
break;
|
||||
}
|
||||
ver[j] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (j)
|
||||
|
@ -970,3 +971,4 @@ int getversionfromwebsite(char *buffer) // FIXME: this probably belongs in game
|
|||
}
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -377,7 +377,7 @@ inline int mpgametext(int y,char *t,char s,short dabits)
|
|||
{
|
||||
if (xdim >= 640 && ydim >= 480)
|
||||
return(gametext_(1,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1));
|
||||
else return(gametext_(0,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1));
|
||||
return(gametext_(0,STARTALPHANUM, 5,y,t,s,0,dabits,0, 0, xdim-1, ydim-1));
|
||||
}
|
||||
|
||||
static int minitext_(int x,int y,char *t,char s,char p,short sb)
|
||||
|
@ -1436,8 +1436,7 @@ int checkspriteflags(short sActor, int iType)
|
|||
{
|
||||
int i;
|
||||
|
||||
i = spriteflags[sprite[sActor].picnum];
|
||||
i ^= actorspriteflags[sActor];
|
||||
i = (spriteflags[sprite[sActor].picnum]^actorspriteflags[sActor]);
|
||||
if (i & iType) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -2707,7 +2706,7 @@ inline short mpstrget(short x,short y,char *t,short dalen,short c)
|
|||
{
|
||||
if (xdim >= 640 && ydim >= 480)
|
||||
return(strgetsm(x,y,t,dalen,c));
|
||||
else return(strget(x,y,t,dalen,c));
|
||||
return(strget(x,y,t,dalen,c));
|
||||
}
|
||||
|
||||
static void typemode(void)
|
||||
|
@ -3253,14 +3252,14 @@ void displayrest(long smoothratio)
|
|||
dotint = 1;
|
||||
}
|
||||
// reset a normal palette
|
||||
else if (restorepalette)
|
||||
/* else */ if (restorepalette)
|
||||
{
|
||||
//setbrightness(ud.brightness>>2,&pp->palette[0],0);
|
||||
setgamepalette(pp,pp->palette,2);
|
||||
restorepalette = 0;
|
||||
}
|
||||
// loogies courtesy of being snotted on
|
||||
else if (pp->loogcnt > 0)
|
||||
/* else */ if (pp->loogcnt > 0)
|
||||
{
|
||||
//palto(0,64,0,(pp->loogcnt>>1)+128);
|
||||
fader = 0;
|
||||
|
@ -9797,6 +9796,7 @@ void app_main(int argc,char **argv)
|
|||
}
|
||||
}
|
||||
}
|
||||
else initprintf("update: failed to check for updates\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -440,13 +440,13 @@ long GetGameVarID(int id, short sActor, short sPlayer)
|
|||
{
|
||||
//Bsprintf(g_szBuf,"GetGameVarID(%d, %d, %d) returns %ld\n",id,sActor,sPlayer, aGameVars[id].plValues[sPlayer]);
|
||||
//AddLog(g_szBuf);
|
||||
if (m) return -aGameVars[id].plValues[sPlayer];
|
||||
else return aGameVars[id].plValues[sPlayer];
|
||||
if (m) return (-aGameVars[id].plValues[sPlayer]);
|
||||
return (aGameVars[id].plValues[sPlayer]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m) return -aGameVars[id].lValue;
|
||||
else return aGameVars[id].lValue;
|
||||
if (m) return (-aGameVars[id].lValue);
|
||||
return (aGameVars[id].lValue);
|
||||
}
|
||||
}
|
||||
else if (aGameVars[id].dwFlags & GAMEVAR_FLAG_PERACTOR)
|
||||
|
@ -454,24 +454,24 @@ long GetGameVarID(int id, short sActor, short sPlayer)
|
|||
// for the current actor
|
||||
if (sActor >= 0 && sActor <=MAXSPRITES)
|
||||
{
|
||||
if (m) return -aGameVars[id].plValues[sActor];
|
||||
else return aGameVars[id].plValues[sActor];
|
||||
if (m) return (-aGameVars[id].plValues[sActor]);
|
||||
return (aGameVars[id].plValues[sActor]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m) return -aGameVars[id].lValue;
|
||||
else return aGameVars[id].lValue;
|
||||
if (m) return (-aGameVars[id].lValue);
|
||||
return (aGameVars[id].lValue);
|
||||
}
|
||||
}
|
||||
else if (aGameVars[id].dwFlags & GAMEVAR_FLAG_PLONG)
|
||||
{
|
||||
if (m) return -(*((long*)aGameVars[id].lValue));
|
||||
else return(*((long*)aGameVars[id].lValue));
|
||||
return(*((long*)aGameVars[id].lValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m) return -aGameVars[id].lValue;
|
||||
else return aGameVars[id].lValue;
|
||||
if (m) return (-aGameVars[id].lValue);
|
||||
return (aGameVars[id].lValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ static int probe_(int type,int x,int y,int i,int n)
|
|||
return(probey);
|
||||
else if (KB_KeyPressed(sc_RightArrow) || KB_KeyPressed(sc_kpad_6) || ((buttonstat&1) && (WHEELUP || mii > 256)))
|
||||
return(probey);
|
||||
else return(-probey-2);
|
||||
return(-probey-2);
|
||||
}
|
||||
}
|
||||
static inline int probe(int x,int y,int i,int n)
|
||||
|
@ -2649,8 +2649,11 @@ cheat_for_port_credits:
|
|||
break;
|
||||
#ifdef _WIN32
|
||||
case 7:
|
||||
i = checkforupdates;
|
||||
if (x==io) checkforupdates = 1-checkforupdates;
|
||||
modval(0,1,(int *)&checkforupdates,1,probey==io);
|
||||
if (checkforupdates != i)
|
||||
lastupdatecheck = 0;
|
||||
gametextpal(d,yy, checkforupdates ? "On" : "Off", MENUHIGHLIGHT(io), 0);
|
||||
break;
|
||||
case 8:
|
||||
|
|
|
@ -5093,71 +5093,69 @@ int getspritescore(long snum, long dapicnum)
|
|||
|
||||
case FREEZEAMMO__STATIC:
|
||||
if (ps[snum].ammo_amount[FREEZE_WEAPON] < max_ammo_amount[FREEZE_WEAPON]) return(10);
|
||||
else return(0);
|
||||
return(0);
|
||||
case AMMO__STATIC:
|
||||
if (ps[snum].ammo_amount[PISTOL_WEAPON] < max_ammo_amount[PISTOL_WEAPON]) return(10);
|
||||
else return(0);
|
||||
return(0);
|
||||
case BATTERYAMMO__STATIC:
|
||||
if (ps[snum].ammo_amount[CHAINGUN_WEAPON] < max_ammo_amount[CHAINGUN_WEAPON]) return(20);
|
||||
else return(0);
|
||||
return(0);
|
||||
case DEVISTATORAMMO__STATIC:
|
||||
if (ps[snum].ammo_amount[DEVISTATOR_WEAPON] < max_ammo_amount[DEVISTATOR_WEAPON]) return(25);
|
||||
else return(0);
|
||||
return(0);
|
||||
case RPGAMMO__STATIC:
|
||||
if (ps[snum].ammo_amount[RPG_WEAPON] < max_ammo_amount[RPG_WEAPON]) return(50);
|
||||
else return(0);
|
||||
return(0);
|
||||
case CRYSTALAMMO__STATIC:
|
||||
if (ps[snum].ammo_amount[SHRINKER_WEAPON] < max_ammo_amount[SHRINKER_WEAPON]) return(10);
|
||||
else return(0);
|
||||
return(0);
|
||||
case HBOMBAMMO__STATIC:
|
||||
if (ps[snum].ammo_amount[HANDBOMB_WEAPON] < max_ammo_amount[HANDBOMB_WEAPON]) return(30);
|
||||
else return(0);
|
||||
return(0);
|
||||
case SHOTGUNAMMO__STATIC:
|
||||
if (ps[snum].ammo_amount[SHOTGUN_WEAPON] < max_ammo_amount[SHOTGUN_WEAPON]) return(25);
|
||||
else return(0);
|
||||
return(0);
|
||||
|
||||
case COLA__STATIC:
|
||||
if (sprite[ps[snum].i].extra < 100) return(10);
|
||||
else return(0);
|
||||
return(0);
|
||||
case SIXPAK__STATIC:
|
||||
if (sprite[ps[snum].i].extra < 100) return(30);
|
||||
else return(0);
|
||||
return(0);
|
||||
case FIRSTAID__STATIC:
|
||||
if (ps[snum].firstaid_amount < 100) return(100);
|
||||
else return(0);
|
||||
return(0);
|
||||
case SHIELD__STATIC:
|
||||
if (ps[snum].shield_amount < 100) return(50);
|
||||
else return(0);
|
||||
return(0);
|
||||
case STEROIDS__STATIC:
|
||||
if (ps[snum].steroids_amount < 400) return(30);
|
||||
else return(0);
|
||||
return(0);
|
||||
case AIRTANK__STATIC:
|
||||
if (ps[snum].scuba_amount < 6400) return(30);
|
||||
else return(0);
|
||||
return(0);
|
||||
case JETPACK__STATIC:
|
||||
if (ps[snum].jetpack_amount < 1600) return(100);
|
||||
else return(0);
|
||||
return(0);
|
||||
case HEATSENSOR__STATIC:
|
||||
if (ps[snum].heat_amount < 1200) return(5);
|
||||
else return(0);
|
||||
return(0);
|
||||
case ACCESSCARD__STATIC:
|
||||
return(1);
|
||||
case BOOTS__STATIC:
|
||||
if (ps[snum].boot_amount < 200) return(15);
|
||||
else return(0);
|
||||
return(0);
|
||||
case ATOMICHEALTH__STATIC:
|
||||
if (sprite[ps[snum].i].extra < max_player_health<<1) return(50);
|
||||
else return(0);
|
||||
return(0);
|
||||
case HOLODUKE__STATIC:
|
||||
if (ps[snum].holoduke_amount < 2400) return(5);
|
||||
else return(0);
|
||||
return(0);
|
||||
|
||||
case SECTOREFFECTOR__STATIC:
|
||||
return(1);
|
||||
case TOUCHPLATE__STATIC:
|
||||
return(1);
|
||||
return(5);
|
||||
case MUSICANDSFX__STATIC:
|
||||
return(1);
|
||||
return(10);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
@ -5180,7 +5178,7 @@ static long fdmatrix[12][12] =
|
|||
};
|
||||
|
||||
static long goalx[MAXPLAYERS], goaly[MAXPLAYERS], goalz[MAXPLAYERS];
|
||||
static long goalsect[MAXPLAYERS], goalwall[MAXPLAYERS], goalsprite[MAXPLAYERS];
|
||||
static long goalsect[MAXPLAYERS], goalwall[MAXPLAYERS], goalsprite[MAXPLAYERS], goalspritescore[MAXPLAYERS];
|
||||
static long goalplayer[MAXPLAYERS], clipmovecount[MAXPLAYERS];
|
||||
short searchsect[MAXSECTORS], searchparent[MAXSECTORS];
|
||||
char dashow2dsector[(MAXSECTORS+7)>>3];
|
||||
|
@ -5522,6 +5520,8 @@ void computergetinput(long snum, input *syn)
|
|||
{
|
||||
if (goalsprite[snum] < 0)
|
||||
{
|
||||
int bestsprite = -1, spritescore = 0;
|
||||
|
||||
for (k=0;k<4;k++)
|
||||
{
|
||||
i = (rand()%numsectors);
|
||||
|
@ -5531,15 +5531,24 @@ void computergetinput(long snum, input *syn)
|
|||
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))
|
||||
{
|
||||
goalx[snum] = sprite[j].x;
|
||||
goaly[snum] = sprite[j].y;
|
||||
goalz[snum] = sprite[j].z;
|
||||
goalsprite[snum] = j;
|
||||
break;
|
||||
if (getspritescore(snum,sprite[j].picnum) > spritescore)
|
||||
{
|
||||
spritescore = getspritescore(snum,sprite[j].picnum);
|
||||
bestsprite = j;
|
||||
}
|
||||
// break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (bestsprite != -1 && (!cansee(x1,y1,z1-(32<<8),damysect,sprite[goalsprite[snum]].x,sprite[goalsprite[snum]].y,sprite[goalsprite[snum]].z-(4<<8),i) ||
|
||||
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];
|
||||
|
@ -5550,8 +5559,11 @@ void computergetinput(long snum, input *syn)
|
|||
syn->svel += (y2-y1)*2047/dist;
|
||||
syn->avel = min(max((((daang+1024-damyang)&2047)-1024)>>3,-127),127);
|
||||
}
|
||||
else
|
||||
goalsprite[snum] = -1;
|
||||
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))
|
||||
goalsprite[snum] = -1;
|
||||
}
|
||||
|
||||
x3 = p->posx;
|
||||
y3 = p->posy;
|
||||
|
@ -5602,7 +5614,11 @@ void computergetinput(long snum, input *syn)
|
|||
clipmovecount[snum] = 0;
|
||||
}
|
||||
|
||||
goalsprite[snum] = -1;
|
||||
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;
|
||||
}
|
||||
}
|
||||
else
|
||||
clipmovecount[snum] = 0;
|
||||
|
|
|
@ -642,7 +642,7 @@ int issoundplaying(short i, int num)
|
|||
{
|
||||
if (Sound[num].lock == 200)
|
||||
return 1;
|
||||
else return 0;
|
||||
return 0;
|
||||
}
|
||||
else return(Sound[num].num);
|
||||
return(Sound[num].num);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue