Merge branch SRB2:next into fix-slope-convex-sectors

This commit is contained in:
Logan Aerl Arias 2023-12-31 17:13:23 +00:00
commit b438392d63
13 changed files with 151 additions and 14 deletions

View file

@ -16,7 +16,7 @@ set GIT=%2
if "%GIT%"=="" set GIT=git
for /f "tokens=* usebackq" %%s in (`%GIT% rev-parse --abbrev-ref HEAD`) do @set BRA=%%s
for /f "tokens=* usebackq" %%s in (`%GIT% rev-parse HEAD`) do @set REV=%%s
for /f "tokens=* usebackq" %%s in (`%GIT% log -1 --format^=%%s`) do @set GL1=%%s
for /f "tokens=* usebackq" %%s in (`%GIT% log -1 --format^=%%f`) do @set GL1=%%s
set REV=%REV:~0,8%
goto filwri

View file

@ -19,7 +19,7 @@ EOF
versiongit() {
gitbranch="$(git rev-parse --abbrev-ref HEAD)"
gitversion="$(git rev-parse HEAD | cut -c -8)"
gitsubject="$(git log -1 --format=%s)"
gitsubject="$(git log -1 --format=%f)"
version "$gitbranch" "$gitversion" "$gitsubject";
exit 0
}

View file

@ -220,13 +220,16 @@ static char *bindtable[NUMINPUTS];
static void CONS_Bind_f(void)
{
size_t na;
char *newcmd;
//size_t newlen = 0;
unsigned int i;
INT32 key;
na = COM_Argc();
if (na != 2 && na != 3)
if (na < 2)
{
CONS_Printf(M_GetText("bind <keyname> [<command>]: create shortcut keys to command(s)\n"));
CONS_Printf(M_GetText("bind <keyname> [<command>] [<arg1>] [...]: create shortcut keys to command(s)\n"));
CONS_Printf("\x82%s", M_GetText("Bind table :\n"));
na = 0;
for (key = 0; key < NUMINPUTS; key++)
@ -250,8 +253,36 @@ static void CONS_Bind_f(void)
Z_Free(bindtable[key]);
bindtable[key] = NULL;
if (na == 3)
bindtable[key] = Z_StrDup(COM_Argv(2));
if (na < 3)
return;
for (i = 2; i < na; ++i)
{
const char *arg = COM_Argv(i);
// on the second iteration, and after
if (i > 2)
{
size_t newlen = strlen(bindtable[key]) + strlen(arg) + 1; // new length, allow space for ' ' and '\0'
size_t curpos = newcmd - bindtable[key]; // offset from newcmd to original pointer
newcmd = bindtable[key] = Z_Realloc(bindtable[key], newlen, PU_STATIC, NULL);
newcmd += curpos; // reapply offset
newcmd[0] = ' '; // replace previous '\0' w/ ' '
++newcmd; // make sure later strcpy doesnt overwrite ' '
}
// first iteration
else
// allocate space for argument and a ' ' or '\0'
newcmd = bindtable[key] = Z_Calloc(strlen(arg) + 1, PU_STATIC, NULL);
// the copy
strcpy(newcmd, arg);
// move window past copied argument for next iteration
newcmd += strlen(arg);
}
}
//======================================================================

View file

@ -370,8 +370,9 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi
"S_XDEATHSTATE",
"S_RAISESTATE",
// Thok
// Thok effect and spin trail
"S_THOK",
"S_THOKEFFECT",
// Player
"S_PLAY_STND",
@ -3560,7 +3561,8 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t
"MT_NULL",
"MT_UNKNOWN",
"MT_THOK", // Thok! mobj
"MT_THOK", // Spin trail mobj
"MT_THOKEFFECT", // Thok boom effect
"MT_PLAYER",
"MT_TAILSOVERLAY", // c:
"MT_METALJETFUME",

View file

@ -801,6 +801,19 @@ void G_GhostTicker(void)
if (!P_MobjWasRemoved(mobj))
mobj->frame = (mobj->frame & ~FF_FRAMEMASK)|tr_trans60<<FF_TRANSSHIFT; // P_SpawnGhostMobj sets trans50, we want trans60
}
else if (type == MT_THOKEFFECT)
{
mobj = P_SpawnMobjFromMobj(g->mo, 0, 0, FixedDiv(g->mo->height, g->mo->scale)*3/4, type);
mobj->angle = g->mo->angle + ANGLE_90;
mobj->fuse = 7;
mobj->scale = g->mo->scale / 3;
mobj->destscale = 10 * g->mo->scale;
mobj->colorized = true;
mobj->color = g->mo->color;
mobj->momx = -g->mo->momx / 2;
mobj->momy = -g->mo->momy / 2;
}
else
{
mobj = P_SpawnMobjFromMobj(g->mo, 0, 0, -FixedDiv(FixedMul(g->mo->info->height, g->mo->scale) - g->mo->height,3*FRACUNIT), MT_THOK);
@ -1107,6 +1120,18 @@ void G_ReadMetalTic(mobj_t *metal)
{
mobj = P_SpawnGhostMobj(metal); // does a large portion of the work for us
}
else if (type == MT_THOKEFFECT)
{
mobj = P_SpawnMobjFromMobj(metal, 0, 0, FixedDiv(metal->height, metal->scale)*3/4, type);
mobj->angle = metal->angle + ANGLE_90;
mobj->fuse = 7;
mobj->scale = metal->scale / 3;
mobj->destscale = 10 * metal->scale;
mobj->colorized = true;
mobj->color = metal->color;
mobj->momx = -metal->momx / 2;
mobj->momy = -metal->momy / 2;
}
else
{
mobj = P_SpawnMobjFromMobj(metal, 0, 0, -FixedDiv(FixedMul(metal->info->height, metal->scale) - metal->height,3*FRACUNIT), MT_THOK);

View file

@ -283,6 +283,7 @@ enum hwdsetspecialstate
HWD_SET_SHADERS,
HWD_SET_TEXTUREFILTERMODE,
HWD_SET_TEXTUREANISOTROPICMODE,
HWD_SET_WIREFRAME,
HWD_NUMSTATE
};

View file

@ -138,6 +138,7 @@ light_t *t_lspr[NUMSPRITES] =
&lspr[NOLIGHT], // SPR_UNKN
&lspr[NOLIGHT], // SPR_THOK
&lspr[NOLIGHT], // SPR_THKE
&lspr[SUPERSONIC_L],// SPR_PLAY
// Enemies

View file

@ -180,6 +180,11 @@ static boolean HWR_UseShader(void)
return (cv_glshaders.value && gl_shadersavailable);
}
static boolean HWR_IsWireframeMode(void)
{
return (cv_glwireframe.value && cv_debug);
}
void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap)
{
RGBA_t poly_color, tint_color, fade_color;
@ -5915,6 +5920,9 @@ void HWR_BuildSkyDome(void)
static void HWR_DrawSkyBackground(player_t *player)
{
if (HWR_IsWireframeMode())
return;
HWD.pfnSetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
if (cv_glskydome.value)
@ -6271,6 +6279,9 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player)
// Reset the shader state.
HWR_SetShaderState();
if (HWR_IsWireframeMode())
HWD.pfnSetSpecialState(HWD_SET_WIREFRAME, 1);
validcount++;
if (cv_glbatching.value)
@ -6333,6 +6344,9 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player)
HWR_CreateDrawNodes();
}
if (HWR_IsWireframeMode())
HWD.pfnSetSpecialState(HWD_SET_WIREFRAME, 0);
HWD.pfnSetTransform(NULL);
HWD.pfnUnSetShader();
@ -6487,6 +6501,9 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
// Reset the shader state.
HWR_SetShaderState();
if (HWR_IsWireframeMode())
HWD.pfnSetSpecialState(HWD_SET_WIREFRAME, 1);
ps_numbspcalls.value.i = 0;
ps_numpolyobjects.value.i = 0;
PS_START_TIMING(ps_bsptime);
@ -6563,6 +6580,9 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
HWR_CreateDrawNodes();
}
if (HWR_IsWireframeMode())
HWD.pfnSetSpecialState(HWD_SET_WIREFRAME, 0);
HWD.pfnSetTransform(NULL);
HWD.pfnUnSetShader();
@ -6640,6 +6660,8 @@ consvar_t cv_glsolvetjoin = CVAR_INIT ("gr_solvetjoin", "On", 0, CV_OnOff, NULL)
consvar_t cv_glbatching = CVAR_INIT ("gr_batching", "On", 0, CV_OnOff, NULL);
consvar_t cv_glwireframe = CVAR_INIT ("gr_wireframe", "Off", 0, CV_OnOff, NULL);
static void CV_glfiltermode_OnChange(void)
{
if (rendermode == render_opengl)
@ -6681,6 +6703,8 @@ void HWR_AddCommands(void)
CV_RegisterVar(&cv_glbatching);
CV_RegisterVar(&cv_glwireframe);
#ifndef NEWCLIP
CV_RegisterVar(&cv_glclipwalls);
#endif

View file

@ -107,6 +107,8 @@ extern consvar_t cv_glslopecontrast;
extern consvar_t cv_glbatching;
extern consvar_t cv_glwireframe;
extern float gl_viewwidth, gl_viewheight, gl_baseviewwindowy;
extern float gl_viewwindowx, gl_basewindowcentery;

View file

@ -302,6 +302,8 @@ typedef void (APIENTRY * PFNglDisable) (GLenum cap);
static PFNglDisable pglDisable;
typedef void (APIENTRY * PFNglGetFloatv) (GLenum pname, GLfloat *params);
static PFNglGetFloatv pglGetFloatv;
typedef void (APIENTRY * PFNglPolygonMode) (GLenum, GLenum);
static PFNglPolygonMode pglPolygonMode;
/* Depth Buffer */
typedef void (APIENTRY * PFNglClearDepth) (GLclampd depth);
@ -476,6 +478,7 @@ boolean SetupGLfunc(void)
GETOPENGLFUNC(pglGetFloatv, glGetFloatv)
GETOPENGLFUNC(pglGetIntegerv, glGetIntegerv)
GETOPENGLFUNC(pglGetString, glGetString)
GETOPENGLFUNC(pglPolygonMode, glPolygonMode)
GETOPENGLFUNC(pglClearDepth, glClearDepth)
GETOPENGLFUNC(pglDepthFunc, glDepthFunc)
@ -2474,6 +2477,10 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
Flush(); //??? if we want to change filter mode by texture, remove this
break;
case HWD_SET_WIREFRAME:
pglPolygonMode(GL_FRONT_AND_BACK, Value ? GL_LINE : GL_FILL);
break;
default:
break;
}

View file

@ -33,7 +33,8 @@ char sprnames[NUMSPRITES + 1][5] =
"NULL", // invisible object
"UNKN",
"THOK", // Thok! mobj
"THOK", // Spin trail mobj
"THKE", // Thok boom effect
"PLAY",
// Enemies
@ -703,8 +704,9 @@ state_t states[NUMSTATES] =
{SPR_UNKN, FF_FULLBRIGHT, -1, {A_InfoState}, 5, 0, S_NULL}, // S_XDEATHSTATE
{SPR_UNKN, FF_FULLBRIGHT, -1, {A_InfoState}, 6, 0, S_NULL}, // S_RAISESTATE
// Thok
// Spin trail and thok boom effect
{SPR_THOK, FF_TRANS50, 8, {NULL}, 0, 0, S_NULL}, // S_THOK
{SPR_THKE, FF_TRANS50|FF_PAPERSPRITE, 8, {NULL}, 0, 0, S_NULL}, // S_THOKEFFECT
// Player
{SPR_PLAY, SPR2_STND|FF_ANIMATE, 105, {NULL}, 0, 7, S_PLAY_WAIT}, // S_PLAY_STND
@ -4078,6 +4080,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags
S_NULL // raisestate
},
{ // MT_THOKEFFECT
-1, // doomednum
S_THOKEFFECT, // spawnstate
1000, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
8, // speed
32*FRACUNIT, // radius
64*FRACUNIT, // height
0, // display offset
16, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags
S_NULL // raisestate
},
{ // MT_PLAYER
-1, // doomednum

View file

@ -580,7 +580,8 @@ typedef enum sprite
SPR_NULL, // invisible object
SPR_UNKN,
SPR_THOK, // Thok! mobj
SPR_THOK, // Spin trail mobj
SPR_THKE, // Thok boom effect
SPR_PLAY,
// Enemies
@ -1182,8 +1183,9 @@ typedef enum state
S_XDEATHSTATE,
S_RAISESTATE,
// Thok
// Thok boom effect and spin trail
S_THOK,
S_THOKEFFECT,
// Player
S_PLAY_STND,
@ -4392,7 +4394,8 @@ typedef enum mobj_type
MT_NULL,
MT_UNKNOWN,
MT_THOK, // Thok! mobj
MT_THOK, // Spin trail mobj
MT_THOKEFFECT, // Thok boom effect
MT_PLAYER,
MT_TAILSOVERLAY, // c:
MT_METALJETFUME,

View file

@ -2122,7 +2122,19 @@ void P_SpawnThokMobj(player_t *player)
if (type == MT_GHOST)
mobj = P_SpawnGhostMobj(player->mo); // virtually does everything here for us
else
else if (type == MT_THOKEFFECT) // Thok boom effect for Sonic
{
mobj = P_SpawnMobjFromMobj(player->mo, 0, 0, FixedDiv(player->mo->height, player->mo->scale)*3/4, type);
mobj->angle = player->mo->angle + ANGLE_90;
mobj->fuse = 7;
mobj->scale = player->mo->scale / 3;
mobj->destscale = 10 * player->mo->scale;
mobj->colorized = true;
mobj->color = player->mo->color;
mobj->momx = -player->mo->momx / 2;
mobj->momy = -player->mo->momy / 2;
}
else // Normal thok object handling
{
if (player->mo->eflags & MFE_VERTICALFLIP)
zheight = player->mo->z + player->mo->height + FixedDiv(P_GetPlayerHeight(player) - player->mo->height, 3*FRACUNIT) - FixedMul(mobjinfo[type].height, player->mo->scale);