Merge branch 'namirays' into oglshaderport

This commit is contained in:
Sally Cochenour 2020-01-11 09:32:59 -05:00
commit 5fac6f542e
53 changed files with 1864 additions and 999 deletions

View File

@ -127,13 +127,17 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
}
// Orientation
if ((bot->pflags & (PF_SPINNING|PF_STARTDASH)) || flymode == 2)
if (bot->pflags & (PF_SPINNING|PF_STARTDASH))
{
cmd->angleturn = (sonic->angle - tails->angle) >> FRACBITS;
cmd->angleturn = (sonic->angle - tails->angle) >> 16; // NOT FRACBITS DAMNIT
}
else if (flymode == 2)
{
cmd->angleturn = sonic->player->cmd.angleturn - (tails->angle >> 16);
}
else
{
cmd->angleturn = (ang - tails->angle) >> FRACBITS;
cmd->angleturn = (ang - tails->angle) >> 16; // NOT FRACBITS DAMNIT
}
// ********
@ -222,7 +226,7 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
{
if (dist < followthres && dist > touchdist) // Do positioning
{
cmd->angleturn = (ang - tails->angle) >> FRACBITS;
cmd->angleturn = (ang - tails->angle) >> 16; // NOT FRACBITS DAMNIT
cmd->forwardmove = 50;
spinmode = true;
}
@ -230,7 +234,7 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
{
if (!bmom && (!(bot->pflags & PF_SPINNING) || (bot->dashspeed && bot->pflags & PF_SPINNING)))
{
cmd->angleturn = (sonic->angle - tails->angle) >> FRACBITS;
cmd->angleturn = (sonic->angle - tails->angle) >> 16; // NOT FRACBITS DAMNIT
spin = true;
}
spinmode = true;
@ -244,7 +248,7 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
if (bot->pflags & PF_SPINNING || !spin_last)
{
spin = true;
cmd->angleturn = (sonic->angle - tails->angle) >> FRACBITS;
cmd->angleturn = (sonic->angle - tails->angle) >> 16; // NOT FRACBITS DAMNIT
cmd->forwardmove = MAXPLMOVE;
spinmode = true;
}
@ -290,7 +294,7 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
else if (dist < followmin)
{
// Copy inputs
cmd->angleturn = (sonic->angle - tails->angle) >> FRACBITS;
cmd->angleturn = (sonic->angle - tails->angle) >> 16; // NOT FRACBITS DAMNIT
bot->drawangle = ang;
cmd->forwardmove = 8 * pcmd->forwardmove / 10;
cmd->sidemove = 8 * pcmd->sidemove / 10;
@ -358,7 +362,7 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
}
// Bot AI isn't programmed in analog.
CV_SetValue(&cv_analog2, false);
CV_SetValue(&cv_analog[1], false);
#ifdef HAVE_BLUA
// Let Lua scripts build ticcmds

View File

@ -2114,7 +2114,12 @@ void CV_SaveVariables(FILE *f)
// Silly hack for Min/Max vars
if (!strcmp(cvar->string, "MAX") || !strcmp(cvar->string, "MIN"))
sprintf(stringtrite, "%d", cvar->value);
{
if (cvar->flags & CV_FLOAT)
sprintf(stringtowrite, "%f", FIXED_TO_FLOAT(cvar->value));
else
sprintf(stringtowrite, "%d", cvar->value);
}
else
strcpy(stringtrite, cvar->string);

View File

@ -20,6 +20,15 @@
// Command buffer & command execution
//===================================
/* Lua command registration flags. */
enum
{
COM_ADMIN = 1,
COM_SPLITSCREEN = 2,
COM_LOCAL = 4,
};
/* Command buffer flags. */
enum
{
COM_SAFE = 1,

View File

@ -4651,9 +4651,9 @@ static void Local_Maketic(INT32 realtics)
// and G_MapEventsToControls
if (!dedicated) rendergametic = gametic;
// translate inputs (keyboard/mouse/joystick) into game controls
G_BuildTiccmd(&localcmds, realtics);
G_BuildTiccmd(&localcmds, realtics, 1);
if (splitscreen || botingame)
G_BuildTiccmd2(&localcmds2, realtics);
G_BuildTiccmd(&localcmds2, realtics, 2);
localcmds.angleturn |= TICCMD_RECEIVED;
}

View File

@ -832,7 +832,7 @@ void D_StartTitle(void)
CV_SetValue(&cv_usemouse, tutorialusemouse);
CV_SetValue(&cv_alwaysfreelook, tutorialfreelook);
CV_SetValue(&cv_mousemove, tutorialmousemove);
CV_SetValue(&cv_analog, tutorialanalog);
CV_SetValue(&cv_analog[0], tutorialanalog);
M_StartMessage("Do you want to \x82save the recommended \x82movement controls?\x80\n\nPress 'Y' or 'Enter' to confirm\nPress 'N' or any key to keep \nyour current controls",
M_TutorialSaveControlResponse, MM_YESNO);
}

View File

@ -781,6 +781,10 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_fireaxis2);
CV_RegisterVar(&cv_firenaxis);
CV_RegisterVar(&cv_firenaxis2);
CV_RegisterVar(&cv_deadzone);
CV_RegisterVar(&cv_deadzone2);
CV_RegisterVar(&cv_digitaldeadzone);
CV_RegisterVar(&cv_digitaldeadzone2);
// filesrch.c
CV_RegisterVar(&cv_addons_option);
@ -819,20 +823,34 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_joyscale2);
// Analog Control
CV_RegisterVar(&cv_analog);
CV_RegisterVar(&cv_analog2);
CV_RegisterVar(&cv_useranalog);
CV_RegisterVar(&cv_useranalog2);
CV_RegisterVar(&cv_analog[0]);
CV_RegisterVar(&cv_analog[1]);
CV_RegisterVar(&cv_useranalog[0]);
CV_RegisterVar(&cv_useranalog[1]);
// deez New User eXperiences
CV_RegisterVar(&cv_directionchar);
CV_RegisterVar(&cv_directionchar2);
CV_RegisterVar(&cv_directionchar[0]);
CV_RegisterVar(&cv_directionchar[1]);
CV_RegisterVar(&cv_autobrake);
CV_RegisterVar(&cv_autobrake2);
// Ported from kart
CV_RegisterVar(&cv_deadzone);
CV_RegisterVar(&cv_deadzone2);
// hi here's some new controls
CV_RegisterVar(&cv_cam_shiftfacing[0]);
CV_RegisterVar(&cv_cam_shiftfacing[1]);
CV_RegisterVar(&cv_cam_turnfacing[0]);
CV_RegisterVar(&cv_cam_turnfacing[1]);
CV_RegisterVar(&cv_cam_turnfacingability[0]);
CV_RegisterVar(&cv_cam_turnfacingability[1]);
CV_RegisterVar(&cv_cam_turnfacingspindash[0]);
CV_RegisterVar(&cv_cam_turnfacingspindash[1]);
CV_RegisterVar(&cv_cam_turnfacinginput[0]);
CV_RegisterVar(&cv_cam_turnfacinginput[1]);
CV_RegisterVar(&cv_cam_centertoggle[0]);
CV_RegisterVar(&cv_cam_centertoggle[1]);
CV_RegisterVar(&cv_cam_lockedinput[0]);
CV_RegisterVar(&cv_cam_lockedinput[1]);
CV_RegisterVar(&cv_cam_lockonboss[0]);
CV_RegisterVar(&cv_cam_lockonboss[1]);
// s_sound.c
CV_RegisterVar(&cv_soundvolume);
@ -1501,9 +1519,9 @@ void SendWeaponPref(void)
buf[0] = 0;
if (cv_flipcam.value)
buf[0] |= 1;
if (cv_analog.value)
if (cv_analog[0].value && cv_directionchar[0].value != 2)
buf[0] |= 2;
if (cv_directionchar.value)
if (cv_directionchar[0].value == 1)
buf[0] |= 4;
if (cv_autobrake.value)
buf[0] |= 8;
@ -1517,9 +1535,9 @@ void SendWeaponPref2(void)
buf[0] = 0;
if (cv_flipcam2.value)
buf[0] |= 1;
if (cv_analog2.value)
if (cv_analog[1].value && cv_directionchar[1].value != 2)
buf[0] |= 2;
if (cv_directionchar2.value)
if (cv_directionchar[1].value == 1)
buf[0] |= 4;
if (cv_autobrake2.value)
buf[0] |= 8;
@ -1984,7 +2002,7 @@ static void Command_Map_f(void)
CV_SetValue(&cv_usemouse, tutorialusemouse);
CV_SetValue(&cv_alwaysfreelook, tutorialfreelook);
CV_SetValue(&cv_mousemove, tutorialmousemove);
CV_SetValue(&cv_analog, tutorialanalog);
CV_SetValue(&cv_analog[0], tutorialanalog);
}
tutorialmode = false; // warping takes us out of tutorial mode

View File

@ -3430,6 +3430,8 @@ static void readextraemblemdata(MYFILE *f, INT32 num)
sizeof (extraemblems[num-1].description), va("Extra emblem %d: objective", num));
else if (fastcmp(word, "CONDITIONSET"))
extraemblems[num-1].conditionset = (UINT8)value;
else if (fastcmp(word, "SHOWCONDITIONSET"))
extraemblems[num-1].showconditionset = (UINT8)value;
else
{
strupr(word2);
@ -3516,6 +3518,8 @@ static void readunlockable(MYFILE *f, INT32 num)
unlockables[num].height = (UINT16)i;
else if (fastcmp(word, "CONDITIONSET"))
unlockables[num].conditionset = (UINT8)i;
else if (fastcmp(word, "SHOWCONDITIONSET"))
unlockables[num].showconditionset = (UINT8)i;
else if (fastcmp(word, "NOCECHO"))
unlockables[num].nocecho = (UINT8)(i || word2[0] == 'T' || word2[0] == 'Y');
else if (fastcmp(word, "NOCHECKLIST"))
@ -8669,6 +8673,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_NIGHTSCHIP", // NiGHTS Chip
"MT_FLINGNIGHTSCHIP", // Lost NiGHTS Chip
"MT_NIGHTSSTAR", // NiGHTS Star
"MT_FLINGNIGHTSSTAR", // Lost NiGHTS Star
"MT_NIGHTSSUPERLOOP",
"MT_NIGHTSDRILLREFILL",
"MT_NIGHTSHELPER",
@ -9461,6 +9466,10 @@ struct {
{"SF_MULTIABILITY",SF_MULTIABILITY},
{"SF_NONIGHTSROTATION",SF_NONIGHTSROTATION},
// Dashmode constants
{"DASHMODE_THRESHOLD",DASHMODE_THRESHOLD},
{"DASHMODE_MAX",DASHMODE_MAX},
// Character abilities!
// Primary
{"CA_NONE",CA_NONE}, // now slot 0!
@ -9737,6 +9746,11 @@ struct {
{"BT_CUSTOM2",BT_CUSTOM2}, // Lua customizable
{"BT_CUSTOM3",BT_CUSTOM3}, // Lua customizable
// Lua command registration flags
{"COM_ADMIN",COM_ADMIN},
{"COM_SPLITSCREEN",COM_SPLITSCREEN},
{"COM_LOCAL",COM_LOCAL},
// cvflags_t
{"CV_SAVE",CV_SAVE},
{"CV_CALL",CV_CALL},

View File

@ -140,7 +140,7 @@ extern INT32 tutorialgcs; // which control scheme is loaded?
extern INT32 tutorialusemouse; // store cv_usemouse user value
extern INT32 tutorialfreelook; // store cv_alwaysfreelook user value
extern INT32 tutorialmousemove; // store cv_mousemove user value
extern INT32 tutorialanalog; // store cv_analog user value
extern INT32 tutorialanalog; // store cv_analog[0] user value
extern boolean looptitle;

View File

@ -3790,7 +3790,7 @@ void F_ContinueDrawer(void)
sprdef = &contskins[n]->sprites[cont_spr2[n][0]];\
sprframe = &sprdef->spriteframes[cont_spr2[n][1]];\
patch = W_CachePatchNum(sprframe->lumppat[cont_spr2[n][2]], PU_PATCH);\
V_DrawFixedPatch((dx), (dy), FRACUNIT, (sprframe->flip & (1<<cont_spr2[n][2])) ? V_FLIP : 0, patch, contcolormaps[n]);\
V_DrawFixedPatch((dx), (dy), contskins[n]->highresscale, (sprframe->flip & (1<<cont_spr2[n][2])) ? V_FLIP : 0, patch, contcolormaps[n]);\
}
if (offsy < 0)

View File

@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2013-2016 by Matthew "Inuyasha" Walsh.
// Copyright (C) 2013-2016 by Matthew "Kaito Sinclaire" Walsh.
// Copyright (C) 1999-2019 by Sonic Team Junior.
//
// This program is free software distributed under the

File diff suppressed because it is too large Load Diff

View File

@ -68,15 +68,37 @@ extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime,
extern consvar_t cv_crosshair, cv_crosshair2;
extern consvar_t cv_invertmouse, cv_alwaysfreelook, cv_chasefreelook, cv_mousemove;
extern consvar_t cv_invertmouse2, cv_alwaysfreelook2, cv_chasefreelook2, cv_mousemove2;
extern consvar_t cv_useranalog, cv_useranalog2;
extern consvar_t cv_analog, cv_analog2;
extern consvar_t cv_directionchar, cv_directionchar2;
extern consvar_t cv_useranalog[2], cv_analog[2];
extern consvar_t cv_directionchar[2];
typedef enum {
CS_LEGACY,
CS_LMAOGALOG,
CS_STANDARD,
CS_SIMPLE = CS_LMAOGALOG|CS_STANDARD,
} controlstyle_e;
#define G_ControlStyle(ssplayer) (cv_directionchar[(ssplayer)-1].value == 3 ? CS_LMAOGALOG : ((cv_analog[(ssplayer)-1].value ? CS_LMAOGALOG : 0) | (cv_directionchar[(ssplayer)-1].value ? CS_STANDARD : 0)))
#define P_ControlStyle(player) ((((player)->pflags & PF_ANALOGMODE) ? CS_LMAOGALOG : 0) | (((player)->pflags & PF_DIRECTIONCHAR) ? CS_STANDARD : 0))
extern consvar_t cv_autobrake, cv_autobrake2;
extern consvar_t cv_deadzone, cv_deadzone2;
extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_jumpaxis,cv_spinaxis,cv_fireaxis,cv_firenaxis;
extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_jumpaxis2,cv_spinaxis2,cv_fireaxis2,cv_firenaxis2;
extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_jumpaxis,cv_spinaxis,cv_fireaxis,cv_firenaxis,cv_deadzone,cv_digitaldeadzone;
extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_jumpaxis2,cv_spinaxis2,cv_fireaxis2,cv_firenaxis2,cv_deadzone2,cv_digitaldeadzone2;
extern consvar_t cv_ghost_bestscore, cv_ghost_besttime, cv_ghost_bestrings, cv_ghost_last, cv_ghost_guest;
// hi here's some new controls
extern consvar_t cv_cam_shiftfacing[2], cv_cam_turnfacing[2],
cv_cam_turnfacingability[2], cv_cam_turnfacingspindash[2], cv_cam_turnfacinginput[2],
cv_cam_centertoggle[2], cv_cam_lockedinput[2], cv_cam_lockonboss[2];
typedef enum
{
LOCK_BOSS = 1<<0,
LOCK_ENEMY = 1<<1,
LOCK_INTERESTS = 1<<2,
} lockassist_e;
// mouseaiming (looking up/down with the mouse or keyboard)
#define KB_LOOKSPEED (1<<25)
#define MAXPLMOVE (50)
@ -84,8 +106,10 @@ extern consvar_t cv_ghost_bestscore, cv_ghost_besttime, cv_ghost_bestrings, cv_g
// build an internal map name MAPxx from map number
const char *G_BuildMapName(INT32 map);
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics);
void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics);
extern boolean ticcmd_centerviewdown[2]; // For simple controls, lock the camera behind the player
extern mobj_t *ticcmd_ztargetfocus[2]; // Locking onto an object?
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer);
// copy ticcmd_t to and fro the normal way
ticcmd_t *G_CopyTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n);

View File

@ -132,6 +132,7 @@ extern INT32 gamecontroldefault[num_gamecontrolschemes][num_gamecontrols][2]; //
extern INT32 gamecontrolbisdefault[num_gamecontrolschemes][num_gamecontrols][2];
#define PLAYER1INPUTDOWN(gc) (gamekeydown[gamecontrol[gc][0]] || gamekeydown[gamecontrol[gc][1]])
#define PLAYER2INPUTDOWN(gc) (gamekeydown[gamecontrolbis[gc][0]] || gamekeydown[gamecontrolbis[gc][1]])
#define PLAYERINPUTDOWN(p, gc) ((p) == 2 ? PLAYER2INPUTDOWN(gc) : PLAYER1INPUTDOWN(gc))
#define num_gcl_tutorial_check 6
#define num_gcl_tutorial_used 8

View File

@ -122,11 +122,11 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
if (mipmap->colormap)
texel = mipmap->colormap[texel];
// transparent pixel
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX)
// If the mipmap is chromakeyed, check if the texel's color
// is equivalent to the chroma key's color index.
alpha = 0xff;
if ((mipmap->flags & TF_CHROMAKEYED) && (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX))
alpha = 0x00;
else
alpha = 0xff;
// hope compiler will get this switch out of the loops (dreams...)
// gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?)
@ -654,7 +654,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
#ifndef NO_PNG_LUMPS
if (R_IsLumpPNG((UINT8 *)realpatch, lumplength))
realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL, false);
realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL);
else
#endif
#ifdef WALLFLATS
@ -698,7 +698,7 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm
// lump is a png so convert it
size_t len = W_LumpLengthPwad(grPatch->wadnum, grPatch->lumpnum);
if ((patch != NULL) && R_IsLumpPNG((const UINT8 *)patch, len))
patch = R_PNGToPatch((const UINT8 *)patch, len, NULL, true);
patch = R_PNGToPatch((const UINT8 *)patch, len, NULL);
#endif
// don't do it twice (like a cache)
@ -1324,23 +1324,6 @@ GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum)
return HWR_GetCachedGLPatchPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum));
}
#ifdef ROTSPRITE
GLPatch_t *HWR_GetCachedGLRotSprite(aatree_t *hwrcache, UINT16 rollangle, patch_t *rawpatch)
{
GLPatch_t *grpatch;
if (!(grpatch = M_AATreeGet(hwrcache, rollangle)))
{
grpatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
grpatch->rawpatch = rawpatch;
grpatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
M_AATreeSet(hwrcache, rollangle, grpatch);
}
return grpatch;
}
#endif
// Need to do this because they aren't powers of 2
static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32 pblockheight,
lumpnum_t fademasklumpnum, UINT16 fmwidth, UINT16 fmheight)

View File

@ -113,9 +113,6 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum);
void HWR_SetPalette(RGBA_t *palette);
GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wad, UINT16 lump);
GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum);
#ifdef ROTSPRITE
GLPatch_t *HWR_GetCachedGLRotSprite(aatree_t *hwrcache, UINT16 rollangle, patch_t *rawpatch);
#endif
void HWR_GetFadeMask(lumpnum_t fademasklumpnum);
// hardware driver

View File

@ -5127,7 +5127,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
spriteinfo_t *sprinfo;
size_t lumpoff;
unsigned rot;
UINT8 flip;
UINT16 flip;
boolean vflip = (!(thing->eflags & MFE_VERTICALFLIP) != !(thing->frame & FF_VERTICALFLIP));
angle_t ang;
@ -5213,12 +5213,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
flip = sprframe->flip; // Will only be 0x00 or 0xFF
if (papersprite && ang < ANGLE_180)
{
if (flip)
flip = 0;
else
flip = 255;
}
flip ^= 0xFFFF;
}
else
{
@ -5227,6 +5222,11 @@ static void HWR_ProjectSprite(mobj_t *thing)
rot = 6; // F7 slot
else if ((sprframe->rotate & SRF_LEFT) && (ang >= ANGLE_180)) // See from left
rot = 2; // F3 slot
else if (sprframe->rotate & SRF_3DGE) // 16-angle mode
{
rot = (ang+ANGLE_180+ANGLE_11hh)>>28;
rot = ((rot & 1)<<3)|(rot>>1);
}
else // Normal behaviour
rot = (ang+ANGLE_202h)>>29;
@ -5235,12 +5235,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
flip = sprframe->flip & (1<<rot);
if (papersprite && ang < ANGLE_180)
{
if (flip)
flip = 0;
else
flip = 1<<rot;
}
flip ^= (1<<rot);
}
if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES)
@ -5255,7 +5250,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
if (thing->rollangle)
{
rollangle = R_GetRollAngle(thing->rollangle);
if (!sprframe->rotsprite.cached[rot])
if (!(sprframe->rotsprite.cached & (1<<rot)))
R_CacheRotSprite(thing->sprite, (thing->frame & FF_FRAMEMASK), sprinfo, sprframe, rot, flip);
rotsprite = sprframe->rotsprite.patch[rot][rollangle];
if (rotsprite != NULL)

View File

@ -1184,7 +1184,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
{
sector_t *sector = spr->mobj->subsector->sector;
UINT8 lightlevel = 255;
extracolormap_t *colormap = sector->extra_colormap;
extracolormap_t *colormap = NULL;
if (sector->numlights)
{
@ -1218,6 +1218,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
INT32 durs = spr->mobj->state->tics;
INT32 tics = spr->mobj->tics;
//mdlframe_t *next = NULL;
const boolean papersprite = (spr->mobj->frame & FF_PAPERSPRITE);
const UINT8 flip = (UINT8)(!(spr->mobj->eflags & MFE_VERTICALFLIP) != !(spr->mobj->frame & FF_VERTICALFLIP));
spritedef_t *sprdef;
spriteframe_t *sprframe;
@ -1428,14 +1429,12 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
sprframe = &sprdef->spriteframes[spr->mobj->frame & FF_FRAMEMASK];
if (sprframe->rotate)
if (sprframe->rotate || papersprite)
{
fixed_t anglef = AngleFixed(spr->mobj->angle);
if (spr->mobj->player)
anglef = AngleFixed(spr->mobj->player->drawangle);
else
anglef = AngleFixed(spr->mobj->angle);
p.angley = FIXED_TO_FLOAT(anglef);
}

View File

@ -2883,14 +2883,30 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
EXPORT INT32 HWRAPI(GetTextureUsed) (void)
{
FTextureInfo* tmp = gr_cachehead;
INT32 res = 0;
FTextureInfo *tmp = gr_cachehead;
INT32 res = 0;
while (tmp)
{
res += tmp->height*tmp->width*(screen_depth/8);
// Figure out the correct bytes-per-pixel for this texture
// I don't know which one the game actually _uses_ but this
// follows format2bpp in hw_cache.c
int bpp = 1;
int format = tmp->grInfo.format;
if (format == GR_RGBA)
bpp = 4;
else if (format == GR_TEXFMT_RGB_565
|| format == GR_TEXFMT_ARGB_1555
|| format == GR_TEXFMT_ARGB_4444
|| format == GR_TEXFMT_ALPHA_INTENSITY_88
|| format == GR_TEXFMT_AP_88)
bpp = 2;
// Add it up!
res += tmp->height*tmp->width*bpp;
tmp = tmp->nextmipmap;
}
return res;
}

View File

@ -2201,10 +2201,14 @@ void HU_Drawer(void)
return;
// draw the crosshair, not when viewing demos nor with chasecam
if (!automapactive && cv_crosshair.value && !demoplayback && !camera.chase && !players[displayplayer].spectator)
if (!automapactive && cv_crosshair.value && !demoplayback &&
(!camera.chase || ticcmd_ztargetfocus[0])
&& !players[displayplayer].spectator)
HU_DrawCrosshair();
if (!automapactive && cv_crosshair2.value && !demoplayback && !camera2.chase && !players[secondarydisplayplayer].spectator)
if (!automapactive && cv_crosshair2.value && !demoplayback &&
(!camera2.chase || ticcmd_ztargetfocus[1])
&& !players[secondarydisplayplayer].spectator)
HU_DrawCrosshair2();
// draw desynch text

View File

@ -3565,7 +3565,7 @@ state_t states[NUMSTATES] =
{SPR_PUMA, FF_FULLBRIGHT|FF_TRANS60|8, 3, {NULL}, 0, 0, S_NULL}, // S_PUMATRAIL4
// Hammer
{SPR_HAMM, FF_ANIMATE, -1, {NULL}, 4, 3, S_NULL}, // S_HAMMER
{SPR_HAMM, FF_ANIMATE, -1, {NULL}, 3, 3, S_NULL}, // S_HAMMER
// Koopa
{SPR_KOOP, 0, -1, {NULL}, 0, 0, S_NULL}, // S_KOOPA1
@ -19760,14 +19760,14 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
{ // MT_FLINGNIGHTSCHIP
-1, // doomednum
S_NIGHTSCHIP, // spawnstate
S_NIGHTSCHIP, // spawnstate
1000, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
MT_FLINGNIGHTSCHIP, // reactiontime
MT_FLINGNIGHTSCHIP, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
MT_NIGHTSCHIP, // painchance
MT_NIGHTSCHIP, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@ -19791,7 +19791,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
1000, // spawnhealth
S_NIGHTSSTARXMAS, // seestate
sfx_None, // seesound
8, // reactiontime
MT_FLINGNIGHTSSTAR, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
@ -19811,6 +19811,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
MF_SLIDEME|MF_SPECIAL|MF_NOGRAVITY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},
{ // MT_FLINGNIGHTSSTAR
-1, // doomednum
S_NIGHTSSTAR, // spawnstate
1000, // spawnhealth
S_NIGHTSSTARXMAS, // seestate
sfx_None, // seesound
MT_FLINGNIGHTSSTAR, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
MT_NIGHTSSTAR, // painchance
sfx_s3k33, // painsound
S_RING, // meleestate
S_NULL, // missilestate
S_SPRK1, // deathstate
S_NULL, // xdeathstate
sfx_ncitem, // deathsound
38*FRACUNIT, // speed
16*FRACUNIT, // radius
24*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_SLIDEME|MF_SPECIAL, // flags
S_NULL // raisestate
},
{ // MT_NIGHTSSUPERLOOP
1707, // doomednum

View File

@ -4702,6 +4702,7 @@ typedef enum mobj_type
MT_NIGHTSCHIP, // NiGHTS Chip
MT_FLINGNIGHTSCHIP, // Lost NiGHTS Chip
MT_NIGHTSSTAR, // NiGHTS Star
MT_FLINGNIGHTSSTAR, // Lost NiGHTS Star
MT_NIGHTSSUPERLOOP,
MT_NIGHTSDRILLREFILL,
MT_NIGHTSHELPER,

View File

@ -681,6 +681,17 @@ static int lib_pSpawnPlayerMissile(lua_State *L)
return 1;
}
static int lib_pRailThinker(lua_State *L)
{
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
NOHUD
INLEVEL
if (!mobj)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_RailThinker(mobj));
return 1;
}
static int lib_pMobjFlip(lua_State *L)
{
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
@ -1406,6 +1417,19 @@ static int lib_pTeleportMove(lua_State *L)
return 2;
}
static int lib_pCheckMoveBlocked(lua_State *L)
{
line_t *li = luaL_checkudata(L, 1, META_LINE);
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
INLEVEL
if (!li)
return LUA_ErrInvalid(L, "line_t");
if (!mo)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, P_CheckMoveBlocked(li, mo));
return 1;
}
static int lib_pSlideMove(lua_State *L)
{
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
@ -3003,6 +3027,7 @@ static luaL_Reg lib[] = {
{"P_ColorTeamMissile",lib_pColorTeamMissile},
{"P_SPMAngle",lib_pSPMAngle},
{"P_SpawnPlayerMissile",lib_pSpawnPlayerMissile},
{"P_RailThinker",lib_pRailThinker},
{"P_MobjFlip",lib_pMobjFlip},
{"P_GetMobjGravity",lib_pGetMobjGravity},
{"P_WeaponOrPanel",lib_pWeaponOrPanel},
@ -3065,6 +3090,7 @@ static luaL_Reg lib[] = {
{"P_TryMove",lib_pTryMove},
{"P_Move",lib_pMove},
{"P_TeleportMove",lib_pTeleportMove},
{"P_CheckMoveBlocked",lib_pCheckMoveBlocked},
{"P_SlideMove",lib_pSlideMove},
{"P_BounceMove",lib_pBounceMove},
{"P_CheckSight", lib_pCheckSight},

View File

@ -118,12 +118,12 @@ void COM_Lua_f(void)
lua_rawgeti(gL, -1, 2); // push flags from command info table
if (lua_isboolean(gL, -1))
flags = (lua_toboolean(gL, -1) ? 1 : 0);
flags = (lua_toboolean(gL, -1) ? COM_ADMIN : 0);
else
flags = (UINT8)lua_tointeger(gL, -1);
lua_pop(gL, 1); // pop flags
if (flags & 2) // flag 2: splitscreen player command.
if (flags & COM_SPLITSCREEN) // flag 2: splitscreen player command.
{
if (!splitscreen)
{
@ -133,12 +133,12 @@ void COM_Lua_f(void)
playernum = secondarydisplayplayer;
}
if (netgame)
if (netgame && !( flags & COM_LOCAL ))/* don't send local commands */
{ // Send the command through the network
UINT8 argc;
lua_pop(gL, 1); // pop command info table
if (flags & 1 && !server && !IsPlayerAdmin(playernum)) // flag 1: only server/admin can use this command.
if (flags & COM_ADMIN && !server && !IsPlayerAdmin(playernum)) // flag 1: only server/admin can use this command.
{
CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n"));
return;
@ -158,7 +158,7 @@ void COM_Lua_f(void)
WRITEUINT8(p, argc);
for (i = 0; i < argc; i++)
WRITESTRINGN(p, COM_Argv(i), 255);
if (flags & 2)
if (flags & COM_SPLITSCREEN)
SendNetXCmd2(XD_LUACMD, buf, p-buf);
else
SendNetXCmd(XD_LUACMD, buf, p-buf);
@ -192,7 +192,15 @@ static int lib_comAddCommand(lua_State *L)
if (lua_gettop(L) >= 3)
{ // For the third argument, only take a boolean or a number.
lua_settop(L, 3);
if (lua_type(L, 3) != LUA_TBOOLEAN)
if (lua_type(L, 3) == LUA_TBOOLEAN)
{
CONS_Alert(CONS_WARNING,
"Using a boolean for admin commands is "
"deprecated and will be removed.\n"
"Use \"COM_ADMIN\" instead.\n"
);
}
else
luaL_checktype(L, 3, LUA_TNUMBER);
}
else

View File

@ -57,6 +57,7 @@ enum hook {
hook_TeamSwitch,
hook_ViewpointSwitch,
hook_SeenPlayer,
hook_PlayerThink,
hook_MAX // last hook
};
@ -108,5 +109,6 @@ UINT8 LUAh_ViewpointSwitch(player_t *player, player_t *newdisplayplayer, boolean
#ifdef SEENAMES
boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend); // Hook for MT_NAMECHECK
#endif
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
#endif

View File

@ -68,6 +68,7 @@ const char *const hookNames[hook_MAX+1] = {
"TeamSwitch",
"ViewpointSwitch",
"SeenPlayer",
"PlayerThink",
NULL
};
@ -216,6 +217,7 @@ static int lib_addHook(lua_State *L)
case hook_SeenPlayer:
case hook_ShieldSpawn:
case hook_ShieldSpecial:
case hook_PlayerThink:
lastp = &playerhooks;
break;
case hook_LinedefExecute:

View File

@ -468,11 +468,11 @@ static int libd_getSpritePatch(lua_State *L)
// convert WAD editor angle numbers (1-8) to internal angle numbers (0-7)
// keep 0 the same since we'll make it default to angle 1 (which is internally 0)
// in case somebody didn't know that angle 0 really just maps all 8 angles to the same patch
// in case somebody didn't know that angle 0 really just maps all 8/16 angles to the same patch
if (angle != 0)
angle--;
if (angle >= 8) // out of range?
if (angle >= ((sprframe->rotate & SRF_3DGE) ? 16 : 8)) // out of range?
return 0;
// push both the patch and it's "flip" value
@ -563,11 +563,11 @@ static int libd_getSprite2Patch(lua_State *L)
// convert WAD editor angle numbers (1-8) to internal angle numbers (0-7)
// keep 0 the same since we'll make it default to angle 1 (which is internally 0)
// in case somebody didn't know that angle 0 really just maps all 8 angles to the same patch
// in case somebody didn't know that angle 0 really just maps all 8/16 angles to the same patch
if (angle != 0)
angle--;
if (angle >= 8) // out of range?
if (angle >= ((sprframe->rotate & SRF_3DGE) ? 16 : 8)) // out of range?
return 0;
// push both the patch and it's "flip" value

View File

@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2013-2016 by Matthew "Inuyasha" Walsh.
// Copyright (C) 2013-2016 by Matthew "Kaito Sinclaire" Walsh.
// Copyright (C) 2013 by "Ninji".
// Copyright (C) 2013-2019 by Sonic Team Junior.
//

View File

@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2013-2016 by Matthew "Inuyasha" Walsh.
// Copyright (C) 2013-2016 by Matthew "Kaito Sinclaire" Walsh.
// Copyright (C) 2013-2019 by Sonic Team Junior.
//
// This program is free software distributed under the

View File

@ -1304,7 +1304,7 @@ void OP_ObjectplaceMovement(player_t *player)
{
ticcmd_t *cmd = &player->cmd;
if (!player->climbing && (netgame || !cv_analog.value || (player->pflags & PF_SPINNING)))
if (!player->climbing && (netgame || !cv_analog[0].value || (player->pflags & PF_SPINNING)))
player->drawangle = player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
ticruned++;

View File

@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by Matthew "Inuyasha" Walsh.
// Copyright (C) 2012-2016 by Matthew "Kaito Sinclaire" Walsh.
// Copyright (C) 2012-2019 by Sonic Team Junior.
//
// This program is free software distributed under the

View File

@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2012-2016 by Matthew "Inuyasha" Walsh.
// Copyright (C) 2012-2016 by Matthew "Kaito Sinclaire" Walsh.
// Copyright (C) 2012-2019 by Sonic Team Junior.
//
// This program is free software distributed under the
@ -97,12 +97,13 @@ typedef struct
} emblem_t;
typedef struct
{
char name[20]; ///< Name of the goal (used in the "emblem awarded" cecho)
char description[40];///< Description of goal (used in statistics)
UINT8 conditionset; ///< Condition set that awards this emblem.
UINT8 sprite; ///< emblem sprite to use, 0 - 25
UINT8 color; ///< skincolor to use
UINT8 collected; ///< Do you have this emblem?
char name[20]; ///< Name of the goal (used in the "emblem awarded" cecho)
char description[40]; ///< Description of goal (used in statistics)
UINT8 conditionset; ///< Condition set that awards this emblem.
UINT8 showconditionset; ///< Condition set that shows this emblem.
UINT8 sprite; ///< emblem sprite to use, 0 - 25
UINT8 color; ///< skincolor to use
UINT8 collected; ///< Do you have this emblem?
} extraemblem_t;
// Unlockable information
@ -112,6 +113,7 @@ typedef struct
char objective[64];
UINT16 height; // menu height
UINT8 conditionset;
UINT8 showconditionset;
INT16 type;
INT16 variable;
UINT8 nocecho;

View File

@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2011-2016 by Matthew "Inuyasha" Walsh.
// Copyright (C) 2011-2016 by Matthew "Kaito Sinclaire" Walsh.
// Copyright (C) 1999-2019 by Sonic Team Junior.
//
// This program is free software distributed under the
@ -298,11 +298,14 @@ menu_t OP_MPControlsDef, OP_MiscControlsDef;
menu_t OP_P1ControlsDef, OP_P2ControlsDef, OP_MouseOptionsDef;
menu_t OP_Mouse2OptionsDef, OP_Joystick1Def, OP_Joystick2Def;
menu_t OP_CameraOptionsDef, OP_Camera2OptionsDef;
menu_t OP_PlaystyleDef;
static void M_VideoModeMenu(INT32 choice);
static void M_Setup1PControlsMenu(INT32 choice);
static void M_Setup2PControlsMenu(INT32 choice);
static void M_Setup1PJoystickMenu(INT32 choice);
static void M_Setup2PJoystickMenu(INT32 choice);
static void M_Setup1PPlaystyleMenu(INT32 choice);
static void M_Setup2PPlaystyleMenu(INT32 choice);
static void M_AssignJoystick(INT32 choice);
static void M_ChangeControl(INT32 choice);
@ -348,6 +351,9 @@ static void M_DrawLevelStats(void);
static void M_DrawTimeAttackMenu(void);
static void M_DrawNightsAttackMenu(void);
static void M_DrawSetupChoosePlayerMenu(void);
static void M_DrawControlsDefMenu(void);
static void M_DrawCameraOptionsMenu(void);
static void M_DrawPlaystyleMenu(void);
static void M_DrawControl(void);
static void M_DrawMainVideoMenu(void);
static void M_DrawVideoMode(void);
@ -375,6 +381,7 @@ static void M_HandleSoundTest(INT32 choice);
static void M_HandleImageDef(INT32 choice);
static void M_HandleLoadSave(INT32 choice);
static void M_HandleLevelStats(INT32 choice);
static void M_HandlePlaystyleMenu(INT32 choice);
#ifndef NONET
static boolean M_CancelConnect(void);
static void M_HandleConnectIP(INT32 choice);
@ -1040,9 +1047,8 @@ static menuitem_t OP_P1ControlsMenu[] =
{IT_SUBMENU | IT_STRING, NULL, "Camera Options...", &OP_CameraOptionsDef, 50},
//{IT_STRING | IT_CVAR, NULL, "Analog Control", &cv_useranalog, 100},
{IT_STRING | IT_CVAR, NULL, "Character angle", &cv_directionchar, 70},
{IT_STRING | IT_CVAR, NULL, "Automatic braking", &cv_autobrake, 80},
{IT_STRING | IT_CVAR, NULL, "Automatic braking", &cv_autobrake, 70},
{IT_CALL | IT_STRING, NULL, "Play Style...", M_Setup1PPlaystyleMenu, 80},
};
static menuitem_t OP_P2ControlsMenu[] =
@ -1053,9 +1059,8 @@ static menuitem_t OP_P2ControlsMenu[] =
{IT_SUBMENU | IT_STRING, NULL, "Camera Options...", &OP_Camera2OptionsDef, 50},
//{IT_STRING | IT_CVAR, NULL, "Analog Control", &cv_useranalog2, 100},
{IT_STRING | IT_CVAR, NULL, "Character angle", &cv_directionchar2, 70},
{IT_STRING | IT_CVAR, NULL, "Automatic braking", &cv_autobrake2, 80},
{IT_STRING | IT_CVAR, NULL, "Automatic braking", &cv_autobrake2, 70},
{IT_CALL | IT_STRING, NULL, "Play Style...", M_Setup2PPlaystyleMenu, 80},
};
static menuitem_t OP_ChangeControlsMenu[] =
@ -1127,8 +1132,8 @@ static menuitem_t OP_Joystick1Menu[] =
{IT_STRING | IT_CVAR, NULL, "First-Person Vert-Look", &cv_alwaysfreelook, 120},
{IT_STRING | IT_CVAR, NULL, "Third-Person Vert-Look", &cv_chasefreelook, 130},
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER,
NULL, "Deadzone", &cv_deadzone, 140 },
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Analog Deadzone", &cv_deadzone, 140},
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Digital Deadzone", &cv_digitaldeadzone, 150},
};
static menuitem_t OP_Joystick2Menu[] =
@ -1145,8 +1150,8 @@ static menuitem_t OP_Joystick2Menu[] =
{IT_STRING | IT_CVAR, NULL, "First-Person Vert-Look", &cv_alwaysfreelook2,120},
{IT_STRING | IT_CVAR, NULL, "Third-Person Vert-Look", &cv_chasefreelook2, 130},
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER,
NULL, "Deadzone", &cv_deadzone2, 140 },
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Analog Deadzone", &cv_deadzone2,140},
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Digital Deadzone", &cv_digitaldeadzone2,150},
};
static menuitem_t OP_JoystickSetMenu[1+MAX_JOYSTICKS];
@ -1183,32 +1188,98 @@ static menuitem_t OP_Mouse2OptionsMenu[] =
static menuitem_t OP_CameraOptionsMenu[] =
{
{IT_STRING | IT_CVAR, NULL, "Third-person Camera" , &cv_chasecam , 10},
{IT_STRING | IT_CVAR, NULL, "Flip Camera with Gravity" , &cv_flipcam , 20},
{IT_STRING | IT_CVAR, NULL, "Orbital Looking" , &cv_cam_orbit , 30},
{IT_STRING | IT_CVAR, NULL, "Downhill Slope Adjustment", &cv_cam_adjust, 40},
{IT_HEADER, NULL, "General Toggles", NULL, 0},
{IT_STRING | IT_CVAR, NULL, "Third-person Camera" , &cv_chasecam , 6},
{IT_STRING | IT_CVAR, NULL, "Flip Camera with Gravity" , &cv_flipcam , 11},
{IT_STRING | IT_CVAR, NULL, "Orbital Looking" , &cv_cam_orbit , 16},
{IT_STRING | IT_CVAR, NULL, "Downhill Slope Adjustment", &cv_cam_adjust, 21},
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Distance", &cv_cam_dist, 60},
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Height", &cv_cam_height, 70},
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Camera Spacial Speed", &cv_cam_speed, 80},
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Camera Turning Speed", &cv_cam_turnmultiplier, 90},
{IT_HEADER, NULL, "Camera Positioning", NULL, 30},
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Distance", &cv_cam_savedist[0][0], 36},
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Height", &cv_cam_saveheight[0][0], 41},
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Camera Spacial Speed", &cv_cam_speed, 46},
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Rotation Speed", &cv_cam_turnmultiplier, 51},
{IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair, 100},
{IT_HEADER, NULL, "Display Options", NULL, 60},
{IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair, 66},
};
static menuitem_t OP_Camera2OptionsMenu[] =
{
{IT_STRING | IT_CVAR, NULL, "Third-person Camera" , &cv_chasecam2 , 10},
{IT_STRING | IT_CVAR, NULL, "Flip Camera with Gravity" , &cv_flipcam2 , 20},
{IT_STRING | IT_CVAR, NULL, "Orbital Looking" , &cv_cam2_orbit , 30},
{IT_STRING | IT_CVAR, NULL, "Downhill Slope Adjustment", &cv_cam2_adjust, 40},
{IT_HEADER, NULL, "General Toggles", NULL, 0},
{IT_STRING | IT_CVAR, NULL, "Third-person Camera" , &cv_chasecam2 , 6},
{IT_STRING | IT_CVAR, NULL, "Flip Camera with Gravity" , &cv_flipcam2 , 11},
{IT_STRING | IT_CVAR, NULL, "Orbital Looking" , &cv_cam2_orbit , 16},
{IT_STRING | IT_CVAR, NULL, "Downhill Slope Adjustment", &cv_cam2_adjust, 21},
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Distance", &cv_cam2_dist, 60},
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Height", &cv_cam2_height, 70},
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Camera Spacial Speed", &cv_cam2_speed, 80},
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Camera Turning Speed", &cv_cam2_turnmultiplier, 90},
{IT_HEADER, NULL, "Camera Positioning", NULL, 30},
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Distance", &cv_cam_savedist[0][1], 36},
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Height", &cv_cam_saveheight[0][1], 41},
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Camera Spacial Speed", &cv_cam2_speed, 46},
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Rotation Speed", &cv_cam2_turnmultiplier, 51},
{IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair2, 100},
{IT_HEADER, NULL, "Display Options", NULL, 60},
{IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair2, 66},
};
static menuitem_t OP_CameraExtendedOptionsMenu[] =
{
{IT_HEADER, NULL, "General Toggles", NULL, 0},
{IT_STRING | IT_CVAR, NULL, "Third-person Camera" , &cv_chasecam , 6},
{IT_STRING | IT_CVAR, NULL, "Flip Camera with Gravity" , &cv_flipcam , 11},
{IT_STRING | IT_CVAR, NULL, "Orbital Looking" , &cv_cam_orbit , 16},
{IT_STRING | IT_CVAR, NULL, "Downhill Slope Adjustment", &cv_cam_adjust, 21},
{IT_HEADER, NULL, "Camera Positioning", NULL, 30},
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Distance", &cv_cam_savedist[1][0], 36},
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Height", &cv_cam_saveheight[1][0], 41},
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Camera Spacial Speed", &cv_cam_speed, 46},
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Rotation Speed", &cv_cam_turnmultiplier, 51},
{IT_HEADER, NULL, "Automatic Camera Options", NULL, 60},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Shift to player angle", &cv_cam_shiftfacing[0], 66},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to player angle", &cv_cam_turnfacing[0], 71},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to ability", &cv_cam_turnfacingability[0], 76},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to spindash", &cv_cam_turnfacingspindash[0], 81},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to input", &cv_cam_turnfacinginput[0], 86},
{IT_HEADER, NULL, "Locked Camera Options", NULL, 95},
{IT_STRING | IT_CVAR, NULL, "Lock button behavior", &cv_cam_centertoggle[0], 101},
{IT_STRING | IT_CVAR, NULL, "Sideways movement", &cv_cam_lockedinput[0], 106},
{IT_STRING | IT_CVAR, NULL, "Targeting assist", &cv_cam_lockonboss[0], 111},
{IT_HEADER, NULL, "Display Options", NULL, 120},
{IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair, 126},
};
static menuitem_t OP_Camera2ExtendedOptionsMenu[] =
{
{IT_HEADER, NULL, "General Toggles", NULL, 0},
{IT_STRING | IT_CVAR, NULL, "Third-person Camera" , &cv_chasecam2 , 6},
{IT_STRING | IT_CVAR, NULL, "Flip Camera with Gravity" , &cv_flipcam2 , 11},
{IT_STRING | IT_CVAR, NULL, "Orbital Looking" , &cv_cam2_orbit , 16},
{IT_STRING | IT_CVAR, NULL, "Downhill Slope Adjustment", &cv_cam2_adjust, 21},
{IT_HEADER, NULL, "Camera Positioning", NULL, 30},
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Distance", &cv_cam_savedist[1][1], 36},
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Height", &cv_cam_saveheight[1][1], 41},
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Camera Spacial Speed", &cv_cam2_speed, 46},
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Rotation Speed", &cv_cam2_turnmultiplier, 51},
{IT_HEADER, NULL, "Automatic Camera Options", NULL, 60},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Shift to player angle", &cv_cam_shiftfacing[1], 66},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to player angle", &cv_cam_turnfacing[1], 71},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to ability", &cv_cam_turnfacingability[1], 76},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to spindash", &cv_cam_turnfacingspindash[1], 81},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to input", &cv_cam_turnfacinginput[1], 86},
{IT_HEADER, NULL, "Locked Camera Options", NULL, 95},
{IT_STRING | IT_CVAR, NULL, "Lock button behavior", &cv_cam_centertoggle[1], 101},
{IT_STRING | IT_CVAR, NULL, "Sideways movement", &cv_cam_lockedinput[1], 106},
{IT_STRING | IT_CVAR, NULL, "Targeting assist", &cv_cam_lockonboss[1], 111},
{IT_HEADER, NULL, "Display Options", NULL, 120},
{IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair2, 126},
};
static menuitem_t OP_VideoOptionsMenu[] =
@ -1927,12 +1998,24 @@ menu_t OP_MainDef = DEFAULTMENUSTYLE(
menu_t OP_ChangeControlsDef = CONTROLMENUSTYLE(
MN_OP_MAIN + (MN_OP_CHANGECONTROLS << 12), // second level (<<6) set on runtime
OP_ChangeControlsMenu, &OP_MainDef);
menu_t OP_P1ControlsDef = DEFAULTMENUSTYLE(
menu_t OP_P1ControlsDef = {
MN_OP_MAIN + (MN_OP_P1CONTROLS << 6),
"M_CONTRO", OP_P1ControlsMenu, &OP_MainDef, 50, 30);
menu_t OP_P2ControlsDef = DEFAULTMENUSTYLE(
"M_CONTRO",
sizeof(OP_P1ControlsMenu)/sizeof(menuitem_t),
&OP_MainDef,
OP_P1ControlsMenu,
M_DrawControlsDefMenu,
50, 30, 0, NULL};
menu_t OP_P2ControlsDef = {
MN_OP_MAIN + (MN_OP_P2CONTROLS << 6),
"M_CONTRO", OP_P2ControlsMenu, &OP_MainDef, 50, 30);
"M_CONTRO",
sizeof(OP_P2ControlsMenu)/sizeof(menuitem_t),
&OP_MainDef,
OP_P2ControlsMenu,
M_DrawControlsDefMenu,
50, 30, 0, NULL};
menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE(
MN_OP_MAIN + (MN_OP_P1CONTROLS << 6) + (MN_OP_P1MOUSE << 12),
"M_CONTRO", OP_MouseOptionsMenu, &OP_P1ControlsDef, 35, 30);
@ -1957,12 +2040,41 @@ menu_t OP_JoystickSetDef =
0,
NULL
};
menu_t OP_CameraOptionsDef = DEFAULTMENUSTYLE(
menu_t OP_CameraOptionsDef = {
MN_OP_MAIN + (MN_OP_P1CONTROLS << 6) + (MN_OP_P1CAMERA << 12),
"M_CONTRO", OP_CameraOptionsMenu, &OP_P1ControlsDef, 35, 30);
menu_t OP_Camera2OptionsDef = DEFAULTMENUSTYLE(
"M_CONTRO",
sizeof (OP_CameraOptionsMenu)/sizeof (menuitem_t),
&OP_P1ControlsDef,
OP_CameraOptionsMenu,
M_DrawCameraOptionsMenu,
35, 30,
0,
NULL
};
menu_t OP_Camera2OptionsDef = {
MN_OP_MAIN + (MN_OP_P2CONTROLS << 6) + (MN_OP_P2CAMERA << 12),
"M_CONTRO", OP_Camera2OptionsMenu, &OP_P2ControlsDef, 35, 30);
"M_CONTRO",
sizeof (OP_Camera2OptionsMenu)/sizeof (menuitem_t),
&OP_P2ControlsDef,
OP_Camera2OptionsMenu,
M_DrawCameraOptionsMenu,
35, 30,
0,
NULL
};
static menuitem_t OP_PlaystyleMenu[] = {{IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandlePlaystyleMenu, 0}};
menu_t OP_PlaystyleDef = {
MN_OP_MAIN + (MN_OP_P1CONTROLS << 6) + (MN_OP_PLAYSTYLE << 12),
NULL,
1,
&OP_P1ControlsDef,
OP_PlaystyleMenu,
M_DrawPlaystyleMenu,
0, 0, 0, NULL
};
menu_t OP_VideoOptionsDef =
@ -3079,7 +3191,7 @@ boolean M_Responder(event_t *ev)
}
else if (ev->type == ev_joystick && ev->data1 == 0 && joywait < I_GetTime())
{
const INT32 jdeadzone = (JOYAXISRANGE * cv_deadzone.value) / FRACUNIT;
const INT32 jdeadzone = (JOYAXISRANGE * cv_digitaldeadzone.value) / FRACUNIT;
if (ev->data3 != INT32_MAX)
{
if (Joystick.bGamepadStyle || abs(ev->data3) > jdeadzone)
@ -4197,6 +4309,102 @@ static void M_DrawGenericMenu(void)
}
}
const char *PlaystyleNames[4] = {"Legacy", "Standard", "Simple", "Old Analog??"};
const char *PlaystyleDesc[4] = {
// Legacy
"The play style used for\n"
"old-school SRB2.\n"
"\n"
"This play style is identical\n"
"to Standard, except that the\n"
"player always looks in the\n"
"direction of the camera."
,
// Standard
"The default play style,\n"
"designed for full control\n"
"with a keyboard and mouse.\n"
"\n"
"The camera rotates only when\n"
"you tell it to. The player\n"
"looks in the direction they're\n"
"moving, but acts in the direction\n"
"the camera is facing.\n"
"\n"
"Mastery of this play style will\n"
"open up the highest level of play!"
,
// Simple
"A play style designed for\n"
"gamepads and hassle-free play.\n"
"\n"
"The camera rotates automatically\n"
"as you move, and the player faces\n"
"and acts in the direction\n"
"they're moving.\n"
"\n"
"Hold \x82" "Center View\x80 to lock the\n"
"camera behind the player!\n"
,
// Old Analog
"I see.\n"
"\n"
"You really liked the old analog mode,\n"
"so when 2.2 came out, you opened up\n"
"your config file and brought it back.\n"
"\n"
"That's absolutely valid, but I implore\n"
"you to try the new Simple play style\n"
"instead!"
};
static UINT8 playstyle_activeplayer = 0, playstyle_currentchoice = 0;
static void M_DrawControlsDefMenu(void)
{
UINT8 opt = 0;
M_DrawGenericMenu();
if (currentMenu == &OP_P1ControlsDef)
{
opt = cv_directionchar[0].value ? 1 : 0;
opt = playstyle_currentchoice = cv_useranalog[0].value ? 3 - opt : opt;
if (opt == 2)
{
OP_CameraOptionsDef.menuitems = OP_CameraExtendedOptionsMenu;
OP_CameraOptionsDef.numitems = sizeof (OP_CameraExtendedOptionsMenu) / sizeof (menuitem_t);
}
else
{
OP_CameraOptionsDef.menuitems = OP_CameraOptionsMenu;
OP_CameraOptionsDef.numitems = sizeof (OP_CameraOptionsMenu) / sizeof (menuitem_t);
}
}
else
{
opt = cv_directionchar[1].value ? 1 : 0;
opt = playstyle_currentchoice = cv_useranalog[1].value ? 3 - opt : opt;
if (opt == 2)
{
OP_Camera2OptionsDef.menuitems = OP_Camera2ExtendedOptionsMenu;
OP_Camera2OptionsDef.numitems = sizeof (OP_Camera2ExtendedOptionsMenu) / sizeof (menuitem_t);
}
else
{
OP_Camera2OptionsDef.menuitems = OP_Camera2OptionsMenu;
OP_Camera2OptionsDef.numitems = sizeof (OP_Camera2OptionsMenu) / sizeof (menuitem_t);
}
}
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + 80, V_YELLOWMAP, PlaystyleNames[opt]);
}
#define scrollareaheight 72
// note that alphakey is multiplied by 2 for scrolling menus to allow greater usage in UINT8 range.
@ -4208,7 +4416,9 @@ static void M_DrawGenericScrollMenu(void)
x = currentMenu->x;
y = currentMenu->y;
if ((currentMenu->menuitems[itemOn].alphaKey*2 - currentMenu->menuitems[0].alphaKey*2) <= scrollareaheight)
if (currentMenu->menuitems[currentMenu->numitems-1].alphaKey < scrollareaheight)
tempcentery = currentMenu->y; // Not tall enough to scroll, but this thinker is used in case it becomes so
else if ((currentMenu->menuitems[itemOn].alphaKey*2 - currentMenu->menuitems[0].alphaKey*2) <= scrollareaheight)
tempcentery = currentMenu->y - currentMenu->menuitems[0].alphaKey*2;
else if ((currentMenu->menuitems[currentMenu->numitems-1].alphaKey*2 - currentMenu->menuitems[itemOn].alphaKey*2) <= scrollareaheight)
tempcentery = currentMenu->y - currentMenu->menuitems[currentMenu->numitems-1].alphaKey*2 + 2*scrollareaheight;
@ -6687,6 +6897,8 @@ static void M_HandleChecklist(INT32 choice)
continue;
if (unlockables[j].conditionset > MAXCONDITIONSETS)
continue;
if (!unlockables[j].unlocked && unlockables[j].showconditionset && !M_Achieved(unlockables[j].showconditionset))
continue;
if (unlockables[j].conditionset == unlockables[check_on].conditionset)
continue;
break;
@ -6710,6 +6922,8 @@ static void M_HandleChecklist(INT32 choice)
continue;
if (unlockables[j].conditionset > MAXCONDITIONSETS)
continue;
if (!unlockables[j].unlocked && unlockables[j].showconditionset && !M_Achieved(unlockables[j].showconditionset))
continue;
if (j && unlockables[j].conditionset == unlockables[j-1].conditionset)
continue;
break;
@ -6747,7 +6961,8 @@ static void M_DrawChecklist(void)
while (i < MAXUNLOCKABLES)
{
if (unlockables[i].name[0] == 0 //|| unlockables[i].nochecklist
|| !unlockables[i].conditionset || unlockables[i].conditionset > MAXCONDITIONSETS)
|| !unlockables[i].conditionset || unlockables[i].conditionset > MAXCONDITIONSETS
|| (!unlockables[i].unlocked && unlockables[i].showconditionset && !M_Achieved(unlockables[i].showconditionset)))
{
i += 1;
continue;
@ -6773,10 +6988,11 @@ static void M_DrawChecklist(void)
if (unlockables[i].objective[0] != '/')
{
addy(8);
V_DrawString(currentMenu->x, y,
addy(16);
V_DrawString(currentMenu->x, y-8,
V_ALLOWLOWERCASE,
va("\x1E %s", unlockables[i].objective));
y -= 8;
}
else
{
@ -7017,12 +7233,26 @@ static void M_EmblemHints(INT32 choice)
static void M_DrawEmblemHints(void)
{
INT32 i, j = 0;
UINT32 collected = 0;
INT32 i, j = 0, x, y;
UINT32 collected = 0, local = 0;
emblem_t *emblem;
const char *hint;
for (i = 0; i < numemblems; i++)
{
emblem = &emblemlocations[i];
if (emblem->level != gamemap || emblem->type > ET_SKIN)
continue;
if (++local >= NUMHINTS*2)
break;
}
x = (local > NUMHINTS ? 4 : 12);
y = 8;
if (!local)
V_DrawCenteredString(160, 48, V_YELLOWMAP, "No hidden emblems on this map.");
else for (i = 0; i < numemblems; i++)
{
emblem = &emblemlocations[i];
if (emblem->level != gamemap || emblem->type > ET_SKIN)
@ -7031,27 +7261,35 @@ static void M_DrawEmblemHints(void)
if (emblem->collected)
{
collected = V_GREENMAP;
V_DrawMappedPatch(12, 12+(28*j), 0, W_CachePatchName(M_GetEmblemPatch(emblem, false), PU_PATCH),
V_DrawMappedPatch(x, y+4, 0, W_CachePatchName(M_GetEmblemPatch(emblem, false), PU_PATCH),
R_GetTranslationColormap(TC_DEFAULT, M_GetEmblemColor(emblem), GTC_CACHE));
}
else
{
collected = 0;
V_DrawScaledPatch(12, 12+(28*j), 0, W_CachePatchName("NEEDIT", PU_PATCH));
V_DrawScaledPatch(x, y+4, 0, W_CachePatchName("NEEDIT", PU_PATCH));
}
if (emblem->hint[0])
hint = emblem->hint;
else
hint = M_GetText("No hints available.");
hint = M_GetText("No hint available for this emblem.");
hint = V_WordWrap(40, BASEVIDWIDTH-12, 0, hint);
V_DrawString(40, 8+(28*j), V_RETURN8|V_ALLOWLOWERCASE|collected, hint);
if (local > NUMHINTS)
V_DrawThinString(x+28, y, V_RETURN8|V_ALLOWLOWERCASE|collected, hint);
else
V_DrawString(x+28, y, V_RETURN8|V_ALLOWLOWERCASE|collected, hint);
if (++j >= NUMHINTS)
y += 28;
if (++j == NUMHINTS)
{
x = 4+(BASEVIDWIDTH/2);
y = 8;
}
else if (j >= NUMHINTS*2)
break;
}
if (!j)
V_DrawCenteredString(160, 48, V_YELLOWMAP, "No hidden emblems on this map.");
M_DrawGenericMenu();
}
@ -7644,7 +7882,7 @@ void M_TutorialSaveControlResponse(INT32 ch)
CV_Set(&cv_usemouse, cv_usemouse.defaultvalue);
CV_Set(&cv_alwaysfreelook, cv_alwaysfreelook.defaultvalue);
CV_Set(&cv_mousemove, cv_mousemove.defaultvalue);
CV_Set(&cv_analog, cv_analog.defaultvalue);
CV_Set(&cv_analog[0], cv_analog[0].defaultvalue);
S_StartSound(NULL, sfx_itemup);
}
else
@ -7662,13 +7900,13 @@ static void M_TutorialControlResponse(INT32 ch)
tutorialusemouse = cv_usemouse.value;
tutorialfreelook = cv_alwaysfreelook.value;
tutorialmousemove = cv_mousemove.value;
tutorialanalog = cv_analog.value;
tutorialanalog = cv_analog[0].value;
G_CopyControls(gamecontrol, gamecontroldefault[tutorialgcs], gcl_tutorial_full, num_gcl_tutorial_full);
CV_Set(&cv_usemouse, cv_usemouse.defaultvalue);
CV_Set(&cv_alwaysfreelook, cv_alwaysfreelook.defaultvalue);
CV_Set(&cv_mousemove, cv_mousemove.defaultvalue);
CV_Set(&cv_analog, cv_analog.defaultvalue);
CV_Set(&cv_analog[0], cv_analog[0].defaultvalue);
//S_StartSound(NULL, sfx_itemup);
}
@ -8986,7 +9224,10 @@ static void M_DrawStatsMaps(int location)
else
V_DrawSmallScaledPatch(292, y, 0, W_CachePatchName("NEEDIT", PU_PATCH));
V_DrawString(20, y, V_YELLOWMAP|V_ALLOWLOWERCASE, va("%s", exemblem->description));
V_DrawString(20, y, V_YELLOWMAP|V_ALLOWLOWERCASE,
(!exemblem->collected && exemblem->showconditionset && !M_Achieved(exemblem->showconditionset))
? M_CreateSecretMenuOption(exemblem->description)
: exemblem->description);
}
y += 8;
@ -11575,6 +11816,88 @@ static void M_ChangeControl(INT32 choice)
M_StartMessage(tmp, M_ChangecontrolResponse, MM_EVENTHANDLER);
}
static void M_Setup1PPlaystyleMenu(INT32 choice)
{
(void)choice;
playstyle_activeplayer = 0;
OP_PlaystyleDef.prevMenu = &OP_P1ControlsDef;
M_SetupNextMenu(&OP_PlaystyleDef);
}
static void M_Setup2PPlaystyleMenu(INT32 choice)
{
(void)choice;
playstyle_activeplayer = 1;
OP_PlaystyleDef.prevMenu = &OP_P2ControlsDef;
M_SetupNextMenu(&OP_PlaystyleDef);
}
static void M_DrawPlaystyleMenu(void)
{
size_t i;
for (i = 0; i < 4; i++)
{
if (i != 3)
V_DrawCenteredString((i+1)*BASEVIDWIDTH/4, 20, (i == playstyle_currentchoice) ? V_YELLOWMAP : 0, PlaystyleNames[i]);
if (i == playstyle_currentchoice)
{
V_DrawScaledPatch((i+1)*BASEVIDWIDTH/4 - 8, 10, 0, W_CachePatchName("M_CURSOR", PU_CACHE));
V_DrawString(30, 50, V_ALLOWLOWERCASE, PlaystyleDesc[i]);
}
}
}
static void M_HandlePlaystyleMenu(INT32 choice)
{
switch (choice)
{
case KEY_ESCAPE:
case KEY_BACKSPACE:
M_SetupNextMenu(currentMenu->prevMenu);
break;
case KEY_ENTER:
S_StartSound(NULL, sfx_menu1);
CV_SetValue((playstyle_activeplayer ? &cv_directionchar[1] : &cv_directionchar[0]), playstyle_currentchoice ? 1 : 0);
CV_SetValue((playstyle_activeplayer ? &cv_useranalog[1] : &cv_useranalog[0]), playstyle_currentchoice/2);
if (playstyle_activeplayer)
CV_UpdateCam2Dist();
else
CV_UpdateCamDist();
M_SetupNextMenu(currentMenu->prevMenu);
break;
case KEY_LEFTARROW:
S_StartSound(NULL, sfx_menu1);
playstyle_currentchoice = (playstyle_currentchoice+2)%3;
break;
case KEY_RIGHTARROW:
S_StartSound(NULL, sfx_menu1);
playstyle_currentchoice = (playstyle_currentchoice+1)%3;
break;
}
}
static void M_DrawCameraOptionsMenu(void)
{
M_DrawGenericScrollMenu();
if (gamestate == GS_LEVEL && (paused || P_AutoPause()))
{
if (currentMenu == &OP_Camera2OptionsDef && splitscreen && camera2.chase)
P_MoveChaseCamera(&players[secondarydisplayplayer], &camera2, false);
if (currentMenu == &OP_CameraOptionsDef && camera.chase)
P_MoveChaseCamera(&players[displayplayer], &camera, false);
}
}
// ===============
// VIDEO MODE MENU
// ===============

View File

@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2011-2016 by Matthew "Inuyasha" Walsh.
// Copyright (C) 2011-2016 by Matthew "Kaito Sinclaire" Walsh.
// Copyright (C) 1999-2019 by Sonic Team Junior.
//
// This program is free software distributed under the
@ -81,6 +81,8 @@ typedef enum
MN_OP_P2JOYSTICK,
MN_OP_P2CAMERA,
MN_OP_PLAYSTYLE,
MN_OP_VIDEO,
MN_OP_VIDEOMODE,
MN_OP_COLOR,

View File

@ -600,12 +600,12 @@ void M_SaveConfig(const char *filename)
CV_SetValue(&cv_usemouse, tutorialusemouse);
CV_SetValue(&cv_alwaysfreelook, tutorialfreelook);
CV_SetValue(&cv_mousemove, tutorialmousemove);
CV_SetValue(&cv_analog, tutorialanalog);
CV_SetValue(&cv_analog[0], tutorialanalog);
CV_SaveVariables(f);
CV_Set(&cv_usemouse, cv_usemouse.defaultvalue);
CV_Set(&cv_alwaysfreelook, cv_alwaysfreelook.defaultvalue);
CV_Set(&cv_mousemove, cv_mousemove.defaultvalue);
CV_Set(&cv_analog, cv_analog.defaultvalue);
CV_Set(&cv_analog[0], cv_analog[0].defaultvalue);
}
else
CV_SaveVariables(f);

View File

@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2012-2016 by Matthew "Inuyasha" Walsh.
// Copyright (C) 2012-2016 by Matthew "Kaito Sinclaire" Walsh.
// Copyright (C) 1999-2019 by Sonic Team Junior.
//
// This program is free software distributed under the

View File

@ -2,7 +2,7 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 2012-2016 by Matthew "Inuyasha" Walsh.
// Copyright (C) 2012-2016 by Matthew "Kaito Sinclaire" Walsh.
// Copyright (C) 1999-2019 by Sonic Team Junior.
//
// This program is free software distributed under the

View File

@ -14603,12 +14603,9 @@ void A_RolloutRock(mobj_t *actor)
if (!actor->tracer || P_MobjWasRemoved(actor->tracer) || !actor->tracer->health)
actor->flags |= MF_PUSHABLE;
if (!(actor->flags & MF_PUSHABLE)) // if being ridden, don't disappear
actor->fuse = 0;
else if (!actor->fuse && actor->movecount == 1) // otherwise if rock has moved, set its fuse
if (!(actor->flags & MF_PUSHABLE) || (actor->movecount != 1)) // if being ridden or haven't moved, don't disappear
actor->fuse = actor->info->painchance;
if (actor->fuse && actor->fuse < 2*TICRATE)
else if (actor->fuse < 2*TICRATE)
actor->flags2 ^= MF2_DONTDRAW;
}

View File

@ -120,6 +120,10 @@ extern consvar_t cv_cam_speed, cv_cam_rotate, cv_cam_rotspeed, cv_cam_turnmultip
extern consvar_t cv_cam2_dist, cv_cam2_still, cv_cam2_height;
extern consvar_t cv_cam2_speed, cv_cam2_rotate, cv_cam2_rotspeed, cv_cam2_turnmultiplier, cv_cam2_orbit, cv_cam2_adjust;
extern consvar_t cv_cam_savedist[2][2], cv_cam_saveheight[2][2];
void CV_UpdateCamDist(void);
void CV_UpdateCam2Dist(void);
extern fixed_t t_cam_dist, t_cam_height, t_cam_rotate;
extern fixed_t t_cam2_dist, t_cam2_height, t_cam2_rotate;
@ -181,16 +185,14 @@ fixed_t P_ReturnThrustX(mobj_t *mo, angle_t angle, fixed_t move);
fixed_t P_ReturnThrustY(mobj_t *mo, angle_t angle, fixed_t move);
void P_InstaThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move);
mobj_t *P_LookForFocusTarget(player_t *player, mobj_t *exclude, SINT8 direction, UINT8 lockonflags);
mobj_t *P_LookForEnemies(player_t *player, boolean nonenemies, boolean bullet);
void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius);
boolean P_HomingAttack(mobj_t *source, mobj_t *enemy); /// \todo doesn't belong in p_user
boolean P_SuperReady(player_t *player);
void P_DoJump(player_t *player, boolean soundandstate);
#if 0
boolean P_AnalogMove(player_t *player);
#else
#define P_AnalogMove(player) (player->pflags & PF_ANALOGMODE)
#endif
#define P_AnalogMove(player) (P_ControlStyle(player) == CS_LMAOGALOG)
boolean P_TransferToNextMare(player_t *player);
UINT8 P_FindLowestMare(void);
void P_FindEmerald(void);
@ -403,6 +405,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam);
boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff);
boolean P_Move(mobj_t *actor, fixed_t speed);
boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z);
boolean P_CheckMoveBlocked(line_t *li, mobj_t *mo);
void P_SlideMove(mobj_t *mo);
void P_BounceMove(mobj_t *mo);
boolean P_CheckSight(mobj_t *t1, mobj_t *t2);

View File

@ -377,7 +377,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
{
object->angle = object->player->drawangle = spring->angle;
if (!demoplayback || P_AnalogMove(object->player))
if (!demoplayback || P_ControlStyle(object->player) == CS_LMAOGALOG)
{
if (object->player == &players[consoleplayer])
localangle = spring->angle;
@ -426,7 +426,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
object->player->pflags |= pflags;
object->player->secondjump = secondjump;
}
else if (object->player->dashmode >= 3*TICRATE)
else if (object->player->dashmode >= DASHMODE_THRESHOLD)
P_SetPlayerMobjState(object, S_PLAY_DASH);
else if (P_IsObjectOnGround(object) && horizspeed >= FixedMul(object->player->runspeed, object->scale))
P_SetPlayerMobjState(object, S_PLAY_RUN);
@ -632,7 +632,7 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails)
&& P_MobjFlip(tails->mo)*sonic->mo->momz <= 0)
{
if (sonic-players == consoleplayer && botingame)
CV_SetValue(&cv_analog2, false);
CV_SetValue(&cv_analog[1], false);
P_ResetPlayer(sonic);
P_SetTarget(&sonic->mo->tracer, tails->mo);
sonic->powers[pw_carry] = CR_PLAYER;
@ -644,7 +644,7 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails)
}
else {
if (sonic-players == consoleplayer && botingame)
CV_SetValue(&cv_analog2, true);
CV_SetValue(&cv_analog[1], true);
P_SetTarget(&sonic->mo->tracer, NULL);
sonic->powers[pw_carry] = CR_NONE;
}
@ -806,7 +806,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
// SF_DASHMODE users destroy spikes and monitors, CA_TWINSPIN users and CA2_MELEE users destroy spikes.
if ((tmthing->player)
&& (((tmthing->player->charflags & SF_DASHMODE) && (tmthing->player->dashmode >= 3*TICRATE)
&& ((((tmthing->player->charflags & (SF_DASHMODE|SF_MACHINE)) == (SF_DASHMODE|SF_MACHINE)) && (tmthing->player->dashmode >= DASHMODE_THRESHOLD)
&& (thing->flags & (MF_MONITOR)
|| (thing->type == MT_SPIKE
|| thing->type == MT_WALLSPIKE)))
@ -1327,7 +1327,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
thing->angle = tmthing->angle;
if (!demoplayback || P_AnalogMove(thing->player))
if (!demoplayback || P_ControlStyle(thing->player) == CS_LMAOGALOG)
{
if (thing->player == &players[consoleplayer])
localangle = thing->angle;
@ -1626,7 +1626,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
}
else if (thing->player) {
if (thing->player-players == consoleplayer && botingame)
CV_SetValue(&cv_analog2, true);
CV_SetValue(&cv_analog[1], true);
if (thing->player->powers[pw_carry] == CR_PLAYER)
{
P_SetTarget(&thing->tracer, NULL);
@ -2005,7 +2005,7 @@ static boolean PIT_CheckLine(line_t *ld)
if (lowfloor < tmdropoffz)
tmdropoffz = lowfloor;
return true;
}
@ -3385,6 +3385,70 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle)
return false;
}
//
//P_CheckMoveBlocked
//
boolean P_CheckMoveBlocked(line_t *li, mobj_t *mo)
{
// one-sided linedefs are always solid to sliding movement.
// one-sided linedef
if (!li->backsector)
{
if (P_PointOnLineSide(mo->x, mo->y, li))
return true; // don't hit the back side
return false;
}
if (!(mo->flags & MF_MISSILE))
{
if (li->flags & ML_IMPASSIBLE)
return false;
if ((mo->flags & (MF_ENEMY|MF_BOSS)) && li->flags & ML_BLOCKMONSTERS)
return false;
}
// set openrange, opentop, openbottom
P_LineOpening(li, mo);
if (openrange < mo->height)
return false; // doesn't fit
if (opentop - mo->z < mo->height)
return false; // mobj is too high
if (openbottom - mo->z > FixedMul(MAXSTEPMOVE, mo->scale))
return false; // too big a step up
// this line doesn't block movement
return true;
}
if (!(mo->flags & MF_MISSILE))
{
if (li->flags & ML_IMPASSIBLE)
return false;
if ((mo->flags & (MF_ENEMY|MF_BOSS)) && li->flags & ML_BLOCKMONSTERS)
return false;
}
// set openrange, opentop, openbottom
P_LineOpening(li, mo);
if (openrange < mo->height)
return false; // doesn't fit
if (opentop - mo->z < mo->height)
return false; // mobj is too high
if (openbottom - mo->z > FixedMul(MAXSTEPMOVE, mo->scale))
return false; // too big a step up
// this line doesn't block movement
return true;
}
//
// PTR_SlideTraverse
//
@ -3396,163 +3460,133 @@ static boolean PTR_SlideTraverse(intercept_t *in)
li = in->d.line;
// one-sided linedefs are always solid to sliding movement.
// one-sided linedef
if (!li->backsector)
if (!P_CheckMoveBlocked(li, slidemo))
{
if (P_PointOnLineSide(slidemo->x, slidemo->y, li))
return true; // don't hit the back side
goto isblocking;
}
if (!(slidemo->flags & MF_MISSILE))
{
if (li->flags & ML_IMPASSIBLE)
goto isblocking;
if ((slidemo->flags & (MF_ENEMY|MF_BOSS)) && li->flags & ML_BLOCKMONSTERS)
goto isblocking;
}
// set openrange, opentop, openbottom
P_LineOpening(li, slidemo);
if (openrange < slidemo->height)
goto isblocking; // doesn't fit
if (opentop - slidemo->z < slidemo->height)
goto isblocking; // mobj is too high
if (openbottom - slidemo->z > FixedMul(MAXSTEPMOVE, slidemo->scale))
goto isblocking; // too big a step up
// this line doesn't block movement
return true;
// the line does block movement,
// see if it is closer than best so far
isblocking:
if (li->polyobj && slidemo->player)
{
if ((li->polyobj->lines[0]->backsector->flags & SF_TRIGGERSPECIAL_TOUCH) && !(li->polyobj->flags & POF_NOSPECIALS))
P_ProcessSpecialSector(slidemo->player, slidemo->subsector->sector, li->polyobj->lines[0]->backsector);
}
if (slidemo->player && (slidemo->player->pflags & PF_GLIDING || slidemo->player->climbing)
&& slidemo->player->charability == CA_GLIDEANDCLIMB)
{
line_t *checkline = li;
sector_t *checksector;
ffloor_t *rover;
fixed_t topheight, bottomheight;
boolean fofline = false;
INT32 side = P_PointOnLineSide(slidemo->x, slidemo->y, li);
if (!side && li->backsector)
checksector = li->backsector;
else
checksector = li->frontsector;
if (checksector->ffloors)
// the line does block movement,
// see if it is closer than best so far
if (li->polyobj && slidemo->player)
{
for (rover = checksector->ffloors; rover; rover = rover->next)
if ((li->polyobj->lines[0]->backsector->flags & SF_TRIGGERSPECIAL_TOUCH) && !(li->polyobj->flags & POF_NOSPECIALS))
P_ProcessSpecialSector(slidemo->player, slidemo->subsector->sector, li->polyobj->lines[0]->backsector);
}
if (slidemo->player && (slidemo->player->pflags & PF_GLIDING || slidemo->player->climbing)
&& slidemo->player->charability == CA_GLIDEANDCLIMB)
{
line_t *checkline = li;
sector_t *checksector;
ffloor_t *rover;
fixed_t topheight, bottomheight;
boolean fofline = false;
INT32 side = P_PointOnLineSide(slidemo->x, slidemo->y, li);
if (!side && li->backsector)
checksector = li->backsector;
else
checksector = li->frontsector;
if (checksector->ffloors)
{
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
continue;
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, slidemo->x, slidemo->y);
if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, slidemo->x, slidemo->y);
#endif
if (topheight < slidemo->z)
continue;
if (bottomheight > slidemo->z + slidemo->height)
continue;
// Got this far, so I guess it's climbable. // TODO: Climbing check, also, better method to do this?
if (rover->master->flags & ML_TFERLINE)
for (rover = checksector->ffloors; rover; rover = rover->next)
{
size_t linenum = li-checksector->lines[0];
checkline = rover->master->frontsector->lines[0] + linenum;
fofline = true;
}
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
continue;
break;
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, slidemo->x, slidemo->y);
if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, slidemo->x, slidemo->y);
#endif
if (topheight < slidemo->z)
continue;
if (bottomheight > slidemo->z + slidemo->height)
continue;
// Got this far, so I guess it's climbable. // TODO: Climbing check, also, better method to do this?
if (rover->master->flags & ML_TFERLINE)
{
size_t linenum = li-checksector->lines[0];
checkline = rover->master->frontsector->lines[0] + linenum;
fofline = true;
}
break;
}
}
// see about climbing on the wall
if (!(checkline->flags & ML_NOCLIMB) && checkline->special != HORIZONSPECIAL)
{
boolean canclimb;
angle_t climbangle, climbline;
INT32 whichside = P_PointOnLineSide(slidemo->x, slidemo->y, li);
climbangle = climbline = R_PointToAngle2(li->v1->x, li->v1->y, li->v2->x, li->v2->y);
if (whichside) // on second side?
climbline += ANGLE_180;
climbangle += (ANGLE_90 * (whichside ? -1 : 1));
canclimb = (li->backsector ? P_IsClimbingValid(slidemo->player, climbangle) : true);
if (((!slidemo->player->climbing && abs((signed)(slidemo->angle - ANGLE_90 - climbline)) < ANGLE_45)
|| (slidemo->player->climbing == 1 && abs((signed)(slidemo->angle - climbline)) < ANGLE_135))
&& canclimb)
{
slidemo->angle = climbangle;
/*if (!demoplayback || P_AnalogMove(slidemo->player))
{
if (slidemo->player == &players[consoleplayer])
localangle = slidemo->angle;
else if (slidemo->player == &players[secondarydisplayplayer])
localangle2 = slidemo->angle;
}*/
if (!slidemo->player->climbing)
{
S_StartSound(slidemo->player->mo, sfx_s3k4a);
slidemo->player->climbing = 5;
}
slidemo->player->pflags &= ~(PF_GLIDING|PF_SPINNING|PF_JUMPED|PF_NOJUMPDAMAGE|PF_THOKKED);
slidemo->player->glidetime = 0;
slidemo->player->secondjump = 0;
if (slidemo->player->climbing > 1)
slidemo->momz = slidemo->momx = slidemo->momy = 0;
if (fofline)
whichside = 0;
if (!whichside)
{
slidemo->player->lastsidehit = checkline->sidenum[whichside];
slidemo->player->lastlinehit = (INT16)(checkline - lines);
}
P_Thrust(slidemo, slidemo->angle, FixedMul(5*FRACUNIT, slidemo->scale));
}
}
}
// see about climbing on the wall
if (!(checkline->flags & ML_NOCLIMB) && checkline->special != HORIZONSPECIAL)
if (in->frac < bestslidefrac && (!slidemo->player || !slidemo->player->climbing))
{
boolean canclimb;
angle_t climbangle, climbline;
INT32 whichside = P_PointOnLineSide(slidemo->x, slidemo->y, li);
climbangle = climbline = R_PointToAngle2(li->v1->x, li->v1->y, li->v2->x, li->v2->y);
if (whichside) // on second side?
climbline += ANGLE_180;
climbangle += (ANGLE_90 * (whichside ? -1 : 1));
canclimb = (li->backsector ? P_IsClimbingValid(slidemo->player, climbangle) : true);
if (((!slidemo->player->climbing && abs((signed)(slidemo->angle - ANGLE_90 - climbline)) < ANGLE_45)
|| (slidemo->player->climbing == 1 && abs((signed)(slidemo->angle - climbline)) < ANGLE_135))
&& canclimb)
{
slidemo->angle = climbangle;
/*if (!demoplayback || P_AnalogMove(slidemo->player))
{
if (slidemo->player == &players[consoleplayer])
localangle = slidemo->angle;
else if (slidemo->player == &players[secondarydisplayplayer])
localangle2 = slidemo->angle;
}*/
if (!slidemo->player->climbing)
{
S_StartSound(slidemo->player->mo, sfx_s3k4a);
slidemo->player->climbing = 5;
}
slidemo->player->pflags &= ~(PF_GLIDING|PF_SPINNING|PF_JUMPED|PF_NOJUMPDAMAGE|PF_THOKKED);
slidemo->player->glidetime = 0;
slidemo->player->secondjump = 0;
if (slidemo->player->climbing > 1)
slidemo->momz = slidemo->momx = slidemo->momy = 0;
if (fofline)
whichside = 0;
if (!whichside)
{
slidemo->player->lastsidehit = checkline->sidenum[whichside];
slidemo->player->lastlinehit = (INT16)(checkline - lines);
}
P_Thrust(slidemo, slidemo->angle, FixedMul(5*FRACUNIT, slidemo->scale));
}
secondslidefrac = bestslidefrac;
secondslideline = bestslideline;
bestslidefrac = in->frac;
bestslideline = li;
}
}
if (in->frac < bestslidefrac && (!slidemo->player || !slidemo->player->climbing))
{
secondslidefrac = bestslidefrac;
secondslideline = bestslideline;
bestslidefrac = in->frac;
bestslideline = li;
return false; // stop
}
return false; // stop
return true; // keep going!
}
//

View File

@ -1892,7 +1892,7 @@ void P_XYMovement(mobj_t *mo)
#endif
// Pushables can break some blocks
if (CheckForBustableBlocks && mo->flags & MF_PUSHABLE)
if (CheckForBustableBlocks && ((mo->flags & MF_PUSHABLE) || ((mo->info->flags & MF_PUSHABLE) && mo->fuse)))
P_PushableCheckBustables(mo);
if (!P_TryMove(mo, mo->x + xmove, mo->y + ymove, true)
@ -3127,7 +3127,7 @@ nightsdone:
{
// DO THE MARIO!
if (rover->flags & FF_SHATTERBOTTOM) // Brick block!
EV_CrumbleChain(NULL, rover); // node->m_sector
EV_CrumbleChain(node->m_sector, rover);
else // Question block!
EV_MarioBlock(rover, node->m_sector, mo);
}
@ -3298,7 +3298,7 @@ boolean P_CanRunOnWater(player_t *player, ffloor_t *rover)
*rover->topheight;
if (!player->powers[pw_carry] && !player->homing
&& ((player->powers[pw_super] || player->charflags & SF_RUNONWATER || player->dashmode >= 3*TICRATE) && player->mo->ceilingz-topheight >= player->mo->height)
&& ((player->powers[pw_super] || player->charflags & SF_RUNONWATER || player->dashmode >= DASHMODE_THRESHOLD) && player->mo->ceilingz-topheight >= player->mo->height)
&& (rover->flags & FF_SWIMMABLE) && !(player->pflags & PF_SPINNING) && player->speed > FixedMul(player->runspeed, player->mo->scale)
&& !(player->pflags & PF_SLIDING)
&& abs(player->mo->z - topheight) < FixedMul(30*FRACUNIT, player->mo->scale))
@ -7286,7 +7286,7 @@ static void P_FlameJetSceneryThink(mobj_t *mobj)
if (!(mobj->flags2 & MF2_FIRING))
return;
if ((leveltime & 3) == 0)
if ((leveltime & 3) != 0)
return;
// Wave the flames back and forth. Reactiontime determines which direction it's going.
@ -7325,7 +7325,7 @@ static void P_VerticalFlameJetSceneryThink(mobj_t *mobj)
if (!(mobj->flags2 & MF2_FIRING))
return;
if ((leveltime & 3) == 0)
if ((leveltime & 3) != 0)
return;
// Wave the flames back and forth. Reactiontime determines which direction it's going.
@ -7977,7 +7977,7 @@ static void P_MobjSceneryThink(mobj_t *mobj)
mobj->x = mobj->extravalue1 + P_ReturnThrustX(mobj, mobj->movedir, mobj->cvmem*mobj->scale);
mobj->y = mobj->extravalue2 + P_ReturnThrustY(mobj, mobj->movedir, mobj->cvmem*mobj->scale);
P_SetThingPosition(mobj);
if (!mobj->fuse)
{
#ifdef HAVE_BLUA

View File

@ -1351,9 +1351,9 @@ static void Polyobj_rotateThings(polyobj_t *po, vertex_t origin, angle_t delta,
if (turnthings == 2 || (turnthings == 1 && !mo->player)) {
mo->angle += delta;
if (mo->player == &players[consoleplayer])
localangle = mo->angle;
localangle += delta;
else if (mo->player == &players[secondarydisplayplayer])
localangle2 = mo->angle;
localangle2 += delta;
}
}
}

View File

@ -1105,8 +1105,8 @@ static void P_LoadSidedefs(UINT8 *data)
if (((sd->line->flags & (ML_TWOSIDED|ML_EFFECT5)) == (ML_TWOSIDED|ML_EFFECT5))
&& !(sd->special >= 300 && sd->special < 500)) // exempt linedef exec specials
{
sd->repeatcnt = (INT16)(((unsigned)textureoffset) >> 12);
sd->textureoffset = (((unsigned)textureoffset) & 2047) << FRACBITS;
sd->repeatcnt = (INT16)(((UINT16)textureoffset) >> 12);
sd->textureoffset = (((UINT16)textureoffset) & 2047) << FRACBITS;
}
else
{
@ -1120,7 +1120,6 @@ static void P_LoadSidedefs(UINT8 *data)
// Special info stored in texture fields!
switch (sd->special)
{
case 63: // Fake floor/ceiling planes
case 606: //SoM: 4/4/2000: Just colormap transfer
case 447: // Change colormap of tagged sectors! -- Monster Iestyn 14/06/18
case 455: // Fade colormaps! mazmazz 9/12/2018 (:flag_us:)
@ -2850,7 +2849,7 @@ static void P_InitLevelSettings(void)
}
if (botingame)
CV_SetValue(&cv_analog2, true);
CV_SetValue(&cv_analog[1], true);
}
// Respawns all the mapthings and mobjs in the map from the already loaded map data.
@ -3161,26 +3160,26 @@ static void P_InitCamera(void)
if (!cv_cam2_rotate.changed)
CV_Set(&cv_cam2_rotate, cv_cam2_rotate.defaultvalue);
if (!cv_analog.changed)
CV_SetValue(&cv_analog, 0);
if (!cv_analog2.changed)
CV_SetValue(&cv_analog2, 0);
if (!cv_analog[0].changed)
CV_SetValue(&cv_analog[0], 0);
if (!cv_analog[1].changed)
CV_SetValue(&cv_analog[1], 0);
displayplayer = consoleplayer; // Start with your OWN view, please!
}
if (twodlevel)
{
CV_SetValue(&cv_analog, false);
CV_SetValue(&cv_analog2, false);
CV_SetValue(&cv_analog[0], false);
CV_SetValue(&cv_analog[1], false);
}
else
{
if (cv_useranalog.value)
CV_SetValue(&cv_analog, true);
if (cv_useranalog[0].value)
CV_SetValue(&cv_analog[0], true);
if ((splitscreen && cv_useranalog2.value) || botingame)
CV_SetValue(&cv_analog2, true);
if ((splitscreen && cv_useranalog[1].value) || botingame)
CV_SetValue(&cv_analog[1], true);
}
}
@ -3427,6 +3426,9 @@ boolean P_LoadLevel(boolean fromnetsave)
/*if (!cv_cam_speed.changed)
CV_Set(&cv_cam_speed, cv_cam_speed.defaultvalue);*/
CV_UpdateCamDist();
CV_UpdateCam2Dist();
if (!cv_chasecam.changed)
CV_SetValue(&cv_chasecam, chase);

View File

@ -1887,7 +1887,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
while (node)
{
mo = node->m_thing;
if (mo->flags & MF_PUSHABLE)
if ((mo->flags & MF_PUSHABLE) || ((mo->info->flags & MF_PUSHABLE) && mo->fuse))
numpush++;
node = node->m_thinglist_next;
}
@ -4614,7 +4614,7 @@ DoneSection2:
player->mo->angle = player->drawangle = lineangle;
if (!demoplayback || P_AnalogMove(player))
if (!demoplayback || P_ControlStyle(player) == CS_LMAOGALOG)
{
if (player == &players[consoleplayer])
localangle = player->mo->angle;
@ -8974,7 +8974,8 @@ void T_Pusher(pusher_t *p)
|| thing->type == MT_EXTRALARGEBUBBLE))
continue;
if (!(thing->flags & MF_PUSHABLE) && !(thing->type == MT_PLAYER
if (!((thing->flags & MF_PUSHABLE) || ((thing->info->flags & MF_PUSHABLE) && thing->fuse))
&& !(thing->type == MT_PLAYER
|| thing->type == MT_SMALLBUBBLE
|| thing->type == MT_MEDIUMBUBBLE
|| thing->type == MT_EXTRALARGEBUBBLE
@ -9127,7 +9128,7 @@ void T_Pusher(pusher_t *p)
thing->player->pflags |= PF_SLIDING;
thing->angle = R_PointToAngle2 (0, 0, xspeed<<(FRACBITS-PUSH_FACTOR), yspeed<<(FRACBITS-PUSH_FACTOR));
if (!demoplayback || P_AnalogMove(thing->player))
if (!demoplayback || P_ControlStyle(thing->player) == CS_LMAOGALOG)
{
if (thing->player == &players[consoleplayer])
{

View File

@ -42,6 +42,8 @@
#include "b_bot.h"
// Objectplace
#include "m_cheat.h"
// Thok camera snap (ctrl-f "chalupa")
#include "g_input.h"
#ifdef HW3SOUND
#include "hardware/hw3sound.h"
@ -347,11 +349,11 @@ void P_GiveEmerald(boolean spawnObj)
continue;
P_SetTarget(&emmo->target, players[i].mo);
P_SetMobjState(emmo, mobjinfo[MT_GOTEMERALD].meleestate + em);
// Make sure we're not being carried before our tracer is changed
if (players[i].powers[pw_carry] != CR_NIGHTSMODE)
players[i].powers[pw_carry] = CR_NONE;
P_SetTarget(&players[i].mo->tracer, emmo);
if (pnum == 255)
@ -1063,7 +1065,7 @@ void P_ResetPlayer(player_t *player)
player->onconveyor = 0;
player->skidtime = 0;
if (player-players == consoleplayer && botingame)
CV_SetValue(&cv_analog2, true);
CV_SetValue(&cv_analog[1], true);
}
// P_PlayerCanDamage
@ -3578,7 +3580,7 @@ static void P_DoClimbing(player_t *player)
}
#define CLIMBCONEMAX FixedAngle(90*FRACUNIT)
if (!demoplayback || P_AnalogMove(player))
if (!demoplayback || P_ControlStyle(player) == CS_LMAOGALOG)
{
if (player == &players[consoleplayer])
{
@ -4393,7 +4395,7 @@ void P_DoJump(player_t *player, boolean soundandstate)
player->drawangle = player->mo->angle = player->mo->angle - ANGLE_180; // Turn around from the wall you were climbing.
if (!demoplayback || P_AnalogMove(player))
if (!demoplayback || P_ControlStyle(player) == CS_LMAOGALOG)
{
if (player == &players[consoleplayer])
localangle = player->mo->angle; // Adjust the local control angle.
@ -4437,7 +4439,7 @@ void P_DoJump(player_t *player, boolean soundandstate)
player->powers[pw_carry] = CR_NONE;
P_SetTarget(&player->mo->tracer, NULL);
if (player-players == consoleplayer && botingame)
CV_SetValue(&cv_analog2, true);
CV_SetValue(&cv_analog[1], true);
}
else if (player->powers[pw_carry] == CR_GENERIC)
{
@ -4641,7 +4643,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
if (player->dashspeed > player->maxdash)
player->dashspeed = player->maxdash;
if (player->dashspeed < player->maxdash && player->mindash != player->maxdash)
{
#define chargecalculation (6*(player->dashspeed - player->mindash))/(player->maxdash - player->mindash)
@ -4724,7 +4726,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
{
player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, lockon->x, lockon->y);
bullet = P_SpawnPointMissile(player->mo, lockon->x, lockon->y, zpos(lockon), player->revitem, player->mo->x, player->mo->y, zpos(player->mo));
if (!demoplayback || P_AnalogMove(player))
if (!demoplayback || P_ControlStyle(player) == CS_LMAOGALOG)
{
if (player == &players[consoleplayer])
localangle = player->mo->angle;
@ -5353,6 +5355,16 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
player->pflags &= ~(PF_SPINNING|PF_STARTDASH);
player->pflags |= PF_THOKKED;
// Change localangle to match for simple controls? (P.S. chalupa)
// disabled because it seemed to disorient people and Z-targeting exists now
/*if (!demoplayback)
{
if (player == &players[consoleplayer] && cv_cam_turnfacingability[0].value > 0 && !(PLAYER1INPUTDOWN(gc_turnleft) || PLAYER1INPUTDOWN(gc_turnright)))
localangle = player->mo->angle;
else if (player == &players[secondarydisplayplayer] && cv_cam_turnfacingability[1].value > 0 && !(PLAYER2INPUTDOWN(gc_turnleft) || PLAYER2INPUTDOWN(gc_turnright)))
localangle2 = player->mo->angle;
}*/
}
break;
@ -5607,13 +5619,6 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
}
}
#if 0
boolean P_AnalogMove(player_t *player)
{
return player->pflags & PF_ANALOGMODE;
}
#endif
//
// P_GetPlayerControlDirection
//
@ -5652,7 +5657,7 @@ INT32 P_GetPlayerControlDirection(player_t *player)
origtempangle = tempangle = 0; // relative to the axis rather than the player!
controlplayerdirection = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy);
}
else if (P_AnalogMove(player) && thiscam->chase)
else if ((P_ControlStyle(player) & CS_LMAOGALOG) && thiscam->chase)
{
if (player->awayviewtics)
origtempangle = tempangle = player->awayviewmobj->angle;
@ -5878,7 +5883,7 @@ static void P_3dMovement(player_t *player)
INT32 mforward = 0, mbackward = 0;
angle_t dangle; // replaces old quadrants bits
fixed_t normalspd = FixedMul(player->normalspeed, player->mo->scale);
boolean analogmove = false;
controlstyle_e controlstyle;
boolean spin = ((onground = P_IsObjectOnGround(player->mo)) && (player->pflags & (PF_SPINNING|PF_THOKKED)) == PF_SPINNING && (player->rmomx || player->rmomy) && !(player->pflags & PF_STARTDASH));
fixed_t oldMagnitude, newMagnitude;
#ifdef ESLOPE
@ -5891,7 +5896,7 @@ static void P_3dMovement(player_t *player)
// Get the old momentum; this will be needed at the end of the function! -SH
oldMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0);
analogmove = P_AnalogMove(player);
controlstyle = P_ControlStyle(player);
cmd = &player->cmd;
@ -5918,7 +5923,7 @@ static void P_3dMovement(player_t *player)
}
}
if (analogmove)
if (controlstyle & CS_LMAOGALOG)
{
movepushangle = (cmd->angleturn<<16 /* not FRACBITS */);
}
@ -6064,7 +6069,7 @@ static void P_3dMovement(player_t *player)
P_SetObjectMomZ(player->mo, FixedDiv(cmd->forwardmove*FRACUNIT, 15*FRACUNIT>>1), false);
}
}
else if (!analogmove
else if (!(controlstyle == CS_LMAOGALOG)
&& cmd->forwardmove != 0 && !(player->pflags & PF_GLIDING || player->exiting
|| (P_PlayerInPain(player) && !onground)))
{
@ -6103,7 +6108,7 @@ static void P_3dMovement(player_t *player)
P_InstaThrust(player->mo, player->mo->angle-ANGLE_90, FixedDiv(cmd->sidemove*player->mo->scale, 15*FRACUNIT>>1));
}
// Analog movement control
else if (analogmove)
else if (controlstyle == CS_LMAOGALOG)
{
if (!(player->pflags & PF_GLIDING || player->exiting || P_PlayerInPain(player)))
{
@ -8114,8 +8119,33 @@ static void P_MovePlayer(player_t *player)
P_2dMovement(player);
else
{
if (!player->climbing && (!P_AnalogMove(player)))
player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
if (!player->climbing)
{
switch (P_ControlStyle(player))
{
case CS_LEGACY:
case CS_STANDARD:
player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
break;
case CS_LMAOGALOG:
break; // handled elsewhere
case CS_SIMPLE:
if (cmd->forwardmove || cmd->sidemove)
{
angle_t controlangle = R_PointToAngle2(0, 0, cmd->forwardmove << FRACBITS, -cmd->sidemove << FRACBITS);
player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */) + controlangle;
}
else
{
angle_t drawangleoffset = (player->powers[pw_carry] == CR_ROLLOUT) ? ANGLE_180 : 0;
player->mo->angle = player->drawangle + drawangleoffset;
}
break;
}
}
ticruned++;
if ((cmd->angleturn & TICCMD_RECEIVED) == 0)
@ -8241,7 +8271,7 @@ static void P_MovePlayer(player_t *player)
if (player->pflags & PF_GLIDING)
{
mobj_t *mo = player->mo; // seriously why isn't this at the top of the function hngngngng
fixed_t leeway = !P_AnalogMove(player) ? FixedAngle(cmd->sidemove*(FRACUNIT)) : 0;
fixed_t leeway = (P_ControlStyle(player) != CS_LMAOGALOG) ? FixedAngle(cmd->sidemove*(FRACUNIT)) : 0;
fixed_t glidespeed = player->actionspd;
fixed_t momx = mo->momx - player->cmomx, momy = mo->momy - player->cmomy;
angle_t angle, moveangle = R_PointToAngle2(0, 0, momx, momy);
@ -8513,7 +8543,7 @@ static void P_MovePlayer(player_t *player)
//////////////////
// This really looks like it should be moved to P_3dMovement. -Red
if (P_AnalogMove(player)
if (P_ControlStyle(player) == CS_LMAOGALOG
&& (cmd->forwardmove != 0 || cmd->sidemove != 0) && !player->climbing && !twodlevel && !(player->mo->flags2 & MF2_TWOD))
{
// If travelling slow enough, face the way the controls
@ -9117,6 +9147,132 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius)
}
}
//
// P_LookForFocusTarget
// Looks for a target for a player to focus on, for Z-targeting etc.
// exclude would be the current focus target, to ignore.
// direction, if set, requires the target to be to the left (1) or right (-1) of the angle
// mobjflags can be used to limit the flags of objects that can be focused
//
mobj_t *P_LookForFocusTarget(player_t *player, mobj_t *exclude, SINT8 direction, UINT8 lockonflags)
{
mobj_t *mo;
thinker_t *think;
mobj_t *closestmo = NULL;
const fixed_t maxdist = 2560*player->mo->scale;
const angle_t span = ANGLE_45;
fixed_t dist, closestdist = 0;
angle_t dangle, closestdangle = 0;
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
{
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo = (mobj_t *)think;
if (mo->flags & MF_NOCLIPTHING)
continue;
if (mo == player->mo || mo == exclude)
continue;
if (mo->health <= 0) // dead
continue;
switch (mo->type)
{
case MT_TNTBARREL:
if (lockonflags & LOCK_INTERESTS)
break;
/*fallthru*/
case MT_PLAYER: // Don't chase other players!
case MT_DETON:
continue; // Don't be STUPID, Sonic!
case MT_FAKEMOBILE:
if (!(lockonflags & LOCK_BOSS))
continue;
break;
case MT_EGGSHIELD:
if (!(lockonflags & LOCK_ENEMY))
continue;
break;
case MT_EGGSTATUE:
if (tutorialmode)
break; // Always focus egg statue in the tutorial
/*fallthru*/
default:
if ((lockonflags & LOCK_BOSS) && ((mo->flags & (MF_BOSS|MF_SHOOTABLE)) == (MF_BOSS|MF_SHOOTABLE))) // allows if it has the flags desired XOR it has the invert aimable flag
{
if (mo->flags2 & MF2_FRET)
continue;
break;
}
if ((lockonflags & LOCK_ENEMY) && (!((mo->flags & (MF_ENEMY|MF_SHOOTABLE)) == (MF_ENEMY|MF_SHOOTABLE)) != !(mo->flags2 & MF2_INVERTAIMABLE))) // allows if it has the flags desired XOR it has the invert aimable flag
break;
if ((lockonflags & LOCK_INTERESTS) && (mo->flags & (MF_PUSHABLE|MF_MONITOR))) // allows if it has the flags desired XOR it has the invert aimable flag
break;
continue; // not a valid object
}
{
fixed_t zdist = (player->mo->z + player->mo->height/2) - (mo->z + mo->height/2);
dist = P_AproxDistance(player->mo->x-mo->x, player->mo->y-mo->y);
if (abs(zdist) > dist)
continue; // Don't home outside of desired angle!
dist = P_AproxDistance(dist, zdist);
if (dist > maxdist)
continue; // out of range
}
if ((twodlevel || player->mo->flags2 & MF2_TWOD)
&& abs(player->mo->y-mo->y) > player->mo->radius)
continue; // not in your 2d plane
dangle = R_PointToAngle2(player->mo->x, player->mo->y, mo->x, mo->y) - (
!exclude ? player->mo->angle : R_PointToAngle2(player->mo->x, player->mo->y, exclude->x, exclude->y)
);
if (direction)
{
if (direction == 1 && dangle > ANGLE_180)
continue; // To the right of the player
if (direction == -1 && dangle < ANGLE_180)
continue; // To the left of the player
}
if (dangle > ANGLE_180)
dangle = InvAngle(dangle);
if (dangle > span)
continue; // behind back
// Inflate dist by angle difference to bias toward objects at a closer angle
dist = FixedDiv(dist, FINECOSINE(dangle>>ANGLETOFINESHIFT)*3);
if (closestmo && (exclude ? (dangle > closestdangle) : (dist > closestdist)))
continue;
if (!P_CheckSight(player->mo, mo))
continue; // out of sight
closestmo = mo;
closestdist = dist;
closestdangle = dangle;
}
return closestmo;
}
//
// P_LookForEnemies
// Looks for something you can hit - Used for homing attack
@ -9232,7 +9388,7 @@ boolean P_HomingAttack(mobj_t *source, mobj_t *enemy) // Home in on your target
if (source->player)
{
source->player->drawangle = source->angle;
if (!demoplayback || P_AnalogMove(source->player))
if (!demoplayback || P_ControlStyle(source->player) == CS_LMAOGALOG)
{
if (source->player == &players[consoleplayer])
localangle = source->angle;
@ -9584,12 +9740,12 @@ static void CV_CamRotate2_OnChange(void)
}
static CV_PossibleValue_t CV_CamSpeed[] = {{0, "MIN"}, {1*FRACUNIT, "MAX"}, {0, NULL}};
static CV_PossibleValue_t rotation_cons_t[] = {{1, "MIN"}, {45, "MAX"}, {0, NULL}};
static CV_PossibleValue_t rotation_cons_t[] = {{1, "MIN"}, {25, "MAX"}, {0, NULL}};
static CV_PossibleValue_t CV_CamRotate[] = {{-720, "MIN"}, {720, "MAX"}, {0, NULL}};
static CV_PossibleValue_t multiplier_cons_t[] = {{0, "MIN"}, {3*FRACUNIT, "MAX"}, {0, NULL}};
consvar_t cv_cam_dist = {"cam_dist", "160", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_height = {"cam_height", "25", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_dist = {"cam_curdist", "160", CV_FLOAT, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_height = {"cam_curheight", "25", CV_FLOAT, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_still = {"cam_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_speed = {"cam_speed", "0.3", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_rotate = {"cam_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate_OnChange, 0, NULL, NULL, 0, 0, NULL};
@ -9597,8 +9753,8 @@ consvar_t cv_cam_rotspeed = {"cam_rotspeed", "10", CV_SAVE, rotation_cons_t, NUL
consvar_t cv_cam_turnmultiplier = {"cam_turnmultiplier", "1.0", CV_FLOAT|CV_SAVE, multiplier_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_orbit = {"cam_orbit", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_adjust = {"cam_adjust", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_dist = {"cam2_dist", "160", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_height = {"cam2_height", "25", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_dist = {"cam2_curdist", "160", CV_FLOAT, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_height = {"cam2_curheight", "25", CV_FLOAT, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_still = {"cam2_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_speed = {"cam2_speed", "0.3", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_rotate = {"cam2_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate2_OnChange, 0, NULL, NULL, 0, 0, NULL};
@ -9607,6 +9763,42 @@ consvar_t cv_cam2_turnmultiplier = {"cam2_turnmultiplier", "1.0", CV_FLOAT|CV_SA
consvar_t cv_cam2_orbit = {"cam2_orbit", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_adjust = {"cam2_adjust", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
// [standard vs simple][p1 or p2]
consvar_t cv_cam_savedist[2][2] = {
{ // standard
{"cam_dist", "160", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCamDist, 0, NULL, NULL, 0, 0, NULL},
{"cam2_dist", "160", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCam2Dist, 0, NULL, NULL, 0, 0, NULL}
},
{ // simple
{"cam_simpledist", "224", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCamDist, 0, NULL, NULL, 0, 0, NULL},
{"cam2_simpledist", "224", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCam2Dist, 0, NULL, NULL, 0, 0, NULL}
}
};
consvar_t cv_cam_saveheight[2][2] = {
{ // standard
{"cam_height", "25", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCamDist, 0, NULL, NULL, 0, 0, NULL},
{"cam2_height", "25", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCam2Dist, 0, NULL, NULL, 0, 0, NULL}
},
{ // simple
{"cam_simpleheight", "48", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCamDist, 0, NULL, NULL, 0, 0, NULL},
{"cam2_simpleheight", "48", CV_FLOAT|CV_SAVE|CV_CALL, NULL, CV_UpdateCam2Dist, 0, NULL, NULL, 0, 0, NULL}
}
};
void CV_UpdateCamDist(void)
{
CV_Set(&cv_cam_dist, va("%f", FIXED_TO_FLOAT(cv_cam_savedist[cv_useranalog[0].value][0].value)));
CV_Set(&cv_cam_height, va("%f", FIXED_TO_FLOAT(cv_cam_saveheight[cv_useranalog[0].value][0].value)));
}
void CV_UpdateCam2Dist(void)
{
CV_Set(&cv_cam2_dist, va("%f", FIXED_TO_FLOAT(cv_cam_savedist[cv_useranalog[1].value][1].value)));
CV_Set(&cv_cam2_height, va("%f", FIXED_TO_FLOAT(cv_cam_saveheight[cv_useranalog[1].value][1].value)));
}
fixed_t t_cam_dist = -42;
fixed_t t_cam_height = -42;
fixed_t t_cam_rotate = -42;
@ -9640,8 +9832,14 @@ void P_ResetCamera(player_t *player, camera_t *thiscam)
thiscam->y = y;
thiscam->z = z;
if (!(thiscam == &camera && (cv_cam_still.value || cv_analog.value))
&& !(thiscam == &camera2 && (cv_cam2_still.value || cv_analog2.value)))
if ((thiscam == &camera && G_ControlStyle(1) == CS_SIMPLE)
|| (thiscam == &camera2 && G_ControlStyle(2) == CS_SIMPLE))
{
thiscam->angle = (thiscam == &camera) ? localangle : localangle2;
thiscam->aiming = (thiscam == &camera) ? localaiming : localaiming2;
}
else if (!(thiscam == &camera && (cv_cam_still.value || cv_analog[0].value))
&& !(thiscam == &camera2 && (cv_cam2_still.value || cv_analog[1].value)))
{
thiscam->angle = player->mo->angle;
thiscam->aiming = 0;
@ -9666,6 +9864,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
subsector_t *newsubsec;
fixed_t f1, f2;
static fixed_t camsideshift[2] = {0, 0};
fixed_t shiftx = 0, shifty = 0;
// We probably shouldn't move the camera if there is no player or player mobj somehow
if (!player || !player->mo)
return true;
@ -9756,7 +9957,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
}
else
{
focusangle = mo->angle;
focusangle = player->cmd.angleturn << 16;
focusaiming = player->aiming;
}
@ -9796,7 +9997,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camheight = FixedMul(camheight, player->camerascale);
#ifdef REDSANALOG
if (P_AnalogMove(player) && (player->cmd.buttons & (BT_CAMLEFT|BT_CAMRIGHT)) == (BT_CAMLEFT|BT_CAMRIGHT)) {
if (P_ControlStyle(player) == CS_LMAOGALOG && (player->cmd.buttons & (BT_CAMLEFT|BT_CAMRIGHT)) == (BT_CAMLEFT|BT_CAMRIGHT)) {
camstill = true;
if (camspeed < 4*FRACUNIT/5)
@ -9826,7 +10027,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
angle = R_PointToAngle2(mo->x, mo->y, mo->target->x, mo->target->y);
}
}
else if (P_AnalogMove(player) && !sign) // Analog
else if (P_ControlStyle(player) == CS_LMAOGALOG && !sign) // Analog
angle = R_PointToAngle2(thiscam->x, thiscam->y, mo->x, mo->y);
else if (demoplayback)
{
@ -9843,14 +10044,14 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
else
angle = focusangle + FixedAngle(camrotate*FRACUNIT);
if (!resetcalled && (cv_analog.value || demoplayback) && ((thiscam == &camera && t_cam_rotate != -42) || (thiscam == &camera2
if (!resetcalled && (cv_analog[0].value || demoplayback) && ((thiscam == &camera && t_cam_rotate != -42) || (thiscam == &camera2
&& t_cam2_rotate != -42)))
{
angle = FixedAngle(camrotate*FRACUNIT);
thiscam->angle = angle;
}
if ((((thiscam == &camera) && cv_analog.value) || ((thiscam != &camera) && cv_analog2.value) || demoplayback) && !sign && !objectplacing && !(twodlevel || (mo->flags2 & MF2_TWOD)) && (player->powers[pw_carry] != CR_NIGHTSMODE) && displayplayer == consoleplayer)
if ((((thiscam == &camera) && cv_analog[0].value) || ((thiscam != &camera) && cv_analog[1].value) || demoplayback) && !sign && !objectplacing && !(twodlevel || (mo->flags2 & MF2_TWOD)) && (player->powers[pw_carry] != CR_NIGHTSMODE) && displayplayer == consoleplayer)
{
#ifdef REDSANALOG
if ((player->cmd.buttons & (BT_CAMLEFT|BT_CAMRIGHT)) == (BT_CAMLEFT|BT_CAMRIGHT)); else
@ -9871,6 +10072,29 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
}
}
if (G_ControlStyle((thiscam == &camera) ? 1 : 2) == CS_SIMPLE && !sign)
{
// Shift the camera slightly to the sides depending on the player facing direction
UINT8 forplayer = (thiscam == &camera) ? 0 : 1;
fixed_t shift = FixedMul(FINESINE((player->mo->angle - angle) >> ANGLETOFINESHIFT), cv_cam_shiftfacing[forplayer].value);
if (player->powers[pw_carry] == CR_NIGHTSMODE)
{
fixed_t cos = FINECOSINE((angle_t) (player->flyangle * ANG1)>>ANGLETOFINESHIFT);
shift = FixedMul(shift, min(FRACUNIT, player->speed*abs(cos)/6000));
shift += FixedMul(camsideshift[forplayer] - shift, FRACUNIT-(camspeed>>2));
}
else if (ticcmd_centerviewdown[(thiscam == &camera) ? 0 : 1])
shift = FixedMul(camsideshift[forplayer], FRACUNIT-camspeed);
else
shift += FixedMul(camsideshift[forplayer] - shift, FRACUNIT-(camspeed>>3));
camsideshift[forplayer] = shift;
shift = FixedMul(shift, camdist);
shiftx = -FixedMul(FINESINE(angle>>ANGLETOFINESHIFT), shift);
shifty = FixedMul(FINECOSINE(angle>>ANGLETOFINESHIFT), shift);
}
// sets ideal cam pos
if (twodlevel || (mo->flags2 & MF2_TWOD))
dist = 480<<FRACBITS;
@ -9893,7 +10117,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camheight = mo->scale << 7;
camspeed = FRACUNIT/12;
}
else if (P_AnalogMove(player)) // x1.2 dist for analog
else if (P_ControlStyle(player) == CS_LMAOGALOG) // x1.2 dist for analog
{
dist = FixedMul(dist, 6*FRACUNIT/5);
camheight = FixedMul(camheight, 6*FRACUNIT/5);
@ -10217,8 +10441,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
}
else
{
viewpointx = mo->x + FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
viewpointy = mo->y + FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
viewpointx = mo->x + shiftx + FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
viewpointy = mo->y + shifty + FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
}
if (!camstill && !resetcalled && !paused)
@ -10259,6 +10483,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
}
else
thiscam->momz = FixedMul(z - thiscam->z, camspeed);
thiscam->momx += FixedMul(shiftx, camspeed);
thiscam->momy += FixedMul(shifty, camspeed);
}
// compute aming to look the viewed point
@ -10806,7 +11033,7 @@ static void P_MinecartThink(player_t *player)
else if (angdiff > ANGLE_180 && angdiff < InvAngle(MINECARTCONEMAX))
player->mo->angle = minecart->angle - MINECARTCONEMAX;
if (angdiff + minecart->angle != player->mo->angle && (!demoplayback || P_AnalogMove(player)))
if (angdiff + minecart->angle != player->mo->angle && (!demoplayback || P_ControlStyle(player) == CS_LMAOGALOG))
{
if (player == &players[consoleplayer])
localangle = player->mo->angle;
@ -10885,7 +11112,7 @@ static void P_MinecartThink(player_t *player)
else
minecart->angle = targetangle + ANGLE_180;
angdiff = (minecart->angle - prevangle);
if (angdiff && (!demoplayback || P_AnalogMove(player))) // maintain relative angle on turns
if (angdiff && (!demoplayback || P_ControlStyle(player) == CS_LMAOGALOG)) // maintain relative angle on turns
{
player->mo->angle += angdiff;
if (player == &players[consoleplayer])
@ -11345,7 +11572,12 @@ void P_PlayerThink(player_t *player)
player->playerstate = PST_REBORN;
}
if (player->playerstate == PST_REBORN)
{
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
return;
}
}
#ifdef SEENAMES
@ -11446,7 +11678,12 @@ void P_PlayerThink(player_t *player)
player->lives = 0;
if (player->playerstate == PST_DEAD)
{
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
return;
}
}
}
@ -11565,7 +11802,9 @@ void P_PlayerThink(player_t *player)
{
player->mo->flags2 &= ~MF2_SHADOW;
P_DeathThink(player);
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
return;
}
@ -11606,7 +11845,12 @@ void P_PlayerThink(player_t *player)
if (player->spectator && cmd->buttons & BT_ATTACK && !player->powers[pw_flashing] && G_GametypeHasSpectators())
{
if (P_SpectatorJoinGame(player))
{
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
return; // player->mo was removed.
}
}
// Even if not NiGHTS, pull in nearby objects when walking around as John Q. Elliot.
@ -11660,7 +11904,7 @@ void P_PlayerThink(player_t *player)
player->mo->reactiontime--;
else if (player->powers[pw_carry] == CR_MINECART)
{
if (!P_AnalogMove(player))
if (P_ControlStyle(player) != CS_LMAOGALOG)
player->mo->angle = (cmd->angleturn << 16 /* not FRACBITS */);
ticruned++;
@ -11673,7 +11917,7 @@ void P_PlayerThink(player_t *player)
{
if (player->powers[pw_carry] == CR_ROPEHANG)
{
if (!P_AnalogMove(player))
if (P_ControlStyle(player) != CS_LMAOGALOG)
player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
ticruned++;
@ -11708,7 +11952,12 @@ void P_PlayerThink(player_t *player)
}
if (!player->mo)
{
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
return; // P_MovePlayer removed player->mo.
}
// deez New User eXperiences.
{
@ -11721,7 +11970,7 @@ void P_PlayerThink(player_t *player)
;
else if (!(player->pflags & PF_DIRECTIONCHAR)
|| (player->climbing) // stuff where the direction is forced at all times
|| (P_AnalogMove(player) || twodlevel || player->mo->flags2 & MF2_TWOD) // keep things synchronised up there, since the camera IS seperate from player motion when that happens
|| (twodlevel || player->mo->flags2 & MF2_TWOD) // keep things synchronised up there, since the camera IS seperate from player motion when that happens
|| G_RingSlingerGametype()) // no firing rings in directions your player isn't aiming
player->drawangle = player->mo->angle;
else if (P_PlayerInPain(player))
@ -11752,7 +12001,7 @@ void P_PlayerThink(player_t *player)
case CR_ROLLOUT:
if (cmd->forwardmove || cmd->sidemove) // only when you're pressing movement keys
{ // inverse direction!
diff = ((player->mo->angle + R_PointToAngle2(0, 0, -cmd->forwardmove<<FRACBITS, cmd->sidemove<<FRACBITS)) - player->drawangle);
diff = (((player->cmd.angleturn<<16) + R_PointToAngle2(0, 0, -cmd->forwardmove<<FRACBITS, cmd->sidemove<<FRACBITS)) - player->drawangle);
factor = 4;
}
break;
@ -11809,7 +12058,7 @@ void P_PlayerThink(player_t *player)
}
else if (cmd->forwardmove || cmd->sidemove) // only when you're pressing movement keys
{
diff = ((player->mo->angle + R_PointToAngle2(0, 0, cmd->forwardmove<<FRACBITS, -cmd->sidemove<<FRACBITS)) - player->drawangle);
diff = ((player->mo->angle + ((player->pflags & PF_ANALOGMODE) ? 0 : R_PointToAngle2(0, 0, cmd->forwardmove<<FRACBITS, -cmd->sidemove<<FRACBITS))) - player->drawangle);
factor = 4;
}
else if (player->rmomx || player->rmomy)
@ -12140,6 +12389,11 @@ void P_PlayerThink(player_t *player)
dashmode = 0;
}
#undef dashmode
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
/*
// Colormap verification
{
@ -12422,7 +12676,7 @@ void P_PlayerAfterThink(player_t *player)
{
player->mo->angle = tails->angle;
if (!demoplayback || P_AnalogMove(player))
if (!demoplayback || P_ControlStyle(player) == CS_LMAOGALOG)
{
if (player == &players[consoleplayer])
localangle = player->mo->angle;
@ -12445,7 +12699,7 @@ void P_PlayerAfterThink(player_t *player)
P_SetTarget(&player->mo->tracer, NULL);
if (player-players == consoleplayer && botingame)
CV_SetValue(&cv_analog2, (player->powers[pw_carry] != CR_PLAYER));
CV_SetValue(&cv_analog[1], (player->powers[pw_carry] != CR_PLAYER));
break;
}
case CR_GENERIC: // being carried by some generic item
@ -12511,7 +12765,7 @@ void P_PlayerAfterThink(player_t *player)
macecenter->angle += cmd->sidemove<<ANGLETOFINESHIFT;
player->mo->angle += cmd->sidemove<<ANGLETOFINESHIFT; // 2048 --> ANGLE_MAX
if (!demoplayback || P_AnalogMove(player))
if (!demoplayback || P_ControlStyle(player) == CS_LMAOGALOG)
{
if (player == &players[consoleplayer])
localangle = player->mo->angle; // Adjust the local control angle.

View File

@ -571,7 +571,7 @@ static UINT8 *R_GenerateTexture(size_t texnum)
#ifndef NO_PNG_LUMPS
if (R_IsLumpPNG((UINT8 *)realpatch, lumplength))
realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL, false);
realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength, NULL);
else
#endif
#ifdef WALLFLATS
@ -2710,14 +2710,29 @@ void R_PrecacheLevel(void)
for (j = 0; j < sprites[i].numframes; j++)
{
sf = &sprites[i].spriteframes[j];
for (k = 0; k < 8; k++)
#define cacheang(a) {\
lump = sf->lumppat[a];\
if (devparm)\
spritememory += W_LumpLength(lump);\
W_CachePatchNum(lump, PU_PATCH);\
}
// see R_InitSprites for more about lumppat,lumpid
switch (sf->rotate)
{
// see R_InitSprites for more about lumppat,lumpid
lump = sf->lumppat[k];
if (devparm)
spritememory += W_LumpLength(lump);
W_CachePatchNum(lump, PU_PATCH);
case SRF_SINGLE:
cacheang(0);
break;
case SRF_2D:
cacheang(2);
cacheang(6);
break;
default:
k = (sf->rotate & SRF_3DGE ? 16 : 8);
while (k--)
cacheang(k);
break;
}
#undef cacheang
}
}
free(spritepresent);

View File

@ -727,11 +727,8 @@ typedef struct
#ifdef ROTSPRITE
typedef struct
{
patch_t *patch[8][ROTANGLES];
boolean cached[8];
#ifdef HWRENDER
aatree_t *hardware_patch[8];
#endif/*HWRENDER*/
patch_t *patch[16][ROTANGLES];
UINT16 cached;
} rotsprite_t;
#endif/*ROTSPRITE*/
@ -739,9 +736,11 @@ typedef enum
{
SRF_SINGLE = 0, // 0-angle for all rotations
SRF_3D = 1, // Angles 1-8
SRF_LEFT = 2, // Left side uses single patch
SRF_RIGHT = 4, // Right side uses single patch
SRF_2D = SRF_LEFT|SRF_RIGHT, // 6
SRF_3DGE = 2, // 3DGE, ZDoom and Doom Legacy all have 16-angle support. Why not us?
SRF_3DMASK = SRF_3D|SRF_3DGE, // 3
SRF_LEFT = 4, // Left side uses single patch
SRF_RIGHT = 8, // Right side uses single patch
SRF_2D = SRF_LEFT|SRF_RIGHT, // 12
SRF_NONE = 0xff // Initial value
} spriterotateflags_t; // SRF's up!
@ -767,7 +766,7 @@ typedef struct patchinfo_s patchinfo_t;
// Sprites are patches with a special naming convention so they can be
// recognized by R_InitSprites.
// The base name is NNNNFx or NNNNFxFx, with x indicating the rotation,
// x = 0, 1-8, L/R
// x = 0, 1-8, 9+A-G, L/R
// The sprite and frame specified by a thing_t is range checked at run time.
// A sprite is a patch_t that is assumed to represent a three dimensional
// object and may have multiple rotations predrawn.
@ -784,12 +783,12 @@ typedef struct
// name eight times.
UINT8 rotate; // see spriterotateflags_t above
// Lump to use for view angles 0-7.
lumpnum_t lumppat[8]; // lump number 16 : 16 wad : lump
size_t lumpid[8]; // id in the spriteoffset, spritewidth, etc. tables
// Lump to use for view angles 0-7/15.
lumpnum_t lumppat[16]; // lump number 16 : 16 wad : lump
size_t lumpid[16]; // id in the spriteoffset, spritewidth, etc. tables
// Flip bits (1 = flip) to use for view angles 0-7.
UINT8 flip;
// Flip bits (1 = flip) to use for view angles 0-7/15.
UINT16 flip;
#ifdef ROTSPRITE
rotsprite_t rotsprite;

View File

@ -187,20 +187,20 @@ void SplitScreen_OnChange(void)
static void ChaseCam_OnChange(void)
{
if (!cv_chasecam.value || !cv_useranalog.value)
CV_SetValue(&cv_analog, 0);
if (!cv_chasecam.value || !cv_useranalog[0].value)
CV_SetValue(&cv_analog[0], 0);
else
CV_SetValue(&cv_analog, 1);
CV_SetValue(&cv_analog[0], 1);
}
static void ChaseCam2_OnChange(void)
{
if (botingame)
return;
if (!cv_chasecam2.value || !cv_useranalog2.value)
CV_SetValue(&cv_analog2, 0);
if (!cv_chasecam2.value || !cv_useranalog[1].value)
CV_SetValue(&cv_analog[1], 0);
else
CV_SetValue(&cv_analog2, 1);
CV_SetValue(&cv_analog[1], 1);
}
static void FlipCam_OnChange(void)
@ -1234,6 +1234,16 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_cam2_orbit);
CV_RegisterVar(&cv_cam2_adjust);
CV_RegisterVar(&cv_cam_savedist[0][0]);
CV_RegisterVar(&cv_cam_savedist[0][1]);
CV_RegisterVar(&cv_cam_savedist[1][0]);
CV_RegisterVar(&cv_cam_savedist[1][1]);
CV_RegisterVar(&cv_cam_saveheight[0][0]);
CV_RegisterVar(&cv_cam_saveheight[0][1]);
CV_RegisterVar(&cv_cam_saveheight[1][0]);
CV_RegisterVar(&cv_cam_saveheight[1][1]);
CV_RegisterVar(&cv_showhud);
CV_RegisterVar(&cv_translucenthud);

View File

@ -2,8 +2,8 @@
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 2005-2009 by Andrey "entryway" Budko.
// Copyright (C) 2018-2019 by Jaime "Lactozilla" Passos.
// Copyright (C) 2019 by Sonic Team Junior.
// Copyright (C) 2018-2020 by Jaime "Lactozilla" Passos.
// Copyright (C) 2019-2020 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
@ -199,11 +199,15 @@ void R_PatchToFlat(patch_t *patch, UINT8 *flat)
}
//
// R_PatchToFlat_16bpp
// R_PatchToMaskedFlat
//
// Convert a patch to a 16-bit flat.
// Convert a patch to a masked flat.
// Now, what is a "masked" flat anyway?
// It means the flat uses two bytes to store image data.
// The upper byte is used to store the transparent pixel,
// and the lower byte stores a palette index.
//
void R_PatchToFlat_16bpp(patch_t *patch, UINT16 *raw, boolean flip)
void R_PatchToMaskedFlat(patch_t *patch, UINT16 *raw, boolean flip)
{
fixed_t col, ofs;
column_t *column;
@ -248,6 +252,9 @@ patch_t *R_FlatToPatch(UINT8 *raw, UINT16 width, UINT16 height, UINT16 leftoffse
UINT8 *colpointers, *startofspan;
size_t size = 0;
if (!raw)
return NULL;
// Write image size and offset
WRITEINT16(imgptr, width);
WRITEINT16(imgptr, height);
@ -347,16 +354,18 @@ patch_t *R_FlatToPatch(UINT8 *raw, UINT16 width, UINT16 height, UINT16 leftoffse
}
//
// R_FlatToPatch_16bpp
// R_MaskedFlatToPatch
//
// Convert a 16-bit flat to a patch.
// Convert a masked flat to a patch.
// Explanation of "masked" flats in R_PatchToMaskedFlat.
//
patch_t *R_FlatToPatch_16bpp(UINT16 *raw, UINT16 width, UINT16 height, size_t *size)
patch_t *R_MaskedFlatToPatch(UINT16 *raw, UINT16 width, UINT16 height, UINT16 leftoffset, UINT16 topoffset, size_t *destsize)
{
UINT32 x, y;
UINT8 *img;
UINT8 *imgptr = imgbuf;
UINT8 *colpointers, *startofspan;
size_t size = 0;
if (!raw)
return NULL;
@ -364,9 +373,8 @@ patch_t *R_FlatToPatch_16bpp(UINT16 *raw, UINT16 width, UINT16 height, size_t *s
// Write image size and offset
WRITEINT16(imgptr, width);
WRITEINT16(imgptr, height);
// no offsets
WRITEINT16(imgptr, 0);
WRITEINT16(imgptr, 0);
WRITEINT16(imgptr, leftoffset);
WRITEINT16(imgptr, topoffset);
// Leave placeholder to column pointers
colpointers = imgptr;
@ -450,9 +458,12 @@ patch_t *R_FlatToPatch_16bpp(UINT16 *raw, UINT16 width, UINT16 height, size_t *s
WRITEUINT8(imgptr, 0xFF);
}
*size = imgptr-imgbuf;
img = Z_Malloc(*size, PU_STATIC, NULL);
memcpy(img, imgbuf, *size);
size = imgptr-imgbuf;
img = Z_Malloc(size, PU_STATIC, NULL);
memcpy(img, imgbuf, size);
if (destsize != NULL)
*destsize = size;
return (patch_t *)img;
}
@ -675,6 +686,41 @@ static UINT8 *PNG_RawConvert(const UINT8 *png, UINT16 *w, UINT16 *h, INT16 *topo
return flat;
}
// Convert a PNG with transparency to a raw image.
static UINT16 *PNG_MaskedRawConvert(const UINT8 *png, UINT16 *w, UINT16 *h, INT16 *topoffset, INT16 *leftoffset, size_t size)
{
UINT16 *flat;
png_uint_32 x, y;
png_bytep *row_pointers = PNG_Read(png, w, h, topoffset, leftoffset, size);
png_uint_32 width = *w, height = *h;
size_t flatsize, i;
if (!row_pointers)
I_Error("PNG_MaskedRawConvert: conversion failed");
// Convert the image to 16bpp
flatsize = (width * height);
flat = Z_Malloc(flatsize * sizeof(UINT16), PU_LEVEL, NULL);
// can't memset here
for (i = 0; i < flatsize; i++)
flat[i] = 0xFF00;
for (y = 0; y < height; y++)
{
png_bytep row = row_pointers[y];
for (x = 0; x < width; x++)
{
png_bytep px = &(row[x * 4]);
if ((UINT8)px[3])
flat[((y * width) + x)] = NearestColor((UINT8)px[0], (UINT8)px[1], (UINT8)px[2]);
}
}
free(row_pointers);
return flat;
}
//
// R_PNGToFlat
//
@ -690,16 +736,16 @@ UINT8 *R_PNGToFlat(UINT16 *width, UINT16 *height, UINT8 *png, size_t size)
//
// Convert a PNG to a patch.
//
patch_t *R_PNGToPatch(const UINT8 *png, size_t size, size_t *destsize, boolean transparency)
patch_t *R_PNGToPatch(const UINT8 *png, size_t size, size_t *destsize)
{
UINT16 width, height;
INT16 topoffset = 0, leftoffset = 0;
UINT8 *raw = PNG_RawConvert(png, &width, &height, &topoffset, &leftoffset, size);
UINT16 *raw = PNG_MaskedRawConvert(png, &width, &height, &topoffset, &leftoffset, size);
if (!raw)
I_Error("R_PNGToPatch: conversion failed");
return R_FlatToPatch(raw, width, height, leftoffset, topoffset, destsize, transparency);
return R_MaskedFlatToPatch(raw, width, height, leftoffset, topoffset, destsize);
}
//
@ -1150,7 +1196,7 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
INT32 angle;
patch_t *patch;
patch_t *newpatch;
UINT16 *rawdst;
UINT16 *rawsrc, *rawdst;
size_t size;
INT32 bflip = (flip != 0x00);
@ -1159,7 +1205,7 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
#define ROTSPRITE_XCENTER (newwidth / 2)
#define ROTSPRITE_YCENTER (newheight / 2)
if (!sprframe->rotsprite.cached[rot])
if (!(sprframe->rotsprite.cached & (1<<rot)))
{
INT32 dx, dy;
INT32 px, py;
@ -1196,6 +1242,17 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
leftoffset = width - leftoffset;
}
// Draw the sprite to a temporary buffer.
size = (width*height);
rawsrc = Z_Malloc(size * sizeof(UINT16), PU_STATIC, NULL);
// can't memset here
for (i = 0; i < size; i++)
rawsrc[i] = 0xFF00;
R_PatchToMaskedFlat(patch, rawsrc, bflip);
// Don't cache angle = 0
for (angle = 1; angle < ROTANGLES; angle++)
{
INT32 newwidth, newheight;
@ -1287,7 +1344,7 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
}
// make patch
newpatch = R_FlatToPatch_16bpp(rawdst, newwidth, newheight, &size);
newpatch = R_MaskedFlatToPatch(rawdst, newwidth, newheight, 0, 0, &size);
{
newpatch->leftoffset = (newpatch->width / 2) + (leftoffset - px);
newpatch->topoffset = (newpatch->height / 2) + (patch->topoffset - py);
@ -1303,9 +1360,11 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
#ifdef HWRENDER
if (rendermode == render_opengl)
{
GLPatch_t *grPatch = HWR_GetCachedGLRotSprite(sprframe->rotsprite.hardware_patch[rot], angle, newpatch);
HWR_MakePatch(newpatch, grPatch, grPatch->mipmap, false);
GLPatch_t *grPatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
grPatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
grPatch->rawpatch = newpatch;
sprframe->rotsprite.patch[rot][angle] = (patch_t *)grPatch;
HWR_MakePatch(newpatch, grPatch, grPatch->mipmap, false);
}
else
#endif // HWRENDER
@ -1316,7 +1375,7 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
}
// This rotation is cached now
sprframe->rotsprite.cached[rot] = true;
sprframe->rotsprite.cached |= (1<<rot);
// free image data
Z_Free(patch);
@ -1340,9 +1399,9 @@ void R_FreeSingleRotSprite(spritedef_t *spritedef)
for (frame = 0; frame < spritedef->numframes; frame++)
{
spriteframe_t *sprframe = &spritedef->spriteframes[frame];
for (rot = 0; rot < 8; rot++)
for (rot = 0; rot < 16; rot++)
{
if (sprframe->rotsprite.cached[rot])
if (sprframe->rotsprite.cached & (1<<rot))
{
for (ang = 0; ang < ROTANGLES; ang++)
{
@ -1373,7 +1432,7 @@ void R_FreeSingleRotSprite(spritedef_t *spritedef)
Z_Free(rotsprite);
}
}
sprframe->rotsprite.cached[rot] = false;
sprframe->rotsprite.cached &= ~(1<<rot);
}
}
}

View File

@ -41,9 +41,9 @@ typedef struct
boolean R_CheckIfPatch(lumpnum_t lump);
void R_TextureToFlat(size_t tex, UINT8 *flat);
void R_PatchToFlat(patch_t *patch, UINT8 *flat);
void R_PatchToFlat_16bpp(patch_t *patch, UINT16 *raw, boolean flip);
void R_PatchToMaskedFlat(patch_t *patch, UINT16 *raw, boolean flip);
patch_t *R_FlatToPatch(UINT8 *raw, UINT16 width, UINT16 height, UINT16 leftoffset, UINT16 topoffset, size_t *destsize, boolean transparency);
patch_t *R_FlatToPatch_16bpp(UINT16 *raw, UINT16 width, UINT16 height, size_t *size);
patch_t *R_MaskedFlatToPatch(UINT16 *raw, UINT16 width, UINT16 height, UINT16 leftoffset, UINT16 topoffset, size_t *destsize);
// Portable Network Graphics
boolean R_IsLumpPNG(const UINT8 *d, size_t s);
@ -51,7 +51,7 @@ boolean R_IsLumpPNG(const UINT8 *d, size_t s);
#ifndef NO_PNG_LUMPS
UINT8 *R_PNGToFlat(UINT16 *width, UINT16 *height, UINT8 *png, size_t size);
patch_t *R_PNGToPatch(const UINT8 *png, size_t size, size_t *destsize, boolean transparency);
patch_t *R_PNGToPatch(const UINT8 *png, size_t size, size_t *destsize);
boolean R_PNGDimensions(UINT8 *png, INT16 *width, INT16 *height, size_t size);
#endif

View File

@ -105,29 +105,23 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch
UINT8 rotation,
UINT8 flipped)
{
char cn = R_Frame2Char(frame); // for debugging
char cn = R_Frame2Char(frame), cr = R_Rotation2Char(rotation); // for debugging
INT32 r, ang;
lumpnum_t lumppat = wad;
lumppat <<= 16;
lumppat += lump;
if (frame >= 64 || !(R_ValidSpriteAngle(rotation)))
I_Error("R_InstallSpriteLump: Bad frame characters in lump %s", W_CheckNameForNum(lumppat));
if (maxframe ==(size_t)-1 || frame > maxframe)
maxframe = frame;
// rotsprite
#ifdef ROTSPRITE
for (r = 0; r < 8; r++)
sprtemp[frame].rotsprite.cached = 0;
for (r = 0; r < 16; r++)
{
sprtemp[frame].rotsprite.cached[r] = false;
for (ang = 0; ang < ROTANGLES; ang++)
sprtemp[frame].rotsprite.patch[r][ang] = NULL;
#ifdef HWRENDER
sprtemp[frame].rotsprite.hardware_patch[r] = M_AATreeAlloc(AATREE_ZUSER);
#endif/*HWRENDER*/
}
#endif/*ROTSPRITE*/
@ -136,16 +130,16 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch
// the lump should be used for all rotations
if (sprtemp[frame].rotate == SRF_SINGLE)
CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has multiple rot = 0 lump\n", spritename, cn);
else if (sprtemp[frame].rotate != SRF_NONE) // Let's bundle 1-8 and L/R rotations into one debug message.
else if (sprtemp[frame].rotate != SRF_NONE) // Let's bundle 1-8/16 and L/R rotations into one debug message.
CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has rotations and a rot = 0 lump\n", spritename, cn);
sprtemp[frame].rotate = SRF_SINGLE;
for (r = 0; r < 8; r++)
for (r = 0; r < 16; r++)
{
sprtemp[frame].lumppat[r] = lumppat;
sprtemp[frame].lumpid[r] = lumpid;
}
sprtemp[frame].flip = flipped ? 0xFF : 0; // 11111111 in binary
sprtemp[frame].flip = flipped ? 0xFFFF : 0; // 1111111111111111 in binary
return;
}
@ -154,54 +148,67 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch
UINT8 rightfactor = ((rotation == ROT_R) ? 4 : 0);
// the lump should be used for half of all rotations
if (sprtemp[frame].rotate == SRF_SINGLE)
if (sprtemp[frame].rotate == SRF_NONE)
sprtemp[frame].rotate = SRF_SINGLE;
else if (sprtemp[frame].rotate == SRF_SINGLE)
CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has L/R rotations and a rot = 0 lump\n", spritename, cn);
else if (sprtemp[frame].rotate == SRF_3D)
CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has both L/R and 1-8 rotations\n", spritename, cn);
else if (sprtemp[frame].rotate == SRF_3DGE)
CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has both L/R and 1-G rotations\n", spritename, cn);
else if ((sprtemp[frame].rotate & SRF_LEFT) && (rotation == ROT_L))
CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has multiple L rotations\n", spritename, cn);
else if ((sprtemp[frame].rotate & SRF_RIGHT) && (rotation == ROT_R))
CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has multiple R rotations\n", spritename, cn);
if (sprtemp[frame].rotate == SRF_NONE)
sprtemp[frame].rotate = SRF_SINGLE;
sprtemp[frame].rotate |= ((rotation == ROT_R) ? SRF_RIGHT : SRF_LEFT);
if (sprtemp[frame].rotate == (SRF_3D|SRF_2D))
sprtemp[frame].rotate = SRF_2D; // SRF_3D|SRF_2D being enabled at the same time doesn't HURT in the current sprite angle implementation, but it DOES mean more to check in some of the helper functions. Let's not allow this scenario to happen.
if ((sprtemp[frame].rotate & SRF_2D) == SRF_2D)
sprtemp[frame].rotate &= ~SRF_3DMASK; // SRF_3D|SRF_2D being enabled at the same time doesn't HURT in the current sprite angle implementation, but it DOES mean more to check in some of the helper functions. Let's not allow this scenario to happen.
for (r = 0; r < 4; r++) // Thanks to R_PrecacheLevel, we can't leave sprtemp[*].lumppat[*] == LUMPERROR... so we load into the front/back angle too.
// load into every relevant angle, including the front one
for (r = 0; r < 4; r++)
{
sprtemp[frame].lumppat[r + rightfactor] = lumppat;
sprtemp[frame].lumpid[r + rightfactor] = lumpid;
sprtemp[frame].lumppat[r + rightfactor + 8] = lumppat;
sprtemp[frame].lumpid[r + rightfactor + 8] = lumpid;
}
if (flipped)
sprtemp[frame].flip |= (0x0F<<rightfactor); // 00001111 or 11110000 in binary, depending on rotation being ROT_L or ROT_R
sprtemp[frame].flip |= (0x0F0F<<rightfactor); // 0000111100001111 or 1111000011110000 in binary, depending on rotation being ROT_L or ROT_R
else
sprtemp[frame].flip &= ~(0x0F<<rightfactor); // ditto
sprtemp[frame].flip &= ~(0x0F0F<<rightfactor); // ditto
return;
}
// the lump is only used for one rotation
if (sprtemp[frame].rotate == SRF_SINGLE)
CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has 1-8 rotations and a rot = 0 lump\n", spritename, cn);
else if ((sprtemp[frame].rotate != SRF_3D) && (sprtemp[frame].rotate != SRF_NONE))
CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has both L/R and 1-8 rotations\n", spritename, cn);
if (sprtemp[frame].rotate == SRF_NONE)
sprtemp[frame].rotate = SRF_SINGLE;
else if (sprtemp[frame].rotate == SRF_SINGLE)
CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has 1-8/G rotations and a rot = 0 lump\n", spritename, cn);
else if (sprtemp[frame].rotate & SRF_2D)
CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s frame %c has both L/R and 1-8/G rotations\n", spritename, cn);
// make 0 based
rotation--;
if (rotation == 0 || rotation == 4) // Front or back...
sprtemp[frame].rotate = SRF_3D; // Prevent L and R changeover
else if (rotation > 3) // Right side
sprtemp[frame].rotate = (SRF_3D | (sprtemp[frame].rotate & SRF_LEFT)); // Continue allowing L frame changeover
else // if (rotation <= 3) // Left side
sprtemp[frame].rotate = (SRF_3D | (sprtemp[frame].rotate & SRF_RIGHT)); // Continue allowing R frame changeover
{
// SRF_3D|SRF_3DGE being enabled at the same time doesn't HURT in the current sprite angle implementation, but it DOES mean more to check in some of the helper functions. Let's not allow this scenario to happen.
UINT8 threedrot = (rotation > 7) ? SRF_3DGE : (sprtemp[frame].rotate & SRF_3DMASK);
if (!threedrot)
threedrot = SRF_3D;
if (rotation == 0 || rotation == 4) // Front or back...
sprtemp[frame].rotate = threedrot; // Prevent L and R changeover
else if ((rotation & 7) > 3) // Right side
sprtemp[frame].rotate = (threedrot | (sprtemp[frame].rotate & SRF_LEFT)); // Continue allowing L frame changeover
else // if ((rotation & 7) <= 3) // Left side
sprtemp[frame].rotate = (threedrot | (sprtemp[frame].rotate & SRF_RIGHT)); // Continue allowing R frame changeover
}
if (sprtemp[frame].lumppat[rotation] != LUMPERROR)
CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s: %c%c has two lumps mapped to it\n", spritename, cn, '1'+rotation);
CONS_Debug(DBG_SETUP, "R_InitSprites: Sprite %s: %c%c has two lumps mapped to it\n", spritename, cn, cr);
// lumppat & lumpid are the same for original Doom, but different
// when using sprites in pwad : the lumppat points the new graphics
@ -262,9 +269,9 @@ static boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef,
if (memcmp(lumpinfo[l].name,sprname,4)==0)
{
frame = R_Char2Frame(lumpinfo[l].name[4]);
rotation = (UINT8)(lumpinfo[l].name[5] - '0');
rotation = R_Char2Rotation(lumpinfo[l].name[5]);
if (frame >= 64 || !(R_ValidSpriteAngle(rotation))) // Give an actual NAME error -_-...
if (frame >= 64 || rotation == 255) // Give an actual NAME error -_-...
{
CONS_Alert(CONS_WARNING, M_GetText("Bad sprite name: %s\n"), W_CheckNameForNumPwad(wadnum,l));
continue;
@ -284,7 +291,7 @@ static boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef,
// lump is a png so convert it
if (R_IsLumpPNG((UINT8 *)png, len))
{
png = R_PNGToPatch((UINT8 *)png, len, NULL, true);
png = R_PNGToPatch((UINT8 *)png, len, NULL);
M_Memcpy(&patch, png, sizeof(INT16)*4);
}
Z_Free(png);
@ -311,7 +318,13 @@ static boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef,
if (lumpinfo[l].name[6])
{
frame = R_Char2Frame(lumpinfo[l].name[6]);
rotation = (UINT8)(lumpinfo[l].name[7] - '0');
rotation = R_Char2Rotation(lumpinfo[l].name[7]);
if (frame >= 64 || rotation == 255) // Give an actual NAME error -_-...
{
CONS_Alert(CONS_WARNING, M_GetText("Bad sprite name: %s\n"), W_CheckNameForNumPwad(wadnum,l));
continue;
}
R_InstallSpriteLump(wadnum, l, numspritelumps, frame, rotation, 1);
}
@ -372,18 +385,19 @@ static boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef,
case SRF_2D: // both Left and Right rotations
// we test to see whether the left and right slots are present
if ((sprtemp[frame].lumppat[2] == LUMPERROR) || (sprtemp[frame].lumppat[6] == LUMPERROR))
I_Error("R_AddSingleSpriteDef: Sprite %.4s frame %c is missing rotations",
I_Error("R_AddSingleSpriteDef: Sprite %.4s frame %c is missing rotations (L-R mode)",
sprname, R_Frame2Char(frame));
break;
default:
// must have all 8 frames
for (rotation = 0; rotation < 8; rotation++)
// must have all 8/16 frames
rotation = ((sprtemp[frame].rotate & SRF_3DGE) ? 16 : 8);
while (rotation--)
// we test the patch lump, or the id lump whatever
// if it was not loaded the two are LUMPERROR
if (sprtemp[frame].lumppat[rotation] == LUMPERROR)
I_Error("R_AddSingleSpriteDef: Sprite %.4s frame %c is missing rotations",
sprname, R_Frame2Char(frame));
I_Error("R_AddSingleSpriteDef: Sprite %.4s frame %c is missing rotations (1-%c mode)",
sprname, R_Frame2Char(frame), ((sprtemp[frame].rotate & SRF_3DGE) ? 'G' : '8'));
break;
}
}
@ -1097,7 +1111,7 @@ static void R_ProjectSprite(mobj_t *thing)
size_t lump;
size_t rot;
UINT8 flip;
UINT16 flip;
boolean vflip = (!(thing->eflags & MFE_VERTICALFLIP) != !(thing->frame & FF_VERTICALFLIP));
INT32 lindex;
@ -1227,7 +1241,7 @@ static void R_ProjectSprite(mobj_t *thing)
// use single rotation for all views
rot = 0; //Fab: for vis->patch below
lump = sprframe->lumpid[0]; //Fab: see note above
flip = sprframe->flip; // Will only be 0x00 or 0xFF
flip = sprframe->flip; // Will only be 0 or 0xFFFF
}
else
{
@ -1238,6 +1252,11 @@ static void R_ProjectSprite(mobj_t *thing)
rot = 6; // F7 slot
else if ((sprframe->rotate & SRF_LEFT) && (ang >= ANGLE_180)) // See from left
rot = 2; // F3 slot
else if (sprframe->rotate & SRF_3DGE) // 16-angle mode
{
rot = (ang+ANGLE_180+ANGLE_11hh)>>28;
rot = ((rot & 1)<<3)|(rot>>1);
}
else // Normal behaviour
rot = (ang+ANGLE_202h)>>29;
@ -1260,7 +1279,7 @@ static void R_ProjectSprite(mobj_t *thing)
if (thing->rollangle)
{
rollangle = R_GetRollAngle(thing->rollangle);
if (!sprframe->rotsprite.cached[rot])
if (!(sprframe->rotsprite.cached & (1<<rot)))
R_CacheRotSprite(thing->sprite, (thing->frame & FF_FRAMEMASK), sprinfo, sprframe, rot, flip);
rotsprite = sprframe->rotsprite.patch[rot][rollangle];
if (rotsprite != NULL)

View File

@ -20,10 +20,6 @@
#include "r_portal.h"
#include "r_defs.h"
// "Left" and "Right" character symbols for additional rotation functionality
#define ROT_L ('L' - '0')
#define ROT_R ('R' - '0')
// number of sprite lumps for spritewidth,offset,topoffset lookup tables
// Fab: this is a hack : should allocate the lookup tables per sprite
#define MAXVISSPRITES 2048 // added 2-2-98 was 128
@ -270,7 +266,7 @@ FUNCMATH FUNCINLINE static ATTRINLINE UINT8 R_Char2Frame(char cn)
if (cn == '+') return '\\' - 'A'; // PK3 can't use backslash, so use + instead
return cn - 'A';
#else
if (cn >= 'A' && cn <= 'Z') return cn - 'A';
if (cn >= 'A' && cn <= 'Z') return (cn - 'A');
if (cn >= '0' && cn <= '9') return (cn - '0') + 26;
if (cn >= 'a' && cn <= 'z') return (cn - 'a') + 36;
if (cn == '!') return 62;
@ -279,9 +275,26 @@ FUNCMATH FUNCINLINE static ATTRINLINE UINT8 R_Char2Frame(char cn)
#endif
}
FUNCMATH FUNCINLINE static ATTRINLINE boolean R_ValidSpriteAngle(UINT8 rotation)
// "Left" and "Right" character symbols for additional rotation functionality
#define ROT_L 17
#define ROT_R 18
FUNCMATH FUNCINLINE static ATTRINLINE char R_Rotation2Char(UINT8 rot)
{
return ((rotation <= 8) || (rotation == ROT_L) || (rotation == ROT_R));
if (rot <= 9) return '0' + rot;
if (rot <= 16) return 'A' + (rot - 10);
if (rot == ROT_L) return 'L';
if (rot == ROT_R) return 'R';
return '\xFF';
}
FUNCMATH FUNCINLINE static ATTRINLINE UINT8 R_Char2Rotation(char cn)
{
if (cn >= '0' && cn <= '9') return (cn - '0');
if (cn >= 'A' && cn <= 'G') return (cn - 'A') + 10;
if (cn == 'L') return ROT_L;
if (cn == 'R') return ROT_R;
return 255;
}
#endif //__R_THINGS__

View File

@ -1179,10 +1179,20 @@ static void ST_drawInput(void)
"AUTOBRAKE");
y -= 8;
}
if (stplyr->pflags & PF_ANALOGMODE)
switch (P_ControlStyle(stplyr))
{
case CS_LMAOGALOG:
V_DrawThinString(x, y, hudinfo[HUD_LIVES].f, "ANALOG");
y -= 8;
break;
case CS_SIMPLE:
V_DrawThinString(x, y, hudinfo[HUD_LIVES].f, "SIMPLE");
y -= 8;
break;
default:
break;
}
}
if (!demosynced) // should always be last, so it doesn't push anything else around
@ -2198,7 +2208,7 @@ static void ST_drawTextHUD(void)
#define textHUDdraw(str) \
{\
V_DrawThinString(16, y, V_PERPLAYER|V_HUDTRANS|V_SNAPTOLEFT|V_SNAPTOBOTTOM, str);\
V_DrawThinString(16, y, V_PERPLAYER|V_HUDTRANS|V_SNAPTOLEFT|V_SNAPTOTOP, str);\
y += 8;\
}

View File

@ -1470,6 +1470,21 @@ boolean W_IsPatchCached(lumpnum_t lumpnum, void *ptr)
return W_IsPatchCachedPWAD(WADFILENUM(lumpnum),LUMPNUM(lumpnum), ptr);
}
void W_FlushCachedPatches(void)
{
if (needpatchflush)
{
Z_FreeTag(PU_CACHE);
Z_FreeTag(PU_PATCH);
Z_FreeTag(PU_HUDGFX);
Z_FreeTag(PU_HWRPATCHINFO);
Z_FreeTag(PU_HWRMODELTEXTURE);
Z_FreeTag(PU_HWRCACHE);
Z_FreeTags(PU_HWRCACHE_UNLOCKED, PU_HWRPATCHINFO_UNLOCKED);
}
needpatchflush = false;
}
// ==========================================================================
// W_CacheLumpName
// ==========================================================================
@ -1493,22 +1508,6 @@ void *W_CacheLumpName(const char *name, INT32 tag)
// Cache a patch into heap memory, convert the patch format as necessary
//
void W_FlushCachedPatches(void)
{
if (needpatchflush)
{
Z_FreeTag(PU_CACHE);
Z_FreeTag(PU_PATCH);
Z_FreeTag(PU_HUDGFX);
Z_FreeTag(PU_HWRPATCHINFO);
Z_FreeTag(PU_HWRMODELTEXTURE);
Z_FreeTag(PU_HWRCACHE);
Z_FreeTags(PU_HWRCACHE_UNLOCKED, PU_HWRPATCHINFO_UNLOCKED);
}
needpatchflush = false;
}
// Software-only compile cache the data without conversion
void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
{
#ifdef HWRENDER
@ -1546,7 +1545,7 @@ void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
if (R_IsLumpPNG((UINT8 *)lumpdata, len))
{
size_t newlen;
srcdata = R_PNGToPatch((UINT8 *)lumpdata, len, &newlen, true);
srcdata = R_PNGToPatch((UINT8 *)lumpdata, len, &newlen);
ptr = Z_Realloc(ptr, newlen, tag, &lumpcache[lump]);
M_Memcpy(ptr, srcdata, newlen);
Z_Free(srcdata);