Optimize some of the frequently used CON commands that have nasty overhead

git-svn-id: https://svn.eduke32.com/eduke32@428 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-12-18 08:37:12 +00:00
parent cb90dc8c83
commit d93dde5a59
8 changed files with 804 additions and 952 deletions

View file

@ -1069,7 +1069,7 @@ static void moveplayers(void) //Players
otherx = 0;
}
execute(&i,&s->yvel,&otherx);
execute(i,s->yvel,otherx);
if (ud.multimode > 1)
if (sprite[ps[otherp].i].extra > 0)
@ -2302,11 +2302,11 @@ CLEAR_THE_BOLT:
case STEAM__STATIC:
case CEILINGSTEAM__STATIC:
p = findplayer(s, &x);
execute(&i,&p,&x);
execute(i,p,x);
goto BOLT;
case WATERBUBBLEMAKER__STATIC:
p = findplayer(s, &x);
execute(&i,&p,&x);
execute(i,p,x);
goto BOLT;
}
@ -2772,7 +2772,7 @@ static void moveweapons(void)
if (thisprojectile[i].workslike & PROJECTILE_FLAG_HITSCAN)
{
p = findplayer(s,&x);
execute(&i,&p,&x);
execute(i,p,x);
goto BOLT;
}
@ -3133,7 +3133,7 @@ static void moveweapons(void)
case SHOTSPARK1__STATIC:
p = findplayer(s,&x);
execute(&i,&p,&x);
execute(i,p,x);
goto BOLT;
}
}
@ -4808,7 +4808,7 @@ DETONATEB:
p = findplayer(s,&x);
execute(&i,&p,&x);
execute(i,p,x);
BOLT:
@ -5249,7 +5249,7 @@ static void moveexplosions(void) // STATNUM 5
case TRANSPORTERSTAR__STATIC:
case TRANSPORTERBEAM__STATIC:
p = findplayer(s,&x);
execute(&i,&p,&x);
execute(i,p,x);
goto BOLT;
case SHELL__STATIC:

View file

@ -716,8 +716,8 @@ int32 CONFIG_ReadSetup(void)
ps[0].auto_aim = AutoAim;
SCRIPT_GetNumber(scripthandle, "Controls","WeaponSwitchMode",&ud.weaponswitch);
ps[0].weaponswitch = ud.weaponswitch;
#ifdef _WIN32
#ifdef _WIN32
SCRIPT_GetNumber(scripthandle, "Updates", "CheckForUpdates", &checkforupdates);
SCRIPT_GetNumber(scripthandle, "Updates", "LastUpdateCheck", &lastupdatecheck);
#endif

View file

@ -122,7 +122,7 @@ extern void getglobalz(short sActor);
extern void makeitfall(short sActor);
extern void loadefs(char *fn);
extern short furthestangle(short sActor,short angs);
extern void execute(const short *sActor,const short *sPlayer,const long *lDist);
extern void execute(int iActor,int iPlayer,long lDist);
extern void overwritesprite(long thex,long they,short tilenum,signed char shade,char stat,char dapalnum);
extern inline int gametext(int x,int y,char *t,char s,short dabits);
extern inline int gametextpal(int x,int y,char *t,char s,char p);

View file

@ -1539,7 +1539,7 @@ void myosx(long x, long y, short tilenum, signed char shade, char orientation)
void myospalx(long x, long y, short tilenum, signed char shade, char orientation, char p)
{
int a = 0;
if (orientation&4)
a = 1024;
@ -1689,32 +1689,32 @@ static void weapon_amounts(struct player_struct *p,long x,long y,long u)
if (p->subweapon&(1<<GROW_WEAPON))
weaponnum(SHRINKER_WEAPON,x+39,y+12,
p->ammo_amount[GROW_WEAPON],max_ammo_amount[GROW_WEAPON],
(!p->gotweapon[GROW_WEAPON]*9)+12-18*
(cw == GROW_WEAPON));
p->ammo_amount[GROW_WEAPON],max_ammo_amount[GROW_WEAPON],
(!p->gotweapon[GROW_WEAPON]*9)+12-18*
(cw == GROW_WEAPON));
else
weaponnum(SHRINKER_WEAPON,x+39,y+12,
p->ammo_amount[SHRINKER_WEAPON],max_ammo_amount[SHRINKER_WEAPON],
(!p->gotweapon[SHRINKER_WEAPON]*9)+12-18*
(cw == SHRINKER_WEAPON));
p->ammo_amount[SHRINKER_WEAPON],max_ammo_amount[SHRINKER_WEAPON],
(!p->gotweapon[SHRINKER_WEAPON]*9)+12-18*
(cw == SHRINKER_WEAPON));
}
if (u&256)
{
if (u != -1) patchstatusbar(158,178,162+29,178+6); //original code: (166,178,166+8,178+6);
weaponnum(DEVISTATOR_WEAPON,x+70,y,
p->ammo_amount[DEVISTATOR_WEAPON],max_ammo_amount[DEVISTATOR_WEAPON],
(!p->gotweapon[DEVISTATOR_WEAPON]*9)+12-18*
(cw == DEVISTATOR_WEAPON));
p->ammo_amount[DEVISTATOR_WEAPON],max_ammo_amount[DEVISTATOR_WEAPON],
(!p->gotweapon[DEVISTATOR_WEAPON]*9)+12-18*
(cw == DEVISTATOR_WEAPON));
}
if (u&512)
{
if (u != -1) patchstatusbar(158,184,162+29,184+6); //original code: (166,184,166+8,184+6);
weaponnum(TRIPBOMB_WEAPON,x+70,y+6,
p->ammo_amount[TRIPBOMB_WEAPON],max_ammo_amount[TRIPBOMB_WEAPON],
(!p->gotweapon[TRIPBOMB_WEAPON]*9)+12-18*
(cw == TRIPBOMB_WEAPON));
p->ammo_amount[TRIPBOMB_WEAPON],max_ammo_amount[TRIPBOMB_WEAPON],
(!p->gotweapon[TRIPBOMB_WEAPON]*9)+12-18*
(cw == TRIPBOMB_WEAPON));
}
if (u&65536L)
@ -1722,9 +1722,9 @@ static void weapon_amounts(struct player_struct *p,long x,long y,long u)
if (u != -1) patchstatusbar(158,190,162+29,190+6); //original code: (166,190,166+8,190+6);
weaponnum(-1,x+70,y+12,
p->ammo_amount[FREEZE_WEAPON],max_ammo_amount[FREEZE_WEAPON],
(!p->gotweapon[FREEZE_WEAPON]*9)+12-18*
(cw == FREEZE_WEAPON));
p->ammo_amount[FREEZE_WEAPON],max_ammo_amount[FREEZE_WEAPON],
(!p->gotweapon[FREEZE_WEAPON]*9)+12-18*
(cw == FREEZE_WEAPON));
}
}
@ -7203,9 +7203,9 @@ FOUNDCHEAT:
switch (k)
{
case CHEAT_WEAPONS:
j = 0;
if (VOLUMEONE)
j = 6;
@ -7353,10 +7353,10 @@ FOUNDCHEAT:
case CHEAT_STUFF:
j = 0;
if (VOLUMEONE)
j = 6;
for (weapon = PISTOL_WEAPON;weapon < MAX_WEAPONS-j;weapon++)
ps[myconnectindex].gotweapon[weapon] = 1;
@ -7398,7 +7398,7 @@ FOUNDCHEAT:
levnume--;
if ((VOLUMEONE && volnume > 0) || volnume > num_volumes-1 ||
levnume >= MAXLEVELS || level_file_names[volnume*MAXLEVELS+levnume] == NULL)
levnume >= MAXLEVELS || level_file_names[volnume*MAXLEVELS+levnume] == NULL)
{
ps[myconnectindex].cheat_phase = 0;
KB_FlushKeyBoardQueue();
@ -9694,10 +9694,10 @@ void app_main(int argc,char **argv)
i=wm_ynbox("Automatic Release Notification",
"Would you like EDuke32 to automatically check for new releases "
"at startup?");
checkforupdates = 0;
checkforupdates = 0;
if (i) checkforupdates = 1;
}
if (checkforupdates == 1)
{
if (time(NULL) - lastupdatecheck > UPDATEINTERVAL)
@ -9709,24 +9709,24 @@ void app_main(int argc,char **argv)
if (atol(tempbuf) > BUILDDATE)
{
if (wm_ynbox("EDuke32","A new version of EDuke32 is available. "
"Browse to http://eduke32.sourceforge.net now?"))
"Browse to http://eduke32.sourceforge.net now?"))
{
SHELLEXECUTEINFOA sinfo;
SHELLEXECUTEINFOA sinfo;
char *p = "http://eduke32.sourceforge.net";
Bmemset(&sinfo, 0, sizeof(sinfo));
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SEE_MASK_CLASSNAME;
sinfo.lpVerb = "open";
sinfo.lpFile = p;
sinfo.nShow = SW_SHOWNORMAL;
sinfo.lpClass = "http";
if(!ShellExecuteExA(&sinfo))
initprintf("update: error launching browser!\n");
Bmemset(&sinfo, 0, sizeof(sinfo));
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SEE_MASK_CLASSNAME;
sinfo.lpVerb = "open";
sinfo.lpFile = p;
sinfo.nShow = SW_SHOWNORMAL;
sinfo.lpClass = "http";
if (!ShellExecuteExA(&sinfo))
initprintf("update: error launching browser!\n");
CONFIG_SetupMouse();
CONFIG_SetupJoystick();
CONFIG_WriteSetup();
CONFIG_WriteSetup();
gameexit(" ");
}
}

File diff suppressed because it is too large Load diff

View file

@ -167,7 +167,7 @@ static int probe_(int type,int x,int y,int i,int n)
onbar = 0;
KB_ClearKeyDown(sc_Escape);
sound(EXITMENUSOUND);
MOUSE_ClearButton(RIGHT_MOUSE);
MOUSE_ClearButton(RIGHT_MOUSE);
return(-1);
}
else
@ -348,7 +348,7 @@ static void bar_(int type, int x,int y,short *p,short dainc,char damodify,short
KB_ClearKeyDown(sc_RightArrow);
KB_ClearKeyDown(sc_kpad_6);
MOUSE_ClearButton(WHEELDOWN_MOUSE);
mii = 0;
mii = 0;
*p += dainc;
if (*p > 63)
*p = 63;
@ -494,7 +494,7 @@ static void dispnames(void)
minitext(c,48+(12*x),ud.savegame[x],2,10+16);
}
void clearfilenames(void)
static void clearfilenames(void)
{
klistfree(finddirs);
klistfree(findfiles);
@ -1376,8 +1376,8 @@ void menus(void)
break;
}
probe(186,124+9,0,0);
probe(186,124+9,0,0);
if (KB_KeyPressed(sc_N) || KB_KeyPressed(sc_Escape) || RMB)
{
KB_ClearKeyDown(sc_N);
@ -1391,7 +1391,9 @@ void menus(void)
ready2send = 1;
totalclock = ototalclock;
}
} else {
}
else
{
cmenu(300);
probey = last_threehundred;
}
@ -1500,7 +1502,7 @@ void menus(void)
}
x = probe(0,0,0,1);
if (x == -1)
{
cmenu(0);
@ -2546,9 +2548,9 @@ cheat_for_port_credits:
"Display other player IDs",
"-",
"Show startup window",
#ifdef _WIN32
#ifdef _WIN32
"Release notification",
#else
#else
"-",
"-",
#endif
@ -2647,7 +2649,7 @@ cheat_for_port_credits:
modval(0,1,(int *)&ForceSetup,1,probey==io);
gametextpal(d,yy, ForceSetup ? "On" : "Off", MENUHIGHLIGHT(io), 0);
break;
#ifdef _WIN32
#ifdef _WIN32
case 7:
i = checkforupdates;
if (x==io) checkforupdates = 1-checkforupdates;
@ -2659,7 +2661,7 @@ cheat_for_port_credits:
case 8:
#else
case 7:
#endif
#endif
if (x==io) cmenu(200);
break;
default:
@ -4529,9 +4531,9 @@ VOLUME_ALL_40x:
resetinventory(c);
}
mpchangemap(ud.m_volume_number,ud.m_level_number);
if (voting == myconnectindex)
adduserquote("VOTE SUCCEEDED");

View file

@ -5517,7 +5517,7 @@ void computergetinput(long snum, input *syn)
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))
{
int bestsprite = -1, spritescore = 0;
for (k=0;k<16;k++)
{
i = (rand()%numsectors);
@ -5531,7 +5531,7 @@ void computergetinput(long snum, input *syn)
{
spritescore = getspritescore(snum,sprite[j].picnum);
bestsprite = j;
}
}
// break;
}
}
@ -5561,7 +5561,7 @@ void computergetinput(long snum, input *syn)
goalspritescore[snum] = 0;
goalsprite[snum] = -1;
}
}
}
x3 = p->posx;
y3 = p->posy;

View file

@ -1162,7 +1162,7 @@ void newgame(char vn,char ln,char sk)
getpackets();
}
}
globalskillsound = -1;
waitforeverybody();
@ -1230,7 +1230,7 @@ void newgame(char vn,char ln,char sk)
}
p->last_weapon = -1;
}
display_mirror = 0;
if (ud.multimode > 1)
@ -1538,15 +1538,15 @@ extern int gotvote[MAXPLAYERS], votes[MAXPLAYERS], voting, vote_map, vote_episod
static void getlevelfromfilename(const char *fn, char *volume, char *level)
{
for ((*volume)=0;(*volume)<MAXVOLUMES;(*volume)++)
for (*volume=0;*volume<MAXVOLUMES;(*volume)++)
{
for ((*level)=0;(*level)<MAXLEVELS;(*level)++)
for (*level=0;*level<MAXLEVELS;(*level)++)
{
if (level_file_names[((*volume)*MAXLEVELS)+(*level)] != NULL)
if (!Bstrcasecmp(fn, level_file_names[((*volume)*MAXLEVELS)+(*level)]))
if (level_file_names[(*volume*MAXLEVELS)+*level] != NULL)
if (!Bstrcasecmp(fn, level_file_names[(*volume*MAXLEVELS)+*level]))
break;
}
if ((*level) != MAXLEVELS)
if (*level != MAXLEVELS)
break;
}
}