mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-17 23:21:22 +00:00
Merge remote-tracking branch 'origin/master' into software-clownery
This commit is contained in:
commit
590d6729e6
12 changed files with 238 additions and 33 deletions
|
@ -690,9 +690,9 @@ linedeftypes
|
|||
title = "Chain Parameters";
|
||||
prefix = "(9)";
|
||||
flags32text = "[5] Swing instead of spin";
|
||||
flags128text = "[7] Make chain from end item";
|
||||
flags64text = "[6] Player-turnable chain";
|
||||
flags128text = "[7] Make chain from maces";
|
||||
flags256text = "[8] Spawn mace at origin";
|
||||
flags256text = "[8] Spawn link at origin";
|
||||
flags512text = "[9] Don't clip inside ground";
|
||||
flags1024text = "[10] No distance check";
|
||||
}
|
||||
|
|
12
src/g_game.c
12
src/g_game.c
|
@ -1159,14 +1159,14 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
|||
else
|
||||
{
|
||||
if (turnright)
|
||||
cmd->angleturn = (INT16)(cmd->angleturn - angleturn[tspeed]);
|
||||
cmd->angleturn = (INT16)(cmd->angleturn - ((angleturn[tspeed] * cv_cam_turnmultiplier.value)>>FRACBITS));
|
||||
else if (turnleft)
|
||||
cmd->angleturn = (INT16)(cmd->angleturn + angleturn[tspeed]);
|
||||
cmd->angleturn = (INT16)(cmd->angleturn + ((angleturn[tspeed] * cv_cam_turnmultiplier.value)>>FRACBITS));
|
||||
|
||||
if (analogjoystickmove && lookjoystickvector.xaxis != 0)
|
||||
{
|
||||
// JOYAXISRANGE should be 1023 (divide by 1024)
|
||||
cmd->angleturn = (INT16)(cmd->angleturn - ((lookjoystickvector.xaxis * angleturn[1]) >> 10)); // ANALOG!
|
||||
cmd->angleturn = (INT16)(cmd->angleturn - ((((lookjoystickvector.xaxis * angleturn[1]) >> 10) * cv_cam_turnmultiplier.value)>>FRACBITS)); // ANALOG!
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1497,14 +1497,14 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
|||
else
|
||||
{
|
||||
if (turnright)
|
||||
cmd->angleturn = (INT16)(cmd->angleturn - angleturn[tspeed]);
|
||||
cmd->angleturn = (INT16)(cmd->angleturn - (((angleturn[tspeed]<<FRACBITS) * cv_cam2_turnmultiplier.value)>>FRACBITS));
|
||||
else if (turnleft)
|
||||
cmd->angleturn = (INT16)(cmd->angleturn + angleturn[tspeed]);
|
||||
cmd->angleturn = (INT16)(cmd->angleturn + (((angleturn[tspeed]<<FRACBITS) * cv_cam2_turnmultiplier.value)>>FRACBITS));
|
||||
|
||||
if (analogjoystickmove && lookjoystickvector.xaxis != 0)
|
||||
{
|
||||
// JOYAXISRANGE should be 1023 (divide by 1024)
|
||||
cmd->angleturn = (INT16)(cmd->angleturn - ((lookjoystickvector.xaxis * angleturn[1]) >> 10)); // ANALOG!
|
||||
cmd->angleturn = (INT16)(cmd->angleturn - ((((lookjoystickvector.xaxis * angleturn[1]) >> 10) * cv_cam2_turnmultiplier.value)>>FRACBITS)); // ANALOG!
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1181,7 +1181,8 @@ static menuitem_t OP_CameraOptionsMenu[] =
|
|||
|
||||
{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 Speed", &cv_cam_speed, 80},
|
||||
{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_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair, 100},
|
||||
};
|
||||
|
@ -1195,7 +1196,8 @@ static menuitem_t OP_Camera2OptionsMenu[] =
|
|||
|
||||
{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 Speed", &cv_cam2_speed, 80},
|
||||
{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_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair2, 100},
|
||||
};
|
||||
|
|
91
src/m_misc.c
91
src/m_misc.c
|
@ -2449,3 +2449,94 @@ const char *M_FileError(FILE *fp)
|
|||
else
|
||||
return "end-of-file";
|
||||
}
|
||||
|
||||
/** Return the number of parts of this path.
|
||||
*/
|
||||
int M_PathParts(const char *path)
|
||||
{
|
||||
int n;
|
||||
const char *p;
|
||||
const char *t;
|
||||
if (path == NULL)
|
||||
return 0;
|
||||
for (n = 0, p = path ;; ++n)
|
||||
{
|
||||
t = p;
|
||||
if (( p = strchr(p, PATHSEP[0]) ))
|
||||
p += strspn(p, PATHSEP);
|
||||
else
|
||||
{
|
||||
if (*t)/* there is something after the final delimiter */
|
||||
n++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/** Check whether a path is an absolute path.
|
||||
*/
|
||||
boolean M_IsPathAbsolute(const char *path)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return ( strncmp(&path[1], ":\\", 2) == 0 );
|
||||
#else
|
||||
return ( path[0] == '/' );
|
||||
#endif
|
||||
}
|
||||
|
||||
/** I_mkdir for each part of the path.
|
||||
*/
|
||||
void M_MkdirEachUntil(const char *cpath, int start, int end, int mode)
|
||||
{
|
||||
char path[MAX_WADPATH];
|
||||
char *p;
|
||||
char *t;
|
||||
|
||||
if (end > 0 && end <= start)
|
||||
return;
|
||||
|
||||
strlcpy(path, cpath, sizeof path);
|
||||
#ifdef _WIN32
|
||||
if (strncmp(&path[1], ":\\", 2) == 0)
|
||||
p = &path[3];
|
||||
else
|
||||
#endif
|
||||
p = path;
|
||||
|
||||
if (end > 0)
|
||||
end -= start;
|
||||
|
||||
for (; start > 0; --start)
|
||||
{
|
||||
p += strspn(p, PATHSEP);
|
||||
if (!( p = strchr(p, PATHSEP[0]) ))
|
||||
return;
|
||||
}
|
||||
p += strspn(p, PATHSEP);
|
||||
for (;;)
|
||||
{
|
||||
if (end > 0 && !--end)
|
||||
break;
|
||||
|
||||
t = p;
|
||||
if (( p = strchr(p, PATHSEP[0]) ))
|
||||
{
|
||||
*p = '\0';
|
||||
I_mkdir(path, mode);
|
||||
*p = PATHSEP[0];
|
||||
p += strspn(p, PATHSEP);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*t)
|
||||
I_mkdir(path, mode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void M_MkdirEach(const char *path, int start, int mode)
|
||||
{
|
||||
M_MkdirEachUntil(path, start, -1, mode);
|
||||
}
|
||||
|
|
|
@ -96,6 +96,11 @@ void M_SetupMemcpy(void);
|
|||
|
||||
const char *M_FileError(FILE *handle);
|
||||
|
||||
int M_PathParts (const char *path);
|
||||
boolean M_IsPathAbsolute (const char *path);
|
||||
void M_MkdirEach (const char *path, int start, int mode);
|
||||
void M_MkdirEachUntil (const char *path, int start, int end, int mode);
|
||||
|
||||
// counting bits, for weapon ammo code, usually
|
||||
FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size);
|
||||
|
||||
|
|
|
@ -2962,7 +2962,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
Graue 12-22-2003 */
|
||||
}
|
||||
|
||||
static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
|
||||
static void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
|
||||
{
|
||||
player_t *player = target->player;
|
||||
tic_t oldnightstime = player->nightstime;
|
||||
|
@ -3028,7 +3028,7 @@ static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
|
|||
}
|
||||
}
|
||||
|
||||
static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
|
||||
static boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
|
||||
{
|
||||
player_t *player = target->player;
|
||||
(void)damage; //unused parm
|
||||
|
@ -3132,7 +3132,7 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou
|
|||
return true;
|
||||
}
|
||||
|
||||
static inline boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
|
||||
static boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
|
||||
{
|
||||
player_t *player = target->player;
|
||||
|
||||
|
|
|
@ -115,10 +115,10 @@ typedef struct camera_s
|
|||
|
||||
extern camera_t camera, camera2;
|
||||
extern consvar_t cv_cam_dist, cv_cam_still, cv_cam_height;
|
||||
extern consvar_t cv_cam_speed, cv_cam_rotate, cv_cam_rotspeed, cv_cam_orbit, cv_cam_adjust;
|
||||
extern consvar_t cv_cam_speed, cv_cam_rotate, cv_cam_rotspeed, cv_cam_turnmultiplier, cv_cam_orbit, cv_cam_adjust;
|
||||
|
||||
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_orbit, cv_cam2_adjust;
|
||||
extern consvar_t cv_cam2_speed, cv_cam2_rotate, cv_cam2_rotspeed, cv_cam2_turnmultiplier, cv_cam2_orbit, cv_cam2_adjust;
|
||||
|
||||
extern fixed_t t_cam_dist, t_cam_height, t_cam_rotate;
|
||||
extern fixed_t t_cam2_dist, t_cam2_height, t_cam2_rotate;
|
||||
|
|
|
@ -9589,6 +9589,7 @@ 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 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};
|
||||
|
@ -9596,6 +9597,7 @@ consvar_t cv_cam_still = {"cam_still", "Off", 0, CV_OnOff, NULL, 0, NULL, 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};
|
||||
consvar_t cv_cam_rotspeed = {"cam_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
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};
|
||||
|
@ -9604,6 +9606,7 @@ consvar_t cv_cam2_still = {"cam2_still", "Off", 0, CV_OnOff, NULL, 0, NULL, 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};
|
||||
consvar_t cv_cam2_rotspeed = {"cam2_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_cam2_turnmultiplier = {"cam2_turnmultiplier", "1.0", CV_FLOAT|CV_SAVE, multiplier_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
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};
|
||||
|
||||
|
|
|
@ -1192,6 +1192,7 @@ void R_RegisterEngineStuff(void)
|
|||
CV_RegisterVar(&cv_cam_speed);
|
||||
CV_RegisterVar(&cv_cam_rotate);
|
||||
CV_RegisterVar(&cv_cam_rotspeed);
|
||||
CV_RegisterVar(&cv_cam_turnmultiplier);
|
||||
CV_RegisterVar(&cv_cam_orbit);
|
||||
CV_RegisterVar(&cv_cam_adjust);
|
||||
|
||||
|
@ -1201,6 +1202,7 @@ void R_RegisterEngineStuff(void)
|
|||
CV_RegisterVar(&cv_cam2_speed);
|
||||
CV_RegisterVar(&cv_cam2_rotate);
|
||||
CV_RegisterVar(&cv_cam2_rotspeed);
|
||||
CV_RegisterVar(&cv_cam2_turnmultiplier);
|
||||
CV_RegisterVar(&cv_cam2_orbit);
|
||||
CV_RegisterVar(&cv_cam2_adjust);
|
||||
|
||||
|
|
|
@ -20,12 +20,17 @@
|
|||
#include "../doomdef.h"
|
||||
#include "../m_argv.h"
|
||||
#include "../d_main.h"
|
||||
#include "../m_misc.h"/* path shit */
|
||||
#include "../i_system.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined (__GNUC__) || defined (__unix__)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef __unix__
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#include "time.h" // For log timestamps
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
|
@ -133,34 +138,86 @@ int main(int argc, char **argv)
|
|||
{
|
||||
time_t my_time;
|
||||
struct tm * timeinfo;
|
||||
char buf[26];
|
||||
const char *format;
|
||||
const char *reldir;
|
||||
int left;
|
||||
boolean fileabs;
|
||||
#ifdef __unix__
|
||||
const char *link;
|
||||
#endif
|
||||
|
||||
logdir = D_Home();
|
||||
|
||||
my_time = time(NULL);
|
||||
timeinfo = localtime(&my_time);
|
||||
|
||||
strftime(buf, 26, "%Y-%m-%d %H-%M-%S", timeinfo);
|
||||
strcpy(logfilename, va("log-%s.txt", buf));
|
||||
if (M_CheckParm("-logfile") && M_IsNextParm())
|
||||
{
|
||||
format = M_GetNextParm();
|
||||
fileabs = M_IsPathAbsolute(format);
|
||||
}
|
||||
else
|
||||
{
|
||||
format = "log-%Y-%m-%d_%H-%M-%S.txt";
|
||||
fileabs = false;
|
||||
}
|
||||
|
||||
if (fileabs)
|
||||
{
|
||||
strftime(logfilename, sizeof logfilename, format, timeinfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (M_CheckParm("-logdir") && M_IsNextParm())
|
||||
reldir = M_GetNextParm();
|
||||
else
|
||||
reldir = "logs";
|
||||
|
||||
if (M_IsPathAbsolute(reldir))
|
||||
{
|
||||
left = snprintf(logfilename, sizeof logfilename,
|
||||
"%s"PATHSEP, reldir);
|
||||
}
|
||||
else
|
||||
#ifdef DEFAULTDIR
|
||||
if (logdir)
|
||||
{
|
||||
// Create dirs here because D_SRB2Main() is too late.
|
||||
I_mkdir(va("%s%s"DEFAULTDIR, logdir, PATHSEP), 0755);
|
||||
I_mkdir(va("%s%s"DEFAULTDIR"%slogs",logdir, PATHSEP, PATHSEP), 0755);
|
||||
strcpy(logfilename, va("%s%s"DEFAULTDIR"%slogs%s%s",logdir, PATHSEP, PATHSEP, PATHSEP, logfilename));
|
||||
left = snprintf(logfilename, sizeof logfilename,
|
||||
"%s"PATHSEP DEFAULTDIR PATHSEP"%s"PATHSEP, logdir, reldir);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#endif/*DEFAULTDIR*/
|
||||
{
|
||||
I_mkdir("."PATHSEP"logs"PATHSEP, 0755);
|
||||
strcpy(logfilename, va("."PATHSEP"logs"PATHSEP"%s", logfilename));
|
||||
left = snprintf(logfilename, sizeof logfilename,
|
||||
"."PATHSEP"%s"PATHSEP, reldir);
|
||||
}
|
||||
#endif/*LOGMESSAGES*/
|
||||
|
||||
strftime(&logfilename[left], sizeof logfilename - left,
|
||||
format, timeinfo);
|
||||
}
|
||||
|
||||
logstream = fopen(logfilename, "wt");
|
||||
M_MkdirEachUntil(logfilename,
|
||||
M_PathParts(logdir) - 1,
|
||||
M_PathParts(logfilename) - 1, 0755);
|
||||
|
||||
#ifdef __unix__
|
||||
logstream = fopen(logfilename, "w");
|
||||
#ifdef DEFAULTDIR
|
||||
if (logdir)
|
||||
link = va("%s/"DEFAULTDIR"/latest-log.txt", logdir);
|
||||
else
|
||||
#endif/*DEFAULTDIR*/
|
||||
link = "latest-log.txt";
|
||||
unlink(link);
|
||||
if (symlink(logfilename, link) == -1)
|
||||
{
|
||||
I_OutputMsg("Error symlinking latest-log.txt: %s\n", strerror(errno));
|
||||
}
|
||||
#else/*__unix__*/
|
||||
logstream = fopen("latest-log.txt", "wt+");
|
||||
#endif/*__unix__*/
|
||||
}
|
||||
#endif
|
||||
|
||||
//I_OutputMsg("I_StartupSystem() ...\n");
|
||||
I_StartupSystem();
|
||||
|
|
|
@ -2484,6 +2484,48 @@ void I_RemoveExitFunc(void (*func)())
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef __unix__
|
||||
static void Shittycopyerror(const char *name)
|
||||
{
|
||||
I_OutputMsg(
|
||||
"Error copying log file: %s: %s\n",
|
||||
name,
|
||||
strerror(errno)
|
||||
);
|
||||
}
|
||||
|
||||
static void Shittylogcopy(void)
|
||||
{
|
||||
char buf[8192];
|
||||
FILE *fp;
|
||||
size_t r;
|
||||
if (fseek(logstream, 0, SEEK_SET) == -1)
|
||||
{
|
||||
Shittycopyerror("fseek");
|
||||
}
|
||||
else if (( fp = fopen(logfilename, "wt") ))
|
||||
{
|
||||
while (( r = fread(buf, 1, sizeof buf, logstream) ))
|
||||
{
|
||||
if (fwrite(buf, 1, r, fp) < r)
|
||||
{
|
||||
Shittycopyerror("fwrite");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ferror(logstream))
|
||||
{
|
||||
Shittycopyerror("fread");
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
Shittycopyerror(logfilename);
|
||||
}
|
||||
}
|
||||
#endif/*__unix__*/
|
||||
|
||||
//
|
||||
// Closes down everything. This includes restoring the initial
|
||||
// palette and video mode, and removing whatever mouse, keyboard, and
|
||||
|
@ -2506,6 +2548,9 @@ void I_ShutdownSystem(void)
|
|||
if (logstream)
|
||||
{
|
||||
I_OutputMsg("I_ShutdownSystem(): end of logstream.\n");
|
||||
#ifndef __unix__
|
||||
Shittylogcopy();
|
||||
#endif
|
||||
fclose(logstream);
|
||||
logstream = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue