Questionable CON changes and optimizations. <3

git-svn-id: https://svn.eduke32.com/eduke32@4902 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2015-01-11 04:56:10 +00:00
parent 2928a9dfa9
commit 364cf15c4f
5 changed files with 629 additions and 803 deletions

View file

@ -124,55 +124,10 @@ int32_t g_numQuoteRedefinitions = 0;
#ifdef LUNATIC
weapondata_t g_playerWeapon[MAXPLAYERS][MAX_WEAPONS];
#else
// pointers to weapon gamevar data
intptr_t *aplWeaponClip[MAX_WEAPONS]; // number of items in magazine
intptr_t *aplWeaponReload[MAX_WEAPONS]; // delay to reload (include fire)
intptr_t *aplWeaponFireDelay[MAX_WEAPONS]; // delay to fire
intptr_t *aplWeaponHoldDelay[MAX_WEAPONS]; // delay after release fire button to fire (0 for none)
intptr_t *aplWeaponTotalTime[MAX_WEAPONS]; // The total time the weapon is cycling before next fire.
intptr_t *aplWeaponFlags[MAX_WEAPONS]; // Flags for weapon
intptr_t *aplWeaponShoots[MAX_WEAPONS]; // what the weapon shoots
intptr_t *aplWeaponSpawnTime[MAX_WEAPONS]; // the frame at which to spawn an item
intptr_t *aplWeaponSpawn[MAX_WEAPONS]; // the item to spawn
intptr_t *aplWeaponShotsPerBurst[MAX_WEAPONS]; // number of shots per 'burst' (one ammo per 'burst')
intptr_t *aplWeaponWorksLike[MAX_WEAPONS]; // What original the weapon works like
intptr_t *aplWeaponInitialSound[MAX_WEAPONS]; // Sound made when weapon starts firing. zero for no sound
intptr_t *aplWeaponFireSound[MAX_WEAPONS]; // Sound made when firing (each time for automatic)
intptr_t *aplWeaponSound2Time[MAX_WEAPONS]; // Alternate sound time
intptr_t *aplWeaponSound2Sound[MAX_WEAPONS]; // Alternate sound sound ID
intptr_t *aplWeaponReloadSound1[MAX_WEAPONS]; // Sound of magazine being removed
intptr_t *aplWeaponReloadSound2[MAX_WEAPONS]; // Sound of magazine being inserted
intptr_t *aplWeaponSelectSound[MAX_WEAPONS]; // Sound of weapon being selected
intptr_t *aplWeaponFlashColor[MAX_WEAPONS]; // Muzzle flash color
#endif
int32_t g_iReturnVarID=-1; // var ID of "RETURN"
int32_t g_iWeaponVarID=-1; // var ID of "WEAPON"
int32_t g_iWorksLikeVarID=-1; // var ID of "WORKSLIKE"
int32_t g_iZRangeVarID=-1; // var ID of "ZRANGE"
int32_t g_iAngRangeVarID=-1; // var ID of "ANGRANGE"
int32_t g_iAimAngleVarID=-1; // var ID of "AUTOAIMANGLE"
int32_t g_iLoTagID=-1; // var ID of "LOTAG"
int32_t g_iHiTagID=-1; // var ID of "HITAG"
int32_t g_iTextureID=-1; // var ID of "TEXTURE"
int32_t g_iThisActorID=-1; // var ID of "THISACTOR"
int32_t g_iSpriteVarID=-1;
int32_t g_iSectorVarID=-1;
int32_t g_iWallVarID=-1;
int32_t g_iPlayerVarID=-1;
int32_t g_iActorVarID=-1;
intptr_t *apScriptGameEvent[MAXGAMEEVENTS];
#if !defined LUNATIC
static intptr_t *g_parsingEventPtr=NULL;
gamevar_t aGameVars[MAXGAMEVARS];
gamearray_t aGameArrays[MAXGAMEARRAYS];
int32_t g_gameVarCount=0;
int32_t g_gameArrayCount=0;
static char *textptr;
#endif
@ -2348,102 +2303,101 @@ int32_t C_AllocQuote(int32_t qnum)
void C_InitQuotes(void)
{
int32_t i;
for (int i = 0; i < 128; i++) C_AllocQuote(i);
for (i=127; i>=0; i--)
C_AllocQuote(i);
for (i=MAXQUOTELEN-7; i>=0; i--)
if (Bstrncmp(&ScriptQuotes[13][i],"SPACE",5) == 0)
#if defined(__ANDROID__)
Bsprintf(ScriptQuotes[13], "TOUCH ANYWHERE TO CONTINUE");
#else
for (int i = MAXQUOTELEN - 7; i >= 0; i--)
if (Bstrncmp(&ScriptQuotes[13][i], "SPACE", 5) == 0)
{
Bmemset(tempbuf,0,sizeof(tempbuf));
Bstrncpy(tempbuf,ScriptQuotes[13],i);
Bstrcat(tempbuf,"OPEN");
Bstrcat(tempbuf,&ScriptQuotes[13][i+5]);
Bstrncpy(ScriptQuotes[13],tempbuf,MAXQUOTELEN-1);
i = MAXQUOTELEN-7;
Bmemset(tempbuf, 0, sizeof(tempbuf));
Bstrncpy(tempbuf, ScriptQuotes[13], i);
Bstrcat(tempbuf, "USE");
Bstrcat(tempbuf, &ScriptQuotes[13][i + 5]);
Bstrncpy(ScriptQuotes[13], tempbuf, MAXQUOTELEN - 1);
i = MAXQUOTELEN - 7;
}
#endif
// most of these are based on Blood, obviously
const char *PlayerObituaries[] =
{
const char *PlayerObituaries[] =
{
"^02%s^02 beat %s^02 like a cur",
"^02%s^02 broke %s",
"^02%s^02 body bagged %s",
"^02%s^02 boned %s^02 like a fish",
"^02%s^02 castrated %s",
"^02%s^02 creamed %s",
"^02%s^02 crushed %s",
"^02%s^02 destroyed %s",
"^02%s^02 diced %s",
"^02%s^02 disemboweled %s",
"^02%s^02 erased %s",
"^02%s^02 eviscerated %s",
"^02%s^02 flailed %s",
"^02%s^02 flattened %s",
"^02%s^02 gave AnAl MaDnEsS to %s",
"^02%s^02 gave %s^02 Anal Justice",
"^02%s^02 hosed %s",
"^02%s^02 hurt %s^02 real bad",
"^02%s^02 killed %s",
"^02%s^02 made dog meat out of %s",
"^02%s^02 made mincemeat out of %s",
"^02%s^02 manhandled %s",
"^02%s^02 massacred %s",
"^02%s^02 mutilated %s",
"^02%s^02 murdered %s",
"^02%s^02 neutered %s",
"^02%s^02 punted %s",
"^02%s^02 reamed %s",
"^02%s^02 ripped %s^02 a new orifice",
"^02%s^02 rocked %s",
"^02%s^02 sent %s^02 to hell",
"^02%s^02 shredded %s",
"^02%s^02 slashed %s",
"^02%s^02 slaughtered %s",
"^02%s^02 sliced %s",
"^02%s^02 smacked %s around",
"^02%s^02 smashed %s",
"^02%s^02 snuffed %s",
"^02%s^02 sodomized %s",
"^02%s^02 splattered %s",
"^02%s^02 sprayed %s",
"^02%s^02 squashed %s",
"^02%s^02 throttled %s",
"^02%s^02 toasted %s",
"^02%s^02 vented %s",
"^02%s^02 ventilated %s",
"^02%s^02 wasted %s",
"^02%s^02 wrecked %s",
};
"^02%s^02 beat %s^02 like a cur",
"^02%s^02 broke %s",
"^02%s^02 body bagged %s",
"^02%s^02 boned %s^02 like a fish",
"^02%s^02 castrated %s",
"^02%s^02 creamed %s",
"^02%s^02 crushed %s",
"^02%s^02 destroyed %s",
"^02%s^02 diced %s",
"^02%s^02 disemboweled %s",
"^02%s^02 erased %s",
"^02%s^02 eviscerated %s",
"^02%s^02 flailed %s",
"^02%s^02 flattened %s",
"^02%s^02 gave AnAl MaDnEsS to %s",
"^02%s^02 gave %s^02 Anal Justice",
"^02%s^02 hosed %s",
"^02%s^02 hurt %s^02 real bad",
"^02%s^02 killed %s",
"^02%s^02 made dog meat out of %s",
"^02%s^02 made mincemeat out of %s",
"^02%s^02 manhandled %s",
"^02%s^02 massacred %s",
"^02%s^02 mutilated %s",
"^02%s^02 murdered %s",
"^02%s^02 neutered %s",
"^02%s^02 punted %s",
"^02%s^02 reamed %s",
"^02%s^02 ripped %s^02 a new orifice",
"^02%s^02 rocked %s",
"^02%s^02 sent %s^02 to hell",
"^02%s^02 shredded %s",
"^02%s^02 slashed %s",
"^02%s^02 slaughtered %s",
"^02%s^02 sliced %s",
"^02%s^02 smacked %s around",
"^02%s^02 smashed %s",
"^02%s^02 snuffed %s",
"^02%s^02 sodomized %s",
"^02%s^02 splattered %s",
"^02%s^02 sprayed %s",
"^02%s^02 squashed %s",
"^02%s^02 throttled %s",
"^02%s^02 toasted %s",
"^02%s^02 vented %s",
"^02%s^02 ventilated %s",
"^02%s^02 wasted %s",
"^02%s^02 wrecked %s",
};
const char *PlayerSelfObituaries[] =
{
"^02%s^02 is excrement",
"^02%s^02 is hamburger",
"^02%s^02 suffered scrotum separation",
"^02%s^02 volunteered for population control",
"^02%s^02 has suicided",
"^02%s^02 bled out",
};
const char *PlayerSelfObituaries[] =
{
"^02%s^02 is excrement",
"^02%s^02 is hamburger",
"^02%s^02 suffered scrotum separation",
"^02%s^02 volunteered for population control",
"^02%s^02 has suicided",
"^02%s^02 bled out",
};
EDUKE32_STATIC_ASSERT(OBITQUOTEINDEX + ARRAY_SIZE(PlayerObituaries)-1 < MAXQUOTES);
EDUKE32_STATIC_ASSERT(SUICIDEQUOTEINDEX + ARRAY_SIZE(PlayerSelfObituaries)-1 < MAXQUOTES);
EDUKE32_STATIC_ASSERT(OBITQUOTEINDEX + ARRAY_SIZE(PlayerObituaries)-1 < MAXQUOTES);
EDUKE32_STATIC_ASSERT(SUICIDEQUOTEINDEX + ARRAY_SIZE(PlayerSelfObituaries)-1 < MAXQUOTES);
g_numObituaries = ARRAY_SIZE(PlayerObituaries);
for (i=g_numObituaries-1; i>=0; i--)
{
if (C_AllocQuote(i+OBITQUOTEINDEX))
Bstrcpy(ScriptQuotes[i+OBITQUOTEINDEX],PlayerObituaries[i]);
}
g_numObituaries = ARRAY_SIZE(PlayerObituaries);
for (int i = g_numObituaries - 1; i >= 0; i--)
{
if (C_AllocQuote(i + OBITQUOTEINDEX))
Bstrcpy(ScriptQuotes[i + OBITQUOTEINDEX], PlayerObituaries[i]);
}
g_numSelfObituaries = ARRAY_SIZE(PlayerSelfObituaries);
for (i=g_numSelfObituaries-1; i>=0; i--)
{
if (C_AllocQuote(i+SUICIDEQUOTEINDEX))
Bstrcpy(ScriptQuotes[i+SUICIDEQUOTEINDEX],PlayerSelfObituaries[i]);
}
g_numSelfObituaries = ARRAY_SIZE(PlayerSelfObituaries);
for (int i = g_numSelfObituaries - 1; i >= 0; i--)
{
if (C_AllocQuote(i + SUICIDEQUOTEINDEX))
Bstrcpy(ScriptQuotes[i + SUICIDEQUOTEINDEX], PlayerSelfObituaries[i]);
}
}

View file

@ -37,6 +37,7 @@ extern "C" {
#define MAXCHEATLEN 20
#define NUMCHEATCODES (int32_t)ARRAY_SIZE(CheatStrings)
extern intptr_t *insptr;
extern hashtable_t h_gamefuncs;
#if !defined LUNATIC
@ -101,6 +102,7 @@ typedef struct {
int g_i, g_p, g_x;
int32_t *g_t;
spritetype *g_sp;
DukePlayer_t *g_pp;
int g_flags;
} vmstate_t;

File diff suppressed because it is too large Load diff

View file

@ -34,6 +34,33 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
int32_t g_noResetVars;
LUNATIC_CB void (*A_ResetVars)(int32_t iActor);
#else
gamevar_t aGameVars[MAXGAMEVARS];
gamearray_t aGameArrays[MAXGAMEARRAYS];
int32_t g_gameVarCount=0;
int32_t g_gameArrayCount=0;
// pointers to weapon gamevar data
intptr_t *aplWeaponClip[MAX_WEAPONS]; // number of items in magazine
intptr_t *aplWeaponReload[MAX_WEAPONS]; // delay to reload (include fire)
intptr_t *aplWeaponFireDelay[MAX_WEAPONS]; // delay to fire
intptr_t *aplWeaponHoldDelay[MAX_WEAPONS]; // delay after release fire button to fire (0 for none)
intptr_t *aplWeaponTotalTime[MAX_WEAPONS]; // The total time the weapon is cycling before next fire.
intptr_t *aplWeaponFlags[MAX_WEAPONS]; // Flags for weapon
intptr_t *aplWeaponShoots[MAX_WEAPONS]; // what the weapon shoots
intptr_t *aplWeaponSpawnTime[MAX_WEAPONS]; // the frame at which to spawn an item
intptr_t *aplWeaponSpawn[MAX_WEAPONS]; // the item to spawn
intptr_t *aplWeaponShotsPerBurst[MAX_WEAPONS]; // number of shots per 'burst' (one ammo per 'burst')
intptr_t *aplWeaponWorksLike[MAX_WEAPONS]; // What original the weapon works like
intptr_t *aplWeaponInitialSound[MAX_WEAPONS]; // Sound made when weapon starts firing. zero for no sound
intptr_t *aplWeaponFireSound[MAX_WEAPONS]; // Sound made when firing (each time for automatic)
intptr_t *aplWeaponSound2Time[MAX_WEAPONS]; // Alternate sound time
intptr_t *aplWeaponSound2Sound[MAX_WEAPONS]; // Alternate sound sound ID
intptr_t *aplWeaponReloadSound1[MAX_WEAPONS]; // Sound of magazine being removed
intptr_t *aplWeaponReloadSound2[MAX_WEAPONS]; // Sound of magazine being inserted
intptr_t *aplWeaponSelectSound[MAX_WEAPONS]; // Sound of weapon being selected
intptr_t *aplWeaponFlashColor[MAX_WEAPONS]; // Muzzle flash color
# include "gamestructures.c"
// Frees the memory for the *values* of game variables and arrays. Resets their

View file

@ -108,7 +108,7 @@ G_EXTERN int32_t screenpeek;
G_EXTERN int32_t startofdynamicinterpolations;
G_EXTERN int32_t ototalclock;
G_EXTERN intptr_t *g_parsingActorPtr;
G_EXTERN intptr_t *g_scriptPtr,*insptr;
G_EXTERN intptr_t *g_scriptPtr;
G_EXTERN int32_t *labelcode,*labeltype;
G_EXTERN intptr_t *script;
G_EXTERN map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" and "loading" music