mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 15:32:33 +00:00
Merge branch 'next' into next-newcontrols
# Conflicts: # src/g_game.c # src/p_setup.c
This commit is contained in:
commit
b22de48c03
93 changed files with 16341 additions and 7241 deletions
77
extras/conf/Includes/Game_SRB222.cfg
Normal file
77
extras/conf/Includes/Game_SRB222.cfg
Normal file
|
@ -0,0 +1,77 @@
|
|||
// Default lump name for new map
|
||||
defaultlumpname = "MAP01";
|
||||
//GZDB specific. Don't try to load lumps that don't exist.
|
||||
basegame = 0;
|
||||
|
||||
//Sky textures for vanilla maps
|
||||
defaultskytextures
|
||||
{
|
||||
SKY1 = "MAP01,MAP02,MAP03,MAP33,MAP50,MAP60,MAPF0,MAPM0";
|
||||
SKY2 = "MAPM7,MAPMB";
|
||||
SKY4 = "MAP04,MAP06,MAP61,MAPF6,MAPM1";
|
||||
SKY6 = "MAP05,MAP51,MAPMA";
|
||||
SKY7 = "MAPM2,MAPM5";
|
||||
SKY8 = "MAP07,MAP08,MAP09,MAP52,MAP62,MAPF1";
|
||||
SKY10 = "MAP10,MAP12,MAP53,MAP63,MAPM3";
|
||||
SKY11 = "MAP11,MAPF7";
|
||||
SKY13 = "MAP13,MAP64";
|
||||
SKY14 = "MAP14";
|
||||
SKY15 = "MAP15,MAP54";
|
||||
SKY17 = "MAP70";
|
||||
SKY20 = "MAP32,MAP55,MAP65,MAPF2,MAPF5";
|
||||
SKY21 = "MAPM4";
|
||||
SKY22 = "MAP22,MAP23,MAP25,MAP26,MAP27,MAP56,MAP66,MAPF4,MAPM6";
|
||||
SKY30 = "MAP30";
|
||||
SKY31 = "MAP31";
|
||||
SKY35 = "MAP42";
|
||||
SKY40 = "MAP41,MAP71,MAPM9";
|
||||
SKY55 = "MAPF3,MAPM8";
|
||||
SKY68 = "MAPF8";
|
||||
SKY99 = "MAP57,MAPZ0";
|
||||
SKY159 = "MAP16";
|
||||
SKY172 = "MAP40";
|
||||
SKY300 = "MAP72";
|
||||
SKY301 = "MAP73";
|
||||
}
|
||||
|
||||
// Skill levels
|
||||
skills
|
||||
{
|
||||
1 = "Normal";
|
||||
}
|
||||
|
||||
// Skins
|
||||
skins
|
||||
{
|
||||
Sonic;
|
||||
Tails;
|
||||
Knuckles;
|
||||
Amy;
|
||||
Fang;
|
||||
Metalsonic;
|
||||
}
|
||||
|
||||
// Gametypes
|
||||
gametypes
|
||||
{
|
||||
-1 = "Single Player";
|
||||
0 = "Co-op";
|
||||
1 = "Competition";
|
||||
2 = "Race";
|
||||
3 = "Match";
|
||||
4 = "Team Match";
|
||||
5 = "Tag";
|
||||
6 = "Hide and Seek";
|
||||
7 = "CTF";
|
||||
}
|
||||
|
||||
// Texture loading options
|
||||
defaultwalltexture = "GFZROCK";
|
||||
defaultfloortexture = "GFZFLR01";
|
||||
defaultceilingtexture = "F_SKY1";
|
||||
|
||||
// Default texture sets
|
||||
// (these are not required, but useful for new users)
|
||||
texturesets
|
||||
{
|
||||
}
|
309
extras/conf/Includes/SRB222_common.cfg
Normal file
309
extras/conf/Includes/SRB222_common.cfg
Normal file
|
@ -0,0 +1,309 @@
|
|||
common
|
||||
{
|
||||
// Some common settings
|
||||
|
||||
|
||||
|
||||
// Default testing parameters
|
||||
testparameters = "-file \"%AP\" \"%F\" -warp %L";
|
||||
testshortpaths = true;
|
||||
|
||||
// Action special help (mxd)
|
||||
actionspecialhelp = "https://wiki.srb2.org/wiki/Linedef_type_%K";
|
||||
|
||||
// Default nodebuilder configurations
|
||||
defaultsavecompiler = "zennode_normal";
|
||||
defaulttestcompiler = "zennode_fast";
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = false;
|
||||
generalizedsectors = true;
|
||||
|
||||
mixtexturesflats = true;
|
||||
defaulttexturescale = 1.0f;
|
||||
defaultflatscale = 1.0f;
|
||||
scaledtextureoffsets = true;
|
||||
|
||||
// Thing number for start position in 3D Mode
|
||||
start3dmode = 3328;
|
||||
|
||||
// Texture sources
|
||||
textures
|
||||
{
|
||||
include("SRB222_misc.cfg", "textures");
|
||||
}
|
||||
|
||||
// Patch sources
|
||||
patches
|
||||
{
|
||||
include("SRB222_misc.cfg", "patches");
|
||||
}
|
||||
|
||||
// Sprite sources
|
||||
sprites
|
||||
{
|
||||
include("SRB222_misc.cfg", "sprites");
|
||||
}
|
||||
|
||||
// Flat sources
|
||||
flats
|
||||
{
|
||||
include("SRB222_misc.cfg", "flats");
|
||||
}
|
||||
}
|
||||
|
||||
mapformat_doom
|
||||
{
|
||||
// The format interface handles the map data format - DoomMapSetIO for SRB2DB2, SRB2MapSetIO for Zone Builder
|
||||
formatinterface = "SRB2MapSetIO";
|
||||
|
||||
/*
|
||||
GAME DETECT PATTERN
|
||||
Used to guess the game for which a WAD file is made.
|
||||
|
||||
1 = One of these lumps must exist
|
||||
2 = None of these lumps must exist
|
||||
3 = All of these lumps must exist
|
||||
*/
|
||||
|
||||
gamedetect
|
||||
{
|
||||
EXTENDED = 2;
|
||||
|
||||
|
||||
BEHAVIOR = 2;
|
||||
|
||||
E#M# = 2;
|
||||
|
||||
MAP?? = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
MAP LUMP NAMES
|
||||
Map lumps are loaded with the map as long as they are right after each other. When the editor
|
||||
meets a lump which is not defined in this list it will ignore the map if not satisfied.
|
||||
The order of items defines the order in which lumps will be written to WAD file on save.
|
||||
To indicate the map header lump, use ~MAP
|
||||
|
||||
Legenda:
|
||||
required = Lump is required to exist.
|
||||
blindcopy = Lump will be copied along with the map blindly. (usefull for lumps Doom Builder doesn't use)
|
||||
nodebuild = The nodebuilder generates this lump.
|
||||
allowempty = The nodebuilder is allowed to leave this lump empty.
|
||||
script = This lump is a text-based script. Specify the filename of the script configuration to use.
|
||||
*/
|
||||
|
||||
maplumpnames
|
||||
{
|
||||
include("SRB222_misc.cfg", "doommaplumpnames");
|
||||
}
|
||||
|
||||
// When this is set to true, sectors with the same tag will light up when a line is highlighted
|
||||
linetagindicatesectors = true;
|
||||
|
||||
// Special linedefs
|
||||
include("SRB222_misc.cfg", "speciallinedefs");
|
||||
|
||||
// Default flags for first new thing (As far as 2.2 goes, they're empty just like in 2.1)
|
||||
defaultthingflags
|
||||
{
|
||||
}
|
||||
|
||||
// DEFAULT SECTOR BRIGHTNESS LEVELS
|
||||
sectorbrightness
|
||||
{
|
||||
include("SRB222_misc.cfg", "sectorbrightness");
|
||||
}
|
||||
|
||||
// SECTOR TYPES-----------------------------------------------------------------
|
||||
sectortypes
|
||||
{
|
||||
include("SRB222_sectors.cfg", "sectortypes");
|
||||
}
|
||||
|
||||
// GENERALISED SECTOR TYPES-----------------------------------------------------------------
|
||||
gen_sectortypes
|
||||
{
|
||||
include("SRB222_sectors.cfg", "gen_sectortypes");
|
||||
}
|
||||
|
||||
// LINEDEF FLAGS
|
||||
linedefflags
|
||||
{
|
||||
include("SRB222_misc.cfg", "linedefflags");
|
||||
}
|
||||
|
||||
// Linedef flags UDMF translation table
|
||||
// This is needed for copy/paste and prefabs to work properly
|
||||
// When the UDMF field name is prefixed with ! it is inverted
|
||||
linedefflagstranslation
|
||||
{
|
||||
include("SRB222_misc.cfg", "linedefflagstranslation");
|
||||
}
|
||||
|
||||
// LINEDEF ACTIVATIONS
|
||||
linedefactivations
|
||||
{
|
||||
}
|
||||
|
||||
// LINEDEF TYPES
|
||||
linedeftypes
|
||||
{
|
||||
include("SRB222_linedefs.cfg", "doom");
|
||||
}
|
||||
|
||||
// THING FLAGS
|
||||
thingflags
|
||||
{
|
||||
include("SRB222_misc.cfg", "thingflags");
|
||||
}
|
||||
|
||||
// Thing flags UDMF translation table
|
||||
// This is needed for copy/paste and prefabs to work properly
|
||||
// When the UDMF field name is prefixed with ! it is inverted
|
||||
thingflagstranslation
|
||||
{
|
||||
include("SRB222_misc.cfg", "thingflagstranslation");
|
||||
}
|
||||
|
||||
// THING FLAGS ERROR MASK
|
||||
// Mask for the thing flags which indicates the options
|
||||
// that make the same thing appear in the same modes
|
||||
thingflagsmask1 = 7; // 1 + 2 + 4
|
||||
thingflagsmask2 = 0;
|
||||
}
|
||||
|
||||
mapformat_udmf
|
||||
{
|
||||
// The format interface handles the map data format
|
||||
formatinterface = "UniversalMapSetIO";
|
||||
|
||||
// Enables support for long (> 8 chars) texture names
|
||||
// WARNING: this should only be enabled for UDMF game configurations!
|
||||
// WARNING: enabling this will make maps incompatible with Doom Builder 2 and can lead to problems in Slade 3!
|
||||
longtexturenames = false;
|
||||
|
||||
// Default nodebuilder configurations
|
||||
defaultsavecompiler = "zdbsp_udmf_normal";
|
||||
defaulttestcompiler = "zdbsp_udmf_fast";
|
||||
|
||||
engine = "srb2"; // override that so that DB2 uses the correct namespace
|
||||
|
||||
maplumpnames
|
||||
{
|
||||
include("UDMF_misc.cfg", "udmfmaplumpnames_begin");
|
||||
include("SRB222_misc.cfg", "udmfmaplumpnames");
|
||||
include("UDMF_misc.cfg", "udmfmaplumpnames_end");
|
||||
}
|
||||
|
||||
universalfields
|
||||
{
|
||||
// include("SRB222_misc.cfg", "universalfields");
|
||||
}
|
||||
|
||||
// When this is set to true, sectors with the same tag will light up when a line is highlighted
|
||||
linetagindicatesectors = false;
|
||||
|
||||
// Special linedefs
|
||||
include("SRB222_misc.cfg", "speciallinedefs_udmf");
|
||||
|
||||
// Default flags for first new thing (As far as 2.2 goes, they're empty just like in 2.1)
|
||||
defaultthingflags
|
||||
{
|
||||
}
|
||||
|
||||
// Generalized actions
|
||||
generalizedlinedefs = false;
|
||||
|
||||
// SECTOR FLAGS
|
||||
sectorflags
|
||||
{
|
||||
// include("SRB222_misc.cfg", "sectorflags");
|
||||
}
|
||||
|
||||
// DEFAULT SECTOR BRIGHTNESS LEVELS
|
||||
sectorbrightness
|
||||
{
|
||||
include("SRB222_misc.cfg", "sectorbrightness");
|
||||
}
|
||||
|
||||
// SECTOR TYPES
|
||||
sectortypes
|
||||
{
|
||||
include("SRB222_sectors.cfg", "sectortypes");
|
||||
}
|
||||
|
||||
// SECTOR RENSERSTYLES
|
||||
/* sectorrenderstyles
|
||||
{
|
||||
include("SRB222_misc.cfg", "sectorrenderstyles");
|
||||
}*/
|
||||
|
||||
// LINEDEF FLAGS
|
||||
linedefflags
|
||||
{
|
||||
include("SRB222_misc.cfg", "linedefflags_udmf");
|
||||
}
|
||||
|
||||
// LINEDEF ACTIVATIONS
|
||||
linedefactivations
|
||||
{
|
||||
include("SRB222_misc.cfg", "linedefactivations_udmf");
|
||||
}
|
||||
|
||||
linedefflagstranslation
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// LINEDEF RENSERSTYLES
|
||||
linedefrenderstyles
|
||||
{
|
||||
include("SRB222_misc.cfg", "linedefrenderstyles");
|
||||
}
|
||||
|
||||
//SIDEDEF FLAGS
|
||||
/* sidedefflags
|
||||
{
|
||||
include("UDMF_misc.cfg", "sidedefflags");
|
||||
}*/
|
||||
|
||||
// THING FLAGS
|
||||
thingflags
|
||||
{
|
||||
include("SRB222_misc.cfg", "thingflags_udmf");
|
||||
}
|
||||
|
||||
// Thing flags UDMF translation table
|
||||
// This is needed for copy/paste and prefabs to work properly
|
||||
// When the UDMF field name is prefixed with ! it is inverted
|
||||
thingflagstranslation
|
||||
{
|
||||
include("SRB222_misc.cfg", "thingflagstranslation");
|
||||
}
|
||||
|
||||
// THING RENSERSTYLES
|
||||
/* thingrenderstyles
|
||||
{
|
||||
include("SRB222_misc.cfg", "thingrenderstyles");
|
||||
}*/
|
||||
|
||||
// How to compare thing flags (for the stuck things error checker)
|
||||
/* thingflagscompare
|
||||
{
|
||||
include("UDMF_misc.cfg", "thingflagscompare");
|
||||
}*/
|
||||
|
||||
//mxd. Thing flags UDMF translation table
|
||||
// This is needed for copy/paste and prefabs to work properly
|
||||
// When the UDMF field name is prefixed with ! it is inverted
|
||||
thingflagstranslation
|
||||
{
|
||||
}
|
||||
|
||||
// LINEDEF TYPES
|
||||
linedeftypes
|
||||
{
|
||||
include("SRB222_linedefs.cfg", "udmf");
|
||||
}
|
||||
}
|
2486
extras/conf/Includes/SRB222_linedefs.cfg
Normal file
2486
extras/conf/Includes/SRB222_linedefs.cfg
Normal file
File diff suppressed because it is too large
Load diff
726
extras/conf/Includes/SRB222_misc.cfg
Normal file
726
extras/conf/Includes/SRB222_misc.cfg
Normal file
|
@ -0,0 +1,726 @@
|
|||
linedefflags
|
||||
{
|
||||
1 = "[0] Impassable";
|
||||
2 = "[1] Block Enemies";
|
||||
4 = "[2] Double-Sided";
|
||||
8 = "[3] Upper Unpegged";
|
||||
16 = "[4] Lower Unpegged";
|
||||
32 = "[5] Slope Skew (E1)";
|
||||
64 = "[6] Not Climbable";
|
||||
128 = "[7] No Midtexture Skew (E2)";
|
||||
256 = "[8] Peg Midtexture (E3)";
|
||||
512 = "[9] Solid Midtexture (E4)";
|
||||
1024 = "[10] Repeat Midtexture (E5)";
|
||||
2048 = "[11] Netgame Only";
|
||||
4096 = "[12] No Netgame";
|
||||
8192 = "[13] Effect 6";
|
||||
16384 = "[14] Bouncy Wall";
|
||||
32768 = "[15] Transfer Line";
|
||||
}
|
||||
|
||||
|
||||
// LINEDEF ACTIVATIONS
|
||||
// Make sure these are in order from lowest value to highest value
|
||||
linedefactivations
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Linedef flags UDMF translation table
|
||||
// This is needed for copy/paste and prefabs to work properly
|
||||
// When the UDMF field name is prefixed with ! it is inverted
|
||||
linedefflagstranslation
|
||||
{
|
||||
1 = "blocking";
|
||||
2 = "blockmonsters";
|
||||
4 = "twosided";
|
||||
8 = "dontpegtop";
|
||||
16 = "dontpegbottom";
|
||||
32 = "skewtd";
|
||||
64 = "noclimb";
|
||||
128 = "noskew";
|
||||
256 = "midpeg";
|
||||
512 = "midsolid";
|
||||
1024 = "wrapmidtex";
|
||||
2048 = "netonly";
|
||||
4096 = "nonet";
|
||||
8192 = "effect6";
|
||||
16384 = "bouncy";
|
||||
32768 = "transfer";
|
||||
}
|
||||
|
||||
|
||||
linedefflags_udmf
|
||||
{
|
||||
blocking = "Impassable";
|
||||
blockmonsters = "Block Enemies";
|
||||
twosided = "Double-Sided";
|
||||
dontpegtop = "Upper Unpegged";
|
||||
dontpegbottom = "Lower Unpegged";
|
||||
skewtd = "Slope Skew";
|
||||
noclimb = "Not Climbable";
|
||||
noskew = "No Midtexture Skew";
|
||||
midpeg = "Peg Midtexture";
|
||||
midsolid = "Solid Midtexture";
|
||||
wrapmidtex = "Repeat Midtexture";
|
||||
// netonly = "Netgame-Only special";
|
||||
// nonet = "No netgame special";
|
||||
// effect6 = "Effect 6";
|
||||
bouncy = "Bouncy Wall";
|
||||
// transfer = "Transfer Line";
|
||||
}
|
||||
|
||||
|
||||
linedefactivations_udmf
|
||||
{
|
||||
notriggerorder = "Out of Order";
|
||||
netonly = "Netgame-Only";
|
||||
nonet = "No netgame";
|
||||
}
|
||||
|
||||
sidedefflags
|
||||
{
|
||||
clipmidtex = "Clip middle texture";
|
||||
wrapmidtex = "Wrap middle texture";
|
||||
smoothlighting = "Smooth lighting";
|
||||
nofakecontrast = "Even lighting";
|
||||
nodecals = "No decals";
|
||||
lightfog = "Use sidedef brightness on fogged walls";
|
||||
}
|
||||
|
||||
//RENDER STYLES
|
||||
thingrenderstyles
|
||||
{
|
||||
}
|
||||
|
||||
linedefrenderstyles
|
||||
{
|
||||
translucent = "Translucent";
|
||||
fog = "Fog";
|
||||
}
|
||||
|
||||
sectorrenderstyles
|
||||
{
|
||||
}
|
||||
|
||||
thingflags
|
||||
{
|
||||
1 = "[1] Extra";
|
||||
2 = "[2] Flip";
|
||||
4 = "[4] Special";
|
||||
8 = "[8] Ambush";
|
||||
}
|
||||
|
||||
// THING FLAGS
|
||||
thingflags_udmf
|
||||
{
|
||||
extra = "Extra";
|
||||
flip = "Flip";
|
||||
special = "Special";
|
||||
ambush = "Ambush";
|
||||
}
|
||||
|
||||
|
||||
// Thing flags UDMF translation table
|
||||
// This is needed for copy/paste and prefabs to work properly
|
||||
// When the UDMF field name is prefixed with ! it is inverted
|
||||
thingflagstranslation
|
||||
{
|
||||
1 = "extra";
|
||||
2 = "flip";
|
||||
4 = "special";
|
||||
8 = "ambush";
|
||||
}
|
||||
|
||||
|
||||
// DEFAULT SECTOR BRIGHTNESS LEVELS
|
||||
sectorbrightness
|
||||
{
|
||||
255;
|
||||
248;
|
||||
240;
|
||||
232;
|
||||
224;
|
||||
216;
|
||||
208;
|
||||
200;
|
||||
192;
|
||||
184;
|
||||
176;
|
||||
168;
|
||||
160;
|
||||
152;
|
||||
144;
|
||||
136;
|
||||
128;
|
||||
120;
|
||||
112;
|
||||
104;
|
||||
96;
|
||||
88;
|
||||
80;
|
||||
72;
|
||||
64;
|
||||
56;
|
||||
48;
|
||||
40;
|
||||
32;
|
||||
24;
|
||||
16;
|
||||
8;
|
||||
0;
|
||||
}
|
||||
|
||||
/*
|
||||
TEXTURES AND FLAT SOURCES
|
||||
This tells Doom Builder where to find the information for textures
|
||||
and flats in the IWAD file, Addition WAD file and Map WAD file.
|
||||
|
||||
Start and end lumps must be given in a structure (of which the
|
||||
key name doesnt matter) and any textures or flats in between them
|
||||
are loaded in either the textures category or flats category.
|
||||
|
||||
For textures: PNAMES, TEXTURE1 and TEXTURE2 are loaded by default.
|
||||
*/
|
||||
textures
|
||||
{
|
||||
zdoom1
|
||||
{
|
||||
start = "TX_START";
|
||||
end = "TX_END";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ADDITIONAL UNIVERSAL DOOM MAP FORMAT FIELD DEFINITIONS
|
||||
Only add fields here that Doom Builder does not edit with its own user-interface!
|
||||
The "default" field must match the UDMF specifications!
|
||||
|
||||
Field data types:
|
||||
0 = integer *
|
||||
1 = float
|
||||
2 = string
|
||||
3 = bool
|
||||
4 = linedef action (integer) *
|
||||
5 = sector effect (integer) *
|
||||
6 = texture (string)
|
||||
7 = flat (string)
|
||||
8 = angle in degrees (integer)
|
||||
9 = angle in radians (float)
|
||||
10 = XXRRGGBB color (integer)
|
||||
11 = enum option (integer) *
|
||||
12 = enum bits (integer) *
|
||||
13 = sector tag (integer) *
|
||||
14 = thing tag (integer) *
|
||||
15 = linedef tag (integer) *
|
||||
16 = enum option (string)
|
||||
17 = angle in degrees (float)
|
||||
22 = byte angle (integer)
|
||||
*/
|
||||
universalfields
|
||||
{
|
||||
sector
|
||||
{
|
||||
friction
|
||||
{
|
||||
name = "Friction";
|
||||
type = 1;
|
||||
default = 1;
|
||||
}
|
||||
|
||||
specialeffectplanes
|
||||
{
|
||||
type = 11;
|
||||
enum = "floorceiling";
|
||||
default = 0;
|
||||
}
|
||||
|
||||
colormapbegin
|
||||
{
|
||||
type = 0;
|
||||
default = 0;
|
||||
}
|
||||
|
||||
colormapend
|
||||
{
|
||||
type = 0;
|
||||
default = 33;
|
||||
}
|
||||
|
||||
foglighting
|
||||
{
|
||||
type = 3;
|
||||
default = false;
|
||||
}
|
||||
|
||||
teambase
|
||||
{
|
||||
type = 11;
|
||||
enum = "ctfteam";
|
||||
default = 0;
|
||||
}
|
||||
|
||||
triggersector
|
||||
{
|
||||
type = 3;
|
||||
default = false;
|
||||
}
|
||||
|
||||
triggerobject
|
||||
{
|
||||
type = 11;
|
||||
enum = "triggerobjects";
|
||||
default = 0;
|
||||
}
|
||||
|
||||
triggersurface
|
||||
{
|
||||
type = 11;
|
||||
enum = "triggersurfaces";
|
||||
default = 0;
|
||||
}
|
||||
|
||||
ringdrain
|
||||
{
|
||||
type = 1;
|
||||
default = 0;
|
||||
}
|
||||
}
|
||||
|
||||
linedef
|
||||
{
|
||||
executordelay
|
||||
{
|
||||
type = 0;
|
||||
default = 0;
|
||||
}
|
||||
midtexrepetitions
|
||||
{
|
||||
type = 0;
|
||||
default = 0;
|
||||
}
|
||||
arg5
|
||||
{
|
||||
type = 0;
|
||||
default = 0;
|
||||
}
|
||||
arg1str
|
||||
{
|
||||
type = 2;
|
||||
default = "";
|
||||
}
|
||||
}
|
||||
|
||||
thing
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
MAP LUMP NAMES
|
||||
Map lumps are loaded with the map as long as they are right after each other. When the editor
|
||||
meets a lump which is not defined in this list it will ignore the map if not satisfied.
|
||||
The order of items defines the order in which lumps will be written to WAD file on save.
|
||||
To indicate the map header lump, use ~MAP
|
||||
|
||||
Legenda:
|
||||
required = Lump is required to exist.
|
||||
blindcopy = Lump will be copied along with the map blindly. (useful for lumps Doom Builder doesn't use)
|
||||
nodebuild = The nodebuilder generates this lump.
|
||||
allowempty = The nodebuilder is allowed to leave this lump empty.
|
||||
scriptbuild = This lump is a text-based script, which should be compiled using current script compiler;
|
||||
script = This lump is a text-based script. Specify the filename of the script configuration to use.
|
||||
*/
|
||||
|
||||
doommaplumpnames
|
||||
{
|
||||
~MAP
|
||||
{
|
||||
required = true;
|
||||
blindcopy = true;
|
||||
nodebuild = false;
|
||||
}
|
||||
|
||||
THINGS
|
||||
{
|
||||
required = true;
|
||||
nodebuild = true;
|
||||
allowempty = true;
|
||||
}
|
||||
|
||||
LINEDEFS
|
||||
{
|
||||
required = true;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
SIDEDEFS
|
||||
{
|
||||
required = true;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
VERTEXES
|
||||
{
|
||||
required = true;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
SEGS
|
||||
{
|
||||
required = false;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
SSECTORS
|
||||
{
|
||||
required = false;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
NODES
|
||||
{
|
||||
required = false;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
SECTORS
|
||||
{
|
||||
required = true;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
REJECT
|
||||
{
|
||||
required = false;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
BLOCKMAP
|
||||
{
|
||||
required = false;
|
||||
nodebuild = true;
|
||||
allowempty = true;
|
||||
}
|
||||
}
|
||||
|
||||
udmfmaplumpnames
|
||||
{
|
||||
ZNODES
|
||||
{
|
||||
required = false;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
REJECT
|
||||
{
|
||||
required = false;
|
||||
nodebuild = true;
|
||||
allowempty = false;
|
||||
}
|
||||
|
||||
BLOCKMAP
|
||||
{
|
||||
required = false;
|
||||
nodebuild = true;
|
||||
allowempty = true;
|
||||
}
|
||||
}
|
||||
|
||||
// ENUMERATIONS
|
||||
// These are enumerated lists for linedef types and UDMF fields.
|
||||
// Reserved names are: angledeg, anglerad, color, texture, flat
|
||||
enums
|
||||
{
|
||||
falsetrue
|
||||
{
|
||||
0 = "False";
|
||||
1 = "True";
|
||||
}
|
||||
|
||||
yesno
|
||||
{
|
||||
0 = "Yes";
|
||||
1 = "No";
|
||||
}
|
||||
|
||||
noyes
|
||||
{
|
||||
0 = "No";
|
||||
1 = "Yes";
|
||||
}
|
||||
|
||||
onoff
|
||||
{
|
||||
0 = "On";
|
||||
1 = "Off";
|
||||
}
|
||||
|
||||
offon
|
||||
{
|
||||
0 = "Off";
|
||||
1 = "On";
|
||||
}
|
||||
|
||||
updown
|
||||
{
|
||||
0 = "Up";
|
||||
1 = "Down";
|
||||
}
|
||||
|
||||
downup
|
||||
{
|
||||
0 = "Down";
|
||||
1 = "Up";
|
||||
}
|
||||
|
||||
addset
|
||||
{
|
||||
0 = "Add";
|
||||
1 = "Set";
|
||||
}
|
||||
|
||||
floorceiling
|
||||
{
|
||||
0 = "Floor";
|
||||
1 = "Ceiling";
|
||||
2 = "Floor and ceiling";
|
||||
}
|
||||
|
||||
triggertype
|
||||
{
|
||||
0 = "Continuous";
|
||||
1 = "Each Time (Enter)";
|
||||
2 = "Each Time (Enter and leave)";
|
||||
3 = "Once";
|
||||
}
|
||||
|
||||
frontback
|
||||
{
|
||||
0 = "None";
|
||||
1 = "Front";
|
||||
2 = "Back";
|
||||
}
|
||||
|
||||
ctfteam
|
||||
{
|
||||
0 = "None";
|
||||
1 = "Red";
|
||||
2 = "Blue";
|
||||
}
|
||||
|
||||
triggerobjects
|
||||
{
|
||||
0 = "Any player";
|
||||
1 = "All players";
|
||||
2 = "Pushable object";
|
||||
3 = "Any object with thinker";
|
||||
}
|
||||
|
||||
triggersurfaces
|
||||
{
|
||||
0 = "Floor touch";
|
||||
1 = "Ceiling touch";
|
||||
2 = "Floor or ceiling touch";
|
||||
3 = "Anywhere in sector";
|
||||
}
|
||||
|
||||
tangibility
|
||||
{
|
||||
1 = "Intangible from top";
|
||||
2 = "Intangible from bottom";
|
||||
4 = "Don't block players";
|
||||
8 = "Don't block non-players";
|
||||
}
|
||||
}
|
||||
|
||||
//Default things filters
|
||||
thingsfilters
|
||||
{
|
||||
|
||||
filter0
|
||||
{
|
||||
name = "Player starts";
|
||||
category = "starts";
|
||||
type = -1;
|
||||
}
|
||||
|
||||
|
||||
filter1
|
||||
{
|
||||
name = "Enemies";
|
||||
category = "enemies";
|
||||
type = -1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
filter2
|
||||
{
|
||||
name = "NiGHTS Track";
|
||||
category = "nightstrk";
|
||||
type = -1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
filter3
|
||||
{
|
||||
name = "Normal Gravity";
|
||||
category = "";
|
||||
type = -1;
|
||||
|
||||
fields
|
||||
{
|
||||
2 = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
filter4
|
||||
{
|
||||
name = "Reverse Gravity";
|
||||
category = "";
|
||||
type = -1;
|
||||
|
||||
fields
|
||||
{
|
||||
2 = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
thingsfilters_udmf
|
||||
{
|
||||
}
|
||||
|
||||
// Special linedefs
|
||||
speciallinedefs
|
||||
{
|
||||
soundlinedefflag = 64; // See linedefflags
|
||||
singlesidedflag = 1; // See linedefflags
|
||||
doublesidedflag = 4; // See linedefflags
|
||||
impassableflag = 1;
|
||||
upperunpeggedflag = 8;
|
||||
lowerunpeggedflag = 16;
|
||||
repeatmidtextureflag = 1024;
|
||||
pegmidtextureflag = 256;
|
||||
}
|
||||
|
||||
speciallinedefs_udmf
|
||||
{
|
||||
soundlinedefflag = "noclimb";
|
||||
singlesidedflag = "blocking";
|
||||
doublesidedflag = "twosided";
|
||||
impassableflag = "blocking";
|
||||
upperunpeggedflag = "dontpegtop";
|
||||
lowerunpeggedflag = "dontpegbottom";
|
||||
repeatmidtextureflag = "wrapmidtex";
|
||||
pegmidtextureflag = "midpeg";
|
||||
}
|
||||
|
||||
scriptlumpnames
|
||||
{
|
||||
MAINCFG
|
||||
{
|
||||
script = "SOC.cfg";
|
||||
}
|
||||
|
||||
OBJCTCFG
|
||||
{
|
||||
script = "SOC.cfg";
|
||||
}
|
||||
|
||||
SOC_
|
||||
{
|
||||
script = "SOC.cfg";
|
||||
isprefix = true;
|
||||
}
|
||||
|
||||
LUA_
|
||||
{
|
||||
script = "Lua.cfg";
|
||||
isprefix = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Texture sources
|
||||
textures
|
||||
{
|
||||
zdoom1
|
||||
{
|
||||
start = "TX_START";
|
||||
end = "TX_END";
|
||||
}
|
||||
}
|
||||
|
||||
// Patch sources
|
||||
patches
|
||||
{
|
||||
standard1
|
||||
{
|
||||
start = "P_START";
|
||||
end = "P_END";
|
||||
}
|
||||
|
||||
standard2
|
||||
{
|
||||
start = "PP_START";
|
||||
end = "PP_END";
|
||||
}
|
||||
}
|
||||
|
||||
// Sprite sources
|
||||
sprites
|
||||
{
|
||||
standard1
|
||||
{
|
||||
start = "S_START";
|
||||
end = "S_END";
|
||||
}
|
||||
|
||||
standard2
|
||||
{
|
||||
start = "SS_START";
|
||||
end = "SS_END";
|
||||
}
|
||||
}
|
||||
|
||||
// Flat sources
|
||||
flats
|
||||
{
|
||||
standard1
|
||||
{
|
||||
start = "F_START";
|
||||
end = "F_END";
|
||||
}
|
||||
|
||||
standard2
|
||||
{
|
||||
start = "FF_START";
|
||||
end = "FF_END";
|
||||
}
|
||||
|
||||
standard3
|
||||
{
|
||||
start = "FF_START";
|
||||
end = "F_END";
|
||||
}
|
||||
|
||||
standard4
|
||||
{
|
||||
start = "F_START";
|
||||
end = "FF_END";
|
||||
}
|
||||
}
|
109
extras/conf/Includes/SRB222_sectors.cfg
Normal file
109
extras/conf/Includes/SRB222_sectors.cfg
Normal file
|
@ -0,0 +1,109 @@
|
|||
sectortypes
|
||||
{
|
||||
0 = "Normal";
|
||||
1 = "Damage";
|
||||
2 = "Damage (Water)";
|
||||
3 = "Damage (Fire)";
|
||||
4 = "Damage (Electrical)";
|
||||
5 = "Spikes";
|
||||
6 = "Death Pit (Camera Tilt)";
|
||||
7 = "Death Pit (No Camera Tilt)";
|
||||
8 = "Instant Kill";
|
||||
9 = "Ring Drainer (Floor Touch)";
|
||||
10 = "Ring Drainer (Anywhere in Sector)";
|
||||
11 = "Special Stage Damage";
|
||||
12 = "Space Countdown";
|
||||
13 = "Ramp Sector (double step-up/down)";
|
||||
14 = "Non-Ramp Sector (no step-down)";
|
||||
15 = "Bouncy FOF";
|
||||
16 = "Trigger Line Ex. (Pushable Objects)";
|
||||
32 = "Trigger Line Ex. (Anywhere, All Players)";
|
||||
48 = "Trigger Line Ex. (Floor Touch, All Players)";
|
||||
64 = "Trigger Line Ex. (Anywhere in Sector)";
|
||||
80 = "Trigger Line Ex. (Floor Touch)";
|
||||
96 = "Trigger Line Ex. (Emerald Check)";
|
||||
112 = "Trigger Line Ex. (NiGHTS Mare)";
|
||||
128 = "Check for Linedef Executor on FOFs";
|
||||
144 = "Egg Capsule";
|
||||
160 = "Special Stage Time/Rings Parameters";
|
||||
176 = "Custom Global Gravity";
|
||||
512 = "Wind/Current";
|
||||
1024 = "Conveyor Belt";
|
||||
1280 = "Speed Pad";
|
||||
4096 = "Star Post Activator";
|
||||
8192 = "Exit/Special Stage Pit/Return Flag";
|
||||
12288 = "CTF Red Team Base";
|
||||
16384 = "CTF Blue Team Base";
|
||||
20480 = "Fan Sector";
|
||||
24576 = "Super Sonic Transform";
|
||||
28672 = "Force Spin";
|
||||
32768 = "Zoom Tube Start";
|
||||
36864 = "Zoom Tube End";
|
||||
40960 = "Circuit Finish Line";
|
||||
45056 = "Rope Hang";
|
||||
49152 = "Intangible to the Camera";
|
||||
}
|
||||
|
||||
gen_sectortypes
|
||||
{
|
||||
first
|
||||
{
|
||||
0 = "Normal";
|
||||
1 = "Damage";
|
||||
2 = "Damage (Water)";
|
||||
3 = "Damage (Fire)";
|
||||
4 = "Damage (Electrical)";
|
||||
5 = "Spikes";
|
||||
6 = "Death Pit (Camera Tilt)";
|
||||
7 = "Death Pit (No Camera Tilt)";
|
||||
8 = "Instant Kill";
|
||||
9 = "Ring Drainer (Floor Touch)";
|
||||
10 = "Ring Drainer (Anywhere in Sector)";
|
||||
11 = "Special Stage Damage";
|
||||
12 = "Space Countdown";
|
||||
13 = "Ramp Sector (double step-up/down)";
|
||||
14 = "Non-Ramp Sector (no step-down)";
|
||||
15 = "Bouncy FOF";
|
||||
}
|
||||
|
||||
second
|
||||
{
|
||||
0 = "Normal";
|
||||
16 = "Trigger Line Ex. (Pushable Objects)";
|
||||
32 = "Trigger Line Ex. (Anywhere, All Players)";
|
||||
48 = "Trigger Line Ex. (Floor Touch, All Players)";
|
||||
64 = "Trigger Line Ex. (Anywhere in Sector)";
|
||||
80 = "Trigger Line Ex. (Floor Touch)";
|
||||
96 = "Trigger Line Ex. (Emerald Check)";
|
||||
112 = "Trigger Line Ex. (NiGHTS Mare)";
|
||||
128 = "Check for Linedef Executor on FOFs";
|
||||
144 = "Egg Capsule";
|
||||
160 = "Special Stage Time/Rings Parameters";
|
||||
176 = "Custom Global Gravity";
|
||||
}
|
||||
|
||||
third
|
||||
{
|
||||
0 = "Normal";
|
||||
512 = "Wind/Current";
|
||||
1024 = "Conveyor Belt";
|
||||
1280 = "Speed Pad";
|
||||
}
|
||||
|
||||
fourth
|
||||
{
|
||||
0 = "Normal";
|
||||
4096 = "Star Post Activator";
|
||||
8192 = "Exit/Special Stage Pit/Return Flag";
|
||||
12288 = "CTF Red Team Base";
|
||||
16384 = "CTF Blue Team Base";
|
||||
20480 = "Fan Sector";
|
||||
24576 = "Super Sonic Transform";
|
||||
28672 = "Force Spin";
|
||||
32768 = "Zoom Tube Start";
|
||||
36864 = "Zoom Tube End";
|
||||
40960 = "Circuit Finish Line";
|
||||
45056 = "Rope Hang";
|
||||
49152 = "Intangible to the Camera";
|
||||
}
|
||||
}
|
3398
extras/conf/Includes/SRB222_things.cfg
Normal file
3398
extras/conf/Includes/SRB222_things.cfg
Normal file
File diff suppressed because it is too large
Load diff
38
extras/conf/SRB2_22Doom.cfg
Normal file
38
extras/conf/SRB2_22Doom.cfg
Normal file
|
@ -0,0 +1,38 @@
|
|||
/************************************************************************\
|
||||
Zone Builder Game Configuration for Sonic Robo Blast 2 Version 2.2
|
||||
\************************************************************************/
|
||||
|
||||
// This is required to prevent accidental use of a different configuration
|
||||
type = "Doom Builder 2 Game Configuration";
|
||||
|
||||
// This is the title to show for this game
|
||||
game = "Sonic Robo Blast 2 - 2.2 (Doom format)";
|
||||
|
||||
// This is the simplified game engine/sourceport name
|
||||
engine = "zdoom";
|
||||
|
||||
// Settings common to all games and all map formats
|
||||
include("Includes\\SRB222_common.cfg", "common");
|
||||
|
||||
// Settings common to Doom map format
|
||||
include("Includes\\SRB222_common.cfg", "mapformat_doom");
|
||||
|
||||
include("Includes\\Game_SRB222.cfg");
|
||||
|
||||
// Script lumps detection
|
||||
scriptlumpnames
|
||||
{
|
||||
include("Includes\\SRB222_misc.cfg", "scriptlumpnames");
|
||||
}
|
||||
|
||||
// THING TYPES
|
||||
thingtypes
|
||||
{
|
||||
include("Includes\\SRB222_things.cfg");
|
||||
}
|
||||
|
||||
//Default things filters
|
||||
thingsfilters
|
||||
{
|
||||
include("Includes\\SRB222_misc.cfg", "thingsfilters");
|
||||
}
|
47
extras/conf/SRB2_22UDMF.cfg
Normal file
47
extras/conf/SRB2_22UDMF.cfg
Normal file
|
@ -0,0 +1,47 @@
|
|||
/************************************************************************\
|
||||
Zone Builder Game Configuration for Sonic Robo Blast 2 Version 2.2
|
||||
\************************************************************************/
|
||||
|
||||
// This is required to prevent accidental use of a different configuration
|
||||
type = "Doom Builder 2 Game Configuration";
|
||||
|
||||
// This is the title to show for this game
|
||||
game = "Sonic Robo Blast 2 - 2.2 (UDMF)";
|
||||
|
||||
// This is the simplified game engine/sourceport name
|
||||
engine = "zdoom";
|
||||
|
||||
// Settings common to all games and all map formats
|
||||
include("Includes\\SRB222_common.cfg", "common");
|
||||
|
||||
// Settings common to Doom map format
|
||||
include("Includes\\SRB222_common.cfg", "mapformat_udmf");
|
||||
|
||||
include("Includes\\Game_SRB222.cfg");
|
||||
|
||||
// Script lumps detection
|
||||
scriptlumpnames
|
||||
{
|
||||
include("Includes\\SRB222_misc.cfg", "scriptlumpnames");
|
||||
}
|
||||
|
||||
// THING TYPES
|
||||
thingtypes
|
||||
{
|
||||
include("Includes\\SRB222_things.cfg");
|
||||
}
|
||||
|
||||
//Default things filters
|
||||
thingsfilters
|
||||
{
|
||||
include("Includes\\SRB222_misc.cfg", "thingsfilters");
|
||||
}
|
||||
|
||||
// ENUMERATIONS
|
||||
// Each engine has its own additional thing types
|
||||
// These are enumerated lists for linedef types and UDMF fields.
|
||||
enums
|
||||
{
|
||||
// Basic game enums
|
||||
include("Includes\\SRB222_misc.cfg", "enums");
|
||||
}
|
|
@ -19,6 +19,7 @@ boolean allow_fullscreen = false;
|
|||
consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
void I_StartupGraphics(void){}
|
||||
void I_StartupHardwareGraphics(void){}
|
||||
|
||||
void I_ShutdownGraphics(void){}
|
||||
|
||||
|
@ -51,6 +52,11 @@ INT32 VID_SetMode(INT32 modenum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
// ..............
|
||||
}
|
||||
|
||||
const char *VID_GetModeName(INT32 modenum)
|
||||
{
|
||||
return "A320x240";
|
||||
|
|
|
@ -61,6 +61,8 @@ static consvar_t *consvar_vars; // list of registered console variables
|
|||
static char com_token[1024];
|
||||
static char *COM_Parse(char *data);
|
||||
|
||||
static char * COM_Purge (char *text, int *lenp);
|
||||
|
||||
CV_PossibleValue_t CV_OnOff[] = {{0, "Off"}, {1, "On"}, {0, NULL}};
|
||||
CV_PossibleValue_t CV_YesNo[] = {{0, "No"}, {1, "Yes"}, {0, NULL}};
|
||||
CV_PossibleValue_t CV_Unsigned[] = {{0, "MIN"}, {999999999, "MAX"}, {0, NULL}};
|
||||
|
@ -100,31 +102,61 @@ static cmdalias_t *com_alias; // aliases list
|
|||
|
||||
static vsbuf_t com_text; // variable sized buffer
|
||||
|
||||
/** Purges control characters out of some text.
|
||||
*
|
||||
* \param s The text.
|
||||
* \param np Optionally a pointer to fill with the new string length.
|
||||
* \return The text.
|
||||
* \sa COM_ExecuteString
|
||||
*/
|
||||
static char *
|
||||
COM_Purge (char *s, int *np)
|
||||
{
|
||||
char *t;
|
||||
char *p;
|
||||
int n;
|
||||
n = strlen(s);
|
||||
t = s + n + 1;
|
||||
p = s;
|
||||
while (( p = strchr(p, '\033') ))
|
||||
{
|
||||
memmove(p, &p[1], t - p - 1);
|
||||
n--;
|
||||
}
|
||||
if (np)
|
||||
(*np) = n;
|
||||
return s;
|
||||
}
|
||||
|
||||
/** Adds text into the command buffer for later execution.
|
||||
*
|
||||
* \param ptext The text to add.
|
||||
* \sa COM_BufInsertText
|
||||
* \sa COM_BufInsertTextEx
|
||||
*/
|
||||
void COM_BufAddText(const char *ptext)
|
||||
void COM_BufAddTextEx(const char *ptext, int flags)
|
||||
{
|
||||
size_t l;
|
||||
int l;
|
||||
char *text;
|
||||
|
||||
l = strlen(ptext);
|
||||
text = COM_Purge(Z_StrDup(ptext), &l);
|
||||
|
||||
if (com_text.cursize + l >= com_text.maxsize)
|
||||
if (com_text.cursize + 2 + l >= com_text.maxsize)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Command buffer full!\n"));
|
||||
return;
|
||||
}
|
||||
VS_Write(&com_text, ptext, l);
|
||||
|
||||
VS_WriteEx(&com_text, text, l, flags);
|
||||
|
||||
Z_Free(text);
|
||||
}
|
||||
|
||||
/** Adds command text and executes it immediately.
|
||||
*
|
||||
* \param ptext The text to execute. A newline is automatically added.
|
||||
* \sa COM_BufAddText
|
||||
* \sa COM_BufAddTextEx
|
||||
*/
|
||||
void COM_BufInsertText(const char *ptext)
|
||||
void COM_BufInsertTextEx(const char *ptext, int flags)
|
||||
{
|
||||
char *temp = NULL;
|
||||
size_t templen;
|
||||
|
@ -138,7 +170,7 @@ void COM_BufInsertText(const char *ptext)
|
|||
}
|
||||
|
||||
// add the entire text of the file (or alias)
|
||||
COM_BufAddText(ptext);
|
||||
COM_BufAddTextEx(ptext, flags);
|
||||
COM_BufExecute(); // do it right away
|
||||
|
||||
// add the copied off data
|
||||
|
@ -272,6 +304,7 @@ static size_t com_argc;
|
|||
static char *com_argv[MAX_ARGS];
|
||||
static const char *com_null_string = "";
|
||||
static char *com_args = NULL; // current command args or NULL
|
||||
static int com_flags;
|
||||
|
||||
static void Got_NetVar(UINT8 **p, INT32 playernum);
|
||||
|
||||
|
@ -395,6 +428,14 @@ static void COM_TokenizeString(char *ptext)
|
|||
com_argc = 0;
|
||||
com_args = NULL;
|
||||
|
||||
if (ptext[0] == '\033')
|
||||
{
|
||||
com_flags = (unsigned)ptext[1];
|
||||
ptext += 2;
|
||||
}
|
||||
else
|
||||
com_flags = 0;
|
||||
|
||||
while (com_argc < MAX_ARGS)
|
||||
{
|
||||
// Skip whitespace up to a newline.
|
||||
|
@ -1016,6 +1057,15 @@ void VS_Write(vsbuf_t *buf, const void *data, size_t length)
|
|||
M_Memcpy(VS_GetSpace(buf, length), data, length);
|
||||
}
|
||||
|
||||
void VS_WriteEx(vsbuf_t *buf, const void *data, size_t length, int flags)
|
||||
{
|
||||
char *p;
|
||||
p = VS_GetSpace(buf, 2 + length);
|
||||
p[0] = '\033';
|
||||
p[1] = flags;
|
||||
M_Memcpy(&p[2], data, length);
|
||||
}
|
||||
|
||||
/** Prints text in a variable buffer. Like VS_Write() plus a
|
||||
* trailing NUL.
|
||||
*
|
||||
|
@ -2015,6 +2065,9 @@ static boolean CV_Command(void)
|
|||
if (!v)
|
||||
return false;
|
||||
|
||||
if (( com_flags & COM_SAFE ) && ( v->flags & CV_NOLUA ))
|
||||
return false;
|
||||
|
||||
// perform a variable print or set
|
||||
if (COM_Argc() == 1)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
// Command buffer & command execution
|
||||
//===================================
|
||||
|
||||
enum
|
||||
{
|
||||
COM_SAFE = 1,
|
||||
};
|
||||
|
||||
typedef void (*com_func_t)(void);
|
||||
|
||||
void COM_AddCommand(const char *name, com_func_t func);
|
||||
|
@ -36,10 +41,12 @@ size_t COM_FirstOption(void);
|
|||
const char *COM_CompleteCommand(const char *partial, INT32 skips);
|
||||
|
||||
// insert at queu (at end of other command)
|
||||
void COM_BufAddText(const char *btext);
|
||||
#define COM_BufAddText(s) COM_BufAddTextEx(s, 0)
|
||||
void COM_BufAddTextEx(const char *btext, int flags);
|
||||
|
||||
// insert in head (before other command)
|
||||
void COM_BufInsertText(const char *btext);
|
||||
#define COM_BufInsertText(s) COM_BufInsertTextEx(s, 0)
|
||||
void COM_BufInsertTextEx(const char *btext, int flags);
|
||||
|
||||
// don't bother inserting, just do immediately
|
||||
void COM_ImmedExecute(const char *ptext);
|
||||
|
@ -71,6 +78,7 @@ void VS_Free(vsbuf_t *buf);
|
|||
void VS_Clear(vsbuf_t *buf);
|
||||
void *VS_GetSpace(vsbuf_t *buf, size_t length);
|
||||
void VS_Write(vsbuf_t *buf, const void *data, size_t length);
|
||||
void VS_WriteEx(vsbuf_t *buf, const void *data, size_t length, int flags);
|
||||
void VS_Print(vsbuf_t *buf, const char *data); // strcats onto the sizebuf
|
||||
|
||||
//==================
|
||||
|
@ -100,7 +108,8 @@ typedef enum
|
|||
CV_HIDEN = 1024, // variable is not part of the cvar list so cannot be accessed by the console
|
||||
// can only be set when we have the pointer to it
|
||||
// used on menus
|
||||
CV_CHEAT = 2048 // Don't let this be used in multiplayer unless cheats are on.
|
||||
CV_CHEAT = 2048, // Don't let this be used in multiplayer unless cheats are on.
|
||||
CV_NOLUA = 4096,/* don't let this be called from Lua */
|
||||
} cvflags_t;
|
||||
|
||||
typedef struct CV_PossibleValue_s
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "g_input.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "keys.h"
|
||||
#include "r_main.h"
|
||||
#include "r_defs.h"
|
||||
#include "sounds.h"
|
||||
#include "st_stuff.h"
|
||||
|
@ -1285,10 +1286,10 @@ void CONS_Printf(const char *fmt, ...)
|
|||
con_scrollup = 0;
|
||||
|
||||
// if not in display loop, force screen update
|
||||
if (con_startup)
|
||||
if (con_startup && (!setrenderneeded))
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
patch_t *con_backpic = W_CachePatchName("CONSBACK", PU_CACHE);
|
||||
patch_t *con_backpic = W_CachePatchName("CONSBACK", PU_PATCH);
|
||||
|
||||
// Jimita: CON_DrawBackpic just called V_DrawScaledPatch
|
||||
V_DrawScaledPatch(0, 0, 0, con_backpic);
|
||||
|
@ -1545,7 +1546,7 @@ static void CON_DrawConsole(void)
|
|||
// draw console background
|
||||
if (cons_backpic.value || con_forcepic)
|
||||
{
|
||||
patch_t *con_backpic = W_CachePatchName("CONSBACK", PU_CACHE);
|
||||
patch_t *con_backpic = W_CachePatchName("CONSBACK", PU_PATCH);
|
||||
|
||||
// Jimita: CON_DrawBackpic just called V_DrawScaledPatch
|
||||
V_DrawScaledPatch(0, 0, 0, con_backpic);
|
||||
|
@ -1602,8 +1603,18 @@ void CON_Drawer(void)
|
|||
if (!con_started || !graphics_started)
|
||||
return;
|
||||
|
||||
if (needpatchrecache)
|
||||
{
|
||||
W_FlushCachedPatches();
|
||||
HU_LoadGraphics();
|
||||
}
|
||||
|
||||
if (con_recalc)
|
||||
{
|
||||
CON_RecalcSize();
|
||||
if (con_curlines <= 0)
|
||||
CON_ClearHUD();
|
||||
}
|
||||
|
||||
if (con_curlines > 0)
|
||||
CON_DrawConsole();
|
||||
|
|
|
@ -611,11 +611,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
|
|||
|
||||
rsp->health = LONG(players[i].mo->health);
|
||||
rsp->angle = (angle_t)LONG(players[i].mo->angle);
|
||||
#ifdef ROTSPRITE
|
||||
rsp->rollangle = (angle_t)LONG(players[i].mo->rollangle);
|
||||
#else
|
||||
rsp->rollangle = 0;
|
||||
#endif
|
||||
rsp->x = LONG(players[i].mo->x);
|
||||
rsp->y = LONG(players[i].mo->y);
|
||||
rsp->z = LONG(players[i].mo->z);
|
||||
|
@ -766,9 +762,7 @@ static void resynch_read_player(resynch_pak *rsp)
|
|||
//At this point, the player should have a body, whether they were respawned or not.
|
||||
P_UnsetThingPosition(players[i].mo);
|
||||
players[i].mo->angle = (angle_t)LONG(rsp->angle);
|
||||
#ifdef ROTSPRITE
|
||||
players[i].mo->rollangle = (angle_t)LONG(rsp->rollangle);
|
||||
#endif
|
||||
players[i].mo->eflags = (UINT16)SHORT(rsp->eflags);
|
||||
players[i].mo->flags = LONG(rsp->flags);
|
||||
players[i].mo->flags2 = LONG(rsp->flags2);
|
||||
|
@ -1025,7 +1019,7 @@ static void SV_SendResynch(INT32 node)
|
|||
netbuffer->packettype = PT_RESYNCHEND;
|
||||
|
||||
netbuffer->u.resynchend.randomseed = P_GetRandSeed();
|
||||
if (gametype == GT_CTF)
|
||||
if (gametyperules & GTR_TEAMFLAGS)
|
||||
resynch_write_ctf(&netbuffer->u.resynchend);
|
||||
resynch_write_others(&netbuffer->u.resynchend);
|
||||
|
||||
|
@ -1271,8 +1265,12 @@ static boolean CL_SendJoin(void)
|
|||
if (splitscreen || botingame)
|
||||
localplayers++;
|
||||
netbuffer->u.clientcfg.localplayers = localplayers;
|
||||
netbuffer->u.clientcfg._255 = 255;
|
||||
netbuffer->u.clientcfg.packetversion = PACKETVERSION;
|
||||
netbuffer->u.clientcfg.version = VERSION;
|
||||
netbuffer->u.clientcfg.subversion = SUBVERSION;
|
||||
strncpy(netbuffer->u.clientcfg.application, SRB2APPLICATION,
|
||||
sizeof netbuffer->u.clientcfg.application);
|
||||
strncpy(netbuffer->u.clientcfg.names[0], cv_playername.zstring, MAXPLAYERNAME);
|
||||
strncpy(netbuffer->u.clientcfg.names[1], cv_playername2.zstring, MAXPLAYERNAME);
|
||||
return HSendPacket(servernode, true, 0, sizeof (clientconfig_pak));
|
||||
|
@ -1283,8 +1281,12 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
|||
UINT8 *p;
|
||||
|
||||
netbuffer->packettype = PT_SERVERINFO;
|
||||
netbuffer->u.serverinfo._255 = 255;
|
||||
netbuffer->u.serverinfo.packetversion = PACKETVERSION;
|
||||
netbuffer->u.serverinfo.version = VERSION;
|
||||
netbuffer->u.serverinfo.subversion = SUBVERSION;
|
||||
strncpy(netbuffer->u.serverinfo.application, SRB2APPLICATION,
|
||||
sizeof netbuffer->u.serverinfo.application);
|
||||
// return back the time value so client can compute their ping
|
||||
netbuffer->u.serverinfo.time = (tic_t)LONG(servertime);
|
||||
netbuffer->u.serverinfo.leveltime = (tic_t)LONG(leveltime);
|
||||
|
@ -1718,12 +1720,21 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
|
|||
if (serverlistcount >= MAXSERVERLIST)
|
||||
return; // list full
|
||||
|
||||
if (info->_255 != 255)
|
||||
return;/* old packet format */
|
||||
|
||||
if (info->packetversion != PACKETVERSION)
|
||||
return;/* old new packet format */
|
||||
|
||||
if (info->version != VERSION)
|
||||
return; // Not same version.
|
||||
|
||||
if (info->subversion != SUBVERSION)
|
||||
return; // Close, but no cigar.
|
||||
|
||||
if (strcmp(info->application, SRB2APPLICATION))
|
||||
return;/* that's a different mod */
|
||||
|
||||
i = serverlistcount++;
|
||||
}
|
||||
|
||||
|
@ -2111,10 +2122,10 @@ static void CL_ConnectToServer(boolean viams)
|
|||
|
||||
if (i != -1)
|
||||
{
|
||||
UINT8 num = serverlist[i].info.gametype;
|
||||
UINT16 num = serverlist[i].info.gametype;
|
||||
const char *gametypestr = NULL;
|
||||
CONS_Printf(M_GetText("Connecting to: %s\n"), serverlist[i].info.servername);
|
||||
if (num < NUMGAMETYPES)
|
||||
if (num < gametypecount)
|
||||
gametypestr = Gametype_Names[num];
|
||||
if (gametypestr)
|
||||
CONS_Printf(M_GetText("Gametype: %s\n"), gametypestr);
|
||||
|
@ -2430,7 +2441,7 @@ static void CL_RemovePlayer(INT32 playernum, INT32 reason)
|
|||
}
|
||||
}
|
||||
|
||||
if (gametype == GT_CTF)
|
||||
if (gametyperules & GTR_TEAMFLAGS)
|
||||
P_PlayerFlagBurst(&players[playernum], false); // Don't take the flag with you!
|
||||
|
||||
// If in a special stage, redistribute the player's spheres across
|
||||
|
@ -2486,6 +2497,17 @@ static void CL_RemovePlayer(INT32 playernum, INT32 reason)
|
|||
(void)reason;
|
||||
#endif
|
||||
|
||||
// don't look through someone's view who isn't there
|
||||
if (playernum == displayplayer)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
// Call ViewpointSwitch hooks here.
|
||||
// The viewpoint was forcibly changed.
|
||||
LUAh_ViewpointSwitch(&players[consoleplayer], &players[displayplayer], true);
|
||||
#endif
|
||||
displayplayer = consoleplayer;
|
||||
}
|
||||
|
||||
// Reset player data
|
||||
CL_ClearPlayer(playernum);
|
||||
|
||||
|
@ -2503,16 +2525,13 @@ static void CL_RemovePlayer(INT32 playernum, INT32 reason)
|
|||
RemoveAdminPlayer(playernum); // don't stay admin after you're gone
|
||||
}
|
||||
|
||||
if (playernum == displayplayer)
|
||||
displayplayer = consoleplayer; // don't look through someone's view who isn't there
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_InvalidatePlayer(&players[playernum]);
|
||||
#endif
|
||||
|
||||
if (G_TagGametype()) //Check if you still have a game. Location flexible. =P
|
||||
P_CheckSurvivors();
|
||||
else if (gametype == GT_RACE || gametype == GT_COMPETITION)
|
||||
else if (gametyperules & GTR_RACE)
|
||||
P_CheckRacers();
|
||||
}
|
||||
|
||||
|
@ -3461,7 +3480,7 @@ void SV_StartSinglePlayerServer(void)
|
|||
server = true;
|
||||
netgame = false;
|
||||
multiplayer = false;
|
||||
gametype = GT_COOP;
|
||||
G_SetGametype(GT_COOP);
|
||||
|
||||
// no more tic the game with this settings!
|
||||
SV_StopServer();
|
||||
|
@ -3507,6 +3526,12 @@ static void HandleConnect(SINT8 node)
|
|||
|
||||
if (bannednode && bannednode[node])
|
||||
SV_SendRefuse(node, M_GetText("You have been banned\nfrom the server"));
|
||||
else if (netbuffer->u.clientcfg._255 != 255 ||
|
||||
netbuffer->u.clientcfg.packetversion != PACKETVERSION)
|
||||
SV_SendRefuse(node, "Incompatible packet formats.");
|
||||
else if (strncmp(netbuffer->u.clientcfg.application, SRB2APPLICATION,
|
||||
sizeof netbuffer->u.clientcfg.application))
|
||||
SV_SendRefuse(node, "Different SRB2 modifications\nare not compatible.");
|
||||
else if (netbuffer->u.clientcfg.version != VERSION
|
||||
|| netbuffer->u.clientcfg.subversion != SUBVERSION)
|
||||
SV_SendRefuse(node, va(M_GetText("Different SRB2 versions cannot\nplay a netgame!\n(server version %d.%d.%d)"), VERSION/100, VERSION%100, SUBVERSION));
|
||||
|
@ -3629,6 +3654,8 @@ static void HandleServerInfo(SINT8 node)
|
|||
const tic_t ticdiff = (ticnow - ticthen)*1000/NEWTICRATE;
|
||||
netbuffer->u.serverinfo.time = (tic_t)LONG(ticdiff);
|
||||
netbuffer->u.serverinfo.servername[MAXSERVERNAME-1] = 0;
|
||||
netbuffer->u.serverinfo.application
|
||||
[sizeof netbuffer->u.serverinfo.application - 1] = '\0';
|
||||
|
||||
SL_InsertServer(&netbuffer->u.serverinfo, node);
|
||||
}
|
||||
|
@ -3740,7 +3767,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
|
|||
if (client)
|
||||
{
|
||||
maketic = gametic = neededtic = (tic_t)LONG(netbuffer->u.servercfg.gametic);
|
||||
gametype = netbuffer->u.servercfg.gametype;
|
||||
G_SetGametype(netbuffer->u.servercfg.gametype);
|
||||
modifiedgame = netbuffer->u.servercfg.modifiedgame;
|
||||
for (j = 0; j < MAXPLAYERS; j++)
|
||||
adminplayers[j] = netbuffer->u.servercfg.adminplayers[j];
|
||||
|
@ -4124,7 +4151,7 @@ static void HandlePacketFromPlayer(SINT8 node)
|
|||
|
||||
P_SetRandSeed(netbuffer->u.resynchend.randomseed);
|
||||
|
||||
if (gametype == GT_CTF)
|
||||
if (gametyperules & GTR_TEAMFLAGS)
|
||||
resynch_read_ctf(&netbuffer->u.resynchend);
|
||||
resynch_read_others(&netbuffer->u.resynchend);
|
||||
|
||||
|
|
|
@ -19,6 +19,16 @@
|
|||
#include "tables.h"
|
||||
#include "d_player.h"
|
||||
|
||||
/*
|
||||
The 'packet version' may be used with packets whose
|
||||
format is expected to change between versions.
|
||||
|
||||
This version is independent of the mod name, and standard
|
||||
version and subversion. It should only account for the
|
||||
basic fields of the packet, and change infrequently.
|
||||
*/
|
||||
#define PACKETVERSION 0
|
||||
|
||||
// Network play related stuff.
|
||||
// There is a data struct that stores network
|
||||
// communication related stuff, and another
|
||||
|
@ -320,8 +330,13 @@ typedef struct {
|
|||
#pragma warning(default : 4200)
|
||||
#endif
|
||||
|
||||
#define MAXAPPLICATION 16
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT8 _255;/* see serverinfo_pak */
|
||||
UINT8 packetversion;
|
||||
char application[MAXAPPLICATION];
|
||||
UINT8 version; // Different versions don't work
|
||||
UINT8 subversion; // Contains build version
|
||||
UINT8 localplayers;
|
||||
|
@ -334,6 +349,14 @@ typedef struct
|
|||
// This packet is too large
|
||||
typedef struct
|
||||
{
|
||||
/*
|
||||
In the old packet, 'version' is the first field. Now that field is set
|
||||
to 255 always, so older versions won't be confused with the new
|
||||
versions or vice-versa.
|
||||
*/
|
||||
UINT8 _255;
|
||||
UINT8 packetversion;
|
||||
char application[MAXAPPLICATION];
|
||||
UINT8 version;
|
||||
UINT8 subversion;
|
||||
UINT8 numberofplayer;
|
||||
|
|
85
src/d_main.c
85
src/d_main.c
|
@ -108,6 +108,8 @@ boolean devparm = false; // started game with -devparm
|
|||
boolean singletics = false; // timedemo
|
||||
boolean lastdraw = false;
|
||||
|
||||
static void D_CheckRendererState(void);
|
||||
|
||||
postimg_t postimgtype = postimg_none;
|
||||
INT32 postimgparam;
|
||||
postimg_t postimgtype2 = postimg_none;
|
||||
|
@ -212,6 +214,7 @@ INT16 wipetypepost = -1;
|
|||
|
||||
static void D_Display(void)
|
||||
{
|
||||
INT32 setrenderstillneeded = 0;
|
||||
boolean forcerefresh = false;
|
||||
static boolean wipe = false;
|
||||
INT32 wipedefindex = 0;
|
||||
|
@ -222,11 +225,38 @@ static void D_Display(void)
|
|||
if (nodrawers)
|
||||
return; // for comparative timing/profiling
|
||||
|
||||
// check for change of screen size (video mode)
|
||||
if (setmodeneeded && !wipe)
|
||||
SCR_SetMode(); // change video mode
|
||||
// Lactozilla: Switching renderers works by checking
|
||||
// if the game has to do it right when the frame
|
||||
// needs to render. If so, five things will happen:
|
||||
// 1. Interface functions will be called so
|
||||
// that switching to OpenGL creates a
|
||||
// GL context, and switching to Software
|
||||
// allocates screen buffers.
|
||||
// 2. Software will set drawer functions,
|
||||
// and OpenGL will load textures and
|
||||
// create plane polygons, if necessary.
|
||||
// 3. Functions related to switching video
|
||||
// modes (resolution) are called.
|
||||
// 4. Patch data is freed from memory,
|
||||
// and recached if necessary.
|
||||
// 5. The frame is ready to be drawn!
|
||||
|
||||
if (vid.recalc)
|
||||
// stop movie if needs to change renderer
|
||||
if (setrenderneeded && (moviemode == MM_APNG))
|
||||
M_StopMovie();
|
||||
|
||||
// check for change of renderer or screen size (video mode)
|
||||
if ((setrenderneeded || setmodeneeded) && !wipe)
|
||||
{
|
||||
if (setrenderneeded)
|
||||
{
|
||||
CONS_Debug(DBG_RENDER, "setrenderneeded set (%d)\n", setrenderneeded);
|
||||
setrenderstillneeded = setrenderneeded;
|
||||
}
|
||||
SCR_SetMode(); // change video mode
|
||||
}
|
||||
|
||||
if (vid.recalc || setrenderstillneeded)
|
||||
{
|
||||
SCR_Recalc(); // NOTE! setsizeneeded is set by SCR_Recalc()
|
||||
#ifdef HWRENDER
|
||||
|
@ -237,12 +267,15 @@ static void D_Display(void)
|
|||
}
|
||||
|
||||
// change the view size if needed
|
||||
if (setsizeneeded)
|
||||
if (setsizeneeded || setrenderstillneeded)
|
||||
{
|
||||
R_ExecuteSetViewSize();
|
||||
forcerefresh = true; // force background redraw
|
||||
}
|
||||
|
||||
// Lactozilla: Renderer switching
|
||||
D_CheckRendererState();
|
||||
|
||||
// draw buffered stuff to screen
|
||||
// Used only by linux GGI version
|
||||
I_UpdateNoBlit();
|
||||
|
@ -457,7 +490,7 @@ static void D_Display(void)
|
|||
py = 4;
|
||||
else
|
||||
py = viewwindowy + 4;
|
||||
patch = W_CachePatchName("M_PAUSE", PU_CACHE);
|
||||
patch = W_CachePatchName("M_PAUSE", PU_PATCH);
|
||||
V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - SHORT(patch->width))/2, py, 0, patch);
|
||||
#else
|
||||
INT32 y = ((automapactive) ? (32) : (BASEVIDHEIGHT/2));
|
||||
|
@ -557,6 +590,25 @@ static void D_Display(void)
|
|||
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
}
|
||||
|
||||
needpatchflush = false;
|
||||
needpatchrecache = false;
|
||||
}
|
||||
|
||||
// Lactozilla: Check the renderer's state
|
||||
// after a possible renderer switch.
|
||||
void D_CheckRendererState(void)
|
||||
{
|
||||
// flush all patches from memory
|
||||
// (also frees memory tagged with PU_CACHE)
|
||||
// (which are not necessarily patches but I don't care)
|
||||
if (needpatchflush)
|
||||
Z_FlushCachedPatches();
|
||||
|
||||
// some patches have been freed,
|
||||
// so cache them again
|
||||
if (needpatchrecache)
|
||||
R_ReloadHUDGraphics();
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
|
@ -600,8 +652,7 @@ void D_SRB2Loop(void)
|
|||
// hack to start on a nice clear console screen.
|
||||
COM_ImmedExecute("cls;version");
|
||||
|
||||
if (rendermode == render_soft)
|
||||
V_DrawScaledPatch(0, 0, 0, (patch_t *)W_CacheLumpNum(W_GetNumForName("CONSBACK"), PU_CACHE));
|
||||
V_DrawScaledPatch(0, 0, 0, W_CachePatchNum(W_GetNumForName("CONSBACK"), PU_CACHE));
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
|
||||
for (;;)
|
||||
|
@ -762,7 +813,7 @@ void D_StartTitle(void)
|
|||
|
||||
gameaction = ga_nothing;
|
||||
displayplayer = consoleplayer = 0;
|
||||
gametype = GT_COOP;
|
||||
G_SetGametype(GT_COOP);
|
||||
paused = false;
|
||||
advancedemo = false;
|
||||
F_InitMenuPresValues();
|
||||
|
@ -1239,6 +1290,16 @@ void D_SRB2Main(void)
|
|||
// set user default mode or mode set at cmdline
|
||||
SCR_CheckDefaultMode();
|
||||
|
||||
// Lactozilla: Does the render mode need to change?
|
||||
if ((setrenderneeded != 0) && (setrenderneeded != rendermode))
|
||||
{
|
||||
needpatchflush = true;
|
||||
needpatchrecache = true;
|
||||
VID_CheckRenderer();
|
||||
SCR_ChangeRendererCVars(setrenderneeded);
|
||||
}
|
||||
D_CheckRendererState();
|
||||
|
||||
wipegamestate = gamestate;
|
||||
|
||||
savedata.lives = 0; // flag this as not-used
|
||||
|
@ -1419,14 +1480,14 @@ void D_SRB2Main(void)
|
|||
if (newgametype == -1) // reached end of the list with no match
|
||||
{
|
||||
j = atoi(sgametype); // assume they gave us a gametype number, which is okay too
|
||||
if (j >= 0 && j < NUMGAMETYPES)
|
||||
if (j >= 0 && j < gametypecount)
|
||||
newgametype = (INT16)j;
|
||||
}
|
||||
|
||||
if (newgametype != -1)
|
||||
{
|
||||
j = gametype;
|
||||
gametype = newgametype;
|
||||
G_SetGametype(newgametype);
|
||||
D_GameTypeChanged(j);
|
||||
}
|
||||
}
|
||||
|
@ -1462,7 +1523,7 @@ void D_SRB2Main(void)
|
|||
{
|
||||
levelstarttic = gametic;
|
||||
G_SetGamestate(GS_LEVEL);
|
||||
if (!P_SetupLevel(false))
|
||||
if (!P_LoadLevel(false))
|
||||
I_Quit(); // fail so reset game stuff
|
||||
}
|
||||
}
|
||||
|
|
|
@ -327,6 +327,10 @@ consvar_t cv_numlaps = {"numlaps", "4", CV_NETVAR|CV_CALL|CV_NOINIT, numlaps_con
|
|||
static CV_PossibleValue_t basenumlaps_cons_t[] = {{1, "MIN"}, {50, "MAX"}, {0, "Map default"}, {0, NULL}};
|
||||
consvar_t cv_basenumlaps = {"basenumlaps", "Map default", CV_NETVAR|CV_CALL|CV_CHEAT, basenumlaps_cons_t, BaseNumLaps_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// Point and time limits for every gametype
|
||||
INT32 pointlimits[NUMGAMETYPES];
|
||||
INT32 timelimits[NUMGAMETYPES];
|
||||
|
||||
// log elemental hazards -- not a netvar, is local to current player
|
||||
consvar_t cv_hazardlog = {"hazardlog", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
|
@ -381,6 +385,9 @@ char timedemo_csv_id[256];
|
|||
boolean timedemo_quit;
|
||||
|
||||
INT16 gametype = GT_COOP;
|
||||
UINT32 gametyperules = 0;
|
||||
INT16 gametypecount = (GT_CTF + 1);
|
||||
|
||||
boolean splitscreen = false;
|
||||
boolean circuitmap = false;
|
||||
INT32 adminplayers[MAXPLAYERS];
|
||||
|
@ -859,6 +866,8 @@ void D_RegisterClientCommands(void)
|
|||
// screen.c
|
||||
CV_RegisterVar(&cv_fullscreen);
|
||||
CV_RegisterVar(&cv_renderview);
|
||||
CV_RegisterVar(&cv_renderer);
|
||||
CV_RegisterVar(&cv_newrenderer);
|
||||
CV_RegisterVar(&cv_scr_depth);
|
||||
CV_RegisterVar(&cv_scr_width);
|
||||
CV_RegisterVar(&cv_scr_height);
|
||||
|
@ -1144,7 +1153,7 @@ UINT8 CanChangeSkin(INT32 playernum)
|
|||
return true;
|
||||
|
||||
// Can change skin during initial countdown.
|
||||
if ((gametype == GT_RACE || gametype == GT_COMPETITION) && leveltime < 4*TICRATE)
|
||||
if ((gametyperules & GTR_RACE) && leveltime < 4*TICRATE)
|
||||
return true;
|
||||
|
||||
if (G_TagGametype())
|
||||
|
@ -1960,7 +1969,7 @@ static void Command_Map_f(void)
|
|||
if (isdigit(gametypename[0]))
|
||||
{
|
||||
d = atoi(gametypename);
|
||||
if (d >= 0 && d < NUMGAMETYPES)
|
||||
if (d >= 0 && d < gametypecount)
|
||||
newgametype = d;
|
||||
else
|
||||
{
|
||||
|
@ -1968,7 +1977,7 @@ static void Command_Map_f(void)
|
|||
"Gametype number %d is out of range. Use a number between"
|
||||
" 0 and %d inclusive. ...Or just use the name. :v\n",
|
||||
d,
|
||||
NUMGAMETYPES-1);
|
||||
gametypecount-1);
|
||||
Z_Free(realmapname);
|
||||
Z_Free(mapname);
|
||||
return;
|
||||
|
@ -2087,8 +2096,9 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
|||
|
||||
lastgametype = gametype;
|
||||
gametype = READUINT8(*cp);
|
||||
G_SetGametype(gametype); // I fear putting that macro as an argument
|
||||
|
||||
if (gametype < 0 || gametype >= NUMGAMETYPES)
|
||||
if (gametype < 0 || gametype >= gametypecount)
|
||||
gametype = lastgametype;
|
||||
else if (gametype != lastgametype)
|
||||
D_GameTypeChanged(lastgametype); // emulate consvar_t behavior for gametype
|
||||
|
@ -2431,7 +2441,7 @@ static void Command_Teamchange_f(void)
|
|||
}
|
||||
|
||||
//additional check for hide and seek. Don't allow change of status after hidetime ends.
|
||||
if (gametype == GT_HIDEANDSEEK && leveltime >= (hidetime * TICRATE))
|
||||
if ((gametyperules & GTR_HIDEFROZEN) && leveltime >= (hidetime * TICRATE))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n"));
|
||||
return;
|
||||
|
@ -2528,7 +2538,7 @@ static void Command_Teamchange2_f(void)
|
|||
}
|
||||
|
||||
//additional check for hide and seek. Don't allow change of status after hidetime ends.
|
||||
if (gametype == GT_HIDEANDSEEK && leveltime >= (hidetime * TICRATE))
|
||||
if ((gametyperules & GTR_HIDEFROZEN) && leveltime >= (hidetime * TICRATE))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n"));
|
||||
return;
|
||||
|
@ -2657,7 +2667,7 @@ static void Command_ServerTeamChange_f(void)
|
|||
}
|
||||
|
||||
//additional check for hide and seek. Don't allow change of status after hidetime ends.
|
||||
if (gametype == GT_HIDEANDSEEK && leveltime >= (hidetime * TICRATE))
|
||||
if ((gametyperules & GTR_HIDEFROZEN) && leveltime >= (hidetime * TICRATE))
|
||||
{
|
||||
CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n"));
|
||||
return;
|
||||
|
@ -2746,6 +2756,16 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// Don't switch team, just go away, please, go awaayyyy, aaauuauugghhhghgh
|
||||
if (!LUAh_TeamSwitch(&players[playernum], NetPacket.packet.newteam, players[playernum].spectator, NetPacket.packet.autobalance, NetPacket.packet.scrambled))
|
||||
return;
|
||||
#endif
|
||||
|
||||
//no status changes after hidetime
|
||||
if ((gametyperules & GTR_HIDEFROZEN) && (leveltime >= (hidetime * TICRATE)))
|
||||
error = true;
|
||||
|
||||
//Make sure that the right team number is sent. Keep in mind that normal clients cannot change to certain teams in certain gametypes.
|
||||
switch (gametype)
|
||||
{
|
||||
|
@ -2900,7 +2920,15 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
|||
|
||||
//reset view if you are changed, or viewing someone who was changed.
|
||||
if (playernum == consoleplayer || displayplayer == playernum)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
// Call ViewpointSwitch hooks here.
|
||||
// The viewpoint was forcibly changed.
|
||||
if (displayplayer != consoleplayer) // You're already viewing yourself. No big deal.
|
||||
LUAh_ViewpointSwitch(&players[playernum], &players[displayplayer], true);
|
||||
#endif
|
||||
displayplayer = consoleplayer;
|
||||
}
|
||||
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
|
@ -3636,7 +3664,7 @@ static void Command_ShowGametype_f(void)
|
|||
}
|
||||
|
||||
// get name string for current gametype
|
||||
if (gametype >= 0 && gametype < NUMGAMETYPES)
|
||||
if (gametype >= 0 && gametype < gametypecount)
|
||||
gametypestr = Gametype_Names[gametype];
|
||||
|
||||
if (gametypestr)
|
||||
|
@ -3698,7 +3726,7 @@ void ItemFinder_OnChange(void)
|
|||
static void PointLimit_OnChange(void)
|
||||
{
|
||||
// Don't allow pointlimit in Single Player/Co-Op/Race!
|
||||
if (server && Playing() && G_PlatformGametype())
|
||||
if (server && Playing() && !(gametyperules & GTR_POINTLIMIT))
|
||||
{
|
||||
if (cv_pointlimit.value)
|
||||
CV_StealthSetValue(&cv_pointlimit, 0);
|
||||
|
@ -3861,7 +3889,7 @@ UINT32 timelimitintics = 0;
|
|||
static void TimeLimit_OnChange(void)
|
||||
{
|
||||
// Don't allow timelimit in Single Player/Co-Op/Race!
|
||||
if (server && Playing() && cv_timelimit.value != 0 && G_PlatformGametype())
|
||||
if (server && Playing() && cv_timelimit.value != 0 && !(gametyperules & GTR_TIMELIMIT))
|
||||
{
|
||||
CV_SetValue(&cv_timelimit, 0);
|
||||
return;
|
||||
|
@ -3897,9 +3925,9 @@ void D_GameTypeChanged(INT32 lastgametype)
|
|||
{
|
||||
const char *oldgt = NULL, *newgt = NULL;
|
||||
|
||||
if (lastgametype >= 0 && lastgametype < NUMGAMETYPES)
|
||||
if (lastgametype >= 0 && lastgametype < gametypecount)
|
||||
oldgt = Gametype_Names[lastgametype];
|
||||
if (gametype >= 0 && lastgametype < NUMGAMETYPES)
|
||||
if (gametype >= 0 && lastgametype < gametypecount)
|
||||
newgt = Gametype_Names[gametype];
|
||||
|
||||
if (oldgt && newgt)
|
||||
|
@ -3953,11 +3981,20 @@ void D_GameTypeChanged(INT32 lastgametype)
|
|||
if (!cv_itemrespawntime.changed)
|
||||
CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue); // respawn normally
|
||||
break;
|
||||
default:
|
||||
if (!cv_timelimit.changed && !cv_pointlimit.changed) // user hasn't changed limits
|
||||
{
|
||||
CV_SetValue(&cv_timelimit, timelimits[gametype]);
|
||||
CV_SetValue(&cv_pointlimit, pointlimits[gametype]);
|
||||
}
|
||||
if (!cv_itemrespawntime.changed)
|
||||
CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue); // respawn normally
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!multiplayer && !netgame)
|
||||
{
|
||||
gametype = GT_COOP;
|
||||
G_SetGametype(GT_COOP);
|
||||
// These shouldn't matter anymore
|
||||
//CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue);
|
||||
//CV_SetValue(&cv_itemrespawn, 0);
|
||||
|
@ -3966,7 +4003,7 @@ void D_GameTypeChanged(INT32 lastgametype)
|
|||
// reset timelimit and pointlimit in race/coop, prevent stupid cheats
|
||||
if (server)
|
||||
{
|
||||
if (G_PlatformGametype())
|
||||
if (!(gametyperules & GTR_POINTLIMIT))
|
||||
{
|
||||
if (cv_timelimit.value)
|
||||
CV_SetValue(&cv_timelimit, 0);
|
||||
|
@ -3984,6 +4021,7 @@ void D_GameTypeChanged(INT32 lastgametype)
|
|||
|
||||
// When swapping to a gametype that supports spectators,
|
||||
// make everyone a spectator initially.
|
||||
// Averted with GTR_NOSPECTATORSPAWN.
|
||||
if (!splitscreen && (G_GametypeHasSpectators()))
|
||||
{
|
||||
INT32 i;
|
||||
|
@ -3991,7 +4029,7 @@ void D_GameTypeChanged(INT32 lastgametype)
|
|||
if (playeringame[i])
|
||||
{
|
||||
players[i].ctfteam = 0;
|
||||
players[i].spectator = true;
|
||||
players[i].spectator = (gametyperules & GTR_NOSPECTATORSPAWN) ? false : true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
579
src/dehacked.c
579
src/dehacked.c
|
@ -22,6 +22,7 @@
|
|||
#include "m_menu.h"
|
||||
#include "m_misc.h"
|
||||
#include "f_finale.h"
|
||||
#include "y_inter.h"
|
||||
#include "dehacked.h"
|
||||
#include "st_stuff.h"
|
||||
#include "i_system.h"
|
||||
|
@ -76,6 +77,7 @@ static UINT16 get_mus(const char *word, UINT8 dehacked_mode);
|
|||
static hudnum_t get_huditem(const char *word);
|
||||
static menutype_t get_menutype(const char *word);
|
||||
#ifndef HAVE_BLUA
|
||||
static INT16 get_gametype(const char *word);
|
||||
static powertype_t get_power(const char *word);
|
||||
#endif
|
||||
|
||||
|
@ -590,6 +592,16 @@ static void readfreeslots(MYFILE *f)
|
|||
} else
|
||||
CONS_Alert(CONS_WARNING, "Ran out of free SPR2 slots!\n");
|
||||
}
|
||||
else if (fastcmp(type, "TOL"))
|
||||
{
|
||||
if (lastcustomtol > 31)
|
||||
CONS_Alert(CONS_WARNING, "Ran out of free typeoflevel slots!\n");
|
||||
else
|
||||
{
|
||||
G_AddTOL((1<<lastcustomtol), word);
|
||||
lastcustomtol++;
|
||||
}
|
||||
}
|
||||
else
|
||||
deh_warning("Freeslots: unknown enum class '%s' for '%s_%s'", type, type, word);
|
||||
}
|
||||
|
@ -863,14 +875,12 @@ static void readspriteframe(MYFILE *f, spriteinfo_t *sprinfo, UINT8 frame)
|
|||
strupr(word);
|
||||
value = atoi(word2); // used for numerical settings
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if (fastcmp(word, "XPIVOT"))
|
||||
sprinfo->pivot[frame].x = value;
|
||||
else if (fastcmp(word, "YPIVOT"))
|
||||
sprinfo->pivot[frame].y = value;
|
||||
else if (fastcmp(word, "ROTAXIS"))
|
||||
sprinfo->pivot[frame].rotaxis = value;
|
||||
#endif
|
||||
else
|
||||
{
|
||||
f->curpos = lastline;
|
||||
|
@ -1095,10 +1105,10 @@ static void readsprite2(MYFILE *f, INT32 num)
|
|||
Z_Free(s);
|
||||
}
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
const UINT16 flag;
|
||||
} TYPEOFLEVEL[] = {
|
||||
INT32 numtolinfo = NUMBASETOL;
|
||||
UINT32 lastcustomtol = 13;
|
||||
|
||||
tolinfo_t TYPEOFLEVEL[NUMMAXTOL] = {
|
||||
{"SOLO",TOL_SP},
|
||||
{"SP",TOL_SP},
|
||||
{"SINGLEPLAYER",TOL_SP},
|
||||
|
@ -1114,8 +1124,6 @@ static const struct {
|
|||
{"TAG",TOL_TAG},
|
||||
{"CTF",TOL_CTF},
|
||||
|
||||
{"CUSTOM",TOL_CUSTOM},
|
||||
|
||||
{"2D",TOL_2D},
|
||||
{"MARIO",TOL_MARIO},
|
||||
{"NIGHTS",TOL_NIGHTS},
|
||||
|
@ -1128,6 +1136,216 @@ static const struct {
|
|||
{NULL, 0}
|
||||
};
|
||||
|
||||
// copypasted from readPlayer :sleep:
|
||||
static const char *const GAMETYPERULE_LIST[];
|
||||
static void readgametype(MYFILE *f, char *gtname)
|
||||
{
|
||||
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||
char *word;
|
||||
char *word2, *word2lwr = NULL;
|
||||
char *tmp;
|
||||
INT32 i, j;
|
||||
|
||||
INT16 newgtidx = 0;
|
||||
UINT32 newgtrules = 0;
|
||||
UINT32 newgttol = 0;
|
||||
INT32 newgtpointlimit = 0;
|
||||
INT32 newgttimelimit = 0;
|
||||
UINT8 newgtleftcolor = 0;
|
||||
UINT8 newgtrightcolor = 0;
|
||||
INT16 newgtrankingstype = -1;
|
||||
int newgtinttype = 0;
|
||||
char gtdescription[441];
|
||||
char gtconst[MAXLINELEN];
|
||||
|
||||
// Empty strings.
|
||||
gtdescription[0] = '\0';
|
||||
gtconst[0] = '\0';
|
||||
|
||||
do
|
||||
{
|
||||
if (myfgets(s, MAXLINELEN, f))
|
||||
{
|
||||
if (s[0] == '\n')
|
||||
break;
|
||||
|
||||
word = strtok(s, " ");
|
||||
if (word)
|
||||
strupr(word);
|
||||
else
|
||||
break;
|
||||
|
||||
if (fastcmp(word, "DESCRIPTION"))
|
||||
{
|
||||
char *descr = NULL;
|
||||
|
||||
for (i = 0; i < MAXLINELEN-3; i++)
|
||||
{
|
||||
if (s[i] == '=')
|
||||
{
|
||||
descr = &s[i+2];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (descr)
|
||||
{
|
||||
strcpy(gtdescription, descr);
|
||||
strcat(gtdescription, myhashfgets(descr, sizeof (gtdescription), f));
|
||||
}
|
||||
else
|
||||
strcpy(gtdescription, "");
|
||||
|
||||
// For some reason, cutting the string did not work above. Most likely due to strcpy or strcat...
|
||||
// It works down here, though.
|
||||
{
|
||||
INT32 numline = 0;
|
||||
for (i = 0; i < MAXLINELEN-1; i++)
|
||||
{
|
||||
if (numline < 20 && gtdescription[i] == '\n')
|
||||
numline++;
|
||||
|
||||
if (numline >= 20 || gtdescription[i] == '\0' || gtdescription[i] == '#')
|
||||
break;
|
||||
}
|
||||
}
|
||||
gtdescription[strlen(gtdescription)-1] = '\0';
|
||||
gtdescription[i] = '\0';
|
||||
continue;
|
||||
}
|
||||
|
||||
word2 = strtok(NULL, " = ");
|
||||
if (word2)
|
||||
{
|
||||
if (!word2lwr)
|
||||
word2lwr = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||
strcpy(word2lwr, word2);
|
||||
strupr(word2);
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
if (word2[strlen(word2)-1] == '\n')
|
||||
word2[strlen(word2)-1] = '\0';
|
||||
i = atoi(word2);
|
||||
|
||||
// Game type rules
|
||||
if (fastcmp(word, "RULES"))
|
||||
{
|
||||
// GTR_
|
||||
newgtrules = (UINT32)get_number(word2);
|
||||
}
|
||||
// Identifier
|
||||
else if (fastcmp(word, "IDENTIFIER"))
|
||||
{
|
||||
// GT_
|
||||
strncpy(gtconst, word2, MAXLINELEN);
|
||||
}
|
||||
// Point and time limits
|
||||
else if (fastcmp(word, "DEFAULTPOINTLIMIT"))
|
||||
newgtpointlimit = (INT32)i;
|
||||
else if (fastcmp(word, "DEFAULTTIMELIMIT"))
|
||||
newgttimelimit = (INT32)i;
|
||||
// Level platter
|
||||
else if (fastcmp(word, "HEADERCOLOR") || fastcmp(word, "HEADERCOLOUR"))
|
||||
newgtleftcolor = newgtrightcolor = (UINT8)get_number(word2);
|
||||
else if (fastcmp(word, "HEADERLEFTCOLOR") || fastcmp(word, "HEADERLEFTCOLOUR"))
|
||||
newgtleftcolor = (UINT8)get_number(word2);
|
||||
else if (fastcmp(word, "HEADERRIGHTCOLOR") || fastcmp(word, "HEADERRIGHTCOLOUR"))
|
||||
newgtrightcolor = (UINT8)get_number(word2);
|
||||
// Rankings type
|
||||
else if (fastcmp(word, "RANKINGTYPE"))
|
||||
{
|
||||
// Case insensitive
|
||||
newgtrankingstype = (int)get_number(word2);
|
||||
}
|
||||
// Intermission type
|
||||
else if (fastcmp(word, "INTERMISSIONTYPE"))
|
||||
{
|
||||
// Case sensitive
|
||||
newgtinttype = (int)get_number(word2lwr);
|
||||
}
|
||||
// Type of level
|
||||
else if (fastcmp(word, "TYPEOFLEVEL"))
|
||||
{
|
||||
if (i) // it's just a number
|
||||
newgttol = (UINT32)i;
|
||||
else
|
||||
{
|
||||
UINT16 tol = 0;
|
||||
tmp = strtok(word2,",");
|
||||
do {
|
||||
for (i = 0; TYPEOFLEVEL[i].name; i++)
|
||||
if (fasticmp(tmp, TYPEOFLEVEL[i].name))
|
||||
break;
|
||||
if (!TYPEOFLEVEL[i].name)
|
||||
deh_warning("readgametype %s: unknown typeoflevel flag %s\n", gtname, tmp);
|
||||
tol |= TYPEOFLEVEL[i].flag;
|
||||
} while((tmp = strtok(NULL,",")) != NULL);
|
||||
newgttol = tol;
|
||||
}
|
||||
}
|
||||
// The SOC probably provided gametype rules as words,
|
||||
// instead of using the RULES keyword.
|
||||
// Like for example "NOSPECTATORSPAWN = TRUE".
|
||||
// This is completely valid, and looks better anyway.
|
||||
else
|
||||
{
|
||||
UINT32 wordgt = 0;
|
||||
for (j = 0; GAMETYPERULE_LIST[j]; j++)
|
||||
if (fastcmp(word, GAMETYPERULE_LIST[j])) {
|
||||
if (!j) // GTR_CAMPAIGN
|
||||
wordgt |= 1;
|
||||
else
|
||||
wordgt |= (1<<j);
|
||||
if (i || word2[0] == 'T' || word2[0] == 'Y')
|
||||
newgtrules |= wordgt;
|
||||
break;
|
||||
}
|
||||
if (!wordgt)
|
||||
deh_warning("readgametype %s: unknown word '%s'", gtname, word);
|
||||
}
|
||||
}
|
||||
} while (!myfeof(f)); // finish when the line is empty
|
||||
|
||||
// Free strings.
|
||||
Z_Free(s);
|
||||
if (word2lwr)
|
||||
Z_Free(word2lwr);
|
||||
|
||||
// Ran out of gametype slots
|
||||
if (gametypecount == NUMGAMETYPEFREESLOTS)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "Ran out of free gametype slots!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the new gametype
|
||||
newgtidx = G_AddGametype(newgtrules);
|
||||
G_AddGametypeTOL(newgtidx, newgttol);
|
||||
G_SetGametypeDescription(newgtidx, gtdescription, newgtleftcolor, newgtrightcolor);
|
||||
|
||||
// Not covered by G_AddGametype alone.
|
||||
if (newgtrankingstype == -1)
|
||||
newgtrankingstype = newgtidx;
|
||||
gametyperankings[newgtidx] = newgtrankingstype;
|
||||
intermissiontypes[newgtidx] = newgtinttype;
|
||||
pointlimits[newgtidx] = newgtpointlimit;
|
||||
timelimits[newgtidx] = newgttimelimit;
|
||||
|
||||
// Write the new gametype name.
|
||||
Gametype_Names[newgtidx] = Z_StrDup((const char *)gtname);
|
||||
|
||||
// Write the constant name.
|
||||
if (gtconst[0] == '\0')
|
||||
strncpy(gtconst, gtname, MAXLINELEN);
|
||||
G_AddGametypeConstant(newgtidx, (const char *)gtconst);
|
||||
|
||||
// Update gametype_cons_t accordingly.
|
||||
G_UpdateGametypeSelections();
|
||||
|
||||
CONS_Printf("Added gametype %s\n", Gametype_Names[newgtidx]);
|
||||
}
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
const mobjtype_t type;
|
||||
|
@ -1395,7 +1613,7 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
else if (fastcmp(word, "TYPEOFLEVEL"))
|
||||
{
|
||||
if (i) // it's just a number
|
||||
mapheaderinfo[num-1]->typeoflevel = (UINT16)i;
|
||||
mapheaderinfo[num-1]->typeoflevel = (UINT32)i;
|
||||
else
|
||||
{
|
||||
UINT16 tol = 0;
|
||||
|
@ -1520,10 +1738,27 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
deh_warning("Level header %d: invalid bonus type number %d", num, i);
|
||||
}
|
||||
|
||||
// Title card
|
||||
else if (fastcmp(word, "TITLECARDZIGZAG"))
|
||||
{
|
||||
deh_strlcpy(mapheaderinfo[num-1]->ltzzpatch, word2,
|
||||
sizeof(mapheaderinfo[num-1]->ltzzpatch), va("Level header %d: title card zigzag patch name", num));
|
||||
}
|
||||
else if (fastcmp(word, "TITLECARDZIGZAGTEXT"))
|
||||
{
|
||||
deh_strlcpy(mapheaderinfo[num-1]->ltzztext, word2,
|
||||
sizeof(mapheaderinfo[num-1]->ltzztext), va("Level header %d: title card zigzag text patch name", num));
|
||||
}
|
||||
else if (fastcmp(word, "TITLECARDACTDIAMOND"))
|
||||
{
|
||||
deh_strlcpy(mapheaderinfo[num-1]->ltactdiamond, word2,
|
||||
sizeof(mapheaderinfo[num-1]->ltactdiamond), va("Level header %d: title card act diamond patch name", num));
|
||||
}
|
||||
|
||||
else if (fastcmp(word, "MAXBONUSLIVES"))
|
||||
mapheaderinfo[num-1]->maxbonuslives = (SINT8)i;
|
||||
else if (fastcmp(word, "LEVELFLAGS"))
|
||||
mapheaderinfo[num-1]->levelflags = (UINT8)i;
|
||||
mapheaderinfo[num-1]->levelflags = (UINT16)i;
|
||||
else if (fastcmp(word, "MENUFLAGS"))
|
||||
mapheaderinfo[num-1]->menuflags = (UINT8)i;
|
||||
|
||||
|
@ -2673,11 +2908,9 @@ static actionpointer_t actionpointers[] =
|
|||
{{A_SpawnObjectRelative}, "A_SPAWNOBJECTRELATIVE"},
|
||||
{{A_ChangeAngleRelative}, "A_CHANGEANGLERELATIVE"},
|
||||
{{A_ChangeAngleAbsolute}, "A_CHANGEANGLEABSOLUTE"},
|
||||
#ifdef ROTSPRITE
|
||||
{{A_RollAngle}, "A_ROLLANGLE"},
|
||||
{{A_ChangeRollAngleRelative},"A_CHANGEROLLANGLERELATIVE"},
|
||||
{{A_ChangeRollAngleAbsolute},"A_CHANGEROLLANGLEABSOLUTE"},
|
||||
#endif
|
||||
{{A_PlaySound}, "A_PLAYSOUND"},
|
||||
{{A_FindTarget}, "A_FINDTARGET"},
|
||||
{{A_FindTracer}, "A_FINDTRACER"},
|
||||
|
@ -4155,6 +4388,7 @@ static void ignorelines(MYFILE *f)
|
|||
static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
|
||||
{
|
||||
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||
char textline[MAXLINELEN];
|
||||
char *word;
|
||||
char *word2;
|
||||
INT32 i;
|
||||
|
@ -4175,6 +4409,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
|
|||
char *traverse;
|
||||
|
||||
myfgets(s, MAXLINELEN, f);
|
||||
memcpy(textline, s, MAXLINELEN);
|
||||
if (s[0] == '\n' || s[0] == '#')
|
||||
continue;
|
||||
|
||||
|
@ -4363,6 +4598,36 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
|
|||
ignorelines(f);
|
||||
}
|
||||
}
|
||||
else if (fastcmp(word, "GAMETYPE"))
|
||||
{
|
||||
// Get the gametype name from textline
|
||||
// instead of word2, so that gametype names
|
||||
// aren't allcaps
|
||||
INT32 c;
|
||||
for (c = 0; c < MAXLINELEN; c++)
|
||||
{
|
||||
if (textline[c] == '\0')
|
||||
break;
|
||||
if (textline[c] == ' ')
|
||||
{
|
||||
char *gtname = (textline+c+1);
|
||||
if (gtname)
|
||||
{
|
||||
// remove funny characters
|
||||
INT32 j;
|
||||
for (j = 0; j < (MAXLINELEN - c); j++)
|
||||
{
|
||||
if (gtname[j] == '\0')
|
||||
break;
|
||||
if (gtname[j] < 32)
|
||||
gtname[j] = '\0';
|
||||
}
|
||||
readgametype(f, gtname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (fastcmp(word, "CUTSCENE"))
|
||||
{
|
||||
if (i > 0 && i < 129)
|
||||
|
@ -8559,9 +8824,11 @@ static const char *const MOBJEFLAG_LIST[] = {
|
|||
"JUSTSTEPPEDDOWN", // used for ramp sectors
|
||||
"VERTICALFLIP", // Vertically flip sprite/allow upside-down physics
|
||||
"GOOWATER", // Goo water
|
||||
"TOUCHLAVA", // The mobj is touching a lava block
|
||||
"PUSHED", // Mobj was already pushed this tic
|
||||
"SPRUNG", // Mobj was already sprung this tic
|
||||
"APPLYPMOMZ", // Platform movement
|
||||
"TRACERANGLE", // Compute and trigger on mobj angle relative to tracer
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -8633,6 +8900,39 @@ static const char *const PLAYERFLAG_LIST[] = {
|
|||
NULL // stop loop here.
|
||||
};
|
||||
|
||||
static const char *const GAMETYPERULE_LIST[] = {
|
||||
"CAMPAIGN",
|
||||
"RINGSLINGER",
|
||||
"SPECTATORS",
|
||||
"FRIENDLYFIRE",
|
||||
"LIVES",
|
||||
"TEAMS",
|
||||
"RACE",
|
||||
"TAG",
|
||||
"POINTLIMIT",
|
||||
"TIMELIMIT",
|
||||
"HIDETIME",
|
||||
"HIDEFROZEN",
|
||||
"BLINDFOLDED",
|
||||
"FIRSTPERSON",
|
||||
"MATCHEMERALDS",
|
||||
"TEAMFLAGS",
|
||||
"PITYSHIELD",
|
||||
"DEATHPENALTY",
|
||||
"NOSPECTATORSPAWN",
|
||||
"DEATHMATCHSTARTS",
|
||||
"SPECIALSTAGES",
|
||||
"EMERALDTOKENS",
|
||||
"EMERALDHUNT",
|
||||
"SPAWNENEMIES",
|
||||
"ALLOWEXIT",
|
||||
"NOTITLECARD",
|
||||
"OVERTIME",
|
||||
"HURTMESSAGES",
|
||||
"SPAWNINVUL",
|
||||
NULL
|
||||
};
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// Linedef flags
|
||||
static const char *const ML_LIST[16] = {
|
||||
|
@ -9048,21 +9348,6 @@ struct {
|
|||
{"tr_trans90",tr_trans90},
|
||||
{"NUMTRANSMAPS",NUMTRANSMAPS},
|
||||
|
||||
// Type of levels
|
||||
{"TOL_SP",TOL_SP},
|
||||
{"TOL_COOP",TOL_COOP},
|
||||
{"TOL_COMPETITION",TOL_COMPETITION},
|
||||
{"TOL_RACE",TOL_RACE},
|
||||
{"TOL_MATCH",TOL_MATCH},
|
||||
{"TOL_TAG",TOL_TAG},
|
||||
{"TOL_CTF",TOL_CTF},
|
||||
{"TOL_CUSTOM",TOL_CUSTOM},
|
||||
{"TOL_2D",TOL_2D},
|
||||
{"TOL_MARIO",TOL_MARIO},
|
||||
{"TOL_NIGHTS",TOL_NIGHTS},
|
||||
{"TOL_ERZ3",TOL_ERZ3},
|
||||
{"TOL_XMAS",TOL_XMAS},
|
||||
|
||||
// Level flags
|
||||
{"LF_SCRIPTISFILE",LF_SCRIPTISFILE},
|
||||
{"LF_SPEEDMUSIC",LF_SPEEDMUSIC},
|
||||
|
@ -9245,15 +9530,16 @@ struct {
|
|||
{"DMG_CANHURTSELF",DMG_CANHURTSELF},
|
||||
{"DMG_DEATHMASK",DMG_DEATHMASK},
|
||||
|
||||
// Gametypes, for use with global var "gametype"
|
||||
{"GT_COOP",GT_COOP},
|
||||
{"GT_COMPETITION",GT_COMPETITION},
|
||||
{"GT_RACE",GT_RACE},
|
||||
{"GT_MATCH",GT_MATCH},
|
||||
{"GT_TEAMMATCH",GT_TEAMMATCH},
|
||||
{"GT_TAG",GT_TAG},
|
||||
{"GT_HIDEANDSEEK",GT_HIDEANDSEEK},
|
||||
{"GT_CTF",GT_CTF},
|
||||
// Intermission types
|
||||
{"int_none",int_none},
|
||||
{"int_coop",int_coop},
|
||||
{"int_match",int_match},
|
||||
{"int_teammatch",int_teammatch},
|
||||
//{"int_tag",int_tag},
|
||||
{"int_ctf",int_ctf},
|
||||
{"int_spec",int_spec},
|
||||
{"int_race",int_race},
|
||||
{"int_comp",int_comp},
|
||||
|
||||
// Jingles (jingletype_t)
|
||||
{"JT_NONE",JT_NONE},
|
||||
|
@ -9426,12 +9712,10 @@ struct {
|
|||
{"DI_SOUTHEAST",DI_SOUTHEAST},
|
||||
{"NUMDIRS",NUMDIRS},
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
// Sprite rotation axis (rotaxis_t)
|
||||
{"ROTAXIS_X",ROTAXIS_X},
|
||||
{"ROTAXIS_Y",ROTAXIS_Y},
|
||||
{"ROTAXIS_Z",ROTAXIS_Z},
|
||||
#endif
|
||||
|
||||
// Buttons (ticcmd_t)
|
||||
{"BT_WEAPONMASK",BT_WEAPONMASK}, //our first four bits.
|
||||
|
@ -9462,6 +9746,7 @@ struct {
|
|||
{"CV_HIDEN",CV_HIDEN},
|
||||
{"CV_HIDDEN",CV_HIDEN},
|
||||
{"CV_CHEAT",CV_CHEAT},
|
||||
{"CV_NOLUA",CV_NOLUA},
|
||||
|
||||
// v_video flags
|
||||
{"V_NOSCALEPATCH",V_NOSCALEPATCH},
|
||||
|
@ -9546,7 +9831,7 @@ struct {
|
|||
};
|
||||
|
||||
static mobjtype_t get_mobjtype(const char *word)
|
||||
{ // Returns the vlaue of MT_ enumerations
|
||||
{ // Returns the value of MT_ enumerations
|
||||
mobjtype_t i;
|
||||
if (*word >= '0' && *word <= '9')
|
||||
return atoi(word);
|
||||
|
@ -9698,8 +9983,22 @@ static menutype_t get_menutype(const char *word)
|
|||
}
|
||||
|
||||
#ifndef HAVE_BLUA
|
||||
static INT16 get_gametype(const char *word)
|
||||
{ // Returns the value of GT_ enumerations
|
||||
INT16 i;
|
||||
if (*word >= '0' && *word <= '9')
|
||||
return atoi(word);
|
||||
if (fastncmp("GT_",word,3))
|
||||
word += 3; // take off the GT_
|
||||
for (i = 0; i < NUMGAMETYPES; i++)
|
||||
if (fastcmp(word, Gametype_ConstantNames[i]+3))
|
||||
return i;
|
||||
deh_warning("Couldn't find gametype named 'GT_%s'",word);
|
||||
return GT_COOP;
|
||||
}
|
||||
|
||||
static powertype_t get_power(const char *word)
|
||||
{ // Returns the vlaue of pw_ enumerations
|
||||
{ // Returns the value of pw_ enumerations
|
||||
powertype_t i;
|
||||
if (*word >= '0' && *word <= '9')
|
||||
return atoi(word);
|
||||
|
@ -9893,11 +10192,42 @@ static fixed_t find_const(const char **rword)
|
|||
free(word);
|
||||
return r;
|
||||
}
|
||||
else if (fastncmp("MN_",word,4)) {
|
||||
else if (fastncmp("MN_",word,3)) {
|
||||
r = get_menutype(word);
|
||||
free(word);
|
||||
return r;
|
||||
}
|
||||
else if (fastncmp("GT_",word,4)) {
|
||||
r = get_gametype(word);
|
||||
free(word);
|
||||
return r;
|
||||
}
|
||||
else if (fastncmp("GTR_", word, 4)) {
|
||||
char *p = word+4;
|
||||
for (i = 0; GAMETYPERULE_LIST[i]; i++)
|
||||
if (fastcmp(p, GAMETYPERULE_LIST[i])) {
|
||||
free(word);
|
||||
return (1<<i);
|
||||
}
|
||||
|
||||
// Not found error
|
||||
const_warning("game type rule",word);
|
||||
free(word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("TOL_", word, 4)) {
|
||||
char *p = word+4;
|
||||
for (i = 0; TYPEOFLEVEL[i].name; i++)
|
||||
if (fastcmp(p, TYPEOFLEVEL[i].name)) {
|
||||
free(word);
|
||||
return TYPEOFLEVEL[i].flag;
|
||||
}
|
||||
|
||||
// Not found error
|
||||
const_warning("typeoflevel",word);
|
||||
free(word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("HUD_",word,4)) {
|
||||
r = get_huditem(word);
|
||||
free(word);
|
||||
|
@ -10107,6 +10437,20 @@ static inline int lib_freeslot(lua_State *L)
|
|||
}
|
||||
r++;
|
||||
}
|
||||
else if (fastcmp(type, "TOL"))
|
||||
{
|
||||
if (lastcustomtol > 31)
|
||||
CONS_Alert(CONS_WARNING, "Ran out of free typeoflevel slots!\n");
|
||||
else
|
||||
{
|
||||
UINT32 newtol = (1<<lastcustomtol);
|
||||
CONS_Printf("TypeOfLevel TOL_%s allocated.\n",word);
|
||||
G_AddTOL(newtol, word);
|
||||
lua_pushinteger(L, newtol);
|
||||
lastcustomtol++;
|
||||
r++;
|
||||
}
|
||||
}
|
||||
Z_Free(s);
|
||||
lua_remove(L, 1);
|
||||
continue;
|
||||
|
@ -10211,6 +10555,36 @@ static inline int lib_getenum(lua_State *L)
|
|||
if (mathlib) return luaL_error(L, "playerflag '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("GT_", word, 3)) {
|
||||
p = word;
|
||||
for (i = 0; Gametype_ConstantNames[i]; i++)
|
||||
if (fastcmp(p, Gametype_ConstantNames[i])) {
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "gametype '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("GTR_", word, 4)) {
|
||||
p = word+4;
|
||||
for (i = 0; GAMETYPERULE_LIST[i]; i++)
|
||||
if (fastcmp(p, GAMETYPERULE_LIST[i])) {
|
||||
lua_pushinteger(L, ((lua_Integer)1<<i));
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "game type rule '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("TOL_", word, 4)) {
|
||||
p = word+4;
|
||||
for (i = 0; TYPEOFLEVEL[i].name; i++)
|
||||
if (fastcmp(p, TYPEOFLEVEL[i].name)) {
|
||||
lua_pushinteger(L, TYPEOFLEVEL[i].flag);
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "typeoflevel '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("ML_", word, 3)) {
|
||||
p = word+3;
|
||||
for (i = 0; i < 16; i++)
|
||||
|
@ -10448,126 +10822,7 @@ static inline int lib_getenum(lua_State *L)
|
|||
// DYNAMIC variables too!!
|
||||
// Try not to add anything that would break netgames or timeattack replays here.
|
||||
// You know, like consoleplayer, displayplayer, secondarydisplayplayer, or gametime.
|
||||
if (fastcmp(word,"gamemap")) {
|
||||
lua_pushinteger(L, gamemap);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"maptol")) {
|
||||
lua_pushinteger(L, maptol);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"ultimatemode")) {
|
||||
lua_pushboolean(L, ultimatemode != 0);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"mariomode")) {
|
||||
lua_pushboolean(L, mariomode != 0);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"twodlevel")) {
|
||||
lua_pushboolean(L, twodlevel != 0);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"circuitmap")) {
|
||||
lua_pushboolean(L, circuitmap);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"netgame")) {
|
||||
lua_pushboolean(L, netgame);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"multiplayer")) {
|
||||
lua_pushboolean(L, multiplayer);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"modeattacking")) {
|
||||
lua_pushboolean(L, modeattacking);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"splitscreen")) {
|
||||
lua_pushboolean(L, splitscreen);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"gamecomplete")) {
|
||||
lua_pushboolean(L, gamecomplete);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"devparm")) {
|
||||
lua_pushboolean(L, devparm);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"modifiedgame")) {
|
||||
lua_pushboolean(L, modifiedgame && !savemoddata);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"menuactive")) {
|
||||
lua_pushboolean(L, menuactive);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"paused")) {
|
||||
lua_pushboolean(L, paused);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"titlemap")) {
|
||||
lua_pushinteger(L, titlemap);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"titlemapinaction")) {
|
||||
lua_pushboolean(L, (titlemapinaction != TITLEMAP_OFF));
|
||||
return 1;
|
||||
} else if (fastcmp(word,"gametype")) {
|
||||
lua_pushinteger(L, gametype);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"leveltime")) {
|
||||
lua_pushinteger(L, leveltime);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"curWeather")) {
|
||||
lua_pushinteger(L, curWeather);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"globalweather")) {
|
||||
lua_pushinteger(L, globalweather);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"levelskynum")) {
|
||||
lua_pushinteger(L, levelskynum);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"globallevelskynum")) {
|
||||
lua_pushinteger(L, globallevelskynum);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"mapmusname")) {
|
||||
lua_pushstring(L, mapmusname);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"mapmusflags")) {
|
||||
lua_pushinteger(L, mapmusflags);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"mapmusposition")) {
|
||||
lua_pushinteger(L, mapmusposition);
|
||||
return 1;
|
||||
// local player variables, by popular request
|
||||
} else if (fastcmp(word,"consoleplayer")) { // player controlling console (aka local player 1)
|
||||
if (consoleplayer < 0 || !playeringame[consoleplayer])
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[consoleplayer], META_PLAYER);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"displayplayer")) { // player visible on screen (aka display player 1)
|
||||
if (displayplayer < 0 || !playeringame[displayplayer])
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[displayplayer], META_PLAYER);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"secondarydisplayplayer")) { // local/display player 2, for splitscreen
|
||||
if (!splitscreen || secondarydisplayplayer < 0 || !playeringame[secondarydisplayplayer])
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[secondarydisplayplayer], META_PLAYER);
|
||||
return 1;
|
||||
// end local player variables
|
||||
} else if (fastcmp(word,"server")) {
|
||||
if ((!multiplayer || !netgame) && !playeringame[serverplayer])
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[serverplayer], META_PLAYER);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"admin")) { // BACKWARDS COMPATIBILITY HACK: This was replaced with IsPlayerAdmin(), but some 2.1 Lua scripts still use the admin variable. It now points to the first admin player in the array.
|
||||
LUA_Deprecated(L, "admin", "IsPlayerAdmin(player)");
|
||||
if (!playeringame[adminplayers[0]] || IsPlayerAdmin(serverplayer))
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[adminplayers[0]], META_PLAYER);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"emeralds")) {
|
||||
lua_pushinteger(L, emeralds);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"gravity")) {
|
||||
lua_pushinteger(L, gravity);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"VERSIONSTRING")) {
|
||||
lua_pushstring(L, VERSIONSTRING);
|
||||
return 1;
|
||||
} else if (fastcmp(word, "token")) {
|
||||
lua_pushinteger(L, token);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
return LUA_PushGlobals(L, word);
|
||||
}
|
||||
|
||||
int LUA_EnumLib(lua_State *L)
|
||||
|
@ -10634,6 +10889,8 @@ static int lib_getActionName(lua_State *L)
|
|||
return luaL_typerror(L, 1, "action userdata or Lua function");
|
||||
}
|
||||
|
||||
|
||||
|
||||
int LUA_SOCLib(lua_State *L)
|
||||
{
|
||||
lua_register(L,"freeslot",lib_freeslot);
|
||||
|
|
|
@ -338,3 +338,8 @@ void I_StartupGraphics(void)
|
|||
graphics_started = true;
|
||||
|
||||
}
|
||||
|
||||
void I_StartupHardwareGraphics(void)
|
||||
{
|
||||
// oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo y
|
||||
}
|
||||
|
|
|
@ -378,6 +378,11 @@ INT32 VID_SetMode (INT32 modenum) //, UINT8 *palette)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
// ..............
|
||||
}
|
||||
|
||||
|
||||
|
||||
// converts a segm:offs 32bit pair to a 32bit flat ptr
|
||||
|
|
|
@ -130,6 +130,9 @@ extern FILE *logstream;
|
|||
extern char logfilename[1024];
|
||||
#endif
|
||||
|
||||
/* A mod name to further distinguish versions. */
|
||||
#define SRB2APPLICATION "SRB2"
|
||||
|
||||
//#define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3
|
||||
#ifdef DEVELOP
|
||||
#define VERSION 0 // Game version
|
||||
|
@ -624,9 +627,12 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
/// SRB2CB itself ported this from PrBoom+
|
||||
#define NEWCLIP
|
||||
|
||||
/// Cache patches in Lua in a way that renderer switching will work flawlessly.
|
||||
//#define LUA_PATCH_SAFETY
|
||||
|
||||
/// Sprite rotation
|
||||
#define ROTSPRITE
|
||||
#define ROTANGLES 24 // Needs to be a divisor of 360 (45, 60, 90, 120...)
|
||||
#define ROTANGLES 72 // Needs to be a divisor of 360 (45, 60, 90, 120...)
|
||||
#define ROTANGDIFF (360 / ROTANGLES)
|
||||
|
||||
/// PNG support
|
||||
|
|
112
src/doomstat.h
112
src/doomstat.h
|
@ -39,7 +39,7 @@ extern UINT32 mapmusposition;
|
|||
#define MUSIC_FORCERESET 0x4000 // -*--------------
|
||||
// Use other bits if necessary.
|
||||
|
||||
extern INT16 maptol;
|
||||
extern UINT32 maptol;
|
||||
extern UINT8 globalweather;
|
||||
extern INT32 curWeather;
|
||||
extern INT32 cursaveslot;
|
||||
|
@ -84,6 +84,9 @@ extern boolean addedtogame; // true after the server has added you
|
|||
extern boolean multiplayer;
|
||||
|
||||
extern INT16 gametype;
|
||||
extern UINT32 gametyperules;
|
||||
extern INT16 gametypecount;
|
||||
|
||||
extern boolean splitscreen;
|
||||
extern boolean circuitmap; // Does this level have 'circuit mode'?
|
||||
extern boolean fromlevelselect;
|
||||
|
@ -284,7 +287,7 @@ typedef struct
|
|||
char lvlttl[22]; ///< Level name without "Zone". (21 character limit instead of 32, 21 characters can display on screen max anyway)
|
||||
char subttl[33]; ///< Subtitle for level
|
||||
UINT8 actnum; ///< Act number or 0 for none.
|
||||
UINT16 typeoflevel; ///< Combination of typeoflevel flags.
|
||||
UINT32 typeoflevel; ///< Combination of typeoflevel flags.
|
||||
INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end.
|
||||
char musname[7]; ///< Music track to play. "" for no music.
|
||||
UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore.
|
||||
|
@ -310,12 +313,17 @@ typedef struct
|
|||
SINT8 bonustype; ///< What type of bonus does this level have? (-1 for null.)
|
||||
SINT8 maxbonuslives; ///< How many bonus lives to award at Intermission? (-1 for unlimited.)
|
||||
|
||||
UINT8 levelflags; ///< LF_flags: merged booleans into one UINT8 for space, see below
|
||||
UINT16 levelflags; ///< LF_flags: merged booleans into one UINT16 for space, see below
|
||||
UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus
|
||||
|
||||
char selectheading[22]; ///< Level select heading. Allows for controllable grouping.
|
||||
UINT16 startrings; ///< Number of rings players start with.
|
||||
|
||||
// Title card.
|
||||
char ltzzpatch[8]; ///< Zig zag patch.
|
||||
char ltzztext[8]; ///< Zig zag text.
|
||||
char ltactdiamond[8]; ///< Act diamond.
|
||||
|
||||
// Freed animals stuff.
|
||||
UINT8 numFlickies; ///< Internal. For freed flicky support.
|
||||
mobjtype_t *flickies; ///< List of freeable flickies in this level. Allocated dynamically for space reasons. Be careful.
|
||||
|
@ -361,6 +369,70 @@ typedef struct
|
|||
|
||||
extern mapheader_t* mapheaderinfo[NUMMAPS];
|
||||
|
||||
// Gametypes
|
||||
#define NUMGAMETYPEFREESLOTS 128
|
||||
enum GameType
|
||||
{
|
||||
GT_COOP = 0, // also used in single player
|
||||
GT_COMPETITION, // Classic "Race"
|
||||
GT_RACE,
|
||||
|
||||
GT_MATCH,
|
||||
GT_TEAMMATCH,
|
||||
|
||||
GT_TAG,
|
||||
GT_HIDEANDSEEK,
|
||||
|
||||
GT_CTF, // capture the flag
|
||||
|
||||
GT_FIRSTFREESLOT,
|
||||
GT_LASTFREESLOT = GT_FIRSTFREESLOT + NUMGAMETYPEFREESLOTS - 1,
|
||||
NUMGAMETYPES
|
||||
};
|
||||
// If you alter this list, update dehacked.c, MISC_ChangeGameTypeMenu in m_menu.c, and Gametype_Names in g_game.c
|
||||
|
||||
// Gametype rules
|
||||
enum GameTypeRules
|
||||
{
|
||||
GTR_CAMPAIGN = 1, // Linear Co-op map progression, don't allow random maps
|
||||
GTR_RINGSLINGER = 1<<1, // Outside of Co-op, Competition, and Race (overriden by cv_ringslinger)
|
||||
GTR_SPECTATORS = 1<<2, // Outside of Co-op, Competition, and Race
|
||||
GTR_FRIENDLYFIRE = 1<<3, // Always allow friendly fire
|
||||
GTR_LIVES = 1<<4, // Co-op and Competition
|
||||
GTR_TEAMS = 1<<5, // Team Match, CTF
|
||||
GTR_RACE = 1<<6, // Race and Competition
|
||||
GTR_TAG = 1<<7, // Tag and Hide and Seek
|
||||
GTR_POINTLIMIT = 1<<8, // Ringslinger point limit
|
||||
GTR_TIMELIMIT = 1<<9, // Ringslinger time limit
|
||||
GTR_HIDETIME = 1<<10, // Hide time (Tag and Hide and Seek)
|
||||
GTR_HIDEFROZEN = 1<<11, // Frozen after hide time (Hide and Seek, but not Tag)
|
||||
GTR_BLINDFOLDED = 1<<12, // Blindfolded view (Tag and Hide and Seek)
|
||||
GTR_FIRSTPERSON = 1<<13, // First person camera
|
||||
GTR_MATCHEMERALDS = 1<<14, // Ringslinger emeralds (Match and CTF)
|
||||
GTR_TEAMFLAGS = 1<<15, // Gametype has team flags (CTF)
|
||||
GTR_PITYSHIELD = 1<<16, // Award pity shield
|
||||
GTR_DEATHPENALTY = 1<<17, // Death score penalty
|
||||
GTR_NOSPECTATORSPAWN = 1<<18, // Use with GTR_SPECTATORS, spawn in the map instead of with the spectators
|
||||
GTR_DEATHMATCHSTARTS = 1<<19, // Use deathmatch starts
|
||||
GTR_SPECIALSTAGES = 1<<20, // Allow special stages
|
||||
GTR_EMERALDTOKENS = 1<<21, // Spawn emerald tokens
|
||||
GTR_EMERALDHUNT = 1<<22, // Emerald Hunt
|
||||
GTR_SPAWNENEMIES = 1<<23, // Spawn enemies
|
||||
GTR_ALLOWEXIT = 1<<24, // Allow exit sectors
|
||||
GTR_NOTITLECARD = 1<<25, // Don't show the title card
|
||||
GTR_OVERTIME = 1<<26, // Allow overtime
|
||||
GTR_HURTMESSAGES = 1<<27, // Hit and death messages
|
||||
GTR_SPAWNINVUL = 1<<28, // Babysitting deterrent
|
||||
};
|
||||
|
||||
// String names for gametypes
|
||||
extern const char *Gametype_Names[NUMGAMETYPES];
|
||||
extern const char *Gametype_ConstantNames[NUMGAMETYPES];
|
||||
|
||||
// Point and time limits for every gametype
|
||||
extern INT32 pointlimits[NUMGAMETYPES];
|
||||
extern INT32 timelimits[NUMGAMETYPES];
|
||||
|
||||
enum TypeOfLevel
|
||||
{
|
||||
TOL_SP = 0x01, ///< Single Player
|
||||
|
@ -376,36 +448,26 @@ enum TypeOfLevel
|
|||
TOL_CTF = 0x40, ///< Capture the Flag
|
||||
// CTF default = 64
|
||||
|
||||
TOL_CUSTOM = 0x80, ///< Custom (Lua-scripted, etc.)
|
||||
// 0x80 was here
|
||||
|
||||
TOL_2D = 0x0100, ///< 2D
|
||||
TOL_MARIO = 0x0200, ///< Mario
|
||||
TOL_NIGHTS = 0x0400, ///< NiGHTS
|
||||
TOL_ERZ3 = 0x0800, ///< ERZ3
|
||||
TOL_XMAS = 0x1000 ///< Christmas NiGHTS
|
||||
TOL_XMAS = 0x1000, ///< Christmas NiGHTS
|
||||
};
|
||||
|
||||
// Gametypes
|
||||
enum GameType
|
||||
#define NUMBASETOL 18
|
||||
#define NUMMAXTOL (18 + NUMGAMETYPEFREESLOTS)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GT_COOP = 0, // also used in single player
|
||||
GT_COMPETITION, // Classic "Race"
|
||||
GT_RACE,
|
||||
|
||||
GT_MATCH,
|
||||
GT_TEAMMATCH,
|
||||
|
||||
GT_TAG,
|
||||
GT_HIDEANDSEEK,
|
||||
|
||||
GT_CTF, // capture the flag
|
||||
|
||||
NUMGAMETYPES
|
||||
};
|
||||
// If you alter this list, update dehacked.c, MISC_ChangeGameTypeMenu in m_menu.c, and Gametype_Names in g_game.c
|
||||
|
||||
// String names for gametypes
|
||||
extern const char *Gametype_Names[NUMGAMETYPES];
|
||||
const char *name;
|
||||
UINT32 flag;
|
||||
} tolinfo_t;
|
||||
extern tolinfo_t TYPEOFLEVEL[NUMMAXTOL];
|
||||
extern INT32 numtolinfo;
|
||||
extern UINT32 lastcustomtol;
|
||||
|
||||
extern tic_t totalplaytime;
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ boolean allow_fullscreen = false;
|
|||
consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
void I_StartupGraphics(void){}
|
||||
void I_StartupHardwareGraphics(void){}
|
||||
|
||||
void I_ShutdownGraphics(void){}
|
||||
|
||||
|
@ -39,6 +40,11 @@ INT32 VID_SetMode(INT32 modenum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
// ..............
|
||||
}
|
||||
|
||||
const char *VID_GetModeName(INT32 modenum)
|
||||
{
|
||||
(void)modenum;
|
||||
|
|
427
src/f_finale.c
427
src/f_finale.c
|
@ -530,78 +530,78 @@ static void F_IntroDrawScene(void)
|
|||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
background = W_CachePatchName("INTRO1", PU_CACHE);
|
||||
background = W_CachePatchName("INTRO1", PU_PATCH);
|
||||
break;
|
||||
case 2:
|
||||
background = W_CachePatchName("INTRO2", PU_CACHE);
|
||||
background = W_CachePatchName("INTRO2", PU_PATCH);
|
||||
break;
|
||||
case 3:
|
||||
background = W_CachePatchName("INTRO3", PU_CACHE);
|
||||
background = W_CachePatchName("INTRO3", PU_PATCH);
|
||||
break;
|
||||
case 4:
|
||||
background = W_CachePatchName("INTRO4", PU_CACHE);
|
||||
background = W_CachePatchName("INTRO4", PU_PATCH);
|
||||
break;
|
||||
case 5:
|
||||
if (intro_curtime >= 5*TICRATE)
|
||||
background = W_CachePatchName("RADAR", PU_CACHE);
|
||||
background = W_CachePatchName("RADAR", PU_PATCH);
|
||||
else
|
||||
background = W_CachePatchName("DRAT", PU_CACHE);
|
||||
background = W_CachePatchName("DRAT", PU_PATCH);
|
||||
break;
|
||||
case 6:
|
||||
background = W_CachePatchName("INTRO6", PU_CACHE);
|
||||
background = W_CachePatchName("INTRO6", PU_PATCH);
|
||||
cx = 180;
|
||||
cy = 8;
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
if (intro_curtime >= 7*TICRATE + ((TICRATE/7)*2))
|
||||
background = W_CachePatchName("SGRASS5", PU_CACHE);
|
||||
background = W_CachePatchName("SGRASS5", PU_PATCH);
|
||||
else if (intro_curtime >= 7*TICRATE + (TICRATE/7))
|
||||
background = W_CachePatchName("SGRASS4", PU_CACHE);
|
||||
background = W_CachePatchName("SGRASS4", PU_PATCH);
|
||||
else if (intro_curtime >= 7*TICRATE)
|
||||
background = W_CachePatchName("SGRASS3", PU_CACHE);
|
||||
background = W_CachePatchName("SGRASS3", PU_PATCH);
|
||||
else if (intro_curtime >= 6*TICRATE)
|
||||
background = W_CachePatchName("SGRASS2", PU_CACHE);
|
||||
background = W_CachePatchName("SGRASS2", PU_PATCH);
|
||||
else
|
||||
background = W_CachePatchName("SGRASS1", PU_CACHE);
|
||||
background = W_CachePatchName("SGRASS1", PU_PATCH);
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
background = W_CachePatchName("WATCHING", PU_CACHE);
|
||||
background = W_CachePatchName("WATCHING", PU_PATCH);
|
||||
break;
|
||||
case 9:
|
||||
background = W_CachePatchName("ZOOMING", PU_CACHE);
|
||||
background = W_CachePatchName("ZOOMING", PU_PATCH);
|
||||
break;
|
||||
case 10:
|
||||
break;
|
||||
case 11:
|
||||
background = W_CachePatchName("INTRO5", PU_CACHE);
|
||||
background = W_CachePatchName("INTRO5", PU_PATCH);
|
||||
break;
|
||||
case 12:
|
||||
background = W_CachePatchName("REVENGE", PU_CACHE);
|
||||
background = W_CachePatchName("REVENGE", PU_PATCH);
|
||||
cx = 208;
|
||||
cy = 8;
|
||||
break;
|
||||
case 13:
|
||||
background = W_CachePatchName("CONFRONT", PU_CACHE);
|
||||
background = W_CachePatchName("CONFRONT", PU_PATCH);
|
||||
cy += 48;
|
||||
break;
|
||||
case 14:
|
||||
background = W_CachePatchName("TAILSSAD", PU_CACHE);
|
||||
background = W_CachePatchName("TAILSSAD", PU_PATCH);
|
||||
bgxoffs = 144;
|
||||
cx = 8;
|
||||
cy = 8;
|
||||
break;
|
||||
case 15:
|
||||
if (intro_curtime >= 7*TICRATE)
|
||||
background = W_CachePatchName("SONICDO2", PU_CACHE);
|
||||
background = W_CachePatchName("SONICDO2", PU_PATCH);
|
||||
else
|
||||
background = W_CachePatchName("SONICDO1", PU_CACHE);
|
||||
background = W_CachePatchName("SONICDO1", PU_PATCH);
|
||||
cx = 224;
|
||||
cy = 8;
|
||||
break;
|
||||
case 16:
|
||||
background = W_CachePatchName("INTRO7", PU_CACHE);
|
||||
background = W_CachePatchName("INTRO7", PU_PATCH);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -631,30 +631,30 @@ static void F_IntroDrawScene(void)
|
|||
S_ChangeMusicInternal("_stjr", false);
|
||||
x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(334<<FRACBITS, aspect)/2;
|
||||
y = (BASEVIDHEIGHT<<FRACBITS)/2 - FixedMul(358<<FRACBITS, aspect)/2;
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH1", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH1", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
if (finalecount > 6) {
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH2", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH2", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
if (finalecount > 10) {
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH3", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH3", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
if (finalecount > 14) {
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH4", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH4", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
}
|
||||
else if (finalecount-30 < 20) { // Big eggy
|
||||
background = W_CachePatchName("FEEDIN", PU_CACHE);
|
||||
background = W_CachePatchName("FEEDIN", PU_PATCH);
|
||||
x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(560<<FRACBITS, aspect)/2;
|
||||
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(477<<FRACBITS, aspect);
|
||||
V_DrawSciencePatch(x, y, V_SNAPTOBOTTOM, background, aspect);
|
||||
}
|
||||
else if (finalecount-50 < 30) { // Zoom out
|
||||
fixed_t scale = FixedDiv(aspect, FixedDiv((finalecount-50)<<FRACBITS, (15<<FRACBITS))+FRACUNIT);
|
||||
background = W_CachePatchName("FEEDIN", PU_CACHE);
|
||||
background = W_CachePatchName("FEEDIN", PU_PATCH);
|
||||
x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(560<<FRACBITS, aspect)/2 + (FixedMul(560<<FRACBITS, aspect) - FixedMul(560<<FRACBITS, scale));
|
||||
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(477<<FRACBITS, scale);
|
||||
V_DrawSciencePatch(x, y, V_SNAPTOBOTTOM, background, scale);
|
||||
|
@ -664,7 +664,7 @@ static void F_IntroDrawScene(void)
|
|||
{
|
||||
// Draw tiny eggy
|
||||
fixed_t scale = FixedMul(FRACUNIT/3, aspect);
|
||||
background = W_CachePatchName("FEEDIN", PU_CACHE);
|
||||
background = W_CachePatchName("FEEDIN", PU_PATCH);
|
||||
x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(560<<FRACBITS, aspect)/2 + (FixedMul(560<<FRACBITS, aspect) - FixedMul(560<<FRACBITS, scale));
|
||||
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(477<<FRACBITS, scale);
|
||||
V_DrawSciencePatch(x, y, V_SNAPTOBOTTOM, background, scale);
|
||||
|
@ -675,34 +675,34 @@ static void F_IntroDrawScene(void)
|
|||
x = (-189*FRACUNIT) + (FixedMul((6<<FRACBITS)+FRACUNIT/3, ftime<<FRACBITS) - FixedMul((6<<FRACBITS)+FRACUNIT/3, FixedDiv(FixedMul(ftime<<FRACBITS, ftime<<FRACBITS), 120<<FRACBITS)));
|
||||
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(417<<FRACBITS, aspect);
|
||||
// Draw the body
|
||||
V_DrawSciencePatch(x, y, V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT1", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(x, y, V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT1", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Draw the door
|
||||
V_DrawSciencePatch(x+FixedMul(344<<FRACBITS, aspect), y+FixedMul(292<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT2", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(x+FixedMul(344<<FRACBITS, aspect), y+FixedMul(292<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT2", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Draw the wheel
|
||||
V_DrawSciencePatch(x+FixedMul(178<<FRACBITS, aspect), y+FixedMul(344<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName(va("TYRE%02u",(abs(finalecount-144)/3)%16), PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(x+FixedMul(178<<FRACBITS, aspect), y+FixedMul(344<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName(va("TYRE%02u",(abs(finalecount-144)/3)%16), PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Draw the wheel cover
|
||||
V_DrawSciencePatch(x+FixedMul(88<<FRACBITS, aspect), y+FixedMul(238<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT3", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(x+FixedMul(88<<FRACBITS, aspect), y+FixedMul(238<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT3", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
} else { // Pure Fat has stopped!
|
||||
y = (BASEVIDHEIGHT<<FRACBITS) - FixedMul(417<<FRACBITS, aspect);
|
||||
// Draw the body
|
||||
V_DrawSciencePatch(0, y, V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT1", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(0, y, V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT1", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Draw the wheel
|
||||
V_DrawSciencePatch(FixedMul(178<<FRACBITS, aspect), y+FixedMul(344<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("TYRE00", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(FixedMul(178<<FRACBITS, aspect), y+FixedMul(344<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("TYRE00", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Draw the wheel cover
|
||||
V_DrawSciencePatch(FixedMul(88<<FRACBITS, aspect), y+FixedMul(238<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT3", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(FixedMul(88<<FRACBITS, aspect), y+FixedMul(238<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT3", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Draw the door
|
||||
if (finalecount-TICRATE/2 > 4*TICRATE) { // Door is being raised!
|
||||
int ftime = (finalecount-TICRATE/2-4*TICRATE);
|
||||
y -= FixedDiv((ftime*ftime)<<FRACBITS, 23<<FRACBITS);
|
||||
}
|
||||
V_DrawSciencePatch(FixedMul(344<<FRACBITS, aspect), y+FixedMul(292<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT2", PU_CACHE)), aspect);
|
||||
V_DrawSciencePatch(FixedMul(344<<FRACBITS, aspect), y+FixedMul(292<<FRACBITS, aspect), V_SNAPTOLEFT|V_SNAPTOBOTTOM, (patch = W_CachePatchName("PUREFAT2", PU_PATCH)), aspect);
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
}
|
||||
|
@ -716,27 +716,27 @@ static void F_IntroDrawScene(void)
|
|||
if (timetonext > 5*TICRATE && timetonext < 6*TICRATE)
|
||||
{
|
||||
if (!(finalecount & 3))
|
||||
background = W_CachePatchName("BRITEGG1", PU_CACHE);
|
||||
background = W_CachePatchName("BRITEGG1", PU_PATCH);
|
||||
else
|
||||
background = W_CachePatchName("DARKEGG1", PU_CACHE);
|
||||
background = W_CachePatchName("DARKEGG1", PU_PATCH);
|
||||
|
||||
V_DrawSmallScaledPatch(0, 0, 0, background);
|
||||
}
|
||||
else if (timetonext > 3*TICRATE && timetonext < 4*TICRATE)
|
||||
{
|
||||
if (!(finalecount & 3))
|
||||
background = W_CachePatchName("BRITEGG2", PU_CACHE);
|
||||
background = W_CachePatchName("BRITEGG2", PU_PATCH);
|
||||
else
|
||||
background = W_CachePatchName("DARKEGG2", PU_CACHE);
|
||||
background = W_CachePatchName("DARKEGG2", PU_PATCH);
|
||||
|
||||
V_DrawSmallScaledPatch(0, 0, 0, background);
|
||||
}
|
||||
else if (timetonext > 1*TICRATE && timetonext < 2*TICRATE)
|
||||
{
|
||||
if (!(finalecount & 3))
|
||||
background = W_CachePatchName("BRITEGG3", PU_CACHE);
|
||||
background = W_CachePatchName("BRITEGG3", PU_PATCH);
|
||||
else
|
||||
background = W_CachePatchName("DARKEGG3", PU_CACHE);
|
||||
background = W_CachePatchName("DARKEGG3", PU_PATCH);
|
||||
|
||||
V_DrawSmallScaledPatch(0, 0, 0, background);
|
||||
}
|
||||
|
@ -768,79 +768,79 @@ static void F_IntroDrawScene(void)
|
|||
knucklesx += sonicx;
|
||||
sonicx += P_ReturnThrustX(NULL, finalecount * ANG10, 3);
|
||||
|
||||
V_DrawSmallScaledPatch(skyx, 0, 0, (patch = W_CachePatchName("INTROSKY", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(skyx, 0, 0, (patch = W_CachePatchName("INTROSKY", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(skyx - 320, 0, 0, patch);
|
||||
W_UnlockCachedPatch(patch);
|
||||
V_DrawSmallScaledPatch(grassx, 0, 0, (patch = W_CachePatchName("INTROGRS", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(grassx, 0, 0, (patch = W_CachePatchName("INTROGRS", PU_PATCH)));
|
||||
V_DrawSmallScaledPatch(grassx - 320, 0, 0, patch);
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
if (finalecount & 1)
|
||||
{
|
||||
// Sonic
|
||||
V_DrawSmallScaledPatch(sonicx, 54, 0, (patch = W_CachePatchName("RUN2", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(sonicx, 54, 0, (patch = W_CachePatchName("RUN2", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
// Appendages
|
||||
if (finalecount & 2)
|
||||
{
|
||||
// Sonic's feet
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT4", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT4", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Tails' tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP2", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP2", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sonic's feet
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT2", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT2", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Tails' tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP1", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP1", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
|
||||
// Tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("FLY2", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("FLY2", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
// Knuckles
|
||||
V_DrawSmallScaledPatch(knucklesx, knucklesy, 0, (patch = W_CachePatchName("GLIDE2", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(knucklesx, knucklesy, 0, (patch = W_CachePatchName("GLIDE2", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sonic
|
||||
V_DrawSmallScaledPatch(sonicx, 54, 0, (patch = W_CachePatchName("RUN1", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(sonicx, 54, 0, (patch = W_CachePatchName("RUN1", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
// Appendages
|
||||
if (finalecount & 2)
|
||||
{
|
||||
// Sonic's feet
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT3", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT3", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Tails' tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP2", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP2", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sonic's feet
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT1", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(sonicx - 8, 92, 0, (patch = W_CachePatchName("PEELOUT1", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
// Tails' tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP1", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("HELICOP1", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
|
||||
// Tails
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("FLY1", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(tailsx, tailsy, 0, (patch = W_CachePatchName("FLY1", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
|
||||
// Knuckles
|
||||
V_DrawSmallScaledPatch(knucklesx, knucklesy, 0, (patch = W_CachePatchName("GLIDE1", PU_CACHE)));
|
||||
V_DrawSmallScaledPatch(knucklesx, knucklesy, 0, (patch = W_CachePatchName("GLIDE1", PU_PATCH)));
|
||||
W_UnlockCachedPatch(patch);
|
||||
}
|
||||
|
||||
|
@ -873,8 +873,8 @@ static void F_IntroDrawScene(void)
|
|||
y += (30*(FRACUNIT-scale));
|
||||
}
|
||||
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (worktics % 35)), PU_LEVEL);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(worktics & 1)), PU_LEVEL);
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (worktics % 35)), PU_PATCH);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(worktics & 1)), PU_PATCH);
|
||||
|
||||
if (worktics >= 5)
|
||||
trans = (worktics-5)>>1;
|
||||
|
@ -988,7 +988,7 @@ void F_IntroDrawer(void)
|
|||
{
|
||||
if (intro_scenenum == 5 && intro_curtime == 5*TICRATE)
|
||||
{
|
||||
patch_t *radar = W_CachePatchName("RADAR", PU_CACHE);
|
||||
patch_t *radar = W_CachePatchName("RADAR", PU_PATCH);
|
||||
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
|
@ -1001,7 +1001,7 @@ void F_IntroDrawer(void)
|
|||
}
|
||||
else if (intro_scenenum == 7 && intro_curtime == 6*TICRATE) // Force a wipe here
|
||||
{
|
||||
patch_t *grass = W_CachePatchName("SGRASS2", PU_CACHE);
|
||||
patch_t *grass = W_CachePatchName("SGRASS2", PU_PATCH);
|
||||
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
|
@ -1014,7 +1014,7 @@ void F_IntroDrawer(void)
|
|||
}
|
||||
/*else if (intro_scenenum == 12 && intro_curtime == 7*TICRATE)
|
||||
{
|
||||
patch_t *confront = W_CachePatchName("CONFRONT", PU_CACHE);
|
||||
patch_t *confront = W_CachePatchName("CONFRONT", PU_PATCH);
|
||||
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
|
@ -1027,7 +1027,7 @@ void F_IntroDrawer(void)
|
|||
}*/
|
||||
if (intro_scenenum == 15 && intro_curtime == 7*TICRATE)
|
||||
{
|
||||
patch_t *sdo = W_CachePatchName("SONICDO2", PU_CACHE);
|
||||
patch_t *sdo = W_CachePatchName("SONICDO2", PU_PATCH);
|
||||
|
||||
F_WipeStartScreen();
|
||||
F_WipeColorFill(31);
|
||||
|
@ -1359,14 +1359,14 @@ void F_CreditDrawer(void)
|
|||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||
|
||||
// Zig Zagz
|
||||
V_DrawScaledPatch(-16, zagpos, V_SNAPTOLEFT, W_CachePatchName("LTZIGZAG", PU_CACHE));
|
||||
V_DrawScaledPatch(-16, zagpos - 320, V_SNAPTOLEFT, W_CachePatchName("LTZIGZAG", PU_CACHE));
|
||||
V_DrawScaledPatch(BASEVIDWIDTH + 16, zagpos, V_SNAPTORIGHT|V_FLIP, W_CachePatchName("LTZIGZAG", PU_CACHE));
|
||||
V_DrawScaledPatch(BASEVIDWIDTH + 16, zagpos - 320, V_SNAPTORIGHT|V_FLIP, W_CachePatchName("LTZIGZAG", PU_CACHE));
|
||||
V_DrawScaledPatch(-16, zagpos, V_SNAPTOLEFT, W_CachePatchName("LTZIGZAG", PU_PATCH));
|
||||
V_DrawScaledPatch(-16, zagpos - 320, V_SNAPTOLEFT, W_CachePatchName("LTZIGZAG", PU_PATCH));
|
||||
V_DrawScaledPatch(BASEVIDWIDTH + 16, zagpos, V_SNAPTORIGHT|V_FLIP, W_CachePatchName("LTZIGZAG", PU_PATCH));
|
||||
V_DrawScaledPatch(BASEVIDWIDTH + 16, zagpos - 320, V_SNAPTORIGHT|V_FLIP, W_CachePatchName("LTZIGZAG", PU_PATCH));
|
||||
|
||||
// Draw background pictures first
|
||||
for (i = 0; credits_pics[i].patch; i++)
|
||||
V_DrawSciencePatch(credits_pics[i].x<<FRACBITS, (280<<FRACBITS) + (((i*credits_height)<<FRACBITS)/(credits_numpics)) - 4*(animtimer<<FRACBITS)/5, 0, W_CachePatchName(credits_pics[i].patch, PU_CACHE), FRACUNIT>>1);
|
||||
V_DrawSciencePatch(credits_pics[i].x<<FRACBITS, (280<<FRACBITS) + (((i*credits_height)<<FRACBITS)/(credits_numpics)) - 4*(animtimer<<FRACBITS)/5, 0, W_CachePatchName(credits_pics[i].patch, PU_PATCH), FRACUNIT>>1);
|
||||
|
||||
// Dim the background
|
||||
V_DrawFadeScreen(0xFF00, 16);
|
||||
|
@ -1574,14 +1574,14 @@ void F_GameEvaluationDrawer(void)
|
|||
|
||||
if (goodending)
|
||||
{
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (finalecount % 35)), PU_LEVEL);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(finalecount & 1)), PU_LEVEL);
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - (finalecount % 35)), PU_PATCH);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", 2+(finalecount & 1)), PU_PATCH);
|
||||
x -= FRACUNIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
rockpat = W_CachePatchName("ROID0000", PU_LEVEL);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", (finalecount & 1)), PU_LEVEL);
|
||||
glow = W_CachePatchName(va("ENDGLOW%.1d", (finalecount & 1)), PU_PATCH);
|
||||
}
|
||||
|
||||
if (finalecount >= 5)
|
||||
|
@ -1613,20 +1613,20 @@ void F_GameEvaluationDrawer(void)
|
|||
// if j == 0 - alternate between 0 and 1
|
||||
// 1 - 1 and 2
|
||||
// 2 - 2 and not rendered
|
||||
V_DrawFixedPatch(x+sparkloffs[j-1][0], y+sparkloffs[j-1][1], FRACUNIT, 0, W_CachePatchName(va("ENDSPKL%.1d", (j - ((sparklloop & 1) ? 0 : 1))), PU_LEVEL), R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_AQUA, GTC_CACHE));
|
||||
V_DrawFixedPatch(x+sparkloffs[j-1][0], y+sparkloffs[j-1][1], FRACUNIT, 0, W_CachePatchName(va("ENDSPKL%.1d", (j - ((sparklloop & 1) ? 0 : 1))), PU_PATCH), R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_AQUA, GTC_CACHE));
|
||||
}
|
||||
j--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
patch_t *eggrock = W_CachePatchName("ENDEGRK5", PU_LEVEL);
|
||||
patch_t *eggrock = W_CachePatchName("ENDEGRK5", PU_PATCH);
|
||||
V_DrawFixedPatch(x, y, scale, 0, eggrock, colormap[0]);
|
||||
if (trans < 10)
|
||||
V_DrawFixedPatch(x, y, scale, trans<<V_ALPHASHIFT, eggrock, colormap[1]);
|
||||
else if (sparklloop)
|
||||
V_DrawFixedPatch(x, y, scale, (10-sparklloop)<<V_ALPHASHIFT,
|
||||
W_CachePatchName("ENDEGRK0", PU_LEVEL), colormap[1]);
|
||||
W_CachePatchName("ENDEGRK0", PU_PATCH), colormap[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1640,7 +1640,7 @@ void F_GameEvaluationDrawer(void)
|
|||
eemeralds_cur += (360<<FRACBITS)/7;
|
||||
|
||||
patchname[4] = 'A'+(char)i;
|
||||
V_DrawFixedPatch(x, y, FRACUNIT, ((emeralds & (1<<i)) ? 0 : V_80TRANS), W_CachePatchName(patchname, PU_LEVEL), NULL);
|
||||
V_DrawFixedPatch(x, y, FRACUNIT, ((emeralds & (1<<i)) ? 0 : V_80TRANS), W_CachePatchName(patchname, PU_PATCH), NULL);
|
||||
}
|
||||
|
||||
V_DrawCreditString((BASEVIDWIDTH - V_CreditStringWidth(endingtext))<<(FRACBITS-1), (BASEVIDHEIGHT-100)<<(FRACBITS-1), 0, endingtext);
|
||||
|
@ -1753,6 +1753,83 @@ void F_GameEvaluationTicker(void)
|
|||
#define STOPPINGPOINT (14*TICRATE)
|
||||
#define SPARKLLOOPTIME 15 // must be odd
|
||||
|
||||
static void F_CacheEnding(void)
|
||||
{
|
||||
endbrdr[1] = W_CachePatchName("ENDBRDR1", PU_PATCH);
|
||||
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK0", PU_PATCH);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK1", PU_PATCH);
|
||||
|
||||
endglow[0] = W_CachePatchName("ENDGLOW0", PU_PATCH);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW1", PU_PATCH);
|
||||
|
||||
endbgsp[0] = W_CachePatchName("ENDBGSP0", PU_PATCH);
|
||||
endbgsp[1] = W_CachePatchName("ENDBGSP1", PU_PATCH);
|
||||
endbgsp[2] = W_CachePatchName("ENDBGSP2", PU_PATCH);
|
||||
|
||||
endspkl[0] = W_CachePatchName("ENDSPKL0", PU_PATCH);
|
||||
endspkl[1] = W_CachePatchName("ENDSPKL1", PU_PATCH);
|
||||
endspkl[2] = W_CachePatchName("ENDSPKL2", PU_PATCH);
|
||||
|
||||
endxpld[0] = W_CachePatchName("ENDXPLD0", PU_PATCH);
|
||||
endxpld[1] = W_CachePatchName("ENDXPLD1", PU_PATCH);
|
||||
endxpld[2] = W_CachePatchName("ENDXPLD2", PU_PATCH);
|
||||
endxpld[3] = W_CachePatchName("ENDXPLD3", PU_PATCH);
|
||||
|
||||
endescp[0] = W_CachePatchName("ENDESCP0", PU_PATCH);
|
||||
endescp[1] = W_CachePatchName("ENDESCP1", PU_PATCH);
|
||||
endescp[2] = W_CachePatchName("ENDESCP2", PU_PATCH);
|
||||
endescp[3] = W_CachePatchName("ENDESCP3", PU_PATCH);
|
||||
endescp[4] = W_CachePatchName("ENDESCP4", PU_PATCH);
|
||||
|
||||
// so we only need to check once
|
||||
if ((goodending = ALL7EMERALDS(emeralds)))
|
||||
{
|
||||
UINT8 skinnum = players[consoleplayer].skin;
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
if (skins[skinnum].sprites[SPR2_XTRA].numframes > (XTRA_ENDING+2))
|
||||
{
|
||||
sprdef = &skins[skinnum].sprites[SPR2_XTRA];
|
||||
// character head, skin specific
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING];
|
||||
endfwrk[0] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING+1];
|
||||
endfwrk[1] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING+2];
|
||||
endfwrk[2] = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
}
|
||||
else // Show a star if your character doesn't have an ending firework display. (Basically the MISSINGs for this)
|
||||
{
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK3", PU_PATCH);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK4", PU_PATCH);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK5", PU_PATCH);
|
||||
}
|
||||
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR2", PU_PATCH);
|
||||
}
|
||||
else
|
||||
{
|
||||
// eggman, skin nonspecific
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK0", PU_PATCH);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK1", PU_PATCH);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK2", PU_PATCH);
|
||||
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR0", PU_LEVEL);
|
||||
}
|
||||
}
|
||||
|
||||
static void F_CacheGoodEnding(void)
|
||||
{
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK2", PU_PATCH);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK3", PU_PATCH);
|
||||
|
||||
endglow[0] = W_CachePatchName("ENDGLOW2", PU_PATCH);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW3", PU_PATCH);
|
||||
|
||||
endxpld[0] = W_CachePatchName("ENDEGRK4", PU_PATCH);
|
||||
}
|
||||
|
||||
void F_StartEnding(void)
|
||||
{
|
||||
G_SetGamestate(GS_ENDING);
|
||||
|
@ -1768,7 +1845,7 @@ void F_StartEnding(void)
|
|||
gameaction = ga_nothing;
|
||||
paused = false;
|
||||
CON_ToggleOff();
|
||||
S_StopMusic();
|
||||
S_StopMusic(); // todo: placeholder
|
||||
S_StopSounds();
|
||||
|
||||
finalecount = -10; // what? this totally isn't a hack. why are you asking?
|
||||
|
@ -1776,68 +1853,7 @@ void F_StartEnding(void)
|
|||
memset(sparkloffs, 0, sizeof(INT32)*3*2);
|
||||
sparklloop = 0;
|
||||
|
||||
endbrdr[1] = W_CachePatchName("ENDBRDR1", PU_LEVEL);
|
||||
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK0", PU_LEVEL);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK1", PU_LEVEL);
|
||||
|
||||
endglow[0] = W_CachePatchName("ENDGLOW0", PU_LEVEL);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW1", PU_LEVEL);
|
||||
|
||||
endbgsp[0] = W_CachePatchName("ENDBGSP0", PU_LEVEL);
|
||||
endbgsp[1] = W_CachePatchName("ENDBGSP1", PU_LEVEL);
|
||||
endbgsp[2] = W_CachePatchName("ENDBGSP2", PU_LEVEL);
|
||||
|
||||
endspkl[0] = W_CachePatchName("ENDSPKL0", PU_LEVEL);
|
||||
endspkl[1] = W_CachePatchName("ENDSPKL1", PU_LEVEL);
|
||||
endspkl[2] = W_CachePatchName("ENDSPKL2", PU_LEVEL);
|
||||
|
||||
endxpld[0] = W_CachePatchName("ENDXPLD0", PU_LEVEL);
|
||||
endxpld[1] = W_CachePatchName("ENDXPLD1", PU_LEVEL);
|
||||
endxpld[2] = W_CachePatchName("ENDXPLD2", PU_LEVEL);
|
||||
endxpld[3] = W_CachePatchName("ENDXPLD3", PU_LEVEL);
|
||||
|
||||
endescp[0] = W_CachePatchName("ENDESCP0", PU_LEVEL);
|
||||
endescp[1] = W_CachePatchName("ENDESCP1", PU_LEVEL);
|
||||
endescp[2] = W_CachePatchName("ENDESCP2", PU_LEVEL);
|
||||
endescp[3] = W_CachePatchName("ENDESCP3", PU_LEVEL);
|
||||
endescp[4] = W_CachePatchName("ENDESCP4", PU_LEVEL);
|
||||
|
||||
// so we only need to check once
|
||||
if ((goodending = ALL7EMERALDS(emeralds)))
|
||||
{
|
||||
UINT8 skinnum = players[consoleplayer].skin;
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
if (skins[skinnum].sprites[SPR2_XTRA].numframes > (XTRA_ENDING+2))
|
||||
{
|
||||
sprdef = &skins[skinnum].sprites[SPR2_XTRA];
|
||||
// character head, skin specific
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING];
|
||||
endfwrk[0] = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL);
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING+1];
|
||||
endfwrk[1] = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL);
|
||||
sprframe = &sprdef->spriteframes[XTRA_ENDING+2];
|
||||
endfwrk[2] = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL);
|
||||
}
|
||||
else // Show a star if your character doesn't have an ending firework display. (Basically the MISSINGs for this)
|
||||
{
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK3", PU_LEVEL);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK4", PU_LEVEL);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK5", PU_LEVEL);
|
||||
}
|
||||
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR2", PU_LEVEL);
|
||||
}
|
||||
else
|
||||
{
|
||||
// eggman, skin nonspecific
|
||||
endfwrk[0] = W_CachePatchName("ENDFWRK0", PU_LEVEL);
|
||||
endfwrk[1] = W_CachePatchName("ENDFWRK1", PU_LEVEL);
|
||||
endfwrk[2] = W_CachePatchName("ENDFWRK2", PU_LEVEL);
|
||||
|
||||
endbrdr[0] = W_CachePatchName("ENDBRDR0", PU_LEVEL);
|
||||
}
|
||||
F_CacheEnding();
|
||||
}
|
||||
|
||||
void F_EndingTicker(void)
|
||||
|
@ -1853,15 +1869,7 @@ void F_EndingTicker(void)
|
|||
S_ChangeMusicInternal((goodending ? "_endg" : "_endb"), false);
|
||||
|
||||
if (goodending && finalecount == INFLECTIONPOINT) // time to swap some assets
|
||||
{
|
||||
endegrk[0] = W_CachePatchName("ENDEGRK2", PU_LEVEL);
|
||||
endegrk[1] = W_CachePatchName("ENDEGRK3", PU_LEVEL);
|
||||
|
||||
endglow[0] = W_CachePatchName("ENDGLOW2", PU_LEVEL);
|
||||
endglow[1] = W_CachePatchName("ENDGLOW3", PU_LEVEL);
|
||||
|
||||
endxpld[0] = W_CachePatchName("ENDEGRK4", PU_LEVEL);
|
||||
}
|
||||
F_CacheGoodEnding();
|
||||
|
||||
if (++sparklloop == SPARKLLOOPTIME) // time to roll the randomisation again
|
||||
{
|
||||
|
@ -1880,10 +1888,17 @@ void F_EndingDrawer(void)
|
|||
INT32 x, y, i, j, parallaxticker;
|
||||
patch_t *rockpat;
|
||||
|
||||
if (needpatchrecache)
|
||||
{
|
||||
F_CacheEnding();
|
||||
if (goodending && finalecount >= INFLECTIONPOINT) // time to swap some assets
|
||||
F_CacheGoodEnding();
|
||||
}
|
||||
|
||||
if (!goodending || finalecount < INFLECTIONPOINT)
|
||||
rockpat = W_CachePatchName("ROID0000", PU_LEVEL);
|
||||
rockpat = W_CachePatchName("ROID0000", PU_PATCH);
|
||||
else
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - ((finalecount - INFLECTIONPOINT) % 35)), PU_LEVEL);
|
||||
rockpat = W_CachePatchName(va("ROID00%.2d", 34 - ((finalecount - INFLECTIONPOINT) % 35)), PU_PATCH);
|
||||
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||
|
||||
|
@ -2367,11 +2382,11 @@ void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname)
|
|||
|
||||
if (!scrollxspeed && !scrollyspeed)
|
||||
{
|
||||
V_DrawPatchFill(W_CachePatchName(patchname, PU_CACHE));
|
||||
V_DrawPatchFill(W_CachePatchName(patchname, PU_PATCH));
|
||||
return;
|
||||
}
|
||||
|
||||
pat = W_CachePatchName(patchname, PU_CACHE);
|
||||
pat = W_CachePatchName(patchname, PU_PATCH);
|
||||
|
||||
patwidth = SHORT(pat->width);
|
||||
patheight = SHORT(pat->height);
|
||||
|
@ -2432,6 +2447,45 @@ else if (strlen(name) <= 6) \
|
|||
else \
|
||||
arr[0] = 0;
|
||||
|
||||
static void F_CacheTitleScreen(void)
|
||||
{
|
||||
switch(curttmode)
|
||||
{
|
||||
case TTMODE_OLD:
|
||||
case TTMODE_NONE:
|
||||
ttbanner = W_CachePatchName("TTBANNER", PU_LEVEL);
|
||||
ttwing = W_CachePatchName("TTWING", PU_LEVEL);
|
||||
ttsonic = W_CachePatchName("TTSONIC", PU_LEVEL);
|
||||
ttswave1 = W_CachePatchName("TTSWAVE1", PU_LEVEL);
|
||||
ttswave2 = W_CachePatchName("TTSWAVE2", PU_LEVEL);
|
||||
ttswip1 = W_CachePatchName("TTSWIP1", PU_LEVEL);
|
||||
ttsprep1 = W_CachePatchName("TTSPREP1", PU_LEVEL);
|
||||
ttsprep2 = W_CachePatchName("TTSPREP2", PU_LEVEL);
|
||||
ttspop1 = W_CachePatchName("TTSPOP1", PU_LEVEL);
|
||||
ttspop2 = W_CachePatchName("TTSPOP2", PU_LEVEL);
|
||||
ttspop3 = W_CachePatchName("TTSPOP3", PU_LEVEL);
|
||||
ttspop4 = W_CachePatchName("TTSPOP4", PU_LEVEL);
|
||||
ttspop5 = W_CachePatchName("TTSPOP5", PU_LEVEL);
|
||||
ttspop6 = W_CachePatchName("TTSPOP6", PU_LEVEL);
|
||||
ttspop7 = W_CachePatchName("TTSPOP7", PU_LEVEL);
|
||||
break;
|
||||
|
||||
// don't load alacroix gfx yet; we do that upon first draw.
|
||||
case TTMODE_ALACROIX:
|
||||
break;
|
||||
|
||||
case TTMODE_USER:
|
||||
{
|
||||
UINT16 i;
|
||||
lumpnum_t lumpnum;
|
||||
char lumpname[9];
|
||||
|
||||
LOADTTGFX(ttuser, curttname, TTMAX_USER)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void F_StartTitleScreen(void)
|
||||
{
|
||||
if (menupres[MN_MAIN].musname[0])
|
||||
|
@ -2493,7 +2547,7 @@ void F_StartTitleScreen(void)
|
|||
camera.x = startpos->x << FRACBITS;
|
||||
camera.y = startpos->y << FRACBITS;
|
||||
camera.subsector = R_PointInSubsector(camera.x, camera.y);
|
||||
camera.z = camera.subsector->sector->floorheight + ((startpos->options >> ZSHIFT) << FRACBITS);
|
||||
camera.z = camera.subsector->sector->floorheight + (startpos->z << FRACBITS);
|
||||
camera.angle = (startpos->angle % 360)*ANG1;
|
||||
camera.aiming = 0;
|
||||
}
|
||||
|
@ -2528,41 +2582,7 @@ void F_StartTitleScreen(void)
|
|||
demoDelayLeft = demoDelayTime;
|
||||
demoIdleLeft = demoIdleTime;
|
||||
|
||||
switch(curttmode)
|
||||
{
|
||||
case TTMODE_OLD:
|
||||
case TTMODE_NONE:
|
||||
ttbanner = W_CachePatchName("TTBANNER", PU_LEVEL);
|
||||
ttwing = W_CachePatchName("TTWING", PU_LEVEL);
|
||||
ttsonic = W_CachePatchName("TTSONIC", PU_LEVEL);
|
||||
ttswave1 = W_CachePatchName("TTSWAVE1", PU_LEVEL);
|
||||
ttswave2 = W_CachePatchName("TTSWAVE2", PU_LEVEL);
|
||||
ttswip1 = W_CachePatchName("TTSWIP1", PU_LEVEL);
|
||||
ttsprep1 = W_CachePatchName("TTSPREP1", PU_LEVEL);
|
||||
ttsprep2 = W_CachePatchName("TTSPREP2", PU_LEVEL);
|
||||
ttspop1 = W_CachePatchName("TTSPOP1", PU_LEVEL);
|
||||
ttspop2 = W_CachePatchName("TTSPOP2", PU_LEVEL);
|
||||
ttspop3 = W_CachePatchName("TTSPOP3", PU_LEVEL);
|
||||
ttspop4 = W_CachePatchName("TTSPOP4", PU_LEVEL);
|
||||
ttspop5 = W_CachePatchName("TTSPOP5", PU_LEVEL);
|
||||
ttspop6 = W_CachePatchName("TTSPOP6", PU_LEVEL);
|
||||
ttspop7 = W_CachePatchName("TTSPOP7", PU_LEVEL);
|
||||
break;
|
||||
|
||||
// don't load alacroix gfx yet; we do that upon first draw.
|
||||
case TTMODE_ALACROIX:
|
||||
break;
|
||||
|
||||
case TTMODE_USER:
|
||||
{
|
||||
UINT16 i;
|
||||
lumpnum_t lumpnum;
|
||||
char lumpname[9];
|
||||
|
||||
LOADTTGFX(ttuser, curttname, TTMAX_USER)
|
||||
break;
|
||||
}
|
||||
}
|
||||
F_CacheTitleScreen();
|
||||
}
|
||||
|
||||
static void F_UnloadAlacroixGraphics(SINT8 oldttscale)
|
||||
|
@ -2711,6 +2731,9 @@ void F_TitleScreenDrawer(void)
|
|||
if (modeattacking)
|
||||
return; // We likely came here from retrying. Don't do a damn thing.
|
||||
|
||||
if (needpatchrecache && (curttmode != TTMODE_ALACROIX))
|
||||
F_CacheTitleScreen();
|
||||
|
||||
// Draw that sky!
|
||||
if (curbgcolor >= 0)
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor);
|
||||
|
@ -2734,6 +2757,12 @@ void F_TitleScreenDrawer(void)
|
|||
return;
|
||||
#endif
|
||||
|
||||
if (needpatchrecache && (curttmode == TTMODE_ALACROIX))
|
||||
{
|
||||
ttloaded[0] = ttloaded[1] = ttloaded[2] = ttloaded[3] = ttloaded[4] = ttloaded[5] = 0;
|
||||
F_LoadAlacroixGraphics(activettscale);
|
||||
}
|
||||
|
||||
switch(curttmode)
|
||||
{
|
||||
case TTMODE_OLD:
|
||||
|
@ -3681,7 +3710,7 @@ void F_ContinueDrawer(void)
|
|||
V_DrawLevelTitle(x - (V_LevelNameWidth("Continue?")>>1), 16, 0, "Continue?");
|
||||
|
||||
// Two stars...
|
||||
patch = W_CachePatchName("CONTSTAR", PU_CACHE);
|
||||
patch = W_CachePatchName("CONTSTAR", PU_PATCH);
|
||||
V_DrawScaledPatch(x-32, 160, 0, patch);
|
||||
V_DrawScaledPatch(x+32, 160, 0, patch);
|
||||
|
||||
|
@ -3689,14 +3718,14 @@ void F_ContinueDrawer(void)
|
|||
if (timeleft > 9)
|
||||
{
|
||||
numbuf[7] = '1';
|
||||
V_DrawScaledPatch(x - 10, 160, 0, W_CachePatchName(numbuf, PU_CACHE));
|
||||
V_DrawScaledPatch(x - 10, 160, 0, W_CachePatchName(numbuf, PU_PATCH));
|
||||
numbuf[7] = '0';
|
||||
V_DrawScaledPatch(x + 10, 160, 0, W_CachePatchName(numbuf, PU_CACHE));
|
||||
V_DrawScaledPatch(x + 10, 160, 0, W_CachePatchName(numbuf, PU_PATCH));
|
||||
}
|
||||
else
|
||||
{
|
||||
numbuf[7] = '0'+timeleft;
|
||||
V_DrawScaledPatch(x, 160, 0, W_CachePatchName(numbuf, PU_CACHE));
|
||||
V_DrawScaledPatch(x, 160, 0, W_CachePatchName(numbuf, PU_PATCH));
|
||||
}
|
||||
|
||||
// Draw the continue markers! Show continues.
|
||||
|
@ -3723,7 +3752,7 @@ void F_ContinueDrawer(void)
|
|||
}
|
||||
|
||||
// Spotlight
|
||||
V_DrawScaledPatch(x, 140, 0, W_CachePatchName("CONTSPOT", PU_CACHE));
|
||||
V_DrawScaledPatch(x, 140, 0, W_CachePatchName("CONTSPOT", PU_PATCH));
|
||||
|
||||
// warping laser
|
||||
if (continuetime)
|
||||
|
@ -3760,7 +3789,7 @@ void F_ContinueDrawer(void)
|
|||
#define drawchar(dx, dy, n) {\
|
||||
sprdef = &contskins[n]->sprites[cont_spr2[n][0]];\
|
||||
sprframe = &sprdef->spriteframes[cont_spr2[n][1]];\
|
||||
patch = W_CachePatchNum(sprframe->lumppat[cont_spr2[n][2]], PU_CACHE);\
|
||||
patch = W_CachePatchNum(sprframe->lumppat[cont_spr2[n][2]], PU_PATCH);\
|
||||
V_DrawFixedPatch((dx), (dy), FRACUNIT, (sprframe->flip & (1<<cont_spr2[n][2])) ? V_FLIP : 0, patch, contcolormaps[n]);\
|
||||
}
|
||||
|
||||
|
@ -4024,10 +4053,10 @@ void F_CutsceneDrawer(void)
|
|||
{
|
||||
if (cutscenes[cutnum]->scene[scenenum].pichires[picnum])
|
||||
V_DrawSmallScaledPatch(picxpos, picypos, 0,
|
||||
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_CACHE));
|
||||
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_PATCH));
|
||||
else
|
||||
V_DrawScaledPatch(picxpos,picypos, 0,
|
||||
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_CACHE));
|
||||
W_CachePatchName(cutscenes[cutnum]->scene[scenenum].picname[picnum], PU_PATCH));
|
||||
}
|
||||
|
||||
if (dofadenow && rendermode != render_none)
|
||||
|
@ -4513,10 +4542,10 @@ void F_TextPromptDrawer(void)
|
|||
{
|
||||
if (textprompts[cutnum]->page[scenenum].pichires[picnum])
|
||||
V_DrawSmallScaledPatch(picxpos, picypos, 0,
|
||||
W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_CACHE));
|
||||
W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_PATCH));
|
||||
else
|
||||
V_DrawScaledPatch(picxpos,picypos, 0,
|
||||
W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_CACHE));
|
||||
W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_PATCH));
|
||||
}
|
||||
|
||||
// Draw background
|
||||
|
@ -4526,7 +4555,7 @@ void F_TextPromptDrawer(void)
|
|||
if (iconlump != LUMPERROR)
|
||||
{
|
||||
INT32 iconx, icony, scale, scaledsize;
|
||||
patch = W_CachePatchName(textprompts[cutnum]->page[scenenum].iconname, PU_CACHE);
|
||||
patch = W_CachePatchName(textprompts[cutnum]->page[scenenum].iconname, PU_PATCH);
|
||||
|
||||
// scale and center
|
||||
if (patch->width > patch->height)
|
||||
|
|
324
src/g_game.c
324
src/g_game.c
|
@ -79,7 +79,7 @@ UINT16 mapmusflags; // Track and reset bit
|
|||
UINT32 mapmusposition; // Position to jump to
|
||||
|
||||
INT16 gamemap = 1;
|
||||
INT16 maptol;
|
||||
UINT32 maptol;
|
||||
UINT8 globalweather = 0;
|
||||
INT32 curWeather = PRECIP_NONE;
|
||||
INT32 cursaveslot = 0; // Auto-save 1p savegame slot
|
||||
|
@ -1190,7 +1190,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
// why build a ticcmd if we're paused?
|
||||
// Or, for that matter, if we're being reborn.
|
||||
// ...OR if we're blindfolded. No looking into the floor.
|
||||
if (paused || P_AutoPause() || (gamestate == GS_LEVEL && (player->playerstate == PST_REBORN || ((gametype == GT_TAG || gametype == GT_HIDEANDSEEK)
|
||||
if (paused || P_AutoPause() || (gamestate == GS_LEVEL && (player->playerstate == PST_REBORN || ((gametyperules & GTR_TAG)
|
||||
&& (leveltime < hidetime * TICRATE) && (player->pflags & PF_TAGIT)))))
|
||||
{//@TODO splitscreen player
|
||||
cmd->angleturn = (INT16)(*myangle >> 16);
|
||||
|
@ -1709,7 +1709,14 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
//Reset away view if a command is given.
|
||||
if (ssplayer == 1 && (cmd->forwardmove || cmd->sidemove || cmd->buttons)
|
||||
&& displayplayer != consoleplayer)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
// Call ViewpointSwitch hooks here.
|
||||
// The viewpoint was forcibly changed.
|
||||
LUAh_ViewpointSwitch(player, &players[displayplayer], true);
|
||||
#endif
|
||||
displayplayer = consoleplayer;
|
||||
}
|
||||
}
|
||||
|
||||
// User has designated that they want
|
||||
|
@ -1826,15 +1833,14 @@ void G_DoLoadLevel(boolean resetplayer)
|
|||
}
|
||||
|
||||
// Setup the level.
|
||||
if (!P_SetupLevel(false)) // this never returns false?
|
||||
if (!P_LoadLevel(false)) // this never returns false?
|
||||
{
|
||||
// fail so reset game stuff
|
||||
Command_ExitGame_f();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!resetplayer)
|
||||
P_FindEmerald();
|
||||
P_FindEmerald();
|
||||
|
||||
displayplayer = consoleplayer; // view the guy you are playing
|
||||
if (!splitscreen && !botingame)
|
||||
|
@ -1871,7 +1877,7 @@ void G_StartTitleCard(void)
|
|||
{
|
||||
// The title card has been disabled for this map.
|
||||
// Oh well.
|
||||
if (mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)
|
||||
if (!G_IsTitleCardAvailable())
|
||||
{
|
||||
WipeStageTitle = false;
|
||||
return;
|
||||
|
@ -1916,6 +1922,23 @@ void G_PreLevelTitleCard(void)
|
|||
wipestyleflags = WSF_CROSSFADE;
|
||||
}
|
||||
|
||||
//
|
||||
// Returns true if the current level has a title card.
|
||||
//
|
||||
boolean G_IsTitleCardAvailable(void)
|
||||
{
|
||||
// The current level header explicitly disabled the title card.
|
||||
if (mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)
|
||||
return false;
|
||||
|
||||
// The current gametype doesn't have a title card.
|
||||
if (gametyperules & GTR_NOTITLECARD)
|
||||
return false;
|
||||
|
||||
// The title card is available.
|
||||
return true;
|
||||
}
|
||||
|
||||
INT32 pausedelay = 0;
|
||||
boolean pausebreakkey = false;
|
||||
static INT32 camtoggledelay, camtoggledelay2 = 0;
|
||||
|
@ -2006,6 +2029,11 @@ boolean G_Responder(event_t *ev)
|
|||
if (gamestate == GS_LEVEL && ev->type == ev_keydown
|
||||
&& (ev->data1 == KEY_F12 || ev->data1 == gamecontrol[gc_viewpoint][0] || ev->data1 == gamecontrol[gc_viewpoint][1]))
|
||||
{
|
||||
// ViewpointSwitch Lua hook.
|
||||
#ifdef HAVE_BLUA
|
||||
UINT8 canSwitchView = 0;
|
||||
#endif
|
||||
|
||||
if (splitscreen || !netgame)
|
||||
displayplayer = consoleplayer;
|
||||
else
|
||||
|
@ -2020,6 +2048,15 @@ boolean G_Responder(event_t *ev)
|
|||
if (!playeringame[displayplayer])
|
||||
continue;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// Call ViewpointSwitch hooks here.
|
||||
canSwitchView = LUAh_ViewpointSwitch(&players[consoleplayer], &players[displayplayer], false);
|
||||
if (canSwitchView == 1) // Set viewpoint to this player
|
||||
break;
|
||||
else if (canSwitchView == 2) // Skip this player
|
||||
continue;
|
||||
#endif
|
||||
|
||||
if (players[displayplayer].spectator)
|
||||
continue;
|
||||
|
||||
|
@ -2628,7 +2665,7 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost)
|
|||
|
||||
// -- CTF --
|
||||
// Order: CTF->DM->Coop
|
||||
if (gametype == GT_CTF && players[playernum].ctfteam)
|
||||
if ((gametyperules & (GTR_TEAMFLAGS|GTR_TEAMS)) && players[playernum].ctfteam)
|
||||
{
|
||||
if (!(spawnpoint = G_FindCTFStart(playernum)) // find a CTF start
|
||||
&& !(spawnpoint = G_FindMatchStart(playernum))) // find a DM start
|
||||
|
@ -2637,7 +2674,7 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost)
|
|||
|
||||
// -- DM/Tag/CTF-spectator/etc --
|
||||
// Order: DM->CTF->Coop
|
||||
else if (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF
|
||||
else if ((gametyperules & GTR_DEATHMATCHSTARTS) || gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF
|
||||
|| ((gametype == GT_TAG || gametype == GT_HIDEANDSEEK) && !(players[playernum].pflags & PF_TAGIT)))
|
||||
{
|
||||
if (!(spawnpoint = G_FindMatchStart(playernum)) // find a DM start
|
||||
|
@ -2684,7 +2721,7 @@ mapthing_t *G_FindCTFStart(INT32 playernum)
|
|||
|
||||
if (!numredctfstarts && !numbluectfstarts) //why even bother, eh?
|
||||
{
|
||||
if (playernum == consoleplayer || (splitscreen && playernum == secondarydisplayplayer))
|
||||
if ((gametyperules & GTR_TEAMFLAGS) && (playernum == consoleplayer || (splitscreen && playernum == secondarydisplayplayer)))
|
||||
CONS_Alert(CONS_WARNING, M_GetText("No CTF starts in this map!\n"));
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2913,7 +2950,7 @@ void G_DoReborn(INT32 playernum)
|
|||
}
|
||||
if (!countdowntimeup && (mapheaderinfo[gamemap-1]->levelflags & LF_NORELOAD))
|
||||
{
|
||||
P_LoadThingsOnly();
|
||||
P_RespawnThings();
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
|
@ -3090,7 +3127,7 @@ void G_ExitLevel(void)
|
|||
CV_SetValue(&cv_teamscramble, cv_scrambleonchange.value);
|
||||
}
|
||||
|
||||
if (gametype != GT_COOP)
|
||||
if (!(gametyperules & GTR_CAMPAIGN))
|
||||
CONS_Printf(M_GetText("The round has ended.\n"));
|
||||
|
||||
// Remove CEcho text on round end.
|
||||
|
@ -3122,6 +3159,221 @@ const char *Gametype_Names[NUMGAMETYPES] =
|
|||
"CTF" // GT_CTF
|
||||
};
|
||||
|
||||
// For dehacked
|
||||
const char *Gametype_ConstantNames[NUMGAMETYPES] =
|
||||
{
|
||||
"GT_COOP", // GT_COOP
|
||||
"GT_COMPETITION", // GT_COMPETITION
|
||||
"GT_RACE", // GT_RACE
|
||||
|
||||
"GT_MATCH", // GT_MATCH
|
||||
"GT_TEAMMATCH", // GT_TEAMMATCH
|
||||
|
||||
"GT_TAG", // GT_TAG
|
||||
"GT_HIDEANDSEEK", // GT_HIDEANDSEEK
|
||||
|
||||
"GT_CTF" // GT_CTF
|
||||
};
|
||||
|
||||
// Gametype rules
|
||||
UINT32 gametypedefaultrules[NUMGAMETYPES] =
|
||||
{
|
||||
// Co-op
|
||||
GTR_CAMPAIGN|GTR_LIVES|GTR_SPAWNENEMIES|GTR_ALLOWEXIT|GTR_EMERALDHUNT|GTR_EMERALDTOKENS|GTR_SPECIALSTAGES,
|
||||
// Competition
|
||||
GTR_RACE|GTR_LIVES|GTR_SPAWNENEMIES|GTR_EMERALDTOKENS|GTR_SPAWNINVUL|GTR_ALLOWEXIT,
|
||||
// Race
|
||||
GTR_RACE|GTR_SPAWNENEMIES|GTR_SPAWNINVUL|GTR_ALLOWEXIT,
|
||||
|
||||
// Match
|
||||
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_MATCHEMERALDS|GTR_SPAWNINVUL|GTR_PITYSHIELD|GTR_DEATHPENALTY,
|
||||
// Team Match
|
||||
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_SPECTATORS|GTR_TEAMS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_SPAWNINVUL|GTR_PITYSHIELD,
|
||||
|
||||
// Tag
|
||||
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_TAG|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_HIDETIME|GTR_BLINDFOLDED|GTR_SPAWNINVUL,
|
||||
// Hide and Seek
|
||||
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_TAG|GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_HIDETIME|GTR_BLINDFOLDED|GTR_SPAWNINVUL,
|
||||
|
||||
// CTF
|
||||
GTR_RINGSLINGER|GTR_FIRSTPERSON|GTR_SPECTATORS|GTR_TEAMS|GTR_TEAMFLAGS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_MATCHEMERALDS|GTR_SPAWNINVUL|GTR_PITYSHIELD,
|
||||
};
|
||||
|
||||
//
|
||||
// G_SetGametype
|
||||
//
|
||||
// Set a new gametype, also setting gametype rules accordingly. Yay!
|
||||
//
|
||||
void G_SetGametype(INT16 gtype)
|
||||
{
|
||||
gametype = gtype;
|
||||
gametyperules = gametypedefaultrules[gametype];
|
||||
}
|
||||
|
||||
//
|
||||
// G_AddGametype
|
||||
//
|
||||
// Add a gametype. Returns the new gametype number.
|
||||
//
|
||||
INT16 G_AddGametype(UINT32 rules)
|
||||
{
|
||||
INT16 newgtype = gametypecount;
|
||||
gametypecount++;
|
||||
|
||||
// Set gametype rules.
|
||||
gametypedefaultrules[newgtype] = rules;
|
||||
Gametype_Names[newgtype] = "???";
|
||||
|
||||
// Update gametype_cons_t accordingly.
|
||||
G_UpdateGametypeSelections();
|
||||
|
||||
return newgtype;
|
||||
}
|
||||
|
||||
//
|
||||
// G_AddGametypeConstant
|
||||
//
|
||||
// Self-explanatory. Filters out "bad" characters.
|
||||
//
|
||||
void G_AddGametypeConstant(INT16 gtype, const char *newgtconst)
|
||||
{
|
||||
char *gtconst = Z_Malloc(strlen(newgtconst) + 3, PU_STATIC, NULL);
|
||||
// Copy GT_ and the gametype name.
|
||||
strcpy(gtconst, "GT_");
|
||||
strcat(gtconst, newgtconst);
|
||||
// Make uppercase.
|
||||
strupr(gtconst);
|
||||
// Remove characters.
|
||||
#define REMOVECHAR(chr) \
|
||||
{ \
|
||||
char *chrfind = strchr(gtconst, chr); \
|
||||
while (chrfind) \
|
||||
{ \
|
||||
*chrfind = '_'; \
|
||||
chrfind = strchr(chrfind, chr); \
|
||||
} \
|
||||
}
|
||||
|
||||
// Space
|
||||
REMOVECHAR(' ')
|
||||
// Used for operations
|
||||
REMOVECHAR('+')
|
||||
REMOVECHAR('-')
|
||||
REMOVECHAR('*')
|
||||
REMOVECHAR('/')
|
||||
REMOVECHAR('%')
|
||||
REMOVECHAR('^')
|
||||
// Part of Lua's syntax
|
||||
REMOVECHAR('#')
|
||||
REMOVECHAR('=')
|
||||
REMOVECHAR('~')
|
||||
REMOVECHAR('<')
|
||||
REMOVECHAR('>')
|
||||
REMOVECHAR('(')
|
||||
REMOVECHAR(')')
|
||||
REMOVECHAR('{')
|
||||
REMOVECHAR('}')
|
||||
REMOVECHAR('[')
|
||||
REMOVECHAR(']')
|
||||
REMOVECHAR(':')
|
||||
REMOVECHAR(';')
|
||||
REMOVECHAR(',')
|
||||
REMOVECHAR('.')
|
||||
|
||||
#undef REMOVECHAR
|
||||
|
||||
// Finally, set the constant string.
|
||||
Gametype_ConstantNames[gtype] = gtconst;
|
||||
}
|
||||
|
||||
//
|
||||
// G_UpdateGametypeSelections
|
||||
//
|
||||
// Updates gametype_cons_t.
|
||||
//
|
||||
void G_UpdateGametypeSelections(void)
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 0; i < gametypecount; i++)
|
||||
{
|
||||
gametype_cons_t[i].value = i;
|
||||
gametype_cons_t[i].strvalue = Gametype_Names[i];
|
||||
}
|
||||
gametype_cons_t[NUMGAMETYPES].value = 0;
|
||||
gametype_cons_t[NUMGAMETYPES].strvalue = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// G_SetGametypeDescription
|
||||
//
|
||||
// Set a description for the specified gametype.
|
||||
// (Level platter)
|
||||
//
|
||||
void G_SetGametypeDescription(INT16 gtype, char *descriptiontext, UINT8 leftcolor, UINT8 rightcolor)
|
||||
{
|
||||
if (descriptiontext != NULL)
|
||||
strncpy(gametypedesc[gtype].notes, descriptiontext, 441);
|
||||
gametypedesc[gtype].col[0] = leftcolor;
|
||||
gametypedesc[gtype].col[1] = rightcolor;
|
||||
}
|
||||
|
||||
// Gametype rankings
|
||||
INT16 gametyperankings[NUMGAMETYPES] =
|
||||
{
|
||||
GT_COOP,
|
||||
GT_COMPETITION,
|
||||
GT_RACE,
|
||||
|
||||
GT_MATCH,
|
||||
GT_TEAMMATCH,
|
||||
|
||||
GT_TAG,
|
||||
GT_HIDEANDSEEK,
|
||||
|
||||
GT_CTF,
|
||||
};
|
||||
|
||||
// Gametype to TOL (Type Of Level)
|
||||
UINT32 gametypetol[NUMGAMETYPES] =
|
||||
{
|
||||
TOL_COOP, // Co-op
|
||||
TOL_COMPETITION, // Competition
|
||||
TOL_RACE, // Race
|
||||
|
||||
TOL_MATCH, // Match
|
||||
TOL_MATCH, // Team Match
|
||||
|
||||
TOL_TAG, // Tag
|
||||
TOL_TAG, // Hide and Seek
|
||||
|
||||
TOL_CTF, // CTF
|
||||
};
|
||||
|
||||
//
|
||||
// G_AddTOL
|
||||
//
|
||||
// Adds a type of level.
|
||||
//
|
||||
void G_AddTOL(UINT32 newtol, const char *tolname)
|
||||
{
|
||||
TYPEOFLEVEL[numtolinfo].name = Z_StrDup(tolname);
|
||||
TYPEOFLEVEL[numtolinfo].flag = newtol;
|
||||
numtolinfo++;
|
||||
|
||||
TYPEOFLEVEL[numtolinfo].name = NULL;
|
||||
TYPEOFLEVEL[numtolinfo].flag = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// G_AddTOL
|
||||
//
|
||||
// Assigns a type of level to a gametype.
|
||||
//
|
||||
void G_AddGametypeTOL(INT16 gtype, UINT32 newtol)
|
||||
{
|
||||
gametypetol[gtype] = newtol;
|
||||
}
|
||||
|
||||
//
|
||||
// G_GetGametypeByName
|
||||
//
|
||||
|
@ -3131,7 +3383,7 @@ INT32 G_GetGametypeByName(const char *gametypestr)
|
|||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < NUMGAMETYPES; i++)
|
||||
for (i = 0; i < gametypecount; i++)
|
||||
if (!stricmp(gametypestr, Gametype_Names[i]))
|
||||
return i;
|
||||
|
||||
|
@ -3164,8 +3416,8 @@ boolean G_IsSpecialStage(INT32 mapnum)
|
|||
//
|
||||
boolean G_GametypeUsesLives(void)
|
||||
{
|
||||
// Coop, Competitive
|
||||
if ((gametype == GT_COOP || gametype == GT_COMPETITION)
|
||||
// Coop, Competitive
|
||||
if ((gametyperules & GTR_LIVES)
|
||||
&& !(modeattacking || metalrecording) // No lives in Time Attack
|
||||
&& !G_IsSpecialStage(gamemap)
|
||||
&& !(maptol & TOL_NIGHTS)) // No lives in NiGHTS
|
||||
|
@ -3181,7 +3433,7 @@ boolean G_GametypeUsesLives(void)
|
|||
//
|
||||
boolean G_GametypeHasTeams(void)
|
||||
{
|
||||
return (gametype == GT_TEAMMATCH || gametype == GT_CTF);
|
||||
return (gametyperules & GTR_TEAMS);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -3192,7 +3444,7 @@ boolean G_GametypeHasTeams(void)
|
|||
//
|
||||
boolean G_GametypeHasSpectators(void)
|
||||
{
|
||||
return (gametype != GT_COOP && gametype != GT_COMPETITION && gametype != GT_RACE);
|
||||
return (gametyperules & GTR_SPECTATORS);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -3203,7 +3455,7 @@ boolean G_GametypeHasSpectators(void)
|
|||
//
|
||||
boolean G_RingSlingerGametype(void)
|
||||
{
|
||||
return ((gametype != GT_COOP && gametype != GT_COMPETITION && gametype != GT_RACE) || (cv_ringslinger.value));
|
||||
return ((gametyperules & GTR_RINGSLINGER) || (cv_ringslinger.value));
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -3213,7 +3465,7 @@ boolean G_RingSlingerGametype(void)
|
|||
//
|
||||
boolean G_PlatformGametype(void)
|
||||
{
|
||||
return (gametype == GT_COOP || gametype == GT_RACE || gametype == GT_COMPETITION);
|
||||
return (!(gametyperules & GTR_RINGSLINGER));
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -3223,7 +3475,7 @@ boolean G_PlatformGametype(void)
|
|||
//
|
||||
boolean G_TagGametype(void)
|
||||
{
|
||||
return (gametype == GT_TAG || gametype == GT_HIDEANDSEEK);
|
||||
return (gametyperules & GTR_TAG);
|
||||
}
|
||||
|
||||
/** Get the typeoflevel flag needed to indicate support of a gametype.
|
||||
|
@ -3234,18 +3486,9 @@ boolean G_TagGametype(void)
|
|||
*/
|
||||
INT16 G_TOLFlag(INT32 pgametype)
|
||||
{
|
||||
if (!multiplayer) return TOL_SP;
|
||||
if (pgametype == GT_COOP) return TOL_COOP;
|
||||
if (pgametype == GT_COMPETITION) return TOL_COMPETITION;
|
||||
if (pgametype == GT_RACE) return TOL_RACE;
|
||||
if (pgametype == GT_MATCH) return TOL_MATCH;
|
||||
if (pgametype == GT_TEAMMATCH) return TOL_MATCH;
|
||||
if (pgametype == GT_TAG) return TOL_TAG;
|
||||
if (pgametype == GT_HIDEANDSEEK) return TOL_TAG;
|
||||
if (pgametype == GT_CTF) return TOL_CTF;
|
||||
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Unknown gametype! %d\n"), pgametype);
|
||||
return INT16_MAX;
|
||||
if (!multiplayer)
|
||||
return TOL_SP;
|
||||
return gametypetol[pgametype];
|
||||
}
|
||||
|
||||
/** Select a random map with the given typeoflevel flags.
|
||||
|
@ -3256,7 +3499,7 @@ INT16 G_TOLFlag(INT32 pgametype)
|
|||
* has those flags.
|
||||
* \author Graue <graue@oceanbase.org>
|
||||
*/
|
||||
static INT16 RandMap(INT16 tolflags, INT16 pprevmap)
|
||||
static INT16 RandMap(UINT32 tolflags, INT16 pprevmap)
|
||||
{
|
||||
INT16 *okmaps = Z_Malloc(NUMMAPS * sizeof(INT16), PU_STATIC, NULL);
|
||||
INT32 numokmaps = 0;
|
||||
|
@ -3414,10 +3657,10 @@ static void G_DoCompleted(void)
|
|||
I_Error("Followed map %d to invalid map %d\n", prevmap + 1, nextmap + 1);
|
||||
|
||||
// wrap around in race
|
||||
if (nextmap >= 1100-1 && nextmap <= 1102-1 && (gametype == GT_RACE || gametype == GT_COMPETITION))
|
||||
if (nextmap >= 1100-1 && nextmap <= 1102-1 && !(gametyperules & GTR_CAMPAIGN))
|
||||
nextmap = (INT16)(spstage_start-1);
|
||||
|
||||
if ((gottoken = (gametype == GT_COOP && token)))
|
||||
if ((gottoken = ((gametyperules & GTR_SPECIALSTAGES) && token)))
|
||||
{
|
||||
token--;
|
||||
|
||||
|
@ -3437,7 +3680,7 @@ static void G_DoCompleted(void)
|
|||
|
||||
automapactive = false;
|
||||
|
||||
if (gametype != GT_COOP)
|
||||
if (!(gametyperules & GTR_CAMPAIGN))
|
||||
{
|
||||
if (cv_advancemap.value == 0) // Stay on same map.
|
||||
nextmap = prevmap;
|
||||
|
@ -6615,23 +6858,20 @@ void G_AddGhost(char *defdemoname)
|
|||
I_Assert(mthing);
|
||||
{ // A bit more complex than P_SpawnPlayer because ghosts aren't solid and won't just push themselves out of the ceiling.
|
||||
fixed_t z,f,c;
|
||||
fixed_t offset = mthing->z << FRACBITS;
|
||||
gh->mo = P_SpawnMobj(mthing->x << FRACBITS, mthing->y << FRACBITS, 0, MT_GHOST);
|
||||
gh->mo->angle = FixedAngle(mthing->angle*FRACUNIT);
|
||||
gh->mo->angle = FixedAngle(mthing->angle << FRACBITS);
|
||||
f = gh->mo->floorz;
|
||||
c = gh->mo->ceilingz - mobjinfo[MT_PLAYER].height;
|
||||
if (!!(mthing->options & MTF_AMBUSH) ^ !!(mthing->options & MTF_OBJECTFLIP))
|
||||
{
|
||||
z = c;
|
||||
if (mthing->options >> ZSHIFT)
|
||||
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||
z = c - offset;
|
||||
if (z < f)
|
||||
z = f;
|
||||
}
|
||||
else
|
||||
{
|
||||
z = f;
|
||||
if (mthing->options >> ZSHIFT)
|
||||
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||
z = f + offset;
|
||||
if (z > c)
|
||||
z = c;
|
||||
}
|
||||
|
|
13
src/g_game.h
13
src/g_game.h
|
@ -167,6 +167,7 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar,
|
|||
void G_DoLoadLevel(boolean resetplayer);
|
||||
void G_StartTitleCard(void);
|
||||
void G_PreLevelTitleCard(void);
|
||||
boolean G_IsTitleCardAvailable(void);
|
||||
void G_DeferedPlayDemo(const char *demo);
|
||||
|
||||
// Can be called by the startup code or M_Responder, calls P_SetupLevel.
|
||||
|
@ -226,6 +227,18 @@ ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(boolean kill);
|
|||
void G_StopDemo(void);
|
||||
boolean G_CheckDemoStatus(void);
|
||||
|
||||
extern UINT32 gametypedefaultrules[NUMGAMETYPES];
|
||||
extern UINT32 gametypetol[NUMGAMETYPES];
|
||||
extern INT16 gametyperankings[NUMGAMETYPES];
|
||||
|
||||
void G_SetGametype(INT16 gametype);
|
||||
INT16 G_AddGametype(UINT32 rules);
|
||||
void G_AddGametypeConstant(INT16 gtype, const char *newgtconst);
|
||||
void G_UpdateGametypeSelections(void);
|
||||
void G_AddTOL(UINT32 newtol, const char *tolname);
|
||||
void G_AddGametypeTOL(INT16 gtype, UINT32 newtol);
|
||||
void G_SetGametypeDescription(INT16 gtype, char *descriptiontext, UINT8 leftcolor, UINT8 rightcolor);
|
||||
|
||||
INT32 G_GetGametypeByName(const char *gametypestr);
|
||||
boolean G_IsSpecialStage(INT32 mapnum);
|
||||
boolean G_GametypeUsesLives(void);
|
||||
|
|
|
@ -836,8 +836,10 @@ static INT32 SolveTProblem(void)
|
|||
return 0;
|
||||
|
||||
CONS_Debug(DBG_RENDER, "Solving T-joins. This may take a while. Please wait...\n");
|
||||
#ifdef HWR_LOADING_SCREEN
|
||||
CON_Drawer(); //let the user know what we are doing
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
#endif
|
||||
|
||||
numsplitpoly = 0;
|
||||
|
||||
|
@ -964,9 +966,9 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
|
|||
CONS_Debug(DBG_RENDER, "Creating polygons, please wait...\n");
|
||||
#ifdef HWR_LOADING_SCREEN
|
||||
ls_count = ls_percent = 0; // reset the loading status
|
||||
#endif
|
||||
CON_Drawer(); //let the user know what we are doing
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
#endif
|
||||
|
||||
HWR_ClearPolys();
|
||||
|
||||
|
|
|
@ -764,13 +764,12 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm
|
|||
// CACHING HANDLING
|
||||
// =================================================
|
||||
|
||||
static size_t gr_numtextures; // Texture count
|
||||
static size_t gr_numtextures = 0; // Texture count
|
||||
static GLTexture_t *gr_textures; // For all textures
|
||||
static GLTexture_t *gr_flats; // For all (texture) flats, as normal flats don't need to be cached
|
||||
|
||||
void HWR_InitTextureCache(void)
|
||||
{
|
||||
gr_numtextures = 0;
|
||||
gr_textures = NULL;
|
||||
gr_flats = NULL;
|
||||
}
|
||||
|
@ -958,6 +957,9 @@ static void HWR_CacheTextureAsFlat(GLMipmap_t *grMipmap, INT32 texturenum)
|
|||
{
|
||||
UINT8 *flat;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
// setup the texture info
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
grMipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_64;
|
||||
|
@ -983,6 +985,9 @@ void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum)
|
|||
if (flatlumpnum == LUMPERROR)
|
||||
return;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
if (!grmip->downloaded && !grmip->grInfo.data)
|
||||
HWR_CacheFlat(grmip, flatlumpnum);
|
||||
|
@ -1061,6 +1066,9 @@ static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
|
|||
// -----------------+
|
||||
void HWR_GetPatch(GLPatch_t *gpatch)
|
||||
{
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
// is it in hardware cache
|
||||
if (!gpatch->mipmap->downloaded && !gpatch->mipmap->grInfo.data)
|
||||
{
|
||||
|
@ -1091,6 +1099,9 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
|
|||
{
|
||||
GLMipmap_t *grmip, *newmip;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
if (colormap == colormaps || colormap == NULL)
|
||||
{
|
||||
// Load the default (green) color in doom cache (temporary?) AND hardware cache
|
||||
|
@ -1216,6 +1227,9 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
|
|||
{
|
||||
GLPatch_t *grpatch;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
grpatch = HWR_GetCachedGLPatch(lumpnum);
|
||||
|
||||
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data)
|
||||
|
@ -1419,6 +1433,9 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
|
|||
{
|
||||
GLMipmap_t *grmip;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
|
||||
if (!grmip->downloaded && !grmip->grInfo.data)
|
||||
|
|
|
@ -115,13 +115,11 @@ typedef struct
|
|||
FLOAT fovxangle, fovyangle;
|
||||
UINT8 splitscreen;
|
||||
boolean flip; // screenflip
|
||||
#ifdef ROTSPRITE
|
||||
boolean roll;
|
||||
SINT8 rollflip;
|
||||
FLOAT rollangle; // done to not override USE_FTRANSFORM_ANGLEZ
|
||||
UINT8 rotaxis;
|
||||
FLOAT centerx, centery;
|
||||
#endif
|
||||
#ifdef USE_FTRANSFORM_MIRROR
|
||||
boolean mirror; // SRB2Kart: Encore Mode
|
||||
#endif
|
||||
|
|
|
@ -992,7 +992,7 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
|||
// top edge
|
||||
if (clearlines > basewindowy - 8)
|
||||
{
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_T], PU_CACHE);
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_T], PU_PATCH);
|
||||
for (x = 0; x < baseviewwidth; x += 8)
|
||||
HWR_DrawPatch(patch, basewindowx + x, basewindowy - 8,
|
||||
0);
|
||||
|
@ -1001,7 +1001,7 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
|||
// bottom edge
|
||||
if (clearlines > basewindowy + baseviewheight)
|
||||
{
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_B], PU_CACHE);
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_B], PU_PATCH);
|
||||
for (x = 0; x < baseviewwidth; x += 8)
|
||||
HWR_DrawPatch(patch, basewindowx + x,
|
||||
basewindowy + baseviewheight, 0);
|
||||
|
@ -1010,7 +1010,7 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
|||
// left edge
|
||||
if (clearlines > basewindowy)
|
||||
{
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_L], PU_CACHE);
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_L], PU_PATCH);
|
||||
for (y = 0; y < baseviewheight && basewindowy + y < clearlines;
|
||||
y += 8)
|
||||
{
|
||||
|
@ -1022,7 +1022,7 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
|||
// right edge
|
||||
if (clearlines > basewindowy)
|
||||
{
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_R], PU_CACHE);
|
||||
patch = W_CachePatchNum(viewborderlump[BRDR_R], PU_PATCH);
|
||||
for (y = 0; y < baseviewheight && basewindowy+y < clearlines;
|
||||
y += 8)
|
||||
{
|
||||
|
@ -1034,22 +1034,22 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
|||
// Draw beveled corners.
|
||||
if (clearlines > basewindowy - 8)
|
||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_TL],
|
||||
PU_CACHE),
|
||||
PU_PATCH),
|
||||
basewindowx - 8, basewindowy - 8, 0);
|
||||
|
||||
if (clearlines > basewindowy - 8)
|
||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_TR],
|
||||
PU_CACHE),
|
||||
PU_PATCH),
|
||||
basewindowx + baseviewwidth, basewindowy - 8, 0);
|
||||
|
||||
if (clearlines > basewindowy+baseviewheight)
|
||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_BL],
|
||||
PU_CACHE),
|
||||
PU_PATCH),
|
||||
basewindowx - 8, basewindowy + baseviewheight, 0);
|
||||
|
||||
if (clearlines > basewindowy + baseviewheight)
|
||||
HWR_DrawPatch(W_CachePatchNum(viewborderlump[BRDR_BR],
|
||||
PU_CACHE),
|
||||
PU_PATCH),
|
||||
basewindowx + baseviewwidth,
|
||||
basewindowy + baseviewheight, 0);
|
||||
}
|
||||
|
|
|
@ -832,7 +832,7 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf)
|
|||
if (!M_PointInBox(segbbox,splat->v1.x,splat->v1.y) && !M_PointInBox(segbbox,splat->v2.x,splat->v2.y))
|
||||
continue;
|
||||
|
||||
gpatch = W_CachePatchNum(splat->patch, PU_CACHE);
|
||||
gpatch = W_CachePatchNum(splat->patch, PU_PATCH);
|
||||
HWR_GetPatch(gpatch);
|
||||
|
||||
wallVerts[0].x = wallVerts[3].x = FIXED_TO_FLOAT(splat->v1.x);
|
||||
|
@ -2714,6 +2714,8 @@ static void HWR_AddLine(seg_t * line)
|
|||
static sector_t tempsec;
|
||||
|
||||
fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t
|
||||
if (line->glseg)
|
||||
return;
|
||||
#ifdef POLYOBJECTS
|
||||
if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES))
|
||||
return;
|
||||
|
@ -5501,17 +5503,12 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
|||
fixed_t spr_offset, spr_topoffset;
|
||||
#ifdef ROTSPRITE
|
||||
patch_t *rotsprite = NULL;
|
||||
angle_t arollangle;
|
||||
UINT32 rollangle;
|
||||
INT32 rollangle = 0;
|
||||
#endif
|
||||
|
||||
if (!thing)
|
||||
return;
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
arollangle = thing->rollangle;
|
||||
rollangle = AngleFixed(arollangle)>>FRACBITS;
|
||||
#endif
|
||||
this_scale = FIXED_TO_FLOAT(thing->scale);
|
||||
|
||||
// transform the origin point
|
||||
|
@ -5618,11 +5615,11 @@ static void HWR_ProjectSprite(mobj_t *thing)
|
|||
spr_topoffset = spritecachedinfo[lumpoff].topoffset;
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if (rollangle > 0)
|
||||
if (thing->rollangle)
|
||||
{
|
||||
rollangle = R_GetRollAngle(thing->rollangle);
|
||||
if (!sprframe->rotsprite.cached[rot])
|
||||
R_CacheRotSprite(thing->sprite, (thing->frame & FF_FRAMEMASK), sprinfo, sprframe, rot, flip);
|
||||
rollangle /= ROTANGDIFF;
|
||||
rotsprite = sprframe->rotsprite.patch[rot][rollangle];
|
||||
if (rotsprite != NULL)
|
||||
{
|
||||
|
@ -6659,7 +6656,13 @@ void HWR_AddCommands(void)
|
|||
|
||||
void HWR_AddSessionCommands(void)
|
||||
{
|
||||
static boolean alreadycalled = false;
|
||||
if (alreadycalled)
|
||||
return;
|
||||
|
||||
CV_RegisterVar(&cv_granisotropicmode);
|
||||
|
||||
alreadycalled = true;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
@ -6695,6 +6698,17 @@ void HWR_Startup(void)
|
|||
startupdone = true;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Called after switching to the hardware renderer
|
||||
// --------------------------------------------------------------------------
|
||||
void HWR_Switch(void)
|
||||
{
|
||||
// Set special states from CVARs
|
||||
HWD.pfnSetSpecialState(HWD_SET_MODEL_LIGHTING, cv_grmodellighting.value);
|
||||
HWD.pfnSetSpecialState(HWD_SET_FOG_DENSITY, cv_grfogdensity.value);
|
||||
HWD.pfnSetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_grfiltermode.value);
|
||||
HWD.pfnSetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_granisotropicmode.value);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Free resources allocated by the hardware renderer
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
// Startup & Shutdown the hardware mode renderer
|
||||
void HWR_Startup(void);
|
||||
void HWR_Switch(void);
|
||||
void HWR_Shutdown(void);
|
||||
|
||||
void HWR_drawAMline(const fline_t *fl, INT32 color);
|
||||
|
|
|
@ -1148,10 +1148,8 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
const UINT8 flip = (UINT8)(!(spr->mobj->eflags & MFE_VERTICALFLIP) != !(spr->mobj->frame & FF_VERTICALFLIP));
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
#ifdef ROTSPRITE
|
||||
spriteinfo_t *sprinfo;
|
||||
angle_t ang;
|
||||
#endif
|
||||
INT32 mod;
|
||||
float finalscale;
|
||||
|
||||
|
@ -1175,16 +1173,12 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
{
|
||||
md2 = &md2_playermodels[(skin_t*)spr->mobj->skin-skins];
|
||||
md2->skin = (skin_t*)spr->mobj->skin-skins;
|
||||
#ifdef ROTSPRITE
|
||||
sprinfo = &((skin_t *)spr->mobj->skin)->sprinfo[spr->mobj->sprite2];
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
md2 = &md2_models[spr->mobj->sprite];
|
||||
#ifdef ROTSPRITE
|
||||
sprinfo = &spriteinfo[spr->mobj->sprite];
|
||||
#endif
|
||||
}
|
||||
|
||||
if (md2->error)
|
||||
|
@ -1384,9 +1378,8 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
p.angley = FIXED_TO_FLOAT(anglef);
|
||||
}
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
p.rollangle = 0.0f;
|
||||
p.rollflip = 0;
|
||||
p.rollflip = 1;
|
||||
p.rotaxis = 0;
|
||||
if (spr->mobj->rollangle)
|
||||
{
|
||||
|
@ -1409,7 +1402,6 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
else if ((sprframe->rotate & SRF_LEFT) && (ang >= ANGLE_180)) // See from left
|
||||
p.rollflip = -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
p.anglex = 0.0f;
|
||||
|
||||
|
|
|
@ -2076,7 +2076,6 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
|
|||
pglRotatef(pos->angley, 0.0f, -1.0f, 0.0f);
|
||||
pglRotatef(pos->anglex, 1.0f, 0.0f, 0.0f);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if (pos->roll)
|
||||
{
|
||||
float roll = (1.0f * pos->rollflip);
|
||||
|
@ -2089,7 +2088,6 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
|
|||
pglRotatef(pos->rollangle, roll, 0.0f, 0.0f);
|
||||
pglTranslatef(-pos->centerx, -pos->centery, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
pglScalef(scalex, scaley, scalez);
|
||||
|
||||
|
|
|
@ -2066,7 +2066,7 @@ static void HU_drawGametype(void)
|
|||
{
|
||||
const char *strvalue = NULL;
|
||||
|
||||
if (gametype < 0 || gametype >= NUMGAMETYPES)
|
||||
if (gametype < 0 || gametype >= gametypecount)
|
||||
return; // not a valid gametype???
|
||||
|
||||
strvalue = Gametype_Names[gametype];
|
||||
|
@ -2117,6 +2117,9 @@ static void HU_DrawDemoInfo(void)
|
|||
//
|
||||
void HU_Drawer(void)
|
||||
{
|
||||
if (needpatchrecache)
|
||||
R_ReloadHUDGraphics();
|
||||
|
||||
#ifndef NONET
|
||||
// draw chat string plus cursor
|
||||
if (chat_on)
|
||||
|
@ -2375,7 +2378,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
|
|||
|
||||
for (i = 0; i < scorelines; i++)
|
||||
{
|
||||
if (players[tab[i].num].spectator && gametype != GT_COOP)
|
||||
if (players[tab[i].num].spectator && gametyperankings[gametype] != GT_COOP)
|
||||
continue; //ignore them.
|
||||
|
||||
greycheck = greycheckdef;
|
||||
|
@ -2438,7 +2441,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
|
|||
}
|
||||
}
|
||||
|
||||
if (G_GametypeUsesLives() && !(gametype == GT_COOP && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != INFLIVES)) //show lives
|
||||
if (G_GametypeUsesLives() && !(gametyperankings[gametype] == GT_COOP && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != INFLIVES)) //show lives
|
||||
V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE|(greycheck ? V_60TRANS : 0), va("%dx", players[tab[i].num].lives));
|
||||
else if (G_TagGametype() && players[tab[i].num].pflags & PF_TAGIT)
|
||||
{
|
||||
|
@ -2451,7 +2454,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
|
|||
if (players[tab[i].num].exiting || (players[tab[i].num].pflags & PF_FINISHED))
|
||||
V_DrawSmallScaledPatch(x - SHORT(exiticon->width)/2 - 1, y-3, 0, exiticon);
|
||||
|
||||
if (gametype == GT_RACE)
|
||||
if (gametyperankings[gametype] == GT_RACE)
|
||||
{
|
||||
if (circuitmap)
|
||||
{
|
||||
|
@ -2545,7 +2548,7 @@ static void HU_Draw32TeamTabRankings(playersort_t *tab, INT32 whiteplayer)
|
|||
| (greycheck ? 0 : V_TRANSLUCENT)
|
||||
| V_ALLOWLOWERCASE, name);
|
||||
|
||||
if (gametype == GT_CTF)
|
||||
if (gametyperules & GTR_TEAMFLAGS)
|
||||
{
|
||||
if (players[tab[i].num].gotflag & GF_REDFLAG) // Red
|
||||
V_DrawFixedPatch((x-10)*FRACUNIT, (y)*FRACUNIT, FRACUNIT/4, 0, rflagico, 0);
|
||||
|
@ -2673,7 +2676,7 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer)
|
|||
| (greycheck ? V_TRANSLUCENT : 0)
|
||||
| V_ALLOWLOWERCASE, name);
|
||||
|
||||
if (gametype == GT_CTF)
|
||||
if (gametyperules & GTR_TEAMFLAGS)
|
||||
{
|
||||
if (players[tab[i].num].gotflag & GF_REDFLAG) // Red
|
||||
V_DrawSmallScaledPatch(x-28, y-4, 0, rflagico);
|
||||
|
@ -2730,7 +2733,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
|
|||
|
||||
for (i = 0; i < scorelines; i++)
|
||||
{
|
||||
if (players[tab[i].num].spectator && gametype != GT_COOP)
|
||||
if (players[tab[i].num].spectator && gametyperankings[gametype] != GT_COOP)
|
||||
continue; //ignore them.
|
||||
|
||||
greycheck = greycheckdef;
|
||||
|
@ -2747,7 +2750,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
|
|||
| (greycheck ? V_TRANSLUCENT : 0)
|
||||
| V_ALLOWLOWERCASE, name);
|
||||
|
||||
if (G_GametypeUsesLives() && !(gametype == GT_COOP && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != INFLIVES)) //show lives
|
||||
if (G_GametypeUsesLives() && !(gametyperankings[gametype] == GT_COOP && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != INFLIVES)) //show lives
|
||||
V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE, va("%dx", players[tab[i].num].lives));
|
||||
else if (G_TagGametype() && players[tab[i].num].pflags & PF_TAGIT)
|
||||
V_DrawSmallScaledPatch(x-28, y-4, 0, tagico);
|
||||
|
@ -2796,7 +2799,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
|
|||
}
|
||||
|
||||
// All data drawn with thin string for space.
|
||||
if (gametype == GT_RACE)
|
||||
if (gametyperankings[gametype] == GT_RACE)
|
||||
{
|
||||
if (circuitmap)
|
||||
{
|
||||
|
@ -2836,7 +2839,7 @@ static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scor
|
|||
|
||||
for (i = 0; i < scorelines; i++)
|
||||
{
|
||||
if (players[tab[i].num].spectator && gametype != GT_COOP)
|
||||
if (players[tab[i].num].spectator && gametyperankings[gametype] != GT_COOP)
|
||||
continue; //ignore them.
|
||||
|
||||
greycheck = greycheckdef;
|
||||
|
@ -2906,7 +2909,7 @@ static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scor
|
|||
}
|
||||
|
||||
// All data drawn with thin string for space.
|
||||
if (gametype == GT_RACE)
|
||||
if (gametyperankings[gametype] == GT_RACE)
|
||||
{
|
||||
if (circuitmap)
|
||||
{
|
||||
|
@ -3030,21 +3033,21 @@ static void HU_DrawRankings(void)
|
|||
// draw the current gametype in the lower right
|
||||
HU_drawGametype();
|
||||
|
||||
if (gametype != GT_RACE && gametype != GT_COMPETITION && gametype != GT_COOP)
|
||||
if (gametyperules & (GTR_TIMELIMIT|GTR_POINTLIMIT))
|
||||
{
|
||||
if (cv_timelimit.value && timelimitintics > 0)
|
||||
if ((gametyperules & GTR_TIMELIMIT) && cv_timelimit.value && timelimitintics > 0)
|
||||
{
|
||||
V_DrawCenteredString(64, 8, 0, "TIME");
|
||||
V_DrawCenteredString(64, 16, 0, va("%i:%02i", G_TicsToMinutes(stplyr->realtime, true), G_TicsToSeconds(stplyr->realtime)));
|
||||
}
|
||||
|
||||
if (cv_pointlimit.value > 0)
|
||||
if ((gametyperules & GTR_POINTLIMIT) && cv_pointlimit.value > 0)
|
||||
{
|
||||
V_DrawCenteredString(256, 8, 0, "POINT LIMIT");
|
||||
V_DrawCenteredString(256, 16, 0, va("%d", cv_pointlimit.value));
|
||||
}
|
||||
}
|
||||
else if (gametype == GT_COOP)
|
||||
else if (gametyperankings[gametype] == GT_COOP)
|
||||
{
|
||||
INT32 totalscore = 0;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
|
@ -3078,7 +3081,7 @@ static void HU_DrawRankings(void)
|
|||
tab[i].num = -1;
|
||||
tab[i].name = 0;
|
||||
|
||||
if (gametype == GT_RACE && !circuitmap)
|
||||
if (gametyperankings[gametype] == GT_RACE && !circuitmap)
|
||||
tab[i].count = INT32_MAX;
|
||||
}
|
||||
|
||||
|
@ -3087,7 +3090,7 @@ static void HU_DrawRankings(void)
|
|||
if (!playeringame[j])
|
||||
continue;
|
||||
|
||||
if (gametype != GT_COOP && players[j].spectator)
|
||||
if (!G_PlatformGametype() && players[j].spectator)
|
||||
continue;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
|
@ -3095,10 +3098,10 @@ static void HU_DrawRankings(void)
|
|||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
if (gametype != GT_COOP && players[i].spectator)
|
||||
if (!G_PlatformGametype() && players[i].spectator)
|
||||
continue;
|
||||
|
||||
if (gametype == GT_RACE)
|
||||
if (gametyperankings[gametype] == GT_RACE)
|
||||
{
|
||||
if (circuitmap)
|
||||
{
|
||||
|
@ -3121,7 +3124,7 @@ static void HU_DrawRankings(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (gametype == GT_COMPETITION)
|
||||
else if (gametyperankings[gametype] == GT_COMPETITION)
|
||||
{
|
||||
// todo put something more fitting for the gametype here, such as current
|
||||
// number of categories led
|
||||
|
|
|
@ -44,6 +44,7 @@ extern boolean highcolor;
|
|||
/** \brief setup video mode
|
||||
*/
|
||||
void I_StartupGraphics(void);
|
||||
void I_StartupHardwareGraphics(void);
|
||||
|
||||
/** \brief restore old video mode
|
||||
*/
|
||||
|
@ -84,6 +85,7 @@ INT32 VID_GetModeForSize(INT32 w, INT32 h);
|
|||
\return currect video mode
|
||||
*/
|
||||
INT32 VID_SetMode(INT32 modenum);
|
||||
void VID_CheckRenderer(void);
|
||||
|
||||
/** \brief The VID_GetModeName function
|
||||
|
||||
|
|
|
@ -4492,7 +4492,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY, // flags
|
||||
MF_SCENERY|MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
|
@ -6273,7 +6273,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_NOGRAVITY|MF_NOBLOCKMAP|MF_NOTHINK, // flags
|
||||
MF_NOGRAVITY|MF_NOBLOCKMAP|MF_SCENERY, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
|
@ -11992,7 +11992,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
100, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags
|
||||
MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
|
@ -12019,7 +12019,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
100, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags
|
||||
MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
|
|
|
@ -155,11 +155,9 @@ void A_SpawnObjectAbsolute();
|
|||
void A_SpawnObjectRelative();
|
||||
void A_ChangeAngleRelative();
|
||||
void A_ChangeAngleAbsolute();
|
||||
#ifdef ROTSPRITE
|
||||
void A_RollAngle();
|
||||
void A_ChangeRollAngleRelative();
|
||||
void A_ChangeRollAngleAbsolute();
|
||||
#endif
|
||||
void A_PlaySound();
|
||||
void A_FindTarget();
|
||||
void A_FindTracer();
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "doomdef.h"
|
||||
#ifdef HAVE_BLUA
|
||||
#include "fastcmp.h"
|
||||
#include "p_local.h"
|
||||
#include "p_setup.h" // So we can have P_SetupLevelSky
|
||||
#ifdef ESLOPE
|
||||
|
@ -23,6 +24,8 @@
|
|||
#include "m_random.h"
|
||||
#include "s_sound.h"
|
||||
#include "g_game.h"
|
||||
#include "m_menu.h"
|
||||
#include "y_inter.h"
|
||||
#include "hu_stuff.h" // HU_AddChatText
|
||||
#include "console.h"
|
||||
#include "d_netcmd.h" // IsPlayerAdmin
|
||||
|
@ -144,10 +147,8 @@ static const struct {
|
|||
{META_MOBJINFO, "mobjinfo_t"},
|
||||
{META_SFXINFO, "sfxinfo_t"},
|
||||
{META_SPRITEINFO, "spriteinfo_t"},
|
||||
#ifdef ROTSPRITE
|
||||
{META_PIVOTLIST, "spriteframepivot_t[]"},
|
||||
{META_FRAMEPIVOT, "spriteframepivot_t"},
|
||||
#endif
|
||||
|
||||
{META_MOBJ, "mobj_t"},
|
||||
{META_MAPTHING, "mapthing_t"},
|
||||
|
@ -2632,6 +2633,145 @@ static int lib_sStartMusicCaption(lua_State *L)
|
|||
// G_GAME
|
||||
////////////
|
||||
|
||||
// Copypasted from lib_cvRegisterVar :]
|
||||
static int lib_gAddGametype(lua_State *L)
|
||||
{
|
||||
const char *k;
|
||||
lua_Integer i;
|
||||
|
||||
const char *gtname = NULL;
|
||||
const char *gtconst = NULL;
|
||||
const char *gtdescription = NULL;
|
||||
INT16 newgtidx = 0;
|
||||
UINT32 newgtrules = 0;
|
||||
UINT32 newgttol = 0;
|
||||
INT32 newgtpointlimit = 0;
|
||||
INT32 newgttimelimit = 0;
|
||||
UINT8 newgtleftcolor = 0;
|
||||
UINT8 newgtrightcolor = 0;
|
||||
INT16 newgtrankingstype = -1;
|
||||
int newgtinttype = 0;
|
||||
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
lua_settop(L, 1); // Clear out all other possible arguments, leaving only the first one.
|
||||
|
||||
if (!lua_lumploading)
|
||||
return luaL_error(L, "This function cannot be called from within a hook or coroutine!");
|
||||
|
||||
// Ran out of gametype slots
|
||||
if (gametypecount == NUMGAMETYPEFREESLOTS)
|
||||
return luaL_error(L, "Ran out of free gametype slots!");
|
||||
|
||||
#define FIELDERROR(f, e) luaL_error(L, "bad value for " LUA_QL(f) " in table passed to " LUA_QL("G_AddGametype") " (%s)", e);
|
||||
#define TYPEERROR(f, t) FIELDERROR(f, va("%s expected, got %s", lua_typename(L, t), luaL_typename(L, -1)))
|
||||
|
||||
lua_pushnil(L);
|
||||
while (lua_next(L, 1)) {
|
||||
// stack: gametype table, key/index, value
|
||||
// 1 2 3
|
||||
i = 0;
|
||||
k = NULL;
|
||||
if (lua_isnumber(L, 2))
|
||||
i = lua_tointeger(L, 2);
|
||||
else if (lua_isstring(L, 2))
|
||||
k = lua_tostring(L, 2);
|
||||
|
||||
// Sorry, no gametype rules as key names.
|
||||
if (i == 1 || (k && fasticmp(k, "name"))) {
|
||||
if (!lua_isstring(L, 3))
|
||||
TYPEERROR("name", LUA_TSTRING)
|
||||
gtname = Z_StrDup(lua_tostring(L, 3));
|
||||
} else if (i == 2 || (k && fasticmp(k, "identifier"))) {
|
||||
if (!lua_isstring(L, 3))
|
||||
TYPEERROR("identifier", LUA_TSTRING)
|
||||
gtconst = Z_StrDup(lua_tostring(L, 3));
|
||||
} else if (i == 3 || (k && fasticmp(k, "rules"))) {
|
||||
if (!lua_isnumber(L, 3))
|
||||
TYPEERROR("rules", LUA_TNUMBER)
|
||||
newgtrules = (UINT32)lua_tointeger(L, 3);
|
||||
} else if (i == 4 || (k && fasticmp(k, "typeoflevel"))) {
|
||||
if (!lua_isnumber(L, 3))
|
||||
TYPEERROR("typeoflevel", LUA_TNUMBER)
|
||||
newgttol = (UINT32)lua_tointeger(L, 3);
|
||||
} else if (i == 5 || (k && fasticmp(k, "rankingtype"))) {
|
||||
if (!lua_isnumber(L, 3))
|
||||
TYPEERROR("rankingtype", LUA_TNUMBER)
|
||||
newgtrankingstype = (INT16)lua_tointeger(L, 3);
|
||||
} else if (i == 6 || (k && fasticmp(k, "intermissiontype"))) {
|
||||
if (!lua_isnumber(L, 3))
|
||||
TYPEERROR("intermissiontype", LUA_TNUMBER)
|
||||
newgtinttype = (int)lua_tointeger(L, 3);
|
||||
} else if (i == 7 || (k && fasticmp(k, "defaultpointlimit"))) {
|
||||
if (!lua_isnumber(L, 3))
|
||||
TYPEERROR("defaultpointlimit", LUA_TNUMBER)
|
||||
newgtpointlimit = (INT32)lua_tointeger(L, 3);
|
||||
} else if (i == 8 || (k && fasticmp(k, "defaulttimelimit"))) {
|
||||
if (!lua_isnumber(L, 3))
|
||||
TYPEERROR("defaulttimelimit", LUA_TNUMBER)
|
||||
newgttimelimit = (INT32)lua_tointeger(L, 3);
|
||||
} else if (i == 9 || (k && fasticmp(k, "description"))) {
|
||||
if (!lua_isstring(L, 3))
|
||||
TYPEERROR("description", LUA_TSTRING)
|
||||
gtdescription = Z_StrDup(lua_tostring(L, 3));
|
||||
} else if (i == 10 || (k && fasticmp(k, "headerleftcolor"))) {
|
||||
if (!lua_isnumber(L, 3))
|
||||
TYPEERROR("headerleftcolor", LUA_TNUMBER)
|
||||
newgtleftcolor = (UINT8)lua_tointeger(L, 3);
|
||||
} else if (i == 11 || (k && fasticmp(k, "headerrightcolor"))) {
|
||||
if (!lua_isnumber(L, 3))
|
||||
TYPEERROR("headerrightcolor", LUA_TNUMBER)
|
||||
newgtrightcolor = (UINT8)lua_tointeger(L, 3);
|
||||
// Key name specified
|
||||
} else if ((!i) && (k && fasticmp(k, "headercolor"))) {
|
||||
if (!lua_isnumber(L, 3))
|
||||
TYPEERROR("headercolor", LUA_TNUMBER)
|
||||
newgtleftcolor = newgtrightcolor = (UINT8)lua_tointeger(L, 3);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
#undef FIELDERROR
|
||||
#undef TYPEERROR
|
||||
|
||||
// pop gametype table
|
||||
lua_pop(L, 1);
|
||||
|
||||
// Set defaults
|
||||
if (gtname == NULL)
|
||||
gtname = Z_StrDup("Unnamed gametype");
|
||||
if (gtdescription == NULL)
|
||||
gtdescription = Z_StrDup("???");
|
||||
|
||||
// Add the new gametype
|
||||
newgtidx = G_AddGametype(newgtrules);
|
||||
G_AddGametypeTOL(newgtidx, newgttol);
|
||||
G_SetGametypeDescription(newgtidx, NULL, newgtleftcolor, newgtrightcolor);
|
||||
strncpy(gametypedesc[newgtidx].notes, gtdescription, 441);
|
||||
|
||||
// Not covered by G_AddGametype alone.
|
||||
if (newgtrankingstype == -1)
|
||||
newgtrankingstype = newgtidx;
|
||||
gametyperankings[newgtidx] = newgtrankingstype;
|
||||
intermissiontypes[newgtidx] = newgtinttype;
|
||||
pointlimits[newgtidx] = newgtpointlimit;
|
||||
timelimits[newgtidx] = newgttimelimit;
|
||||
|
||||
// Write the new gametype name.
|
||||
Gametype_Names[newgtidx] = gtname;
|
||||
|
||||
// Write the constant name.
|
||||
if (gtconst == NULL)
|
||||
gtconst = gtname;
|
||||
G_AddGametypeConstant(newgtidx, gtconst);
|
||||
|
||||
// Update gametype_cons_t accordingly.
|
||||
G_UpdateGametypeSelections();
|
||||
|
||||
// done
|
||||
CONS_Printf("Added gametype %s\n", Gametype_Names[newgtidx]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_gBuildMapName(lua_State *L)
|
||||
{
|
||||
INT32 map = luaL_optinteger(L, 1, gamemap);
|
||||
|
@ -2664,23 +2804,17 @@ static int lib_gSetCustomExitVars(lua_State *L)
|
|||
// Supported:
|
||||
// G_SetCustomExitVars(); [reset to defaults]
|
||||
// G_SetCustomExitVars(int) [nextmap override only]
|
||||
// G_SetCustomExitVars(bool) [skipstats only]
|
||||
// G_SetCustomExitVars(int, bool) [both of the above]
|
||||
// G_SetCustomExitVars(nil, int) [skipstats only]
|
||||
// G_SetCustomExitVars(int, int) [both of the above]
|
||||
|
||||
nextmapoverride = 0;
|
||||
skipstats = 0;
|
||||
|
||||
if (n >= 1)
|
||||
{
|
||||
if (lua_isnumber(L, 1) || n >= 2)
|
||||
{
|
||||
nextmapoverride = (INT16)luaL_checknumber(L, 1);
|
||||
lua_remove(L, 1); // remove nextmapoverride; skipstats now 1 if available
|
||||
}
|
||||
skipstats = luaL_optinteger(L, 2, 0);
|
||||
nextmapoverride = (INT16)luaL_optinteger(L, 1, 0);
|
||||
skipstats = (INT16)luaL_optinteger(L, 2, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
nextmapoverride = 0;
|
||||
skipstats = 0;
|
||||
}
|
||||
// ---
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -2997,6 +3131,7 @@ static luaL_Reg lib[] = {
|
|||
{"S_StartMusicCaption", lib_sStartMusicCaption},
|
||||
|
||||
// g_game
|
||||
{"G_AddGametype", lib_gAddGametype},
|
||||
{"G_BuildMapName",lib_gBuildMapName},
|
||||
{"G_DoReborn",lib_gDoReborn},
|
||||
{"G_SetCustomExitVars",lib_gSetCustomExitVars},
|
||||
|
|
|
@ -245,7 +245,7 @@ static int lib_comBufAddText(lua_State *L)
|
|||
return LUA_ErrInvalid(L, "player_t");
|
||||
if (plr != &players[consoleplayer])
|
||||
return 0;
|
||||
COM_BufAddText(va("%s\n", luaL_checkstring(L, 2)));
|
||||
COM_BufAddTextEx(va("%s\n", luaL_checkstring(L, 2)), COM_SAFE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ static int lib_comBufInsertText(lua_State *L)
|
|||
return LUA_ErrInvalid(L, "player_t");
|
||||
if (plr != &players[consoleplayer])
|
||||
return 0;
|
||||
COM_BufInsertText(va("%s\n", luaL_checkstring(L, 2)));
|
||||
COM_BufInsertTextEx(va("%s\n", luaL_checkstring(L, 2)), COM_SAFE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ enum hook {
|
|||
hook_PlayerCanDamage,
|
||||
hook_PlayerQuit,
|
||||
hook_IntermissionThinker,
|
||||
hook_TeamSwitch,
|
||||
hook_ViewpointSwitch,
|
||||
|
||||
hook_MAX // last hook
|
||||
};
|
||||
|
@ -93,5 +95,7 @@ boolean LUAh_FollowMobj(player_t *player, mobj_t *mobj); // Hook for P_PlayerAft
|
|||
UINT8 LUAh_PlayerCanDamage(player_t *player, mobj_t *mobj); // Hook for P_PlayerCanDamage
|
||||
void LUAh_PlayerQuit(player_t *plr, int reason); // Hook for player quitting
|
||||
void LUAh_IntermissionThinker(void); // Hook for Y_Ticker
|
||||
boolean LUAh_TeamSwitch(player_t *player, int newteam, boolean fromspectators, boolean tryingautobalance, boolean tryingscramble); // Hook for team switching in... uh....
|
||||
UINT8 LUAh_ViewpointSwitch(player_t *player, player_t *newdisplayplayer, boolean forced); // Hook for spy mode
|
||||
|
||||
#endif
|
||||
|
|
|
@ -62,6 +62,8 @@ const char *const hookNames[hook_MAX+1] = {
|
|||
"PlayerCanDamage",
|
||||
"PlayerQuit",
|
||||
"IntermissionThinker",
|
||||
"TeamSwitch",
|
||||
"ViewpointSwitch",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -203,6 +205,8 @@ static int lib_addHook(lua_State *L)
|
|||
case hook_PlayerSpawn:
|
||||
case hook_FollowMobj:
|
||||
case hook_PlayerCanDamage:
|
||||
case hook_TeamSwitch:
|
||||
case hook_ViewpointSwitch:
|
||||
case hook_ShieldSpawn:
|
||||
case hook_ShieldSpecial:
|
||||
lastp = &playerhooks;
|
||||
|
@ -657,14 +661,16 @@ UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32
|
|||
LUA_PushUserdata(gL, inflictor, META_MOBJ);
|
||||
LUA_PushUserdata(gL, source, META_MOBJ);
|
||||
lua_pushinteger(gL, damage);
|
||||
lua_pushinteger(gL, damagetype);
|
||||
}
|
||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||
lua_pushvalue(gL, -5);
|
||||
lua_pushvalue(gL, -5);
|
||||
lua_pushvalue(gL, -5);
|
||||
lua_pushvalue(gL, -5);
|
||||
if (lua_pcall(gL, 4, 1, 0)) {
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
if (lua_pcall(gL, 5, 1, 0)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
|
@ -745,14 +751,16 @@ boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32
|
|||
LUA_PushUserdata(gL, inflictor, META_MOBJ);
|
||||
LUA_PushUserdata(gL, source, META_MOBJ);
|
||||
lua_pushinteger(gL, damage);
|
||||
lua_pushinteger(gL, damagetype);
|
||||
}
|
||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||
lua_pushvalue(gL, -5);
|
||||
lua_pushvalue(gL, -5);
|
||||
lua_pushvalue(gL, -5);
|
||||
lua_pushvalue(gL, -5);
|
||||
if (lua_pcall(gL, 4, 1, 0)) {
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
if (lua_pcall(gL, 5, 1, 0)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
|
@ -823,13 +831,15 @@ boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8
|
|||
LUA_PushUserdata(gL, target, META_MOBJ);
|
||||
LUA_PushUserdata(gL, inflictor, META_MOBJ);
|
||||
LUA_PushUserdata(gL, source, META_MOBJ);
|
||||
lua_pushinteger(gL, damagetype);
|
||||
}
|
||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||
lua_pushvalue(gL, -4);
|
||||
lua_pushvalue(gL, -4);
|
||||
lua_pushvalue(gL, -4);
|
||||
if (lua_pcall(gL, 3, 1, 0)) {
|
||||
lua_pushvalue(gL, -5);
|
||||
lua_pushvalue(gL, -5);
|
||||
lua_pushvalue(gL, -5);
|
||||
lua_pushvalue(gL, -5);
|
||||
if (lua_pcall(gL, 4, 1, 0)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
|
@ -1346,4 +1356,101 @@ void LUAh_IntermissionThinker(void)
|
|||
}
|
||||
}
|
||||
|
||||
// Hook for team switching
|
||||
// It's just an edit of LUAh_ViewpointSwitch.
|
||||
boolean LUAh_TeamSwitch(player_t *player, int newteam, boolean fromspectators, boolean tryingautobalance, boolean tryingscramble)
|
||||
{
|
||||
hook_p hookp;
|
||||
boolean canSwitchTeam = true;
|
||||
if (!gL || !(hooksAvailable[hook_TeamSwitch/8] & (1<<(hook_TeamSwitch%8))))
|
||||
return true;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
|
||||
for (hookp = playerhooks; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type != hook_TeamSwitch)
|
||||
continue;
|
||||
|
||||
if (lua_gettop(gL) == 0)
|
||||
{
|
||||
LUA_PushUserdata(gL, player, META_PLAYER);
|
||||
lua_pushinteger(gL, newteam);
|
||||
lua_pushboolean(gL, fromspectators);
|
||||
lua_pushboolean(gL, tryingautobalance);
|
||||
lua_pushboolean(gL, tryingscramble);
|
||||
}
|
||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
lua_pushvalue(gL, -6);
|
||||
if (lua_pcall(gL, 5, 1, 0)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
hookp->error = true;
|
||||
continue;
|
||||
}
|
||||
if (!lua_isnil(gL, -1) && !lua_toboolean(gL, -1))
|
||||
canSwitchTeam = false; // Can't switch team
|
||||
lua_pop(gL, 1);
|
||||
}
|
||||
|
||||
lua_settop(gL, 0);
|
||||
return canSwitchTeam;
|
||||
}
|
||||
|
||||
// Hook for spy mode
|
||||
UINT8 LUAh_ViewpointSwitch(player_t *player, player_t *newdisplayplayer, boolean forced)
|
||||
{
|
||||
hook_p hookp;
|
||||
UINT8 canSwitchView = 0; // 0 = default, 1 = force yes, 2 = force no.
|
||||
if (!gL || !(hooksAvailable[hook_ViewpointSwitch/8] & (1<<(hook_ViewpointSwitch%8))))
|
||||
return 0;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
hud_running = true;
|
||||
|
||||
for (hookp = playerhooks; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type != hook_ViewpointSwitch)
|
||||
continue;
|
||||
|
||||
if (lua_gettop(gL) == 0)
|
||||
{
|
||||
LUA_PushUserdata(gL, player, META_PLAYER);
|
||||
LUA_PushUserdata(gL, newdisplayplayer, META_PLAYER);
|
||||
lua_pushboolean(gL, forced);
|
||||
}
|
||||
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||
lua_pushvalue(gL, -4);
|
||||
lua_pushvalue(gL, -4);
|
||||
lua_pushvalue(gL, -4);
|
||||
if (lua_pcall(gL, 3, 1, 0)) {
|
||||
if (!hookp->error || cv_debug & DBG_LUA)
|
||||
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
|
||||
lua_pop(gL, 1);
|
||||
hookp->error = true;
|
||||
continue;
|
||||
}
|
||||
if (!lua_isnil(gL, -1))
|
||||
{ // if nil, leave canSwitchView = 0.
|
||||
if (lua_toboolean(gL, -1))
|
||||
canSwitchView = 1; // Force viewpoint switch
|
||||
else
|
||||
canSwitchView = 2; // Skip viewpoint switch
|
||||
}
|
||||
lua_pop(gL, 1);
|
||||
}
|
||||
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
|
||||
return canSwitchView;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -21,6 +21,7 @@ enum hud {
|
|||
// Match / CTF / Tag / Ringslinger
|
||||
hud_weaponrings,
|
||||
hud_powerstones,
|
||||
hud_teamscores,
|
||||
// NiGHTS mode
|
||||
hud_nightslink,
|
||||
hud_nightsdrill,
|
||||
|
@ -33,6 +34,9 @@ enum hud {
|
|||
hud_coopemeralds,
|
||||
hud_tokens,
|
||||
hud_tabemblems,
|
||||
// Intermission
|
||||
hud_intermissiontally,
|
||||
hud_intermissionmessages,
|
||||
hud_MAX
|
||||
};
|
||||
|
||||
|
@ -43,4 +47,5 @@ boolean LUA_HudEnabled(enum hud option);
|
|||
void LUAh_GameHUD(player_t *stplyr);
|
||||
void LUAh_ScoresHUD(void);
|
||||
void LUAh_TitleHUD(void);
|
||||
void LUAh_TitleCardHUD(player_t *stplyr);
|
||||
void LUAh_TitleCardHUD(player_t *stplayr);
|
||||
void LUAh_IntermissionHUD(void);
|
||||
|
|
133
src/lua_hudlib.c
133
src/lua_hudlib.c
|
@ -36,6 +36,11 @@ static UINT8 hud_enabled[(hud_MAX/8)+1];
|
|||
|
||||
static UINT8 hudAvailable; // hud hooks field
|
||||
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
static patchinfo_t *patchinfo, *patchinfohead;
|
||||
static int numluapatches;
|
||||
#endif
|
||||
|
||||
// must match enum hud in lua_hud.h
|
||||
static const char *const hud_disable_options[] = {
|
||||
"stagetitle",
|
||||
|
@ -48,6 +53,7 @@ static const char *const hud_disable_options[] = {
|
|||
|
||||
"weaponrings",
|
||||
"powerstones",
|
||||
"teamscores",
|
||||
|
||||
"nightslink",
|
||||
"nightsdrill",
|
||||
|
@ -60,6 +66,9 @@ static const char *const hud_disable_options[] = {
|
|||
"coopemeralds",
|
||||
"tokens",
|
||||
"tabemblems",
|
||||
|
||||
"intermissiontally",
|
||||
"intermissionmessages",
|
||||
NULL};
|
||||
|
||||
enum hudinfo {
|
||||
|
@ -92,12 +101,14 @@ static const char *const patch_opt[] = {
|
|||
enum hudhook {
|
||||
hudhook_game = 0,
|
||||
hudhook_scores,
|
||||
hudhook_intermission,
|
||||
hudhook_title,
|
||||
hudhook_titlecard
|
||||
};
|
||||
static const char *const hudhook_opt[] = {
|
||||
"game",
|
||||
"scores",
|
||||
"intermission",
|
||||
"title",
|
||||
"titlecard",
|
||||
NULL};
|
||||
|
@ -250,12 +261,17 @@ static int colormap_get(lua_State *L)
|
|||
|
||||
static int patch_get(lua_State *L)
|
||||
{
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
patch_t *patch = *((patch_t **)luaL_checkudata(L, 1, META_PATCH));
|
||||
#else
|
||||
patchinfo_t *patch = *((patchinfo_t **)luaL_checkudata(L, 1, META_PATCH));
|
||||
#endif
|
||||
enum patch field = luaL_checkoption(L, 2, NULL, patch_opt);
|
||||
|
||||
// patches are CURRENTLY always valid, expected to be cached with PU_STATIC
|
||||
// this may change in the future, so patch.valid still exists
|
||||
I_Assert(patch != NULL);
|
||||
if (!patch)
|
||||
return LUA_ErrInvalid(L, "patch_t");
|
||||
|
||||
switch (field)
|
||||
{
|
||||
|
@ -352,8 +368,59 @@ static int libd_patchExists(lua_State *L)
|
|||
|
||||
static int libd_cachePatch(lua_State *L)
|
||||
{
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
int i;
|
||||
lumpnum_t lumpnum;
|
||||
patchinfo_t *luapat;
|
||||
patch_t *realpatch;
|
||||
|
||||
HUDONLY
|
||||
LUA_PushUserdata(L, W_CachePatchName(luaL_checkstring(L, 1), PU_STATIC), META_PATCH);
|
||||
|
||||
luapat = patchinfohead;
|
||||
lumpnum = W_CheckNumForName(luaL_checkstring(L, 1));
|
||||
if (lumpnum == LUMPERROR)
|
||||
lumpnum = W_GetNumForName("MISSING");
|
||||
|
||||
for (i = 0; i < numluapatches; i++)
|
||||
{
|
||||
// check if already cached
|
||||
if (luapat->wadnum == WADFILENUM(lumpnum) && luapat->lumpnum == LUMPNUM(lumpnum))
|
||||
{
|
||||
LUA_PushUserdata(L, luapat, META_PATCH);
|
||||
return 1;
|
||||
}
|
||||
luapat = luapat->next;
|
||||
if (!luapat)
|
||||
break;
|
||||
}
|
||||
|
||||
if (numluapatches > 0)
|
||||
{
|
||||
patchinfo->next = Z_Malloc(sizeof(patchinfo_t), PU_STATIC, NULL);
|
||||
patchinfo = patchinfo->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
patchinfo = Z_Malloc(sizeof(patchinfo_t), PU_STATIC, NULL);
|
||||
patchinfohead = patchinfo;
|
||||
}
|
||||
|
||||
realpatch = W_CachePatchNum(lumpnum, PU_PATCH);
|
||||
|
||||
patchinfo->width = realpatch->width;
|
||||
patchinfo->height = realpatch->height;
|
||||
patchinfo->leftoffset = realpatch->leftoffset;
|
||||
patchinfo->topoffset = realpatch->topoffset;
|
||||
|
||||
patchinfo->wadnum = WADFILENUM(lumpnum);
|
||||
patchinfo->lumpnum = LUMPNUM(lumpnum);
|
||||
|
||||
LUA_PushUserdata(L, patchinfo, META_PATCH);
|
||||
numluapatches++;
|
||||
#else
|
||||
HUDONLY
|
||||
LUA_PushUserdata(L, W_CachePatchName(luaL_checkstring(L, 1), PU_PATCH), META_PATCH);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -409,7 +476,7 @@ static int libd_getSpritePatch(lua_State *L)
|
|||
return 0;
|
||||
|
||||
// push both the patch and it's "flip" value
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_STATIC), META_PATCH);
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_PATCH), META_PATCH);
|
||||
lua_pushboolean(L, (sprframe->flip & (1<<angle)) != 0);
|
||||
return 2;
|
||||
}
|
||||
|
@ -504,7 +571,7 @@ static int libd_getSprite2Patch(lua_State *L)
|
|||
return 0;
|
||||
|
||||
// push both the patch and it's "flip" value
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_STATIC), META_PATCH);
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_PATCH), META_PATCH);
|
||||
lua_pushboolean(L, (sprframe->flip & (1<<angle)) != 0);
|
||||
return 2;
|
||||
}
|
||||
|
@ -513,12 +580,22 @@ static int libd_draw(lua_State *L)
|
|||
{
|
||||
INT32 x, y, flags;
|
||||
patch_t *patch;
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
patchinfo_t *luapat;
|
||||
#endif
|
||||
const UINT8 *colormap = NULL;
|
||||
|
||||
HUDONLY
|
||||
x = luaL_checkinteger(L, 1);
|
||||
y = luaL_checkinteger(L, 2);
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
luapat = *((patchinfo_t **)luaL_checkudata(L, 3, META_PATCH));
|
||||
patch = W_CachePatchNum((luapat->wadnum<<16)+luapat->lumpnum, PU_PATCH);
|
||||
#else
|
||||
patch = *((patch_t **)luaL_checkudata(L, 3, META_PATCH));
|
||||
if (!patch)
|
||||
return LUA_ErrInvalid(L, "patch_t");
|
||||
#endif
|
||||
flags = luaL_optinteger(L, 4, 0);
|
||||
if (!lua_isnoneornil(L, 5))
|
||||
colormap = *((UINT8 **)luaL_checkudata(L, 5, META_COLORMAP));
|
||||
|
@ -534,6 +611,9 @@ static int libd_drawScaled(lua_State *L)
|
|||
fixed_t x, y, scale;
|
||||
INT32 flags;
|
||||
patch_t *patch;
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
patchinfo_t *luapat;
|
||||
#endif
|
||||
const UINT8 *colormap = NULL;
|
||||
|
||||
HUDONLY
|
||||
|
@ -542,7 +622,14 @@ static int libd_drawScaled(lua_State *L)
|
|||
scale = luaL_checkinteger(L, 3);
|
||||
if (scale < 0)
|
||||
return luaL_error(L, "negative scale");
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
luapat = *((patchinfo_t **)luaL_checkudata(L, 4, META_PATCH));
|
||||
patch = W_CachePatchNum((luapat->wadnum<<16)+luapat->lumpnum, PU_PATCH);
|
||||
#else
|
||||
patch = *((patch_t **)luaL_checkudata(L, 4, META_PATCH));
|
||||
if (!patch)
|
||||
return LUA_ErrInvalid(L, "patch_t");
|
||||
#endif
|
||||
flags = luaL_optinteger(L, 5, 0);
|
||||
if (!lua_isnoneornil(L, 6))
|
||||
colormap = *((UINT8 **)luaL_checkudata(L, 6, META_COLORMAP));
|
||||
|
@ -1041,6 +1128,10 @@ int LUA_HudLib(lua_State *L)
|
|||
{
|
||||
memset(hud_enabled, 0xff, (hud_MAX/8)+1);
|
||||
|
||||
#ifdef LUA_PATCH_SAFETY
|
||||
numluapatches = 0;
|
||||
#endif
|
||||
|
||||
lua_newtable(L); // HUD registry table
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, lib_draw);
|
||||
|
@ -1050,13 +1141,16 @@ int LUA_HudLib(lua_State *L)
|
|||
lua_rawseti(L, -2, 2); // HUD[2] = game rendering functions array
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 3); // HUD[2] = scores rendering functions array
|
||||
lua_rawseti(L, -2, 3); // HUD[3] = scores rendering functions array
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 4); // HUD[3] = title rendering functions array
|
||||
lua_rawseti(L, -2, 4); // HUD[4] = intermission rendering functions array
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 5); // HUD[4] = title card rendering functions array
|
||||
lua_rawseti(L, -2, 5); // HUD[5] = title rendering functions array
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 6); // HUD[6] = title card rendering functions array
|
||||
lua_setfield(L, LUA_REGISTRYINDEX, "HUD");
|
||||
|
||||
luaL_newmetatable(L, META_HUDINFO);
|
||||
|
@ -1228,4 +1322,29 @@ void LUAh_TitleCardHUD(player_t *stplayr)
|
|||
hud_running = false;
|
||||
}
|
||||
|
||||
void LUAh_IntermissionHUD(void)
|
||||
{
|
||||
if (!gL || !(hudAvailable & (1<<hudhook_intermission)))
|
||||
return;
|
||||
|
||||
hud_running = true;
|
||||
lua_pop(gL, -1);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_rawgeti(gL, -1, 4); // HUD[4] = rendering funcs
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_remove(gL, -3); // pop HUD
|
||||
lua_pushnil(gL);
|
||||
while (lua_next(gL, -3) != 0) {
|
||||
lua_pushvalue(gL, -3); // graphics library (HUD[1])
|
||||
LUA_Call(gL, 1);
|
||||
}
|
||||
lua_pop(gL, -1);
|
||||
hud_running = false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -266,7 +266,6 @@ static int lib_getSpriteInfo(lua_State *L)
|
|||
#define FIELDERROR(f, e) luaL_error(L, "bad value for " LUA_QL(f) " in table passed to spriteinfo[] (%s)", e);
|
||||
#define TYPEERROR(f, t1, t2) FIELDERROR(f, va("%s expected, got %s", lua_typename(L, t1), lua_typename(L, t2)))
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
static int PopPivotSubTable(spriteframepivot_t *pivot, lua_State *L, int stk, int idx)
|
||||
{
|
||||
int okcool = 0;
|
||||
|
@ -360,7 +359,6 @@ static int PopPivotTable(spriteinfo_t *info, lua_State *L, int stk)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int lib_setSpriteInfo(lua_State *L)
|
||||
{
|
||||
|
@ -393,14 +391,11 @@ static int lib_setSpriteInfo(lua_State *L)
|
|||
if (lua_isnumber(L, 2))
|
||||
{
|
||||
i = lua_tointeger(L, 2);
|
||||
#ifndef ROTSPRITE
|
||||
i++; // shift index in case of missing rotsprite support
|
||||
#endif
|
||||
}
|
||||
else
|
||||
str = luaL_checkstring(L, 2);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if (i == 1 || (str && fastcmp(str, "pivot")))
|
||||
{
|
||||
// pivot[] is a table
|
||||
|
@ -409,7 +404,6 @@ static int lib_setSpriteInfo(lua_State *L)
|
|||
else
|
||||
FIELDERROR("pivot", va("%s expected, got %s", lua_typename(L, LUA_TTABLE), luaL_typename(L, -1)))
|
||||
}
|
||||
#endif
|
||||
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
@ -434,7 +428,6 @@ static int spriteinfo_get(lua_State *L)
|
|||
|
||||
I_Assert(sprinfo != NULL);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
// push spriteframepivot_t userdata
|
||||
if (fastcmp(field, "pivot"))
|
||||
{
|
||||
|
@ -448,7 +441,6 @@ static int spriteinfo_get(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
return luaL_error(L, LUA_QL("spriteinfo_t") " has no field named " LUA_QS, field);
|
||||
|
||||
return 0;
|
||||
|
@ -473,6 +465,7 @@ static int spriteinfo_set(lua_State *L)
|
|||
#ifdef ROTSPRITE
|
||||
if (sprites != NULL)
|
||||
R_FreeSingleRotSprite(&sprites[sprinfo-spriteinfo]);
|
||||
#endif
|
||||
|
||||
if (fastcmp(field, "pivot"))
|
||||
{
|
||||
|
@ -488,7 +481,6 @@ static int spriteinfo_set(lua_State *L)
|
|||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
return luaL_error(L, va("Field %s does not exist in spriteinfo_t", field));
|
||||
|
||||
return 0;
|
||||
|
@ -506,7 +498,6 @@ static int spriteinfo_num(lua_State *L)
|
|||
}
|
||||
|
||||
// framepivot_t
|
||||
#ifdef ROTSPRITE
|
||||
static int pivotlist_get(lua_State *L)
|
||||
{
|
||||
void **userdata;
|
||||
|
@ -616,7 +607,6 @@ static int framepivot_num(lua_State *L)
|
|||
lua_pushinteger(L, 2);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
////////////////
|
||||
// STATE INFO //
|
||||
|
@ -1538,7 +1528,6 @@ int LUA_InfoLib(lua_State *L)
|
|||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L, 1);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
luaL_newmetatable(L, META_PIVOTLIST);
|
||||
lua_pushcfunction(L, pivotlist_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
|
@ -1560,7 +1549,6 @@ int LUA_InfoLib(lua_State *L)
|
|||
lua_pushcfunction(L, framepivot_num);
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L, 1);
|
||||
#endif
|
||||
|
||||
lua_newuserdata(L, 0);
|
||||
lua_createtable(L, 0, 2);
|
||||
|
|
|
@ -23,10 +23,8 @@ extern lua_State *gL;
|
|||
#define META_MOBJINFO "MOBJINFO_T*"
|
||||
#define META_SFXINFO "SFXINFO_T*"
|
||||
#define META_SPRITEINFO "SPRITEINFO_T*"
|
||||
#ifdef ROTSPRITE
|
||||
#define META_PIVOTLIST "SPRITEFRAMEPIVOT_T[]"
|
||||
#define META_FRAMEPIVOT "SPRITEFRAMEPIVOT_T*"
|
||||
#endif
|
||||
|
||||
#define META_MOBJ "MOBJ_T*"
|
||||
#define META_MAPTHING "MAPTHING_T*"
|
||||
|
|
|
@ -134,6 +134,7 @@ enum side_e {
|
|||
side_toptexture,
|
||||
side_bottomtexture,
|
||||
side_midtexture,
|
||||
side_line,
|
||||
side_sector,
|
||||
side_special,
|
||||
side_repeatcnt,
|
||||
|
@ -445,7 +446,7 @@ static int sectorlines_get(lua_State *L)
|
|||
// get the "linecount" by shifting our retrieved memory address of "lines" to where "linecount" is in the sector_t, then dereferencing the result
|
||||
// we need this to determine the array's actual size, and therefore also the maximum value allowed as an index
|
||||
// this only works if seclines is actually a pointer to a sector's lines member in memory, oh boy
|
||||
numoflines = (size_t)(*(seclines - (offsetof(sector_t, lines) - offsetof(sector_t, linecount))));
|
||||
numoflines = (size_t)(*(size_t *)(((size_t)seclines) - (offsetof(sector_t, lines) - offsetof(sector_t, linecount))));
|
||||
|
||||
/* OLD HACK
|
||||
// check first linedef to figure which of its sectors owns this sector->lines pointer
|
||||
|
@ -479,7 +480,7 @@ static int sectorlines_num(lua_State *L)
|
|||
return luaL_error(L, "accessed sector_t.lines doesn't exist anymore.");
|
||||
|
||||
// see comments in the _get function above
|
||||
numoflines = (size_t)(*(seclines - (offsetof(sector_t, lines) - offsetof(sector_t, linecount))));
|
||||
numoflines = (size_t)(*(size_t *)(((size_t)seclines) - (offsetof(sector_t, lines) - offsetof(sector_t, linecount))));
|
||||
lua_pushinteger(L, numoflines);
|
||||
return 1;
|
||||
}
|
||||
|
@ -869,6 +870,9 @@ static int side_get(lua_State *L)
|
|||
case side_midtexture:
|
||||
lua_pushinteger(L, side->midtexture);
|
||||
return 1;
|
||||
case side_line:
|
||||
LUA_PushUserdata(L, side->line, META_LINE);
|
||||
return 1;
|
||||
case side_sector:
|
||||
LUA_PushUserdata(L, side->sector, META_SECTOR);
|
||||
return 1;
|
||||
|
@ -902,6 +906,7 @@ static int side_set(lua_State *L)
|
|||
switch(field)
|
||||
{
|
||||
case side_valid: // valid
|
||||
case side_line:
|
||||
case side_sector:
|
||||
case side_special:
|
||||
case side_text:
|
||||
|
@ -2071,6 +2076,12 @@ static int mapheaderinfo_get(lua_State *L)
|
|||
lua_pushinteger(L, header->levelselect);
|
||||
else if (fastcmp(field,"bonustype"))
|
||||
lua_pushinteger(L, header->bonustype);
|
||||
else if (fastcmp(field,"ltzzpatch"))
|
||||
lua_pushstring(L, header->ltzzpatch);
|
||||
else if (fastcmp(field,"ltzztext"))
|
||||
lua_pushstring(L, header->ltzztext);
|
||||
else if (fastcmp(field,"ltactdiamond"))
|
||||
lua_pushstring(L, header->ltactdiamond);
|
||||
else if (fastcmp(field,"maxbonuslives"))
|
||||
lua_pushinteger(L, header->maxbonuslives);
|
||||
else if (fastcmp(field,"levelflags"))
|
||||
|
|
|
@ -32,9 +32,7 @@ enum mobj_e {
|
|||
mobj_snext,
|
||||
mobj_sprev,
|
||||
mobj_angle,
|
||||
#ifdef ROTSPRITE
|
||||
mobj_rollangle,
|
||||
#endif
|
||||
mobj_sprite,
|
||||
mobj_frame,
|
||||
mobj_sprite2,
|
||||
|
@ -101,9 +99,7 @@ static const char *const mobj_opt[] = {
|
|||
"snext",
|
||||
"sprev",
|
||||
"angle",
|
||||
#ifdef ROTSPRITE
|
||||
"rollangle",
|
||||
#endif
|
||||
"sprite",
|
||||
"frame",
|
||||
"sprite2",
|
||||
|
@ -205,11 +201,9 @@ static int mobj_get(lua_State *L)
|
|||
case mobj_angle:
|
||||
lua_pushangle(L, mo->angle);
|
||||
break;
|
||||
#ifdef ROTSPRITE
|
||||
case mobj_rollangle:
|
||||
lua_pushangle(L, mo->rollangle);
|
||||
break;
|
||||
#endif
|
||||
case mobj_sprite:
|
||||
lua_pushinteger(L, mo->sprite);
|
||||
break;
|
||||
|
@ -462,11 +456,9 @@ static int mobj_set(lua_State *L)
|
|||
else if (mo->player == &players[secondarydisplayplayer])
|
||||
localangle2 = mo->angle;
|
||||
break;
|
||||
#ifdef ROTSPRITE
|
||||
case mobj_rollangle:
|
||||
mo->rollangle = luaL_checkangle(L, 3);
|
||||
break;
|
||||
#endif
|
||||
case mobj_sprite:
|
||||
mo->sprite = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
|
|
240
src/lua_script.c
240
src/lua_script.c
|
@ -18,7 +18,9 @@
|
|||
#include "w_wad.h"
|
||||
#include "p_setup.h"
|
||||
#include "r_state.h"
|
||||
#include "r_sky.h"
|
||||
#include "g_game.h"
|
||||
#include "f_finale.h"
|
||||
#include "byteptr.h"
|
||||
#include "p_saveg.h"
|
||||
#include "p_local.h"
|
||||
|
@ -79,8 +81,239 @@ FUNCNORETURN static int LUA_Panic(lua_State *L)
|
|||
#endif
|
||||
}
|
||||
|
||||
// Moved here from lib_getenum.
|
||||
int LUA_PushGlobals(lua_State *L, const char *word)
|
||||
{
|
||||
if (fastcmp(word,"gamemap")) {
|
||||
lua_pushinteger(L, gamemap);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"maptol")) {
|
||||
lua_pushinteger(L, maptol);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"ultimatemode")) {
|
||||
lua_pushboolean(L, ultimatemode != 0);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"mariomode")) {
|
||||
lua_pushboolean(L, mariomode != 0);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"twodlevel")) {
|
||||
lua_pushboolean(L, twodlevel != 0);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"circuitmap")) {
|
||||
lua_pushboolean(L, circuitmap);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"netgame")) {
|
||||
lua_pushboolean(L, netgame);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"multiplayer")) {
|
||||
lua_pushboolean(L, multiplayer);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"modeattacking")) {
|
||||
lua_pushboolean(L, modeattacking);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"splitscreen")) {
|
||||
lua_pushboolean(L, splitscreen);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"gamecomplete")) {
|
||||
lua_pushboolean(L, gamecomplete);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"devparm")) {
|
||||
lua_pushboolean(L, devparm);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"modifiedgame")) {
|
||||
lua_pushboolean(L, modifiedgame && !savemoddata);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"menuactive")) {
|
||||
lua_pushboolean(L, menuactive);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"paused")) {
|
||||
lua_pushboolean(L, paused);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"bluescore")) {
|
||||
lua_pushinteger(L, bluescore);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"redscore")) {
|
||||
lua_pushinteger(L, redscore);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"timelimit")) {
|
||||
lua_pushinteger(L, cv_timelimit.value);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"pointlimit")) {
|
||||
lua_pushinteger(L, cv_pointlimit.value);
|
||||
return 1;
|
||||
// begin map vars
|
||||
} else if (fastcmp(word,"spstage_start")) {
|
||||
lua_pushinteger(L, spstage_start);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"sstage_start")) {
|
||||
lua_pushinteger(L, sstage_start);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"sstage_end")) {
|
||||
lua_pushinteger(L, sstage_end);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"smpstage_start")) {
|
||||
lua_pushinteger(L, smpstage_start);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"smpstage_end")) {
|
||||
lua_pushinteger(L, smpstage_end);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"titlemap")) {
|
||||
lua_pushinteger(L, titlemap);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"titlemapinaction")) {
|
||||
lua_pushboolean(L, (titlemapinaction != TITLEMAP_OFF));
|
||||
return 1;
|
||||
} else if (fastcmp(word,"bootmap")) {
|
||||
lua_pushinteger(L, bootmap);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"tutorialmap")) {
|
||||
lua_pushinteger(L, tutorialmap);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"tutorialmode")) {
|
||||
lua_pushboolean(L, tutorialmode);
|
||||
return 1;
|
||||
// end map vars
|
||||
// begin CTF colors
|
||||
} else if (fastcmp(word,"skincolor_redteam")) {
|
||||
lua_pushinteger(L, skincolor_redteam);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"skincolor_blueteam")) {
|
||||
lua_pushinteger(L, skincolor_blueteam);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"skincolor_redring")) {
|
||||
lua_pushinteger(L, skincolor_redring);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"skincolor_bluering")) {
|
||||
lua_pushinteger(L, skincolor_bluering);
|
||||
return 1;
|
||||
// end CTF colors
|
||||
// begin timers
|
||||
} else if (fastcmp(word,"invulntics")) {
|
||||
lua_pushinteger(L, invulntics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"sneakertics")) {
|
||||
lua_pushinteger(L, sneakertics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"flashingtics")) {
|
||||
lua_pushinteger(L, flashingtics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"tailsflytics")) {
|
||||
lua_pushinteger(L, tailsflytics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"underwatertics")) {
|
||||
lua_pushinteger(L, underwatertics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"spacetimetics")) {
|
||||
lua_pushinteger(L, spacetimetics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"extralifetics")) {
|
||||
lua_pushinteger(L, extralifetics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"nightslinktics")) {
|
||||
lua_pushinteger(L, nightslinktics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"gameovertics")) {
|
||||
lua_pushinteger(L, gameovertics);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"ammoremovaltics")) {
|
||||
lua_pushinteger(L, ammoremovaltics);
|
||||
return 1;
|
||||
// end timers
|
||||
} else if (fastcmp(word,"gametype")) {
|
||||
lua_pushinteger(L, gametype);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"gametyperules")) {
|
||||
lua_pushinteger(L, gametyperules);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"leveltime")) {
|
||||
lua_pushinteger(L, leveltime);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"sstimer")) {
|
||||
lua_pushinteger(L, sstimer);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"curWeather")) {
|
||||
lua_pushinteger(L, curWeather);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"globalweather")) {
|
||||
lua_pushinteger(L, globalweather);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"levelskynum")) {
|
||||
lua_pushinteger(L, levelskynum);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"globallevelskynum")) {
|
||||
lua_pushinteger(L, globallevelskynum);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"mapmusname")) {
|
||||
lua_pushstring(L, mapmusname);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"mapmusflags")) {
|
||||
lua_pushinteger(L, mapmusflags);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"mapmusposition")) {
|
||||
lua_pushinteger(L, mapmusposition);
|
||||
return 1;
|
||||
// local player variables, by popular request
|
||||
} else if (fastcmp(word,"consoleplayer")) { // player controlling console (aka local player 1)
|
||||
if (consoleplayer < 0 || !playeringame[consoleplayer])
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[consoleplayer], META_PLAYER);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"displayplayer")) { // player visible on screen (aka display player 1)
|
||||
if (displayplayer < 0 || !playeringame[displayplayer])
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[displayplayer], META_PLAYER);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"secondarydisplayplayer")) { // local/display player 2, for splitscreen
|
||||
if (!splitscreen || secondarydisplayplayer < 0 || !playeringame[secondarydisplayplayer])
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[secondarydisplayplayer], META_PLAYER);
|
||||
return 1;
|
||||
// end local player variables
|
||||
} else if (fastcmp(word,"server")) {
|
||||
if ((!multiplayer || !netgame) && !playeringame[serverplayer])
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[serverplayer], META_PLAYER);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"admin")) { // BACKWARDS COMPATIBILITY HACK: This was replaced with IsPlayerAdmin(), but some 2.1 Lua scripts still use the admin variable. It now points to the first admin player in the array.
|
||||
LUA_Deprecated(L, "admin", "IsPlayerAdmin(player)");
|
||||
if (!playeringame[adminplayers[0]] || IsPlayerAdmin(serverplayer))
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &players[adminplayers[0]], META_PLAYER);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"emeralds")) {
|
||||
lua_pushinteger(L, emeralds);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"gravity")) {
|
||||
lua_pushinteger(L, gravity);
|
||||
return 1;
|
||||
} else if (fastcmp(word,"VERSIONSTRING")) {
|
||||
lua_pushstring(L, VERSIONSTRING);
|
||||
return 1;
|
||||
} else if (fastcmp(word, "token")) {
|
||||
lua_pushinteger(L, token);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// See the above.
|
||||
int LUA_CheckGlobals(lua_State *L, const char *word)
|
||||
{
|
||||
if (fastcmp(word, "gametyperules"))
|
||||
gametyperules = (UINT32)luaL_checkinteger(L, 2);
|
||||
else if (fastcmp(word, "redscore"))
|
||||
redscore = (UINT32)luaL_checkinteger(L, 2);
|
||||
else if (fastcmp(word, "bluescore"))
|
||||
bluescore = (UINT32)luaL_checkinteger(L, 2);
|
||||
else
|
||||
return 0;
|
||||
|
||||
// Global variable set, so return and don't error.
|
||||
return 1;
|
||||
}
|
||||
|
||||
// This function decides which global variables you are allowed to set.
|
||||
static int noglobals(lua_State *L)
|
||||
static int setglobals(lua_State *L)
|
||||
{
|
||||
const char *csname;
|
||||
char *name;
|
||||
|
@ -106,6 +339,9 @@ static int noglobals(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (LUA_CheckGlobals(L, csname))
|
||||
return 0;
|
||||
|
||||
Z_Free(name);
|
||||
return luaL_error(L, "Implicit global " LUA_QS " prevented. Create a local variable instead.", csname);
|
||||
}
|
||||
|
@ -144,7 +380,7 @@ static void LUA_ClearState(void)
|
|||
|
||||
// lock the global namespace
|
||||
lua_getmetatable(L, LUA_GLOBALSINDEX);
|
||||
lua_pushcfunction(L, noglobals);
|
||||
lua_pushcfunction(L, setglobals);
|
||||
lua_setfield(L, -2, "__newindex");
|
||||
lua_newtable(L);
|
||||
lua_setfield(L, -2, "__metatable");
|
||||
|
|
|
@ -54,6 +54,8 @@ void LUA_InvalidatePlayer(player_t *player);
|
|||
void LUA_Step(void);
|
||||
void LUA_Archive(void);
|
||||
void LUA_UnArchive(void);
|
||||
int LUA_PushGlobals(lua_State *L, const char *word);
|
||||
int LUA_CheckGlobals(lua_State *L, const char *word);
|
||||
void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c
|
||||
void LUA_CVarChanged(const char *name); // lua_consolelib.c
|
||||
int Lua_optoption(lua_State *L, int narg,
|
||||
|
|
|
@ -517,6 +517,7 @@ void Command_Teleport_f(void)
|
|||
if (!starpostnum) // spawnpoints...
|
||||
{
|
||||
mapthing_t *mt;
|
||||
fixed_t offset;
|
||||
|
||||
if (starpostpath >= numcoopstarts)
|
||||
{
|
||||
|
@ -527,6 +528,7 @@ void Command_Teleport_f(void)
|
|||
mt = playerstarts[starpostpath]; // Given above check, should never be NULL.
|
||||
intx = mt->x<<FRACBITS;
|
||||
inty = mt->y<<FRACBITS;
|
||||
offset = mt->z<<FRACBITS;
|
||||
|
||||
ss = R_IsPointInSubsector(intx, inty);
|
||||
if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height)
|
||||
|
@ -538,17 +540,9 @@ void Command_Teleport_f(void)
|
|||
// Flagging a player's ambush will make them start on the ceiling
|
||||
// Objectflip inverts
|
||||
if (!!(mt->options & MTF_AMBUSH) ^ !!(mt->options & MTF_OBJECTFLIP))
|
||||
{
|
||||
intz = ss->sector->ceilingheight - p->mo->height;
|
||||
if (mt->options >> ZSHIFT)
|
||||
intz -= ((mt->options >> ZSHIFT) << FRACBITS);
|
||||
}
|
||||
intz = ss->sector->ceilingheight - p->mo->height - offset;
|
||||
else
|
||||
{
|
||||
intz = ss->sector->floorheight;
|
||||
if (mt->options >> ZSHIFT)
|
||||
intz += ((mt->options >> ZSHIFT) << FRACBITS);
|
||||
}
|
||||
intz = ss->sector->floorheight + offset;
|
||||
|
||||
if (mt->options & MTF_OBJECTFLIP) // flip the player!
|
||||
{
|
||||
|
@ -778,7 +772,7 @@ void Command_CauseCfail_f(void)
|
|||
P_SetThingPosition(players[consoleplayer].mo);
|
||||
|
||||
// CTF consistency test
|
||||
if (gametype == GT_CTF)
|
||||
if (gametyperules & GTR_TEAMFLAGS)
|
||||
{
|
||||
if (blueflag) {
|
||||
P_RemoveMobj(blueflag);
|
||||
|
@ -1106,7 +1100,7 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
|
|||
#else
|
||||
fixed_t cheight = sec->ceilingheight;
|
||||
#endif
|
||||
mt->options = (UINT16)((cheight - player->mo->z - player->mo->height)>>FRACBITS);
|
||||
mt->z = (UINT16)((cheight - player->mo->z - player->mo->height)>>FRACBITS);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1115,12 +1109,11 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
|
|||
#else
|
||||
fixed_t fheight = sec->floorheight;
|
||||
#endif
|
||||
mt->options = (UINT16)((player->mo->z - fheight)>>FRACBITS);
|
||||
mt->z = (UINT16)((player->mo->z - fheight)>>FRACBITS);
|
||||
}
|
||||
mt->options <<= ZSHIFT;
|
||||
mt->angle = (INT16)(FixedInt(AngleFixed(player->mo->angle)));
|
||||
|
||||
mt->options |= (UINT16)cv_opflags.value;
|
||||
mt->options = (mt->z << ZSHIFT) | (UINT16)cv_opflags.value;
|
||||
return mt;
|
||||
}
|
||||
|
||||
|
@ -1187,21 +1180,21 @@ void OP_NightsObjectplace(player_t *player)
|
|||
mt->options = (mt->options & ~(UINT16)cv_opflags.value) | (UINT16)cv_ophoopflags.value;
|
||||
mt->angle = (INT16)(mt->angle+(INT16)((FixedInt(FixedDiv(temp*FRACUNIT, 360*(FRACUNIT/256))))<<8));
|
||||
|
||||
P_SpawnHoopsAndRings(mt, false);
|
||||
P_SpawnHoop(mt);
|
||||
}
|
||||
|
||||
// This places a bumper!
|
||||
if (cmd->buttons & BT_TOSSFLAG)
|
||||
{
|
||||
UINT16 vertangle = (UINT16)(player->anotherflyangle % 360);
|
||||
UINT16 newflags, newz;
|
||||
UINT16 newflags;
|
||||
|
||||
player->pflags |= PF_ATTACKDOWN;
|
||||
if (!OP_HeightOkay(player, false))
|
||||
return;
|
||||
|
||||
mt = OP_CreateNewMapThing(player, (UINT16)mobjinfo[MT_NIGHTSBUMPER].doomednum, false);
|
||||
newz = min((mt->options >> ZSHIFT) - (mobjinfo[MT_NIGHTSBUMPER].height/4), 0);
|
||||
mt->z = min(mt->z - (mobjinfo[MT_NIGHTSBUMPER].height/4), 0);
|
||||
// height offset: from P_TouchSpecialThing case MT_NIGHTSBUMPER
|
||||
|
||||
// clockwise
|
||||
|
@ -1232,7 +1225,7 @@ void OP_NightsObjectplace(player_t *player)
|
|||
else // forward
|
||||
newflags = 0;
|
||||
|
||||
mt->options = (newz << ZSHIFT) | newflags;
|
||||
mt->options = (mt->z << ZSHIFT) | newflags;
|
||||
|
||||
// if NiGHTS is facing backwards, orient the Thing angle forwards so that the sprite angle
|
||||
// displays correctly. Backwards movement via the Thing flags is unaffected.
|
||||
|
@ -1250,7 +1243,7 @@ void OP_NightsObjectplace(player_t *player)
|
|||
return;
|
||||
|
||||
mt = OP_CreateNewMapThing(player, (UINT16)mobjinfo[MT_BLUESPHERE].doomednum, false);
|
||||
P_SpawnHoopsAndRings(mt, false);
|
||||
P_SpawnMapThing(mt);
|
||||
}
|
||||
|
||||
// This places a ring!
|
||||
|
@ -1261,7 +1254,7 @@ void OP_NightsObjectplace(player_t *player)
|
|||
return;
|
||||
|
||||
mt = OP_CreateNewMapThing(player, (UINT16)mobjinfo[MT_RING].doomednum, false);
|
||||
P_SpawnHoopsAndRings(mt, false);
|
||||
P_SpawnMapThing(mt);
|
||||
}
|
||||
|
||||
// This places a custom object as defined in the console cv_mapthingnum.
|
||||
|
@ -1293,15 +1286,10 @@ void OP_NightsObjectplace(player_t *player)
|
|||
mt = OP_CreateNewMapThing(player, (UINT16)cv_mapthingnum.value, false);
|
||||
mt->angle = angle;
|
||||
|
||||
if (mt->type == 300 // Ring
|
||||
|| mt->type == 308 || mt->type == 309 // Team Rings
|
||||
|| mt->type == 1706 // Sphere
|
||||
|| (mt->type >= 600 && mt->type <= 609) // Placement patterns
|
||||
|| mt->type == 1705 || mt->type == 1713 // NiGHTS Hoops
|
||||
|| mt->type == 1800) // Mario Coin
|
||||
{
|
||||
P_SpawnHoopsAndRings(mt, false);
|
||||
}
|
||||
if (mt->type >= 600 && mt->type <= 609) // Placement patterns
|
||||
P_SpawnItemPattern(mt, false);
|
||||
else if (mt->type == 1705 || mt->type == 1713) // NiGHTS Hoops
|
||||
P_SpawnHoop(mt);
|
||||
else
|
||||
P_SpawnMapThing(mt);
|
||||
}
|
||||
|
@ -1438,19 +1426,14 @@ void OP_ObjectplaceMovement(player_t *player)
|
|||
return;
|
||||
|
||||
mt = OP_CreateNewMapThing(player, (UINT16)spawnthing, ceiling);
|
||||
if (mt->type == 300 // Ring
|
||||
|| mt->type == 308 || mt->type == 309 // Team Rings
|
||||
|| mt->type == 1706 // Nights Wing
|
||||
|| (mt->type >= 600 && mt->type <= 609) // Placement patterns
|
||||
|| mt->type == 1705 || mt->type == 1713 // NiGHTS Hoops
|
||||
|| mt->type == 1800) // Mario Coin
|
||||
{
|
||||
P_SpawnHoopsAndRings(mt, false);
|
||||
}
|
||||
if (mt->type >= 600 && mt->type <= 609) // Placement patterns
|
||||
P_SpawnItemPattern(mt, false);
|
||||
else if (mt->type == 1705 || mt->type == 1713) // NiGHTS Hoops
|
||||
P_SpawnHoop(mt);
|
||||
else
|
||||
P_SpawnMapThing(mt);
|
||||
|
||||
CONS_Printf(M_GetText("Placed object type %d at %d, %d, %d, %d\n"), mt->type, mt->x, mt->y, mt->options>>ZSHIFT, mt->angle);
|
||||
CONS_Printf(M_GetText("Placed object type %d at %d, %d, %d, %d\n"), mt->type, mt->x, mt->y, mt->z, mt->angle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
490
src/m_menu.c
490
src/m_menu.c
File diff suppressed because it is too large
Load diff
|
@ -373,6 +373,7 @@ typedef struct
|
|||
UINT8 col[2];
|
||||
char notes[441];
|
||||
} gtdesc_t;
|
||||
extern gtdesc_t gametypedesc[NUMGAMETYPES];
|
||||
|
||||
// mode descriptions for video mode menu
|
||||
typedef struct
|
||||
|
|
21
src/m_misc.c
21
src/m_misc.c
|
@ -1779,7 +1779,7 @@ char *M_GetToken(const char *inputString)
|
|||
|| stringToUse[startPos] == '\r'
|
||||
|| stringToUse[startPos] == '\n'
|
||||
|| stringToUse[startPos] == '\0'
|
||||
|| stringToUse[startPos] == '"' // we're treating this as whitespace because SLADE likes adding it for no good reason
|
||||
|| stringToUse[startPos] == '=' || stringToUse[startPos] == ';' // UDMF TEXTMAP.
|
||||
|| inComment != 0)
|
||||
&& startPos < stringLength)
|
||||
{
|
||||
|
@ -1837,6 +1837,23 @@ char *M_GetToken(const char *inputString)
|
|||
texturesToken[1] = '\0';
|
||||
return texturesToken;
|
||||
}
|
||||
// Return entire string within quotes, except without the quotes.
|
||||
else if (stringToUse[startPos] == '"')
|
||||
{
|
||||
endPos = ++startPos;
|
||||
while (stringToUse[endPos] != '"' && endPos < stringLength)
|
||||
endPos++;
|
||||
|
||||
texturesTokenLength = endPos++ - startPos;
|
||||
// Assign the memory. Don't forget an extra byte for the end of the string!
|
||||
texturesToken = (char *)Z_Malloc((texturesTokenLength+1)*sizeof(char),PU_STATIC,NULL);
|
||||
// Copy the string.
|
||||
M_Memcpy(texturesToken, stringToUse+startPos, (size_t)texturesTokenLength);
|
||||
// Make the final character NUL.
|
||||
texturesToken[texturesTokenLength] = '\0';
|
||||
|
||||
return texturesToken;
|
||||
}
|
||||
|
||||
// Now find the end of the token. This includes several additional characters that are okay to capture as one character, but not trailing at the end of another token.
|
||||
endPos = startPos + 1;
|
||||
|
@ -1847,7 +1864,7 @@ char *M_GetToken(const char *inputString)
|
|||
&& stringToUse[endPos] != ','
|
||||
&& stringToUse[endPos] != '{'
|
||||
&& stringToUse[endPos] != '}'
|
||||
&& stringToUse[endPos] != '"' // see above
|
||||
&& stringToUse[endPos] != '=' && stringToUse[endPos] != ';' // UDMF TEXTMAP.
|
||||
&& inComment == 0)
|
||||
&& endPos < stringLength)
|
||||
{
|
||||
|
|
|
@ -181,11 +181,9 @@ void A_SpawnObjectAbsolute(mobj_t *actor);
|
|||
void A_SpawnObjectRelative(mobj_t *actor);
|
||||
void A_ChangeAngleRelative(mobj_t *actor);
|
||||
void A_ChangeAngleAbsolute(mobj_t *actor);
|
||||
#ifdef ROTSPRITE
|
||||
void A_RollAngle(mobj_t *actor);
|
||||
void A_ChangeRollAngleRelative(mobj_t *actor);
|
||||
void A_ChangeRollAngleAbsolute(mobj_t *actor);
|
||||
#endif // ROTSPRITE
|
||||
void A_PlaySound(mobj_t *actor);
|
||||
void A_FindTarget(mobj_t *actor);
|
||||
void A_FindTracer(mobj_t *actor);
|
||||
|
@ -2263,7 +2261,7 @@ void A_CrushclawLaunch(mobj_t *actor)
|
|||
while (chain)
|
||||
{
|
||||
P_TeleportMove(chain, actor->target->x + idx, actor->target->y + idy, actor->target->z + idz);
|
||||
chain->watertop = chain->z;
|
||||
chain->movefactor = chain->z;
|
||||
idx += dx;
|
||||
idy += dy;
|
||||
idz += dz;
|
||||
|
@ -4985,7 +4983,7 @@ void A_ThrownRing(mobj_t *actor)
|
|||
continue;
|
||||
|
||||
// Don't home in on teammates.
|
||||
if (gametype == GT_CTF
|
||||
if ((gametyperules & GTR_TEAMFLAGS)
|
||||
&& actor->target->player->ctfteam == player->ctfteam)
|
||||
continue;
|
||||
}
|
||||
|
@ -6591,7 +6589,7 @@ void A_OldRingExplode(mobj_t *actor) {
|
|||
|
||||
if (changecolor)
|
||||
{
|
||||
if (gametype != GT_CTF)
|
||||
if (!(gametyperules & GTR_TEAMFLAGS))
|
||||
mo->color = actor->target->color; //copy color
|
||||
else if (actor->target->player->ctfteam == 2)
|
||||
mo->color = skincolor_bluering;
|
||||
|
@ -6607,7 +6605,7 @@ void A_OldRingExplode(mobj_t *actor) {
|
|||
|
||||
if (changecolor)
|
||||
{
|
||||
if (gametype != GT_CTF)
|
||||
if (!(gametyperules & GTR_TEAMFLAGS))
|
||||
mo->color = actor->target->color; //copy color
|
||||
else if (actor->target->player->ctfteam == 2)
|
||||
mo->color = skincolor_bluering;
|
||||
|
@ -6622,7 +6620,7 @@ void A_OldRingExplode(mobj_t *actor) {
|
|||
|
||||
if (changecolor)
|
||||
{
|
||||
if (gametype != GT_CTF)
|
||||
if (!(gametyperules & GTR_TEAMFLAGS))
|
||||
mo->color = actor->target->color; //copy color
|
||||
else if (actor->target->player->ctfteam == 2)
|
||||
mo->color = skincolor_bluering;
|
||||
|
@ -8627,7 +8625,6 @@ void A_ChangeAngleAbsolute(mobj_t *actor)
|
|||
actor->angle = FixedAngle(P_RandomRange(amin, amax));
|
||||
}
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
// Function: A_RollAngle
|
||||
//
|
||||
// Description: Changes the roll angle.
|
||||
|
@ -8663,16 +8660,10 @@ void A_RollAngle(mobj_t *actor)
|
|||
//
|
||||
void A_ChangeRollAngleRelative(mobj_t *actor)
|
||||
{
|
||||
// Oh god, the old code /sucked/. Changed this and the absolute version to get a random range using amin and amax instead of
|
||||
// getting a random angle from the _entire_ spectrum and then clipping. While we're at it, do the angle conversion to the result
|
||||
// rather than the ranges, so <0 and >360 work as possible values. -Red
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
//angle_t angle = (P_RandomByte()+1)<<24;
|
||||
const fixed_t amin = locvar1*FRACUNIT;
|
||||
const fixed_t amax = locvar2*FRACUNIT;
|
||||
//const angle_t amin = FixedAngle(locvar1*FRACUNIT);
|
||||
//const angle_t amax = FixedAngle(locvar2*FRACUNIT);
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_ChangeRollAngleRelative", actor))
|
||||
return;
|
||||
|
@ -8682,11 +8673,6 @@ void A_ChangeRollAngleRelative(mobj_t *actor)
|
|||
if (amin > amax)
|
||||
I_Error("A_ChangeRollAngleRelative: var1 is greater than var2");
|
||||
#endif
|
||||
/*
|
||||
if (angle < amin)
|
||||
angle = amin;
|
||||
if (angle > amax)
|
||||
angle = amax;*/
|
||||
|
||||
actor->rollangle += FixedAngle(P_RandomRange(amin, amax));
|
||||
}
|
||||
|
@ -8702,11 +8688,8 @@ void A_ChangeRollAngleAbsolute(mobj_t *actor)
|
|||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
//angle_t angle = (P_RandomByte()+1)<<24;
|
||||
const fixed_t amin = locvar1*FRACUNIT;
|
||||
const fixed_t amax = locvar2*FRACUNIT;
|
||||
//const angle_t amin = FixedAngle(locvar1*FRACUNIT);
|
||||
//const angle_t amax = FixedAngle(locvar2*FRACUNIT);
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_ChangeRollAngleAbsolute", actor))
|
||||
return;
|
||||
|
@ -8716,15 +8699,9 @@ void A_ChangeRollAngleAbsolute(mobj_t *actor)
|
|||
if (amin > amax)
|
||||
I_Error("A_ChangeRollAngleAbsolute: var1 is greater than var2");
|
||||
#endif
|
||||
/*
|
||||
if (angle < amin)
|
||||
angle = amin;
|
||||
if (angle > amax)
|
||||
angle = amax;*/
|
||||
|
||||
actor->rollangle = FixedAngle(P_RandomRange(amin, amax));
|
||||
}
|
||||
#endif // ROTSPRITE
|
||||
|
||||
// Function: A_PlaySound
|
||||
//
|
||||
|
@ -13614,12 +13591,12 @@ static boolean PIT_DustDevilLaunch(mobj_t *thing)
|
|||
}
|
||||
else
|
||||
{ //Player on the top of the tornado.
|
||||
P_ResetPlayer(player);
|
||||
thing->z = dustdevil->z + dustdevil->height;
|
||||
thrust = 20 * FRACUNIT;
|
||||
player->powers[pw_nocontrol] = 0;
|
||||
S_StartSound(thing, sfx_wdjump);
|
||||
P_SetPlayerMobjState(thing, S_PLAY_FALL);
|
||||
player->pflags &= ~PF_JUMPED;
|
||||
}
|
||||
|
||||
thing->momz = thrust;
|
||||
|
@ -14248,7 +14225,7 @@ void A_SaloonDoorSpawn(mobj_t *actor)
|
|||
fixed_t c = FINECOSINE(fa)*locvar2;
|
||||
fixed_t s = FINESINE(fa)*locvar2;
|
||||
mobj_t *door;
|
||||
mobjflag2_t ambush = (actor->flags & MF2_AMBUSH);
|
||||
mobjflag2_t ambush = (actor->flags2 & MF2_AMBUSH);
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_SaloonDoorSpawn", actor))
|
||||
|
@ -14712,20 +14689,35 @@ void A_DragonWing(mobj_t *actor)
|
|||
void A_DragonSegment(mobj_t *actor)
|
||||
{
|
||||
mobj_t *target = actor->target;
|
||||
fixed_t dist = P_AproxDistance(P_AproxDistance(actor->x - target->x, actor->y - target->y), actor->z - target->z);
|
||||
fixed_t radius = actor->radius + target->radius;
|
||||
angle_t hangle = R_PointToAngle2(target->x, target->y, actor->x, actor->y);
|
||||
angle_t zangle = R_PointToAngle2(0, target->z, dist, actor->z);
|
||||
fixed_t hdist = P_ReturnThrustX(target, zangle, radius);
|
||||
fixed_t xdist = P_ReturnThrustX(target, hangle, hdist);
|
||||
fixed_t ydist = P_ReturnThrustY(target, hangle, hdist);
|
||||
fixed_t zdist = P_ReturnThrustY(target, zangle, radius);
|
||||
fixed_t dist;
|
||||
fixed_t radius;
|
||||
angle_t hangle;
|
||||
angle_t zangle;
|
||||
fixed_t hdist;
|
||||
fixed_t xdist;
|
||||
fixed_t ydist;
|
||||
fixed_t zdist;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_DragonSegment", actor))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (target == NULL || !target->health)
|
||||
{
|
||||
P_RemoveMobj(actor);
|
||||
return;
|
||||
}
|
||||
|
||||
dist = P_AproxDistance(P_AproxDistance(actor->x - target->x, actor->y - target->y), actor->z - target->z);
|
||||
radius = actor->radius + target->radius;
|
||||
hangle = R_PointToAngle2(target->x, target->y, actor->x, actor->y);
|
||||
zangle = R_PointToAngle2(0, target->z, dist, actor->z);
|
||||
hdist = P_ReturnThrustX(target, zangle, radius);
|
||||
xdist = P_ReturnThrustX(target, hangle, hdist);
|
||||
ydist = P_ReturnThrustY(target, hangle, hdist);
|
||||
zdist = P_ReturnThrustY(target, zangle, radius);
|
||||
|
||||
actor->angle = hangle;
|
||||
P_TeleportMove(actor, target->x + xdist, target->y + ydist, target->z + zdist);
|
||||
}
|
||||
|
|
|
@ -625,7 +625,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
|
||||
P_AddPlayerScore(player, 1000);
|
||||
|
||||
if (gametype != GT_COOP || modeattacking) // score only?
|
||||
if (!(gametyperules & GTR_SPECIALSTAGES) || modeattacking) // score only?
|
||||
{
|
||||
S_StartSound(toucher, sfx_chchng);
|
||||
break;
|
||||
|
@ -1888,7 +1888,7 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour
|
|||
char targetname[MAXPLAYERNAME+4];
|
||||
char sourcename[MAXPLAYERNAME+4];
|
||||
|
||||
if (G_PlatformGametype())
|
||||
if (!(gametyperules & (GTR_RINGSLINGER|GTR_HURTMESSAGES)))
|
||||
return; // Not in coop, etc.
|
||||
|
||||
if (!player)
|
||||
|
@ -2093,7 +2093,7 @@ void P_CheckTimeLimit(void)
|
|||
if (!(multiplayer || netgame))
|
||||
return;
|
||||
|
||||
if (G_PlatformGametype())
|
||||
if (!(gametyperules & GTR_TIMELIMIT))
|
||||
return;
|
||||
|
||||
if (leveltime < timelimitintics)
|
||||
|
@ -2124,7 +2124,7 @@ void P_CheckTimeLimit(void)
|
|||
}
|
||||
|
||||
//Optional tie-breaker for Match/CTF
|
||||
else if (cv_overtime.value)
|
||||
else if ((cv_overtime.value) && (gametyperules & GTR_OVERTIME))
|
||||
{
|
||||
INT32 playerarray[MAXPLAYERS];
|
||||
INT32 tempplayer = 0;
|
||||
|
@ -2206,7 +2206,7 @@ void P_CheckPointLimit(void)
|
|||
if (!(multiplayer || netgame))
|
||||
return;
|
||||
|
||||
if (G_PlatformGametype())
|
||||
if (!(gametyperules & GTR_POINTLIMIT))
|
||||
return;
|
||||
|
||||
// pointlimit is nonzero, check if it's been reached by this player
|
||||
|
@ -2389,7 +2389,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
{
|
||||
if (metalrecording) // Ack! Metal Sonic shouldn't die! Cut the tape, end recording!
|
||||
G_StopMetalRecording(true);
|
||||
if (gametype == GT_MATCH // note, no team match suicide penalty
|
||||
if ((gametyperules & GTR_DEATHPENALTY) // note, no team match suicide penalty
|
||||
&& ((target == source) || (source == NULL && inflictor == NULL) || (source && !source->player)))
|
||||
{ // Suicide penalty
|
||||
if (target->player->score >= 50)
|
||||
|
@ -2481,9 +2481,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
|
||||
P_SetMobjState(scoremobj, scorestate);
|
||||
|
||||
// On ground? No chain starts.
|
||||
if (source->player->powers[pw_invulnerability] || !P_IsObjectOnGround(source))
|
||||
source->player->scoreadd = locscoreadd;
|
||||
source->player->scoreadd = locscoreadd;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2978,7 +2976,7 @@ static void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
|
|||
player->flyangle += 180; // Shuffle's BETTERNIGHTSMOVEMENT?
|
||||
player->flyangle %= 360;
|
||||
|
||||
if (gametype == GT_RACE || gametype == GT_COMPETITION)
|
||||
if (gametyperules & GTR_RACE)
|
||||
player->drillmeter -= 5*20;
|
||||
else
|
||||
{
|
||||
|
@ -3005,9 +3003,7 @@ static void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
|
|||
P_SetPlayerMobjState(target, S_PLAY_NIGHTS_STUN);
|
||||
S_StartSound(target, sfx_nghurt);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
player->mo->rollangle = 0;
|
||||
#endif
|
||||
|
||||
if (oldnightstime > 10*TICRATE
|
||||
&& player->nightstime < 10*TICRATE)
|
||||
|
@ -3042,7 +3038,7 @@ static boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, IN
|
|||
return false;
|
||||
|
||||
// Ignore IT players shooting each other, unless friendlyfire is on.
|
||||
if ((player->pflags & PF_TAGIT && !((cv_friendlyfire.value || (damagetype & DMG_CANHURTSELF)) &&
|
||||
if ((player->pflags & PF_TAGIT && !((cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE) || (damagetype & DMG_CANHURTSELF)) &&
|
||||
source && source->player && source->player->pflags & PF_TAGIT)))
|
||||
{
|
||||
if (inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK))
|
||||
|
@ -3058,7 +3054,7 @@ static boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, IN
|
|||
|
||||
// Don't allow players on the same team to hurt one another,
|
||||
// unless cv_friendlyfire is on.
|
||||
if (!(cv_friendlyfire.value || (damagetype & DMG_CANHURTSELF)) && (player->pflags & PF_TAGIT) == (source->player->pflags & PF_TAGIT))
|
||||
if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE) || (damagetype & DMG_CANHURTSELF)) && (player->pflags & PF_TAGIT) == (source->player->pflags & PF_TAGIT))
|
||||
{
|
||||
if (inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK))
|
||||
{
|
||||
|
@ -3143,7 +3139,7 @@ static boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj_t *sou
|
|||
return false;
|
||||
|
||||
// In COOP/RACE, you can't hurt other players unless cv_friendlyfire is on
|
||||
if (!cv_friendlyfire.value && (G_PlatformGametype()))
|
||||
if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE)) && (G_PlatformGametype()))
|
||||
{
|
||||
if (gametype == GT_COOP && inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK)) // co-op only
|
||||
{
|
||||
|
@ -3166,7 +3162,7 @@ static boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj_t *sou
|
|||
{
|
||||
// Don't allow players on the same team to hurt one another,
|
||||
// unless cv_friendlyfire is on.
|
||||
if (!cv_friendlyfire.value && target->player->ctfteam == source->player->ctfteam)
|
||||
if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE)) && target->player->ctfteam == source->player->ctfteam)
|
||||
{
|
||||
if (inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK))
|
||||
{
|
||||
|
@ -3224,7 +3220,7 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage)
|
|||
player->mo->flags2 &= ~MF2_DONTDRAW;
|
||||
|
||||
P_SetPlayerMobjState(player->mo, player->mo->info->deathstate);
|
||||
if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
if ((gametyperules & GTR_TEAMFLAGS) && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
{
|
||||
P_PlayerFlagBurst(player, false);
|
||||
if (source && source->player)
|
||||
|
@ -3349,7 +3345,7 @@ static void P_ShieldDamage(player_t *player, mobj_t *inflictor, mobj_t *source,
|
|||
else
|
||||
S_StartSound (player->mo, sfx_shldls); // Ba-Dum! Shield loss.
|
||||
|
||||
if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
if ((gametyperules & GTR_TEAMFLAGS) && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
{
|
||||
P_PlayerFlagBurst(player, false);
|
||||
if (source && source->player)
|
||||
|
@ -3383,7 +3379,7 @@ static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, IN
|
|||
P_AddPlayerScore(source->player, 50);
|
||||
}
|
||||
|
||||
if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
if ((gametyperules & GTR_TEAMFLAGS) && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
|
||||
{
|
||||
P_PlayerFlagBurst(player, false);
|
||||
if (source && source->player)
|
||||
|
@ -3426,6 +3422,24 @@ void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source)
|
|||
if (player->powers[pw_invulnerability] || player->powers[pw_flashing] || player->powers[pw_super])
|
||||
return;
|
||||
|
||||
if (!cv_friendlyfire.value)
|
||||
{
|
||||
if (inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK))
|
||||
{
|
||||
if (player->revitem != MT_LHRT && player->spinitem != MT_LHRT && player->thokitem != MT_LHRT) // Healers do not get to heal other healers.
|
||||
{
|
||||
P_SwitchShield(player, SH_PINK);
|
||||
S_StartSound(player->mo, mobjinfo[MT_PITY_ICON].seesound);
|
||||
}
|
||||
}
|
||||
|
||||
if (source->player->ctfteam == player->ctfteam)
|
||||
return;
|
||||
}
|
||||
|
||||
if (inflictor->type == MT_LHRT)
|
||||
return;
|
||||
|
||||
if (player->powers[pw_shield] || player->bot) //If One-Hit Shield
|
||||
{
|
||||
P_RemoveShield(player);
|
||||
|
@ -3442,7 +3456,7 @@ void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source)
|
|||
|
||||
P_DoPlayerPain(player, inflictor, source);
|
||||
|
||||
if (gametype == GT_CTF && player->gotflag & (GF_REDFLAG|GF_BLUEFLAG))
|
||||
if ((gametyperules & GTR_TEAMFLAGS) && player->gotflag & (GF_REDFLAG|GF_BLUEFLAG))
|
||||
P_PlayerFlagBurst(player, false);
|
||||
|
||||
if (oldnightstime > 10*TICRATE
|
||||
|
@ -3593,7 +3607,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
{
|
||||
if (source == target)
|
||||
return false; // Don't hit yourself with your own paraloop, baka
|
||||
if (source && source->player && !cv_friendlyfire.value
|
||||
if (source && source->player && !(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE))
|
||||
&& (gametype == GT_COOP
|
||||
|| (G_GametypeHasTeams() && player->ctfteam == source->player->ctfteam)))
|
||||
return false; // Don't run eachother over in special stages and team games and such
|
||||
|
@ -3688,7 +3702,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
// by friendly fire. Spilling their rings and other items is enough.
|
||||
else if (!force && G_GametypeHasTeams()
|
||||
&& source && source->player && (source->player->ctfteam == player->ctfteam)
|
||||
&& cv_friendlyfire.value)
|
||||
&& (cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE)))
|
||||
{
|
||||
damage = 0;
|
||||
P_ShieldDamage(player, inflictor, source, damage, damagetype);
|
||||
|
|
12
src/p_map.c
12
src/p_map.c
|
@ -615,7 +615,7 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails)
|
|||
// Why block opposing teams from tailsflying each other?
|
||||
// Sneaking into the hands of a flying tails player in Race might be a viable strategy, who knows.
|
||||
/*
|
||||
if (gametype == GT_RACE || gametype == GT_COMPETITION
|
||||
if ((gametyperules & GTR_RACE)
|
||||
|| (netgame && (tails->spectator || sonic->spectator))
|
||||
|| (G_TagGametype() && (!(tails->pflags & PF_TAGIT) != !(sonic->pflags & PF_TAGIT)))
|
||||
|| (gametype == GT_MATCH)
|
||||
|
@ -829,13 +829,13 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
for (iter = thing->subsector->sector->thinglist; iter; iter = iter->snext)
|
||||
if (iter->type == thing->type && iter->health > 0 && iter->flags & MF_SOLID && (iter == thing || P_AproxDistance(P_AproxDistance(thing->x - iter->x, thing->y - iter->y), thing->z - iter->z) < 56*thing->scale))//FixedMul(56*FRACUNIT, thing->scale))
|
||||
P_KillMobj(iter, tmthing, tmthing, 0);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
thing->health = 0;
|
||||
P_KillMobj(thing, tmthing, tmthing, 0);
|
||||
if (P_DamageMobj(thing, tmthing, tmthing, 1, 0))
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// vectorise metal - done in a special case as at this point neither has the right flags for touching
|
||||
|
@ -995,7 +995,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
if (thing->type == MT_SALOONDOOR && tmthing->player)
|
||||
{
|
||||
mobj_t *ref = (tmthing->player->powers[pw_carry] == CR_MINECART && tmthing->tracer && !P_MobjWasRemoved(tmthing->tracer)) ? tmthing->tracer : tmthing;
|
||||
if ((thing->flags & MF2_AMBUSH) || ref != tmthing)
|
||||
if ((thing->flags2 & MF2_AMBUSH) || ref != tmthing)
|
||||
{
|
||||
fixed_t dm = min(FixedHypot(ref->momx, ref->momy), 16*FRACUNIT);
|
||||
angle_t ang = R_PointToAngle2(0, 0, ref->momx, ref->momy) - thing->angle;
|
||||
|
@ -1008,7 +1008,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
|
||||
if (thing->type == MT_SALOONDOORCENTER && tmthing->player)
|
||||
{
|
||||
if ((thing->flags & MF2_AMBUSH) || (tmthing->player->powers[pw_carry] == CR_MINECART && tmthing->tracer && !P_MobjWasRemoved(tmthing->tracer)))
|
||||
if ((thing->flags2 & MF2_AMBUSH) || (tmthing->player->powers[pw_carry] == CR_MINECART && tmthing->tracer && !P_MobjWasRemoved(tmthing->tracer)))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
8802
src/p_mobj.c
8802
src/p_mobj.c
File diff suppressed because it is too large
Load diff
10
src/p_mobj.h
10
src/p_mobj.h
|
@ -279,9 +279,7 @@ typedef struct mobj_s
|
|||
|
||||
// More drawing info: to determine current sprite.
|
||||
angle_t angle; // orientation
|
||||
#ifdef ROTSPRITE
|
||||
angle_t rollangle;
|
||||
#endif
|
||||
spritenum_t sprite; // used to find patch_t and flip value
|
||||
UINT32 frame; // frame number, plus bits see p_pspr.h
|
||||
UINT8 sprite2; // player sprites
|
||||
|
@ -402,9 +400,7 @@ typedef struct precipmobj_s
|
|||
|
||||
// More drawing info: to determine current sprite.
|
||||
angle_t angle; // orientation
|
||||
#ifdef ROTSPRITE
|
||||
angle_t rollangle;
|
||||
#endif
|
||||
spritenum_t sprite; // used to find patch_t and flip value
|
||||
UINT32 frame; // frame number, plus bits see p_pspr.h
|
||||
UINT8 sprite2; // player sprites
|
||||
|
@ -456,8 +452,10 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing);
|
|||
void P_MovePlayerToStarpost(INT32 playernum);
|
||||
void P_AfterPlayerSpawn(INT32 playernum);
|
||||
|
||||
void P_SpawnMapThing(mapthing_t *mthing);
|
||||
void P_SpawnHoopsAndRings(mapthing_t *mthing, boolean bonustime);
|
||||
mobj_t *P_SpawnMapThing(mapthing_t *mthing);
|
||||
void P_SpawnHoop(mapthing_t *mthing);
|
||||
void P_SetBonusTime(mobj_t *mobj);
|
||||
void P_SpawnItemPattern(mapthing_t *mthing, boolean bonustime);
|
||||
void P_SpawnHoopOfSomething(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle);
|
||||
void P_SpawnPrecipitation(void);
|
||||
void P_SpawnParaloop(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, statenum_t nstate, angle_t rotangle, boolean spawncenter);
|
||||
|
|
|
@ -400,6 +400,8 @@ static void Polyobj_findSegs(polyobj_t *po, seg_t *seg)
|
|||
// Find backfacings
|
||||
for (s = 0; s < numsegs; s++)
|
||||
{
|
||||
if (segs[s].glseg)
|
||||
continue;
|
||||
if (segs[s].linedef == seg->linedef
|
||||
&& segs[s].side == 1)
|
||||
{
|
||||
|
@ -436,6 +438,8 @@ newseg:
|
|||
// seg's ending vertex.
|
||||
for (i = 0; i < numsegs; ++i)
|
||||
{
|
||||
if (segs[i].glseg)
|
||||
continue;
|
||||
if (segs[i].side != 0) // needs to be frontfacing
|
||||
continue;
|
||||
if (segs[i].v1->x == seg->v2->x && segs[i].v1->y == seg->v2->y)
|
||||
|
@ -460,6 +464,9 @@ newseg:
|
|||
// Find backfacings
|
||||
for (q = 0; q < numsegs; q++)
|
||||
{
|
||||
if (segs[q].glseg)
|
||||
continue;
|
||||
|
||||
if (segs[q].linedef == segs[i].linedef
|
||||
&& segs[q].side == 1)
|
||||
{
|
||||
|
@ -606,6 +613,9 @@ static void Polyobj_spawnPolyObj(INT32 num, mobj_t *spawnSpot, INT32 id)
|
|||
INT32 poflags = POF_SOLID|POF_TESTHEIGHT|POF_RENDERSIDES;
|
||||
INT32 parentID = 0, potrans = 0;
|
||||
|
||||
if (seg->glseg)
|
||||
continue;
|
||||
|
||||
if (seg->side != 0) // needs to be frontfacing
|
||||
continue;
|
||||
|
||||
|
@ -1815,6 +1825,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||
if (po->thinker == NULL)
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
/*
|
||||
// Find out target first.
|
||||
// We redo this each tic to make savegame compatibility easier.
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
|
@ -1833,6 +1844,9 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
target = th->target;
|
||||
|
||||
if (!target)
|
||||
{
|
||||
|
@ -2015,6 +2029,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
|||
|
||||
target = waypoint;
|
||||
th->pointnum = target->health;
|
||||
// Set the mobj as your target! -- Monster Iestyn 27/12/19
|
||||
P_SetTarget(&th->target, target);
|
||||
|
||||
// calculate MOMX/MOMY/MOMZ for next waypoint
|
||||
// change slope
|
||||
|
@ -2641,6 +2657,9 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
|||
|
||||
// Set pointnum
|
||||
th->pointnum = target->health;
|
||||
th->target = NULL; // set to NULL first so the below doesn't go wrong
|
||||
// Set the mobj as your target! -- Monster Iestyn 27/12/19
|
||||
P_SetTarget(&th->target, target);
|
||||
|
||||
// We don't deal with the mirror crap here, we'll
|
||||
// handle that in the T_Thinker function.
|
||||
|
|
|
@ -161,6 +161,8 @@ typedef struct polywaypoint_s
|
|||
fixed_t diffx;
|
||||
fixed_t diffy;
|
||||
fixed_t diffz;
|
||||
|
||||
mobj_t *target; // next waypoint mobj
|
||||
} polywaypoint_t;
|
||||
|
||||
typedef struct polyslidedoor_s
|
||||
|
|
119
src/p_saveg.c
119
src/p_saveg.c
|
@ -777,14 +777,13 @@ static void P_NetArchiveWorld(void)
|
|||
size_t i;
|
||||
INT32 statsec = 0, statline = 0;
|
||||
const line_t *li = lines;
|
||||
const line_t *spawnli = spawnlines;
|
||||
const side_t *si;
|
||||
const side_t *spawnsi;
|
||||
UINT8 *put;
|
||||
|
||||
// reload the map just to see difference
|
||||
mapsector_t *ms;
|
||||
mapsidedef_t *msd;
|
||||
maplinedef_t *mld;
|
||||
const sector_t *ss = sectors;
|
||||
const sector_t *spawnss = spawnsectors;
|
||||
UINT8 diff, diff2, diff3;
|
||||
|
||||
// initialize colormap vars because paranoia
|
||||
|
@ -793,65 +792,45 @@ static void P_NetArchiveWorld(void)
|
|||
WRITEUINT32(save_p, ARCHIVEBLOCK_WORLD);
|
||||
put = save_p;
|
||||
|
||||
if (W_IsLumpWad(lastloadedmaplumpnum)) // welp it's a map wad in a pk3
|
||||
{ // HACK: Open wad file rather quickly so we can get the data from the relevant lumps
|
||||
UINT8 *wadData = W_CacheLumpNum(lastloadedmaplumpnum, PU_STATIC);
|
||||
filelump_t *fileinfo = (filelump_t *)(wadData + ((wadinfo_t *)wadData)->infotableofs);
|
||||
#define retrieve_mapdata(d, f)\
|
||||
d = Z_Malloc((f)->size, PU_CACHE, NULL); \
|
||||
M_Memcpy(d, wadData + (f)->filepos, (f)->size)
|
||||
retrieve_mapdata(ms, fileinfo + ML_SECTORS);
|
||||
retrieve_mapdata(mld, fileinfo + ML_LINEDEFS);
|
||||
retrieve_mapdata(msd, fileinfo + ML_SIDEDEFS);
|
||||
#undef retrieve_mapdata
|
||||
Z_Free(wadData); // we're done with this now
|
||||
}
|
||||
else // phew it's just a WAD
|
||||
{
|
||||
ms = W_CacheLumpNum(lastloadedmaplumpnum+ML_SECTORS, PU_CACHE);
|
||||
mld = W_CacheLumpNum(lastloadedmaplumpnum+ML_LINEDEFS, PU_CACHE);
|
||||
msd = W_CacheLumpNum(lastloadedmaplumpnum+ML_SIDEDEFS, PU_CACHE);
|
||||
}
|
||||
|
||||
for (i = 0; i < numsectors; i++, ss++, ms++)
|
||||
for (i = 0; i < numsectors; i++, ss++, spawnss++)
|
||||
{
|
||||
diff = diff2 = diff3 = 0;
|
||||
if (ss->floorheight != SHORT(ms->floorheight)<<FRACBITS)
|
||||
if (ss->floorheight != spawnss->floorheight)
|
||||
diff |= SD_FLOORHT;
|
||||
if (ss->ceilingheight != SHORT(ms->ceilingheight)<<FRACBITS)
|
||||
if (ss->ceilingheight != spawnss->ceilingheight)
|
||||
diff |= SD_CEILHT;
|
||||
//
|
||||
// flats
|
||||
//
|
||||
if (ss->floorpic != P_CheckLevelFlat(ms->floorpic))
|
||||
if (ss->floorpic != spawnss->floorpic)
|
||||
diff |= SD_FLOORPIC;
|
||||
if (ss->ceilingpic != P_CheckLevelFlat(ms->ceilingpic))
|
||||
if (ss->ceilingpic != spawnss->ceilingpic)
|
||||
diff |= SD_CEILPIC;
|
||||
|
||||
if (ss->lightlevel != SHORT(ms->lightlevel))
|
||||
if (ss->lightlevel != spawnss->lightlevel)
|
||||
diff |= SD_LIGHT;
|
||||
if (ss->special != SHORT(ms->special))
|
||||
if (ss->special != spawnss->special)
|
||||
diff |= SD_SPECIAL;
|
||||
|
||||
if (ss->floor_xoffs != ss->spawn_flr_xoffs)
|
||||
if (ss->floor_xoffs != spawnss->floor_xoffs)
|
||||
diff2 |= SD_FXOFFS;
|
||||
if (ss->floor_yoffs != ss->spawn_flr_yoffs)
|
||||
if (ss->floor_yoffs != spawnss->floor_yoffs)
|
||||
diff2 |= SD_FYOFFS;
|
||||
if (ss->ceiling_xoffs != ss->spawn_ceil_xoffs)
|
||||
if (ss->ceiling_xoffs != spawnss->ceiling_xoffs)
|
||||
diff2 |= SD_CXOFFS;
|
||||
if (ss->ceiling_yoffs != ss->spawn_ceil_yoffs)
|
||||
if (ss->ceiling_yoffs != spawnss->ceiling_yoffs)
|
||||
diff2 |= SD_CYOFFS;
|
||||
if (ss->floorpic_angle != ss->spawn_flrpic_angle)
|
||||
if (ss->floorpic_angle != spawnss->floorpic_angle)
|
||||
diff2 |= SD_FLOORANG;
|
||||
if (ss->ceilingpic_angle != ss->spawn_flrpic_angle)
|
||||
if (ss->ceilingpic_angle != spawnss->ceilingpic_angle)
|
||||
diff2 |= SD_CEILANG;
|
||||
|
||||
if (ss->tag != SHORT(ms->tag))
|
||||
if (ss->tag != spawnss->tag)
|
||||
diff2 |= SD_TAG;
|
||||
if (ss->nexttag != ss->spawn_nexttag || ss->firsttag != ss->spawn_firsttag)
|
||||
if (ss->nexttag != spawnss->nexttag || ss->firsttag != spawnss->firsttag)
|
||||
diff3 |= SD_TAGLIST;
|
||||
|
||||
if (ss->extra_colormap != ss->spawn_extra_colormap)
|
||||
if (ss->extra_colormap != spawnss->extra_colormap)
|
||||
diff3 |= SD_COLORMAP;
|
||||
|
||||
// Check if any of the sector's FOFs differ from how they spawned
|
||||
|
@ -955,45 +934,41 @@ static void P_NetArchiveWorld(void)
|
|||
WRITEUINT16(put, 0xffff);
|
||||
|
||||
// do lines
|
||||
for (i = 0; i < numlines; i++, mld++, li++)
|
||||
for (i = 0; i < numlines; i++, spawnli++, li++)
|
||||
{
|
||||
diff = diff2 = diff3 = 0;
|
||||
|
||||
if (li->special != SHORT(mld->special))
|
||||
if (li->special != spawnli->special)
|
||||
diff |= LD_SPECIAL;
|
||||
|
||||
if (SHORT(mld->special) == 321 || SHORT(mld->special) == 322) // only reason li->callcount would be non-zero is if either of these are involved
|
||||
if (spawnli->special == 321 || spawnli->special == 322) // only reason li->callcount would be non-zero is if either of these are involved
|
||||
diff |= LD_CLLCOUNT;
|
||||
|
||||
if (li->sidenum[0] != 0xffff)
|
||||
{
|
||||
si = &sides[li->sidenum[0]];
|
||||
if (si->textureoffset != SHORT(msd[li->sidenum[0]].textureoffset)<<FRACBITS)
|
||||
spawnsi = &spawnsides[li->sidenum[0]];
|
||||
if (si->textureoffset != spawnsi->textureoffset)
|
||||
diff |= LD_S1TEXOFF;
|
||||
//SoM: 4/1/2000: Some textures are colormaps. Don't worry about invalid textures.
|
||||
if (R_CheckTextureNumForName(msd[li->sidenum[0]].toptexture) != -1
|
||||
&& si->toptexture != R_TextureNumForName(msd[li->sidenum[0]].toptexture))
|
||||
if (si->toptexture != spawnsi->toptexture)
|
||||
diff |= LD_S1TOPTEX;
|
||||
if (R_CheckTextureNumForName(msd[li->sidenum[0]].bottomtexture) != -1
|
||||
&& si->bottomtexture != R_TextureNumForName(msd[li->sidenum[0]].bottomtexture))
|
||||
if (si->bottomtexture != spawnsi->bottomtexture)
|
||||
diff |= LD_S1BOTTEX;
|
||||
if (R_CheckTextureNumForName(msd[li->sidenum[0]].midtexture) != -1
|
||||
&& si->midtexture != R_TextureNumForName(msd[li->sidenum[0]].midtexture))
|
||||
if (si->midtexture != spawnsi->midtexture)
|
||||
diff |= LD_S1MIDTEX;
|
||||
}
|
||||
if (li->sidenum[1] != 0xffff)
|
||||
{
|
||||
si = &sides[li->sidenum[1]];
|
||||
if (si->textureoffset != SHORT(msd[li->sidenum[1]].textureoffset)<<FRACBITS)
|
||||
spawnsi = &spawnsides[li->sidenum[1]];
|
||||
if (si->textureoffset != spawnsi->textureoffset)
|
||||
diff2 |= LD_S2TEXOFF;
|
||||
if (R_CheckTextureNumForName(msd[li->sidenum[1]].toptexture) != -1
|
||||
&& si->toptexture != R_TextureNumForName(msd[li->sidenum[1]].toptexture))
|
||||
if (si->toptexture != spawnsi->toptexture)
|
||||
diff2 |= LD_S2TOPTEX;
|
||||
if (R_CheckTextureNumForName(msd[li->sidenum[1]].bottomtexture) != -1
|
||||
&& si->bottomtexture != R_TextureNumForName(msd[li->sidenum[1]].bottomtexture))
|
||||
if (si->bottomtexture != spawnsi->bottomtexture)
|
||||
diff2 |= LD_S2BOTTEX;
|
||||
if (R_CheckTextureNumForName(msd[li->sidenum[1]].midtexture) != -1
|
||||
&& si->midtexture != R_TextureNumForName(msd[li->sidenum[1]].midtexture))
|
||||
if (si->midtexture != spawnsi->midtexture)
|
||||
diff2 |= LD_S2MIDTEX;
|
||||
if (diff2)
|
||||
diff |= LD_DIFF2;
|
||||
|
@ -1277,9 +1252,7 @@ typedef enum
|
|||
MD2_SLOPE = 1<<11,
|
||||
#endif
|
||||
MD2_COLORIZED = 1<<12,
|
||||
#ifdef ROTSPRITE
|
||||
MD2_ROLLANGLE = 1<<13,
|
||||
#endif
|
||||
} mobj_diff2_t;
|
||||
|
||||
typedef enum
|
||||
|
@ -1499,10 +1472,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
|||
#endif
|
||||
if (mobj->colorized)
|
||||
diff2 |= MD2_COLORIZED;
|
||||
#ifdef ROTSPRITE
|
||||
if (mobj->rollangle)
|
||||
diff2 |= MD2_ROLLANGLE;
|
||||
#endif
|
||||
if (diff2 != 0)
|
||||
diff |= MD_MORE;
|
||||
|
||||
|
@ -1667,10 +1638,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
|||
#endif
|
||||
if (diff2 & MD2_COLORIZED)
|
||||
WRITEUINT8(save_p, mobj->colorized);
|
||||
#ifdef ROTSPRITE
|
||||
if (diff2 & MD2_ROLLANGLE)
|
||||
WRITEANGLE(save_p, mobj->rollangle);
|
||||
#endif
|
||||
|
||||
WRITEUINT32(save_p, mobj->mobjnum);
|
||||
}
|
||||
|
@ -2086,6 +2055,7 @@ static void SavePolywaypointThinker(const thinker_t *th, UINT8 type)
|
|||
WRITEFIXED(save_p, ht->diffx);
|
||||
WRITEFIXED(save_p, ht->diffy);
|
||||
WRITEFIXED(save_p, ht->diffz);
|
||||
WRITEUINT32(save_p, SaveMobjnum(ht->target));
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -2563,7 +2533,7 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
|
|||
|
||||
if (mapthings[spawnpointnum].type == 1705 || mapthings[spawnpointnum].type == 1713) // NiGHTS Hoop special case
|
||||
{
|
||||
P_SpawnHoopsAndRings(&mapthings[spawnpointnum], false);
|
||||
P_SpawnHoop(&mapthings[spawnpointnum]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -2747,12 +2717,8 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
|
|||
#endif
|
||||
if (diff2 & MD2_COLORIZED)
|
||||
mobj->colorized = READUINT8(save_p);
|
||||
#ifdef ROTSPRITE
|
||||
if (diff2 & MD2_ROLLANGLE)
|
||||
mobj->rollangle = READANGLE(save_p);
|
||||
else
|
||||
mobj->rollangle = 0;
|
||||
#endif
|
||||
|
||||
if (diff & MD_REDFLAG)
|
||||
{
|
||||
|
@ -3279,6 +3245,7 @@ static inline thinker_t* LoadPolywaypointThinker(actionf_p1 thinker)
|
|||
ht->diffx = READFIXED(save_p);
|
||||
ht->diffy = READFIXED(save_p);
|
||||
ht->diffz = READFIXED(save_p);
|
||||
ht->target = LoadMobj(READUINT32(save_p));
|
||||
return &ht->thinker;
|
||||
}
|
||||
|
||||
|
@ -3573,6 +3540,7 @@ static void P_NetUnArchiveThinkers(void)
|
|||
|
||||
case tc_polywaypoint:
|
||||
th = LoadPolywaypointThinker((actionf_p1)T_PolyObjWaypoint);
|
||||
restoreNum = true;
|
||||
break;
|
||||
|
||||
case tc_polyslidedoor:
|
||||
|
@ -3634,9 +3602,9 @@ static void P_NetUnArchiveThinkers(void)
|
|||
if (restoreNum)
|
||||
{
|
||||
executor_t *delay = NULL;
|
||||
polywaypoint_t *polywp = NULL;
|
||||
UINT32 mobjnum;
|
||||
for (currentthinker = thlist[THINK_MAIN].next; currentthinker != &thlist[THINK_MAIN];
|
||||
currentthinker = currentthinker->next)
|
||||
for (currentthinker = thlist[THINK_MAIN].next; currentthinker != &thlist[THINK_MAIN]; currentthinker = currentthinker->next)
|
||||
{
|
||||
if (currentthinker->function.acp1 != (actionf_p1)T_ExecutorDelay)
|
||||
continue;
|
||||
|
@ -3645,6 +3613,15 @@ static void P_NetUnArchiveThinkers(void)
|
|||
continue;
|
||||
delay->caller = P_FindNewPosition(mobjnum);
|
||||
}
|
||||
for (currentthinker = thlist[THINK_POLYOBJ].next; currentthinker != &thlist[THINK_POLYOBJ]; currentthinker = currentthinker->next)
|
||||
{
|
||||
if (currentthinker->function.acp1 != (actionf_p1)T_PolyObjWaypoint)
|
||||
continue;
|
||||
polywp = (void *)currentthinker;
|
||||
if (!(mobjnum = (UINT32)(size_t)polywp->target))
|
||||
continue;
|
||||
polywp->target = P_FindNewPosition(mobjnum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4099,7 +4076,7 @@ static inline boolean P_NetUnArchiveMisc(void)
|
|||
|
||||
tokenlist = READUINT32(save_p);
|
||||
|
||||
if (!P_SetupLevel(true))
|
||||
if (!P_LoadLevel(true))
|
||||
return false;
|
||||
|
||||
// get the time
|
||||
|
|
2764
src/p_setup.c
2764
src/p_setup.c
File diff suppressed because it is too large
Load diff
|
@ -96,8 +96,11 @@ void P_SetupLevelSky(INT32 skynum, boolean global);
|
|||
#ifdef SCANTHINGS
|
||||
void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum);
|
||||
#endif
|
||||
void P_LoadThingsOnly(void);
|
||||
boolean P_SetupLevel(boolean skipprecip);
|
||||
void P_RespawnThings(void);
|
||||
boolean P_LoadLevel(boolean fromnetsave);
|
||||
#ifdef HWRENDER
|
||||
void HWR_SetupLevel(void);
|
||||
#endif
|
||||
boolean P_AddWadFile(const char *wadfilename);
|
||||
boolean P_RunSOC(const char *socfilename);
|
||||
void P_LoadSoundsRange(UINT16 wadnum, UINT16 first, UINT16 num);
|
||||
|
|
|
@ -445,10 +445,9 @@ static pslope_t *MakeViaMapthings(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag
|
|||
I_Error("MakeViaMapthings: Slope vertex %s (for linedef tag %d) not found!", sizeu1(i), tag1);
|
||||
vx[i].x = mt->x << FRACBITS;
|
||||
vx[i].y = mt->y << FRACBITS;
|
||||
if (mt->extrainfo)
|
||||
vx[i].z = mt->options << FRACBITS;
|
||||
else
|
||||
vx[i].z = (R_PointInSubsector(mt->x << FRACBITS, mt->y << FRACBITS)->sector->floorheight) + ((mt->options >> ZSHIFT) << FRACBITS);
|
||||
vx[i].z = mt->z << FRACBITS;
|
||||
if (!mt->extrainfo)
|
||||
vx[i].z += R_PointInSubsector(vx[i].x, vx[i].y)->sector->floorheight;
|
||||
}
|
||||
|
||||
ReconfigureViaVertexes(ret, vx[0], vx[1], vx[2]);
|
||||
|
@ -553,11 +552,8 @@ pslope_t *P_SlopeById(UINT16 id)
|
|||
}
|
||||
|
||||
/// Reset slopes and read them from special lines.
|
||||
void P_ResetDynamicSlopes(const UINT32 fromsave) {
|
||||
void P_ResetDynamicSlopes(const boolean fromsave) {
|
||||
size_t i;
|
||||
|
||||
boolean spawnthinkers = !(boolean)fromsave;
|
||||
|
||||
slopelist = NULL;
|
||||
slopecount = 0;
|
||||
|
||||
|
@ -574,14 +570,14 @@ void P_ResetDynamicSlopes(const UINT32 fromsave) {
|
|||
case 711:
|
||||
case 712:
|
||||
case 713:
|
||||
line_SpawnViaLine(i, spawnthinkers);
|
||||
line_SpawnViaLine(i, !fromsave);
|
||||
break;
|
||||
|
||||
case 704:
|
||||
case 705:
|
||||
case 714:
|
||||
case 715:
|
||||
line_SpawnViaVertexes(i, spawnthinkers);
|
||||
line_SpawnViaVertexes(i, !fromsave);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -23,7 +23,7 @@ extern UINT16 slopecount;
|
|||
void P_LinkSlopeThinkers (void);
|
||||
|
||||
void P_CalculateSlopeNormal(pslope_t *slope);
|
||||
void P_ResetDynamicSlopes(const UINT32 fromsave);
|
||||
void P_ResetDynamicSlopes(const boolean fromsave);
|
||||
|
||||
//
|
||||
// P_CopySectorSlope
|
||||
|
|
65
src/p_spec.c
65
src/p_spec.c
|
@ -1603,8 +1603,6 @@ static inline void P_InitTagLists(void)
|
|||
size_t j = (unsigned)sectors[i].tag % numsectors;
|
||||
sectors[i].nexttag = sectors[j].firsttag;
|
||||
sectors[j].firsttag = (INT32)i;
|
||||
sectors[i].spawn_nexttag = sectors[i].nexttag;
|
||||
sectors[j].spawn_firsttag = sectors[j].firsttag;
|
||||
}
|
||||
|
||||
for (i = numlines - 1; i != (size_t)-1; i--)
|
||||
|
@ -4694,7 +4692,7 @@ DoneSection2:
|
|||
}
|
||||
|
||||
case 2: // Special stage GOAL sector / Exit Sector / CTF Flag Return
|
||||
if (player->bot || !G_PlatformGametype())
|
||||
if (player->bot || !(gametyperules & GTR_ALLOWEXIT))
|
||||
break;
|
||||
if (!(maptol & TOL_NIGHTS) && G_IsSpecialStage(gamemap) && player->nightstime > 6)
|
||||
{
|
||||
|
@ -4729,7 +4727,7 @@ DoneSection2:
|
|||
break;
|
||||
|
||||
case 3: // Red Team's Base
|
||||
if (gametype == GT_CTF && P_IsObjectOnGround(player->mo))
|
||||
if ((gametyperules & GTR_TEAMFLAGS) && P_IsObjectOnGround(player->mo))
|
||||
{
|
||||
if (player->ctfteam == 1 && (player->gotflag & GF_BLUEFLAG))
|
||||
{
|
||||
|
@ -4762,7 +4760,7 @@ DoneSection2:
|
|||
break;
|
||||
|
||||
case 4: // Blue Team's Base
|
||||
if (gametype == GT_CTF && P_IsObjectOnGround(player->mo))
|
||||
if ((gametyperules & GTR_TEAMFLAGS) && P_IsObjectOnGround(player->mo))
|
||||
{
|
||||
if (player->ctfteam == 2 && (player->gotflag & GF_REDFLAG))
|
||||
{
|
||||
|
@ -6405,22 +6403,16 @@ static void P_ApplyFlatAlignment(line_t *master, sector_t *sector, angle_t flata
|
|||
{
|
||||
if (!(master->flags & ML_NETONLY)) // Modify floor flat alignment unless ML_NETONLY flag is set
|
||||
{
|
||||
sector->spawn_flrpic_angle = sector->floorpic_angle = flatangle;
|
||||
sector->floorpic_angle = flatangle;
|
||||
sector->floor_xoffs += xoffs;
|
||||
sector->floor_yoffs += yoffs;
|
||||
// saved for netgames
|
||||
sector->spawn_flr_xoffs = sector->floor_xoffs;
|
||||
sector->spawn_flr_yoffs = sector->floor_yoffs;
|
||||
}
|
||||
|
||||
if (!(master->flags & ML_NONET)) // Modify ceiling flat alignment unless ML_NONET flag is set
|
||||
{
|
||||
sector->spawn_ceilpic_angle = sector->ceilingpic_angle = flatangle;
|
||||
sector->ceilingpic_angle = flatangle;
|
||||
sector->ceiling_xoffs += xoffs;
|
||||
sector->ceiling_yoffs += yoffs;
|
||||
// saved for netgames
|
||||
sector->spawn_ceil_xoffs = sector->ceiling_xoffs;
|
||||
sector->spawn_ceil_yoffs = sector->ceiling_yoffs;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6434,14 +6426,13 @@ static void P_ApplyFlatAlignment(line_t *master, sector_t *sector, angle_t flata
|
|||
* as they'll just be erased by UnArchiveThinkers.
|
||||
* \sa P_SpawnPrecipitation, P_SpawnFriction, P_SpawnPushers, P_SpawnScrollers
|
||||
*/
|
||||
void P_SpawnSpecials(INT32 fromnetsave)
|
||||
void P_SpawnSpecials(boolean fromnetsave)
|
||||
{
|
||||
sector_t *sector;
|
||||
size_t i;
|
||||
INT32 j;
|
||||
thinkerlist_t *secthinkers;
|
||||
thinker_t *th;
|
||||
|
||||
// This used to be used, and *should* be used in the future,
|
||||
// but currently isn't.
|
||||
(void)fromnetsave;
|
||||
|
@ -7187,46 +7178,14 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
|||
EV_AddLaserThinker(§ors[s], §ors[sec], lines + i, secthinkers);
|
||||
break;
|
||||
|
||||
case 259: // Make-Your-Own FOF!
|
||||
case 259: // Custom FOF
|
||||
if (lines[i].sidenum[1] != 0xffff)
|
||||
{
|
||||
UINT8 *data;
|
||||
UINT16 b;
|
||||
|
||||
if (W_IsLumpWad(lastloadedmaplumpnum)) // welp it's a map wad in a pk3
|
||||
{ // HACK: Open wad file rather quickly so we can get the data from the sidedefs lump
|
||||
UINT8 *wadData = W_CacheLumpNum(lastloadedmaplumpnum, PU_STATIC);
|
||||
filelump_t *fileinfo = (filelump_t *)(wadData + ((wadinfo_t *)wadData)->infotableofs);
|
||||
fileinfo += ML_SIDEDEFS; // we only need the SIDEDEFS lump
|
||||
data = Z_Malloc(fileinfo->size, PU_STATIC, NULL);
|
||||
M_Memcpy(data, wadData + fileinfo->filepos, fileinfo->size); // copy data
|
||||
Z_Free(wadData); // we're done with this now
|
||||
}
|
||||
else // phew it's just a WAD
|
||||
data = W_CacheLumpNum(lastloadedmaplumpnum + ML_SIDEDEFS,PU_STATIC);
|
||||
|
||||
for (b = 0; b < (INT16)numsides; b++)
|
||||
{
|
||||
register mapsidedef_t *msd = (mapsidedef_t *)data + b;
|
||||
|
||||
if (b == lines[i].sidenum[1])
|
||||
{
|
||||
if ((msd->toptexture[0] >= '0' && msd->toptexture[0] <= '9')
|
||||
|| (msd->toptexture[0] >= 'A' && msd->toptexture[0] <= 'F'))
|
||||
{
|
||||
ffloortype_e FOF_Flags = axtoi(msd->toptexture);
|
||||
|
||||
P_AddFakeFloorsByLine(i, FOF_Flags, secthinkers);
|
||||
break;
|
||||
}
|
||||
else
|
||||
I_Error("Make-Your-Own-FOF (tag %d) needs a value in the linedef's second side upper texture field.", lines[i].tag);
|
||||
}
|
||||
}
|
||||
Z_Free(data);
|
||||
ffloortype_e fofflags = sides[lines[i].sidenum[1]].toptexture;
|
||||
P_AddFakeFloorsByLine(i, fofflags, secthinkers);
|
||||
}
|
||||
else
|
||||
I_Error("Make-Your-Own FOF (tag %d) found without a 2nd linedef side!", lines[i].tag);
|
||||
I_Error("Custom FOF (tag %d) found without a linedef back side!", lines[i].tag);
|
||||
break;
|
||||
|
||||
case 300: // Linedef executor (combines with sector special 974/975) and commands
|
||||
|
@ -7240,14 +7199,14 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
|||
break;
|
||||
|
||||
case 308: // Race-only linedef executor. Triggers once.
|
||||
if (gametype != GT_RACE && gametype != GT_COMPETITION)
|
||||
if (!(gametyperules & GTR_RACE))
|
||||
lines[i].special = 0;
|
||||
break;
|
||||
|
||||
// Linedef executor triggers for CTF teams.
|
||||
case 309:
|
||||
case 311:
|
||||
if (gametype != GT_CTF)
|
||||
if (!(gametyperules & GTR_TEAMFLAGS))
|
||||
lines[i].special = 0;
|
||||
break;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ void P_SetupLevelFlatAnims(void);
|
|||
|
||||
// at map load
|
||||
void P_InitSpecials(void);
|
||||
void P_SpawnSpecials(INT32 fromnetsave);
|
||||
void P_SpawnSpecials(boolean fromnetsave);
|
||||
|
||||
// every tic
|
||||
void P_UpdateSpecials(void);
|
||||
|
|
87
src/p_user.c
87
src/p_user.c
|
@ -389,7 +389,7 @@ UINT8 P_FindLowestMare(void)
|
|||
mobj_t *mo2;
|
||||
UINT8 mare = UINT8_MAX;
|
||||
|
||||
if (gametype == GT_RACE || gametype == GT_COMPETITION)
|
||||
if (gametyperules & GTR_RACE)
|
||||
return 0;
|
||||
|
||||
// scan the thinkers
|
||||
|
@ -640,9 +640,7 @@ static void P_DeNightserizePlayer(player_t *player)
|
|||
player->marebonuslap = 0;
|
||||
player->flyangle = 0;
|
||||
player->anotherflyangle = 0;
|
||||
#ifdef ROTSPRITE
|
||||
player->mo->rollangle = 0;
|
||||
#endif
|
||||
|
||||
P_SetTarget(&player->mo->target, NULL);
|
||||
P_SetTarget(&player->axis1, P_SetTarget(&player->axis2, NULL));
|
||||
|
@ -770,9 +768,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
|
|||
player->secondjump = 0;
|
||||
player->flyangle = 0;
|
||||
player->anotherflyangle = 0;
|
||||
#ifdef ROTSPRITE
|
||||
player->mo->rollangle = 0;
|
||||
#endif
|
||||
|
||||
player->powers[pw_shield] = SH_NONE;
|
||||
player->powers[pw_super] = 0;
|
||||
|
@ -795,7 +791,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
|
|||
P_RestoreMusic(player);
|
||||
}
|
||||
|
||||
if (gametype == GT_RACE || gametype == GT_COMPETITION)
|
||||
if (gametyperules & GTR_RACE)
|
||||
{
|
||||
if (player->drillmeter < 48*20)
|
||||
player->drillmeter = 48*20;
|
||||
|
@ -1602,7 +1598,7 @@ void P_RestoreMusic(player_t *player)
|
|||
P_PlayJingle(player, JT_SUPER);
|
||||
|
||||
// Invulnerability
|
||||
else if (player->powers[pw_invulnerability] > 1)
|
||||
else if (player->powers[pw_invulnerability] > 1 && !player->powers[pw_super])
|
||||
{
|
||||
strlcpy(S_sfx[sfx_None].caption, "Invincibility", 14);
|
||||
S_StartCaption(sfx_None, -1, player->powers[pw_invulnerability]);
|
||||
|
@ -2183,7 +2179,7 @@ void P_DoPlayerExit(player_t *player)
|
|||
|
||||
if (cv_allowexitlevel.value == 0 && !G_PlatformGametype())
|
||||
return;
|
||||
else if (gametype == GT_RACE || gametype == GT_COMPETITION) // If in Race Mode, allow
|
||||
else if (gametyperules & GTR_RACE) // If in Race Mode, allow
|
||||
{
|
||||
if (!countdown) // a 60-second wait ala Sonic 2.
|
||||
countdown = (cv_countdowntime.value - 1)*TICRATE + 1; // Use cv_countdowntime
|
||||
|
@ -3112,7 +3108,7 @@ static void P_DoPlayerHeadSigns(player_t *player)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG))) // If you have the flag (duh).
|
||||
else if ((gametyperules & GTR_TEAMFLAGS) && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG))) // If you have the flag (duh).
|
||||
{
|
||||
// Spawn a got-flag message over the head of the player that
|
||||
// has it (but not on your own screen if you have the flag).
|
||||
|
@ -4637,7 +4633,13 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
|
|||
S_StartSound(player->mo, sfx_spin);
|
||||
break;
|
||||
}
|
||||
if (player->dashspeed < player->maxdash)
|
||||
if (player->dashspeed < player->mindash)
|
||||
player->dashspeed = player->mindash;
|
||||
|
||||
if (player->dashspeed > player->maxdash)
|
||||
player->dashspeed = player->maxdash;
|
||||
|
||||
if (player->dashspeed < player->maxdash && player->mindash != player->maxdash)
|
||||
{
|
||||
#define chargecalculation (6*(player->dashspeed - player->mindash))/(player->maxdash - player->mindash)
|
||||
fixed_t soundcalculation = chargecalculation;
|
||||
|
@ -4672,7 +4674,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
|
|||
if (player->powers[pw_carry] == CR_BRAKGOOP)
|
||||
player->dashspeed = 0;
|
||||
|
||||
if (!((gametype == GT_RACE || gametype == GT_COMPETITION) && leveltime < 4*TICRATE))
|
||||
if (!((gametyperules & GTR_RACE) && leveltime < 4*TICRATE))
|
||||
{
|
||||
if (player->dashspeed)
|
||||
{
|
||||
|
@ -5050,7 +5052,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
|
|||
{
|
||||
if (onground || player->climbing || player->powers[pw_carry])
|
||||
;
|
||||
else if (gametype == GT_CTF && player->gotflag)
|
||||
else if ((gametyperules & GTR_TEAMFLAGS) && player->gotflag)
|
||||
;
|
||||
else if (player->pflags & (PF_GLIDING|PF_SLIDING|PF_SHIELDABILITY)) // If the player has used an ability previously
|
||||
;
|
||||
|
@ -5130,11 +5132,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
|
|||
boolean elem = ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL);
|
||||
player->pflags |= PF_THOKKED|PF_SHIELDABILITY;
|
||||
if (elem)
|
||||
{
|
||||
player->pflags |= PF_NOJUMPDAMAGE;
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
|
||||
S_StartSound(player->mo, sfx_s3k43);
|
||||
}
|
||||
else
|
||||
{
|
||||
player->pflags &= ~PF_NOJUMPDAMAGE;
|
||||
|
@ -5275,7 +5273,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
|
|||
player->secondjump = 0;
|
||||
player->pflags &= ~PF_THOKKED;
|
||||
}
|
||||
else if (player->pflags & PF_SLIDING || (gametype == GT_CTF && player->gotflag))
|
||||
else if (player->pflags & PF_SLIDING || ((gametyperules & GTR_TEAMFLAGS) && player->gotflag) || player->pflags & PF_SHIELDABILITY)
|
||||
;
|
||||
/*else if (P_SuperReady(player))
|
||||
{
|
||||
|
@ -5572,7 +5570,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
|
|||
{
|
||||
player->pflags |= PF_JUMPDOWN;
|
||||
|
||||
if ((gametype != GT_CTF || !player->gotflag) && !player->exiting)
|
||||
if ((!(gametyperules & GTR_TEAMFLAGS) || !player->gotflag) && !player->exiting)
|
||||
{
|
||||
if (player->secondjump == 1 && player->charability != CA_DOUBLEJUMP)
|
||||
{
|
||||
|
@ -6829,7 +6827,6 @@ static void P_DoNiGHTSCapsule(player_t *player)
|
|||
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
|
||||
}
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if (!(player->charflags & SF_NONIGHTSROTATION))
|
||||
{
|
||||
if ((player->mo->state == &states[S_PLAY_NIGHTS_PULL])
|
||||
|
@ -6838,7 +6835,6 @@ static void P_DoNiGHTSCapsule(player_t *player)
|
|||
else
|
||||
player->mo->rollangle = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (G_IsSpecialStage(gamemap))
|
||||
{ // In special stages, share rings. Everyone gives up theirs to the capsule player always, because we can't have any individualism here!
|
||||
|
@ -7101,9 +7097,7 @@ static void P_NiGHTSMovement(player_t *player)
|
|||
INT32 i;
|
||||
statenum_t flystate;
|
||||
UINT16 visangle;
|
||||
#ifdef ROTSPRITE
|
||||
angle_t rollangle = 0;
|
||||
#endif
|
||||
|
||||
player->pflags &= ~PF_DRILLING;
|
||||
|
||||
|
@ -7142,7 +7136,7 @@ static void P_NiGHTSMovement(player_t *player)
|
|||
&& !player->exiting)
|
||||
player->nightstime--;
|
||||
}
|
||||
else if (gametype != GT_RACE && gametype != GT_COMPETITION
|
||||
else if (!(gametyperules & GTR_RACE)
|
||||
&& !(player->mo->state >= &states[S_PLAY_NIGHTS_TRANS1]
|
||||
&& player->mo->state <= &states[S_PLAY_NIGHTS_TRANS6])
|
||||
&& !(player->capsule && player->capsule->reactiontime)
|
||||
|
@ -7288,9 +7282,7 @@ static void P_NiGHTSMovement(player_t *player)
|
|||
&& player->mo->state <= &states[S_PLAY_NIGHTS_TRANS6])
|
||||
{
|
||||
player->mo->momx = player->mo->momy = player->mo->momz = 0;
|
||||
#ifdef ROTSPRITE
|
||||
player->mo->rollangle = 0;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -7298,7 +7290,7 @@ static void P_NiGHTSMovement(player_t *player)
|
|||
{
|
||||
player->mo->momx = player->mo->momy = 0;
|
||||
|
||||
if (gametype != GT_RACE && gametype != GT_COMPETITION)
|
||||
if (!(gametyperules & GTR_RACE))
|
||||
P_SetObjectMomZ(player->mo, FRACUNIT/2, (P_MobjFlip(player->mo)*player->mo->momz >= 0));
|
||||
else
|
||||
player->mo->momz = 0;
|
||||
|
@ -7616,7 +7608,6 @@ static void P_NiGHTSMovement(player_t *player)
|
|||
flystate += (visangle*2); // S_PLAY_NIGHTS_FLY0-C - the *2 is to skip over drill states
|
||||
#endif
|
||||
}
|
||||
#ifdef ROTSPRITE
|
||||
else
|
||||
{
|
||||
angle_t a = R_PointToAngle(player->mo->x, player->mo->y) - player->mo->angle;
|
||||
|
@ -7634,18 +7625,15 @@ static void P_NiGHTSMovement(player_t *player)
|
|||
|
||||
rollangle = FixedAngle(visangle<<FRACBITS);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (player->mo->state != &states[flystate])
|
||||
P_SetPlayerMobjState(player->mo, flystate);
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if (player->charflags & SF_NONIGHTSROTATION)
|
||||
player->mo->rollangle = 0;
|
||||
else
|
||||
player->mo->rollangle = rollangle;
|
||||
#endif
|
||||
|
||||
if (player == &players[consoleplayer])
|
||||
localangle = player->mo->angle;
|
||||
|
@ -9691,12 +9679,12 @@ static void P_DeathThink(player_t *player)
|
|||
player->playerstate = PST_REBORN;
|
||||
}
|
||||
|
||||
if (gametype == GT_RACE || gametype == GT_COMPETITION || (gametype == GT_COOP && (multiplayer || netgame)))
|
||||
if ((gametyperules & GTR_RACE) || (gametype == GT_COOP && (multiplayer || netgame)))
|
||||
{
|
||||
// Keep time rolling in race mode
|
||||
if (!(countdown2 && !countdown) && !player->exiting && !(player->pflags & PF_GAMETYPEOVER) && !stoppedclock)
|
||||
{
|
||||
if (gametype == GT_RACE || gametype == GT_COMPETITION)
|
||||
if (gametyperules & GTR_RACE)
|
||||
{
|
||||
if (leveltime >= 4*TICRATE)
|
||||
player->realtime = leveltime - 4*TICRATE;
|
||||
|
@ -10594,6 +10582,11 @@ boolean P_SpectatorJoinGame(player_t *player)
|
|||
else
|
||||
changeto = (P_RandomFixed() & 1) + 1;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (!LUAh_TeamSwitch(player, changeto, true, false, false))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if (player->mo)
|
||||
{
|
||||
P_RemoveMobj(player->mo);
|
||||
|
@ -10605,7 +10598,14 @@ boolean P_SpectatorJoinGame(player_t *player)
|
|||
|
||||
//Reset away view
|
||||
if (P_IsLocalPlayer(player) && displayplayer != consoleplayer)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
// Call ViewpointSwitch hooks here.
|
||||
// The viewpoint was forcibly changed.
|
||||
LUAh_ViewpointSwitch(player, &players[displayplayer], true);
|
||||
#endif
|
||||
displayplayer = consoleplayer;
|
||||
}
|
||||
|
||||
if (changeto == 1)
|
||||
CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[player-players], '\x85', M_GetText("Red team"), '\x80');
|
||||
|
@ -10619,8 +10619,12 @@ boolean P_SpectatorJoinGame(player_t *player)
|
|||
{
|
||||
// Exception for hide and seek. Don't join a game when you simply
|
||||
// respawn in place and sit there for the rest of the round.
|
||||
if (!(gametype == GT_HIDEANDSEEK && leveltime > (hidetime * TICRATE)))
|
||||
if (!((gametyperules & GTR_HIDEFROZEN) && leveltime > (hidetime * TICRATE)))
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
if (!LUAh_TeamSwitch(player, 3, true, false, false))
|
||||
return false;
|
||||
#endif
|
||||
if (player->mo)
|
||||
{
|
||||
P_RemoveMobj(player->mo);
|
||||
|
@ -10643,7 +10647,14 @@ boolean P_SpectatorJoinGame(player_t *player)
|
|||
|
||||
//Reset away view
|
||||
if (P_IsLocalPlayer(player) && displayplayer != consoleplayer)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
// Call ViewpointSwitch hooks here.
|
||||
// The viewpoint was forcibly changed.
|
||||
LUAh_ViewpointSwitch(player, &players[displayplayer], true);
|
||||
#endif
|
||||
displayplayer = consoleplayer;
|
||||
}
|
||||
|
||||
if (gametype != GT_COOP)
|
||||
CONS_Printf(M_GetText("%s entered the game.\n"), player_names[player-players]);
|
||||
|
@ -10769,7 +10780,7 @@ void P_DoPityCheck(player_t *player)
|
|||
{
|
||||
// No pity outside of match or CTF.
|
||||
if (player->spectator
|
||||
|| !(gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF))
|
||||
|| !(gametyperules & GTR_PITYSHIELD))
|
||||
return;
|
||||
|
||||
// Apply pity shield if available.
|
||||
|
@ -11602,7 +11613,7 @@ void P_PlayerThink(player_t *player)
|
|||
I_Error("player %s is in PST_REBORN\n", sizeu1(playeri));
|
||||
#endif
|
||||
|
||||
if (gametype == GT_RACE || gametype == GT_COMPETITION)
|
||||
if (gametyperules & GTR_RACE)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
|
@ -11665,7 +11676,7 @@ void P_PlayerThink(player_t *player)
|
|||
player->exiting > 0 && player->exiting <= 1*TICRATE &&
|
||||
(!multiplayer || gametype == GT_COOP ? !mapheaderinfo[gamemap-1]->musinterfadeout : true) &&
|
||||
// don't fade if we're fading during intermission. follows Y_StartIntermission intertype = int_coop
|
||||
(gametype == GT_RACE || gametype == GT_COMPETITION ? countdown2 == 0 : true) && // don't fade on timeout
|
||||
((gametyperules & GTR_RACE) ? countdown2 == 0 : true) && // don't fade on timeout
|
||||
player->lives > 0 && // don't fade on game over (competition)
|
||||
P_IsLocalPlayer(player))
|
||||
{
|
||||
|
@ -11780,7 +11791,7 @@ void P_PlayerThink(player_t *player)
|
|||
player->lives = cv_startinglives.value;
|
||||
}
|
||||
|
||||
if ((gametype == GT_RACE || gametype == GT_COMPETITION) && leveltime < 4*TICRATE)
|
||||
if ((gametyperules & GTR_RACE) && leveltime < 4*TICRATE)
|
||||
{
|
||||
cmd->buttons &= BT_USE; // Remove all buttons except BT_USE
|
||||
cmd->forwardmove = 0;
|
||||
|
@ -11790,7 +11801,7 @@ void P_PlayerThink(player_t *player)
|
|||
// Synchronizes the "real" amount of time spent in the level.
|
||||
if (!player->exiting && !stoppedclock)
|
||||
{
|
||||
if (gametype == GT_RACE || gametype == GT_COMPETITION)
|
||||
if (gametyperules & GTR_RACE)
|
||||
{
|
||||
if (leveltime >= 4*TICRATE)
|
||||
player->realtime = leveltime - 4*TICRATE;
|
||||
|
|
|
@ -1169,9 +1169,11 @@ static void R_Subsector(size_t num)
|
|||
while (count--)
|
||||
{
|
||||
// CONS_Debug(DBG_GAMELOGIC, "Adding normal line %d...(%d)\n", line->linedef-lines, leveltime);
|
||||
if (!line->glseg
|
||||
#ifdef POLYOBJECTS
|
||||
if (!line->polyseg) // ignore segs that belong to polyobjects
|
||||
&& !line->polyseg // ignore segs that belong to polyobjects
|
||||
#endif
|
||||
)
|
||||
R_AddLine(line);
|
||||
line++;
|
||||
curline = NULL; /* cph 2001/11/18 - must clear curline now we're done with it, so stuff doesn't try using it for other things */
|
||||
|
|
|
@ -2095,7 +2095,6 @@ lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap)
|
|||
/////////////////////
|
||||
// This code creates the colormap array used by software renderer
|
||||
/////////////////////
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
double r, g, b, cbrightness;
|
||||
int p;
|
||||
|
@ -2717,7 +2716,7 @@ void R_PrecacheLevel(void)
|
|||
lump = sf->lumppat[k];
|
||||
if (devparm)
|
||||
spritememory += W_LumpLength(lump);
|
||||
W_CachePatchNum(lump, PU_CACHE);
|
||||
W_CachePatchNum(lump, PU_PATCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
47
src/r_defs.h
47
src/r_defs.h
|
@ -384,17 +384,6 @@ typedef struct sector_s
|
|||
// for fade thinker
|
||||
INT16 spawn_lightlevel;
|
||||
|
||||
// these are saved for netgames, so do not let Lua touch these!
|
||||
INT32 spawn_nexttag, spawn_firsttag; // the actual nexttag/firsttag values may differ if the sector's tag was changed
|
||||
|
||||
// offsets sector spawned with (via linedef type 7)
|
||||
fixed_t spawn_flr_xoffs, spawn_flr_yoffs;
|
||||
fixed_t spawn_ceil_xoffs, spawn_ceil_yoffs;
|
||||
|
||||
// flag angles sector spawned with (via linedef type 7)
|
||||
angle_t spawn_flrpic_angle;
|
||||
angle_t spawn_ceilpic_angle;
|
||||
|
||||
// colormap structure
|
||||
extracolormap_t *spawn_extra_colormap;
|
||||
} sector_t;
|
||||
|
@ -447,14 +436,10 @@ typedef struct line_s
|
|||
polyobj_t *polyobj; // Belongs to a polyobject?
|
||||
#endif
|
||||
|
||||
char *text; // a concatination of all front and back texture names, for linedef specials that require a string.
|
||||
char *text; // a concatenation of all front and back texture names, for linedef specials that require a string.
|
||||
INT16 callcount; // no. of calls left before triggering, for the "X calls" linedef specials, defaults to 0
|
||||
} line_t;
|
||||
|
||||
//
|
||||
// The SideDef.
|
||||
//
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// add this to the calculated texture column
|
||||
|
@ -467,13 +452,16 @@ typedef struct
|
|||
// We do not maintain names here.
|
||||
INT32 toptexture, bottomtexture, midtexture;
|
||||
|
||||
// Sector the SideDef is facing.
|
||||
// Linedef the sidedef belongs to
|
||||
line_t *line;
|
||||
|
||||
// Sector the sidedef is facing.
|
||||
sector_t *sector;
|
||||
|
||||
INT16 special; // the special of the linedef this side belongs to
|
||||
INT16 repeatcnt; // # of times to repeat midtexture
|
||||
|
||||
char *text; // a concatination of all top, bottom, and mid texture names, for linedef specials that require a string.
|
||||
char *text; // a concatenation of all top, bottom, and mid texture names, for linedef specials that require a string.
|
||||
|
||||
extracolormap_t *colormap_data; // storage for colormaps; not applied to sectors.
|
||||
} side_t;
|
||||
|
@ -598,6 +586,7 @@ typedef struct seg_s
|
|||
polyobj_t *polyseg;
|
||||
boolean dontrenderme;
|
||||
#endif
|
||||
boolean glseg;
|
||||
} seg_t;
|
||||
|
||||
//
|
||||
|
@ -742,9 +731,9 @@ typedef struct
|
|||
boolean cached[8];
|
||||
#ifdef HWRENDER
|
||||
aatree_t *hardware_patch[8];
|
||||
#endif
|
||||
#endif/*HWRENDER*/
|
||||
} rotsprite_t;
|
||||
#endif
|
||||
#endif/*ROTSPRITE*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -756,6 +745,24 @@ typedef enum
|
|||
SRF_NONE = 0xff // Initial value
|
||||
} spriterotateflags_t; // SRF's up!
|
||||
|
||||
// Same as a patch_t, except just the header
|
||||
// and the wadnum/lumpnum combination that points
|
||||
// to wherever the patch is in memory.
|
||||
struct patchinfo_s
|
||||
{
|
||||
INT16 width; // bounding box size
|
||||
INT16 height;
|
||||
INT16 leftoffset; // pixels to the left of origin
|
||||
INT16 topoffset; // pixels below the origin
|
||||
|
||||
UINT16 wadnum; // the software patch lump num for when the patch
|
||||
UINT16 lumpnum; // was flushed, and we need to re-create it
|
||||
|
||||
// next patchinfo_t in memory
|
||||
struct patchinfo_s *next;
|
||||
};
|
||||
typedef struct patchinfo_s patchinfo_t;
|
||||
|
||||
//
|
||||
// Sprites are patches with a special naming convention so they can be
|
||||
// recognized by R_InitSprites.
|
||||
|
|
22
src/r_main.c
22
src/r_main.c
|
@ -19,6 +19,7 @@
|
|||
#include "r_local.h"
|
||||
#include "r_splats.h" // faB(21jan): testing
|
||||
#include "r_sky.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "st_stuff.h"
|
||||
#include "p_local.h"
|
||||
#include "keys.h"
|
||||
|
@ -28,6 +29,7 @@
|
|||
#include "d_main.h"
|
||||
#include "v_video.h"
|
||||
#include "p_spec.h" // skyboxmo
|
||||
#include "p_setup.h"
|
||||
#include "z_zone.h"
|
||||
#include "m_random.h" // quake camera shake
|
||||
#include "r_portal.h"
|
||||
|
@ -1154,6 +1156,26 @@ void R_RenderPlayerView(player_t *player)
|
|||
free(masks);
|
||||
}
|
||||
|
||||
// Lactozilla: Renderer switching
|
||||
#ifdef HWRENDER
|
||||
void R_InitHardwareMode(void)
|
||||
{
|
||||
HWR_AddSessionCommands();
|
||||
HWR_Switch();
|
||||
HWR_LoadTextures(numtextures);
|
||||
if (gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction))
|
||||
HWR_SetupLevel();
|
||||
}
|
||||
#endif
|
||||
|
||||
void R_ReloadHUDGraphics(void)
|
||||
{
|
||||
CONS_Debug(DBG_RENDER, "R_ReloadHUDGraphics()...\n");
|
||||
ST_LoadGraphics();
|
||||
HU_LoadGraphics();
|
||||
ST_ReloadSkinFaceGraphics();
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// ENGINE COMMANDS & VARS
|
||||
// =========================================================================
|
||||
|
|
|
@ -89,6 +89,10 @@ extern consvar_t cv_tailspickup;
|
|||
|
||||
// Called by startup code.
|
||||
void R_Init(void);
|
||||
#ifdef HWRENDER
|
||||
void R_InitHardwareMode(void);
|
||||
#endif
|
||||
void R_ReloadHUDGraphics(void);
|
||||
|
||||
// just sets setsizeneeded true
|
||||
extern boolean setsizeneeded;
|
||||
|
|
113
src/r_patch.c
113
src/r_patch.c
|
@ -49,8 +49,6 @@
|
|||
#endif
|
||||
|
||||
static unsigned char imgbuf[1<<26];
|
||||
fixed_t cosang2rad[ROTANGLES];
|
||||
fixed_t sinang2rad[ROTANGLES];
|
||||
|
||||
//
|
||||
// R_CheckIfPatch
|
||||
|
@ -789,11 +787,9 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info)
|
|||
size_t sprinfoTokenLength;
|
||||
char *frameChar = NULL;
|
||||
UINT8 frameFrame = 0xFF;
|
||||
#ifdef ROTSPRITE
|
||||
INT16 frameXPivot = 0;
|
||||
INT16 frameYPivot = 0;
|
||||
rotaxis_t frameRotAxis = 0;
|
||||
#endif
|
||||
|
||||
// Sprite identifier
|
||||
sprinfoToken = M_GetToken(NULL);
|
||||
|
@ -828,7 +824,6 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info)
|
|||
}
|
||||
while (strcmp(sprinfoToken,"}")!=0)
|
||||
{
|
||||
#ifdef ROTSPRITE
|
||||
if (stricmp(sprinfoToken, "XPIVOT")==0)
|
||||
{
|
||||
Z_Free(sprinfoToken);
|
||||
|
@ -852,7 +847,6 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info)
|
|||
else if ((stricmp(sprinfoToken, "Z")==0) || (stricmp(sprinfoToken, "ZAXIS")==0) || (stricmp(sprinfoToken, "YAW")==0))
|
||||
frameRotAxis = ROTAXIS_Z;
|
||||
}
|
||||
#endif
|
||||
Z_Free(sprinfoToken);
|
||||
|
||||
sprinfoToken = M_GetToken(NULL);
|
||||
|
@ -866,11 +860,9 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info)
|
|||
}
|
||||
|
||||
// set fields
|
||||
#ifdef ROTSPRITE
|
||||
info->pivot[frameFrame].x = frameXPivot;
|
||||
info->pivot[frameFrame].y = frameYPivot;
|
||||
info->pivot[frameFrame].rotaxis = frameRotAxis;
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1093,16 +1085,60 @@ void R_LoadSpriteInfoLumps(UINT16 wadnum, UINT16 numlumps)
|
|||
for (i = 0; i < numlumps; i++, lumpinfo++)
|
||||
{
|
||||
name = lumpinfo->name;
|
||||
// load SPRTINFO lumps
|
||||
if (!stricmp(name, "SPRTINFO"))
|
||||
// Load SPRTINFO and SPR_ lumps as SpriteInfo
|
||||
if (!memcmp(name, "SPRTINFO", 8) || !memcmp(name, "SPR_", 4))
|
||||
R_ParseSPRTINFOLump(wadnum, i);
|
||||
// load SPR_ lumps (as DEHACKED lump)
|
||||
else if (!memcmp(name, "SPR_", 4))
|
||||
DEH_LoadDehackedLumpPwad(wadnum, i, false);
|
||||
}
|
||||
}
|
||||
|
||||
static UINT16 GetPatchPixel(patch_t *patch, INT32 x, INT32 y, boolean flip)
|
||||
{
|
||||
fixed_t ofs;
|
||||
column_t *column;
|
||||
UINT8 *source;
|
||||
|
||||
if (x >= 0 && x < SHORT(patch->width))
|
||||
{
|
||||
INT32 topdelta, prevdelta = -1;
|
||||
column = (column_t *)((UINT8 *)patch + LONG(patch->columnofs[flip ? (patch->width-1-x) : x]));
|
||||
while (column->topdelta != 0xff)
|
||||
{
|
||||
topdelta = column->topdelta;
|
||||
if (topdelta <= prevdelta)
|
||||
topdelta += prevdelta;
|
||||
prevdelta = topdelta;
|
||||
source = (UINT8 *)(column) + 3;
|
||||
for (ofs = 0; ofs < column->length; ofs++)
|
||||
{
|
||||
if ((topdelta + ofs) == y)
|
||||
return source[ofs];
|
||||
}
|
||||
column = (column_t *)((UINT8 *)column + column->length + 4);
|
||||
}
|
||||
}
|
||||
|
||||
return 0xFF00;
|
||||
}
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
//
|
||||
// R_GetRollAngle
|
||||
//
|
||||
// Angles precalculated in R_InitSprites.
|
||||
//
|
||||
fixed_t rollcosang[ROTANGLES];
|
||||
fixed_t rollsinang[ROTANGLES];
|
||||
INT32 R_GetRollAngle(angle_t rollangle)
|
||||
{
|
||||
INT32 ra = AngleFixed(rollangle)>>FRACBITS;
|
||||
#if (ROTANGDIFF > 1)
|
||||
ra += (ROTANGDIFF/2);
|
||||
#endif
|
||||
ra /= ROTANGDIFF;
|
||||
ra %= ROTANGLES;
|
||||
return ra;
|
||||
}
|
||||
|
||||
//
|
||||
// R_CacheRotSprite
|
||||
//
|
||||
|
@ -1114,8 +1150,8 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
|
|||
INT32 angle;
|
||||
patch_t *patch;
|
||||
patch_t *newpatch;
|
||||
UINT16 *rawsrc, *rawdst;
|
||||
size_t size, size2;
|
||||
UINT16 *rawdst;
|
||||
size_t size;
|
||||
INT32 bflip = (flip != 0x00);
|
||||
|
||||
#define SPRITE_XCENTER (leftoffset)
|
||||
|
@ -1160,23 +1196,12 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
|
|||
leftoffset = width - leftoffset;
|
||||
}
|
||||
|
||||
// Draw the sprite to a temporary buffer.
|
||||
size = (width*height);
|
||||
rawsrc = Z_Malloc(size * sizeof(UINT16), PU_STATIC, NULL);
|
||||
|
||||
// can't memset here
|
||||
for (i = 0; i < size; i++)
|
||||
rawsrc[i] = 0xFF00;
|
||||
|
||||
R_PatchToFlat_16bpp(patch, rawsrc, bflip);
|
||||
|
||||
// Don't cache angle = 0
|
||||
for (angle = 1; angle < ROTANGLES; angle++)
|
||||
{
|
||||
INT32 newwidth, newheight;
|
||||
|
||||
ca = cosang2rad[angle];
|
||||
sa = sinang2rad[angle];
|
||||
ca = rollcosang[angle];
|
||||
sa = rollsinang[angle];
|
||||
|
||||
// Find the dimensions of the rotated patch.
|
||||
{
|
||||
|
@ -1237,17 +1262,15 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
|
|||
#undef BOUNDARYADJUST
|
||||
}
|
||||
|
||||
size2 = (newwidth * newheight);
|
||||
if (!size2)
|
||||
size2 = size;
|
||||
// Draw the rotated sprite to a temporary buffer.
|
||||
size = (newwidth * newheight);
|
||||
if (!size)
|
||||
size = (width * height);
|
||||
|
||||
rawdst = Z_Malloc(size2 * sizeof(UINT16), PU_STATIC, NULL);
|
||||
|
||||
// can't memset here
|
||||
for (i = 0; i < size2; i++)
|
||||
rawdst = Z_Malloc(size * sizeof(UINT16), PU_STATIC, NULL);
|
||||
for (i = 0; i < size; i++)
|
||||
rawdst[i] = 0xFF00;
|
||||
|
||||
// Draw the rotated sprite to a temporary buffer.
|
||||
for (dy = 0; dy < newheight; dy++)
|
||||
{
|
||||
for (dx = 0; dx < newwidth; dx++)
|
||||
|
@ -1259,7 +1282,7 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
|
|||
sx >>= FRACBITS;
|
||||
sy >>= FRACBITS;
|
||||
if (sx >= 0 && sy >= 0 && sx < width && sy < height)
|
||||
rawdst[(dy*newwidth)+dx] = rawsrc[(sy*width)+sx];
|
||||
rawdst[(dy*newwidth)+dx] = GetPatchPixel(patch, sx, sy, bflip);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1296,7 +1319,6 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
|
|||
sprframe->rotsprite.cached[rot] = true;
|
||||
|
||||
// free image data
|
||||
Z_Free(rawsrc);
|
||||
Z_Free(patch);
|
||||
}
|
||||
#undef SPRITE_XCENTER
|
||||
|
@ -1374,4 +1396,19 @@ void R_FreeSkinRotSprite(size_t skinnum)
|
|||
skinsprites++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// R_FreeAllRotSprite
|
||||
//
|
||||
// Free ALL sprite rotation data from memory.
|
||||
//
|
||||
void R_FreeAllRotSprite(void)
|
||||
{
|
||||
INT32 i;
|
||||
size_t s;
|
||||
for (s = 0; s < numsprites; s++)
|
||||
R_FreeSingleRotSprite(&sprites[s]);
|
||||
for (i = 0; i < numskins; ++i)
|
||||
R_FreeSkinRotSprite(i);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "doomdef.h"
|
||||
|
||||
// Structs
|
||||
#ifdef ROTSPRITE
|
||||
typedef enum
|
||||
{
|
||||
ROTAXIS_X, // Roll (the default)
|
||||
|
@ -31,13 +30,10 @@ typedef struct
|
|||
INT32 x, y;
|
||||
rotaxis_t rotaxis;
|
||||
} spriteframepivot_t;
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#ifdef ROTSPRITE
|
||||
spriteframepivot_t pivot[64];
|
||||
#endif
|
||||
boolean available;
|
||||
} spriteinfo_t;
|
||||
|
||||
|
@ -66,11 +62,13 @@ void R_ParseSPRTINFOLump(UINT16 wadNum, UINT16 lumpNum);
|
|||
|
||||
// Sprite rotation
|
||||
#ifdef ROTSPRITE
|
||||
INT32 R_GetRollAngle(angle_t rollangle);
|
||||
void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, spriteframe_t *sprframe, INT32 rot, UINT8 flip);
|
||||
void R_FreeSingleRotSprite(spritedef_t *spritedef);
|
||||
void R_FreeSkinRotSprite(size_t skinnum);
|
||||
extern fixed_t cosang2rad[ROTANGLES];
|
||||
extern fixed_t sinang2rad[ROTANGLES];
|
||||
extern fixed_t rollcosang[ROTANGLES];
|
||||
extern fixed_t rollsinang[ROTANGLES];
|
||||
void R_FreeAllRotSprite(void);
|
||||
#endif
|
||||
|
||||
#endif // __R_PATCH__
|
||||
|
|
|
@ -165,7 +165,7 @@ static void R_DrawWallSplats(void)
|
|||
mfloorclip = floorclip;
|
||||
mceilingclip = ceilingclip;
|
||||
|
||||
patch = W_CachePatchNum(splat->patch, PU_CACHE);
|
||||
patch = W_CachePatchNum(splat->patch, PU_PATCH);
|
||||
|
||||
dc_texturemid = splat->top + (SHORT(patch->height)<<(FRACBITS-1)) - viewz;
|
||||
if (splat->yoffset)
|
||||
|
@ -308,6 +308,10 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
|
|||
// for horizontal / vertical / diagonal. Diagonal?
|
||||
// OPTIMIZE: get rid of LIGHTSEGSHIFT globally
|
||||
curline = ds->curline;
|
||||
|
||||
if (curline->glseg)
|
||||
return;
|
||||
|
||||
frontsector = curline->frontsector;
|
||||
backsector = curline->backsector;
|
||||
texnum = R_GetTextureNum(curline->sidedef->midtexture);
|
||||
|
|
|
@ -147,7 +147,7 @@ void R_AddWallSplat(line_t *wallline, INT16 sectorside, const char *patchname, f
|
|||
splat->flags = flags;
|
||||
|
||||
// bad.. but will be needed for drawing anyway..
|
||||
patch = W_CachePatchNum(splat->patch, PU_CACHE);
|
||||
patch = W_CachePatchNum(splat->patch, PU_PATCH);
|
||||
|
||||
// offset needed by draw code for texture mapping
|
||||
linelength = P_SegLength((seg_t *)wallline);
|
||||
|
|
|
@ -63,6 +63,7 @@ extern seg_t *segs;
|
|||
|
||||
extern size_t numsectors;
|
||||
extern sector_t *sectors;
|
||||
extern sector_t *spawnsectors;
|
||||
|
||||
extern size_t numsubsectors;
|
||||
extern subsector_t *subsectors;
|
||||
|
@ -72,9 +73,11 @@ extern node_t *nodes;
|
|||
|
||||
extern size_t numlines;
|
||||
extern line_t *lines;
|
||||
extern line_t *spawnlines;
|
||||
|
||||
extern size_t numsides;
|
||||
extern side_t *sides;
|
||||
extern side_t *spawnsides;
|
||||
|
||||
//
|
||||
// POV data.
|
||||
|
|
|
@ -126,11 +126,10 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch
|
|||
for (ang = 0; ang < ROTANGLES; ang++)
|
||||
sprtemp[frame].rotsprite.patch[r][ang] = NULL;
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
sprtemp[frame].rotsprite.hardware_patch[r] = M_AATreeAlloc(AATREE_ZUSER);
|
||||
#endif // HWRENDER
|
||||
sprtemp[frame].rotsprite.hardware_patch[r] = M_AATreeAlloc(AATREE_ZUSER);
|
||||
#endif/*HWRENDER*/
|
||||
}
|
||||
#endif
|
||||
#endif/*ROTSPRITE*/
|
||||
|
||||
if (rotation == 0)
|
||||
{
|
||||
|
@ -500,7 +499,7 @@ void R_InitSprites(void)
|
|||
{
|
||||
size_t i;
|
||||
#ifdef ROTSPRITE
|
||||
INT32 angle, realangle = 0;
|
||||
INT32 angle;
|
||||
float fa;
|
||||
#endif
|
||||
|
||||
|
@ -508,12 +507,11 @@ void R_InitSprites(void)
|
|||
negonearray[i] = -1;
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
for (angle = 0; angle < ROTANGLES; angle++)
|
||||
for (angle = 1; angle < ROTANGLES; angle++)
|
||||
{
|
||||
fa = ANG2RAD(FixedAngle(realangle<<FRACBITS));
|
||||
cosang2rad[angle] = FLOAT_TO_FIXED(cos(-fa));
|
||||
sinang2rad[angle] = FLOAT_TO_FIXED(sin(-fa));
|
||||
realangle += ROTANGDIFF;
|
||||
fa = ANG2RAD(FixedAngle((ROTANGDIFF * angle)<<FRACBITS));
|
||||
rollcosang[angle] = FLOAT_TO_FIXED(cos(-fa));
|
||||
rollsinang[angle] = FLOAT_TO_FIXED(sin(-fa));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1127,8 +1125,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
fixed_t spr_offset, spr_topoffset;
|
||||
#ifdef ROTSPRITE
|
||||
patch_t *rotsprite = NULL;
|
||||
angle_t arollangle = thing->rollangle;
|
||||
UINT32 rollangle = AngleFixed(arollangle)>>FRACBITS;
|
||||
INT32 rollangle = 0;
|
||||
#endif
|
||||
|
||||
#ifndef PROPERPAPER
|
||||
|
@ -1260,11 +1257,11 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
spr_topoffset = spritecachedinfo[lump].topoffset;
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
if (rollangle > 0)
|
||||
if (thing->rollangle)
|
||||
{
|
||||
rollangle = R_GetRollAngle(thing->rollangle);
|
||||
if (!sprframe->rotsprite.cached[rot])
|
||||
R_CacheRotSprite(thing->sprite, (thing->frame & FF_FRAMEMASK), sprinfo, sprframe, rot, flip);
|
||||
rollangle /= ROTANGDIFF;
|
||||
rotsprite = sprframe->rotsprite.patch[rot][rollangle];
|
||||
if (rotsprite != NULL)
|
||||
{
|
||||
|
@ -2839,7 +2836,7 @@ boolean R_SkinUsable(INT32 playernum, INT32 skinnum)
|
|||
{
|
||||
return ((skinnum == -1) // Simplifies things elsewhere, since there's already plenty of checks for less-than-0...
|
||||
|| (!skins[skinnum].availability)
|
||||
|| ((playernum != -1) ? (players[playernum].availabilities & (1 << skinnum)) : (unlockables[skins[skinnum].availability - 1].unlocked))
|
||||
|| (((netgame || multiplayer) && playernum != -1) ? (players[playernum].availabilities & (1 << skinnum)) : (unlockables[skins[skinnum].availability - 1].unlocked))
|
||||
|| (modeattacking) // If you have someone else's run you might as well take a look
|
||||
|| (Playing() && (R_SkinAvailable(mapheaderinfo[gamemap-1]->forcecharacter) == skinnum)) // Force 1.
|
||||
|| (netgame && (cv_forceskin.value == skinnum)) // Force 2.
|
||||
|
|
|
@ -61,7 +61,9 @@ static void GameMIDIMusic_OnChange(void);
|
|||
static void GameSounds_OnChange(void);
|
||||
static void GameDigiMusic_OnChange(void);
|
||||
|
||||
#ifdef HAVE_OPENMPT
|
||||
static void ModFilter_OnChange(void);
|
||||
#endif
|
||||
|
||||
static lumpnum_t S_GetMusicLumpNum(const char *mname);
|
||||
|
||||
|
|
94
src/screen.c
94
src/screen.c
|
@ -53,6 +53,7 @@ void (*spanfuncs_npo2[SPANDRAWFUNC_MAX])(void);
|
|||
// ------------------
|
||||
viddef_t vid;
|
||||
INT32 setmodeneeded; //video mode change needed if > 0 (the mode number to set + 1)
|
||||
UINT8 setrenderneeded = 0;
|
||||
|
||||
static CV_PossibleValue_t scr_depth_cons_t[] = {{8, "8 bits"}, {16, "16 bits"}, {24, "24 bits"}, {32, "32 bits"}, {0, NULL}};
|
||||
|
||||
|
@ -62,7 +63,11 @@ consvar_t cv_scr_height = {"scr_height", "800", CV_SAVE, CV_Unsigned, NULL, 0, N
|
|||
consvar_t cv_scr_depth = {"scr_depth", "16 bits", CV_SAVE, scr_depth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void SCR_ChangeFullscreen (void);
|
||||
static void SCR_ActuallyChangeRenderer(void);
|
||||
CV_PossibleValue_t cv_renderer_t[] = {{1, "Software"}, {2, "OpenGL"}, {0, NULL}};
|
||||
consvar_t cv_renderer = {"renderer", "Software", CV_SAVE|CV_NOLUA|CV_CALL, cv_renderer_t, SCR_ChangeRenderer, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void SCR_ChangeFullscreen(void);
|
||||
|
||||
consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, CV_YesNo, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
|
@ -87,19 +92,8 @@ boolean R_3DNow = false;
|
|||
boolean R_MMXExt = false;
|
||||
boolean R_SSE2 = false;
|
||||
|
||||
|
||||
void SCR_SetMode(void)
|
||||
void SCR_SetDrawFuncs(void)
|
||||
{
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
if (!setmodeneeded || WipeInAction)
|
||||
return; // should never happen and don't change it during a wipe, BAD!
|
||||
|
||||
VID_SetMode(--setmodeneeded);
|
||||
|
||||
V_SetPalette(0);
|
||||
|
||||
//
|
||||
// setup the right draw routines for either 8bpp or 16bpp
|
||||
//
|
||||
|
@ -193,9 +187,37 @@ void SCR_SetMode(void)
|
|||
if (SCR_IsAspectCorrect(vid.width, vid.height))
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Resolution is not aspect-correct!\nUse a multiple of %dx%d\n"), BASEVIDWIDTH, BASEVIDHEIGHT);
|
||||
*/
|
||||
}
|
||||
|
||||
void SCR_SetMode(void)
|
||||
{
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
if (!(setmodeneeded || setrenderneeded) || WipeInAction)
|
||||
return; // should never happen and don't change it during a wipe, BAD!
|
||||
|
||||
// Lactozilla: Renderer switching
|
||||
if (setrenderneeded)
|
||||
{
|
||||
Z_PreparePatchFlush();
|
||||
needpatchflush = true;
|
||||
needpatchrecache = true;
|
||||
VID_CheckRenderer();
|
||||
if (!setmodeneeded)
|
||||
VID_SetMode(vid.modenum);
|
||||
}
|
||||
|
||||
if (setmodeneeded)
|
||||
VID_SetMode(--setmodeneeded);
|
||||
|
||||
V_SetPalette(0);
|
||||
|
||||
SCR_SetDrawFuncs();
|
||||
|
||||
// set the apprpriate drawer for the sky (tall or INT16)
|
||||
setmodeneeded = 0;
|
||||
setrenderneeded = 0;
|
||||
}
|
||||
|
||||
// do some initial settings for the game loading screen
|
||||
|
@ -383,6 +405,8 @@ void SCR_CheckDefaultMode(void)
|
|||
// see note above
|
||||
setmodeneeded = VID_GetModeForSize(cv_scr_width.value, cv_scr_height.value) + 1;
|
||||
}
|
||||
|
||||
SCR_ActuallyChangeRenderer();
|
||||
}
|
||||
|
||||
// sets the modenum as the new default video mode to be saved in the config file
|
||||
|
@ -412,6 +436,50 @@ void SCR_ChangeFullscreen(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static int target_renderer = 0;
|
||||
|
||||
void SCR_ActuallyChangeRenderer(void)
|
||||
{
|
||||
setrenderneeded = target_renderer;
|
||||
// setting the same renderer twice WILL crash your game, so let's not, please
|
||||
if (rendermode == setrenderneeded)
|
||||
setrenderneeded = 0;
|
||||
}
|
||||
|
||||
// Lactozilla: Renderer switching
|
||||
void SCR_ChangeRenderer(void)
|
||||
{
|
||||
setrenderneeded = 0;
|
||||
|
||||
if (con_startup)
|
||||
{
|
||||
target_renderer = cv_renderer.value;
|
||||
if (M_CheckParm("-opengl"))
|
||||
target_renderer = rendermode = render_opengl;
|
||||
else if (M_CheckParm("-software"))
|
||||
target_renderer = rendermode = render_soft;
|
||||
// set cv_renderer back
|
||||
SCR_ChangeRendererCVars(rendermode);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cv_renderer.value == 1)
|
||||
target_renderer = render_soft;
|
||||
else if (cv_renderer.value == 2)
|
||||
target_renderer = render_opengl;
|
||||
SCR_ActuallyChangeRenderer();
|
||||
}
|
||||
|
||||
void SCR_ChangeRendererCVars(INT32 mode)
|
||||
{
|
||||
// set cv_renderer back
|
||||
if (mode == render_soft)
|
||||
CV_StealthSetValue(&cv_renderer, 1);
|
||||
else if (mode == render_opengl)
|
||||
CV_StealthSetValue(&cv_renderer, 2);
|
||||
CV_StealthSetValue(&cv_newrenderer, cv_renderer.value);
|
||||
}
|
||||
|
||||
boolean SCR_IsAspectCorrect(INT32 width, INT32 height)
|
||||
{
|
||||
return
|
||||
|
|
11
src/screen.h
11
src/screen.h
|
@ -170,18 +170,27 @@ extern boolean R_SSE2;
|
|||
// ----------------
|
||||
// screen variables
|
||||
// ----------------
|
||||
|
||||
extern viddef_t vid;
|
||||
extern INT32 setmodeneeded; // mode number to set if needed, or 0
|
||||
|
||||
void SCR_ChangeRenderer(void);
|
||||
void SCR_ChangeRendererCVars(INT32 mode);
|
||||
extern UINT8 setrenderneeded;
|
||||
|
||||
extern INT32 scr_bpp;
|
||||
extern UINT8 *scr_borderpatch; // patch used to fill the view borders
|
||||
|
||||
extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_fullscreen;
|
||||
extern CV_PossibleValue_t cv_renderer_t[];
|
||||
|
||||
extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_renderer, cv_fullscreen;
|
||||
extern consvar_t cv_newrenderer;
|
||||
// wait for page flipping to end or not
|
||||
extern consvar_t cv_vidwait;
|
||||
|
||||
// Change video mode, only at the start of a refresh.
|
||||
void SCR_SetMode(void);
|
||||
void SCR_SetDrawFuncs(void);
|
||||
// Recalc screen size dependent stuff
|
||||
void SCR_Recalc(void);
|
||||
// Check parms once at startup
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
#include "../i_video.h"
|
||||
#include "../console.h"
|
||||
#include "../command.h"
|
||||
#include "../r_main.h"
|
||||
#include "sdlmain.h"
|
||||
#ifdef HWRENDER
|
||||
#include "../hardware/hw_main.h"
|
||||
|
@ -1208,7 +1209,6 @@ void I_FinishUpdate(void)
|
|||
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
else if (rendermode == render_opengl)
|
||||
{
|
||||
|
@ -1408,37 +1408,53 @@ void VID_PrepareModeList(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
INT32 VID_SetMode(INT32 modeNum)
|
||||
static SDL_bool Impl_CreateContext(void)
|
||||
{
|
||||
SDLdoUngrabMouse();
|
||||
|
||||
vid.recalc = 1;
|
||||
vid.bpp = 1;
|
||||
|
||||
if (modeNum >= 0 && modeNum < MAXWINMODES)
|
||||
// Renderer-specific stuff
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
vid.width = windowedModes[modeNum][0];
|
||||
vid.height = windowedModes[modeNum][1];
|
||||
vid.modenum = modeNum;
|
||||
if (!sdlglcontext)
|
||||
sdlglcontext = SDL_GL_CreateContext(window);
|
||||
if (sdlglcontext == NULL)
|
||||
{
|
||||
SDL_DestroyWindow(window);
|
||||
I_Error("Failed to create a GL context: %s\n", SDL_GetError());
|
||||
}
|
||||
SDL_GL_MakeCurrent(window, sdlglcontext);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
// just set the desktop resolution as a fallback
|
||||
SDL_DisplayMode mode;
|
||||
SDL_GetWindowDisplayMode(window, &mode);
|
||||
if (mode.w >= 2048)
|
||||
int flags = 0; // Use this to set SDL_RENDERER_* flags now
|
||||
if (usesdl2soft)
|
||||
flags |= SDL_RENDERER_SOFTWARE;
|
||||
else if (cv_vidwait.value)
|
||||
flags |= SDL_RENDERER_PRESENTVSYNC;
|
||||
|
||||
if (!renderer)
|
||||
renderer = SDL_CreateRenderer(window, -1, flags);
|
||||
if (renderer == NULL)
|
||||
{
|
||||
vid.width = 1920;
|
||||
vid.height = 1200;
|
||||
CONS_Printf(M_GetText("Couldn't create rendering context: %s\n"), SDL_GetError());
|
||||
return SDL_FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
vid.width = mode.w;
|
||||
vid.height = mode.h;
|
||||
}
|
||||
vid.modenum = -1;
|
||||
SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT);
|
||||
}
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
if (setrenderneeded)
|
||||
{
|
||||
rendermode = setrenderneeded;
|
||||
Impl_CreateContext();
|
||||
}
|
||||
//Impl_SetWindowName("SRB2 "VERSIONSTRING);
|
||||
|
||||
SDLSetMode(vid.width, vid.height, USE_FULLSCREEN);
|
||||
Impl_VideoSetupBuffer();
|
||||
|
@ -1450,8 +1466,39 @@ INT32 VID_SetMode(INT32 modeNum)
|
|||
SDL_FreeSurface(bufSurface);
|
||||
bufSurface = NULL;
|
||||
}
|
||||
#ifdef HWRENDER
|
||||
HWR_FreeTextureCache();
|
||||
#endif
|
||||
SCR_SetDrawFuncs();
|
||||
}
|
||||
#ifdef HWRENDER
|
||||
else if (rendermode == render_opengl)
|
||||
{
|
||||
I_StartupHardwareGraphics();
|
||||
R_InitHardwareMode();
|
||||
HWR_Switch();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
INT32 VID_SetMode(INT32 modeNum)
|
||||
{
|
||||
SDLdoUngrabMouse();
|
||||
|
||||
vid.recalc = 1;
|
||||
vid.bpp = 1;
|
||||
|
||||
if (modeNum < 0)
|
||||
modeNum = 0;
|
||||
if (modeNum >= MAXWINMODES)
|
||||
modeNum = MAXWINMODES-1;
|
||||
|
||||
vid.width = windowedModes[modeNum][0];
|
||||
vid.height = windowedModes[modeNum][1];
|
||||
vid.modenum = modeNum;
|
||||
|
||||
//Impl_SetWindowName("SRB2 "VERSIONSTRING);
|
||||
VID_CheckRenderer();
|
||||
return SDL_TRUE;
|
||||
}
|
||||
|
||||
|
@ -1472,8 +1519,7 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
|
|||
flags |= SDL_WINDOW_BORDERLESS;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
flags |= SDL_WINDOW_OPENGL;
|
||||
flags |= SDL_WINDOW_OPENGL;
|
||||
#endif
|
||||
|
||||
// Create a window
|
||||
|
@ -1486,38 +1532,7 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
|
|||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
// Renderer-specific stuff
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
sdlglcontext = SDL_GL_CreateContext(window);
|
||||
if (sdlglcontext == NULL)
|
||||
{
|
||||
SDL_DestroyWindow(window);
|
||||
I_Error("Failed to create a GL context: %s\n", SDL_GetError());
|
||||
}
|
||||
SDL_GL_MakeCurrent(window, sdlglcontext);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
flags = 0; // Use this to set SDL_RENDERER_* flags now
|
||||
if (usesdl2soft)
|
||||
flags |= SDL_RENDERER_SOFTWARE;
|
||||
else if (cv_vidwait.value)
|
||||
flags |= SDL_RENDERER_PRESENTVSYNC;
|
||||
|
||||
renderer = SDL_CreateRenderer(window, -1, flags);
|
||||
if (renderer == NULL)
|
||||
{
|
||||
CONS_Printf(M_GetText("Couldn't create rendering context: %s\n"), SDL_GetError());
|
||||
return SDL_FALSE;
|
||||
}
|
||||
SDL_RenderSetLogicalSize(renderer, BASEVIDWIDTH, BASEVIDHEIGHT);
|
||||
}
|
||||
|
||||
return SDL_TRUE;
|
||||
return Impl_CreateContext();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1572,17 +1587,14 @@ static void Impl_VideoSetupSDLBuffer(void)
|
|||
static void Impl_VideoSetupBuffer(void)
|
||||
{
|
||||
// Set up game's software render buffer
|
||||
//if (rendermode == render_soft)
|
||||
vid.rowbytes = vid.width * vid.bpp;
|
||||
vid.direct = NULL;
|
||||
if (vid.buffer)
|
||||
free(vid.buffer);
|
||||
vid.buffer = calloc(vid.rowbytes*vid.height, NUMSCREENS);
|
||||
if (!vid.buffer)
|
||||
{
|
||||
vid.rowbytes = vid.width * vid.bpp;
|
||||
vid.direct = NULL;
|
||||
if (vid.buffer)
|
||||
free(vid.buffer);
|
||||
vid.buffer = calloc(vid.rowbytes*vid.height, NUMSCREENS);
|
||||
if (!vid.buffer)
|
||||
{
|
||||
I_Error("%s", M_GetText("Not enough memory for video buffer\n"));
|
||||
}
|
||||
I_Error("%s", M_GetText("Not enough memory for video buffer\n"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1626,10 +1638,13 @@ void I_StartupGraphics(void)
|
|||
))
|
||||
framebuffer = SDL_TRUE;
|
||||
}
|
||||
if (M_CheckParm("-software"))
|
||||
{
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (M_CheckParm("-opengl"))
|
||||
rendermode = render_opengl;
|
||||
else if (M_CheckParm("-software"))
|
||||
#endif
|
||||
rendermode = render_soft;
|
||||
}
|
||||
|
||||
usesdl2soft = M_CheckParm("-softblit");
|
||||
borderlesswindow = M_CheckParm("-borderless");
|
||||
|
@ -1637,44 +1652,7 @@ void I_StartupGraphics(void)
|
|||
//SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY>>1,SDL_DEFAULT_REPEAT_INTERVAL<<2);
|
||||
VID_Command_ModeList_f();
|
||||
#ifdef HWRENDER
|
||||
if (M_CheckParm("-opengl") || rendermode == render_opengl)
|
||||
{
|
||||
rendermode = render_opengl;
|
||||
HWD.pfnInit = hwSym("Init",NULL);
|
||||
HWD.pfnFinishUpdate = NULL;
|
||||
HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL);
|
||||
HWD.pfnDrawPolygon = hwSym("DrawPolygon",NULL);
|
||||
HWD.pfnRenderSkyDome = hwSym("RenderSkyDome",NULL);
|
||||
HWD.pfnSetBlend = hwSym("SetBlend",NULL);
|
||||
HWD.pfnClearBuffer = hwSym("ClearBuffer",NULL);
|
||||
HWD.pfnSetTexture = hwSym("SetTexture",NULL);
|
||||
HWD.pfnReadRect = hwSym("ReadRect",NULL);
|
||||
HWD.pfnGClipRect = hwSym("GClipRect",NULL);
|
||||
HWD.pfnClearMipMapCache = hwSym("ClearMipMapCache",NULL);
|
||||
HWD.pfnSetSpecialState = hwSym("SetSpecialState",NULL);
|
||||
HWD.pfnSetPalette = hwSym("SetPalette",NULL);
|
||||
HWD.pfnGetTextureUsed = hwSym("GetTextureUsed",NULL);
|
||||
HWD.pfnDrawModel = hwSym("DrawModel",NULL);
|
||||
HWD.pfnCreateModelVBOs = hwSym("CreateModelVBOs",NULL);
|
||||
HWD.pfnSetTransform = hwSym("SetTransform",NULL);
|
||||
HWD.pfnGetRenderVersion = hwSym("GetRenderVersion",NULL);
|
||||
HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
|
||||
HWD.pfnFlushScreenTextures=hwSym("FlushScreenTextures",NULL);
|
||||
HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL);
|
||||
HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL);
|
||||
HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);
|
||||
HWD.pfnDrawIntermissionBG=hwSym("DrawIntermissionBG",NULL);
|
||||
HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL);
|
||||
HWD.pfnMakeScreenFinalTexture=hwSym("MakeScreenFinalTexture",NULL);
|
||||
HWD.pfnDrawScreenFinalTexture=hwSym("DrawScreenFinalTexture",NULL);
|
||||
// check gl renderer lib
|
||||
if (HWD.pfnGetRenderVersion() != VERSION)
|
||||
I_Error("%s", M_GetText("The version of the renderer doesn't match the version of the executable\nBe sure you have installed SRB2 properly.\n"));
|
||||
if (!HWD.pfnInit(I_Error)) // let load the OpenGL library
|
||||
{
|
||||
rendermode = render_soft;
|
||||
}
|
||||
}
|
||||
I_StartupHardwareGraphics();
|
||||
#endif
|
||||
|
||||
// Fury: we do window initialization after GL setup to allow
|
||||
|
@ -1734,6 +1712,50 @@ void I_StartupGraphics(void)
|
|||
graphics_started = true;
|
||||
}
|
||||
|
||||
void I_StartupHardwareGraphics(void)
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
static boolean glstartup = false;
|
||||
if (!glstartup)
|
||||
{
|
||||
HWD.pfnInit = hwSym("Init",NULL);
|
||||
HWD.pfnFinishUpdate = NULL;
|
||||
HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL);
|
||||
HWD.pfnDrawPolygon = hwSym("DrawPolygon",NULL);
|
||||
HWD.pfnRenderSkyDome = hwSym("RenderSkyDome",NULL);
|
||||
HWD.pfnSetBlend = hwSym("SetBlend",NULL);
|
||||
HWD.pfnClearBuffer = hwSym("ClearBuffer",NULL);
|
||||
HWD.pfnSetTexture = hwSym("SetTexture",NULL);
|
||||
HWD.pfnReadRect = hwSym("ReadRect",NULL);
|
||||
HWD.pfnGClipRect = hwSym("GClipRect",NULL);
|
||||
HWD.pfnClearMipMapCache = hwSym("ClearMipMapCache",NULL);
|
||||
HWD.pfnSetSpecialState = hwSym("SetSpecialState",NULL);
|
||||
HWD.pfnSetPalette = hwSym("SetPalette",NULL);
|
||||
HWD.pfnGetTextureUsed = hwSym("GetTextureUsed",NULL);
|
||||
HWD.pfnDrawModel = hwSym("DrawModel",NULL);
|
||||
HWD.pfnCreateModelVBOs = hwSym("CreateModelVBOs",NULL);
|
||||
HWD.pfnSetTransform = hwSym("SetTransform",NULL);
|
||||
HWD.pfnGetRenderVersion = hwSym("GetRenderVersion",NULL);
|
||||
HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
|
||||
HWD.pfnFlushScreenTextures=hwSym("FlushScreenTextures",NULL);
|
||||
HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL);
|
||||
HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL);
|
||||
HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);
|
||||
HWD.pfnDrawIntermissionBG=hwSym("DrawIntermissionBG",NULL);
|
||||
HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL);
|
||||
HWD.pfnMakeScreenFinalTexture=hwSym("MakeScreenFinalTexture",NULL);
|
||||
HWD.pfnDrawScreenFinalTexture=hwSym("DrawScreenFinalTexture",NULL);
|
||||
// check gl renderer lib
|
||||
if (HWD.pfnGetRenderVersion() != VERSION)
|
||||
I_Error("%s", M_GetText("The version of the renderer doesn't match the version of the executable\nBe sure you have installed SRB2 properly.\n"));
|
||||
if (!HWD.pfnInit(I_Error)) // let load the OpenGL library
|
||||
rendermode = render_soft;
|
||||
else
|
||||
glstartup = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void I_ShutdownGraphics(void)
|
||||
{
|
||||
const rendermode_t oldrendermode = rendermode;
|
||||
|
|
|
@ -1432,6 +1432,8 @@ static void I_ResumeGME(void)
|
|||
|
||||
boolean I_LoadSong(char *data, size_t len)
|
||||
{
|
||||
(void)data;
|
||||
(void)len;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1493,6 +1495,7 @@ boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms
|
|||
(void)target_volume;
|
||||
(void)source_volume;
|
||||
(void)ms;
|
||||
(void)callback;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1500,6 +1503,7 @@ boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void))
|
|||
{
|
||||
(void)target_volume;
|
||||
(void)ms;
|
||||
(void)callback;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
158
src/st_stuff.c
158
src/st_stuff.c
|
@ -694,7 +694,7 @@ static void ST_drawTime(void)
|
|||
else
|
||||
{
|
||||
// Counting down the hidetime?
|
||||
if ((gametype == GT_TAG || gametype == GT_HIDEANDSEEK) && (stplyr->realtime <= (hidetime*TICRATE)))
|
||||
if ((gametyperules & GTR_HIDETIME) && (stplyr->realtime <= (hidetime*TICRATE)))
|
||||
{
|
||||
tics = (hidetime*TICRATE - stplyr->realtime);
|
||||
if (tics < 3*TICRATE)
|
||||
|
@ -705,11 +705,11 @@ static void ST_drawTime(void)
|
|||
else
|
||||
{
|
||||
// Hidetime finish!
|
||||
if ((gametype == GT_TAG || gametype == GT_HIDEANDSEEK) && (stplyr->realtime < ((hidetime+1)*TICRATE)))
|
||||
if ((gametyperules & GTR_HIDETIME) && (stplyr->realtime < ((hidetime+1)*TICRATE)))
|
||||
ST_drawRaceNum(hidetime*TICRATE - stplyr->realtime);
|
||||
|
||||
// Time limit?
|
||||
if (gametype != GT_COOP && gametype != GT_RACE && gametype != GT_COMPETITION && cv_timelimit.value && timelimitintics > 0)
|
||||
if ((gametyperules & GTR_TIMELIMIT) && cv_timelimit.value && timelimitintics > 0)
|
||||
{
|
||||
if (timelimitintics > stplyr->realtime)
|
||||
{
|
||||
|
@ -723,7 +723,7 @@ static void ST_drawTime(void)
|
|||
downwards = true;
|
||||
}
|
||||
// Post-hidetime normal.
|
||||
else if (gametype == GT_TAG || gametype == GT_HIDEANDSEEK)
|
||||
else if (gametyperules & GTR_TAG)
|
||||
tics = stplyr->realtime - hidetime*TICRATE;
|
||||
// "Shadow! What are you doing? Hurry and get back here
|
||||
// right now before the island blows up with you on it!"
|
||||
|
@ -912,7 +912,7 @@ static void ST_drawLivesArea(void)
|
|||
else if (stplyr->spectator)
|
||||
v_colmap = V_GRAYMAP;
|
||||
// Tag
|
||||
else if (gametype == GT_TAG || gametype == GT_HIDEANDSEEK)
|
||||
else if (gametyperules & GTR_TAG)
|
||||
{
|
||||
if (stplyr->pflags & PF_TAGIT)
|
||||
{
|
||||
|
@ -1187,21 +1187,33 @@ tic_t lt_exitticker = 0, lt_endtime = 0;
|
|||
|
||||
//
|
||||
// Load the graphics for the title card.
|
||||
// Don't let LJ see this
|
||||
//
|
||||
static void ST_cacheLevelTitle(void)
|
||||
{
|
||||
if (!(mapheaderinfo[gamemap-1]->levelflags & LF_WARNINGTITLE))
|
||||
{
|
||||
lt_patches[0] = (patch_t *)W_CachePatchName("LTACTBLU", PU_HUDGFX);
|
||||
lt_patches[1] = (patch_t *)W_CachePatchName("LTZIGZAG", PU_HUDGFX);
|
||||
lt_patches[2] = (patch_t *)W_CachePatchName("LTZZTEXT", PU_HUDGFX);
|
||||
}
|
||||
else // boss map
|
||||
{
|
||||
lt_patches[0] = (patch_t *)W_CachePatchName("LTACTRED", PU_HUDGFX);
|
||||
lt_patches[1] = (patch_t *)W_CachePatchName("LTZIGRED", PU_HUDGFX);
|
||||
lt_patches[2] = (patch_t *)W_CachePatchName("LTZZWARN", PU_HUDGFX);
|
||||
}
|
||||
#define SETPATCH(default, warning, custom, idx) \
|
||||
{ \
|
||||
lumpnum_t patlumpnum = LUMPERROR; \
|
||||
if (mapheaderinfo[gamemap-1]->custom[0] != '\0') \
|
||||
{ \
|
||||
patlumpnum = W_CheckNumForName(mapheaderinfo[gamemap-1]->custom); \
|
||||
if (patlumpnum != LUMPERROR) \
|
||||
lt_patches[idx] = (patch_t *)W_CachePatchNum(patlumpnum, PU_HUDGFX); \
|
||||
} \
|
||||
if (patlumpnum == LUMPERROR) \
|
||||
{ \
|
||||
if (!(mapheaderinfo[gamemap-1]->levelflags & LF_WARNINGTITLE)) \
|
||||
lt_patches[idx] = (patch_t *)W_CachePatchName(default, PU_HUDGFX); \
|
||||
else \
|
||||
lt_patches[idx] = (patch_t *)W_CachePatchName(warning, PU_HUDGFX); \
|
||||
} \
|
||||
}
|
||||
|
||||
SETPATCH("LTACTBLU", "LTACTRED", ltactdiamond, 0)
|
||||
SETPATCH("LTZIGZAG", "LTZIGRED", ltzzpatch, 1)
|
||||
SETPATCH("LTZZTEXT", "LTZZWARN", ltzztext, 2)
|
||||
|
||||
#undef SETPATCH
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1226,6 +1238,9 @@ void ST_startTitleCard(void)
|
|||
//
|
||||
void ST_preDrawTitleCard(void)
|
||||
{
|
||||
if (!G_IsTitleCardAvailable())
|
||||
return;
|
||||
|
||||
if (lt_ticker >= (lt_endtime + TICRATE))
|
||||
return;
|
||||
|
||||
|
@ -1241,6 +1256,9 @@ void ST_preDrawTitleCard(void)
|
|||
//
|
||||
void ST_runTitleCard(void)
|
||||
{
|
||||
if (!G_IsTitleCardAvailable())
|
||||
return;
|
||||
|
||||
if (lt_ticker >= (lt_endtime + TICRATE))
|
||||
return;
|
||||
|
||||
|
@ -1294,6 +1312,9 @@ void ST_drawTitleCard(void)
|
|||
INT32 zzticker;
|
||||
patch_t *actpat, *zigzag, *zztext;
|
||||
|
||||
if (!G_IsTitleCardAvailable())
|
||||
return;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (!LUA_HudEnabled(hud_stagetitle))
|
||||
goto luahook;
|
||||
|
@ -1772,7 +1793,7 @@ static void ST_drawNiGHTSHUD(void)
|
|||
ST_drawNiGHTSLink();
|
||||
}
|
||||
|
||||
if (gametype == GT_RACE || gametype == GT_COMPETITION)
|
||||
if (gametyperules & GTR_RACE)
|
||||
{
|
||||
ST_drawScore();
|
||||
ST_drawTime();
|
||||
|
@ -2213,34 +2234,37 @@ static void ST_drawTextHUD(void)
|
|||
|
||||
if (G_IsSpecialStage(gamemap))
|
||||
textHUDdraw(M_GetText("\x82""Wait for the stage to end..."))
|
||||
else if (gametype == GT_COOP)
|
||||
else if (G_PlatformGametype())
|
||||
{
|
||||
if (stplyr->lives <= 0
|
||||
&& cv_cooplives.value == 2
|
||||
&& (netgame || multiplayer))
|
||||
if (gametype == GT_COOP)
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (stplyr->lives <= 0
|
||||
&& cv_cooplives.value == 2
|
||||
&& (netgame || multiplayer))
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
INT32 i;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
if (&players[i] == stplyr)
|
||||
continue;
|
||||
if (&players[i] == stplyr)
|
||||
continue;
|
||||
|
||||
if (players[i].lives > 1)
|
||||
break;
|
||||
}
|
||||
if (players[i].lives > 1)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i != MAXPLAYERS)
|
||||
textHUDdraw(M_GetText("You'll steal a life on respawn..."))
|
||||
if (i != MAXPLAYERS)
|
||||
textHUDdraw(M_GetText("You'll steal a life on respawn..."))
|
||||
else
|
||||
textHUDdraw(M_GetText("Wait to respawn..."))
|
||||
}
|
||||
else
|
||||
textHUDdraw(M_GetText("Wait to respawn..."))
|
||||
}
|
||||
else
|
||||
textHUDdraw(M_GetText("Wait to respawn..."))
|
||||
}
|
||||
else
|
||||
else if (G_GametypeHasSpectators())
|
||||
textHUDdraw(M_GetText("\x82""FIRE:""\x80 Enter game"))
|
||||
}
|
||||
|
||||
|
@ -2283,13 +2307,14 @@ static void ST_drawTextHUD(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if ((gametype == GT_TAG || gametype == GT_HIDEANDSEEK) && (!stplyr->spectator))
|
||||
else if ((gametyperules & GTR_TAG) && (!stplyr->spectator))
|
||||
{
|
||||
if (leveltime < hidetime * TICRATE)
|
||||
{
|
||||
if (stplyr->pflags & PF_TAGIT)
|
||||
{
|
||||
textHUDdraw(M_GetText("\x82""You are blindfolded!"))
|
||||
if (gametyperules & GTR_BLINDFOLDED)
|
||||
textHUDdraw(M_GetText("\x82""You are blindfolded!"))
|
||||
textHUDdraw(M_GetText("Waiting for players to hide..."))
|
||||
}
|
||||
else if (gametype == GT_HIDEANDSEEK)
|
||||
|
@ -2304,7 +2329,8 @@ static void ST_drawTextHUD(void)
|
|||
textHUDdraw(M_GetText("\x82""VIEWPOINT:""\x80 Switch view"))
|
||||
donef12 = true;
|
||||
}
|
||||
textHUDdraw(M_GetText("You cannot move while hiding."))
|
||||
if (gametyperules & GTR_HIDEFROZEN)
|
||||
textHUDdraw(M_GetText("You cannot move while hiding."))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2326,21 +2352,27 @@ static void ST_drawTeamHUD(void)
|
|||
if (F_GetPromptHideHud(0)) // y base is 0
|
||||
return;
|
||||
|
||||
if (gametype == GT_CTF)
|
||||
if (gametyperules & GTR_TEAMFLAGS)
|
||||
p = bflagico;
|
||||
else
|
||||
p = bmatcico;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_HudEnabled(hud_teamscores))
|
||||
#endif
|
||||
V_DrawSmallScaledPatch(BASEVIDWIDTH/2 - SEP - SHORT(p->width)/4, 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, p);
|
||||
|
||||
if (gametype == GT_CTF)
|
||||
if (gametyperules & GTR_TEAMFLAGS)
|
||||
p = rflagico;
|
||||
else
|
||||
p = rmatcico;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_HudEnabled(hud_teamscores))
|
||||
#endif
|
||||
V_DrawSmallScaledPatch(BASEVIDWIDTH/2 + SEP - SHORT(p->width)/4, 4, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, p);
|
||||
|
||||
if (gametype != GT_CTF)
|
||||
if (!(gametyperules & GTR_TEAMFLAGS))
|
||||
goto num;
|
||||
{
|
||||
INT32 i;
|
||||
|
@ -2349,28 +2381,53 @@ static void ST_drawTeamHUD(void)
|
|||
// Show which flags aren't at base.
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (players[i].gotflag & GF_BLUEFLAG) // Blue flag isn't at base
|
||||
if (players[i].gotflag & GF_BLUEFLAG // Blue flag isn't at base
|
||||
#ifdef HAVE_BLUA
|
||||
&& LUA_HudEnabled(hud_teamscores)
|
||||
#endif
|
||||
)
|
||||
V_DrawScaledPatch(BASEVIDWIDTH/2 - SEP - SHORT(nonicon->width)/2, 0, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, nonicon);
|
||||
if (players[i].gotflag & GF_REDFLAG) // Red flag isn't at base
|
||||
|
||||
if (players[i].gotflag & GF_REDFLAG // Red flag isn't at base
|
||||
#ifdef HAVE_BLUA
|
||||
&& LUA_HudEnabled(hud_teamscores)
|
||||
#endif
|
||||
)
|
||||
V_DrawScaledPatch(BASEVIDWIDTH/2 + SEP - SHORT(nonicon2->width)/2, 0, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, nonicon2);
|
||||
|
||||
whichflag |= players[i].gotflag;
|
||||
|
||||
if ((whichflag & (GF_REDFLAG|GF_BLUEFLAG)) == (GF_REDFLAG|GF_BLUEFLAG))
|
||||
break; // both flags were found, let's stop early
|
||||
}
|
||||
|
||||
// Display a countdown timer showing how much time left until the flag returns to base.
|
||||
{
|
||||
if (blueflag && blueflag->fuse > 1)
|
||||
if (blueflag && blueflag->fuse > 1
|
||||
#ifdef HAVE_BLUA
|
||||
&& LUA_HudEnabled(hud_teamscores)
|
||||
#endif
|
||||
)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2 - SEP, 8, V_YELLOWMAP|V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, va("%u", (blueflag->fuse / TICRATE)));
|
||||
|
||||
if (redflag && redflag->fuse > 1)
|
||||
if (redflag && redflag->fuse > 1
|
||||
#ifdef HAVE_BLUA
|
||||
&& LUA_HudEnabled(hud_teamscores)
|
||||
#endif
|
||||
)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2 + SEP, 8, V_YELLOWMAP|V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, va("%u", (redflag->fuse / TICRATE)));
|
||||
}
|
||||
}
|
||||
|
||||
num:
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_HudEnabled(hud_teamscores))
|
||||
#endif
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2 - SEP, 16, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, va("%u", bluescore));
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_HudEnabled(hud_teamscores))
|
||||
#endif
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2 + SEP, 16, V_HUDTRANS|V_PERPLAYER|V_SNAPTOTOP, va("%u", redscore));
|
||||
|
||||
#undef SEP
|
||||
|
@ -2643,7 +2700,7 @@ static void ST_overlayDrawer(void)
|
|||
}
|
||||
|
||||
// If you are in overtime, put a big honkin' flashin' message on the screen.
|
||||
if (G_RingSlingerGametype() && cv_overtime.value
|
||||
if (((gametyperules & GTR_TIMELIMIT) && (gametyperules & GTR_OVERTIME)) && cv_overtime.value
|
||||
&& (leveltime > (timelimitintics + TICRATE/2)) && cv_timelimit.value && (leveltime/TICRATE % 2 == 0))
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 184, V_PERPLAYER, M_GetText("OVERTIME!"));
|
||||
|
||||
|
@ -2658,7 +2715,7 @@ static void ST_overlayDrawer(void)
|
|||
ST_drawMatchHUD();
|
||||
|
||||
// Race HUD Stuff
|
||||
if (gametype == GT_RACE || gametype == GT_COMPETITION)
|
||||
if (gametyperules & GTR_RACE)
|
||||
ST_drawRaceHUD();
|
||||
|
||||
// Emerald Hunt Indicators
|
||||
|
@ -2719,6 +2776,9 @@ static void ST_overlayDrawer(void)
|
|||
|
||||
void ST_Drawer(void)
|
||||
{
|
||||
if (needpatchrecache)
|
||||
R_ReloadHUDGraphics();
|
||||
|
||||
#ifdef SEENAMES
|
||||
if (cv_seenames.value && cv_allowseenames.value && displayplayer == consoleplayer && seenplayer && seenplayer->mo)
|
||||
{
|
||||
|
@ -2763,7 +2823,7 @@ void ST_Drawer(void)
|
|||
if (rendermode != render_none) ST_doPaletteStuff();
|
||||
|
||||
// Blindfold!
|
||||
if ((gametype == GT_TAG || gametype == GT_HIDEANDSEEK)
|
||||
if ((gametyperules & GTR_BLINDFOLDED)
|
||||
&& (leveltime < hidetime * TICRATE))
|
||||
{
|
||||
if (players[displayplayer].pflags & PF_TAGIT)
|
||||
|
|
|
@ -1045,13 +1045,13 @@ void V_DrawContinueIcon(INT32 x, INT32 y, INT32 flags, INT32 skinnum, UINT8 skin
|
|||
{
|
||||
spritedef_t *sprdef = &skins[skinnum].sprites[SPR2_XTRA];
|
||||
spriteframe_t *sprframe = &sprdef->spriteframes[XTRA_CONTINUE];
|
||||
patch_t *patch = W_CachePatchNum(sprframe->lumppat[0], PU_LEVEL);
|
||||
patch_t *patch = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
const UINT8 *colormap = R_GetTranslationColormap(skinnum, skincolor, GTC_CACHE);
|
||||
|
||||
V_DrawMappedPatch(x, y, flags, patch, colormap);
|
||||
}
|
||||
else
|
||||
V_DrawScaledPatch(x - 10, y - 14, flags, W_CachePatchName("CONTINS", PU_CACHE));
|
||||
V_DrawScaledPatch(x - 10, y - 14, flags, W_CachePatchName("CONTINS", PU_PATCH));
|
||||
}
|
||||
|
||||
//
|
||||
|
|
119
src/w_wad.c
119
src/w_wad.c
|
@ -55,6 +55,7 @@
|
|||
#include "dehacked.h"
|
||||
#include "d_clisrv.h"
|
||||
#include "r_defs.h"
|
||||
#include "r_data.h"
|
||||
#include "i_system.h"
|
||||
#include "md5.h"
|
||||
#include "lua_script.h"
|
||||
|
@ -1375,7 +1376,6 @@ void *W_CacheLumpNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
|
|||
|
||||
void *W_CacheLumpNum(lumpnum_t lumpnum, INT32 tag)
|
||||
{
|
||||
|
||||
return W_CacheLumpNumPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum),tag);
|
||||
}
|
||||
|
||||
|
@ -1488,12 +1488,31 @@ void *W_CacheLumpName(const char *name, INT32 tag)
|
|||
// Cache a patch into heap memory, convert the patch format as necessary
|
||||
//
|
||||
|
||||
void W_FlushCachedPatches(void)
|
||||
{
|
||||
if (needpatchflush)
|
||||
{
|
||||
Z_FreeTag(PU_CACHE);
|
||||
Z_FreeTag(PU_PATCH);
|
||||
Z_FreeTag(PU_HUDGFX);
|
||||
Z_FreeTag(PU_HWRPATCHINFO);
|
||||
Z_FreeTag(PU_HWRMODELTEXTURE);
|
||||
Z_FreeTag(PU_HWRCACHE);
|
||||
Z_FreeTags(PU_HWRCACHE_UNLOCKED, PU_HWRPATCHINFO_UNLOCKED);
|
||||
}
|
||||
needpatchflush = false;
|
||||
}
|
||||
|
||||
// Software-only compile cache the data without conversion
|
||||
void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
GLPatch_t *grPatch;
|
||||
#endif
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
if (!TestValidLump(wad, lump))
|
||||
return NULL;
|
||||
|
||||
|
@ -1872,3 +1891,101 @@ int W_VerifyNMUSlumps(const char *filename)
|
|||
};
|
||||
return W_VerifyFile(filename, NMUSlist, false);
|
||||
}
|
||||
|
||||
/** \brief Generates a virtual resource used for level data loading.
|
||||
*
|
||||
* \param lumpnum_t reference
|
||||
* \return Virtual resource
|
||||
*
|
||||
*/
|
||||
virtres_t* vres_GetMap(lumpnum_t lumpnum)
|
||||
{
|
||||
UINT32 i;
|
||||
virtres_t* vres = NULL;
|
||||
virtlump_t* vlumps = NULL;
|
||||
size_t numlumps = 0;
|
||||
|
||||
if (W_IsLumpWad(lumpnum))
|
||||
{
|
||||
// Remember that we're assuming that the WAD will have a specific set of lumps in a specific order.
|
||||
UINT8 *wadData = W_CacheLumpNum(lumpnum, PU_LEVEL);
|
||||
filelump_t *fileinfo = (filelump_t *)(wadData + ((wadinfo_t *)wadData)->infotableofs);
|
||||
numlumps = ((wadinfo_t *)wadData)->numlumps;
|
||||
vlumps = Z_Malloc(sizeof(virtlump_t)*numlumps, PU_LEVEL, NULL);
|
||||
|
||||
// Build the lumps.
|
||||
for (i = 0; i < numlumps; i++)
|
||||
{
|
||||
vlumps[i].size = (size_t)(((filelump_t *)(fileinfo + i))->size);
|
||||
// Play it safe with the name in this case.
|
||||
memcpy(vlumps[i].name, (fileinfo + i)->name, 8);
|
||||
vlumps[i].name[8] = '\0';
|
||||
vlumps[i].data = Z_Malloc(vlumps[i].size, PU_LEVEL, NULL); // This is memory inefficient, sorry about that.
|
||||
memcpy(vlumps[i].data, wadData + (fileinfo + i)->filepos, vlumps[i].size);
|
||||
}
|
||||
|
||||
Z_Free(wadData);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Count number of lumps until the end of resource OR up until next "MAPXX" lump.
|
||||
lumpnum_t lumppos = lumpnum + 1;
|
||||
for (i = LUMPNUM(lumppos); i < wadfiles[WADFILENUM(lumpnum)]->numlumps; i++, lumppos++, numlumps++)
|
||||
if (memcmp(W_CheckNameForNum(lumppos), "MAP", 3) == 0)
|
||||
break;
|
||||
numlumps++;
|
||||
|
||||
vlumps = Z_Malloc(sizeof(virtlump_t)*numlumps, PU_LEVEL, NULL);
|
||||
for (i = 0; i < numlumps; i++, lumpnum++)
|
||||
{
|
||||
vlumps[i].size = W_LumpLength(lumpnum);
|
||||
memcpy(vlumps[i].name, W_CheckNameForNum(lumpnum), 8);
|
||||
vlumps[i].name[8] = '\0';
|
||||
vlumps[i].data = W_CacheLumpNum(lumpnum, PU_LEVEL);
|
||||
}
|
||||
}
|
||||
vres = Z_Malloc(sizeof(virtres_t), PU_LEVEL, NULL);
|
||||
vres->vlumps = vlumps;
|
||||
vres->numlumps = numlumps;
|
||||
|
||||
return vres;
|
||||
}
|
||||
|
||||
/** \brief Frees zone memory for a given virtual resource.
|
||||
*
|
||||
* \param Virtual resource
|
||||
*/
|
||||
void vres_Free(virtres_t* vres)
|
||||
{
|
||||
while (vres->numlumps--)
|
||||
Z_Free(vres->vlumps[vres->numlumps].data);
|
||||
Z_Free(vres->vlumps);
|
||||
Z_Free(vres);
|
||||
}
|
||||
|
||||
/** (Debug) Prints lumps from a virtual resource into console.
|
||||
*/
|
||||
/*
|
||||
static void vres_Diag(const virtres_t* vres)
|
||||
{
|
||||
UINT32 i;
|
||||
for (i = 0; i < vres->numlumps; i++)
|
||||
CONS_Printf("%s\n", vres->vlumps[i].name);
|
||||
}
|
||||
*/
|
||||
|
||||
/** \brief Finds a lump in a given virtual resource.
|
||||
*
|
||||
* \param Virtual resource
|
||||
* \param Lump name to look for
|
||||
* \return Virtual lump if found, NULL otherwise
|
||||
*
|
||||
*/
|
||||
virtlump_t* vres_Find(const virtres_t* vres, const char* name)
|
||||
{
|
||||
UINT32 i;
|
||||
for (i = 0; i < vres->numlumps; i++)
|
||||
if (fastcmp(name, vres->vlumps[i].name))
|
||||
return &vres->vlumps[i];
|
||||
return NULL;
|
||||
}
|
||||
|
|
20
src/w_wad.h
20
src/w_wad.h
|
@ -72,6 +72,25 @@ typedef struct
|
|||
compmethod compression; // lump compression method
|
||||
} lumpinfo_t;
|
||||
|
||||
// =========================================================================
|
||||
// 'VIRTUAL' RESOURCES
|
||||
// =========================================================================
|
||||
|
||||
typedef struct {
|
||||
char name[9];
|
||||
UINT8* data;
|
||||
size_t size;
|
||||
} virtlump_t;
|
||||
|
||||
typedef struct {
|
||||
size_t numlumps;
|
||||
virtlump_t* vlumps;
|
||||
} virtres_t;
|
||||
|
||||
virtres_t* vres_GetMap(lumpnum_t);
|
||||
void vres_Free(virtres_t*);
|
||||
virtlump_t* vres_Find(const virtres_t*, const char*);
|
||||
|
||||
// =========================================================================
|
||||
// DYNAMIC WAD LOADING
|
||||
// =========================================================================
|
||||
|
@ -177,6 +196,7 @@ void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag); // return a patch
|
|||
void *W_CachePatchNum(lumpnum_t lumpnum, INT32 tag); // return a patch_t
|
||||
|
||||
void W_UnlockCachedPatch(void *patch);
|
||||
void W_FlushCachedPatches(void);
|
||||
|
||||
void W_VerifyFileMD5(UINT16 wadfilenum, const char *matchmd5);
|
||||
|
||||
|
|
|
@ -239,6 +239,11 @@ void I_StartupGraphics(void)
|
|||
if (!dedicated) graphics_started = true;
|
||||
}
|
||||
|
||||
void I_StartupHardwareGraphics(void)
|
||||
{
|
||||
// oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo y
|
||||
}
|
||||
|
||||
// ------------------
|
||||
// I_ShutdownGraphics
|
||||
// Close the screen, restore previous video mode.
|
||||
|
@ -946,6 +951,11 @@ INT32 VID_SetMode(INT32 modenum)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
// ..............
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// Free the video buffer of the last video mode,
|
||||
// allocate a new buffer for the video mode to set.
|
||||
|
|
144
src/y_inter.c
144
src/y_inter.c
|
@ -37,6 +37,10 @@
|
|||
#include "m_cond.h" // condition sets
|
||||
#include "lua_hook.h" // IntermissionThinker hook
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
#include "lua_hud.h"
|
||||
#endif
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_main.h"
|
||||
#endif
|
||||
|
@ -157,6 +161,7 @@ typedef struct
|
|||
|
||||
boolean usebuffer = false;
|
||||
static boolean useinterpic;
|
||||
static boolean safetorender = true;
|
||||
static y_buffer_t *y_buffer;
|
||||
|
||||
static INT32 intertic;
|
||||
|
@ -164,6 +169,7 @@ static INT32 tallydonetic = -1;
|
|||
static INT32 endtic = -1;
|
||||
|
||||
intertype_t intertype = int_none;
|
||||
intertype_t intermissiontypes[NUMGAMETYPES];
|
||||
|
||||
static void Y_RescaleScreenBuffer(void);
|
||||
static void Y_AwardCoopBonuses(void);
|
||||
|
@ -172,6 +178,7 @@ static void Y_CalculateCompetitionWinners(void);
|
|||
static void Y_CalculateTimeRaceWinners(void);
|
||||
static void Y_CalculateMatchWinners(void);
|
||||
static void Y_UnloadData(void);
|
||||
static void Y_CleanupData(void);
|
||||
|
||||
// Stuff copy+pasted from st_stuff.c
|
||||
#define ST_DrawNumFromHud(h,n) V_DrawTallNum(hudinfo[h].x, hudinfo[h].y, hudinfo[h].f, n)
|
||||
|
@ -318,12 +325,31 @@ void Y_IntermissionDrawer(void)
|
|||
// Bonus loops
|
||||
INT32 i;
|
||||
|
||||
if (intertype == int_none || rendermode == render_none)
|
||||
if (rendermode == render_none)
|
||||
return;
|
||||
|
||||
if (intertype == int_none)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
LUAh_IntermissionHUD();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
if (!usebuffer)
|
||||
// Lactozilla: Renderer switching
|
||||
if (needpatchrecache)
|
||||
{
|
||||
Y_CleanupData();
|
||||
safetorender = false;
|
||||
}
|
||||
|
||||
if (!usebuffer || !safetorender)
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||
|
||||
if (!safetorender)
|
||||
goto dontdrawbg;
|
||||
|
||||
if (useinterpic)
|
||||
V_DrawScaledPatch(0, 0, 0, interpic);
|
||||
else if (!usetile)
|
||||
|
@ -358,6 +384,13 @@ void Y_IntermissionDrawer(void)
|
|||
else
|
||||
V_DrawPatchFill(bgtile);
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUAh_IntermissionHUD();
|
||||
if (!LUA_HudEnabled(hud_intermissiontally))
|
||||
goto skiptallydrawer;
|
||||
#endif
|
||||
|
||||
dontdrawbg:
|
||||
if (intertype == int_coop)
|
||||
{
|
||||
INT32 bonusy;
|
||||
|
@ -407,14 +440,17 @@ void Y_IntermissionDrawer(void)
|
|||
|
||||
bonusy = 150;
|
||||
// Total
|
||||
V_DrawScaledPatch(152, bonusy, 0, data.coop.ptotal);
|
||||
V_DrawTallNum(BASEVIDWIDTH - 68, bonusy + 1, 0, data.coop.total);
|
||||
if (safetorender)
|
||||
{
|
||||
V_DrawScaledPatch(152, bonusy, 0, data.coop.ptotal);
|
||||
V_DrawTallNum(BASEVIDWIDTH - 68, bonusy + 1, 0, data.coop.total);
|
||||
}
|
||||
bonusy -= (3*SHORT(tallnum[0]->height)/2) + 1;
|
||||
|
||||
// Draw bonuses
|
||||
for (i = 3; i >= 0; --i)
|
||||
{
|
||||
if (data.coop.bonuses[i].display)
|
||||
if (data.coop.bonuses[i].display && safetorender)
|
||||
{
|
||||
V_DrawScaledPatch(152, bonusy, 0, data.coop.bonuspatches[i]);
|
||||
V_DrawTallNum(BASEVIDWIDTH - 68, bonusy + 1, 0, data.coop.bonuses[i].points);
|
||||
|
@ -643,7 +679,8 @@ void Y_IntermissionDrawer(void)
|
|||
char strtime[10];
|
||||
|
||||
// draw the header
|
||||
V_DrawScaledPatch(112, 2, 0, data.match.result);
|
||||
if (safetorender)
|
||||
V_DrawScaledPatch(112, 2, 0, data.match.result);
|
||||
|
||||
// draw the level name
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 20, 0, data.match.levelstring);
|
||||
|
@ -907,6 +944,12 @@ void Y_IntermissionDrawer(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
skiptallydrawer:
|
||||
if (!LUA_HudEnabled(hud_intermissionmessages))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (timer)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 188, V_YELLOWMAP,
|
||||
va("start in %d seconds", timer/TICRATE));
|
||||
|
@ -1169,6 +1212,8 @@ void Y_StartIntermission(void)
|
|||
I_Error("endtic is dirty");
|
||||
#endif
|
||||
|
||||
safetorender = true;
|
||||
|
||||
if (!multiplayer)
|
||||
{
|
||||
timer = 0;
|
||||
|
@ -1187,7 +1232,9 @@ void Y_StartIntermission(void)
|
|||
timer = 1;
|
||||
}
|
||||
|
||||
if (gametype == GT_COOP)
|
||||
if (intermissiontypes[gametype] != int_none)
|
||||
intertype = intermissiontypes[gametype];
|
||||
else if (gametype == GT_COOP)
|
||||
intertype = (G_IsSpecialStage(gamemap)) ? int_spec : int_coop;
|
||||
else if (gametype == GT_TEAMMATCH)
|
||||
intertype = int_teammatch;
|
||||
|
@ -1222,20 +1269,20 @@ void Y_StartIntermission(void)
|
|||
data.coop.tics = players[consoleplayer].realtime;
|
||||
|
||||
for (i = 0; i < 4; ++i)
|
||||
data.coop.bonuspatches[i] = W_CachePatchName(data.coop.bonuses[i].patch, PU_STATIC);
|
||||
data.coop.ptotal = W_CachePatchName("YB_TOTAL", PU_STATIC);
|
||||
data.coop.bonuspatches[i] = W_CachePatchName(data.coop.bonuses[i].patch, PU_PATCH);
|
||||
data.coop.ptotal = W_CachePatchName("YB_TOTAL", PU_PATCH);
|
||||
|
||||
// get act number
|
||||
data.coop.actnum = mapheaderinfo[gamemap-1]->actnum;
|
||||
|
||||
// get background patches
|
||||
widebgpatch = W_CachePatchName("INTERSCW", PU_STATIC);
|
||||
bgpatch = W_CachePatchName("INTERSCR", PU_STATIC);
|
||||
widebgpatch = W_CachePatchName("INTERSCW", PU_PATCH);
|
||||
bgpatch = W_CachePatchName("INTERSCR", PU_PATCH);
|
||||
|
||||
// grab an interscreen if appropriate
|
||||
if (mapheaderinfo[gamemap-1]->interscreen[0] != '#')
|
||||
{
|
||||
interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_STATIC);
|
||||
interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_PATCH);
|
||||
useinterpic = true;
|
||||
usebuffer = false;
|
||||
}
|
||||
|
@ -1293,18 +1340,18 @@ void Y_StartIntermission(void)
|
|||
Y_AwardSpecialStageBonus();
|
||||
|
||||
for (i = 0; i < 2; ++i)
|
||||
data.spec.bonuspatches[i] = W_CachePatchName(data.spec.bonuses[i].patch, PU_STATIC);
|
||||
data.spec.bonuspatches[i] = W_CachePatchName(data.spec.bonuses[i].patch, PU_PATCH);
|
||||
|
||||
data.spec.pscore = W_CachePatchName("YB_SCORE", PU_STATIC);
|
||||
data.spec.pcontinues = W_CachePatchName("YB_CONTI", PU_STATIC);
|
||||
data.spec.pscore = W_CachePatchName("YB_SCORE", PU_PATCH);
|
||||
data.spec.pcontinues = W_CachePatchName("YB_CONTI", PU_PATCH);
|
||||
|
||||
// get background tile
|
||||
bgtile = W_CachePatchName("SPECTILE", PU_STATIC);
|
||||
bgtile = W_CachePatchName("SPECTILE", PU_PATCH);
|
||||
|
||||
// grab an interscreen if appropriate
|
||||
if (mapheaderinfo[gamemap-1]->interscreen[0] != '#')
|
||||
{
|
||||
interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_STATIC);
|
||||
interpic = W_CachePatchName(mapheaderinfo[gamemap-1]->interscreen, PU_PATCH);
|
||||
useinterpic = true;
|
||||
}
|
||||
else
|
||||
|
@ -1316,14 +1363,14 @@ void Y_StartIntermission(void)
|
|||
// get special stage specific patches
|
||||
/* if (!stagefailed && ALL7EMERALDS(emeralds))
|
||||
{
|
||||
data.spec.cemerald = W_CachePatchName("GOTEMALL", PU_STATIC);
|
||||
data.spec.cemerald = W_CachePatchName("GOTEMALL", PU_PATCH);
|
||||
data.spec.headx = 70;
|
||||
data.spec.nowsuper = players[consoleplayer].skin
|
||||
? NULL : W_CachePatchName("NOWSUPER", PU_STATIC);
|
||||
? NULL : W_CachePatchName("NOWSUPER", PU_PATCH);
|
||||
}
|
||||
else
|
||||
{
|
||||
data.spec.cemerald = W_CachePatchName("CEMERALD", PU_STATIC);
|
||||
data.spec.cemerald = W_CachePatchName("CEMERALD", PU_PATCH);
|
||||
data.spec.headx = 48;
|
||||
data.spec.nowsuper = NULL;
|
||||
} */
|
||||
|
@ -1401,9 +1448,9 @@ void Y_StartIntermission(void)
|
|||
|
||||
// get RESULT header
|
||||
data.match.result =
|
||||
W_CachePatchName("RESULT", PU_STATIC);
|
||||
W_CachePatchName("RESULT", PU_PATCH);
|
||||
|
||||
bgtile = W_CachePatchName("SRB2BACK", PU_STATIC);
|
||||
bgtile = W_CachePatchName("SRB2BACK", PU_PATCH);
|
||||
usetile = true;
|
||||
useinterpic = false;
|
||||
break;
|
||||
|
@ -1429,9 +1476,9 @@ void Y_StartIntermission(void)
|
|||
data.match.levelstring[sizeof data.match.levelstring - 1] = '\0';
|
||||
|
||||
// get RESULT header
|
||||
data.match.result = W_CachePatchName("RESULT", PU_STATIC);
|
||||
data.match.result = W_CachePatchName("RESULT", PU_PATCH);
|
||||
|
||||
bgtile = W_CachePatchName("SRB2BACK", PU_STATIC);
|
||||
bgtile = W_CachePatchName("SRB2BACK", PU_PATCH);
|
||||
usetile = true;
|
||||
useinterpic = false;
|
||||
break;
|
||||
|
@ -1468,7 +1515,7 @@ void Y_StartIntermission(void)
|
|||
data.match.blueflag = bmatcico;
|
||||
}
|
||||
|
||||
bgtile = W_CachePatchName("SRB2BACK", PU_STATIC);
|
||||
bgtile = W_CachePatchName("SRB2BACK", PU_PATCH);
|
||||
usetile = true;
|
||||
useinterpic = false;
|
||||
break;
|
||||
|
@ -1494,7 +1541,7 @@ void Y_StartIntermission(void)
|
|||
data.competition.levelstring[sizeof data.competition.levelstring - 1] = '\0';
|
||||
|
||||
// get background tile
|
||||
bgtile = W_CachePatchName("SRB2BACK", PU_STATIC);
|
||||
bgtile = W_CachePatchName("SRB2BACK", PU_PATCH);
|
||||
usetile = true;
|
||||
useinterpic = false;
|
||||
break;
|
||||
|
@ -2032,7 +2079,8 @@ void Y_EndIntermission(void)
|
|||
usebuffer = false;
|
||||
}
|
||||
|
||||
#define UNLOAD(x) Z_ChangeTag(x, PU_CACHE); x = NULL
|
||||
#define UNLOAD(x) if (x) {Z_ChangeTag(x, PU_CACHE);} x = NULL;
|
||||
#define CLEANUP(x) x = NULL;
|
||||
|
||||
//
|
||||
// Y_UnloadData
|
||||
|
@ -2083,5 +2131,47 @@ static void Y_UnloadData(void)
|
|||
//are not handled
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void Y_CleanupData(void)
|
||||
{
|
||||
// unload the background patches
|
||||
CLEANUP(bgpatch);
|
||||
CLEANUP(widebgpatch);
|
||||
CLEANUP(bgtile);
|
||||
CLEANUP(interpic);
|
||||
|
||||
switch (intertype)
|
||||
{
|
||||
case int_coop:
|
||||
// unload the coop and single player patches
|
||||
CLEANUP(data.coop.bonuspatches[3]);
|
||||
CLEANUP(data.coop.bonuspatches[2]);
|
||||
CLEANUP(data.coop.bonuspatches[1]);
|
||||
CLEANUP(data.coop.bonuspatches[0]);
|
||||
CLEANUP(data.coop.ptotal);
|
||||
break;
|
||||
case int_spec:
|
||||
// unload the special stage patches
|
||||
//CLEANUP(data.spec.cemerald);
|
||||
//CLEANUP(data.spec.nowsuper);
|
||||
CLEANUP(data.spec.bonuspatches[1]);
|
||||
CLEANUP(data.spec.bonuspatches[0]);
|
||||
CLEANUP(data.spec.pscore);
|
||||
CLEANUP(data.spec.pcontinues);
|
||||
break;
|
||||
case int_match:
|
||||
case int_race:
|
||||
CLEANUP(data.match.result);
|
||||
break;
|
||||
case int_ctf:
|
||||
CLEANUP(data.match.blueflag);
|
||||
CLEANUP(data.match.redflag);
|
||||
break;
|
||||
default:
|
||||
//without this default,
|
||||
//int_none, int_tag, int_chaos, and int_classicrace
|
||||
//are not handled
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,3 +31,4 @@ typedef enum
|
|||
int_comp, // Competition
|
||||
} intertype_t;
|
||||
extern intertype_t intertype;
|
||||
extern intertype_t intermissiontypes[NUMGAMETYPES];
|
||||
|
|
30
src/z_zone.c
30
src/z_zone.c
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "r_patch.h"
|
||||
#include "i_system.h" // I_GetFreeMem
|
||||
#include "i_video.h" // rendermode
|
||||
#include "z_zone.h"
|
||||
|
@ -497,6 +498,35 @@ void Z_FreeTags(INT32 lowtag, INT32 hightag)
|
|||
// Utility functions
|
||||
// -----------------
|
||||
|
||||
// for renderer switching, free a bunch of stuff
|
||||
boolean needpatchflush = false;
|
||||
boolean needpatchrecache = false;
|
||||
|
||||
// flush all patches from memory
|
||||
// (also frees memory tagged with PU_CACHE)
|
||||
// (which are not necessarily patches but I don't care)
|
||||
void Z_FlushCachedPatches(void)
|
||||
{
|
||||
CONS_Debug(DBG_RENDER, "Z_FlushCachedPatches()...\n");
|
||||
Z_FreeTag(PU_CACHE);
|
||||
Z_FreeTag(PU_PATCH);
|
||||
Z_FreeTag(PU_HUDGFX);
|
||||
Z_FreeTag(PU_HWRPATCHINFO);
|
||||
Z_FreeTag(PU_HWRMODELTEXTURE);
|
||||
Z_FreeTag(PU_HWRCACHE);
|
||||
Z_FreeTag(PU_HWRCACHE_UNLOCKED);
|
||||
Z_FreeTag(PU_HWRPATCHINFO_UNLOCKED);
|
||||
}
|
||||
|
||||
// happens before a renderer switch
|
||||
void Z_PreparePatchFlush(void)
|
||||
{
|
||||
CONS_Debug(DBG_RENDER, "Z_PreparePatchFlush()...\n");
|
||||
#ifdef ROTSPRITE
|
||||
R_FreeAllRotSprite();
|
||||
#endif
|
||||
}
|
||||
|
||||
// starting value of nextcleanup
|
||||
#define CLEANUPCOUNT 2000
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ enum
|
|||
PU_SOUND = 11, // static while playing
|
||||
PU_MUSIC = 12, // static while playing
|
||||
PU_HUDGFX = 13, // static until WAD added
|
||||
PU_PATCH = 14, // static until renderer change
|
||||
|
||||
PU_HWRPATCHINFO = 21, // Hardware GLPatch_t struct for OpenGL texture cache
|
||||
PU_HWRPATCHCOLMIPMAP = 22, // Hardware GLMipmap_t struct colormap variation of patch
|
||||
|
@ -142,4 +143,10 @@ size_t Z_TagsUsage(INT32 lowtag, INT32 hightag);
|
|||
char *Z_StrDup(const char *in);
|
||||
#define Z_Unlock(p) (void)p // TODO: remove this now that NDS code has been removed
|
||||
|
||||
// For renderer switching
|
||||
extern boolean needpatchflush;
|
||||
extern boolean needpatchrecache;
|
||||
void Z_FlushCachedPatches(void);
|
||||
void Z_PreparePatchFlush(void);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue