Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Sryder13 2014-11-12 17:02:40 +00:00
commit 9796260709
144 changed files with 2985 additions and 1602 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -13,7 +13,7 @@
doc = doc || document;
// from http://stackoverflow.com/questions/1145850/get-height-of-entire-document-with-javascript
var body = doc.body, html = doc.documentElement;
var height = Math.max( body.scrollHeight, body.offsetHeight,
var height = Math.max( body.scrollHeight, body.offsetHeight,
html.clientHeight, html.scrollHeight, html.offsetHeight );
return height;
}
@ -65,4 +65,4 @@
<iframe id="ifrm" name="ifrm" src="intro.htm" onload="setIframeHeight(this.id)"> </iframe>
</p>
</body>
</html>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 938 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 938 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 937 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 937 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -1,4 +1,4 @@
Here it is! SRB2 v2.1.11 source code!
Here it is! SRB2 v2.1.12 source code!
(why do we keep the version number up to date
when everything else in this file is hilariously old?
- Inuyasha)

View file

@ -319,21 +319,6 @@ LUA_API lua_Number lua_tonumber (lua_State *L, int idx) {
return 0;
}
LUA_API lua_Integer lua_tointeger (lua_State *L, int idx) {
TValue n;
const TValue *o = index2adr(L, idx);
if (tonumber(o, &n)) {
lua_Integer res;
lua_Number num = nvalue(o);
lua_number2integer(res, num);
return res;
}
else
return 0;
}
LUA_API int lua_toboolean (lua_State *L, int idx) {
const TValue *o = index2adr(L, idx);
return !l_isfalse(o);
@ -446,14 +431,6 @@ LUA_API void lua_pushnumber (lua_State *L, lua_Number n) {
}
LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) {
lua_lock(L);
setnvalue(L->top, cast_num(n));
api_incr_top(L);
lua_unlock(L);
}
LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) {
lua_lock(L);
luaC_checkGC(L);

View file

@ -186,20 +186,6 @@ LUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number def) {
}
LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) {
lua_Integer d = lua_tointeger(L, narg);
if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */
tag_error(L, narg, LUA_TNUMBER);
return d;
}
LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg,
lua_Integer def) {
return luaL_opt(L, luaL_checkinteger, narg, def);
}
LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) {
if (!lua_getmetatable(L, obj)) /* no metatable? */
return 0;

View file

@ -54,9 +54,8 @@ LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg,
LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg);
LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def);
LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);
LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,
lua_Integer def);
#define luaL_checkinteger luaL_checknumber
#define luaL_optinteger luaL_optnumber
LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);

View file

@ -100,7 +100,7 @@ typedef LUA_NUMBER lua_Number;
/* type for integer functions */
typedef LUA_INTEGER lua_Integer;
#define lua_Integer lua_Number
@ -144,7 +144,7 @@ LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2);
LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2);
LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx);
LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx);
#define lua_tointeger lua_tonumber
LUA_API int (lua_toboolean) (lua_State *L, int idx);
LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len);
LUA_API size_t (lua_objlen) (lua_State *L, int idx);
@ -159,7 +159,7 @@ LUA_API const void *(lua_topointer) (lua_State *L, int idx);
*/
LUA_API void (lua_pushnil) (lua_State *L);
LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n);
LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n);
#define lua_pushinteger lua_pushnumber
LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l);
LUA_API void (lua_pushstring) (lua_State *L, const char *s);
LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt,

View file

@ -323,7 +323,7 @@ static void Arith (lua_State *L, StkId ra, TValue *rb,
case TM_SUB: setnvalue(ra, luai_numsub(nb, nc)); break;
case TM_MUL: setnvalue(ra, luai_nummul(nb, nc)); break;
case TM_DIV: if (nc == 0) { lua_pushliteral(L, "divide by zero error"); lua_error(L); } else setnvalue(ra, luai_numdiv(nb, nc)); break;
case TM_MOD: setnvalue(ra, luai_nummod(nb, nc)); break;
case TM_MOD: if (nc == 0) { lua_pushliteral(L, "modulo by zero error"); lua_error(L); } else setnvalue(ra, luai_nummod(nb, nc)); break;
case TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break;
case TM_UNM: setnvalue(ra, luai_numunm(nb)); break;
case TM_AND: setnvalue(ra, luai_numand(nb, nc)); break;
@ -494,7 +494,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
if (nc == 0) {
lua_pushliteral(L, "divide by zero error");
lua_error(L);
}
}
else
setnvalue(ra, luai_numdiv(nb, nc));
}
@ -503,7 +503,19 @@ void luaV_execute (lua_State *L, int nexeccalls) {
continue;
}
case OP_MOD: {
arith_op(luai_nummod, TM_MOD);
TValue *rb = RKB(i);
TValue *rc = RKC(i);
if (ttisnumber(rb) && ttisnumber(rc)) {
lua_Number nb = nvalue(rb), nc = nvalue(rc);
if (nc == 0) {
lua_pushliteral(L, "modulo by zero error");
lua_error(L);
}
else
setnvalue(ra, luai_nummod(nb, nc));
}
else
Protect(Arith(L, ra, rb, rc, TM_MOD));
continue;
}
case OP_POW: {

View file

@ -1055,9 +1055,22 @@ static void Setvalue(consvar_t *var, const char *valstr, boolean stealth)
if (var->PossibleValue)
{
INT32 v = atoi(valstr);
if (!v && valstr[0] != '0')
v = INT32_MIN; // Invalid integer trigger
INT32 v;
if (var->flags & CV_FLOAT)
{
double d = atof(valstr);
if (!d && valstr[0] != '0')
v = INT32_MIN;
else
v = (INT32)(d * FRACUNIT);
}
else
{
v = atoi(valstr);
if (!v && valstr[0] != '0')
v = INT32_MIN; // Invalid integer trigger
}
if (var->PossibleValue[0].strvalue && !stricmp(var->PossibleValue[0].strvalue, "MIN")) // bounded cvar
{
@ -1134,13 +1147,13 @@ found:
var->string = var->zstring = Z_StrDup(valstr);
if (var->flags & CV_FLOAT)
if (override)
var->value = overrideval;
else if (var->flags & CV_FLOAT)
{
double d = atof(var->string);
var->value = (INT32)(d * FRACUNIT);
}
else if (override)
var->value = overrideval;
else
var->value = atoi(var->string);

View file

@ -2921,6 +2921,12 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
displayplayer = newplayernum;
secondarydisplayplayer = newplayernum;
DEBFILE("spawning me\n");
// Apply player flags as soon as possible!
players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
if (cv_flipcam.value)
players[newplayernum].pflags |= PF_FLIPCAM;
if (cv_analog.value)
players[newplayernum].pflags |= PF_ANALOGMODE;
}
else
{
@ -2928,6 +2934,12 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
DEBFILE("spawning my brother\n");
if (botingame)
players[newplayernum].bot = 1;
// Same goes for player 2 when relevant
players[newplayernum].pflags &= ~(/*PF_FLIPCAM|*/PF_ANALOGMODE);
//if (cv_flipcam2.value)
//players[newplayernum].pflags |= PF_FLIPCAM;
if (cv_analog2.value)
players[newplayernum].pflags |= PF_ANALOGMODE;
}
D_SendPlayerConfig();
addedtogame = true;

View file

@ -1087,14 +1087,14 @@ void D_SRB2Main(void)
#endif
D_CleanFile();
#if 1 // md5s last updated 8/05/14
#if 1 // md5s last updated 11/10/14
// Check MD5s of autoloaded files
W_VerifyFileMD5(0, "ac309fb3c7d4b5b685e2cd26beccf0e8"); // srb2.srb/srb2.wad
W_VerifyFileMD5(1, "f39b6c849295e3c81875726e8cc0e2c7"); // zones.dta
W_VerifyFileMD5(2, "cfca0f1c73023cbbd8f844f45480f799"); // player.dta
W_VerifyFileMD5(3, "85901ad4bf94637e5753d2ac2c03ea26"); // rings.dta
W_VerifyFileMD5(4, "3d6cfc185fd7c195eb934ce593b0248f"); // patch.dta
W_VerifyFileMD5(4, "a45cc59d13dce924f2112b3e4201d0ae"); // patch.dta
// don't check music.dta because people like to modify it, and it doesn't matter if they do
// ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for.
#endif

View file

@ -164,6 +164,7 @@ static void Command_Archivetest_f(void);
// =========================================================================
void SendWeaponPref(void);
void SendWeaponPref2(void);
static CV_PossibleValue_t usemouse_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Force"}, {0, NULL}};
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
@ -1345,26 +1346,34 @@ void SendWeaponPref(void)
XBOXSTATIC UINT8 buf[1];
buf[0] = 0;
if (cv_flipcam.value)
if (players[consoleplayer].pflags & PF_FLIPCAM)
buf[0] |= 1;
if (players[consoleplayer].pflags & PF_ANALOGMODE)
buf[0] |= 2;
SendNetXCmd(XD_WEAPONPREF, buf, 1);
}
if (splitscreen)
{
buf[0] = 0;
if (cv_flipcam2.value)
buf[0] |= 1;
SendNetXCmd2(XD_WEAPONPREF, buf, 1);
}
void SendWeaponPref2(void)
{
XBOXSTATIC UINT8 buf[1];
buf[0] = 0;
if (players[secondarydisplayplayer].pflags & PF_FLIPCAM)
buf[0] |= 1;
if (players[secondarydisplayplayer].pflags & PF_ANALOGMODE)
buf[0] |= 2;
SendNetXCmd2(XD_WEAPONPREF, buf, 1);
}
static void Got_WeaponPref(UINT8 **cp,INT32 playernum)
{
UINT8 prefs = READUINT8(*cp);
players[playernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE);
if (prefs & 1)
players[playernum].pflags |= PF_FLIPCAM;
else
players[playernum].pflags &= ~PF_FLIPCAM;
if (prefs & 2)
players[playernum].pflags |= PF_ANALOGMODE;
}
void D_SendPlayerConfig(void)
@ -1373,6 +1382,8 @@ void D_SendPlayerConfig(void)
if (splitscreen || botingame)
SendNameAndColor2();
SendWeaponPref();
if (splitscreen)
SendWeaponPref2();
}
// Only works for displayplayer, sorry!
@ -1798,7 +1809,6 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
if (demorecording) // Okay, level loaded, character spawned and skinned,
G_BeginRecording(); // I AM NOW READY TO RECORD.
demo_start = true;
metal_start = true;
}
static void Command_Pause(void)

View file

@ -151,6 +151,7 @@ typedef enum
/*** misc ***/
PF_FORCESTRAFE = 1<<29, // Turning inputs are translated into strafing inputs
PF_ANALOGMODE = 1<<30, // Analog mode?
// free: 1<<30 and 1<<31
} pflags_t;

View file

@ -7273,6 +7273,7 @@ static const char *const PLAYERFLAG_LIST[] = {
/*** misc ***/
"FORCESTRAFE", // Translate turn inputs into strafe inputs
"ANALOGMODE", // Analog mode?
NULL // stop loop here.
};
@ -8681,12 +8682,7 @@ static inline int lib_getenum(lua_State *L)
lua_pushinteger(L, mapmusic);
return 1;
} else if (fastcmp(word,"server")) {
if (dedicated || !playeringame[serverplayer])
return 0;
LUA_PushUserdata(L, &players[serverplayer], META_PLAYER);
return 1;
} else if (fastcmp(word,"dedicatedserver")) {
if (!dedicated)
if (!playeringame[serverplayer])
return 0;
LUA_PushUserdata(L, &players[serverplayer], META_PLAYER);
return 1;

View file

@ -144,8 +144,10 @@ extern FILE *logstream;
#define VERSIONSTRING "Trunk"
#else
#define VERSION 201 // Game version
#define SUBVERSION 11 // more precise version number
#define VERSIONSTRING "v2.1.11"
#define SUBVERSION 12 // more precise version number
#define VERSIONSTRING "v2.1.12"
// Hey! If you change this, add 1 to the MODVERSION below!
// Otherwise we can't force updates!
#endif
// Modification options
@ -201,7 +203,7 @@ extern FILE *logstream;
// it's only for detection of the version the player is using so the MS can alert them of an update.
// Only set it higher, not lower, obviously.
// Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1".
#define MODVERSION 16
#define MODVERSION 17
@ -428,9 +430,8 @@ extern const char *compdate, *comptime, *comprevision;
// Compile them at your own risk!
/// Max recursive portal renders
/// \note sadly some additional work will need to be done
/// before anything > 1 will function correctly
#define PORTAL_LIMIT 1
/// \note obsoleted by cv_maxportals
//#define PORTAL_LIMIT 8
/// Fun experimental slope stuff!
//#define SLOPENESS
@ -453,7 +454,7 @@ extern const char *compdate, *comptime, *comprevision;
//#define CHAOSISNOTDEADYET
/// Polyobject fake flat code
//#define POLYOBJECTS_PLANES
#define POLYOBJECTS_PLANES
/// Blue spheres for future use.
/// \todo Remove this define.
@ -493,4 +494,7 @@ extern const char *compdate, *comptime, *comprevision;
#define CLIENT_LOADINGSCREEN
#endif
/// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.)
//#define REDSANALOG
#endif // __DOOMDEF__

View file

@ -165,7 +165,6 @@ extern cutscene_t *cutscenes[128];
// For the Custom Exit linedef.
extern INT16 nextmapoverride;
extern INT32 nextmapgametype;
extern boolean skipstats;
extern UINT32 totalrings; // Total # of rings in a level

View file

@ -307,7 +307,11 @@ typedef UINT32 tic_t;
#define FUNCTARGET(X) __attribute__ ((__target__ (X)))
#endif
#endif
#if defined (__MINGW32__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#define ATTRPACK __attribute__((packed, gcc_struct))
#else
#define ATTRPACK __attribute__((packed))
#endif
#define ATTRUNUSED __attribute__((unused))
#ifdef _XBOX
#define FILESTAMP I_OutputMsg("%s:%d\n",__FILE__,__LINE__);

View file

@ -958,29 +958,30 @@ boolean F_IntroResponder(event_t *event)
// CREDITS
// =========
static const char *credits[] = {
"\1Sonic Team Junior",
"\1Staff",
"\1Sonic Robo Blast II",
"\1Credits",
"",
"\1Game Design",
"\"SSNTails\"",
"Ben \"Mystic\" Geyer",
"\"SSNTails\"",
"Johnny \"Sonikku\" Wallbank",
"",
"\1Programming",
"\"SSNTails\"",
"Alam \"GBC\" Arias",
"Logan \"GBA\" Arias",
"Tim \"RedEnchilada\" Bordelon",
"Callum Dickinson",
"Scott \"Graue\" Feeney",
"Nathan \"Jazz\" Giroux",
"Thomas \"Shadow Hog\" Igoe",
"\"Monster\" Iestyn Jealous",
"Ronald \"Furyhunter\" Kinard", // The SDL2 port
"John \"JTE\" Muniz",
"\"SSNTails\"",
"Matthew \"Inuyasha\" Walsh",
"",
"\1Programming",
"\1Assistance",
"Tim \"RedEnchilada\" Bordelon",
"Andrew \"orospakr\" Clunis",
"Gregor \"Oogaland\" Dick",
"Julio \"Chaos Zero 64\" Guir",
@ -993,7 +994,6 @@ static const char *credits[] = {
"Ben \"Cue\" Woodford",
"",
"\1Sprite Artists",
"\"SSNTails\"",
"Odi \"Iceman404\" Atunzu",
"Victor \"VAdaPEGA\" Ara\x1Fjo", // Araújo -- sorry for our limited font! D:
"Jim \"MotorRoach\" DeMello",
@ -1001,6 +1001,7 @@ static const char *credits[] = {
"Sherman \"CoatRack\" DesJardins",
"Andrew \"Senku Niola\" Moran",
"David \"Instant Sonic\" Spencer Jr.",
"\"SSNTails\"",
"",
"\1Texture Artists",
"Ryan \"Blaze Hedgehog\" Bloom",
@ -1010,8 +1011,6 @@ static const char *credits[] = {
"",
"\1Music and Sound",
"\1Production",
"\"SSNTails\"",
"Michael \"Spazzo\" Antonakes",
"Malcolm \"RedXVI\" Brown",
"David \"Bulmybag\" Bulmer",
"Paul \"Boinciel\" Clempson",
@ -1021,12 +1020,12 @@ static const char *credits[] = {
"Jarel \"Arrow\" Jones",
"Stefan \"Stuf\" Rimalia",
"Shane Strife",
"\"Spazzo\"",
"David \"Big Wave Dave\" Spencer Sr.",
"David \"Instant Sonic\" Spencer Jr.",
"\"SSNTails\"",
"",
"\1Level Design",
"\"SSNTails\"",
"Michael \"Spazzo\" Antonakes",
"Matthew \"Fawfulfan\" Chapman",
"Paul \"Boinciel\" Clempson",
"Desmond \"Blade\" DesJardins",
@ -1038,12 +1037,22 @@ static const char *credits[] = {
"Thomas \"Shadow Hog\" Igoe",
"Erik \"Torgo\" Nielsen",
"Wessel \"Spherallic\" Smit",
"\"Spazzo\"",
"\"SSNTails\"",
"Rob Tisdell",
"Jarrett \"JEV3\" Voight",
"Johnny \"Sonikku\" Wallbank",
"Matthew \"Inuyasha\" Walsh",
"Marco \"Digiku\" Zafra",
"",
"\1Boss Design",
"Ben \"Mystic\" Geyer",
"Thomas \"Shadow Hog\" Igoe",
"John \"JTE\" Muniz",
"Samuel \"Prime 2.0\" Peters",
"\"SSNTails\"",
"Johnny \"Sonikku\" Wallbank",
"",
"\1Testing",
"Hank \"FuriousFox\" Brannock",
"Cody \"SRB2 Playah\" Koester",
@ -1060,9 +1069,12 @@ static const char *credits[] = {
"Alex \"MistaED\" Fuller",
"FreeDoom Project", // Used some of the mancubus and rocket launcher sprites for Brak
"Randy Heit (<!>)", // For his MSPaint <!> sprite that we nicked
#if 0 // (don't take your anger out on me anymore, ok, JTE...?)
"Abigail \"Raspberry\" Fox", // (Inuyasha's girlfriend. >_> <_< >_>)
#endif
"",
"\1Produced By",
"Sonic Team Junior",
"",
"\1Published By",
"A 28K dialup modem",
"",
"\1Thank you",
"\1for playing!",

View file

@ -131,7 +131,6 @@ boolean countdowntimeup = false;
cutscene_t *cutscenes[128];
INT16 nextmapoverride;
INT32 nextmapgametype;
boolean skipstats;
// Pointers to each CTF flag
@ -244,7 +243,6 @@ mobj_t *metalplayback;
static UINT8 *metalbuffer = NULL;
static UINT8 *metal_p;
static UINT16 metalversion;
boolean metal_start;
// extra data stuff (events registered this frame while recording)
static struct {
@ -283,6 +281,8 @@ static void UserAnalog_OnChange(void);
static void UserAnalog2_OnChange(void);
static void Analog_OnChange(void);
static void Analog2_OnChange(void);
void SendWeaponPref(void);
void SendWeaponPref2(void);
static CV_PossibleValue_t crosshair_cons_t[] = {{0, "Off"}, {1, "Cross"}, {2, "Angle"}, {3, "Point"}, {0, NULL}};
static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"},
@ -595,14 +595,18 @@ void G_AddTempNightsRecords(UINT32 pscore, tic_t ptime, UINT8 mare)
void G_SetNightsRecords(void)
{
INT32 i;
UINT32 totalscore = 0;
tic_t totaltime = 0;
const size_t glen = strlen(srb2home)+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1;
char *gpath;
char lastdemo[256], bestdemo[256];
if (!ntemprecords.nummares)
return;
// Set overall
{
UINT32 totalscore = 0;
tic_t totaltime = 0;
UINT8 totalrank = 0, realrank = 0;
for (i = 1; i <= ntemprecords.nummares; ++i)
@ -648,6 +652,50 @@ void G_SetNightsRecords(void)
memset(&ntemprecords, 0, sizeof(nightsdata_t));
// Save demo!
bestdemo[255] = '\0';
lastdemo[255] = '\0';
G_SetDemoTime(totaltime, totalscore, 0);
G_CheckDemoStatus();
I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755);
I_mkdir(va("%s"PATHSEP"replay"PATHSEP"%s", srb2home, timeattackfolder), 0755);
if ((gpath = malloc(glen)) == NULL)
I_Error("Out of memory for replay filepath\n");
sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap));
snprintf(lastdemo, 255, "%s-last.lmp", gpath);
if (FIL_FileExists(lastdemo))
{
UINT8 *buf;
size_t len = FIL_ReadFile(lastdemo, &buf);
snprintf(bestdemo, 255, "%s-time-best.lmp", gpath);
if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & 1)
{ // Better time, save this demo.
if (FIL_FileExists(bestdemo))
remove(bestdemo);
FIL_WriteFile(bestdemo, buf, len);
CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW RECORD TIME!"), M_GetText("Saved replay as"), bestdemo);
}
snprintf(bestdemo, 255, "%s-score-best.lmp", gpath);
if (!FIL_FileExists(bestdemo) || (G_CmpDemoTime(bestdemo, lastdemo) & (1<<1)))
{ // Better score, save this demo.
if (FIL_FileExists(bestdemo))
remove(bestdemo);
FIL_WriteFile(bestdemo, buf, len);
CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW HIGH SCORE!"), M_GetText("Saved replay as"), bestdemo);
}
//CONS_Printf("%s '%s'\n", M_GetText("Saved replay as"), lastdemo);
Z_Free(buf);
}
free(gpath);
// If the mare count changed, this will update the score display
CV_AddValue(&cv_nextmap, 1);
CV_AddValue(&cv_nextmap, -1);
@ -909,6 +957,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
// these ones used for multiple conditions
boolean turnleft, turnright, mouseaiming, analogjoystickmove, gamepadjoystickmove;
player_t *player = &players[consoleplayer];
camera_t *thiscam = &camera;
static INT32 turnheld; // for accelerative turning
static boolean keyboard_look; // true if lookup/down using keyboard
@ -1172,8 +1221,16 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
cmd->forwardmove = (SINT8)(cmd->forwardmove + forward);
cmd->sidemove = (SINT8)(cmd->sidemove + side);
localangle += (cmd->angleturn<<16);
cmd->angleturn = (INT16)(localangle >> 16);
if (cv_analog.value) {
cmd->angleturn = (INT16)(thiscam->angle >> 16);
if (player->awayviewtics)
cmd->angleturn = (INT16)(player->awayviewmobj->angle >> 16);
}
else
{
localangle += (cmd->angleturn<<16);
cmd->angleturn = (INT16)(localangle >> 16);
}
//Reset away view if a command is given.
if ((cmd->forwardmove || cmd->sidemove || cmd->buttons)
@ -1190,6 +1247,7 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
// these ones used for multiple conditions
boolean turnleft, turnright, mouseaiming, analogjoystickmove, gamepadjoystickmove;
player_t *player = &players[secondarydisplayplayer];
camera_t *thiscam = (player->bot == 2 ? &camera : &camera2);
static INT32 turnheld; // for accelerative turning
static boolean keyboard_look; // true if lookup/down using keyboard
@ -1463,8 +1521,16 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
}
}
localangle2 += (cmd->angleturn<<16);
cmd->angleturn = (INT16)(localangle2 >> 16);
if (cv_analog2.value) {
cmd->angleturn = (INT16)(thiscam->angle >> 16);
if (player->awayviewtics)
cmd->angleturn = (INT16)(player->awayviewmobj->angle >> 16);
}
else
{
localangle2 += (cmd->angleturn<<16);
cmd->angleturn = (INT16)(localangle2 >> 16);
}
}
// User has designated that they want
@ -1497,25 +1563,45 @@ static void Analog_OnChange(void)
if (leveltime > 1)
CV_SetValue(&cv_cam_dist, 128);
if (netgame)
CV_StealthSetValue(&cv_analog, 0);
else if (cv_analog.value || demoplayback)
if (cv_analog.value || demoplayback)
CV_SetValue(&cv_cam_dist, 192);
if (!cv_chasecam.value && cv_analog.value) {
CV_SetValue(&cv_analog, 0);
return;
}
if (cv_analog.value)
players[consoleplayer].pflags |= PF_ANALOGMODE;
else
players[consoleplayer].pflags &= ~PF_ANALOGMODE;
SendWeaponPref();
}
static void Analog2_OnChange(void)
{
if (!splitscreen || !cv_cam2_dist.string)
if (!(splitscreen || botingame) || !cv_cam2_dist.string)
return;
// cameras are not initialized at this point
if (leveltime > 1)
CV_SetValue(&cv_cam2_dist, 128);
if (netgame)
CV_StealthSetValue(&cv_analog2, 0);
else if (cv_analog2.value)
if (cv_analog2.value)
CV_SetValue(&cv_cam2_dist, 192);
if (!cv_chasecam2.value && cv_analog2.value) {
CV_SetValue(&cv_analog2, 0);
return;
}
if (cv_analog2.value)
players[secondarydisplayplayer].pflags |= PF_ANALOGMODE;
else
players[secondarydisplayplayer].pflags &= ~PF_ANALOGMODE;
SendWeaponPref2();
}
//
@ -1999,7 +2085,7 @@ void G_PlayerReborn(INT32 player)
exiting = players[player].exiting;
jointime = players[player].jointime;
spectator = players[player].spectator;
pflags = (players[player].pflags & (PF_TIMEOVER|PF_FLIPCAM|PF_TAGIT|PF_TAGGED));
pflags = (players[player].pflags & (PF_TIMEOVER|PF_FLIPCAM|PF_TAGIT|PF_TAGGED|PF_ANALOGMODE));
// As long as we're not in multiplayer, carry over cheatcodes from map to map
if (!(netgame || multiplayer))
@ -2838,23 +2924,12 @@ static void G_DoWorldDone(void)
{
if (server)
{
INT32 nextgametype;
// for custom exit (linetype 2) that changes gametype
if (nextmapgametype != -1)
nextgametype = nextmapgametype;
else
{
// use current gametype by default
nextgametype = gametype;
}
if (gametype == GT_COOP && nextgametype == GT_COOP)
if (gametype == GT_COOP)
// don't reset player between maps
D_MapChange(nextmap+1, nextgametype, ultimatemode, false, 0, false, false);
D_MapChange(nextmap+1, gametype, ultimatemode, false, 0, false, false);
else
// resetplayer in match/chaos/tag/CTF/race for more equality
D_MapChange(nextmap+1, nextgametype, ultimatemode, true, 0, false, false);
D_MapChange(nextmap+1, gametype, ultimatemode, true, 0, false, false);
}
gameaction = ga_nothing;
@ -3618,6 +3693,7 @@ static ticcmd_t oldcmd;
// Not used for Metal Sonic
#define GZT_SPRITE 0x10 // Animation frame
#define GZT_EXTRA 0x20
#define GZT_NIGHTS 0x40 // NiGHTS Mode stuff!
// GZT_EXTRA flags
#define EZT_THOK 0x01 // Spawned a thok object
@ -3632,6 +3708,21 @@ static ticcmd_t oldcmd;
static mobj_t oldmetal, oldghost;
void G_SaveMetal(UINT8 **buffer)
{
I_Assert(buffer != NULL && *buffer != NULL);
WRITEUINT32(*buffer, metal_p - metalbuffer);
}
void G_LoadMetal(UINT8 **buffer)
{
I_Assert(buffer != NULL && *buffer != NULL);
G_DoPlayMetal();
metal_p = metalbuffer + READUINT32(*buffer);
}
ticcmd_t *G_CopyTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n)
{
return M_Memcpy(dest, src, n*sizeof(*src));
@ -3814,6 +3905,13 @@ void G_WriteGhostTic(mobj_t *ghost)
if (!(demoflags & DF_GHOST))
return; // No ghost data to write.
if (ghost->player && ghost->player->pflags & PF_NIGHTSMODE && ghost->tracer)
{
// We're talking about the NiGHTS thing, not the normal platforming thing!
ziptic |= GZT_NIGHTS;
ghost = ghost->tracer;
}
ziptic_p = demo_p++; // the ziptic, written at the end of this function
#define MAXMOM (0xFFFF<<8)
@ -3875,10 +3973,7 @@ void G_WriteGhostTic(mobj_t *ghost)
}
// Store the sprite frame.
if (ghost->player && ghost->player->pflags & PF_NIGHTSMODE && ghost->tracer)
frame = ghost->tracer->frame & 0xFF; // get frame from NiGHTS tracer
else
frame = ghost->frame & 0xFF; // get frame from player
frame = ghost->frame & 0xFF;
if (frame != oldghost.frame)
{
oldghost.frame = frame;
@ -3887,10 +3982,7 @@ void G_WriteGhostTic(mobj_t *ghost)
}
// Check for sprite set changes
if (ghost->player && ghost->player->pflags & PF_NIGHTSMODE && ghost->tracer)
sprite = ghost->tracer->sprite; // get sprite from NiGHTS tracer
else
sprite = ghost->sprite; // get sprite from player
sprite = ghost->sprite;
if (sprite != oldghost.sprite)
{
oldghost.sprite = sprite;
@ -3957,12 +4049,16 @@ void G_ConsGhostTic(void)
{
UINT8 ziptic;
UINT16 px,py,pz,gx,gy,gz;
mobj_t *testmo;
boolean nightsfail = false;
if (!demo_p || !demo_start)
return;
if (!(demoflags & DF_GHOST))
return; // No ghost data to use.
testmo = players[0].mo;
// Grab ghost data.
ziptic = READUINT8(demo_p);
if (ziptic & GZT_XYZ)
@ -3988,6 +4084,12 @@ void G_ConsGhostTic(void)
demo_p++;
if (ziptic & GZT_SPRITE)
demo_p++;
if(ziptic & GZT_NIGHTS) {
if (!testmo->player || !(testmo->player->pflags & PF_NIGHTSMODE) || !testmo->tracer)
nightsfail = true;
else
testmo = testmo->tracer;
}
if (ziptic & GZT_EXTRA)
{ // But wait, there's more!
@ -4029,7 +4131,12 @@ void G_ConsGhostTic(void)
mobj = NULL; // wasn't this one, keep searching.
}
if (mobj && mobj->health != health) // Wasn't damaged?! This is desync! Fix it!
{
if (demosynced)
CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n"));
demosynced = false;
P_DamageMobj(mobj, players[0].mo, players[0].mo, 1);
}
}
}
if (ziptic & EZT_SPRITE)
@ -4037,24 +4144,24 @@ void G_ConsGhostTic(void)
}
// Re-synchronise
px = players[0].mo->x>>FRACBITS;
py = players[0].mo->y>>FRACBITS;
pz = players[0].mo->z>>FRACBITS;
px = testmo->x>>FRACBITS;
py = testmo->y>>FRACBITS;
pz = testmo->z>>FRACBITS;
gx = oldghost.x>>FRACBITS;
gy = oldghost.y>>FRACBITS;
gz = oldghost.z>>FRACBITS;
if (px != gx || py != gy || pz != gz)
if (nightsfail || px != gx || py != gy || pz != gz)
{
if (demosynced)
CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n"));
demosynced = false;
P_UnsetThingPosition(players[0].mo);
players[0].mo->x = oldghost.x;
players[0].mo->y = oldghost.y;
P_SetThingPosition(players[0].mo);
players[0].mo->z = oldghost.z;
P_UnsetThingPosition(testmo);
testmo->x = oldghost.x;
testmo->y = oldghost.y;
P_SetThingPosition(testmo);
testmo->z = oldghost.z;
}
if (*demo_p == DEMOMARKER)
@ -4272,7 +4379,7 @@ void G_ReadMetalTic(mobj_t *metal)
UINT16 speed;
UINT8 statetype;
if (!metal_p || !metal_start)
if (!metal_p)
return;
ziptic = READUINT8(metal_p);
@ -4517,11 +4624,7 @@ void G_BeginRecording(void)
memset(name,0,sizeof(name));
demo_p = demobuffer;
demoflags = DF_GHOST;
if (modeattacking == ATTACKING_RECORD)
demoflags |= DF_RECORDATTACK;
else if (modeattacking == ATTACKING_NIGHTS)
demoflags |= DF_NIGHTSATTACK;
demoflags = DF_GHOST|(modeattacking<<DF_ATTACKSHIFT);
// Setup header.
M_Memcpy(demo_p, DEMOHEADER, 12); demo_p += 12;
@ -4651,12 +4754,21 @@ void G_BeginMetal(void)
void G_SetDemoTime(UINT32 ptime, UINT32 pscore, UINT16 prings)
{
if (!(demorecording && demoflags & DF_RECORDATTACK && demotime_p))
return; // Can't record a time. :(
WRITEUINT32(demotime_p, ptime);
WRITEUINT32(demotime_p, pscore);
WRITEUINT16(demotime_p, prings);
demotime_p = NULL;
if (!demorecording || !demotime_p)
return;
if (demoflags & DF_RECORDATTACK)
{
WRITEUINT32(demotime_p, ptime);
WRITEUINT32(demotime_p, pscore);
WRITEUINT16(demotime_p, prings);
demotime_p = NULL;
}
else if (demoflags & DF_NIGHTSATTACK)
{
WRITEUINT32(demotime_p, ptime);
WRITEUINT32(demotime_p, pscore);
demotime_p = NULL;
}
}
// Returns bitfield:
@ -4672,6 +4784,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
size_t bufsize ATTRUNUSED;
UINT8 c;
UINT16 s ATTRUNUSED;
UINT8 aflags = 0;
// load the new file
FIL_DefaultExtension(newname, ".lmp");
@ -4694,10 +4807,23 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
p += 2; // gamemap
p += 16; // map md5
flags = READUINT8(p); // demoflags
I_Assert(flags & DF_RECORDATTACK);
newtime = READUINT32(p);
newscore = READUINT32(p);
newrings = READUINT16(p);
aflags = flags & (DF_RECORDATTACK|DF_NIGHTSATTACK);
I_Assert(aflags);
if (flags & DF_RECORDATTACK)
{
newtime = READUINT32(p);
newscore = READUINT32(p);
newrings = READUINT16(p);
}
else if (flags & DF_NIGHTSATTACK)
{
newtime = READUINT32(p);
newscore = READUINT32(p);
newrings = 0;
}
else // appease compiler
return 0;
Z_Free(buffer);
@ -4745,15 +4871,26 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
p += 2; // gamemap
p += 16; // mapmd5
flags = READUINT8(p);
if (!(flags & DF_RECORDATTACK))
if (!(flags & aflags))
{
CONS_Alert(CONS_NOTICE, M_GetText("File '%s' not from timeattack. It will be overwritten.\n"), oldname);
CONS_Alert(CONS_NOTICE, M_GetText("File '%s' not from same game mode. It will be overwritten.\n"), oldname);
Z_Free(buffer);
return UINT8_MAX;
}
oldtime = READUINT32(p);
oldscore = READUINT32(p);
oldrings = READUINT16(p);
if (flags & DF_RECORDATTACK)
{
oldtime = READUINT32(p);
oldscore = READUINT32(p);
oldrings = READUINT16(p);
}
else if (flags & DF_NIGHTSATTACK)
{
oldtime = READUINT32(p);
oldscore = READUINT32(p);
oldrings = 0;
}
else // appease compiler
return UINT8_MAX;
Z_Free(buffer);
@ -4967,7 +5104,6 @@ void G_DoPlayDemo(char *defdemoname)
// didn't start recording right away.
demo_start = false;
metal_start = false;
#ifdef HAVE_BLUA
LUAh_MapChange();
@ -5013,7 +5149,6 @@ void G_DoPlayDemo(char *defdemoname)
players[0].jumpfactor = jumpfactor;
demo_start = true;
metal_start = true;
}
void G_AddGhost(char *defdemoname)
@ -5433,7 +5568,7 @@ boolean G_CheckDemoStatus(void)
I_Quit();
G_StopDemo();
if (modeattacking == ATTACKING_RECORD)
if (modeattacking)
M_EndModeAttackRun();
else
D_AdvanceDemo();

View file

@ -43,7 +43,6 @@ extern boolean singledemo;
extern boolean demo_start;
extern mobj_t *metalplayback;
extern boolean metal_start;
// gametic at level start
extern tic_t levelstarttic;
@ -147,6 +146,8 @@ void G_ConsGhostTic(void);
void G_GhostTicker(void);
void G_ReadMetalTic(mobj_t *metal);
void G_WriteMetalTic(mobj_t *metal);
void G_SaveMetal(UINT8 **buffer);
void G_LoadMetal(UINT8 **buffer);
void G_DoPlayDemo(char *defdemoname);
void G_TimeDemo(const char *name);

View file

@ -1045,7 +1045,6 @@ static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
{
size_t size;
UINT16 fmheight = 0, fmwidth = 0;
UINT8 *block; // The fade mask's pixels
// setup the texture info
grMipmap->grInfo.format = GR_TEXFMT_ALPHA_8; // put the correct alpha levels straight in so I don't need to convert it later
@ -1083,7 +1082,7 @@ static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
grMipmap->width = blockwidth;
grMipmap->height = blockheight;
block = MakeBlock(grMipmap);
MakeBlock(grMipmap);
HWR_DrawFadeMaskInCache(grMipmap, blockwidth, blockheight, fademasklumpnum, fmwidth, fmheight);

View file

@ -66,6 +66,8 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing);
#ifdef SORTING
void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, fixed_t fixedheight,
INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector, fixed_t fixedheight,
INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap);
#else
static void HWR_Add3DWater(lumpnum_t lumpnum, extrasubsector_t *xsub, fixed_t fixedheight,
INT32 lightlevel, INT32 alpha, sector_t *FOFSector);
@ -1695,78 +1697,81 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
}
// Isn't this just the most lovely mess
if (gr_frontsector->ceilingpic == skyflatnum || gr_backsector->ceilingpic == skyflatnum)
if (!gr_curline->polyseg) // Don't do it for polyobjects
{
fixed_t depthwallheight;
if (!gr_sidedef->toptexture || (gr_frontsector->ceilingpic == skyflatnum && gr_backsector->ceilingpic == skyflatnum)) // when both sectors are sky, the top texture isn't drawn
depthwallheight = gr_frontsector->ceilingheight < gr_backsector->ceilingheight ? gr_frontsector->ceilingheight : gr_backsector->ceilingheight;
else
depthwallheight = gr_frontsector->ceilingheight > gr_backsector->ceilingheight ? gr_frontsector->ceilingheight : gr_backsector->ceilingheight;
if (gr_frontsector->ceilingheight-gr_frontsector->floorheight <= 0) // current sector is a thok barrier
if (gr_frontsector->ceilingpic == skyflatnum || gr_backsector->ceilingpic == skyflatnum)
{
if (gr_backsector->ceilingheight-gr_backsector->floorheight <= 0) // behind sector is also a thok barrier
fixed_t depthwallheight;
if (!gr_sidedef->toptexture || (gr_frontsector->ceilingpic == skyflatnum && gr_backsector->ceilingpic == skyflatnum)) // when both sectors are sky, the top texture isn't drawn
depthwallheight = gr_frontsector->ceilingheight < gr_backsector->ceilingheight ? gr_frontsector->ceilingheight : gr_backsector->ceilingheight;
else
depthwallheight = gr_frontsector->ceilingheight > gr_backsector->ceilingheight ? gr_frontsector->ceilingheight : gr_backsector->ceilingheight;
if (gr_frontsector->ceilingheight-gr_frontsector->floorheight <= 0) // current sector is a thok barrier
{
if (!gr_sidedef->bottomtexture) // Only extend further down if there's no texture
HWR_DrawSkyWall(wallVerts, &Surf, worldbottom < worldlow ? worldbottom : worldlow, INT32_MAX);
else
HWR_DrawSkyWall(wallVerts, &Surf, worldbottom > worldlow ? worldbottom : worldlow, INT32_MAX);
if (gr_backsector->ceilingheight-gr_backsector->floorheight <= 0) // behind sector is also a thok barrier
{
if (!gr_sidedef->bottomtexture) // Only extend further down if there's no texture
HWR_DrawSkyWall(wallVerts, &Surf, worldbottom < worldlow ? worldbottom : worldlow, INT32_MAX);
else
HWR_DrawSkyWall(wallVerts, &Surf, worldbottom > worldlow ? worldbottom : worldlow, INT32_MAX);
}
// behind sector is not a thok barrier
else if (gr_backsector->ceilingheight <= gr_frontsector->ceilingheight) // behind sector ceiling is lower or equal to current sector
HWR_DrawSkyWall(wallVerts, &Surf, depthwallheight, INT32_MAX);
// gr_front/backsector heights need to be used here because of the worldtop being set to worldhigh earlier on
}
// behind sector is not a thok barrier
else if (gr_backsector->ceilingheight <= gr_frontsector->ceilingheight) // behind sector ceiling is lower or equal to current sector
HWR_DrawSkyWall(wallVerts, &Surf, depthwallheight, INT32_MAX);
// gr_front/backsector heights need to be used here because of the worldtop being set to worldhigh earlier on
}
else if (gr_backsector->ceilingheight-gr_backsector->floorheight <= 0) // behind sector is a thok barrier, current sector is not
{
if (gr_backsector->ceilingheight >= gr_frontsector->ceilingheight // thok barrier ceiling height is equal to or greater than current sector ceiling height
|| gr_backsector->floorheight <= gr_frontsector->floorheight // thok barrier ceiling height is equal to or less than current sector floor height
|| gr_backsector->ceilingpic != skyflatnum) // thok barrier is not a sky
HWR_DrawSkyWall(wallVerts, &Surf, depthwallheight, INT32_MAX);
}
else // neither sectors are thok barriers
{
if ((gr_backsector->ceilingheight < gr_frontsector->ceilingheight && !gr_sidedef->toptexture) // no top texture and sector behind is lower
|| gr_backsector->ceilingpic != skyflatnum) // behind sector is not a sky
HWR_DrawSkyWall(wallVerts, &Surf, depthwallheight, INT32_MAX);
}
}
// And now for sky floors!
if (gr_frontsector->floorpic == skyflatnum || gr_backsector->floorpic == skyflatnum)
{
fixed_t depthwallheight;
if (!gr_sidedef->bottomtexture)
depthwallheight = worldbottom > worldlow ? worldbottom : worldlow;
else
depthwallheight = worldbottom < worldlow ? worldbottom : worldlow;
if (gr_frontsector->ceilingheight-gr_frontsector->floorheight <= 0) // current sector is a thok barrier
{
if (gr_backsector->ceilingheight-gr_backsector->floorheight <= 0) // behind sector is also a thok barrier
else if (gr_backsector->ceilingheight-gr_backsector->floorheight <= 0) // behind sector is a thok barrier, current sector is not
{
if (!gr_sidedef->toptexture) // Only extend up if there's no texture
HWR_DrawSkyWall(wallVerts, &Surf, INT32_MIN, worldtop > worldhigh ? worldtop : worldhigh);
else
HWR_DrawSkyWall(wallVerts, &Surf, INT32_MIN, worldtop < worldhigh ? worldtop : worldhigh);
if (gr_backsector->ceilingheight >= gr_frontsector->ceilingheight // thok barrier ceiling height is equal to or greater than current sector ceiling height
|| gr_backsector->floorheight <= gr_frontsector->floorheight // thok barrier ceiling height is equal to or less than current sector floor height
|| gr_backsector->ceilingpic != skyflatnum) // thok barrier is not a sky
HWR_DrawSkyWall(wallVerts, &Surf, depthwallheight, INT32_MAX);
}
else // neither sectors are thok barriers
{
if ((gr_backsector->ceilingheight < gr_frontsector->ceilingheight && !gr_sidedef->toptexture) // no top texture and sector behind is lower
|| gr_backsector->ceilingpic != skyflatnum) // behind sector is not a sky
HWR_DrawSkyWall(wallVerts, &Surf, depthwallheight, INT32_MAX);
}
// behind sector is not a thok barrier
else if (gr_backsector->floorheight >= gr_frontsector->floorheight) // behind sector floor is greater or equal to current sector
HWR_DrawSkyWall(wallVerts, &Surf, INT32_MIN, depthwallheight);
}
else if (gr_backsector->ceilingheight-gr_backsector->floorheight <= 0) // behind sector is a thok barrier, current sector is not
// And now for sky floors!
if (gr_frontsector->floorpic == skyflatnum || gr_backsector->floorpic == skyflatnum)
{
if (gr_backsector->floorheight <= gr_frontsector->floorheight // thok barrier floor height is equal to or less than current sector floor height
|| gr_backsector->ceilingheight >= gr_frontsector->ceilingheight // thok barrier floor height is equal to or greater than current sector ceiling height
|| gr_backsector->floorpic != skyflatnum) // thok barrier is not a sky
HWR_DrawSkyWall(wallVerts, &Surf, INT32_MIN, depthwallheight);
}
else // neither sectors are thok barriers
{
if ((gr_backsector->floorheight > gr_frontsector->floorheight && !gr_sidedef->bottomtexture) // no bottom texture and sector behind is higher
|| gr_backsector->floorpic != skyflatnum) // behind sector is not a sky
HWR_DrawSkyWall(wallVerts, &Surf, INT32_MIN, depthwallheight);
fixed_t depthwallheight;
if (!gr_sidedef->bottomtexture)
depthwallheight = worldbottom > worldlow ? worldbottom : worldlow;
else
depthwallheight = worldbottom < worldlow ? worldbottom : worldlow;
if (gr_frontsector->ceilingheight-gr_frontsector->floorheight <= 0) // current sector is a thok barrier
{
if (gr_backsector->ceilingheight-gr_backsector->floorheight <= 0) // behind sector is also a thok barrier
{
if (!gr_sidedef->toptexture) // Only extend up if there's no texture
HWR_DrawSkyWall(wallVerts, &Surf, INT32_MIN, worldtop > worldhigh ? worldtop : worldhigh);
else
HWR_DrawSkyWall(wallVerts, &Surf, INT32_MIN, worldtop < worldhigh ? worldtop : worldhigh);
}
// behind sector is not a thok barrier
else if (gr_backsector->floorheight >= gr_frontsector->floorheight) // behind sector floor is greater or equal to current sector
HWR_DrawSkyWall(wallVerts, &Surf, INT32_MIN, depthwallheight);
}
else if (gr_backsector->ceilingheight-gr_backsector->floorheight <= 0) // behind sector is a thok barrier, current sector is not
{
if (gr_backsector->floorheight <= gr_frontsector->floorheight // thok barrier floor height is equal to or less than current sector floor height
|| gr_backsector->ceilingheight >= gr_frontsector->ceilingheight // thok barrier floor height is equal to or greater than current sector ceiling height
|| gr_backsector->floorpic != skyflatnum) // thok barrier is not a sky
HWR_DrawSkyWall(wallVerts, &Surf, INT32_MIN, depthwallheight);
}
else // neither sectors are thok barriers
{
if ((gr_backsector->floorheight > gr_frontsector->floorheight && !gr_sidedef->bottomtexture) // no bottom texture and sector behind is higher
|| gr_backsector->floorpic != skyflatnum) // behind sector is not a sky
HWR_DrawSkyWall(wallVerts, &Surf, INT32_MIN, depthwallheight);
}
}
}
}
@ -1809,10 +1814,13 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
}
}
if (gr_frontsector->ceilingpic == skyflatnum) // It's a single-sided line with sky for its sector
HWR_DrawSkyWall(wallVerts, &Surf, worldtop, INT32_MAX);
if (gr_frontsector->floorpic == skyflatnum)
HWR_DrawSkyWall(wallVerts, &Surf, INT32_MIN, worldbottom);
if (!gr_curline->polyseg)
{
if (gr_frontsector->ceilingpic == skyflatnum) // It's a single-sided line with sky for its sector
HWR_DrawSkyWall(wallVerts, &Surf, worldtop, INT32_MAX);
if (gr_frontsector->floorpic == skyflatnum)
HWR_DrawSkyWall(wallVerts, &Surf, INT32_MIN, worldbottom);
}
}
@ -2612,6 +2620,234 @@ static inline void HWR_AddPolyObjectSegs(void)
Z_Free(pv1);
Z_Free(gr_fakeline);
}
#ifdef POLYOBJECTS_PLANES
static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, fixed_t fixedheight,
FBITFIELD blendmode, UINT8 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector,
UINT8 alpha, extracolormap_t *planecolormap)
{
float height; //constant y for all points on the convex flat polygon
FOutVector *v3d;
INT32 i;
float flatxref,flatyref;
float fflatsize;
INT32 flatflag;
size_t len;
float scrollx = 0.0f, scrolly = 0.0f;
angle_t angle = 0;
FSurfaceInfo Surf;
fixed_t tempxsow, tempytow;
size_t nrPlaneVerts;
static FOutVector *planeVerts = NULL;
static UINT16 numAllocedPlaneVerts = 0;
nrPlaneVerts = polysector->numVertices;
height = FIXED_TO_FLOAT(fixedheight);
if (nrPlaneVerts < 3) //not even a triangle ?
return;
if (nrPlaneVerts > UINT16_MAX) // FIXME: exceeds plVerts size
{
CONS_Debug(DBG_RENDER, "polygon size of %d exceeds max value of %d vertices\n", nrPlaneVerts, UINT16_MAX);
return;
}
// Allocate plane-vertex buffer if we need to
if (!planeVerts || nrPlaneVerts > numAllocedPlaneVerts)
{
numAllocedPlaneVerts = (UINT16)nrPlaneVerts;
Z_Free(planeVerts);
Z_Malloc(numAllocedPlaneVerts * sizeof (FOutVector), PU_LEVEL, &planeVerts);
}
len = W_LumpLength(lumpnum);
switch (len)
{
case 4194304: // 2048x2048 lump
fflatsize = 2048.0f;
flatflag = 2047;
break;
case 1048576: // 1024x1024 lump
fflatsize = 1024.0f;
flatflag = 1023;
break;
case 262144:// 512x512 lump
fflatsize = 512.0f;
flatflag = 511;
break;
case 65536: // 256x256 lump
fflatsize = 256.0f;
flatflag = 255;
break;
case 16384: // 128x128 lump
fflatsize = 128.0f;
flatflag = 127;
break;
case 1024: // 32x32 lump
fflatsize = 32.0f;
flatflag = 31;
break;
default: // 64x64 lump
fflatsize = 64.0f;
flatflag = 63;
break;
}
// reference point for flat texture coord for each vertex around the polygon
flatxref = (float)(((fixed_t)FIXED_TO_FLOAT(polysector->origVerts[0].x) & (~flatflag)) / fflatsize);
flatyref = (float)(((fixed_t)FIXED_TO_FLOAT(polysector->origVerts[0].y) & (~flatflag)) / fflatsize);
// transform
v3d = planeVerts;
if (FOFsector != NULL)
{
if (fixedheight == FOFsector->floorheight) // it's a floor
{
scrollx = FIXED_TO_FLOAT(FOFsector->floor_xoffs)/fflatsize;
scrolly = FIXED_TO_FLOAT(FOFsector->floor_yoffs)/fflatsize;
angle = FOFsector->floorpic_angle>>ANGLETOFINESHIFT;
}
else // it's a ceiling
{
scrollx = FIXED_TO_FLOAT(FOFsector->ceiling_xoffs)/fflatsize;
scrolly = FIXED_TO_FLOAT(FOFsector->ceiling_yoffs)/fflatsize;
angle = FOFsector->ceilingpic_angle>>ANGLETOFINESHIFT;
}
}
else if (gr_frontsector)
{
if (fixedheight < dup_viewz) // it's a floor
{
scrollx = FIXED_TO_FLOAT(gr_frontsector->floor_xoffs)/fflatsize;
scrolly = FIXED_TO_FLOAT(gr_frontsector->floor_yoffs)/fflatsize;
angle = gr_frontsector->floorpic_angle>>ANGLETOFINESHIFT;
}
else // it's a ceiling
{
scrollx = FIXED_TO_FLOAT(gr_frontsector->ceiling_xoffs)/fflatsize;
scrolly = FIXED_TO_FLOAT(gr_frontsector->ceiling_yoffs)/fflatsize;
angle = gr_frontsector->ceilingpic_angle>>ANGLETOFINESHIFT;
}
}
if (angle) // Only needs to be done if there's an altered angle
{
// This needs to be done so that it scrolls in a different direction after rotation like software
tempxsow = FLOAT_TO_FIXED(scrollx);
tempytow = FLOAT_TO_FIXED(scrolly);
scrollx = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
scrolly = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
// This needs to be done so everything aligns after rotation
// It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does
tempxsow = FLOAT_TO_FIXED(flatxref);
tempytow = FLOAT_TO_FIXED(flatyref);
flatxref = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
flatyref = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
}
for (i = 0; i < (INT32)nrPlaneVerts; i++,v3d++)
{
// Hurdler: add scrolling texture on floor/ceiling
v3d->sow = (float)((FIXED_TO_FLOAT(polysector->origVerts[i].x) / fflatsize) - flatxref + scrollx); // Go from the polysector's original vertex locations
v3d->tow = (float)(flatyref - (FIXED_TO_FLOAT(polysector->origVerts[i].y) / fflatsize) + scrolly); // Means the flat is offset based on the original vertex locations
// Need to rotate before translate
if (angle) // Only needs to be done if there's an altered angle
{
tempxsow = FLOAT_TO_FIXED(v3d->sow);
tempytow = FLOAT_TO_FIXED(v3d->tow);
v3d->sow = (FIXED_TO_FLOAT(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
v3d->tow = (FIXED_TO_FLOAT(-FixedMul(tempxsow, FINESINE(angle)) - FixedMul(tempytow, FINECOSINE(angle))));
}
v3d->x = FIXED_TO_FLOAT(polysector->lines[i]->v1->x);
v3d->y = height;
v3d->z = FIXED_TO_FLOAT(polysector->lines[i]->v1->y);
}
if (planecolormap)
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, planecolormap->rgba, planecolormap->fadergba, false, true);
else
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, true);
if (blendmode & PF_Translucent)
{
Surf.FlatColor.s.alpha = (UINT8)alpha;
blendmode |= PF_Modulated|PF_Occlude|PF_Clip;
}
else
blendmode |= PF_Masked|PF_Modulated|PF_Clip;
HWD.pfnDrawPolygon(&Surf, planeVerts, nrPlaneVerts, blendmode);
}
static void HWR_AddPolyObjectPlanes(void)
{
size_t i;
sector_t *polyobjsector;
// Polyobject Planes need their own function for drawing because they don't have extrasubsectors by themselves
// It should be okay because polyobjects should always be convex anyway
for (i = 0; i < numpolys; i++)
{
polyobjsector = po_ptrs[i]->lines[0]->backsector; // the in-level polyobject sector
if (!(po_ptrs[i]->flags & POF_RENDERPLANES)) // Only render planes when you should
continue;
if (po_ptrs[i]->translucency >= NUMTRANSMAPS)
continue;
if (polyobjsector->floorheight <= gr_frontsector->ceilingheight
&& polyobjsector->floorheight >= gr_frontsector->floorheight
&& (viewz < polyobjsector->floorheight))
{
if (po_ptrs[i]->translucency > 0)
{
FSurfaceInfo Surf;
FBITFIELD blendmode = HWR_TranstableToAlpha(po_ptrs[i]->translucency, &Surf);
HWR_AddTransparentPolyobjectFloor(levelflats[polyobjsector->floorpic].lumpnum, po_ptrs[i], polyobjsector->floorheight,
polyobjsector->lightlevel, Surf.FlatColor.s.alpha, polyobjsector, blendmode, NULL);
}
else
{
HWR_GetFlat(levelflats[polyobjsector->floorpic].lumpnum);
HWR_RenderPolyObjectPlane(po_ptrs[i], polyobjsector->floorheight, PF_Occlude,
polyobjsector->lightlevel, levelflats[polyobjsector->floorpic].lumpnum,
polyobjsector, 255, NULL);
}
}
if (polyobjsector->ceilingheight >= gr_frontsector->floorheight
&& polyobjsector->ceilingheight <= gr_frontsector->ceilingheight
&& (viewz > polyobjsector->ceilingheight))
{
if (po_ptrs[i]->translucency > 0)
{
FSurfaceInfo Surf;
FBITFIELD blendmode = HWR_TranstableToAlpha(po_ptrs[i]->translucency, &Surf);
HWR_AddTransparentPolyobjectFloor(levelflats[polyobjsector->ceilingpic].lumpnum, po_ptrs[i], polyobjsector->ceilingheight,
polyobjsector->lightlevel, Surf.FlatColor.s.alpha, polyobjsector, blendmode, NULL);
}
else
{
HWR_GetFlat(levelflats[polyobjsector->ceilingpic].lumpnum);
HWR_RenderPolyObjectPlane(po_ptrs[i], polyobjsector->ceilingheight, PF_Occlude,
polyobjsector->lightlevel, levelflats[polyobjsector->floorpic].lumpnum,
polyobjsector, 255, NULL);
}
}
}
}
#endif
#endif
// -----------------+
@ -2922,8 +3158,13 @@ static void HWR_Subsector(size_t num)
// Draw polyobject lines.
HWR_AddPolyObjectSegs();
// Draw polyobject planes
//HWR_AddPolyObjectPlanes();
#ifdef POLYOBJECTS_PLANES
if (sub->validcount != validcount) // This validcount situation seems to let us know that the floors have already been drawn.
{
// Draw polyobject planes
HWR_AddPolyObjectPlanes();
}
#endif
}
#endif
@ -3246,6 +3487,46 @@ static fixed_t HWR_OpaqueFloorAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t hei
return floorz;
}
//
// HWR_DoCulling
// Hardware version of R_DoCulling
// (see r_main.c)
static boolean HWR_DoCulling(line_t *cullheight, line_t *viewcullheight, float vz, float bottomh, float toph)
{
float cullplane;
if (!cullheight)
return false;
cullplane = FIXED_TO_FLOAT(cullheight->frontsector->floorheight);
if (cullheight->flags & ML_NOCLIMB) // Group culling
{
if (!viewcullheight)
return false;
// Make sure this is part of the same group
if (viewcullheight->frontsector == cullheight->frontsector)
{
// OK, we can cull
if (vz > cullplane && toph < cullplane) // Cull if below plane
return true;
if (bottomh > cullplane && vz <= cullplane) // Cull if above plane
return true;
}
}
else // Quick culling
{
if (vz > cullplane && toph < cullplane) // Cull if below plane
return true;
if (bottomh > cullplane && vz <= cullplane) // Cull if above plane
return true;
}
return false;
}
// -----------------+
// HWR_DrawSprite : Draw flat sprites
// : (monsters, bonuses, weapons, lights, ...)
@ -3804,6 +4085,22 @@ typedef struct
static size_t numplanes = 0; // a list of transparent floors to be drawn
static planeinfo_t *planeinfo = NULL;
typedef struct
{
polyobj_t *polysector;
fixed_t fixedheight;
INT32 lightlevel;
lumpnum_t lumpnum;
INT32 alpha;
sector_t *FOFSector;
FBITFIELD blend;
extracolormap_t *planecolormap;
INT32 drawcount;
} polyplaneinfo_t;
static size_t numpolyplanes = 0; // a list of transparent poyobject floors to be drawn
static polyplaneinfo_t *polyplaneinfo = NULL;
#ifndef SORTING
size_t numfloors = 0;
#else
@ -3813,6 +4110,7 @@ size_t numfloors = 0;
typedef struct gr_drawnode_s
{
planeinfo_t *plane;
polyplaneinfo_t *polyplane;
wallinfo_t *wall;
gr_vissprite_t *sprite;
@ -3853,6 +4151,35 @@ void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub,
numplanes++;
}
// Adding this for now until I can create extrasubsector info for polyobjects
// When that happens it'll just be done through HWR_AddTransparentFloor and HWR_RenderPlane
void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector,
fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap)
{
static size_t allocedpolyplanes = 0;
// Force realloc if buffer has been freed
if (!polyplaneinfo)
allocedpolyplanes = 0;
if (allocedpolyplanes < numpolyplanes + 1)
{
allocedpolyplanes += MAX_TRANSPARENTFLOOR;
Z_Realloc(polyplaneinfo, allocedpolyplanes * sizeof (*polyplaneinfo), PU_LEVEL, &polyplaneinfo);
}
polyplaneinfo[numpolyplanes].fixedheight = fixedheight;
polyplaneinfo[numpolyplanes].lightlevel = lightlevel;
polyplaneinfo[numpolyplanes].lumpnum = lumpnum;
polyplaneinfo[numpolyplanes].polysector = polysector;
polyplaneinfo[numpolyplanes].alpha = alpha;
polyplaneinfo[numpolyplanes].FOFSector = FOFSector;
polyplaneinfo[numpolyplanes].blend = blend;
polyplaneinfo[numpolyplanes].planecolormap = planecolormap;
polyplaneinfo[numpolyplanes].drawcount = drawcount++;
numpolyplanes++;
}
//
// HWR_CreateDrawNodes
// Creates and sorts a list of drawnodes for the scene being rendered.
@ -3865,12 +4192,13 @@ static void HWR_CreateDrawNodes(void)
// Could this be optimized into _AddTransparentWall/_AddTransparentPlane?
// Hell yes! But sort algorithm must be modified to use a linked list.
gr_drawnode_t *sortnode = Z_Calloc((sizeof(planeinfo_t)*numplanes)
+ (sizeof(polyplaneinfo_t)*numpolyplanes)
+ (sizeof(wallinfo_t)*numwalls)
,PU_STATIC, NULL);
// todo:
// However, in reality we shouldn't be re-copying and shifting all this information
// that is already lying around. This should all be in some sort of linked list or lists.
size_t *sortindex = Z_Calloc(sizeof(size_t) * (numplanes + numwalls), PU_STATIC, NULL);
size_t *sortindex = Z_Calloc(sizeof(size_t) * (numplanes + numpolyplanes + numwalls), PU_STATIC, NULL);
// If true, swap the draw order.
boolean shift = false;
@ -3881,6 +4209,12 @@ static void HWR_CreateDrawNodes(void)
sortindex[p] = p;
}
for (i = 0; i < numpolyplanes; i++, p++)
{
sortnode[p].polyplane = &polyplaneinfo[i];
sortindex[p] = p;
}
for (i = 0; i < numwalls; i++, p++)
{
sortnode[p].wall = &wallinfo[i];
@ -3916,6 +4250,12 @@ static void HWR_CreateDrawNodes(void)
if (ABS(sortnode[sortindex[i]].plane->fixedheight - pviewz) > ABS(sortnode[sortindex[prev]].plane->fixedheight - pviewz))
shift = true;
}
if (sortnode[sortindex[prev]].polyplane)
{
// Plane (i) is further away than polyplane (prev)
if (ABS(sortnode[sortindex[i]].plane->fixedheight - pviewz) > ABS(sortnode[sortindex[prev]].polyplane->fixedheight - pviewz))
shift = true;
}
else if (sortnode[sortindex[prev]].wall)
{
// Plane (i) is further than wall (prev)
@ -3923,6 +4263,28 @@ static void HWR_CreateDrawNodes(void)
shift = true;
}
}
else if (sortnode[sortindex[i]].polyplane)
{
// What are we comparing it with?
if (sortnode[sortindex[prev]].plane)
{
// Plane (i) is further away than plane (prev)
if (ABS(sortnode[sortindex[i]].polyplane->fixedheight - pviewz) > ABS(sortnode[sortindex[prev]].plane->fixedheight - pviewz))
shift = true;
}
if (sortnode[sortindex[prev]].polyplane)
{
// Plane (i) is further away than polyplane (prev)
if (ABS(sortnode[sortindex[i]].polyplane->fixedheight - pviewz) > ABS(sortnode[sortindex[prev]].polyplane->fixedheight - pviewz))
shift = true;
}
else if (sortnode[sortindex[prev]].wall)
{
// Plane (i) is further than wall (prev)
if (sortnode[sortindex[i]].polyplane->drawcount > sortnode[sortindex[prev]].wall->drawcount)
shift = true;
}
}
else if (sortnode[sortindex[i]].wall)
{
// What are we comparing it with?
@ -3932,6 +4294,12 @@ static void HWR_CreateDrawNodes(void)
if (sortnode[sortindex[i]].wall->drawcount > sortnode[sortindex[prev]].plane->drawcount)
shift = true;
}
if (sortnode[sortindex[prev]].polyplane)
{
// Wall (i) is further than polyplane(prev)
if (sortnode[sortindex[i]].wall->drawcount > sortnode[sortindex[prev]].polyplane->drawcount)
shift = true;
}
else if (sortnode[sortindex[prev]].wall)
{
// Wall (i) is further than wall (prev)
@ -3968,6 +4336,16 @@ static void HWR_CreateDrawNodes(void)
HWR_RenderPlane(NULL, sortnode[sortindex[i]].plane->xsub, sortnode[sortindex[i]].plane->fixedheight, sortnode[sortindex[i]].plane->blend, sortnode[sortindex[i]].plane->lightlevel,
sortnode[sortindex[i]].plane->lumpnum, sortnode[sortindex[i]].plane->FOFSector, sortnode[sortindex[i]].plane->alpha, sortnode[sortindex[i]].plane->fogplane, sortnode[sortindex[i]].plane->planecolormap);
}
else if (sortnode[sortindex[i]].polyplane)
{
// We aren't traversing the BSP tree, so make gr_frontsector null to avoid crashes.
gr_frontsector = NULL;
if (!(sortnode[sortindex[i]].polyplane->blend & PF_NoTexture))
HWR_GetFlat(sortnode[sortindex[i]].polyplane->lumpnum);
HWR_RenderPolyObjectPlane(sortnode[sortindex[i]].polyplane->polysector, sortnode[sortindex[i]].polyplane->fixedheight, sortnode[sortindex[i]].polyplane->blend, sortnode[sortindex[i]].polyplane->lightlevel,
sortnode[sortindex[i]].polyplane->lumpnum, sortnode[sortindex[i]].polyplane->FOFSector, sortnode[sortindex[i]].polyplane->alpha, sortnode[sortindex[i]].polyplane->planecolormap);
}
else if (sortnode[sortindex[i]].wall)
{
if (!(sortnode[sortindex[i]].wall->blend & PF_NoTexture))
@ -3979,6 +4357,7 @@ static void HWR_CreateDrawNodes(void)
numwalls = 0;
numplanes = 0;
numpolyplanes = 0;
// No mem leaks, please.
Z_Free(sortnode);
@ -4268,29 +4647,8 @@ static void HWR_ProjectSprite(mobj_t *thing)
if (thing->subsector->sector->cullheight)
{
float cullplane = FIXED_TO_FLOAT(thing->subsector->sector->cullheight->frontsector->floorheight);
if (thing->subsector->sector->cullheight->flags & ML_NOCLIMB) // Group culling
{
// Make sure this is part of the same group
if (viewsector->cullheight && viewsector->cullheight->frontsector
== thing->subsector->sector->cullheight->frontsector)
{
// OK, we can cull
if (gr_viewz > cullplane && gzt < cullplane) // Cull if below plane
return;
if (gz > cullplane && gr_viewz <= cullplane) // Cull if above plane
return;
}
}
else // Quick culling
{
if (gr_viewz > cullplane && gzt < cullplane) // Cull if below plane
return;
if (gz > cullplane && gr_viewz <= cullplane) // Cull if above plane
return;
}
if (HWR_DoCulling(thing->subsector->sector->cullheight, viewsector->cullheight, gr_viewz, gz, gzt))
return;
}
heightsec = thing->subsector->sector->heightsec;
@ -4456,6 +4814,8 @@ static void HWR_DrawSkyBackground(player_t *player)
FOutVector v[4];
angle_t angle;
float dimensionmultiply;
float aspectratio;
float angleturn;
// 3--2
// | /|
@ -4490,10 +4850,10 @@ static void HWR_DrawSkyBackground(player_t *player)
// Y
angle = aimingangle;
float aspectratio = (float)vid.width/(float)vid.height;
aspectratio = (float)vid.width/(float)vid.height;
dimensionmultiply = ((float)textures[skytexture]->height/(128.0f*aspectratio));
float angleturn = (((float)ANGLE_45-1.0f)*aspectratio)*dimensionmultiply;
angleturn = (((float)ANGLE_45-1.0f)*aspectratio)*dimensionmultiply;
// Middle of the sky should always be at angle 0
// need to keep correct aspect ratio with X
@ -4768,7 +5128,7 @@ if (0)
#endif
#ifdef SORTING
if (numplanes || numwalls) //Hurdler: render 3D water and transparent walls after everything
if (numplanes || numpolyplanes || numwalls) //Hurdler: render 3D water and transparent walls after everything
{
HWR_CreateDrawNodes();
}
@ -4998,12 +5358,12 @@ if (0)
#endif
#ifdef SORTING
if (numplanes || numwalls) //Hurdler: render 3D water and transparent walls after everything
if (numplanes || numpolyplanes || numwalls) //Hurdler: render 3D water and transparent walls after everything
{
HWR_CreateDrawNodes();
}
#else
if (numfloors || numwalls)
if (numfloors || numpolyplanes || numwalls)
{
HWD.pfnSetTransform(&atransform);
if (numfloors)

View file

@ -366,10 +366,7 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode)
else
maximumAnisotropy = 0;
#ifndef MINI_GL_COMPATIBILITY
SetupGLFunc13();
#endif
screen_depth = (GLbyte)(lvid->bpp*8);
if (screen_depth > 16)

View file

@ -399,10 +399,10 @@ static PFNgluBuild2DMipmaps pgluBuild2DMipmaps;
#ifndef MINI_GL_COMPATIBILITY
/* 1.3 functions for multitexturing */
typedef void (APIENTRY *PFNGLACTIVETEXTUREPROC) (GLenum);
static PFNGLACTIVETEXTUREPROC pglActiveTexture;
typedef void (APIENTRY *PFNGLMULTITEXCOORD2FPROC) (GLenum, GLfloat, GLfloat);
static PFNGLMULTITEXCOORD2FPROC pglMultiTexCoord2f;
typedef void (APIENTRY *PFNglActiveTexture) (GLenum);
static PFNglActiveTexture pglActiveTexture;
typedef void (APIENTRY *PFNglMultiTexCoord2f) (GLenum, GLfloat, GLfloat);
static PFNglMultiTexCoord2f pglMultiTexCoord2f;
#endif
#endif
@ -517,38 +517,33 @@ boolean SetupGLfunc(void)
return true;
}
#ifndef MINI_GL_COMPATIBILITY
// This has to be done after the context is created so the version number can be obtained
boolean SetupGLFunc13(void)
{
#ifndef STATIC_OPENGL
#define GETOPENGLFUNC(func, proc) \
func = GetGLFunc(#proc); \
if (!func) \
{ \
DBG_Printf("failed to get OpenGL function: %s", #proc); \
} \
const char *glversion = (const char *)pglGetString(GL_VERSION);
UINT32 majorversion = 0, minorversion = 0;
if (glversion != NULL && sscanf((char *)glversion, "%u.%u", &majorversion, &minorversion) == 2) // There is a version number I can identify
#ifdef MINI_GL_COMPATIBILITY
return false;
#else
#ifdef STATIC_OPENGL
gl13 = true;
#else
if (isExtAvailable("GL_ARB_multitexture", gl_extensions))
{
if (majorversion > 1 || (majorversion == 1 && minorversion >= 3)) // Version of OpenGL is equal to or greater than 1.3
{
// Get the functions
GETOPENGLFUNC(pglActiveTexture , glActiveTexture)
GETOPENGLFUNC(pglMultiTexCoord2f , glMultiTexCoord2f)
// Get the functions
pglActiveTexture = GetGLFunc("glActiveTextureARB");
pglMultiTexCoord2f = GetGLFunc("glMultiTexCoord2fARB");
gl13 = true; // This is now true, so the new fade mask stuff can be done, if OpenGL version is less than 1.3, it still uses the old fade stuff.
DBG_Printf("GL_ARB_multitexture support: enabled\n");
gl13 = true; // This is now true, so the new fade mask stuff can be done, if OpenGL version is less than 1.3, it still uses the old fade stuff.
}
}
else
DBG_Printf("GL_ARB_multitexture support: disabled\n");
#undef GETOPENGLFUNC
#endif
return true;
}
#endif
}
// -----------------+
// SetNoTexture : Disable texture

View file

@ -1028,20 +1028,26 @@ UINT16 hu_demorings;
static void HU_DrawDemoInfo(void)
{
V_DrawString(4, 188-24, V_YELLOWMAP, va(M_GetText("%s's replay"), player_names[0]));
V_DrawString(4, 188-16, V_YELLOWMAP|V_MONOSPACE, "SCORE:");
V_DrawRightAlignedString(120, 188-16, V_MONOSPACE, va("%d", hu_demoscore));
if (modeattacking)
{
V_DrawString(4, 188-16, V_YELLOWMAP|V_MONOSPACE, "SCORE:");
V_DrawRightAlignedString(120, 188-16, V_MONOSPACE, va("%d", hu_demoscore));
V_DrawString(4, 188- 8, V_YELLOWMAP|V_MONOSPACE, "TIME:");
if (hu_demotime != UINT32_MAX)
V_DrawRightAlignedString(120, 188- 8, V_MONOSPACE, va("%i:%02i.%02i",
G_TicsToMinutes(hu_demotime,true),
G_TicsToSeconds(hu_demotime),
G_TicsToCentiseconds(hu_demotime)));
else
V_DrawRightAlignedString(120, 188- 8, V_MONOSPACE, "--:--.--");
V_DrawString(4, 188- 8, V_YELLOWMAP|V_MONOSPACE, "TIME:");
if (hu_demotime != UINT32_MAX)
V_DrawRightAlignedString(120, 188- 8, V_MONOSPACE, va("%i:%02i.%02i",
G_TicsToMinutes(hu_demotime,true),
G_TicsToSeconds(hu_demotime),
G_TicsToCentiseconds(hu_demotime)));
else
V_DrawRightAlignedString(120, 188- 8, V_MONOSPACE, "--:--.--");
V_DrawString(4, 188 , V_YELLOWMAP|V_MONOSPACE, "RINGS:");
V_DrawRightAlignedString(120, 188 , V_MONOSPACE, va("%d", hu_demorings));
if (modeattacking == ATTACKING_RECORD)
{
V_DrawString(4, 188 , V_YELLOWMAP|V_MONOSPACE, "RINGS:");
V_DrawRightAlignedString(120, 188 , V_MONOSPACE, va("%d", hu_demorings));
}
}
}
// Heads up displays drawer, call each frame

View file

@ -570,7 +570,7 @@ state_t states[NUMSTATES] =
{SPR_EGGO, 9, 8, {A_BossScream}, 0, 0, S_EGGMOBILE3_DIE14}, // S_EGGMOBILE3_DIE13
{SPR_EGGO, 9, -1, {A_BossDeath}, 0, 0, S_NULL}, // S_EGGMOBILE3_DIE14
{SPR_EGGO, 10, 5, {NULL}, 0, 0, S_EGGMOBILE3_FLEE2}, // S_EGGMOBILE3_FLEE1
{SPR_EGGO, 11, 5, {A_BossScream}, 0, 0, S_EGGMOBILE3_FLEE1}, // S_EGGMOBILE3_FLEE2
{SPR_EGGO, 11, 5, {NULL}, 0, 0, S_EGGMOBILE3_FLEE1}, // S_EGGMOBILE3_FLEE2
// Boss 3 Propeller
{SPR_PRPL, 0, 1, {NULL}, 0, 0, S_PROPELLER2}, // S_PROPELLER1
@ -3349,7 +3349,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // seesound
2*TICRATE, // reactiontime
sfx_None, // attacksound
S_CCOMMAND1, // painstate
S_CCOMMAND3, // painstate
200, // painchance
sfx_dmpain, // painsound
S_NULL, // meleestate
@ -13452,7 +13452,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},
@ -13479,7 +13479,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},
@ -13506,7 +13506,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},
@ -13533,7 +13533,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},
@ -13560,7 +13560,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},
@ -13587,7 +13587,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},
@ -13614,7 +13614,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},
@ -13641,7 +13641,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},
@ -13668,7 +13668,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},
@ -13695,7 +13695,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},
@ -13722,7 +13722,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},
@ -13749,7 +13749,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},
@ -13776,7 +13776,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},
@ -13803,7 +13803,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},
@ -13830,7 +13830,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},
@ -13857,7 +13857,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
1000, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP, // flags
MF_NOBLOCKMAP|MF_NOCLIPTHING|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},

View file

@ -1744,7 +1744,26 @@ static int lib_gDoReborn(lua_State *L)
static int lib_gExitLevel(lua_State *L)
{
int n = lua_gettop(L); // Num arguments
NOHUD
// LUA EXTENSION: Custom exit like support
// Supported:
// G_ExitLevel(); [no modifications]
// G_ExitLevel(int) [nextmap override only]
// G_ExitLevel(bool) [skipstats only]
// G_ExitLevel(int, bool) [both of the above]
if (n >= 1)
{
if (lua_isnumber(L, 1) || n >= 2)
{
nextmapoverride = (INT16)luaL_checknumber(L, 1);
lua_pop(L, 1); // pop nextmapoverride; skipstats now 1 if available
}
skipstats = lua_optboolean(L, 1);
}
// ---
G_ExitLevel();
return 0;
}

View file

@ -71,7 +71,7 @@ boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source); // Ho
#define LUAh_JumpSpinSpecial(player) LUAh_PlayerHook(player, hook_JumpSpinSpecial) // Hook for P_DoJumpStuff (Spin button effect (mid-air))
boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd
boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo); // Hook for linedef executors
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages
boolean LUAh_DeathMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages

Some files were not shown because too many files have changed in this diff Show more