mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 14:41:55 +00:00
- removed the bot code.
This would become a refactoring hassle, maybe re-add it later?
This commit is contained in:
parent
4538068bcc
commit
0b6f299d0e
5 changed files with 16 additions and 942 deletions
|
@ -384,10 +384,6 @@ DoShadows(tspriteptr_t tsp, int viewz, SWBOOL mirror)
|
|||
|
||||
if (sectnum < 0)
|
||||
{
|
||||
//int cz,fz;
|
||||
//getzsofslope(tsp->sectnum, tsp->x, tsp->y, &cz, &fz);
|
||||
////DSPRINTF(ds,"Shad sect !fnd x%d, y%d, z%d, sect%d, cz %d, fz %d", tsp->x, tsp->y, tsp->z, tsp->sectnum, cz, fz);
|
||||
//MONO_PRINT(ds);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -453,27 +449,22 @@ DoShadows(tspriteptr_t tsp, int viewz, SWBOOL mirror)
|
|||
New->xrepeat = xrepeat;
|
||||
New->yrepeat = yrepeat;
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
if (videoGetRenderMode() >= REND_POLYMOST)
|
||||
if (tilehasmodelorvoxel(tsp->picnum,tsp->pal))
|
||||
{
|
||||
if (tilehasmodelorvoxel(tsp->picnum,tsp->pal))
|
||||
{
|
||||
New->yrepeat = 0;
|
||||
// cstat: trans reverse
|
||||
// clipdist: tell mdsprite.cpp to use Z-buffer hacks to hide overdraw issues
|
||||
New->clipdist |= TSPR_FLAGS_MDHACK;
|
||||
New->cstat |= 512;
|
||||
}
|
||||
else
|
||||
{
|
||||
int const camang = mirror ? NORM_ANGLE(2048 - Player[screenpeek].siang) : Player[screenpeek].siang;
|
||||
vec2_t const ofs = { sintable[NORM_ANGLE(camang+512)]>>11, sintable[NORM_ANGLE(camang)]>>11};
|
||||
|
||||
New->x += ofs.x;
|
||||
New->y += ofs.y;
|
||||
}
|
||||
New->yrepeat = 0;
|
||||
// cstat: trans reverse
|
||||
// clipdist: tell mdsprite.cpp to use Z-buffer hacks to hide overdraw issues
|
||||
New->clipdist |= TSPR_FLAGS_MDHACK;
|
||||
New->cstat |= 512;
|
||||
}
|
||||
else
|
||||
{
|
||||
int const camang = mirror ? NORM_ANGLE(2048 - Player[screenpeek].siang) : Player[screenpeek].siang;
|
||||
vec2_t const ofs = { sintable[NORM_ANGLE(camang+512)]>>11, sintable[NORM_ANGLE(camang)]>>11};
|
||||
|
||||
New->x += ofs.x;
|
||||
New->y += ofs.y;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check for voxel items and use a round generic pic if so
|
||||
//DoVoxelShadow(New);
|
||||
|
@ -1108,66 +1099,6 @@ ResizeView(PLAYERp pp)
|
|||
}
|
||||
}
|
||||
|
||||
// !JIM! 08/06
|
||||
|
||||
#if 0
|
||||
void
|
||||
ViewOutsidePlayerRecurse(PLAYERp pp, int32_t* vx, int32_t* vy, int32_t* vz, int16_t* ang, int16_t* vsectnum)
|
||||
{
|
||||
int nx, ny;
|
||||
int ret;
|
||||
|
||||
*vx = pp->posx;
|
||||
*vy = pp->posy;
|
||||
*vz = pp->posz;
|
||||
*vsectnum = pp->cursectnum;
|
||||
|
||||
*ang = fix16_to_int(pp->q16ang) + pp->view_outside_dang;
|
||||
|
||||
nx = sintable[NORM_ANGLE(*ang + 512 + 1024)] << 11;
|
||||
ny = sintable[NORM_ANGLE(*ang + 1024)] << 11;
|
||||
|
||||
ret = clipmove_old(vx, vy, vz, vsectnum, nx, ny, 64L, 4 << 8, 4 << 8, CLIPMASK_PLAYER);
|
||||
|
||||
switch (TEST(ret, HIT_MASK))
|
||||
{
|
||||
case HIT_SPRITE:
|
||||
{
|
||||
short hit_sprite;
|
||||
SPRITEp sp;
|
||||
|
||||
hit_sprite = NORM_SPRITE(ret);
|
||||
sp = &sprite[hit_sprite];
|
||||
|
||||
// if you hit a sprite that's not a wall sprite - try again
|
||||
if (!TEST(sp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL))
|
||||
{
|
||||
FLIP(sp->cstat, CSTAT_SPRITE_BLOCK);
|
||||
ViewOutsidePlayerRecurse(pp, vx, vy, vz, ang, vsectnum);
|
||||
FLIP(sp->cstat, CSTAT_SPRITE_BLOCK);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (TEST(sector[*vsectnum].floorstat, FLOOR_STAT_SLOPE)|TEST(sector[*vsectnum].ceilingstat, CEILING_STAT_SLOPE))
|
||||
{
|
||||
int cz, fz;
|
||||
|
||||
getzsofslope(*vsectnum, *vx, *vy, &cz, &fz);
|
||||
|
||||
if (*vz > fz - Z(12))
|
||||
*vz = fz - Z(12);
|
||||
|
||||
if (*vz < cz + Z(12))
|
||||
*vz = cz + Z(12);
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void
|
||||
BackView(int *nx, int *ny, int *nz, short *vsect, fix16_t *nq16ang, short horiz)
|
||||
|
|
|
@ -613,20 +613,7 @@ bool InitGame()
|
|||
CommPlayers = numplayers;
|
||||
OrigCommPlayers = CommPlayers;
|
||||
CommEnabled = TRUE;
|
||||
if (!BotMode)
|
||||
gNet.MultiGameType = MULTI_GAME_COMMBAT;
|
||||
else
|
||||
gNet.MultiGameType = MULTI_GAME_AI_BOTS;
|
||||
|
||||
#if 0 //def NET_MODE_MASTER_SLAVE
|
||||
if (!NetModeOverride)
|
||||
{
|
||||
if (numplayers <= 4)
|
||||
NetBroadcastMode = TRUE;
|
||||
else
|
||||
NetBroadcastMode = FALSE;
|
||||
}
|
||||
#endif
|
||||
gNet.MultiGameType = MULTI_GAME_COMMBAT;
|
||||
}
|
||||
|
||||
LoadDemoRun();
|
||||
|
@ -917,38 +904,6 @@ InitLevel(void)
|
|||
|
||||
InitAllPlayers();
|
||||
|
||||
#if DEBUG
|
||||
// fake Multi-player game setup
|
||||
if (FakeMultiNumPlayers && !BotMode)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
// insert all needed players except the first one - its already tere
|
||||
for (i = 0; i < FakeMultiNumPlayers - 1; i++)
|
||||
{
|
||||
ManualPlayerInsert(Player);
|
||||
// reset control back to 1st player
|
||||
myconnectindex = 0;
|
||||
screenpeek = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Put in the BOTS if called for
|
||||
if (FakeMultiNumPlayers && BotMode)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
// insert all needed players except the first one - its already tere
|
||||
for (i = 0; i < FakeMultiNumPlayers; i++)
|
||||
{
|
||||
BotPlayerInsert(Player);
|
||||
// reset control back to 1st player
|
||||
myconnectindex = 0;
|
||||
screenpeek = 0;
|
||||
}
|
||||
}
|
||||
|
||||
QueueReset();
|
||||
PreMapCombineFloors();
|
||||
InitMultiPlayerInfo();
|
||||
|
@ -1890,9 +1845,6 @@ void StatScreen(PLAYERp mpp)
|
|||
#define STAT_TABLE_X (STAT_START_X + SM_SIZ(15))
|
||||
#define STAT_TABLE_XOFF SM_SIZ(6)
|
||||
|
||||
// No stats in bot games
|
||||
//if (BotMode) return;
|
||||
|
||||
//ResetPalette(mpp);
|
||||
COVER_SetReverb(0); // Reset reverb
|
||||
mpp->Reverb = 0;
|
||||
|
@ -3668,146 +3620,4 @@ void GameInterface::UpdateScreenSize()
|
|||
}
|
||||
|
||||
|
||||
#if 0 // the message input needs to be moved out of the game code!
|
||||
void GetMessageInput(PLAYERp pp)
|
||||
{
|
||||
int pnum = myconnectindex;
|
||||
short w, h;
|
||||
static SWBOOL cur_show;
|
||||
static SWBOOL TeamSendAll, TeamSendTeam;
|
||||
#define TEAM_MENU "A - Send to ALL, T - Send to TEAM"
|
||||
static char HoldMessageInputString[256];
|
||||
int i;
|
||||
|
||||
if (!MessageInputMode && !ConInputMode)
|
||||
{
|
||||
if (buttonMap.ButtonDown(gamefunc_SendMessage))
|
||||
{
|
||||
buttonMap.ClearButton(gamefunc_SendMessage);
|
||||
inputState.keyFlushChars();
|
||||
MessageInputMode = TRUE;
|
||||
InputMode = TRUE;
|
||||
TeamSendTeam = FALSE;
|
||||
TeamSendAll = FALSE;
|
||||
|
||||
if (MessageInputMode)
|
||||
{
|
||||
memset(MessageInputString, '\0', sizeof(MessageInputString));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (MessageInputMode && !ConInputMode)
|
||||
{
|
||||
if (gs.BorderNum > BORDER_BAR + 1)
|
||||
SetRedrawScreen(pp);
|
||||
|
||||
// get input
|
||||
switch (MNU_InputSmallString(MessageInputString, 320 - 20))
|
||||
{
|
||||
case -1: // Cancel Input (pressed ESC) or Err
|
||||
MessageInputMode = FALSE;
|
||||
InputMode = FALSE;
|
||||
inputState.ClearAllInput();
|
||||
break;
|
||||
case FALSE: // Input finished (RETURN)
|
||||
if (MessageInputString[0] == '\0')
|
||||
{
|
||||
// no input
|
||||
MessageInputMode = FALSE;
|
||||
InputMode = FALSE;
|
||||
inputState.ClearAllInput();
|
||||
buttonMap.ClearButton(gamefunc_Inventory);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gNet.TeamPlay)
|
||||
{
|
||||
if (memcmp(MessageInputString, TEAM_MENU, sizeof(TEAM_MENU)) != 0)
|
||||
{
|
||||
{
|
||||
strcpy(HoldMessageInputString, MessageInputString);
|
||||
strcpy(MessageInputString, TEAM_MENU);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (memcmp(MessageInputString, TEAM_MENU, sizeof(TEAM_MENU)) == 0)
|
||||
{
|
||||
strcpy(MessageInputString, HoldMessageInputString);
|
||||
TeamSendAll = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
SEND_MESSAGE:
|
||||
|
||||
// broadcast message
|
||||
MessageInputMode = FALSE;
|
||||
InputMode = FALSE;
|
||||
inputState.ClearAllInput();
|
||||
|
||||
for (i = 0; i < NUMGAMEFUNCTIONS; i++)
|
||||
buttonMap.ClearButton(i);
|
||||
|
||||
// Put who sent this
|
||||
sprintf(ds, "%s: %s", pp->PlayerName, MessageInputString);
|
||||
|
||||
if (gNet.TeamPlay)
|
||||
{
|
||||
TRAVERSE_CONNECT(pnum)
|
||||
{
|
||||
if (pnum != myconnectindex)
|
||||
{
|
||||
if (TeamSendAll)
|
||||
SW_SendMessage(pnum, ds);
|
||||
else if (User[pp->PlayerSprite]->spal == User[Player[pnum].PlayerSprite]->spal)
|
||||
SW_SendMessage(pnum, ds);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
TRAVERSE_CONNECT(pnum)
|
||||
{
|
||||
if (pnum != myconnectindex)
|
||||
{
|
||||
SW_SendMessage(pnum, ds);
|
||||
}
|
||||
}
|
||||
adduserquote(MessageInputString);
|
||||
quotebot += 8;
|
||||
quotebotgoal = quotebot;
|
||||
}
|
||||
break;
|
||||
|
||||
case TRUE: // Got input
|
||||
|
||||
if (gNet.TeamPlay)
|
||||
{
|
||||
if (memcmp(MessageInputString, TEAM_MENU "a", sizeof(TEAM_MENU) + 1) == 0)
|
||||
{
|
||||
strcpy(MessageInputString, HoldMessageInputString);
|
||||
TeamSendAll = TRUE;
|
||||
goto SEND_MESSAGE;
|
||||
}
|
||||
else if (memcmp(MessageInputString, TEAM_MENU "t", sizeof(TEAM_MENU) + 1) == 0)
|
||||
{
|
||||
strcpy(MessageInputString, HoldMessageInputString);
|
||||
TeamSendTeam = TRUE;
|
||||
goto SEND_MESSAGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// reset the string if anything else is typed
|
||||
if (strlen(MessageInputString) + 1 > sizeof(TEAM_MENU))
|
||||
{
|
||||
strcpy(MessageInputString, TEAM_MENU);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
END_SW_NS
|
||||
|
|
|
@ -300,594 +300,4 @@ void operateconfta(void)
|
|||
}
|
||||
}
|
||||
|
||||
// BOT STUFF ////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void BOT_UseInventory(PLAYERp p, short targetitem, SW_PACKET *syn)
|
||||
{
|
||||
// Try to get to item
|
||||
if (p->InventoryNum == targetitem)
|
||||
syn->bits |= (1<<SK_INV_USE);
|
||||
else
|
||||
{
|
||||
syn->bits |= (1<<SK_INV_LEFT); // Scroll to it
|
||||
syn->bits |= (1<<SK_INV_USE); // Use whatever you're on too
|
||||
}
|
||||
}
|
||||
|
||||
void BOT_ChooseWeapon(PLAYERp p, USERp u, SW_PACKET *syn)
|
||||
{
|
||||
short weap;
|
||||
|
||||
// If you have a nuke, fire it
|
||||
if (u->WeaponNum == WPN_MICRO && p->WpnRocketNuke && p->WpnRocketType != 2)
|
||||
{
|
||||
syn->bits ^= 15;
|
||||
syn->bits |= 4;
|
||||
}
|
||||
else
|
||||
for (weap=9; weap>=0; weap--)
|
||||
{
|
||||
if (weap <= u->WeaponNum) break;
|
||||
if (TEST(p->WpnFlags, BIT(weap)) && p->WpnAmmo[weap] > DamageData[weap].min_ammo)
|
||||
{
|
||||
syn->bits ^= 15;
|
||||
syn->bits |= weap;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int getspritescore(/*int snum, */int dapicnum)
|
||||
{
|
||||
|
||||
switch (dapicnum)
|
||||
{
|
||||
case ICON_STAR: return 5;
|
||||
case ICON_UZI: return 20;
|
||||
case ICON_UZIFLOOR: return 20;
|
||||
case ICON_LG_UZI_AMMO: return 15;
|
||||
case ICON_HEART: return 160;
|
||||
case ICON_HEART_LG_AMMO: return 60;
|
||||
case ICON_GUARD_HEAD: return 170;
|
||||
case ICON_FIREBALL_LG_AMMO: return 70;
|
||||
case ICON_ROCKET: return 100;
|
||||
case ICON_SHOTGUN: return 130;
|
||||
case ICON_LG_ROCKET: return 100;
|
||||
case ICON_LG_SHOTSHELL: return 30;
|
||||
case ICON_MICRO_GUN: return 200;
|
||||
case ICON_MICRO_BATTERY: return 100;
|
||||
case ICON_GRENADE_LAUNCHER: return 150;
|
||||
case ICON_LG_GRENADE: return 50;
|
||||
case ICON_LG_MINE: return 150;
|
||||
case ICON_RAIL_GUN: return 180;
|
||||
case ICON_RAIL_AMMO: return 80;
|
||||
|
||||
case ST_QUICK_EXIT:
|
||||
case ST_QUICK_SCAN:
|
||||
case ICON_MEDKIT:
|
||||
case ICON_CHEMBOMB:
|
||||
case ICON_FLASHBOMB:
|
||||
case ICON_NUKE:
|
||||
case ICON_CALTROPS:
|
||||
case TRACK_SPRITE:
|
||||
case ST1:
|
||||
case ST2:
|
||||
case ST_QUICK_JUMP:
|
||||
case ST_QUICK_JUMP_DOWN:
|
||||
case ST_QUICK_SUPER_JUMP: return 120; break;
|
||||
|
||||
// Commented out for now, example.
|
||||
// case FREEZEAMMO: if (ps[snum].ammo_amount[FREEZE_WEAPON] < max_ammo_amount[FREEZE_WEAPON]) return(10); else return(0);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fdmatrix[13][13] =
|
||||
{
|
||||
//SWRD SHUR UZI SHOT RPG 40MM MINE RAIL HEAD HEAD2HEAD3HEART
|
||||
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}, //SWRD
|
||||
{1024, 512, 128, 128,2560, 128,2560, 128,2560,2560,2560, 128, 128}, //SHUR
|
||||
{2560,1024, 512, 512,2560, 128,2560,2560,1024,2560,2560,2560,2560}, //UZI
|
||||
{ 512, 512, 512, 512,2560, 128,2560, 512, 512, 512, 512, 512, 512}, //SHOT
|
||||
{2560,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,2560}, //40MM
|
||||
{ 128, 128, 128, 128, 512, 128, 128, 128, 128, 128, 128, 128, 128}, //MINE
|
||||
{1536,1536,1536,1536,2560,1536,1536,1536,1536,1536,1536,1536,1536}, //RAIL
|
||||
{2560,1024, 512,1024,1024,1024,2560, 512,1024,2560,2560, 512, 512}, //HEAD1
|
||||
{ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128}, //HEAD2
|
||||
{ 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512}, //HEAD3
|
||||
{1024, 512, 128, 128,2560, 512,2560,1024, 128,2560,1024,1024,1024}, //HEART
|
||||
};
|
||||
|
||||
static int goalx[MAX_SW_PLAYERS_REG], goaly[MAX_SW_PLAYERS_REG], goalz[MAX_SW_PLAYERS_REG];
|
||||
static int goalsect[MAX_SW_PLAYERS_REG], goalwall[MAX_SW_PLAYERS_REG], goalsprite[MAX_SW_PLAYERS_REG];
|
||||
static int goalplayer[MAX_SW_PLAYERS_REG], clipmovecount[MAX_SW_PLAYERS_REG];
|
||||
short searchsect[MAXSECTORS], searchparent[MAXSECTORS];
|
||||
uint8_t dashow2dsector[(MAXSECTORS+7)>>3];
|
||||
|
||||
void computergetinput(int snum, SW_PACKET *syn)
|
||||
{
|
||||
int i, j, k, l, x1, y1, z1, x2, y2, z2, dx, dy, nextj;
|
||||
int dist, daang, zang, fightdist, damyang, damysect;
|
||||
int startsect, endsect, splc, send, startwall, endwall;
|
||||
hitdata_t hitinfo;
|
||||
PLAYERp p;
|
||||
walltype *wal;
|
||||
int myx, myy, myz, myang, mycursectnum;
|
||||
USERp u;
|
||||
//extern SWBOOL Pachinko_Win_Cheat;
|
||||
|
||||
if (!MoveSkip4) return; // Make it so the bots don't slow the game down so bad!
|
||||
|
||||
p = &Player[snum];
|
||||
u = User[p->PlayerSprite]; // Set user struct
|
||||
|
||||
// Copy current weapon number to player struct
|
||||
p->WpnNum = u->WeaponNum;
|
||||
if (p->WpnNum >= MAX_WEAPONS) p->WpnNum = MAX_WEAPONS-1;
|
||||
|
||||
// Init local position variables
|
||||
myx = p->posx;
|
||||
myy = p->posy;
|
||||
myz = p->posz;
|
||||
myang = fix16_to_int(p->q16ang);
|
||||
mycursectnum = p->cursectnum;
|
||||
|
||||
// Reset input bits
|
||||
syn->vel = 0;
|
||||
syn->svel = 0;
|
||||
syn->q16angvel = 0;
|
||||
syn->q16aimvel = 0;
|
||||
syn->bits = 0;
|
||||
|
||||
x1 = p->posx;
|
||||
y1 = p->posy;
|
||||
z1 = p->posz;
|
||||
|
||||
damyang = fix16_to_int(p->q16ang);
|
||||
damysect = sprite[p->PlayerSprite].sectnum;
|
||||
if ((numplayers >= 2) && (snum == myconnectindex))
|
||||
{ x1 = myx; y1 = myy; z1 = myz+PLAYER_HEIGHT; damyang = myang; damysect = mycursectnum; }
|
||||
|
||||
// Always operate everything
|
||||
syn->bits |= (1<<SK_OPERATE);
|
||||
|
||||
// If bot can't see the goal enemy, set target to himself so that he
|
||||
// will pick a new target
|
||||
if (TEST(Player[goalplayer[snum]].Flags, PF_DEAD) || STD_RANDOM_RANGE(1000) > 800)
|
||||
goalplayer[snum] = snum;
|
||||
else
|
||||
{
|
||||
x2 = Player[goalplayer[snum]].posx;
|
||||
y2 = Player[goalplayer[snum]].posy;
|
||||
z2 = Player[goalplayer[snum]].posz;
|
||||
if (!FAFcansee(x1,y1,z1-(48<<8),damysect,x2,y2,z2-(48<<8),sprite[Player[goalplayer[snum]].PlayerSprite].sectnum))
|
||||
goalplayer[snum] = snum;
|
||||
}
|
||||
|
||||
// Pick a new target player if goal is dead or target is itself
|
||||
if (goalplayer[snum] == snum)
|
||||
{
|
||||
j = 0x7fffffff;
|
||||
for (i=connecthead; i>=0; i=connectpoint2[i])
|
||||
if (i != snum)
|
||||
{
|
||||
if (TEST(Player[i].Flags, PF_DEAD))
|
||||
continue;
|
||||
|
||||
x2 = Player[i].posx;
|
||||
y2 = Player[i].posy;
|
||||
z2 = Player[i].posz;
|
||||
|
||||
if (!FAFcansee(x1,y1,z1-(48<<8),damysect,x2,y2,z2-(48<<8),sprite[Player[i].PlayerSprite].sectnum))
|
||||
continue;
|
||||
|
||||
dist = ksqrt((sprite[Player[i].PlayerSprite].x-x1)*(sprite[Player[i].PlayerSprite].x-x1)+(sprite[Player[i].PlayerSprite].y-y1)*(sprite[Player[i].PlayerSprite].y-y1));
|
||||
|
||||
if (dist < j) { j = dist; goalplayer[snum] = i; }
|
||||
}
|
||||
}
|
||||
|
||||
// Pick a weapon
|
||||
BOT_ChooseWeapon(p, u, syn);
|
||||
|
||||
// x2,y2,z2 is the coordinates of the target sprite
|
||||
x2 = Player[goalplayer[snum]].posx;
|
||||
y2 = Player[goalplayer[snum]].posy;
|
||||
z2 = Player[goalplayer[snum]].posz;
|
||||
|
||||
// If bot is dead, either barf or respawn
|
||||
if (TEST(p->Flags, PF_DEAD))
|
||||
{
|
||||
if (STD_RANDOM_RANGE(1000) > 990)
|
||||
{
|
||||
syn->bits |= (1<<SK_SPACE_BAR); // Respawn
|
||||
}
|
||||
else
|
||||
syn->bits |= (1<<SK_SHOOT); // Try to barf
|
||||
}
|
||||
|
||||
// Need Health?
|
||||
if (u->Health < p->MaxHealth)
|
||||
BOT_UseInventory(p, INVENTORY_MEDKIT, syn);
|
||||
|
||||
// Check the missile stat lists to see what's being fired and
|
||||
// take the appropriate action
|
||||
TRAVERSE_SPRITE_STAT(headspritestat[STAT_MISSILE], j, nextj)
|
||||
{
|
||||
switch (sprite[j].picnum)
|
||||
{
|
||||
case FIREBALL: k = 0; break;
|
||||
case BOLT_THINMAN_R0:
|
||||
k = 0;
|
||||
syn->bits |= (1<<SK_JUMP); // Always jump when rockets being fired!
|
||||
break;
|
||||
default: k = 0; break;
|
||||
}
|
||||
if (k)
|
||||
{
|
||||
hitinfo.pos.x = sprite[j].x;
|
||||
hitinfo.pos.y = sprite[j].y;
|
||||
hitinfo.pos.z = sprite[j].z;
|
||||
for (l=0; l<=8; l++)
|
||||
{
|
||||
if (tmulscale11(hitinfo.pos.x-x1,hitinfo.pos.x-x1,hitinfo.pos.y-y1,hitinfo.pos.y-y1,(hitinfo.pos.z-z1)>>4,(hitinfo.pos.z-z1)>>4) < 3072)
|
||||
{
|
||||
dx = sintable[(sprite[j].ang+512)&2047];
|
||||
dy = sintable[sprite[j].ang&2047];
|
||||
if ((x1-hitinfo.pos.x)*dy > (y1-hitinfo.pos.y)*dx) i = -k*512; else i = k*512;
|
||||
syn->vel -= mulscale17(dy,i);
|
||||
syn->svel += mulscale17(dx,i);
|
||||
}
|
||||
|
||||
if (l < 7)
|
||||
{
|
||||
hitinfo.pos.x += (mulscale14(sprite[j].xvel,sintable[(sprite[j].ang+512)&2047])<<2);
|
||||
hitinfo.pos.y += (mulscale14(sprite[j].xvel,sintable[sprite[j].ang&2047])<<2);
|
||||
hitinfo.pos.z += (sprite[j].zvel<<2);
|
||||
}
|
||||
else
|
||||
{
|
||||
hitscan((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]),
|
||||
(int)sprite[j].zvel,
|
||||
&hitinfo,CLIPMASK1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!TEST(Player[goalplayer[snum]].Flags, PF_DEAD) && snum != goalplayer[snum] &&
|
||||
((FAFcansee(x1,y1,z1-(24<<8),damysect,x2,y2,z2-(24<<8),sprite[Player[goalplayer[snum]].PlayerSprite].sectnum)) ||
|
||||
(FAFcansee(x1,y1,z1-(48<<8),damysect,x2,y2,z2-(48<<8),sprite[Player[goalplayer[snum]].PlayerSprite].sectnum))))
|
||||
{
|
||||
// Shoot how often by skill level
|
||||
short shootrnd=0;
|
||||
|
||||
shootrnd = STD_RANDOM_RANGE(1000);
|
||||
|
||||
if ((Skill == 0 && shootrnd > 990) ||
|
||||
(Skill == 1 && shootrnd > 550) ||
|
||||
(Skill == 2 && shootrnd > 350) ||
|
||||
(Skill == 3))
|
||||
syn->bits |= (1<<SK_SHOOT);
|
||||
else
|
||||
syn->bits &= ~(1<<SK_SHOOT);
|
||||
|
||||
// Jump sometimes, to try to be evasive
|
||||
if (STD_RANDOM_RANGE(256) > 252)
|
||||
syn->bits |= (1<<SK_JUMP);
|
||||
|
||||
// Make sure selected weapon is in range
|
||||
//ASSERT(p->WpnNum < MAX_WEAPONS);
|
||||
//ASSERT(Player[goalplayer[snum]].WpnNum < MAX_WEAPONS);
|
||||
|
||||
// Only fire explosive type weaps if you are not too close to the target!
|
||||
if (u->WeaponNum == WPN_MICRO || u->WeaponNum == WPN_GRENADE || u->WeaponNum == WPN_RAIL)
|
||||
{
|
||||
vec3_t hit_pos = { x1, y1, z1-PLAYER_HEIGHT };
|
||||
hitscan(&hit_pos,damysect,sintable[(damyang+512)&2047],sintable[damyang&2047],
|
||||
(100-fix16_to_int(p->q16horiz)-fix16_to_int(p->q16horizoff))*32,&hitinfo,CLIPMASK1);
|
||||
if ((hitinfo.pos.x-x1)*(hitinfo.pos.x-x1)+(hitinfo.pos.y-y1)*(hitinfo.pos.y-y1) < 2560*2560) syn->bits &= ~(1<<SK_SHOOT);
|
||||
}
|
||||
|
||||
// Get fighting distance based on you and your opponents current weapons
|
||||
fightdist = fdmatrix[p->WpnNum][Player[goalplayer[snum]].WpnNum];
|
||||
if (fightdist < 128) fightdist = 128;
|
||||
|
||||
// Figure out your distance from the enemy target sprite
|
||||
dist = ksqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); if (dist == 0) dist = 1;
|
||||
daang = NORM_ANGLE(getangle(x2+(Player[goalplayer[snum]].xvect>>14)-x1,y2+(Player[goalplayer[snum]].yvect>>14)-y1));
|
||||
|
||||
zang = 100-((z2-z1)*8)/dist;
|
||||
fightdist = max(fightdist,(klabs(z2-z1)>>4));
|
||||
|
||||
hitinfo.pos.x = x2+((x1-x2)*fightdist/dist);
|
||||
hitinfo.pos.y = y2+((y1-y2)*fightdist/dist);
|
||||
syn->vel += (hitinfo.pos.x-x1)*2047/dist;
|
||||
syn->svel += (hitinfo.pos.y-y1)*2047/dist;
|
||||
|
||||
//Strafe attack
|
||||
if (fightdist)
|
||||
{
|
||||
j = (int32_t) 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[Player[goalplayer[snum]].PlayerSprite].ang+512)&2047];
|
||||
dy = sintable[sprite[Player[goalplayer[snum]].PlayerSprite].ang&2047];
|
||||
if ((x1-x2)*dy > (y1-y2)*dx) i += 8192; else i -= 8192;
|
||||
syn->vel += ((sintable[(daang+1024)&2047]*i)>>17);
|
||||
syn->svel += ((sintable[(daang+512)&2047]*i)>>17);
|
||||
}
|
||||
|
||||
// Make aiming and running speed suck by skill level
|
||||
if (Skill == 0)
|
||||
{
|
||||
daang = NORM_ANGLE((daang-256) + STD_RANDOM_RANGE(512));
|
||||
syn->vel -= syn->vel/2;
|
||||
syn->svel -= syn->svel/2;
|
||||
}
|
||||
else if (Skill == 1)
|
||||
{
|
||||
daang = NORM_ANGLE((daang-128) + STD_RANDOM_RANGE(256));
|
||||
syn->vel -= syn->vel/8;
|
||||
syn->svel -= syn->svel/8;
|
||||
}
|
||||
else if (Skill == 2)
|
||||
daang = NORM_ANGLE((daang-64) + STD_RANDOM_RANGE(128));
|
||||
|
||||
// Below formula fails in certain cases
|
||||
//syn->q16angvel = fix16_from_int(min(max((((daang+1024-damyang)&2047)-1024)>>1,-MAXANGVEL),MAXANGVEL)); //was 127
|
||||
p->q16ang = fix16_from_int(daang);
|
||||
syn->q16aimvel = fix16_from_int(min(max((zang-fix16_to_int(p->q16horiz))>>1,-PLAYER_HORIZ_MAX),PLAYER_HORIZ_MAX));
|
||||
// Sets type of aiming, auto aim for bots
|
||||
syn->bits |= (1<<SK_AUTO_AIM);
|
||||
return;
|
||||
}
|
||||
|
||||
goalsect[snum] = -1;
|
||||
|
||||
#if 1
|
||||
if (goalsect[snum] < 0)
|
||||
{
|
||||
goalwall[snum] = -1;
|
||||
startsect = sprite[p->PlayerSprite].sectnum;
|
||||
endsect = sprite[Player[goalplayer[snum]].PlayerSprite].sectnum;
|
||||
|
||||
memset(dashow2dsector, 0, (MAXSECTORS + 7) >> 3);
|
||||
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] = (short)j;
|
||||
searchparent[send] = (short)splc;
|
||||
send++;
|
||||
if (j == endsect)
|
||||
{
|
||||
memset(dashow2dsector, 0, (MAXSECTORS + 7) >> 3);
|
||||
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;
|
||||
hitinfo.pos.x = hitinfo.pos.y = 0;
|
||||
for (i=startwall; i<endwall; i++)
|
||||
{
|
||||
hitinfo.pos.x += wall[i].x;
|
||||
hitinfo.pos.y += wall[i].y;
|
||||
}
|
||||
hitinfo.pos.x /= (endwall-startwall);
|
||||
hitinfo.pos.y /= (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 ((hitinfo.pos.x-x1)*(wall[i].y-y1) <= (hitinfo.pos.y-y1)*(wall[i].x-x1))
|
||||
if ((hitinfo.pos.x-x1)*(wall[wall[i].point2].y-y1) >= (hitinfo.pos.y-y1)*(wall[wall[i].point2].x-x1))
|
||||
{ k = i; break; }
|
||||
|
||||
dist = ksqrt(dx*dx+dy*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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
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] = (short)j;
|
||||
searchparent[send] = (short)splc;
|
||||
send++;
|
||||
if (j == endsect)
|
||||
{
|
||||
memset(dashow2dsector, 0, (MAXSECTORS + 7) >> 3);
|
||||
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(dx*dx+dy*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;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if ((goalsect[snum] < 0) || (goalwall[snum] < 0))
|
||||
{
|
||||
if (goalsprite[snum] < 0)
|
||||
{
|
||||
for (k=0; k<4; 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 (FAFcansee(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; }
|
||||
}
|
||||
}
|
||||
}
|
||||
x2 = goalx[snum];
|
||||
y2 = goaly[snum];
|
||||
dist = ksqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); if (!dist) return;
|
||||
daang = getangle(x2-x1,y2-y1);
|
||||
syn->vel += (x2-x1)*2047/dist;
|
||||
syn->svel += (y2-y1)*2047/dist;
|
||||
syn->q16angvel = fix16_from_int(min(max((((daang+1024-damyang)&2047)-1024)>>3,-MAXANGVEL),MAXANGVEL));
|
||||
}
|
||||
else
|
||||
goalsprite[snum] = -1;
|
||||
#endif
|
||||
|
||||
hitinfo.pos.x = p->posx; hitinfo.pos.y = p->posy; hitinfo.pos.z = p->posz; hitinfo.sect = p->cursectnum;
|
||||
i = clipmove(&hitinfo.pos,&hitinfo.sect,p->xvect,p->yvect,164L,4L<<8,4L<<8,CLIPMASK0);
|
||||
if (!i)
|
||||
{
|
||||
hitinfo.pos.x = p->posx; hitinfo.pos.y = p->posy; hitinfo.pos.z = p->posz+(24<<8); hitinfo.sect = p->cursectnum;
|
||||
i = clipmove(&hitinfo.pos,&hitinfo.sect,p->xvect,p->yvect,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->posx,p->posy) <= p->posz+(24<<8)) j |= 1;
|
||||
if (getceilzofslope(wall[i&(MAXWALLS-1)].nextsector,p->posx,p->posy) >= p->posz-(24<<8)) j |= 2;
|
||||
}
|
||||
if ((i&0xc000) == 49152) j = 1;
|
||||
// Jump
|
||||
if (j&1) if (clipmovecount[snum] == 4) syn->bits |= (1<<SK_JUMP);
|
||||
// Crawl
|
||||
if (j&2) syn->bits |= (1<<SK_CRAWL);
|
||||
|
||||
//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 = (int32_t) 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->vel += ((sintable[(daang+1024)&2047]*i)>>17);
|
||||
syn->svel += ((sintable[(daang+512)&2047]*i)>>17);
|
||||
|
||||
// Try to Open
|
||||
if ((clipmovecount[snum]&31) == 2) syn->bits |= (1<<SK_OPERATE);
|
||||
// *TODO: In Duke, this is Kick, but I need to select sword then fire in SW
|
||||
// if ((clipmovecount[snum]&31) == 17) syn->bits |= (1<<22);
|
||||
if (clipmovecount[snum] > 32) { goalsect[snum] = -1; goalwall[snum] = -1; clipmovecount[snum] = 0; }
|
||||
|
||||
goalsprite[snum] = -1;
|
||||
}
|
||||
else
|
||||
clipmovecount[snum] = 0;
|
||||
|
||||
if ((goalsect[snum] >= 0) && (goalwall[snum] >= 0))
|
||||
{
|
||||
x2 = goalx[snum];
|
||||
y2 = goaly[snum];
|
||||
dist = ksqrt((x2-x1)*(x2-x1)+(y2-y1)*(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->vel += (x2-x1)*2047/dist;
|
||||
syn->svel += (y2-y1)*2047/dist;
|
||||
syn->q16angvel = fix16_from_int(min(max((((daang+1024-damyang)&2047)-1024)>>3,-MAXANGVEL),MAXANGVEL));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// Use extended bot logic for navigation through level
|
||||
goalsect[snum] = -1;
|
||||
goalwall[snum] = -1;
|
||||
goalsprite[snum] = -1;
|
||||
|
||||
// Go to a goal place
|
||||
if ((goalsect[snum] >= 0) && (goalwall[snum] >= 0))
|
||||
{
|
||||
x2 = goalx[snum];
|
||||
y2 = goaly[snum];
|
||||
dist = ksqrt((x2-x1)*(x2-x1)+(y2-y1)*(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->vel += (x2-x1)*2047/dist;
|
||||
syn->svel += (y2-y1)*2047/dist;
|
||||
syn->q16angvel = fix16_from_int(min(max((((daang+1024-damyang)&2047)-1024)>>3,-MAXANGVEL),MAXANGVEL));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
END_SW_NS
|
||||
|
|
|
@ -897,7 +897,6 @@ UpdateInputs(void)
|
|||
{
|
||||
int i, j, k;
|
||||
PLAYERp pp;
|
||||
extern SWBOOL BotMode;
|
||||
|
||||
ototalclock += synctics;
|
||||
|
||||
|
@ -948,40 +947,13 @@ UpdateInputs(void)
|
|||
pp->movefifoend++;
|
||||
Bmemset(&loc, 0, sizeof(loc));
|
||||
|
||||
#if 0
|
||||
// AI Bot stuff
|
||||
if (numplayers > 1)
|
||||
{
|
||||
if (gNet.MultiGameType == MULTI_GAME_AI_BOTS)
|
||||
{
|
||||
for (i=connecthead; i>=0; i=connectpoint2[i])
|
||||
{
|
||||
if (i != myconnectindex)
|
||||
{
|
||||
if (BotMode && Player[i].IsAI == 1) // Skip it if this player is not computer controlled!
|
||||
{
|
||||
computergetinput(i,&Player[i].inputfifo[Player[i].movefifoend&(MOVEFIFOSIZ-1)]);
|
||||
Player[i].movefifoend++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// AI Bot stuff
|
||||
#endif
|
||||
|
||||
if (!CommEnabled)
|
||||
{
|
||||
TRAVERSE_CONNECT(i)
|
||||
{
|
||||
if (i != myconnectindex)
|
||||
{
|
||||
if (BotMode && Player[i].IsAI == 1)
|
||||
{
|
||||
computergetinput(i,&Player[i].inputfifo[Player[i].movefifoend&(MOVEFIFOSIZ-1)]);
|
||||
}
|
||||
else
|
||||
memset(&Player[i].inputfifo[Player[i].movefifoend & (MOVEFIFOSIZ - 1)], 0, sizeof(Player[i].inputfifo[0]));
|
||||
memset(&Player[i].inputfifo[Player[i].movefifoend & (MOVEFIFOSIZ - 1)], 0, sizeof(Player[i].inputfifo[0]));
|
||||
Player[i].movefifoend++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,11 +55,6 @@ int predictmovefifoplc;
|
|||
void DoPlayerSectorUpdatePreMove(PLAYERp);
|
||||
void DoPlayerSectorUpdatePostMove(PLAYERp);
|
||||
|
||||
#define PREDICT_DEBUG 0
|
||||
|
||||
#if PREDICT_DEBUG
|
||||
void (*pred_last_func)(PLAYERp) = NULL;
|
||||
#endif
|
||||
|
||||
void
|
||||
InitPrediction(PLAYERp pp)
|
||||
|
@ -67,51 +62,11 @@ InitPrediction(PLAYERp pp)
|
|||
if (!PredictionOn)
|
||||
return;
|
||||
|
||||
#if PREDICT_DEBUG
|
||||
pred_last_func = pp->DoPlayerAction;
|
||||
#endif
|
||||
|
||||
// make a copy of player struct and sprite
|
||||
*ppp = *pp;
|
||||
PredictUser = *User[pp->PlayerSprite];
|
||||
}
|
||||
|
||||
#if PREDICT_DEBUG
|
||||
PredictDebug(PLAYERp ppp)
|
||||
{
|
||||
static FILE *fout = NULL;
|
||||
static char pred_sym_name[80];
|
||||
|
||||
if (SymCountCode == 0)
|
||||
LoadSymTable("swcode.sym", &SymTableCode, &SymCountCode);
|
||||
|
||||
if (SymCountCode <= 0)
|
||||
return;
|
||||
|
||||
if (!fout)
|
||||
{
|
||||
if ((fout = fopen("dbgpred.txt", "wb")) == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ppp->DoPlayerAction != pred_last_func)
|
||||
{
|
||||
extern uint32_t MoveThingsCount;
|
||||
SYM_TABLEp st_ptr;
|
||||
uint32_t unrelocated_offset;
|
||||
uint32_t offset_from_symbol;
|
||||
|
||||
unrelocated_offset = SymCodePtrToOffset((void *)ppp->DoPlayerAction);
|
||||
st_ptr = SearchSymTableByOffset(SymTableCode, SymCountCode, unrelocated_offset, &offset_from_symbol);
|
||||
ASSERT(st_ptr);
|
||||
strcpy(pred_sym_name, st_ptr->Name);
|
||||
|
||||
fprintf(fout, "%s, %d\n", pred_sym_name, MoveThingsCount);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
DoPrediction(PLAYERp ppp)
|
||||
{
|
||||
|
@ -160,10 +115,6 @@ DoPrediction(PLAYERp ppp)
|
|||
ppp->oposz = ppp->posz;
|
||||
ppp->oq16horiz = ppp->q16horiz;
|
||||
|
||||
#if PREDICT_DEBUG
|
||||
PredictDebug(ppp);
|
||||
#endif
|
||||
|
||||
// go through the player MOVEMENT code only
|
||||
Prediction = TRUE;
|
||||
DoPlayerSectorUpdatePreMove(ppp);
|
||||
|
|
Loading…
Reference in a new issue