mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 14:41:55 +00:00
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
43a759ec07
commit
ce210a9fd7
9 changed files with 558 additions and 706 deletions
|
@ -3310,8 +3310,8 @@ static void P_FinishWaterChange(int32_t j, DukePlayer_t *ps, int32_t sectlotag,
|
|||
int32_t l;
|
||||
vec3_t vect;
|
||||
|
||||
ps->bobposx = ps->opos.x = ps->pos.x;
|
||||
ps->bobposy = ps->opos.y = ps->pos.y;
|
||||
ps->bobpos.x = ps->opos.x = ps->pos.x;
|
||||
ps->bobpos.y = ps->opos.y = ps->pos.y;
|
||||
|
||||
if (ow < 0 || sprite[ow].owner != ow)
|
||||
ps->transporter_hold = -2;
|
||||
|
@ -3412,8 +3412,8 @@ ACTOR_STATIC void G_MoveTransports(void)
|
|||
ps->transporter_hold = 13;
|
||||
}
|
||||
|
||||
ps->bobposx = ps->opos.x = ps->pos.x = sprite[OW].x;
|
||||
ps->bobposy = ps->opos.y = ps->pos.y = sprite[OW].y;
|
||||
ps->bobpos.x = ps->opos.x = ps->pos.x = sprite[OW].x;
|
||||
ps->bobpos.y = ps->opos.y = ps->pos.y = sprite[OW].y;
|
||||
ps->opos.z = ps->pos.z = sprite[OW].z-PHEIGHT;
|
||||
|
||||
changespritesect(j,sprite[OW].sectnum);
|
||||
|
@ -3434,8 +3434,8 @@ ACTOR_STATIC void G_MoveTransports(void)
|
|||
if (!ps->jetpack_on || TEST_SYNC_KEY(g_player[p].sync->bits, SK_JUMP) ||
|
||||
TEST_SYNC_KEY(g_player[p].sync->bits, SK_CROUCH))
|
||||
{
|
||||
ps->bobposx = ps->opos.x = ps->pos.x += sprite[OW].x-SX;
|
||||
ps->bobposy = ps->opos.y = ps->pos.y += sprite[OW].y-SY;
|
||||
ps->bobpos.x = ps->opos.x = ps->pos.x += sprite[OW].x-SX;
|
||||
ps->bobpos.y = ps->opos.y = ps->pos.y += sprite[OW].y-SY;
|
||||
|
||||
if (ps->jetpack_on && (TEST_SYNC_KEY(g_player[p].sync->bits, SK_JUMP) || ps->jetpack_on < 11))
|
||||
ps->pos.z = sprite[OW].z-6144;
|
||||
|
@ -5624,8 +5624,6 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
|||
int32_t q=0, j, k, l, m, x;
|
||||
int32_t i = headspritestat[STAT_EFFECTOR];
|
||||
|
||||
fricxv = fricyv = 0;
|
||||
|
||||
while (i >= 0)
|
||||
{
|
||||
const int32_t nexti = nextspritestat[i];
|
||||
|
@ -5746,8 +5744,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
|||
|
||||
rotatepoint(sprite[j].x,sprite[j].y,ps->pos.x,ps->pos.y,(q*l),&m,&x);
|
||||
|
||||
ps->bobposx += m-ps->pos.x;
|
||||
ps->bobposy += x-ps->pos.y;
|
||||
ps->bobpos.x += m-ps->pos.x;
|
||||
ps->bobpos.y += x-ps->pos.y;
|
||||
|
||||
ps->pos.x = m;
|
||||
ps->pos.y = x;
|
||||
|
@ -5950,10 +5948,10 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
|||
|
||||
if (sector[ps->cursectnum].lotag != ST_2_UNDERWATER)
|
||||
{
|
||||
if (g_playerSpawnPoints[p].os == s->sectnum)
|
||||
if (g_playerSpawnPoints[p].sect == s->sectnum)
|
||||
{
|
||||
g_playerSpawnPoints[p].ox += m;
|
||||
g_playerSpawnPoints[p].oy += x;
|
||||
g_playerSpawnPoints[p].pos.x += m;
|
||||
g_playerSpawnPoints[p].pos.y += x;
|
||||
}
|
||||
|
||||
if (s->sectnum == sprite[ps->i].sectnum
|
||||
|
@ -5967,8 +5965,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
|||
ps->pos.x += m;
|
||||
ps->pos.y += x;
|
||||
|
||||
ps->bobposx += m;
|
||||
ps->bobposy += x;
|
||||
ps->bobpos.x += m;
|
||||
ps->bobpos.y += x;
|
||||
|
||||
ps->ang += q;
|
||||
ps->ang &= 2047;
|
||||
|
@ -6138,14 +6136,14 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
|||
ps->opos.y = ps->pos.y;
|
||||
}
|
||||
|
||||
ps->bobposx += l;
|
||||
ps->bobposy += x;
|
||||
ps->bobpos.x += l;
|
||||
ps->bobpos.y += x;
|
||||
}
|
||||
|
||||
if (g_playerSpawnPoints[p].os == s->sectnum)
|
||||
if (g_playerSpawnPoints[p].sect == s->sectnum)
|
||||
{
|
||||
g_playerSpawnPoints[p].ox += l;
|
||||
g_playerSpawnPoints[p].oy += x;
|
||||
g_playerSpawnPoints[p].pos.x += l;
|
||||
g_playerSpawnPoints[p].pos.y += x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6235,8 +6233,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
|||
ps->pos.x += m;
|
||||
ps->pos.y += x;
|
||||
|
||||
ps->bobposx += m;
|
||||
ps->bobposy += x;
|
||||
ps->bobpos.x += m;
|
||||
ps->bobpos.y += x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6891,8 +6889,8 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
|||
actor[k].floorz = sector[sprite[j].sectnum].floorz;
|
||||
actor[k].ceilingz = sector[sprite[j].sectnum].ceilingz;
|
||||
|
||||
ps->bobposx = ps->opos.x = ps->pos.x;
|
||||
ps->bobposy = ps->opos.y = ps->pos.y;
|
||||
ps->bobpos.x = ps->opos.x = ps->pos.x;
|
||||
ps->bobpos.y = ps->opos.y = ps->pos.y;
|
||||
ps->opos.z = ps->pos.z;
|
||||
|
||||
ps->truefz = actor[k].floorz;
|
||||
|
@ -7279,12 +7277,15 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
|||
}
|
||||
|
||||
p = myconnectindex;
|
||||
g_player[p].ps->fric.x = g_player[p].ps->fric.y = 0;
|
||||
if (g_player[p].ps->cursectnum == s->sectnum && g_player[p].ps->on_ground)
|
||||
{
|
||||
if (klabs(g_player[p].ps->pos.z-g_player[p].ps->truefz) < PHEIGHT+(9<<8))
|
||||
{
|
||||
fricxv += x<<3;
|
||||
fricyv += l<<3;
|
||||
g_player[p].ps->fric.x += x<<3;
|
||||
g_player[p].ps->fric.y += l<<3;
|
||||
}
|
||||
}
|
||||
|
||||
sc->floorxpanning += SP>>7;
|
||||
|
||||
|
@ -7382,10 +7383,11 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
|||
}
|
||||
|
||||
p = myconnectindex;
|
||||
g_player[p].ps->fric.x = g_player[p].ps->fric.y = 0;
|
||||
if (sprite[g_player[p].ps->i].sectnum == s->sectnum && g_player[p].ps->on_ground)
|
||||
{
|
||||
fricxv += l<<5;
|
||||
fricyv += x<<5;
|
||||
g_player[p].ps->fric.x += l<<5;
|
||||
g_player[p].ps->fric.y += x<<5;
|
||||
}
|
||||
|
||||
for (TRAVERSE_CONNECT(p))
|
||||
|
|
|
@ -8581,7 +8581,7 @@ void G_StartMusic(void)
|
|||
int32_t res = S_PlayMusic(MapInfo[i].musicfn, i);
|
||||
|
||||
Bsnprintf(ScriptQuotes[QUOTE_MUSIC], MAXQUOTELEN, "Playing %s",
|
||||
res ? MapInfo[i].alt_musicfn : MapInfo[i].musicfn);
|
||||
res ? MapInfo[i].ext_musicfn : MapInfo[i].musicfn);
|
||||
P_DoQuote(QUOTE_MUSIC, g_player[myconnectindex].ps);
|
||||
}
|
||||
}
|
||||
|
@ -9025,8 +9025,8 @@ FAKE_F3:
|
|||
|
||||
KB_ClearKeyDown(sc_F5);
|
||||
|
||||
if (map->alt_musicfn != NULL)
|
||||
Bstrncpyz(qmusic, map->alt_musicfn, MAXQUOTELEN);
|
||||
if (map->ext_musicfn != NULL)
|
||||
Bstrncpyz(qmusic, map->ext_musicfn, MAXQUOTELEN);
|
||||
else if (map->musicfn != NULL)
|
||||
Bsnprintf(qmusic, MAXQUOTELEN, "%s. Use SHIFT-F5 to change.",
|
||||
map->musicfn);
|
||||
|
@ -9299,14 +9299,14 @@ static int32_t S_DefineMusic(const char *ID, const char *name)
|
|||
map_t *map = &MapInfo[sel];
|
||||
const int special = (sel >= MUS_FIRST_SPECIAL);
|
||||
|
||||
map->alt_musicfn = S_OggifyFilename(map->alt_musicfn, name, ID);
|
||||
map->ext_musicfn = S_OggifyFilename(map->ext_musicfn, name, ID);
|
||||
|
||||
// If we are given a music file name for a proper level that has no
|
||||
// primary music defined, set it up as both.
|
||||
if (map->alt_musicfn == NULL && !special && ID == 0 && name)
|
||||
if (map->ext_musicfn == NULL && !special && ID == 0 && name)
|
||||
{
|
||||
map->musicfn = dup_filename(name);
|
||||
map->alt_musicfn = dup_filename(name);
|
||||
map->ext_musicfn = dup_filename(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -10649,7 +10649,7 @@ static void G_Cleanup(void)
|
|||
if (MapInfo[i].name != NULL) Bfree(MapInfo[i].name);
|
||||
if (MapInfo[i].filename != NULL) Bfree(MapInfo[i].filename);
|
||||
if (MapInfo[i].musicfn != NULL) Bfree(MapInfo[i].musicfn);
|
||||
if (MapInfo[i].alt_musicfn != NULL) Bfree(MapInfo[i].alt_musicfn);
|
||||
if (MapInfo[i].ext_musicfn != NULL) Bfree(MapInfo[i].ext_musicfn);
|
||||
|
||||
G_FreeMapState(i);
|
||||
}
|
||||
|
|
|
@ -1257,9 +1257,9 @@ static void __fastcall VM_GetPlayer(register int32_t lVar1, register int32_t lLa
|
|||
case PLAYER_INVDISPTIME:
|
||||
Gv_SetVarX(lVar2, ps->invdisptime); return;
|
||||
case PLAYER_BOBPOSX:
|
||||
Gv_SetVarX(lVar2, ps->bobposx); return;
|
||||
Gv_SetVarX(lVar2, ps->bobpos.x); return;
|
||||
case PLAYER_BOBPOSY:
|
||||
Gv_SetVarX(lVar2, ps->bobposy); return;
|
||||
Gv_SetVarX(lVar2, ps->bobpos.y); return;
|
||||
case PLAYER_OPOSX:
|
||||
Gv_SetVarX(lVar2, ps->opos.x); return;
|
||||
case PLAYER_OPOSY:
|
||||
|
@ -1599,9 +1599,9 @@ static void __fastcall VM_SetPlayer(int32_t lVar1, int32_t lLabelID, int32_t lVa
|
|||
case PLAYER_INVDISPTIME:
|
||||
ps->invdisptime=lVar1; return;
|
||||
case PLAYER_BOBPOSX:
|
||||
ps->bobposx=lVar1; return;
|
||||
ps->bobpos.x=lVar1; return;
|
||||
case PLAYER_BOBPOSY:
|
||||
ps->bobposy=lVar1; return;
|
||||
ps->bobpos.y=lVar1; return;
|
||||
case PLAYER_OPOSX:
|
||||
ps->opos.x=lVar1; return;
|
||||
case PLAYER_OPOSY:
|
||||
|
@ -3648,9 +3648,9 @@ static int32_t __fastcall VM_AccessPlayerX(int32_t iPlayer, int32_t lLabelID, in
|
|||
case PLAYER_INVDISPTIME:
|
||||
return ps->invdisptime;
|
||||
case PLAYER_BOBPOSX:
|
||||
return ps->bobposx;
|
||||
return ps->bobpos.x;
|
||||
case PLAYER_BOBPOSY:
|
||||
return ps->bobposy;
|
||||
return ps->bobpos.y;
|
||||
case PLAYER_OPOSX:
|
||||
return ps->opos.x;
|
||||
case PLAYER_OPOSY:
|
||||
|
|
|
@ -85,7 +85,6 @@ G_EXTERN int16_t myhoriz,omyhoriz,myhorizoff,omyhorizoff;
|
|||
G_EXTERN int32_t *animateptr[MAXANIMATES];
|
||||
G_EXTERN int32_t animategoal[MAXANIMATES],animatevel[MAXANIMATES],g_animateCount;
|
||||
G_EXTERN int32_t cloudtotalclock;
|
||||
G_EXTERN int32_t fricxv,fricyv;
|
||||
G_EXTERN int32_t g_currentFrameRate;
|
||||
G_EXTERN int32_t g_damageCameras,g_freezerSelfDamage;
|
||||
G_EXTERN int32_t g_doQuickSave;
|
||||
|
@ -103,7 +102,7 @@ G_EXTERN int32_t neartaghitdist,lockclock,g_startArmorAmount;
|
|||
G_EXTERN int32_t playerswhenstarted;
|
||||
G_EXTERN int32_t screenpeek;
|
||||
G_EXTERN int32_t startofdynamicinterpolations;
|
||||
G_EXTERN int32_t vel,svel,angvel,horiz,ototalclock;
|
||||
G_EXTERN int32_t ototalclock;
|
||||
G_EXTERN intptr_t *g_parsingActorPtr;
|
||||
G_EXTERN intptr_t *g_scriptPtr,*insptr;
|
||||
G_EXTERN int32_t *labelcode,*labeltype;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -142,8 +142,8 @@ enum playeraction_t {
|
|||
};
|
||||
|
||||
typedef struct {
|
||||
int32_t ox,oy,oz;
|
||||
int16_t oa,os;
|
||||
vec3_t pos;
|
||||
int16_t ang, sect;
|
||||
} playerspawn_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -155,10 +155,9 @@ typedef struct {
|
|||
} DukeStatus_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t bits; // 4b
|
||||
int16_t fvel, svel; // 4b
|
||||
int8_t avel, horz; // 2b
|
||||
int8_t extbits, filler; // 2b
|
||||
uint32_t bits;
|
||||
int16_t fvel, svel, avel;
|
||||
int8_t horz, extbits;
|
||||
} input_t;
|
||||
|
||||
#pragma pack(push,1)
|
||||
|
@ -171,7 +170,7 @@ typedef struct {
|
|||
// KEEPINSYNC lunatic/defs.ilua
|
||||
typedef struct {
|
||||
vec3_t pos, opos, vel, npos;
|
||||
int32_t bobposx, bobposy;
|
||||
vec2_t bobpos, fric;
|
||||
int32_t truefz, truecz, player_par;
|
||||
int32_t randomflamex, exitx, exity;
|
||||
int32_t runspeed, max_player_health, max_shield_amount;
|
||||
|
@ -288,7 +287,6 @@ typedef struct
|
|||
} weapondata_t;
|
||||
|
||||
extern int8_t g_numPlayerSprites;
|
||||
extern int32_t fricxv,fricyv;
|
||||
|
||||
#ifdef LUNATIC
|
||||
# define PWEAPON(Player, Weapon, Wmember) (g_playerWeapon[Player][Weapon].Wmember)
|
||||
|
|
|
@ -627,7 +627,7 @@ void P_RandomSpawnPoint(int32_t snum)
|
|||
{
|
||||
for (k=0; k<g_numPlayerSprites; k++)
|
||||
{
|
||||
dist = FindDistance2D(g_player[j].ps->pos.x-g_playerSpawnPoints[k].ox,g_player[j].ps->pos.y-g_playerSpawnPoints[k].oy);
|
||||
dist = FindDistance2D(g_player[j].ps->pos.x-g_playerSpawnPoints[k].pos.x,g_player[j].ps->pos.y-g_playerSpawnPoints[k].pos.y);
|
||||
if (dist < pdist)
|
||||
i = k, pdist = dist;
|
||||
}
|
||||
|
@ -637,11 +637,11 @@ void P_RandomSpawnPoint(int32_t snum)
|
|||
}
|
||||
}
|
||||
|
||||
p->bobposx = p->opos.x = p->pos.x = g_playerSpawnPoints[i].ox;
|
||||
p->bobposy = p->opos.y = p->pos.y = g_playerSpawnPoints[i].oy;
|
||||
p->opos.z = p->pos.z = g_playerSpawnPoints[i].oz;
|
||||
p->ang = g_playerSpawnPoints[i].oa;
|
||||
p->cursectnum = g_playerSpawnPoints[i].os;
|
||||
p->bobpos.x = p->opos.x = p->pos.x = g_playerSpawnPoints[i].pos.x;
|
||||
p->bobpos.y = p->opos.y = p->pos.y = g_playerSpawnPoints[i].pos.y;
|
||||
p->opos.z = p->pos.z = g_playerSpawnPoints[i].pos.z;
|
||||
p->ang = g_playerSpawnPoints[i].ang;
|
||||
p->cursectnum = g_playerSpawnPoints[i].sect;
|
||||
sprite[p->i].cstat = 1+256;
|
||||
}
|
||||
|
||||
|
@ -663,8 +663,8 @@ void P_ResetPlayer(int32_t snum)
|
|||
tmpvect.y = pl->pos.y;
|
||||
tmpvect.z = pl->pos.z+PHEIGHT;
|
||||
P_RandomSpawnPoint(snum);
|
||||
sp->x = actor[pl->i].bpos.x = pl->bobposx = pl->opos.x = pl->pos.x;
|
||||
sp->y = actor[pl->i].bpos.y = pl->bobposy = pl->opos.y = pl->pos.y;
|
||||
sp->x = actor[pl->i].bpos.x = pl->bobpos.x = pl->opos.x = pl->pos.x;
|
||||
sp->y = actor[pl->i].bpos.y = pl->bobpos.y = pl->opos.y = pl->pos.y;
|
||||
sp->z = actor[pl->i].bpos.y = pl->opos.z =pl->pos.z;
|
||||
updatesector(pl->pos.x,pl->pos.y,&pl->cursectnum);
|
||||
setsprite(pl->i,&tmpvect);
|
||||
|
@ -799,8 +799,8 @@ void P_ResetStatus(int32_t snum)
|
|||
p->vel.x = 0;
|
||||
p->vel.y = 0;
|
||||
p->vel.z = 0;
|
||||
fricxv = 0;
|
||||
fricyv = 0;
|
||||
p->fric.x = 0;
|
||||
p->fric.y = 0;
|
||||
p->somethingonplayer =-1;
|
||||
p->one_eighty_count = 0;
|
||||
p->cheat_phase = 0;
|
||||
|
@ -931,7 +931,6 @@ static void resetprestat(int32_t snum,int32_t g)
|
|||
|
||||
p->timebeforeexit = 0;
|
||||
p->customexitsound = 0;
|
||||
|
||||
}
|
||||
|
||||
// Tweak sprites contained in moving sectors with these SE lotags.
|
||||
|
@ -1000,7 +999,7 @@ static inline int32_t G_CheckExitSprite(int32_t i)
|
|||
return (sprite[i].lotag == UINT16_MAX && (sprite[i].cstat&16));
|
||||
}
|
||||
|
||||
static inline void prelevel(char g)
|
||||
static void prelevel(char g)
|
||||
{
|
||||
int32_t i, nexti, j, startwall, endwall;
|
||||
int32_t switchpicnum;
|
||||
|
@ -1119,22 +1118,17 @@ static inline void prelevel(char g)
|
|||
break;
|
||||
}
|
||||
|
||||
for (i=0; i < MAXSPRITES; i++)
|
||||
for (i = 0; i < MAXSPRITES; i++)
|
||||
{
|
||||
if (sprite[i].statnum < MAXSTATUS)
|
||||
{
|
||||
if (PN == SECTOREFFECTOR && SLT == SE_14_SUBWAY_CAR)
|
||||
continue;
|
||||
A_Spawn(-1,i);
|
||||
}
|
||||
if (sprite[i].statnum < MAXSTATUS && (PN != SECTOREFFECTOR || SLT != SE_14_SUBWAY_CAR))
|
||||
A_Spawn(-1, i);
|
||||
}
|
||||
|
||||
for (i=0; i < MAXSPRITES; i++)
|
||||
if (sprite[i].statnum < MAXSTATUS)
|
||||
{
|
||||
if (PN == SECTOREFFECTOR && SLT == SE_14_SUBWAY_CAR)
|
||||
A_Spawn(-1,i);
|
||||
}
|
||||
for (i = 0; i < MAXSPRITES; i++)
|
||||
{
|
||||
if (sprite[i].statnum < MAXSTATUS && PN == SECTOREFFECTOR && SLT == SE_14_SUBWAY_CAR)
|
||||
A_Spawn(-1, i);
|
||||
}
|
||||
|
||||
G_SetupRotfixedSprites();
|
||||
|
||||
|
@ -1518,11 +1512,11 @@ static void resetpspritevars(char g)
|
|||
if (g_numPlayerSprites == MAXPLAYERS)
|
||||
G_GameExit("\nToo many player sprites (max 16.)");
|
||||
|
||||
g_playerSpawnPoints[g_numPlayerSprites].ox = s->x;
|
||||
g_playerSpawnPoints[g_numPlayerSprites].oy = s->y;
|
||||
g_playerSpawnPoints[g_numPlayerSprites].oz = s->z;
|
||||
g_playerSpawnPoints[g_numPlayerSprites].oa = s->ang;
|
||||
g_playerSpawnPoints[g_numPlayerSprites].os = s->sectnum;
|
||||
g_playerSpawnPoints[g_numPlayerSprites].pos.x = s->x;
|
||||
g_playerSpawnPoints[g_numPlayerSprites].pos.y = s->y;
|
||||
g_playerSpawnPoints[g_numPlayerSprites].pos.z = s->z;
|
||||
g_playerSpawnPoints[g_numPlayerSprites].ang = s->ang;
|
||||
g_playerSpawnPoints[g_numPlayerSprites].sect = s->sectnum;
|
||||
|
||||
g_numPlayerSprites++;
|
||||
|
||||
|
@ -1592,8 +1586,8 @@ static void resetpspritevars(char g)
|
|||
g_player[j].ps->autostep = (20L<<8);
|
||||
g_player[j].ps->autostep_sbw = (4L<<8);
|
||||
|
||||
actor[i].bpos.x = g_player[j].ps->bobposx = g_player[j].ps->opos.x = g_player[j].ps->pos.x = s->x;
|
||||
actor[i].bpos.y = g_player[j].ps->bobposy = g_player[j].ps->opos.y = g_player[j].ps->pos.y = s->y;
|
||||
actor[i].bpos.x = g_player[j].ps->bobpos.x = g_player[j].ps->opos.x = g_player[j].ps->pos.x = s->x;
|
||||
actor[i].bpos.y = g_player[j].ps->bobpos.y = g_player[j].ps->opos.y = g_player[j].ps->pos.y = s->y;
|
||||
actor[i].bpos.z = g_player[j].ps->opos.z = g_player[j].ps->pos.z = s->z;
|
||||
g_player[j].ps->oang = g_player[j].ps->ang = s->ang;
|
||||
|
||||
|
@ -1623,12 +1617,7 @@ static inline void clearfrags(void)
|
|||
|
||||
void G_ResetTimers(uint8_t keepgtics)
|
||||
{
|
||||
vel = svel = angvel = horiz = 0;
|
||||
|
||||
totalclock = 0;
|
||||
cloudtotalclock = 0;
|
||||
ototalclock = 0;
|
||||
lockclock = 0;
|
||||
totalclock = cloudtotalclock = ototalclock = lockclock = 0;
|
||||
ready2send = 1;
|
||||
g_levelTextTime = 85;
|
||||
if (!keepgtics)
|
||||
|
@ -1658,18 +1647,20 @@ void G_ClearFIFO(void)
|
|||
|
||||
int32_t G_FindLevelByFile(const char *fn)
|
||||
{
|
||||
int32_t volume, level;
|
||||
|
||||
for (volume=0; volume<MAXVOLUMES; volume++)
|
||||
for (int volume = 0; volume < MAXVOLUMES; volume++)
|
||||
{
|
||||
for (level=0; level<MAXLEVELS; level++)
|
||||
const int voloff = volume * MAXLEVELS;
|
||||
for (int level = 0; level < MAXLEVELS; level++)
|
||||
{
|
||||
if (MapInfo[(volume*MAXLEVELS)+level].filename != NULL)
|
||||
if (!Bstrcasecmp(fn, MapInfo[(volume*MAXLEVELS)+level].filename))
|
||||
return ((volume * MAXLEVELS) + level);
|
||||
if (MapInfo[voloff + level].filename == NULL)
|
||||
continue;
|
||||
|
||||
if (!Bstrcasecmp(fn, MapInfo[voloff + level].filename))
|
||||
return voloff + level;
|
||||
}
|
||||
}
|
||||
return MAXLEVELS*MAXVOLUMES;
|
||||
|
||||
return MAXLEVELS * MAXVOLUMES;
|
||||
}
|
||||
|
||||
void G_FadeLoad(int32_t r, int32_t g, int32_t b, int32_t start, int32_t end, int32_t step, int32_t ticwait)
|
||||
|
@ -1710,60 +1701,54 @@ static void G_LoadMapHack(char *outbuf, const char *filename)
|
|||
|
||||
static void G_ReallocCopyMusicName(int32_t level_number, const char *levnamebuf, int32_t altp)
|
||||
{
|
||||
char **musfn = altp ? &MapInfo[level_number].alt_musicfn : &MapInfo[level_number].musicfn;
|
||||
int32_t dastrlen = Bstrlen(levnamebuf);
|
||||
|
||||
*musfn = (char *)Xrealloc(*musfn, dastrlen+1);
|
||||
Bstrcpy(*musfn, levnamebuf);
|
||||
char **musfn = altp ? &MapInfo[level_number].ext_musicfn : &MapInfo[level_number].musicfn;
|
||||
uint8_t len = Bstrlen(levnamebuf) + 1;
|
||||
*musfn = (char *)Xrealloc(*musfn, len);
|
||||
Bstrncpy(*musfn, levnamebuf, len);
|
||||
}
|
||||
|
||||
// levnamebuf should have at least size BMAX_PATH
|
||||
// FIXME: This function should be rolled into a loop, testing .flac, then .ogg, then .mid.
|
||||
void G_SetupFilenameBasedMusic(char *levnamebuf, const char *boardfilename, int32_t level_number)
|
||||
{
|
||||
char *p;
|
||||
int32_t fil;
|
||||
char *p, *exts[] = {
|
||||
#ifdef HAVE_FLAC
|
||||
"flac",
|
||||
#endif
|
||||
#ifdef HAVE_VORBIS
|
||||
"ogg",
|
||||
#endif
|
||||
"mid"
|
||||
};
|
||||
|
||||
Bstrcpy(levnamebuf, boardfilename);
|
||||
Bstrncpy(levnamebuf, boardfilename, BMAX_PATH);
|
||||
|
||||
// usermap music based on map filename
|
||||
Bcorrectfilename(levnamebuf,0);
|
||||
Bcorrectfilename(levnamebuf, 0);
|
||||
|
||||
p = Bstrrchr(levnamebuf,'.');
|
||||
if (!p)
|
||||
if (NULL == (p = Bstrrchr(levnamebuf, '.')))
|
||||
{
|
||||
p = levnamebuf + Bstrlen(levnamebuf);
|
||||
p[0] = '.';
|
||||
}
|
||||
|
||||
Bmemcpy(p+1, "ogg", 4);
|
||||
fil = kopen4loadfrommod(levnamebuf,0);
|
||||
|
||||
if (fil > -1)
|
||||
for (int i = 0; i < ARRAY_SIZE(exts); i++)
|
||||
{
|
||||
kclose(fil);
|
||||
int32_t fil;
|
||||
|
||||
G_ReallocCopyMusicName(level_number, levnamebuf, 1);
|
||||
}
|
||||
else if (MapInfo[level_number].alt_musicfn != NULL)
|
||||
{
|
||||
Bfree(MapInfo[level_number].alt_musicfn);
|
||||
MapInfo[level_number].alt_musicfn = NULL;
|
||||
Bmemcpy(p+1, exts[i], Bstrlen(exts[i]) + 1);
|
||||
|
||||
if ((fil = kopen4loadfrommod(levnamebuf, 0)) != -1)
|
||||
{
|
||||
kclose(fil);
|
||||
G_ReallocCopyMusicName(level_number, levnamebuf, i < (ARRAY_SIZE(exts) - 1));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Bmemcpy(p+1, "mid", 4);
|
||||
fil = kopen4loadfrommod(levnamebuf,0);
|
||||
|
||||
// XXX: should pull in a "default user map" song entry, probably E1L8
|
||||
// (which would need to not get clobbered)
|
||||
if (fil == -1)
|
||||
Bstrcpy(levnamebuf, "dethtoll.mid");
|
||||
else kclose(fil);
|
||||
|
||||
G_ReallocCopyMusicName(level_number, levnamebuf, 0);
|
||||
DO_FREE_AND_NULL(MapInfo[level_number].ext_musicfn);
|
||||
G_ReallocCopyMusicName(level_number, "dethtoll.mid", 0);
|
||||
}
|
||||
|
||||
static int G_HaveUserMap(void)
|
||||
static inline int G_HaveUserMap(void)
|
||||
{
|
||||
return (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0);
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ extern void G_RestoreMapState();
|
|||
|
||||
typedef struct {
|
||||
int32_t partime, designertime;
|
||||
char *name, *filename, *musicfn, *alt_musicfn;
|
||||
char *name, *filename, *musicfn, *ext_musicfn;
|
||||
mapstate_t *savedstate;
|
||||
} map_t;
|
||||
|
||||
|
|
|
@ -216,8 +216,8 @@ int32_t S_PlayMusic(const char *fn, const int32_t sel)
|
|||
if (ud.config.MusicToggle == 0) return 0;
|
||||
if (ud.config.MusicDevice < 0) return 0;
|
||||
|
||||
if (MapInfo[sel].alt_musicfn != NULL)
|
||||
alt = fn = MapInfo[sel].alt_musicfn;
|
||||
if (MapInfo[sel].ext_musicfn != NULL)
|
||||
alt = fn = MapInfo[sel].ext_musicfn;
|
||||
|
||||
testfn = (char *)Xmalloc(strlen(fn) + 6);
|
||||
strcpy(testfn, fn);
|
||||
|
|
Loading…
Reference in a new issue