Screw merge conflicts

This commit is contained in:
Zachary McAlpin 2020-03-24 20:38:46 -05:00
commit 21353f1209
105 changed files with 4645 additions and 13572 deletions

View file

@ -51,8 +51,8 @@ jobs:
- /var/cache/apt/archives
- checkout
- run:
name: Compile without network support and BLUA
command: make -C src LINUX=1 ERRORMODE=1 -k NONET=1 NO_LUA=1
name: Compile without network support
command: make -C src LINUX=1 ERRORMODE=1 -k NONET=1
- run:
name: wipe build
command: make -C src LINUX=1 cleandep

View file

@ -1,77 +0,0 @@
// 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
{
}

View file

@ -1,309 +0,0 @@
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");
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,726 +0,0 @@
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";
}
}

View file

@ -1,109 +0,0 @@
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";
}
}

File diff suppressed because it is too large Load diff

View file

@ -435,7 +435,7 @@ sectortypes
112 = "Trigger Line Ex. (NiGHTS Mare)";
128 = "Check for Linedef Executor on FOFs";
144 = "Egg Capsule";
160 = "Special Stage Time/Rings Parameters";
160 = "Special Stage Time/Spheres Parameters";
176 = "Custom Global Gravity";
512 = "Wind/Current";
1024 = "Conveyor Belt";
@ -490,7 +490,7 @@ gen_sectortypes
112 = "Trigger Line Ex. (NiGHTS Mare)";
128 = "Check for Linedef Executor on FOFs";
144 = "Egg Capsule";
160 = "Special Stage Time/Rings Parameters";
160 = "Special Stage Time/Spheres Parameters";
176 = "Custom Global Gravity";
}
@ -766,6 +766,7 @@ linedeftypes
{
title = "Parameters";
prefix = "(22)";
flags32text = "[5] Render outer sides only";
flags64text = "[6] Trigger linedef executor";
flags128text = "[7] Intangible";
flags256text = "[8] Stopped by pushables";
@ -788,7 +789,6 @@ linedeftypes
{
title = "Angular Displacement by Front Sector";
prefix = "(32)";
flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Don't turn players";
flags512text = "[9] Turn all objects";
}
@ -1136,7 +1136,6 @@ linedeftypes
{
title = "Goo Water, Translucent, No Sides";
prefix = "(125)";
flags8text = "[3] Slope skew sides";
flags64text = "[6] Use two light levels";
flags512text = "[9] Use target light level";
flags1024text = "[10] Ripple effect";
@ -1227,6 +1226,18 @@ linedeftypes
3dfloorflags = "19F";
}
153
{
title = "Dynamically Sinking Platform";
prefix = "(153)";
flags8text = "[3] Slope skew sides";
flags32text = "[5] Only block player";
flags64text = "[6] Spindash to move";
flags128text = "[7] Only block non-players";
3dfloor = true;
3dfloorflags = "19F";
}
160
{
title = "Floating, Bobbing";
@ -1282,7 +1293,6 @@ linedeftypes
title = "Rising Platform, Solid, Invisible";
prefix = "(193)";
flags2text = "[1] Sink when stepped on";
flags8text = "[3] Slope skew sides";
flags32text = "[5] Only block player";
flags64text = "[6] Spindash to move";
flags128text = "[7] Only block non-players";
@ -1488,16 +1498,22 @@ linedeftypes
{
title = "Mario Block";
prefix = "(250)";
flags8text = "[3] Slope skew sides";
flags32text = "[5] Invisible block";
flags64text = "[6] Brick block";
3dfloor = true;
3dfloorflags = "40019F";
flags323dfloorflagsremove = "19E";
flags643dfloorflagsadd = "200000";
}
251
{
title = "Thwomp Block";
prefix = "(251)";
flags8text = "[3] Slope skew sides";
flags32text = "[5] Only block player";
flags128text = "[7] Only block non-players";
flags512text = "[9] Custom crushing sound";
flags1024text = "[10] Custom speed";
3dfloor = true;
@ -1513,8 +1529,8 @@ linedeftypes
flags512text = "[9] Shattered by pushables";
flags1024text = "[10] Trigger linedef executor";
3dfloor = true;
3dfloorflags = "8800019";
flags643dfloorflagsadd = "200006";
3dfloorflags = "880001D";
flags643dfloorflagsadd = "200002";
}
253
@ -1525,7 +1541,7 @@ linedeftypes
flags512text = "[9] Shattered by pushables";
flags1024text = "[10] Trigger linedef executor";
3dfloor = true;
3dfloorflags = "8801019";
3dfloorflags = "880101D";
}
254
@ -1533,6 +1549,7 @@ linedeftypes
title = "Bustable Block";
prefix = "(254)";
flags8text = "[3] Slope skew sides";
flags32text = "[5] Only block player";
flags64text = "[6] Strong characters only";
flags128text = "[7] Only block non-players";
flags512text = "[9] Shattered by pushables";
@ -1593,6 +1610,7 @@ linedeftypes
{
title = "Custom FOF";
prefix = "(259)";
flags8text = "[3] Slope skew sides";
flags32text = "[5] Only block player";
flags128text = "[7] Only block non-players";
flags512text = "[9] Shattered by pushables";
@ -2161,6 +2179,14 @@ linedeftypes
flags8text = "[3] Set delay by backside sector";
}
449
{
title = "Enable Bosses with Parameter";
prefix = "(449)";
flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Disable bosses";
}
457
{
title = "Track Object's Angle";
@ -2180,12 +2206,14 @@ linedeftypes
{
title = "Award Rings";
prefix = "(460)";
flags8text = "[3] Set delay by backside sector";
}
461
{
title = "Spawn Object";
prefix = "(461)";
flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Spawn inside a range";
}
@ -2193,6 +2221,7 @@ linedeftypes
{
title = "Stop Timer/Exit Stage in Record Attack";
prefix = "(462)";
flags8text = "[3] Set delay by backside sector";
}
}
@ -2206,7 +2235,7 @@ linedeftypes
prefix = "(413)";
flags2text = "[1] Keep after death";
flags8text = "[3] Set delay by backside sector";
flags32text = "[5] Seek to current song position";
flags32text = "[5] Seek from current position";
flags64text = "[6] For everyone";
flags128text = "[7] Fade to custom volume";
flags512text = "[9] Don't loop";
@ -2220,7 +2249,7 @@ linedeftypes
flags2text = "[1] From calling sector";
flags8text = "[3] Set delay by backside sector";
flags64text = "[6] From nowhere for triggerer";
flags512text = "[9] For everyone";
flags512text = "[9] From nowhere for everyone";
flags1024text = "[10] From tagged sectors";
}
@ -2298,7 +2327,6 @@ linedeftypes
flags8text = "[3] Set delay by backside sector";
}
445
{
title = "Make FOF Disappear/Reappear";
@ -2325,8 +2353,8 @@ linedeftypes
flags32text = "[5] Subtract Red value";
flags64text = "[6] Subtract Green value";
flags128text = "[7] Subtract Blue value";
flags256text = "[8] Calc relative values";
flags32768text = "[15] Use back side colormap";
flags256text = "[8] Set relative to current";
flags32768text = "[15] Use backside colormap";
}
448
@ -2359,7 +2387,7 @@ linedeftypes
prefix = "(452)";
flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Do not handle FF_TRANS";
flags256text = "[8] Set relative to current val";
flags256text = "[8] Set relative to current";
}
453
@ -2371,7 +2399,7 @@ linedeftypes
flags32text = "[5] No collision during fade";
flags64text = "[6] Do not handle FF_TRANS";
flags128text = "[7] Do not handle lighting";
flags256text = "[8] Set relative to current val";
flags256text = "[8] Set relative to current";
flags512text = "[9] Speed = Tic Duration";
flags1024text = "[10] Override existing fade";
flags16384text = "[14] Do not handle collision";
@ -2395,11 +2423,11 @@ linedeftypes
flags32text = "[5] Subtract Red value";
flags64text = "[6] Subtract Green value";
flags128text = "[7] Subtract Blue value";
flags256text = "[8] Calc relative values";
flags256text = "[8] Set relative to current";
flags512text = "[9] Speed = Tic Duration";
flags1024text = "[10] Override existing fade";
flags16384text = "[14] Fade from invisible black";
flags32768text = "[15] Use back side colormap";
flags32768text = "[15] Use backside colormap";
}
456
@ -2416,9 +2444,7 @@ linedeftypes
flags2text = "[1] Close text prompt";
flags8text = "[3] Set delay by backside sector";
flags32text = "[5] Run executor tag on close";
flags64text = "[6] For everyone";
flags128text = "[7] Do not block controls";
flags256text = "[8] Do not freeze time";
flags128text = "[7] Don't disable controls";
flags32768text = "[15] Find prompt by name";
}
}
@ -2524,7 +2550,7 @@ linedeftypes
prefix = "(491)";
flags8text = "[3] Set delay by backside sector";
flags16text = "[4] Set raw alpha by Front X";
flags256text = "[8] Calc relative values";
flags256text = "[8] Set relative to current";
}
492
@ -2534,7 +2560,7 @@ linedeftypes
flags8text = "[3] Set delay by backside sector";
flags16text = "[4] Set raw alpha by Front X";
flags32text = "[5] No collision during fade";
flags256text = "[8] Calc relative values";
flags256text = "[8] Set relative to current";
flags512text = "[9] Speed = Tic Duration";
flags1024text = "[10] Override existing fade";
flags16384text = "[14] Do not handle collision";
@ -2632,76 +2658,84 @@ linedeftypes
{
title = "Carry Objects on Floor";
prefix = "(520)";
flags64text = "[6] Exclusive";
}
521
{
title = "Carry Objects on Floor (Accelerative)";
prefix = "(521)";
flags64text = "[6] Even across edges";
flags64text = "[6] Exclusive";
}
522
{
title = "Carry Objects on Floor (Displacement)";
prefix = "(522)";
flags64text = "[6] Exclusive";
}
523
{
title = "Carry Objects on Ceiling";
prefix = "(523)";
flags64text = "[6] Even across edges";
flags64text = "[6] Exclusive";
}
524
{
title = "Carry Objects on Ceiling (Accelerative)";
prefix = "(524)";
flags64text = "[6] Exclusive";
}
525
{
title = "Carry Objects on Ceiling (Displacement)";
prefix = "(525)";
flags64text = "[6] Exclusive";
}
530
{
title = "Scroll Floor Texture and Carry Objects";
prefix = "(530)";
flags64text = "[6] Even across edges";
flags64text = "[6] Exclusive";
}
531
{
title = "Scroll Floor Texture and Carry Objects (Accelerative)";
prefix = "(531)";
flags64text = "[6] Exclusive";
}
532
{
title = "Scroll Floor Texture and Carry Objects (Displacement)";
prefix = "(532)";
flags64text = "[6] Exclusive";
}
533
{
title = "Scroll Ceiling Texture and Carry Objects";
prefix = "(533)";
flags64text = "[6] Even across edges";
flags64text = "[6] Exclusive";
}
534
{
title = "Scroll Ceiling Texture and Carry Objects (Accelerative)";
prefix = "(534)";
flags64text = "[6] Exclusive";
}
535
{
title = "Scroll Ceiling Texture and Carry Objects (Displacement)";
prefix = "(535)";
flags64text = "[6] Exclusive";
}
}
@ -2714,7 +2748,7 @@ linedeftypes
title = "Wind";
prefix = "(541)";
flags512text = "[9] Player slides";
flags64text = "[6] Even across edges";
flags64text = "[6] Exclusive";
}
542
@ -2722,7 +2756,7 @@ linedeftypes
title = "Upwards Wind";
prefix = "(542)";
flags512text = "[9] Player slides";
flags64text = "[6] Even across edges";
flags64text = "[6] Exclusive";
}
543
@ -2730,7 +2764,7 @@ linedeftypes
title = "Downwards Wind";
prefix = "(543)";
flags512text = "[9] Player slides";
flags64text = "[6] Even across edges";
flags64text = "[6] Exclusive";
}
544
@ -2738,7 +2772,7 @@ linedeftypes
title = "Current";
prefix = "(544)";
flags512text = "[9] Player slides";
flags64text = "[6] Even across edges";
flags64text = "[6] Exclusive";
}
545
@ -2746,7 +2780,7 @@ linedeftypes
title = "Upwards Current";
prefix = "(545)";
flags512text = "[9] Player slides";
flags64text = "[6] Even across edges";
flags64text = "[6] Exclusive";
}
546
@ -2754,13 +2788,14 @@ linedeftypes
title = "Downwards Current";
prefix = "(546)";
flags512text = "[9] Player slides";
flags64text = "[6] Even across edges";
flags64text = "[6] Exclusive";
}
547
{
title = "Push/Pull";
prefix = "(547)";
flags64text = "[6] Exclusive";
}
}
@ -3407,8 +3442,8 @@ thingtypes
sprite = "ESHIA1";
width = 16;
height = 48;
flags1text = "[1] 90 degrees counter-clockwise";
flags4text = "[4] 90 degrees clockwise";
flags1text = "[1] 90 degrees clockwise";
flags4text = "[4] 90 degrees counter-clockwise";
flags8text = "[8] Double speed";
}
115
@ -3897,9 +3932,10 @@ thingtypes
title = "Monitors";
width = 18;
height = 40;
flags1text = "[1] Run Linedef Executor on pop";
flags1text = "[1] Run linedef executor on pop";
flags4text = "[4] Random (Strong)";
flags8text = "[8] Random (Weak)";
angletext = "Tag";
400
{
@ -4029,7 +4065,8 @@ thingtypes
title = "Monitors (Respawning)";
width = 20;
height = 44;
flags1text = "[1] Run Linedef Executor on pop";
flags1text = "[1] Run linedef executor on pop";
angletext = "Tag";
431
{
@ -4125,7 +4162,9 @@ thingtypes
sprite = "STPTA0M0";
width = 64;
height = 128;
flags4text = "[4] Respawn at center";
angletext = "Angle/Order";
parametertext = "Order";
}
520
{
@ -4152,6 +4191,7 @@ thingtypes
sprite = "WSPKALAR";
width = 16;
height = 14;
arrow = 1;
flags1text = "[1] Start retracted";
flags4text = "[4] Retractable";
flags8text = "[8] Intangible";
@ -4558,6 +4598,7 @@ thingtypes
sprite = "TOADA0";
width = 32;
height = 16;
angletext = "Tag";
}
757
{
@ -5832,7 +5873,7 @@ thingtypes
sprite = "CAPSA0";
width = 72;
height = 144;
angletext = "Rings";
angletext = "Spheres";
parametertext = "Mare";
}
}
@ -6273,7 +6314,7 @@ thingtypes
sprite = "PUMKA0";
width = 16;
height = 40;
flags1text = "Don't flicker";
flags1text = "[1] Don't flicker";
}
2007
{
@ -6281,7 +6322,7 @@ thingtypes
sprite = "PUMKB0";
width = 16;
height = 40;
flags1text = "Don't flicker";
flags1text = "[1] Don't flicker";
}
2008
{
@ -6289,7 +6330,7 @@ thingtypes
sprite = "PUMKC0";
width = 16;
height = 40;
flags1text = "Don't flicker";
flags1text = "[1] Don't flicker";
}
2009
{

View file

@ -1,38 +0,0 @@
/************************************************************************\
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");
}

View file

@ -1,47 +0,0 @@
/************************************************************************\
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");
}

View file

@ -16,6 +16,7 @@ set(SRB2_CORE_SOURCES
f_finale.c
f_wipe.c
filesrch.c
g_demo.c
g_game.c
g_input.c
hu_stuff.c
@ -71,6 +72,7 @@ set(SRB2_CORE_HEADERS
f_finale.h
fastcmp.h
filesrch.h
g_demo.h
g_game.h
g_input.h
g_state.h
@ -120,6 +122,7 @@ set(SRB2_CORE_RENDER_SOURCES
r_main.c
r_plane.c
r_segs.c
r_skins.c
r_sky.c
r_splats.c
r_things.c
@ -134,6 +137,7 @@ set(SRB2_CORE_RENDER_SOURCES
r_main.h
r_plane.h
r_segs.h
r_skins.h
r_sky.h
r_splats.h
r_state.h
@ -214,8 +218,6 @@ source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES})
### Configuration
set(SRB2_CONFIG_HAVE_BLUA ON CACHE BOOL
"Enable Lua interpreter support")
set(SRB2_CONFIG_HAVE_PNG ON CACHE BOOL
"Enable PNG support. Depends on zlib, so will be disabled if you don't enable that too.")
set(SRB2_CONFIG_HAVE_ZLIB ON CACHE BOOL
@ -239,93 +241,90 @@ if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only
"Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME, OpenMPT).")
endif()
if(${SRB2_CONFIG_HAVE_BLUA})
add_definitions(-DHAVE_BLUA)
set(SRB2_LUA_SOURCES
lua_baselib.c
lua_blockmaplib.c
lua_consolelib.c
lua_hooklib.c
lua_hudlib.c
lua_infolib.c
lua_maplib.c
lua_mathlib.c
lua_mobjlib.c
lua_playerlib.c
lua_script.c
lua_skinlib.c
lua_thinkerlib.c
)
set(SRB2_LUA_HEADERS
lua_hook.h
lua_hud.h
lua_libs.h
lua_script.h
)
set(SRB2_LUA_SOURCES
lua_baselib.c
lua_blockmaplib.c
lua_consolelib.c
lua_hooklib.c
lua_hudlib.c
lua_infolib.c
lua_maplib.c
lua_mathlib.c
lua_mobjlib.c
lua_playerlib.c
lua_script.c
lua_skinlib.c
lua_thinkerlib.c
)
set(SRB2_LUA_HEADERS
lua_hook.h
lua_hud.h
lua_libs.h
lua_script.h
)
prepend_sources(SRB2_LUA_SOURCES)
prepend_sources(SRB2_LUA_HEADERS)
prepend_sources(SRB2_LUA_SOURCES)
prepend_sources(SRB2_LUA_HEADERS)
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
set(SRB2_BLUA_SOURCES
blua/lapi.c
blua/lauxlib.c
blua/lbaselib.c
blua/lcode.c
blua/ldebug.c
blua/ldo.c
blua/ldump.c
blua/lfunc.c
blua/lgc.c
blua/linit.c
blua/liolib.c
blua/llex.c
blua/lmem.c
blua/lobject.c
blua/lopcodes.c
blua/lparser.c
blua/lstate.c
blua/lstring.c
blua/lstrlib.c
blua/ltable.c
blua/ltablib.c
blua/ltm.c
blua/lundump.c
blua/lvm.c
blua/lzio.c
)
set(SRB2_BLUA_HEADERS
blua/lapi.h
blua/lauxlib.h
blua/lcode.h
blua/ldebug.h
blua/ldo.h
blua/lfunc.h
blua/lgc.h
blua/llex.h
blua/llimits.h
blua/lmem.h
blua/lobject.h
blua/lopcodes.h
blua/lparser.h
blua/lstate.h
blua/lstring.h
blua/ltable.h
blua/ltm.h
blua/lua.h
blua/luaconf.h
blua/lualib.h
blua/lundump.h
blua/lvm.h
blua/lzio.h
)
set(SRB2_BLUA_SOURCES
blua/lapi.c
blua/lauxlib.c
blua/lbaselib.c
blua/lcode.c
blua/ldebug.c
blua/ldo.c
blua/ldump.c
blua/lfunc.c
blua/lgc.c
blua/linit.c
blua/liolib.c
blua/llex.c
blua/lmem.c
blua/lobject.c
blua/lopcodes.c
blua/lparser.c
blua/lstate.c
blua/lstring.c
blua/lstrlib.c
blua/ltable.c
blua/ltablib.c
blua/ltm.c
blua/lundump.c
blua/lvm.c
blua/lzio.c
)
set(SRB2_BLUA_HEADERS
blua/lapi.h
blua/lauxlib.h
blua/lcode.h
blua/ldebug.h
blua/ldo.h
blua/lfunc.h
blua/lgc.h
blua/llex.h
blua/llimits.h
blua/lmem.h
blua/lobject.h
blua/lopcodes.h
blua/lparser.h
blua/lstate.h
blua/lstring.h
blua/ltable.h
blua/ltm.h
blua/lua.h
blua/luaconf.h
blua/lualib.h
blua/lundump.h
blua/lvm.h
blua/lzio.h
)
prepend_sources(SRB2_BLUA_SOURCES)
prepend_sources(SRB2_BLUA_HEADERS)
prepend_sources(SRB2_BLUA_SOURCES)
prepend_sources(SRB2_BLUA_HEADERS)
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
endif()
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
if(${SRB2_CONFIG_HAVE_GME})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})

View file

@ -340,9 +340,7 @@ CFLAGS+=-DHAVE_MINIUPNPC
endif
endif
ifndef NO_LUA
include blua/Makefile.cfg
endif
include blua/Makefile.cfg
ifdef NOMD5
OPTS+=-DNOMD5
@ -424,6 +422,7 @@ OBJS:=$(i_main_o) \
$(OBJDIR)/z_zone.o \
$(OBJDIR)/f_finale.o \
$(OBJDIR)/f_wipe.o \
$(OBJDIR)/g_demo.o \
$(OBJDIR)/g_game.o \
$(OBJDIR)/g_input.o \
$(OBJDIR)/am_map.o \
@ -468,6 +467,7 @@ OBJS:=$(i_main_o) \
$(OBJDIR)/r_main.o \
$(OBJDIR)/r_plane.o \
$(OBJDIR)/r_segs.o \
$(OBJDIR)/r_skins.o \
$(OBJDIR)/r_sky.o \
$(OBJDIR)/r_splats.o \
$(OBJDIR)/r_things.o \
@ -682,9 +682,7 @@ $(OBJDIR)/depend.dep:
ifndef NOHW
$(CC) $(CFLAGS) -MM hardware/*.c >> $(OBJDIR)/depend.ped
endif
ifndef NO_LUA
$(CC) $(CFLAGS) -MM blua/*.c >> $(OBJDIR)/depend.ped
endif
@sed -e 's,\(.*\)\.o: ,$(subst /,\/,$(OBJDIR))\/&,g' < $(OBJDIR)/depend.ped > $(OBJDIR)/depend.dep
$(REMOVE) $(OBJDIR)/depend.ped
@echo "Created dependency file, depend.dep"

View file

@ -920,10 +920,8 @@ static inline void AM_drawWalls(void)
{
size_t i;
static mline_t l;
#ifdef ESLOPE
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
fixed_t backf1 = 0, backf2 = 0, backc1 = 0, backc2 = 0; // back floor ceiling ends
#endif
for (i = 0; i < numlines; i++)
{
@ -931,7 +929,7 @@ static inline void AM_drawWalls(void)
l.a.y = lines[i].v1->y >> FRACTOMAPBITS;
l.b.x = lines[i].v2->x >> FRACTOMAPBITS;
l.b.y = lines[i].v2->y >> FRACTOMAPBITS;
#ifdef ESLOPE
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
if (slope) { \
end1 = P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y); \
@ -946,7 +944,6 @@ static inline void AM_drawWalls(void)
SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
}
#undef SLOPEPARAMS
#endif
if (!lines[i].backsector) // 1-sided
{
@ -955,19 +952,11 @@ static inline void AM_drawWalls(void)
else
AM_drawMline(&l, WALLCOLORS);
}
#ifdef ESLOPE
else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|| (frontf1 == frontc1 && frontf2 == frontc2)) // Front is thok barrier
{
if (backf1 == backc1 && backf2 == backc2
&& frontf1 == frontc1 && frontf2 == frontc2) // BOTH are thok barriers
#else
else if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight // Back is thok barrier
|| lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // Front is thok barrier
{
if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight
&& lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // BOTH are thok barriers
#endif
{
if (lines[i].flags & ML_NOCLIMB)
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
@ -985,20 +974,10 @@ static inline void AM_drawWalls(void)
else
{
if (lines[i].flags & ML_NOCLIMB) {
#ifdef ESLOPE
if (backf1 != frontf1 || backf2 != frontf2) {
#else
if (lines[i].backsector->floorheight
!= lines[i].frontsector->floorheight) {
#endif
AM_drawMline(&l, NOCLIMBFDWALLCOLORS); // floor level change
}
#ifdef ESLOPE
else if (backc1 != frontc1 || backc2 != frontc2) {
#else
else if (lines[i].backsector->ceilingheight
!= lines[i].frontsector->ceilingheight) {
#endif
AM_drawMline(&l, NOCLIMBCDWALLCOLORS); // ceiling level change
}
else
@ -1006,20 +985,10 @@ static inline void AM_drawWalls(void)
}
else
{
#ifdef ESLOPE
if (backf1 != frontf1 || backf2 != frontf2) {
#else
if (lines[i].backsector->floorheight
!= lines[i].frontsector->floorheight) {
#endif
AM_drawMline(&l, FDWALLCOLORS); // floor level change
}
#ifdef ESLOPE
else if (backc1 != frontc1 || backc2 != frontc2) {
#else
else if (lines[i].backsector->ceilingheight
!= lines[i].frontsector->ceilingheight) {
#endif
AM_drawMline(&l, CDWALLCOLORS); // ceiling level change
}
else

View file

@ -74,11 +74,9 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
if (!sonic || sonic->health <= 0)
return;
#ifdef HAVE_BLUA
// Lua can handle it!
if (LUAh_BotAI(sonic, tails, cmd))
return;
#endif
if (tails->player->powers[pw_carry] == CR_MACESPIN || tails->player->powers[pw_carry] == CR_GENERIC)
{
@ -364,11 +362,9 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
// Bot AI isn't programmed in analog.
CV_SetValue(&cv_analog[1], false);
#ifdef HAVE_BLUA
// Let Lua scripts build ticcmds
if (LUAh_BotTiccmd(player, cmd))
return;
#endif
// We don't have any main character AI, sorry. D:
if (player-players == consoleplayer)

View file

@ -10,8 +10,6 @@ WFLAGS+=-Wno-logical-op
endif
endif
OPTS+=-DHAVE_BLUA
OBJS:=$(OBJS) \
$(OBJDIR)/lapi.o \
$(OBJDIR)/lbaselib.o \

View file

@ -481,13 +481,11 @@ void COM_AddCommand(const char *name, com_func_t func)
{
if (!stricmp(name, cmd->name)) //case insensitive now that we have lower and uppercase!
{
#ifdef HAVE_BLUA
// don't I_Error for Lua commands
// Lua commands can replace game commands, and they have priority.
// BUT, if for some reason we screwed up and made two console commands with the same name,
// it's good to have this here so we find out.
if (cmd->function != COM_Lua_f)
#endif
I_Error("Command %s already exists\n", name);
return;
@ -501,7 +499,6 @@ void COM_AddCommand(const char *name, com_func_t func)
com_commands = cmd;
}
#ifdef HAVE_BLUA
/** Adds a console command for Lua.
* No I_Errors allowed; return a negative code instead.
*
@ -534,7 +531,6 @@ int COM_AddLuaCommand(const char *name)
com_commands = cmd;
return 0;
}
#endif
/** Tests if a command exists.
*
@ -1427,9 +1423,7 @@ finish:
}
var->flags |= CV_MODIFIED;
// raise 'on change' code
#ifdef HAVE_BLUA
LUA_CVarChanged(var->name); // let consolelib know what cvar this is.
#endif
if (var->flags & CV_CALL && !stealth)
var->func();

View file

@ -1289,6 +1289,37 @@ static boolean CL_SendJoin(void)
return HSendPacket(servernode, true, 0, sizeof (clientconfig_pak));
}
static INT32 FindRejoinerNum(SINT8 node)
{
char strippednodeaddress[64];
const char *nodeaddress;
char *port;
INT32 i;
// Make sure there is no dead dress before proceeding to the stripping
if (!I_GetNodeAddress)
return -1;
nodeaddress = I_GetNodeAddress(node);
if (!nodeaddress)
return -1;
// Strip the address of its port
strcpy(strippednodeaddress, nodeaddress);
port = strchr(strippednodeaddress, ':');
if (port)
*port = '\0';
// Check if any player matches the stripped address
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i] && playeraddress[i][0] && playernode[i] == UINT8_MAX
&& !strcmp(playeraddress[i], strippednodeaddress))
return i;
}
return -1;
}
static void SV_SendServerInfo(INT32 node, tic_t servertime)
{
UINT8 *p;
@ -1306,6 +1337,16 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
netbuffer->u.serverinfo.numberofplayer = (UINT8)D_NumPlayers();
netbuffer->u.serverinfo.maxplayer = (UINT8)cv_maxplayers.value;
if (FindRejoinerNum(node) != -1)
netbuffer->u.serverinfo.refusereason = 0;
else if (!cv_allownewplayer.value)
netbuffer->u.serverinfo.refusereason = 1;
else if (D_NumPlayers() >= cv_maxplayers.value)
netbuffer->u.serverinfo.refusereason = 2;
else
netbuffer->u.serverinfo.refusereason = 0;
strncpy(netbuffer->u.serverinfo.gametypename, Gametype_Names[gametype],
sizeof netbuffer->u.serverinfo.gametypename);
netbuffer->u.serverinfo.modifiedgame = (UINT8)modifiedgame;
@ -1863,12 +1904,17 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent)
}
// Quit here rather than downloading files and being refused later.
if (serverlist[i].info.numberofplayer >= serverlist[i].info.maxplayer)
if (serverlist[i].info.refusereason)
{
D_QuitNetGame();
CL_Reset();
D_StartTitle();
M_StartMessage(va(M_GetText("Maximum players reached: %d\n\nPress ESC\n"), serverlist[i].info.maxplayer), NULL, MM_NOTHING);
if (serverlist[i].info.refusereason == 1)
M_StartMessage(M_GetText("The server is not accepting\njoins for the moment.\n\nPress ESC\n"), NULL, MM_NOTHING);
else if (serverlist[i].info.refusereason == 2)
M_StartMessage(va(M_GetText("Maximum players reached: %d\n\nPress ESC\n"), serverlist[i].info.maxplayer), NULL, MM_NOTHING);
else
M_StartMessage(M_GetText("You can't join.\nI don't know why,\nbut you can't join.\n\nPress ESC\n"), NULL, MM_NOTHING);
return false;
}
@ -2439,14 +2485,14 @@ static void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
if (!playeringame[playernum])
return;
if (server && !demoplayback)
if (server && !demoplayback && playernode[playernum] != UINT8_MAX)
{
INT32 node = playernode[playernum];
playerpernode[node]--;
if (playerpernode[node] <= 0)
{
nodeingame[playernode[playernum]] = false;
Net_CloseConnection(playernode[playernum]);
nodeingame[node] = false;
Net_CloseConnection(node);
ResetNode(node);
}
}
@ -2501,20 +2547,14 @@ static void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
}
}
#ifdef HAVE_BLUA
LUAh_PlayerQuit(&players[playernum], reason); // Lua hook for player quitting
#else
(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
LUAh_ViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true);
displayplayer = consoleplayer;
}
@ -2535,9 +2575,7 @@ static void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
RemoveAdminPlayer(playernum); // don't stay admin after you're gone
}
#ifdef HAVE_BLUA
LUA_InvalidatePlayer(&players[playernum]);
#endif
if (G_TagGametype()) //Check if you still have a game. Location flexible. =P
P_CheckSurvivors();
@ -2792,16 +2830,13 @@ static void Command_Kick(void)
if (pn == -1 || pn == 0)
return;
if (server)
// Special case if we are trying to kick a player who is downloading the game state:
// trigger a timeout instead of kicking them, because a kick would only
// take effect after they have finished downloading
if (server && playernode[pn] != UINT8_MAX && sendingsavegame[playernode[pn]])
{
// Special case if we are trying to kick a player who is downloading the game state:
// trigger a timeout instead of kicking them, because a kick would only
// take effect after they have finished downloading
if (sendingsavegame[playernode[pn]])
{
Net_ConnectionTimeout(playernode[pn]);
return;
}
Net_ConnectionTimeout(playernode[pn]);
return;
}
WRITESINT8(p, pn);
@ -2859,7 +2894,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
// Is playernum authorized to make this kick?
if (playernum != serverplayer && !IsPlayerAdmin(playernum)
&& !(playerpernode[playernode[playernum]] == 2
&& !(playernode[playernum] != UINT8_MAX && playerpernode[playernode[playernum]] == 2
&& nodetoplayer2[playernode[playernum]] == pnum))
{
// We received a kick command from someone who isn't the
@ -3018,7 +3053,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
}
else if (keepbody)
{
if (server && !demoplayback)
if (server && !demoplayback && playernode[pnum] != UINT8_MAX)
{
INT32 node = playernode[pnum];
playerpernode[node]--;
@ -3134,9 +3169,7 @@ void SV_ResetServer(void)
for (i = 0; i < MAXPLAYERS; i++)
{
#ifdef HAVE_BLUA
LUA_InvalidatePlayer(&players[i]);
#endif
playeringame[i] = false;
playernode[i] = UINT8_MAX;
memset(playeraddress[i], 0, sizeof(*playeraddress));
@ -3197,10 +3230,8 @@ void D_QuitNetGame(void)
// abort send/receive of files
CloseNetFile();
#ifdef HAVE_BLUA
RemoveAllLuaFileTransfers();
waitingforluafiletransfer = false;
#endif
if (server)
{
@ -3234,37 +3265,6 @@ void D_QuitNetGame(void)
#endif
}
static INT32 FindRejoinerNum(SINT8 node)
{
char strippednodeaddress[64];
const char *nodeaddress;
char *port;
INT32 i;
// Make sure there is no dead dress before proceeding to the stripping
if (!I_GetNodeAddress)
return -1;
nodeaddress = I_GetNodeAddress(node);
if (!nodeaddress)
return -1;
// Strip the address of its port
strcpy(strippednodeaddress, nodeaddress);
port = strchr(strippednodeaddress, ':');
if (port)
*port = '\0';
// Check if any player matches the stripped address
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i] && playeraddress[i][0] && playernode[i] == UINT8_MAX
&& !strcmp(playeraddress[i], strippednodeaddress))
return i;
}
return -1;
}
// Adds a node to the game (player will follow at map change or at savegame....)
static inline void SV_AddNode(INT32 node)
{
@ -3402,10 +3402,8 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
if (server && multiplayer && motd[0] != '\0')
COM_BufAddText(va("sayto %d %s\n", newplayernum, motd));
#ifdef HAVE_BLUA
if (!rejoined)
LUAh_PlayerJoin(newplayernum);
#endif
}
static boolean SV_AddWaitingPlayers(const char *name, const char *name2)
@ -3595,7 +3593,7 @@ static void HandleConnect(SINT8 node)
rejoinernum = FindRejoinerNum(node);
if (bannednode && bannednode[node])
SV_SendRefuse(node, M_GetText("You have been banned\nfrom the server"));
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.");
@ -3606,17 +3604,15 @@ static void HandleConnect(SINT8 node)
|| 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));
else if (!cv_allownewplayer.value && node && rejoinernum == -1)
SV_SendRefuse(node, M_GetText("The server is not accepting\njoins for the moment"));
SV_SendRefuse(node, M_GetText("The server is not accepting\njoins for the moment."));
else if (D_NumPlayers() >= cv_maxplayers.value && rejoinernum == -1)
SV_SendRefuse(node, va(M_GetText("Maximum players reached: %d"), cv_maxplayers.value));
else if (netgame && netbuffer->u.clientcfg.localplayers > 1) // Hacked client?
SV_SendRefuse(node, M_GetText("Too many players from\nthis node."));
else if (netgame && !netbuffer->u.clientcfg.localplayers) // Stealth join?
SV_SendRefuse(node, M_GetText("No players from\nthis node."));
#ifdef HAVE_BLUA
else if (luafiletransfers)
SV_SendRefuse(node, M_GetText("The server is broadcasting a file\nrequested by a Lua script.\nPlease wait a bit and then\ntry rejoining."));
#endif
else
{
#ifndef NONET
@ -4203,7 +4199,6 @@ static void HandlePacketFromPlayer(SINT8 node)
Net_CloseConnection(node);
nodeingame[node] = false;
break;
#ifdef HAVE_BLUA
case PT_ASKLUAFILE:
if (server && luafiletransfers && luafiletransfers->nodestatus[node] == LFTNS_ASKED)
{
@ -4216,7 +4211,6 @@ static void HandlePacketFromPlayer(SINT8 node)
if (server && luafiletransfers && luafiletransfers->nodestatus[node] == LFTNS_SENDING)
SV_HandleLuaFileSent(node);
break;
#endif
// -------------------------------------------- CLIENT RECEIVE ----------
case PT_RESYNCHEND:
// Only accept PT_RESYNCHEND from the server.
@ -4344,12 +4338,10 @@ static void HandlePacketFromPlayer(SINT8 node)
if (client)
Got_Filetxpak();
break;
#ifdef HAVE_BLUA
case PT_SENDINGLUAFILE:
if (client)
CL_PrepareDownloadLuaFile();
break;
#endif
default:
DEBFILE(va("UNKNOWN PACKET TYPE RECEIVED %d from host %d\n",
netbuffer->packettype, node));
@ -4971,7 +4963,7 @@ void NetUpdate(void)
PingUpdate();
// update node latency values so we can take an average later.
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i])
if (playeringame[i] && playernode[i] != UINT8_MAX)
realpingtable[i] += G_TicsToMilliseconds(GetLag(playernode[i]));
pingmeasurecount++;
}

View file

@ -27,7 +27,7 @@ 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 2
#define PACKETVERSION 3
// Network play related stuff.
// There is a data struct that stores network
@ -36,7 +36,7 @@ basic fields of the packet, and change infrequently.
// be transmitted.
// Networking and tick handling related.
#define BACKUPTICS 32
#define BACKUPTICS 96
#define MAXTEXTCMD 256
//
// Packet structure
@ -67,11 +67,9 @@ typedef enum
PT_RESYNCHEND, // Player is now resynched and is being requested to remake the gametic
PT_RESYNCHGET, // Player got resynch packet
#ifdef HAVE_BLUA
PT_SENDINGLUAFILE, // Server telling a client Lua needs to open a file
PT_ASKLUAFILE, // Client telling the server they don't have the file
PT_HASLUAFILE, // Client telling the server they have the file
#endif
// Add non-PT_CANFAIL packet types here to avoid breaking MS compatibility.
@ -367,6 +365,7 @@ typedef struct
UINT8 subversion;
UINT8 numberofplayer;
UINT8 maxplayer;
UINT8 refusereason; // 0: joinable, 1: joins disabled, 2: full
char gametypename[24];
UINT8 modifiedgame;
UINT8 cheatsenabled;

View file

@ -91,9 +91,7 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
#include "hardware/hw3sound.h"
#endif
#ifdef HAVE_BLUA
#include "lua_script.h"
#endif
// platform independant focus loss
UINT8 window_notinfocus = false;
@ -746,9 +744,7 @@ void D_SRB2Loop(void)
HW3S_EndFrameUpdate();
#endif
#ifdef HAVE_BLUA
LUA_Step();
#endif
}
}
@ -1124,9 +1120,7 @@ void D_SRB2Main(void)
// can't use sprintf since there is %u in savegamename
strcatbf(savegamename, srb2home, PATHSEP);
#ifdef HAVE_BLUA
snprintf(luafiledir, sizeof luafiledir, "%s" PATHSEP "luafiles", srb2home);
#endif
#else // DEFAULTDIR
snprintf(srb2home, sizeof srb2home, "%s", userhome);
snprintf(downloaddir, sizeof downloaddir, "%s", userhome);
@ -1138,9 +1132,7 @@ void D_SRB2Main(void)
// can't use sprintf since there is %u in savegamename
strcatbf(savegamename, userhome, PATHSEP);
#ifdef HAVE_BLUA
snprintf(luafiledir, sizeof luafiledir, "%s" PATHSEP "luafiles", userhome);
#endif
#endif // DEFAULTDIR
}

View file

@ -715,10 +715,8 @@ void Net_CloseConnection(INT32 node)
InitNode(&nodes[node]);
SV_AbortSendFiles(node);
#ifdef HAVE_BLUA
if (server)
SV_AbortLuaFileTransfer(node);
#endif
I_NetFreeNodenum(node);
#endif
}
@ -803,11 +801,9 @@ static const char *packettypename[NUMPACKETTYPE] =
"RESYNCHEND",
"RESYNCHGET",
#ifdef HAVE_BLUA
"SENDINGLUAFILE",
"ASKLUAFILE",
"HASLUAFILE",
#endif
"FILEFRAGMENT",
"TEXTCMD",

View file

@ -22,7 +22,7 @@
#include "g_input.h"
#include "m_menu.h"
#include "r_local.h"
#include "r_things.h"
#include "r_skins.h"
#include "p_local.h"
#include "p_setup.h"
#include "s_sound.h"
@ -157,10 +157,8 @@ static void Command_Isgamemodified_f(void);
static void Command_Cheats_f(void);
#ifdef _DEBUG
static void Command_Togglemodified_f(void);
#ifdef HAVE_BLUA
static void Command_Archivetest_f(void);
#endif
#endif
// =========================================================================
// CLIENT VARIABLES
@ -415,11 +413,9 @@ const char *netxcmdnames[MAXNETXCMD - 1] =
"DELFILE", // replace next time we add an XD
"SETMOTD",
"SUICIDE",
#ifdef HAVE_BLUA
"LUACMD",
"LUAVAR",
"LUAFILE"
#endif
};
// =========================================================================
@ -452,10 +448,8 @@ void D_RegisterServerCommands(void)
RegisterNetXCmd(XD_PAUSE, Got_Pause);
RegisterNetXCmd(XD_SUICIDE, Got_Suicide);
RegisterNetXCmd(XD_RUNSOC, Got_RunSOCcmd);
#ifdef HAVE_BLUA
RegisterNetXCmd(XD_LUACMD, Got_Luacmd);
RegisterNetXCmd(XD_LUAFILE, Got_LuaFile);
#endif
// Remote Administration
COM_AddCommand("password", Command_Changepassword_f);
@ -504,9 +498,7 @@ void D_RegisterServerCommands(void)
COM_AddCommand("cheats", Command_Cheats_f); // test
#ifdef _DEBUG
COM_AddCommand("togglemodified", Command_Togglemodified_f);
#ifdef HAVE_BLUA
COM_AddCommand("archivetest", Command_Archivetest_f);
#endif
#endif
// for master server connection
@ -915,7 +907,7 @@ void D_RegisterClientCommands(void)
#ifdef _DEBUG
COM_AddCommand("causecfail", Command_CauseCfail_f);
#endif
#if defined(HAVE_BLUA) && defined(LUA_ALLOW_BYTECODE)
#ifdef LUA_ALLOW_BYTECODE
COM_AddCommand("dumplua", Command_Dumplua_f);
#endif
}
@ -2029,9 +2021,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
UINT8 flags;
INT32 resetplayer = 1, lastgametype;
UINT8 skipprecutscene, FLS;
#ifdef HAVE_BLUA
INT16 mapnumber;
#endif
if (playernum != serverplayer && !IsPlayerAdmin(playernum))
{
@ -2093,10 +2083,8 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
CV_StealthSetValue(&cv_playercolor, players[0].skincolor);
}
#ifdef HAVE_BLUA
mapnumber = M_MapNumber(mapname[3], mapname[4]);
LUAh_MapChange(mapnumber);
#endif
G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene, FLS);
if (demoplayback && !timingdemo)
@ -2680,11 +2668,9 @@ 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)))
@ -2841,12 +2827,10 @@ 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
LUAh_ViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true);
displayplayer = consoleplayer;
}
@ -3344,10 +3328,6 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
boolean kick = false;
boolean toomany = false;
INT32 i,j;
serverinfo_pak *dummycheck = NULL;
// Shut the compiler up.
(void)dummycheck;
READSTRINGN(*cp, filename, 240);
READMEM(*cp, md5sum, 16);
@ -3574,10 +3554,8 @@ static void Command_Playintro_f(void)
*/
FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void)
{
#ifdef HAVE_BLUA
if (Playing())
LUAh_GameQuit();
#endif
I_Quit();
}
@ -3759,11 +3737,11 @@ static void ExitMove_OnChange(void)
{
if (players[i].mo->target && players[i].mo->target->type == MT_SIGN)
P_SetTarget(&players[i].mo->target, NULL);
if (players[i].pflags & PF_FINISHED)
P_GiveFinishFlags(&players[i]);
}
CONS_Printf(M_GetText("Players can now move after completing the level.\n"));
}
else
@ -4239,10 +4217,8 @@ void Command_ExitGame_f(void)
{
INT32 i;
#ifdef HAVE_BLUA
if (Playing())
LUAh_GameQuit();
#endif
D_QuitNetGame();
CL_Reset();
@ -4345,7 +4321,6 @@ static void Command_Togglemodified_f(void)
modifiedgame = !modifiedgame;
}
#ifdef HAVE_BLUA
extern UINT8 *save_p;
static void Command_Archivetest_f(void)
{
@ -4390,7 +4365,6 @@ static void Command_Archivetest_f(void)
CONS_Printf("Done. No crash.\n");
}
#endif
#endif
/** Makes a change to ::cv_forceskin take effect immediately.
*

View file

@ -142,11 +142,9 @@ typedef enum
XD_SETMOTD, // 19
XD_SUICIDE, // 20
XD_DEMOTED, // 21
#ifdef HAVE_BLUA
XD_LUACMD, // 22
XD_LUAVAR, // 23
XD_LUAFILE, // 24
#endif
MAXNETXCMD
} netxcmd_t;

View file

@ -95,11 +95,9 @@ char downloaddir[512] = "DOWNLOAD";
INT32 lastfilenum = -1;
#endif
#ifdef HAVE_BLUA
luafiletransfer_t *luafiletransfers = NULL;
boolean waitingforluafiletransfer = false;
char luafiledir[256 + 16] = "luafiles";
#endif
/** Fills a serverinfo packet with information about wad files loaded.
@ -458,7 +456,6 @@ void CL_LoadServerFiles(void)
}
}
#ifdef HAVE_BLUA
void AddLuaFileTransfer(const char *filename, const char *mode)
{
luafiletransfer_t **prevnext; // A pointer to the "next" field of the last transfer in the list
@ -614,7 +611,6 @@ void CL_PrepareDownloadLuaFile(void)
// Make sure all directories in the file path exist
MakePathDirs(fileneeded[0].filename);
}
#endif
// Number of files to send
// Little optimization to quickly test if there is a file in the queue
@ -749,7 +745,6 @@ void SV_SendRam(INT32 node, void *data, size_t size, freemethod_t freemethod, UI
filestosend++;
}
#ifdef HAVE_BLUA
/** Adds a file requested by Lua to the file list for a node
*
* \param node The node to send the file to
@ -798,7 +793,6 @@ boolean SV_SendLuaFile(INT32 node, const char *filename, boolean textmode)
filestosend++;
return true;
}
#endif
/** Stops sending a file for a node, and removes the file request from the list,
* either because the file has been fully sent or because the node was disconnected
@ -1035,14 +1029,12 @@ void Got_Filetxpak(void)
file->status = FS_FOUND;
CONS_Printf(M_GetText("Downloading %s...(done)\n"),
filename);
#ifdef HAVE_BLUA
if (luafiletransfers)
{
// Tell the server we have received the file
netbuffer->packettype = PT_HASLUAFILE;
HSendPacket(servernode, true, 0, 0);
}
#endif
}
}
else

View file

@ -72,7 +72,6 @@ boolean CL_CheckDownloadable(void);
boolean CL_SendRequestFile(void);
boolean Got_RequestFilePak(INT32 node);
#ifdef HAVE_BLUA
typedef enum
{
LFTNS_WAITING, // This node is waiting for the server to send the file
@ -108,7 +107,6 @@ void Got_LuaFile(UINT8 **cp, INT32 playernum);
void StoreLuaFileCallback(INT32 id);
void RemoveLuaFileCallback(INT32 id);
void MakePathDirs(char *path);
#endif
void SV_AbortSendFiles(INT32 node);
void CloseNetFile(void);

View file

@ -31,6 +31,7 @@
#include "r_data.h"
#include "r_draw.h"
#include "r_patch.h"
#include "r_things.h" // R_Char2Frame
#include "r_sky.h"
#include "fastcmp.h"
#include "lua_script.h"
@ -39,9 +40,7 @@
#include "m_cond.h"
#ifdef HAVE_BLUA
#include "v_video.h" // video flags (for lua)
#endif
#ifdef HWRENDER
#include "hardware/hw_light.h"
@ -76,10 +75,8 @@ static UINT16 get_mus(const char *word, UINT8 dehacked_mode);
#endif
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
//static INT16 get_gametype(const char *word);
//static powertype_t get_power(const char *word);
boolean deh_loaded = false;
static int dbg_line;
@ -1415,7 +1412,6 @@ static void readlevelheader(MYFILE *f, INT32 num)
// Lua custom options also go above, contents may be case sensitive.
if (fastncmp(word, "LUA.", 4))
{
#ifdef HAVE_BLUA
UINT8 j;
customoption_t *modoption;
@ -1449,9 +1445,6 @@ static void readlevelheader(MYFILE *f, INT32 num)
modoption->option[31] = '\0';
strncpy(modoption->value, word2, 255);
modoption->value[255] = '\0';
#else
// Silently ignore.
#endif
continue;
}
@ -3123,22 +3116,20 @@ static void readframe(MYFILE *f, INT32 num)
}
z = 0;
#ifdef HAVE_BLUA
found = LUA_SetLuaAction(&states[num], actiontocompare);
if (!found)
#endif
while (actionpointers[z].name)
{
if (fastcmp(actiontocompare, actionpointers[z].name))
while (actionpointers[z].name)
{
states[num].action = actionpointers[z].action;
states[num].action.acv = actionpointers[z].action.acv; // assign
states[num].action.acp1 = actionpointers[z].action.acp1;
found = true;
break;
if (fastcmp(actiontocompare, actionpointers[z].name))
{
states[num].action = actionpointers[z].action;
states[num].action.acv = actionpointers[z].action.acv; // assign
states[num].action.acp1 = actionpointers[z].action.acp1;
found = true;
break;
}
z++;
}
z++;
}
if (!found)
deh_warning("Unknown action %s", actiontocompare);
@ -8848,14 +8839,12 @@ static const char *const MOBJEFLAG_LIST[] = {
NULL
};
#ifdef HAVE_BLUA
static const char *const MAPTHINGFLAG_LIST[4] = {
"EXTRA", // Extra flag for objects.
"OBJECTFLIP", // Reverse gravity flag for objects.
"OBJECTSPECIAL", // Special flag used with certain objects.
"AMBUSH" // Deaf monsters/do not react to sound.
};
#endif
static const char *const PLAYERFLAG_LIST[] = {
@ -8952,7 +8941,6 @@ static const char *const GAMETYPERULE_LIST[] = {
NULL
};
#ifdef HAVE_BLUA
// Linedef flags
static const char *const ML_LIST[16] = {
"IMPASSIBLE",
@ -8972,7 +8960,6 @@ static const char *const ML_LIST[16] = {
"BOUNCY",
"TFERLINE"
};
#endif
// This DOES differ from r_draw's Color_Names, unfortunately.
// Also includes Super colors
@ -9271,11 +9258,7 @@ static const char *const MENUTYPES_LIST[] = {
struct {
const char *n;
// has to be able to hold both fixed_t and angle_t, so drastic measure!!
#ifdef HAVE_BLUA
lua_Integer v;
#else
INT64 v;
#endif
} const INT_CONST[] = {
// If a mod removes some variables here,
// please leave the names in-tact and just set
@ -9531,7 +9514,6 @@ struct {
{"ME_ULTIMATE",ME_ULTIMATE},
{"ME_PERFECT",ME_PERFECT},
#ifdef HAVE_BLUA
// p_local.h constants
{"FLOATSPEED",FLOATSPEED},
{"MAXSTEPMOVE",MAXSTEPMOVE},
@ -9696,11 +9678,10 @@ struct {
// Node flags
{"NF_SUBSECTOR",NF_SUBSECTOR}, // Indicate a leaf.
#endif
#ifdef ESLOPE
// Slope flags
{"SL_NOPHYSICS",SL_NOPHYSICS},
{"SL_DYNAMIC",SL_DYNAMIC},
#endif
// Angles
{"ANG1",ANG1},
@ -9864,7 +9845,6 @@ struct {
{"TC_RAINBOW",TC_RAINBOW},
{"TC_BLINK",TC_BLINK},
{"TC_DASHMODE",TC_DASHMODE},
#endif
{NULL,0}
};
@ -10021,8 +10001,7 @@ static menutype_t get_menutype(const char *word)
return MN_NONE;
}
#ifndef HAVE_BLUA
static INT16 get_gametype(const char *word)
/*static INT16 get_gametype(const char *word)
{ // Returns the value of GT_ enumerations
INT16 i;
if (*word >= '0' && *word <= '9')
@ -10048,7 +10027,7 @@ static powertype_t get_power(const char *word)
return i;
deh_warning("Couldn't find power named 'pw_%s'",word);
return pw_invulnerability;
}
}*/
/// \todo Make ANY of this completely over-the-top math craziness obey the order of operations.
static fixed_t op_mul(fixed_t a, fixed_t b) { return a*b; }
@ -10076,7 +10055,7 @@ struct {
};
// Returns the full word, cut at the first symbol or whitespace
static char *read_word(const char *line)
/*static char *read_word(const char *line)
{
// Part 1: You got the start of the word, now find the end.
const char *p;
@ -10306,16 +10285,14 @@ static fixed_t find_const(const char **rword)
const_warning("constant",word);
free(word);
return 0;
}
#endif
}*/
// Loops through every constant and operation in word and performs its calculations, returning the final value.
fixed_t get_number(const char *word)
{
#ifdef HAVE_BLUA
return LUA_EvalMath(word);
#else
// DESPERATELY NEEDED: Order of operations support! :x
/*// DESPERATELY NEEDED: Order of operations support! :x
fixed_t i = find_const(&word);
INT32 o;
while(*word) {
@ -10325,8 +10302,7 @@ fixed_t get_number(const char *word)
else
break;
}
return i;
#endif
return i;*/
}
void DEH_Check(void)
@ -10351,7 +10327,6 @@ void DEH_Check(void)
#endif
}
#ifdef HAVE_BLUA
#include "lua_script.h"
#include "lua_libs.h"
@ -10977,5 +10952,3 @@ void LUA_SetActionByName(void *state, const char *actiontocompare)
}
}
}
#endif // HAVE_BLUA

View file

@ -34,11 +34,9 @@ void DEH_Check(void);
fixed_t get_number(const char *word);
#ifdef HAVE_BLUA
boolean LUA_SetLuaAction(void *state, const char *actiontocompare);
const char *LUA_GetActionName(void *action);
void LUA_SetActionByName(void *state, const char *actiontocompare);
#endif
extern boolean deh_loaded;

View file

@ -562,14 +562,9 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
// None of these that are disabled in the normal build are guaranteed to work perfectly
// Compile them at your own risk!
/// Kalaron/Eternity Engine slope code (SRB2CB ported)
#define ESLOPE
#ifdef ESLOPE
/// Backwards compatibility with SRB2CB's slope linedef types.
/// \note A simple shim that prints a warning.
#define ESLOPE_TYPESHIM
#endif
/// Allows the use of devmode in multiplayer. AKA "fishcake"
//#define NETGAME_DEVMODE

View file

@ -493,7 +493,6 @@ extern UINT16 emeralds;
#define EMERALD7 64
#define ALL7EMERALDS(v) ((v & (EMERALD1|EMERALD2|EMERALD3|EMERALD4|EMERALD5|EMERALD6|EMERALD7)) == (EMERALD1|EMERALD2|EMERALD3|EMERALD4|EMERALD5|EMERALD6|EMERALD7))
// yes, even in non HAVE_BLUA
#define NUM_LUABANKS 16 // please only make this number go up between versions, never down. you'll break saves otherwise. also, must fit in UINT8
extern INT32 luabanks[NUM_LUABANKS];

View file

@ -39,9 +39,7 @@
#include "fastcmp.h"
#include "console.h"
#ifdef HAVE_BLUA
#include "lua_hud.h"
#endif
// Stage of animation:
// 0 = text, 1 = art screen
@ -2762,11 +2760,7 @@ void F_TitleScreenDrawer(void)
// rei|miru: use title pics?
hidepics = curhidepics;
if (hidepics)
#ifdef HAVE_BLUA
goto luahook;
#else
return;
#endif
switch(curttmode)
{
@ -3488,10 +3482,8 @@ void F_TitleScreenDrawer(void)
break;
}
#ifdef HAVE_BLUA
luahook:
LUAh_TitleHUD();
#endif
}
// separate animation timer for backgrounds, since we also count

View file

@ -16,6 +16,7 @@
#include "i_video.h"
#include "v_video.h"
#include "r_state.h" // fadecolormap
#include "r_draw.h" // transtable
#include "p_pspr.h" // tr_transxxx
#include "p_local.h"
@ -32,9 +33,7 @@
#include "doomstat.h"
#ifdef HAVE_BLUA
#include "lua_hud.h" // level title
#endif
#ifdef HWRENDER
#include "hardware/hw_main.h"

View file

@ -60,7 +60,7 @@ typedef enum
#endif
EXT_PK3,
EXT_SOC,
EXT_LUA, // allowed even if not HAVE_BLUA so that we can yell on load attempt
EXT_LUA,
NUM_EXT,
NUM_EXT_TABLE = NUM_EXT-EXT_START,
EXT_LOADED = 0x80

2501
src/g_demo.c Normal file

File diff suppressed because it is too large Load diff

86
src/g_demo.h Normal file
View file

@ -0,0 +1,86 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file g_demo.h
/// \brief Demo recording and playback
#ifndef __G_DEMO__
#define __G_DEMO__
#include "doomdef.h"
#include "doomstat.h"
#include "d_event.h"
// ======================================
// DEMO playback/recording related stuff.
// ======================================
// demoplaying back and demo recording
extern boolean demoplayback, titledemo, demorecording, timingdemo;
extern tic_t demostarttime;
// Quit after playing a demo from cmdline.
extern boolean singledemo;
extern boolean demo_start;
extern boolean demosynced;
extern mobj_t *metalplayback;
// Only called by startup code.
void G_RecordDemo(const char *name);
void G_RecordMetal(void);
void G_BeginRecording(void);
void G_BeginMetal(void);
// Only called by shutdown code.
void G_SetDemoTime(UINT32 ptime, UINT32 pscore, UINT16 prings);
UINT8 G_CmpDemoTime(char *oldname, char *newname);
typedef enum
{
GHC_NORMAL = 0,
GHC_SUPER,
GHC_FIREFLOWER,
GHC_INVINCIBLE,
GHC_NIGHTSSKIN, // not actually a colour
GHC_RETURNSKIN // ditto
} ghostcolor_t;
// Record/playback tics
void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum);
void G_WriteDemoTiccmd(ticcmd_t *cmd, INT32 playernum);
void G_GhostAddThok(void);
void G_GhostAddSpin(void);
void G_GhostAddRev(void);
void G_GhostAddColor(ghostcolor_t color);
void G_GhostAddFlip(void);
void G_GhostAddScale(fixed_t scale);
void G_GhostAddHit(mobj_t *victim);
void G_WriteGhostTic(mobj_t *ghost);
void G_ConsGhostTic(void);
void G_GhostTicker(void);
void G_ReadMetalTic(mobj_t *metal);
void G_WriteMetalTic(mobj_t *metal);
void G_SaveMetal(UINT8 **buffer);
void G_LoadMetal(UINT8 **buffer);
void G_DeferedPlayDemo(const char *demo);
void G_DoPlayDemo(char *defdemoname);
void G_TimeDemo(const char *name);
void G_AddGhost(char *defdemoname);
void G_FreeGhosts(void);
void G_DoPlayMetal(void);
void G_DoneLevelLoad(void);
void G_StopMetalDemo(void);
ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(boolean kill);
void G_StopDemo(void);
boolean G_CheckDemoStatus(void);
#endif // __G_DEMO__

File diff suppressed because it is too large Load diff

View file

@ -17,6 +17,7 @@
#include "doomdef.h"
#include "doomstat.h"
#include "d_event.h"
#include "g_demo.h"
extern char gamedatafilename[64];
extern char timeattackfolder[64];
@ -31,21 +32,6 @@ extern char player_names[MAXPLAYERS][MAXPLAYERNAME+1];
extern player_t players[MAXPLAYERS];
extern boolean playeringame[MAXPLAYERS];
// ======================================
// DEMO playback/recording related stuff.
// ======================================
// demoplaying back and demo recording
extern boolean demoplayback, titledemo, demorecording, timingdemo;
extern tic_t demostarttime;
// Quit after playing a demo from cmdline.
extern boolean singledemo;
extern boolean demo_start;
extern boolean demosynced;
extern mobj_t *metalplayback;
// gametic at level start
extern tic_t levelstarttic;
@ -173,7 +159,6 @@ 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.
void G_LoadGame(UINT32 slot, INT16 mapoverride);
@ -184,54 +169,6 @@ void G_SaveGame(UINT32 slot);
void G_SaveGameOver(UINT32 slot, boolean modifylives);
// Only called by startup code.
void G_RecordDemo(const char *name);
void G_RecordMetal(void);
void G_BeginRecording(void);
void G_BeginMetal(void);
// Only called by shutdown code.
void G_SetDemoTime(UINT32 ptime, UINT32 pscore, UINT16 prings);
UINT8 G_CmpDemoTime(char *oldname, char *newname);
typedef enum
{
GHC_NORMAL = 0,
GHC_SUPER,
GHC_FIREFLOWER,
GHC_INVINCIBLE,
GHC_NIGHTSSKIN, // not actually a colour
GHC_RETURNSKIN // ditto
} ghostcolor_t;
// Record/playback tics
void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum);
void G_WriteDemoTiccmd(ticcmd_t *cmd, INT32 playernum);
void G_GhostAddThok(void);
void G_GhostAddSpin(void);
void G_GhostAddRev(void);
void G_GhostAddColor(ghostcolor_t color);
void G_GhostAddFlip(void);
void G_GhostAddScale(fixed_t scale);
void G_GhostAddHit(mobj_t *victim);
void G_WriteGhostTic(mobj_t *ghost);
void G_ConsGhostTic(void);
void G_GhostTicker(void);
void G_ReadMetalTic(mobj_t *metal);
void G_WriteMetalTic(mobj_t *metal);
void G_SaveMetal(UINT8 **buffer);
void G_LoadMetal(UINT8 **buffer);
void G_DoPlayDemo(char *defdemoname);
void G_TimeDemo(const char *name);
void G_AddGhost(char *defdemoname);
void G_DoPlayMetal(void);
void G_DoneLevelLoad(void);
void G_StopMetalDemo(void);
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];

View file

@ -28,7 +28,7 @@
#include "../tables.h"
#include "../sounds.h"
#include "../r_main.h"
#include "../r_things.h"
#include "../r_skins.h"
#include "../m_random.h"
#include "../p_local.h"
#include "hw3dsdrv.h"

View file

@ -42,9 +42,7 @@
#include "../m_cheat.h"
#include "../f_finale.h"
#include "../r_things.h" // R_GetShadowZ
#ifdef ESLOPE
#include "../p_slopes.h"
#endif
#include "hw_md2.h"
#ifdef NEWCLIP
@ -486,9 +484,7 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is
angle_t angle = 0;
FSurfaceInfo Surf;
fixed_t tempxsow, tempytow;
#ifdef ESLOPE
pslope_t *slope = NULL;
#endif
static FOutVector *planeVerts = NULL;
static UINT16 numAllocedPlaneVerts = 0;
@ -499,7 +495,6 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is
if (!xsub->planepoly)
return;
#ifdef ESLOPE
// Get the slope pointer to simplify future code
if (FOFsector)
{
@ -519,7 +514,6 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is
// Set fixedheight to the slope's height from our viewpoint, if we have a slope
if (slope)
fixedheight = P_GetZAt(slope, viewx, viewy);
#endif
height = FIXED_TO_FLOAT(fixedheight);
@ -669,13 +663,11 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is
v3d->y = height;
v3d->z = pv->y;
#ifdef ESLOPE
if (slope)
{
fixedheight = P_GetZAt(slope, FLOAT_TO_FIXED(pv->x), FLOAT_TO_FIXED(pv->y));
v3d->y = FIXED_TO_FLOAT(fixedheight);
}
#endif
}
// only useful for flat coloured triangles
@ -693,10 +685,8 @@ static void HWR_RenderPlane(sector_t *sector, extrasubsector_t *xsub, boolean is
{
sector_t *psector = gr_frontsector;
#ifdef ESLOPE
if (slope)
fixedheight = P_GetZAt(slope, psector->soundorg.x, psector->soundorg.y);
#endif
if (psector->ffloors)
{
@ -1068,7 +1058,6 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
float pegt, pegb, pegmul;
float height = 0.0f, bheight = 0.0f;
#ifdef ESLOPE
float endrealtop, endrealbot, endtop, endbot;
float endpegt, endpegb, endpegmul;
float endheight = 0.0f, endbheight = 0.0f;
@ -1076,7 +1065,6 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
// compiler complains when P_GetZAt is used in FLOAT_TO_FIXED directly
// use this as a temp var to store P_GetZAt's return value each time
fixed_t temp;
#endif
fixed_t v1x = FLOAT_TO_FIXED(wallVerts[0].x);
fixed_t v1y = FLOAT_TO_FIXED(wallVerts[0].z); // not a typo
@ -1095,23 +1083,18 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
pegb = wallVerts[0].t;
pegmul = (pegb - pegt) / (top - bot);
#ifdef ESLOPE
endrealtop = endtop = wallVerts[2].y;
endrealbot = endbot = wallVerts[1].y;
endpegt = wallVerts[2].t;
endpegb = wallVerts[1].t;
endpegmul = (endpegb - endpegt) / (endtop - endbot);
#endif
for (i = 0; i < sector->numlights; i++)
{
#ifdef ESLOPE
if (endtop < endrealbot)
#endif
if (top < realbot)
if (endtop < endrealbot && top < realbot)
return;
// There's a compiler warning here if this comment isn't here because of indentation
// There's a compiler warning here if this comment isn't here because of indentation
if (!(list[i].flags & FF_NOSHADE))
{
if (pfloor && (pfloor->flags & FF_FOG))
@ -1143,7 +1126,6 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
else
solid = false;
#ifdef ESLOPE
if (list[i].slope)
{
temp = P_GetZAt(list[i].slope, v1x, v1y);
@ -1165,26 +1147,15 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
else
bheight = endbheight = FIXED_TO_FLOAT(*list[i].caster->bottomheight);
}
#else
height = FIXED_TO_FLOAT(list[i].height);
if (solid)
bheight = FIXED_TO_FLOAT(*list[i].caster->bottomheight);
#endif
#ifdef ESLOPE
if (endheight >= endtop)
#endif
if (height >= top)
if (endheight >= endtop && height >= top)
{
if (solid && top > bheight)
top = bheight;
#ifdef ESLOPE
if (solid && endtop > endbheight)
endtop = endbheight;
#endif
}
#ifdef ESLOPE
if (i + 1 < sector->numlights)
{
if (list[i+1].slope)
@ -1202,21 +1173,8 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
bheight = realbot;
endbheight = endrealbot;
}
#else
if (i + 1 < sector->numlights)
{
bheight = FIXED_TO_FLOAT(list[i+1].height);
}
else
{
bheight = realbot;
}
#endif
#ifdef ESLOPE
if (endbheight >= endtop)
#endif
if (bheight >= top)
if (endbheight >= endtop && bheight >= top)
continue;
//Found a break;
@ -1225,15 +1183,12 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
if (bot < realbot)
bot = realbot;
#ifdef ESLOPE
endbot = endbheight;
if (endbot < endrealbot)
endbot = endrealbot;
#endif
Surf->FlatColor.s.alpha = alpha;
#ifdef ESLOPE
wallVerts[3].t = pegt + ((realtop - top) * pegmul);
wallVerts[2].t = endpegt + ((endrealtop - endtop) * endpegmul);
wallVerts[0].t = pegt + ((realtop - bot) * pegmul);
@ -1244,14 +1199,6 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
wallVerts[2].y = endtop;
wallVerts[0].y = bot;
wallVerts[1].y = endbot;
#else
wallVerts[3].t = wallVerts[2].t = pegt + ((realtop - top) * pegmul);
wallVerts[0].t = wallVerts[1].t = pegt + ((realtop - bot) * pegmul);
// set top/bottom coords
wallVerts[2].y = wallVerts[3].y = top;
wallVerts[0].y = wallVerts[1].y = bot;
#endif
if (cutflag & FF_FOG)
HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture, true, lightnum, colormap);
@ -1261,22 +1208,16 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
HWR_ProjectWall(wallVerts, Surf, PF_Masked, lightnum, colormap);
top = bot;
#ifdef ESLOPE
endtop = endbot;
#endif
}
bot = realbot;
#ifdef ESLOPE
endbot = endrealbot;
if (endtop <= endrealbot)
#endif
if (top <= realbot)
if (endtop <= endrealbot && top <= realbot)
return;
Surf->FlatColor.s.alpha = alpha;
#ifdef ESLOPE
wallVerts[3].t = pegt + ((realtop - top) * pegmul);
wallVerts[2].t = endpegt + ((endrealtop - endtop) * endpegmul);
wallVerts[0].t = pegt + ((realtop - bot) * pegmul);
@ -1287,14 +1228,6 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum,
wallVerts[2].y = endtop;
wallVerts[0].y = bot;
wallVerts[1].y = endbot;
#else
wallVerts[3].t = wallVerts[2].t = pegt + ((realtop - top) * pegmul);
wallVerts[0].t = wallVerts[1].t = pegt + ((realtop - bot) * pegmul);
// set top/bottom coords
wallVerts[2].y = wallVerts[3].y = top;
wallVerts[0].y = wallVerts[1].y = bot;
#endif
if (cutflag & FF_FOG)
HWR_AddTransparentWall(wallVerts, Surf, texnum, PF_Fog|PF_NoTexture, true, lightnum, colormap);
@ -1339,19 +1272,15 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
fixed_t worldtop, worldbottom;
fixed_t worldhigh = 0, worldlow = 0;
#ifdef ESLOPE
fixed_t worldtopslope, worldbottomslope;
fixed_t worldhighslope = 0, worldlowslope = 0;
fixed_t v1x, v1y, v2x, v2y;
#endif
GLTexture_t *grTex = NULL;
float cliplow = 0.0f, cliphigh = 0.0f;
INT32 gr_midtexture;
fixed_t h, l; // 3D sides and 2s middle textures
#ifdef ESLOPE
fixed_t hS, lS;
#endif
FUINT lightnum = 0; // shut up compiler
extracolormap_t *colormap;
@ -1370,13 +1299,10 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
ve.x = ((polyvertex_t *)gr_curline->pv2)->x;
ve.y = ((polyvertex_t *)gr_curline->pv2)->y;
#ifdef ESLOPE
v1x = FLOAT_TO_FIXED(vs.x);
v1y = FLOAT_TO_FIXED(vs.y);
v2x = FLOAT_TO_FIXED(ve.x);
v2y = FLOAT_TO_FIXED(ve.y);
#endif
#ifdef ESLOPE
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
if (slope) { \
@ -1387,10 +1313,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
SLOPEPARAMS(gr_frontsector->c_slope, worldtop, worldtopslope, gr_frontsector->ceilingheight)
SLOPEPARAMS(gr_frontsector->f_slope, worldbottom, worldbottomslope, gr_frontsector->floorheight)
#else
worldtop = gr_frontsector->ceilingheight;
worldbottom = gr_frontsector->floorheight;
#endif
// remember vertices ordering
// 3--2
@ -1440,14 +1362,9 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
boolean bothceilingssky = false; // turned on if both back and front ceilings are sky
boolean bothfloorssky = false; // likewise, but for floors
#ifdef ESLOPE
SLOPEPARAMS(gr_backsector->c_slope, worldhigh, worldhighslope, gr_backsector->ceilingheight)
SLOPEPARAMS(gr_backsector->f_slope, worldlow, worldlowslope, gr_backsector->floorheight)
#undef SLOPEPARAMS
#else
worldhigh = gr_backsector->ceilingheight;
worldlow = gr_backsector->floorheight;
#endif
// hack to allow height changes in outdoor areas
// This is what gets rid of the upper textures if there should be sky
@ -1470,12 +1387,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
gr_bottomtexture = R_GetTextureNum(gr_sidedef->bottomtexture);
// check TOP TEXTURE
if ((
#ifdef ESLOPE
worldhighslope < worldtopslope ||
#endif
worldhigh < worldtop
) && gr_toptexture)
if ((worldhighslope < worldtopslope || worldhigh < worldtop) && gr_toptexture)
{
{
fixed_t texturevpegtop; // top
@ -1485,15 +1397,10 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
// PEGGING
if (gr_linedef->flags & ML_DONTPEGTOP)
texturevpegtop = 0;
#ifdef ESLOPE
else if (gr_linedef->flags & ML_EFFECT1)
texturevpegtop = worldhigh + textureheight[gr_sidedef->toptexture] - worldtop;
else
texturevpegtop = gr_backsector->ceilingheight + textureheight[gr_sidedef->toptexture] - gr_frontsector->ceilingheight;
#else
else
texturevpegtop = worldhigh + textureheight[gr_sidedef->toptexture] - worldtop;
#endif
texturevpegtop += gr_sidedef->rowoffset;
@ -1505,7 +1412,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
#ifdef ESLOPE
// Adjust t value for sloped walls
if (!(gr_linedef->flags & ML_EFFECT1))
{
@ -1528,19 +1434,13 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[3].t = wallVerts[0].t - (worldtop - worldhigh) * grTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (worldtopslope - worldhighslope) * grTex->scaleY;
}
#endif
}
// set top/bottom coords
#ifdef ESLOPE
wallVerts[3].y = FIXED_TO_FLOAT(worldtop);
wallVerts[0].y = FIXED_TO_FLOAT(worldhigh);
wallVerts[2].y = FIXED_TO_FLOAT(worldtopslope);
wallVerts[1].y = FIXED_TO_FLOAT(worldhighslope);
#else
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldtop);
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldhigh);
#endif
if (gr_frontsector->numlights)
HWR_SplitWall(gr_frontsector, wallVerts, gr_toptexture, &Surf, FF_CUTLEVEL, NULL);
@ -1552,9 +1452,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
// check BOTTOM TEXTURE
if ((
#ifdef ESLOPE
worldlowslope > worldbottomslope ||
#endif
worldlow > worldbottom) && gr_bottomtexture) //only if VISIBLE!!!
{
{
@ -1563,19 +1461,12 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
grTex = HWR_GetTexture(gr_bottomtexture);
// PEGGING
#ifdef ESLOPE
if (!(gr_linedef->flags & ML_DONTPEGBOTTOM))
texturevpegbottom = 0;
else if (gr_linedef->flags & ML_EFFECT1)
texturevpegbottom = worldbottom - worldlow;
else
texturevpegbottom = gr_frontsector->floorheight - gr_backsector->floorheight;
#else
if (gr_linedef->flags & ML_DONTPEGBOTTOM)
texturevpegbottom = worldbottom - worldlow;
else
texturevpegbottom = 0;
#endif
texturevpegbottom += gr_sidedef->rowoffset;
@ -1587,7 +1478,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
#ifdef ESLOPE
// Adjust t value for sloped walls
if (!(gr_linedef->flags & ML_EFFECT1))
{
@ -1610,19 +1500,13 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[0].t = (texturevpegbottom + worldlow - worldbottom) * grTex->scaleY;
wallVerts[1].t = (texturevpegbottom + worldlowslope - worldbottomslope) * grTex->scaleY;
}
#endif
}
// set top/bottom coords
#ifdef ESLOPE
wallVerts[3].y = FIXED_TO_FLOAT(worldlow);
wallVerts[0].y = FIXED_TO_FLOAT(worldbottom);
wallVerts[2].y = FIXED_TO_FLOAT(worldlowslope);
wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope);
#else
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldlow);
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldbottom);
#endif
if (gr_frontsector->numlights)
HWR_SplitWall(gr_frontsector, wallVerts, gr_bottomtexture, &Surf, FF_CUTLEVEL, NULL);
@ -1692,16 +1576,10 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
else
#endif
{
#ifdef ESLOPE
popentop = min(worldtop, worldhigh);
popenbottom = max(worldbottom, worldlow);
#else
popentop = min(front->ceilingheight, back->ceilingheight);
popenbottom = max(front->floorheight, back->floorheight);
#endif
}
#ifdef ESLOPE
if (gr_linedef->flags & ML_EFFECT2)
{
if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3))
@ -1716,9 +1594,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
}
}
else if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3))
#else
if (gr_linedef->flags & ML_DONTPEGBOTTOM)
#endif
{
polybottom = popenbottom + gr_sidedef->rowoffset;
polytop = polybottom + textureheight[gr_midtexture]*repeats;
@ -1750,11 +1625,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
{
// PEGGING
#ifdef ESLOPE
if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3))
#else
if (gr_linedef->flags & ML_DONTPEGBOTTOM)
#endif
texturevpeg = textureheight[gr_sidedef->midtexture]*repeats - h + polybottom;
else
texturevpeg = polytop - h;
@ -1773,7 +1644,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(h);
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(l);
#ifdef ESLOPE
// Correct to account for slopes
{
fixed_t midtextureslant;
@ -1816,7 +1686,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[2].y = FIXED_TO_FLOAT(h);
wallVerts[1].y = FIXED_TO_FLOAT(l);
}
#endif
// set alpha for transparent walls (new boom and legacy linedef types)
// ooops ! this do not work at all because render order we should render it in backtofront order
@ -1918,12 +1787,8 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
if (gr_backsector->ceilingpic != skyflatnum) // don't cull if back sector is also sky
{
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(INT32_MAX); // draw to top of map space
#ifdef ESLOPE
wallVerts[0].y = FIXED_TO_FLOAT(worldtop);
wallVerts[1].y = FIXED_TO_FLOAT(worldtopslope);
#else
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldtop);
#endif
HWR_DrawSkyWall(wallVerts, &Surf);
}
}
@ -1932,12 +1797,8 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
{
if (gr_backsector->floorpic != skyflatnum) // don't cull if back sector is also sky
{
#ifdef ESLOPE
wallVerts[3].y = FIXED_TO_FLOAT(worldbottom);
wallVerts[2].y = FIXED_TO_FLOAT(worldbottomslope);
#else
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldbottom);
#endif
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(INT32_MIN); // draw to bottom of map space
HWR_DrawSkyWall(wallVerts, &Surf);
}
@ -1954,12 +1815,9 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
{
fixed_t texturevpeg;
// PEGGING
#ifdef ESLOPE
if ((gr_linedef->flags & (ML_DONTPEGBOTTOM|ML_EFFECT2)) == (ML_DONTPEGBOTTOM|ML_EFFECT2))
texturevpeg = gr_frontsector->floorheight + textureheight[gr_sidedef->midtexture] - gr_frontsector->ceilingheight + gr_sidedef->rowoffset;
else
#endif
if (gr_linedef->flags & ML_DONTPEGBOTTOM)
else if (gr_linedef->flags & ML_DONTPEGBOTTOM)
texturevpeg = worldbottom + textureheight[gr_sidedef->midtexture] - worldtop + gr_sidedef->rowoffset;
else
// top of texture at top
@ -1972,7 +1830,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
#ifdef ESLOPE
// Texture correction for slopes
if (gr_linedef->flags & ML_EFFECT2) {
wallVerts[3].t += (gr_frontsector->ceilingheight - worldtop) * grTex->scaleY;
@ -1986,19 +1843,14 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[0].t = wallVerts[3].t - (worldbottom-worldtop) * grTex->scaleY;
wallVerts[1].t = wallVerts[2].t - (worldbottomslope-worldtopslope) * grTex->scaleY;
}
#endif
}
#ifdef ESLOPE
//Set textures properly on single sided walls that are sloped
wallVerts[3].y = FIXED_TO_FLOAT(worldtop);
wallVerts[0].y = FIXED_TO_FLOAT(worldbottom);
wallVerts[2].y = FIXED_TO_FLOAT(worldtopslope);
wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope);
#else
// set top/bottom coords
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldtop);
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldbottom);
#endif
// I don't think that solid walls can use translucent linedef types...
if (gr_frontsector->numlights)
HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, &Surf, FF_CUTLEVEL, NULL);
@ -2016,22 +1868,14 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
if (gr_frontsector->ceilingpic == skyflatnum) // It's a single-sided line with sky for its sector
{
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(INT32_MAX); // draw to top of map space
#ifdef ESLOPE
wallVerts[0].y = FIXED_TO_FLOAT(worldtop);
wallVerts[1].y = FIXED_TO_FLOAT(worldtopslope);
#else
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(worldtop);
#endif
HWR_DrawSkyWall(wallVerts, &Surf);
}
if (gr_frontsector->floorpic == skyflatnum)
{
#ifdef ESLOPE
wallVerts[3].y = FIXED_TO_FLOAT(worldbottom);
wallVerts[2].y = FIXED_TO_FLOAT(worldbottomslope);
#else
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(worldbottom);
#endif
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(INT32_MIN); // draw to bottom of map space
HWR_DrawSkyWall(wallVerts, &Surf);
}
@ -2072,7 +1916,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
}
#ifdef ESLOPE
h = *rover->t_slope ? P_GetZAt(*rover->t_slope, v1x, v1y) : *rover->topheight;
hS = *rover->t_slope ? P_GetZAt(*rover->t_slope, v2x, v2y) : *rover->topheight;
l = *rover->b_slope ? P_GetZAt(*rover->b_slope, v1x, v1y) : *rover->bottomheight;
@ -2089,19 +1932,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[2].y = FIXED_TO_FLOAT(hS);
wallVerts[0].y = FIXED_TO_FLOAT(l);
wallVerts[1].y = FIXED_TO_FLOAT(lS);
#else
h = *rover->topheight;
l = *rover->bottomheight;
if (h > highcut)
h = highcut;
if (l < lowcut)
l = lowcut;
//Hurdler: HW code starts here
//FIXME: check if peging is correct
// set top/bottom coords
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(h);
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(l);
#endif
if (rover->flags & FF_FOG)
{
wallVerts[3].t = wallVerts[2].t = 0;
@ -2113,9 +1943,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
{
fixed_t texturevpeg;
boolean attachtobottom = false;
#ifdef ESLOPE
boolean slopeskew = false; // skew FOF walls with slopes?
#endif
// Wow, how was this missing from OpenGL for so long?
// ...Oh well, anyway, Lower Unpegged now changes pegging of FOFs like in software
@ -2124,22 +1952,17 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
{
texturevpeg = sides[newline->sidenum[0]].rowoffset;
attachtobottom = !!(newline->flags & ML_DONTPEGBOTTOM);
#ifdef ESLOPE
slopeskew = !!(newline->flags & ML_DONTPEGTOP);
#endif
}
else
{
texturevpeg = sides[rover->master->sidenum[0]].rowoffset;
attachtobottom = !!(gr_linedef->flags & ML_DONTPEGBOTTOM);
#ifdef ESLOPE
slopeskew = !!(rover->master->flags & ML_DONTPEGTOP);
#endif
}
grTex = HWR_GetTexture(texnum);
#ifdef ESLOPE
if (!slopeskew) // no skewing
{
if (attachtobottom)
@ -2164,12 +1987,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[2].t = wallVerts[1].t - (hS - lS) * grTex->scaleY;
}
}
#else
if (attachtobottom)
texturevpeg -= *rover->topheight - *rover->bottomheight;
wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h + texturevpeg) * grTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (*rover->topheight - l + texturevpeg) * grTex->scaleY;
#endif
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
@ -2238,7 +2055,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
newline = rover->master->frontsector->lines[0] + linenum;
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
}
#ifdef ESLOPE //backsides
h = *rover->t_slope ? P_GetZAt(*rover->t_slope, v1x, v1y) : *rover->topheight;
hS = *rover->t_slope ? P_GetZAt(*rover->t_slope, v2x, v2y) : *rover->topheight;
l = *rover->b_slope ? P_GetZAt(*rover->b_slope, v1x, v1y) : *rover->bottomheight;
@ -2255,19 +2071,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[2].y = FIXED_TO_FLOAT(hS);
wallVerts[0].y = FIXED_TO_FLOAT(l);
wallVerts[1].y = FIXED_TO_FLOAT(lS);
#else
h = *rover->topheight;
l = *rover->bottomheight;
if (h > highcut)
h = highcut;
if (l < lowcut)
l = lowcut;
//Hurdler: HW code starts here
//FIXME: check if peging is correct
// set top/bottom coords
wallVerts[2].y = wallVerts[3].y = FIXED_TO_FLOAT(h);
wallVerts[0].y = wallVerts[1].y = FIXED_TO_FLOAT(l);
#endif
if (rover->flags & FF_FOG)
{
wallVerts[3].t = wallVerts[2].t = 0;
@ -2365,7 +2168,6 @@ static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacks
// GZDoom method of sloped line clipping
#ifdef ESLOPE
if (afrontsector->f_slope || afrontsector->c_slope || abacksector->f_slope || abacksector->c_slope)
{
fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t
@ -2387,7 +2189,6 @@ static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacks
#undef SLOPEPARAMS
}
else
#endif
{
frontf1 = frontf2 = afrontsector->floorheight;
frontc1 = frontc2 = afrontsector->ceilingheight;
@ -2928,7 +2729,6 @@ static void HWR_AddLine(seg_t * line)
goto clippass; // treat like wide open window instead
}
#ifdef ESLOPE
if (gr_frontsector->f_slope || gr_frontsector->c_slope || gr_backsector->f_slope || gr_backsector->c_slope)
{
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
@ -2973,7 +2773,6 @@ static void HWR_AddLine(seg_t * line)
goto clippass;
}
else
#endif
{
// if both ceilings are skies, consider it always "open"
// same for floors
@ -3511,7 +3310,6 @@ static void HWR_Subsector(size_t num)
cullFloorHeight = locFloorHeight = gr_frontsector->floorheight;
cullCeilingHeight = locCeilingHeight = gr_frontsector->ceilingheight;
#ifdef ESLOPE
if (gr_frontsector->f_slope)
{
cullFloorHeight = P_GetZAt(gr_frontsector->f_slope, viewx, viewy);
@ -3523,7 +3321,6 @@ static void HWR_Subsector(size_t num)
cullCeilingHeight = P_GetZAt(gr_frontsector->c_slope, viewx, viewy);
locCeilingHeight = P_GetZAt(gr_frontsector->c_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
}
#endif
}
// ----- end special tricks -----
@ -3615,15 +3412,13 @@ static void HWR_Subsector(size_t num)
fixed_t cullHeight, centerHeight;
// bottom plane
#ifdef ESLOPE
if (*rover->b_slope)
{
cullHeight = P_GetZAt(*rover->b_slope, viewx, viewy);
centerHeight = P_GetZAt(*rover->b_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
}
else
#endif
cullHeight = centerHeight = *rover->bottomheight;
cullHeight = centerHeight = *rover->bottomheight;
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES))
continue;
@ -3683,15 +3478,13 @@ static void HWR_Subsector(size_t num)
}
// top plane
#ifdef ESLOPE
if (*rover->t_slope)
{
cullHeight = P_GetZAt(*rover->t_slope, viewx, viewy);
centerHeight = P_GetZAt(*rover->t_slope, gr_frontsector->soundorg.x, gr_frontsector->soundorg.y);
}
else
#endif
cullHeight = centerHeight = *rover->topheight;
cullHeight = centerHeight = *rover->topheight;
if (centerHeight >= locFloorHeight &&
centerHeight <= locCeilingHeight &&
@ -4263,13 +4056,11 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
float realheight, heightmult;
const sector_t *sector = spr->mobj->subsector->sector;
const lightlist_t *list = sector->lightlist;
#ifdef ESLOPE
float endrealtop, endrealbot, endtop, endbot;
float endbheight;
float endrealheight;
fixed_t temp;
fixed_t v1x, v1y, v2x, v2y;
#endif
this_scale = FIXED_TO_FLOAT(spr->mobj->scale);
@ -4341,10 +4132,8 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
towbot = baseWallVerts[0].tow;
towmult = (towbot - towtop) / (top - bot);
#ifdef ESLOPE
endrealtop = endtop = baseWallVerts[2].y;
endrealbot = endbot = baseWallVerts[1].y;
#endif
// copy the contents of baseWallVerts into the drawn wallVerts array
// baseWallVerts is used to know the final shape to easily get the vertex
@ -4384,7 +4173,6 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
if (spr->mobj->frame & FF_FULLBRIGHT)
lightlevel = 255;
#ifdef ESLOPE
for (i = 1; i < sector->numlights; i++)
{
fixed_t h = sector->lightlist[i].slope ? P_GetZAt(sector->lightlist[i].slope, spr->mobj->x, spr->mobj->y)
@ -4397,19 +4185,10 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
break;
}
}
#else
i = R_GetPlaneLight(sector, temp, false);
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *list[i].lightlevel;
colormap = *list[i].extra_colormap;
#endif
for (i = 0; i < sector->numlights; i++)
{
#ifdef ESLOPE
if (endtop < endrealbot)
#endif
if (top < realbot)
if (endtop < endrealbot && top < realbot)
return;
// even if we aren't changing colormap or lightlevel, we still need to continue drawing down the sprite
@ -4420,7 +4199,6 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
colormap = *list[i].extra_colormap;
}
#ifdef ESLOPE
if (i + 1 < sector->numlights)
{
if (list[i+1].slope)
@ -4438,21 +4216,8 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
bheight = realbot;
endbheight = endrealbot;
}
#else
if (i + 1 < sector->numlights)
{
bheight = FIXED_TO_FLOAT(list[i+1].height);
}
else
{
bheight = realbot;
}
#endif
#ifdef ESLOPE
if (endbheight >= endtop)
#endif
if (bheight >= top)
if (endbheight >= endtop && bheight >= top)
continue;
bot = bheight;
@ -4460,14 +4225,11 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
if (bot < realbot)
bot = realbot;
#ifdef ESLOPE
endbot = endbheight;
if (endbot < endrealbot)
endbot = endrealbot;
#endif
#ifdef ESLOPE
wallVerts[3].tow = towtop + ((realtop - top) * towmult);
wallVerts[2].tow = towtop + ((endrealtop - endtop) * towmult);
wallVerts[0].tow = towtop + ((realtop - bot) * towmult);
@ -4501,32 +4263,6 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
wallVerts[1].x = baseWallVerts[2].x + (baseWallVerts[2].x - baseWallVerts[1].x) * heightmult;
wallVerts[1].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult;
}
#else
wallVerts[3].tow = wallVerts[2].tow = towtop + ((realtop - top) * towmult);
wallVerts[0].tow = wallVerts[1].tow = towtop + ((realtop - bot) * towmult);
wallVerts[2].y = wallVerts[3].y = top;
wallVerts[0].y = wallVerts[1].y = bot;
// The x and y only need to be adjusted in the case that it's not a papersprite
if (cv_grspritebillboarding.value
&& spr->mobj && !(spr->mobj->frame & FF_PAPERSPRITE))
{
// Get the x and z of the vertices so billboarding draws correctly
realheight = realbot - realtop;
heightmult = (realtop - top) / realheight;
wallVerts[3].x = baseWallVerts[3].x + (baseWallVerts[3].x - baseWallVerts[0].x) * heightmult;
wallVerts[3].z = baseWallVerts[3].z + (baseWallVerts[3].z - baseWallVerts[0].z) * heightmult;
wallVerts[2].x = baseWallVerts[2].x + (baseWallVerts[2].x - baseWallVerts[1].x) * heightmult;
wallVerts[2].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult;
heightmult = (realtop - bot) / realheight;
wallVerts[0].x = baseWallVerts[3].x + (baseWallVerts[3].x - baseWallVerts[0].x) * heightmult;
wallVerts[0].z = baseWallVerts[3].z + (baseWallVerts[3].z - baseWallVerts[0].z) * heightmult;
wallVerts[1].x = baseWallVerts[2].x + (baseWallVerts[2].x - baseWallVerts[1].x) * heightmult;
wallVerts[1].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult;
}
#endif
if (colormap)
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, colormap->rgba, colormap->fadergba, false, false);
@ -4538,21 +4274,15 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
HWD.pfnDrawPolygon(&Surf, wallVerts, 4, blend|PF_Modulated|PF_Clip);
top = bot;
#ifdef ESLOPE
endtop = endbot;
#endif
}
bot = realbot;
#ifdef ESLOPE
endbot = endrealbot;
if (endtop <= endrealbot)
#endif
if (top <= realbot)
if (endtop <= endrealbot && top <= realbot)
return;
// If we're ever down here, somehow the above loop hasn't draw all the light levels of sprite
#ifdef ESLOPE
wallVerts[3].tow = towtop + ((realtop - top) * towmult);
wallVerts[2].tow = towtop + ((endrealtop - endtop) * towmult);
wallVerts[0].tow = towtop + ((realtop - bot) * towmult);
@ -4562,13 +4292,6 @@ static void HWR_SplitSprite(gr_vissprite_t *spr)
wallVerts[2].y = endtop;
wallVerts[0].y = bot;
wallVerts[1].y = endbot;
#else
wallVerts[3].tow = wallVerts[2].tow = towtop + ((realtop - top) * towmult);
wallVerts[0].tow = wallVerts[1].tow = towtop + ((realtop - bot) * towmult);
wallVerts[2].y = wallVerts[3].y = top;
wallVerts[0].y = wallVerts[1].y = bot;
#endif
if (colormap)
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, colormap->rgba, colormap->fadergba, false, false);

View file

@ -610,10 +610,8 @@ static boolean isCeilingFloating(sector_t *thisSector)
if (!adjSector) // assume floating sectors have surrounding sectors
return false;
#ifdef ESLOPE
if (adjSector->c_slope) // Don't bother with slopes
return false;
#endif
if (!refSector)
{
@ -663,10 +661,8 @@ static boolean isFloorFloating(sector_t *thisSector)
if (!adjSector) // assume floating sectors have surrounding sectors
return false;
#ifdef ESLOPE
if (adjSector->f_slope) // Don't bother with slopes
return false;
#endif
if (!refSector)
{

View file

@ -47,10 +47,8 @@
#include "hardware/hw_main.h"
#endif
#ifdef HAVE_BLUA
#include "lua_hud.h"
#include "lua_hook.h"
#endif
// coords are scaled
#define HU_INPUTX 0
@ -688,10 +686,8 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
// run the lua hook even if we were supposed to eat the msg, netgame consistency goes first.
#ifdef HAVE_BLUA
if (LUAh_PlayerMsg(playernum, target, flags, msg))
return;
#endif
if (spam_eatmsg)
return; // don't proceed if we were supposed to eat the message.
@ -2177,18 +2173,14 @@ void HU_Drawer(void)
{
if (netgame || multiplayer)
{
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_rankings))
#endif
HU_DrawRankings();
HU_DrawRankings();
if (gametype == GT_COOP)
HU_DrawNetplayCoopOverlay();
}
else
HU_DrawCoopOverlay();
#ifdef HAVE_BLUA
LUAh_ScoresHUD();
#endif
}
if (gamestate != GS_LEVEL)
@ -3171,29 +3163,20 @@ static void HU_DrawRankings(void)
static void HU_DrawCoopOverlay(void)
{
if (token
#ifdef HAVE_BLUA
&& LUA_HudEnabled(hud_tokens)
#endif
)
if (token && LUA_HudEnabled(hud_tokens))
{
V_DrawString(168, 176, 0, va("- %d", token));
V_DrawSmallScaledPatch(148, 172, 0, tokenicon);
}
#ifdef HAVE_BLUA
if (LUA_HudEnabled(hud_tabemblems))
#endif
if (!modifiedgame || savemoddata)
if (LUA_HudEnabled(hud_tabemblems) && (!modifiedgame || savemoddata))
{
V_DrawString(160, 144, 0, va("- %d/%d", M_CountEmblems(), numemblems+numextraemblems));
V_DrawScaledPatch(128, 144 - SHORT(emblemicon->height)/4, 0, emblemicon);
}
#ifdef HAVE_BLUA
if (!LUA_HudEnabled(hud_coopemeralds))
return;
#endif
if (emeralds & EMERALD1)
V_DrawScaledPatch((BASEVIDWIDTH/2)-8 , (BASEVIDHEIGHT/3)-32, 0, emeraldpics[0][0]);
@ -3215,20 +3198,14 @@ static void HU_DrawNetplayCoopOverlay(void)
{
int i;
if (token
#ifdef HAVE_BLUA
&& LUA_HudEnabled(hud_tokens)
#endif
)
if (token && LUA_HudEnabled(hud_tokens))
{
V_DrawString(168, 10, 0, va("- %d", token));
V_DrawSmallScaledPatch(148, 6, 0, tokenicon);
}
#ifdef HAVE_BLUA
if (!LUA_HudEnabled(hud_coopemeralds))
return;
#endif
for (i = 0; i < 7; ++i)
{

View file

@ -11,17 +11,14 @@
/// \brief basic functions for Lua scripting
#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
#include "p_slopes.h" // P_GetZAt
#endif
#include "z_zone.h"
#include "r_main.h"
#include "r_draw.h"
#include "r_things.h"
#include "r_things.h" // R_Frame2Char etc
#include "m_random.h"
#include "s_sound.h"
#include "g_game.h"
@ -1040,11 +1037,60 @@ static int lib_pSetObjectMomZ(lua_State *L)
return 0;
}
static int lib_pPlayJingle(lua_State *L)
{
player_t *player = NULL;
jingletype_t jingletype = luaL_checkinteger(L, 2);
//NOHUD
//INLEVEL
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
{
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
if (!player)
return LUA_ErrInvalid(L, "player_t");
}
if (jingletype >= NUMJINGLES)
return luaL_error(L, "jingletype %d out of range (0 - %d)", jingletype, NUMJINGLES-1);
P_PlayJingle(player, jingletype);
return 0;
}
static int lib_pPlayJingleMusic(lua_State *L)
{
player_t *player = NULL;
const char *musnamearg = luaL_checkstring(L, 2);
char musname[7], *p = musname;
UINT16 musflags = luaL_optinteger(L, 3, 0);
boolean looping = lua_opttrueboolean(L, 4);
jingletype_t jingletype = luaL_optinteger(L, 5, JT_OTHER);
//NOHUD
//INLEVEL
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
{
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
if (!player)
return LUA_ErrInvalid(L, "player_t");
}
if (jingletype >= NUMJINGLES)
return luaL_error(L, "jingletype %d out of range (0 - %d)", jingletype, NUMJINGLES-1);
musname[6] = '\0';
strncpy(musname, musnamearg, 6);
while (*p) {
*p = tolower(*p);
++p;
}
P_PlayJingleMusic(player, musname, musflags, looping, jingletype);
return 0;
}
static int lib_pRestoreMusic(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
NOHUD
INLEVEL
//NOHUD
//INLEVEL
if (!player)
return LUA_ErrInvalid(L, "player_t");
if (P_IsLocalPlayer(player))
@ -1674,11 +1720,15 @@ static int lib_pPlayVictorySound(lua_State *L)
static int lib_pPlayLivesJingle(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
NOHUD
INLEVEL
if (!player)
return LUA_ErrInvalid(L, "player_t");
player_t *player = NULL;
//NOHUD
//INLEVEL
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
{
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
if (!player)
return LUA_ErrInvalid(L, "player_t");
}
P_PlayLivesJingle(player);
return 0;
}
@ -2123,7 +2173,6 @@ static int lib_evStartCrumble(lua_State *L)
return 0;
}
#ifdef ESLOPE
// P_SLOPES
////////////
@ -2139,7 +2188,6 @@ static int lib_pGetZAt(lua_State *L)
lua_pushfixed(L, P_GetZAt(slope, x, y));
return 1;
}
#endif
// R_DEFS
////////////
@ -2342,7 +2390,7 @@ static int lib_sStartSound(lua_State *L)
const void *origin = NULL;
sfxenum_t sound_id = luaL_checkinteger(L, 2);
player_t *player = NULL;
//NOHUD // kys @whoever did this.
//NOHUD
if (sound_id >= NUMSFX)
return luaL_error(L, "sfx %d out of range (0 - %d)", sound_id, NUMSFX-1);
if (!lua_isnil(L, 1))
@ -2373,7 +2421,7 @@ static int lib_sStartSoundAtVolume(lua_State *L)
sfxenum_t sound_id = luaL_checkinteger(L, 2);
INT32 volume = (INT32)luaL_checkinteger(L, 3);
player_t *player = NULL;
NOHUD
//NOHUD
if (!lua_isnil(L, 1))
{
@ -2397,7 +2445,7 @@ static int lib_sStartSoundAtVolume(lua_State *L)
static int lib_sStopSound(lua_State *L)
{
void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
NOHUD
//NOHUD
if (!origin)
return LUA_ErrInvalid(L, "mobj_t");
S_StopSound(origin);
@ -2414,7 +2462,7 @@ static int lib_sChangeMusic(lua_State *L)
boolean looping;
player_t *player = NULL;
UINT16 music_flags = 0;
NOHUD
//NOHUD
if (lua_isnumber(L, 1))
{
@ -2443,7 +2491,7 @@ static int lib_sChangeMusic(lua_State *L)
boolean looping = (boolean)lua_opttrueboolean(L, 2);
player_t *player = NULL;
UINT16 music_flags = 0;
NOHUD
//NOHUD
#endif
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
@ -2474,7 +2522,7 @@ static int lib_sSpeedMusic(lua_State *L)
fixed_t fixedspeed = luaL_checkfixed(L, 1);
float speed = FIXED_TO_FLOAT(fixedspeed);
player_t *player = NULL;
NOHUD
//NOHUD
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
{
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
@ -2489,7 +2537,7 @@ static int lib_sSpeedMusic(lua_State *L)
static int lib_sStopMusic(lua_State *L)
{
player_t *player = NULL;
NOHUD
//NOHUD
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
{
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
@ -2505,7 +2553,7 @@ static int lib_sSetInternalMusicVolume(lua_State *L)
{
UINT32 volume = (UINT32)luaL_checkinteger(L, 1);
player_t *player = NULL;
NOHUD
//NOHUD
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
{
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
@ -2525,7 +2573,7 @@ static int lib_sSetInternalMusicVolume(lua_State *L)
static int lib_sStopFadingMusic(lua_State *L)
{
player_t *player = NULL;
NOHUD
//NOHUD
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
{
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
@ -2548,7 +2596,7 @@ static int lib_sFadeMusic(lua_State *L)
UINT32 ms;
INT32 source_volume;
player_t *player = NULL;
NOHUD
//NOHUD
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
{
player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER));
@ -2576,8 +2624,6 @@ static int lib_sFadeMusic(lua_State *L)
ms = (UINT32)luaL_checkinteger(L, 3);
}
NOHUD
if (!player || P_IsLocalPlayer(player))
lua_pushboolean(L, S_FadeMusicFromVolume(target_volume, source_volume, ms));
else
@ -2589,7 +2635,7 @@ static int lib_sFadeOutStopMusic(lua_State *L)
{
UINT32 ms = (UINT32)luaL_checkinteger(L, 1);
player_t *player = NULL;
NOHUD
//NOHUD
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
{
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
@ -2605,10 +2651,29 @@ static int lib_sFadeOutStopMusic(lua_State *L)
return 1;
}
static int lib_sGetMusicLength(lua_State *L)
{
lua_pushinteger(L, S_GetMusicLength());
return 1;
}
static int lib_sGetMusicPosition(lua_State *L)
{
lua_pushinteger(L, S_GetMusicPosition());
return 1;
}
static int lib_sSetMusicPosition(lua_State *L)
{
UINT32 pos = (UINT32)luaL_checkinteger(L, 1);
lua_pushboolean(L, S_SetMusicPosition(pos));
return 1;
}
static int lib_sOriginPlaying(lua_State *L)
{
void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
NOHUD
//NOHUD
INLEVEL
if (!origin)
return LUA_ErrInvalid(L, "mobj_t");
@ -2619,7 +2684,7 @@ static int lib_sOriginPlaying(lua_State *L)
static int lib_sIdPlaying(lua_State *L)
{
sfxenum_t id = luaL_checkinteger(L, 1);
NOHUD
//NOHUD
if (id >= NUMSFX)
return luaL_error(L, "sfx %d out of range (0 - %d)", id, NUMSFX-1);
lua_pushboolean(L, S_IdPlaying(id));
@ -2630,7 +2695,7 @@ static int lib_sSoundPlaying(lua_State *L)
{
void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
sfxenum_t id = luaL_checkinteger(L, 2);
NOHUD
//NOHUD
INLEVEL
if (!origin)
return LUA_ErrInvalid(L, "mobj_t");
@ -2648,7 +2713,7 @@ static int lib_sStartMusicCaption(lua_State *L)
const char *caption = luaL_checkstring(L, 1);
UINT16 lifespan = (UINT16)luaL_checkinteger(L, 2);
//HUDSAFE
INLEVEL
//INLEVEL
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
{
@ -3069,6 +3134,8 @@ static luaL_Reg lib[] = {
{"P_InSpaceSector",lib_pInSpaceSector},
{"P_InQuicksand",lib_pInQuicksand},
{"P_SetObjectMomZ",lib_pSetObjectMomZ},
{"P_PlayJingle",lib_pPlayJingle},
{"P_PlayJingleMusic",lib_pPlayJingleMusic},
{"P_RestoreMusic",lib_pRestoreMusic},
{"P_SpawnShieldOrb",lib_pSpawnShieldOrb},
{"P_SpawnGhostMobj",lib_pSpawnGhostMobj},
@ -3151,10 +3218,8 @@ static luaL_Reg lib[] = {
{"EV_CrumbleChain",lib_evCrumbleChain},
{"EV_StartCrumble",lib_evStartCrumble},
#ifdef ESLOPE
// p_slopes
{"P_GetZAt",lib_pGetZAt},
#endif
// r_defs
{"R_PointToAngle",lib_rPointToAngle},
@ -3189,6 +3254,9 @@ static luaL_Reg lib[] = {
{"S_StopFadingMusic",lib_sStopFadingMusic},
{"S_FadeMusic",lib_sFadeMusic},
{"S_FadeOutStopMusic",lib_sFadeOutStopMusic},
{"S_GetMusicLength",lib_sGetMusicLength},
{"S_GetMusicPosition",lib_sGetMusicPosition},
{"S_SetMusicPosition",lib_sSetMusicPosition},
{"S_OriginPlaying",lib_sOriginPlaying},
{"S_IdPlaying",lib_sIdPlaying},
{"S_SoundPlaying",lib_sSoundPlaying},
@ -3237,5 +3305,3 @@ int LUA_BaseLib(lua_State *L)
luaL_register(L, NULL, lib);
return 0;
}
#endif

View file

@ -11,7 +11,6 @@
/// \brief blockmap library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "p_local.h"
#include "r_main.h" // validcount
#include "lua_script.h"
@ -264,5 +263,3 @@ int LUA_BlockmapLib(lua_State *L)
lua_register(L, "searchBlockmap", lib_searchBlockmap);
return 0;
}
#endif

View file

@ -11,7 +11,6 @@
/// \brief console modifying/etc library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h"
#include "p_local.h"
#include "g_game.h"
@ -551,5 +550,3 @@ int LUA_ConsoleLib(lua_State *L)
luaL_register(L, NULL, lib);
return 0;
}
#endif

View file

@ -10,8 +10,6 @@
/// \file lua_hook.h
/// \brief hooks for Lua scripting
#ifdef HAVE_BLUA
#include "r_defs.h"
#include "d_player.h"
@ -58,6 +56,7 @@ enum hook {
hook_ViewpointSwitch,
hook_SeenPlayer,
hook_PlayerThink,
hook_ShouldJingleContinue,
hook_GameQuit,
hook_MAX // last hook
@ -111,6 +110,5 @@ UINT8 LUAh_ViewpointSwitch(player_t *player, player_t *newdisplayplayer, boolean
boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend); // Hook for MT_NAMECHECK
#endif
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
void LUAh_GameQuit(void); // Hook for game quitting
#endif
boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname); // Hook for whether a jingle of the given music should continue playing
void LUAh_GameQuit(void); // Hook for game quitting

View file

@ -11,11 +11,10 @@
/// \brief hooks for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "doomstat.h"
#include "p_mobj.h"
#include "g_game.h"
#include "r_things.h"
#include "r_skins.h"
#include "b_bot.h"
#include "z_zone.h"
@ -69,6 +68,7 @@ const char *const hookNames[hook_MAX+1] = {
"ViewpointSwitch",
"SeenPlayer",
"PlayerThink",
"ShouldJingleContinue",
"GameQuit",
NULL
};
@ -82,6 +82,7 @@ struct hook_s
union {
mobjtype_t mt;
char *skinname;
char *musname;
char *funcname;
} s;
boolean error;
@ -150,6 +151,7 @@ static int lib_addHook(lua_State *L)
luaL_argcheck(L, hook.s.mt < NUMMOBJTYPES, 2, "invalid mobjtype_t");
break;
case hook_BotAI:
case hook_ShouldJingleContinue:
hook.s.skinname = NULL;
if (lua_isstring(L, 2))
{ // lowercase copy
@ -1684,4 +1686,45 @@ void LUAh_GameQuit(void)
}
}
#endif
boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname)
{
hook_p hookp;
boolean keepplaying = false;
if (!gL || !(hooksAvailable[hook_ShouldJingleContinue/8] & (1<<(hook_ShouldJingleContinue%8))))
return true;
lua_settop(gL, 0);
hud_running = true; // local hook
for (hookp = roothook; hookp; hookp = hookp->next)
{
if (hookp->type != hook_ShouldJingleContinue
|| (hookp->s.musname && strcmp(hookp->s.musname, musname)))
continue;
if (lua_gettop(gL) == 0)
{
LUA_PushUserdata(gL, player, META_PLAYER);
lua_pushstring(gL, musname);
}
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX);
lua_pushvalue(gL, -3);
lua_pushvalue(gL, -3);
if (lua_pcall(gL, 2, 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))
keepplaying = true; // Keep playing this boolean
lua_pop(gL, 1);
}
lua_settop(gL, 0);
hud_running = false;
return keepplaying;
}

View file

@ -11,7 +11,6 @@
/// \brief custom HUD rendering library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h"
#include "r_defs.h"
#include "r_local.h"
@ -1466,5 +1465,3 @@ void LUAh_IntermissionHUD(void)
lua_pop(gL, -1);
hud_running = false;
}
#endif

View file

@ -11,7 +11,6 @@
/// \brief infotable editing library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h"
#include "info.h"
#include "dehacked.h"
@ -389,10 +388,7 @@ static int lib_setSpriteInfo(lua_State *L)
lua_Integer i = 0;
const char *str = NULL;
if (lua_isnumber(L, 2))
{
i = lua_tointeger(L, 2);
i++; // shift index in case of missing rotsprite support
}
else
str = luaL_checkstring(L, 2);
@ -1651,5 +1647,3 @@ int LUA_InfoLib(lua_State *L)
return 0;
}
#endif

View file

@ -10,8 +10,6 @@
/// \file lua_libs.h
/// \brief libraries for Lua scripting
#ifdef HAVE_BLUA
extern lua_State *gL;
#define LREG_VALID "VALID_USERDATA"
@ -45,11 +43,9 @@ extern lua_State *gL;
#define META_SEG "SEG_T*"
#define META_NODE "NODE_T*"
#endif
#ifdef ESLOPE
#define META_SLOPE "PSLOPE_T*"
#define META_VECTOR2 "VECTOR2_T"
#define META_VECTOR3 "VECTOR3_T"
#endif
#define META_MAPHEADER "MAPHEADER_T*"
#define META_CVAR "CONSVAR_T*"
@ -88,5 +84,3 @@ int LUA_ThinkerLib(lua_State *L);
int LUA_MapLib(lua_State *L);
int LUA_BlockmapLib(lua_State *L);
int LUA_HudLib(lua_State *L);
#endif

View file

@ -11,14 +11,11 @@
/// \brief game map library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "r_state.h"
#include "p_local.h"
#include "p_setup.h"
#include "z_zone.h"
#ifdef ESLOPE
#include "p_slopes.h"
#endif
#include "r_main.h"
#include "lua_script.h"
@ -42,13 +39,9 @@ enum sector_e {
sector_heightsec,
sector_camsec,
sector_lines,
#ifdef ESLOPE
sector_ffloors,
sector_fslope,
sector_cslope
#else
sector_ffloors
#endif
};
static const char *const sector_opt[] = {
@ -65,10 +58,8 @@ static const char *const sector_opt[] = {
"camsec",
"lines",
"ffloors",
#ifdef ESLOPE
"f_slope",
"c_slope",
#endif
NULL};
enum subsector_e {
@ -181,10 +172,8 @@ enum ffloor_e {
ffloor_toplightlevel,
ffloor_bottomheight,
ffloor_bottompic,
#ifdef ESLOPE
ffloor_tslope,
ffloor_bslope,
#endif
ffloor_sector,
ffloor_flags,
ffloor_master,
@ -201,10 +190,8 @@ static const char *const ffloor_opt[] = {
"toplightlevel",
"bottomheight",
"bottompic",
#ifdef ESLOPE
"t_slope",
"b_slope",
#endif
"sector", // secnum pushed as control sector userdata
"flags",
"master", // control linedef
@ -290,7 +277,6 @@ static const char *const bbox_opt[] = {
"right",
NULL};
#ifdef ESLOPE
enum slope_e {
slope_valid = 0,
slope_o,
@ -325,7 +311,6 @@ static const char *const vector_opt[] = {
"y",
"z",
NULL};
#endif
static const char *const array_opt[] ={"iterate",NULL};
static const char *const valid_opt[] ={"valid",NULL};
@ -571,14 +556,12 @@ static int sector_get(lua_State *L)
LUA_PushUserdata(L, sector->ffloors, META_FFLOOR);
lua_pushcclosure(L, sector_iterate, 2); // push lib_iterateFFloors and sector->ffloors as upvalues for the function
return 1;
#ifdef ESLOPE
case sector_fslope: // f_slope
LUA_PushUserdata(L, sector->f_slope, META_SLOPE);
return 1;
case sector_cslope: // c_slope
LUA_PushUserdata(L, sector->c_slope, META_SLOPE);
return 1;
#endif
}
return 0;
}
@ -602,10 +585,8 @@ static int sector_set(lua_State *L)
case sector_camsec: // camsec
case sector_lines: // lines
case sector_ffloors: // ffloors
#ifdef ESLOPE
case sector_fslope: // f_slope
case sector_cslope: // c_slope
#endif
default:
return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]);
case sector_floorheight: { // floorheight
@ -1693,14 +1674,12 @@ static int ffloor_get(lua_State *L)
lua_pushlstring(L, levelflat->name, i);
return 1;
}
#ifdef ESLOPE
case ffloor_tslope:
LUA_PushUserdata(L, *ffloor->t_slope, META_SLOPE);
return 1;
case ffloor_bslope:
LUA_PushUserdata(L, *ffloor->b_slope, META_SLOPE);
return 1;
#endif
case ffloor_sector:
LUA_PushUserdata(L, &sectors[ffloor->secnum], META_SECTOR);
return 1;
@ -1740,10 +1719,8 @@ static int ffloor_set(lua_State *L)
switch(field)
{
case ffloor_valid: // valid
#ifdef ESLOPE
case ffloor_tslope: // t_slope
case ffloor_bslope: // b_slope
#endif
case ffloor_sector: // sector
case ffloor_master: // master
case ffloor_target: // target
@ -1804,7 +1781,6 @@ static int ffloor_set(lua_State *L)
return 0;
}
#ifdef ESLOPE
//////////////
// pslope_t //
//////////////
@ -1977,7 +1953,6 @@ static int vector3_get(lua_State *L)
return 0;
}
#endif
/////////////////////
// mapheaderinfo[] //
@ -2226,7 +2201,6 @@ int LUA_MapLib(lua_State *L)
lua_setfield(L, -2, "__index");
lua_pop(L, 1);
#ifdef ESLOPE
luaL_newmetatable(L, META_SLOPE);
lua_pushcfunction(L, slope_get);
lua_setfield(L, -2, "__index");
@ -2244,7 +2218,6 @@ int LUA_MapLib(lua_State *L)
lua_pushcfunction(L, vector3_get);
lua_setfield(L, -2, "__index");
lua_pop(L, 1);
#endif
luaL_newmetatable(L, META_MAPHEADER);
lua_pushcfunction(L, mapheaderinfo_get);
@ -2337,5 +2310,3 @@ int LUA_MapLib(lua_State *L)
lua_setglobal(L, "mapheaderinfo");
return 0;
}
#endif

View file

@ -11,7 +11,6 @@
/// \brief basic math library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
//#include "fastcmp.h"
#include "tables.h"
#include "p_local.h"
@ -217,5 +216,3 @@ int LUA_MathLib(lua_State *L)
luaL_register(L, NULL, lib);
return 0;
}
#endif

View file

@ -11,9 +11,8 @@
/// \brief mobj/thing library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h"
#include "r_things.h"
#include "r_skins.h"
#include "p_local.h"
#include "g_game.h"
#include "p_setup.h"
@ -85,9 +84,7 @@ enum mobj_e {
mobj_extravalue2,
mobj_cusval,
mobj_cvmem,
#ifdef ESLOPE
mobj_standingslope,
#endif
mobj_colorized,
mobj_shadowscale
};
@ -153,9 +150,7 @@ static const char *const mobj_opt[] = {
"extravalue2",
"cusval",
"cvmem",
#ifdef ESLOPE
"standingslope",
#endif
"colorized",
"shadowscale",
NULL};
@ -384,11 +379,9 @@ static int mobj_get(lua_State *L)
case mobj_cvmem:
lua_pushinteger(L, mo->cvmem);
break;
#ifdef ESLOPE
case mobj_standingslope:
LUA_PushUserdata(L, mo->standingslope, META_SLOPE);
break;
#endif
case mobj_colorized:
lua_pushboolean(L, mo->colorized);
break;
@ -717,10 +710,8 @@ static int mobj_set(lua_State *L)
case mobj_cvmem:
mo->cvmem = luaL_checkinteger(L, 3);
break;
#ifdef ESLOPE
case mobj_standingslope:
return NOSET;
#endif
case mobj_colorized:
mo->colorized = luaL_checkboolean(L, 3);
break;
@ -915,5 +906,3 @@ int LUA_MobjLib(lua_State *L)
lua_setglobal(L, "mapthings");
return 0;
}
#endif

View file

@ -11,7 +11,6 @@
/// \brief player object library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h"
#include "p_mobj.h"
#include "d_player.h"
@ -878,5 +877,3 @@ int LUA_PlayerLib(lua_State *L)
lua_setglobal(L, "players");
return 0;
}
#endif

View file

@ -11,7 +11,6 @@
/// \brief Lua scripting basics
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h"
#include "dehacked.h"
#include "z_zone.h"
@ -24,9 +23,7 @@
#include "byteptr.h"
#include "p_saveg.h"
#include "p_local.h"
#ifdef ESLOPE
#include "p_slopes.h" // for P_SlopeById
#endif
#ifdef LUA_ALLOW_BYTECODE
#include "d_netfil.h" // for LUA_DumpFile
#endif
@ -732,9 +729,7 @@ enum
ARCH_NODE,
#endif
ARCH_FFLOOR,
#ifdef ESLOPE
ARCH_SLOPE,
#endif
ARCH_MAPHEADER,
ARCH_TEND=0xFF,
@ -759,9 +754,7 @@ static const struct {
{META_NODE, ARCH_NODE},
#endif
{META_FFLOOR, ARCH_FFLOOR},
#ifdef ESLOPE
{META_SLOPE, ARCH_SLOPE},
#endif
{META_MAPHEADER, ARCH_MAPHEADER},
{NULL, ARCH_NULL}
};
@ -1016,7 +1009,6 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
}
break;
}
#ifdef ESLOPE
case ARCH_SLOPE:
{
pslope_t *slope = *((pslope_t **)lua_touserdata(gL, myindex));
@ -1028,7 +1020,6 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
}
break;
}
#endif
case ARCH_MAPHEADER:
{
mapheader_t *header = *((mapheader_t **)lua_touserdata(gL, myindex));
@ -1250,11 +1241,9 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
LUA_PushUserdata(gL, rover, META_FFLOOR);
break;
}
#ifdef ESLOPE
case ARCH_SLOPE:
LUA_PushUserdata(gL, P_SlopeById(READUINT16(save_p)), META_SLOPE);
break;
#endif
case ARCH_MAPHEADER:
LUA_PushUserdata(gL, mapheaderinfo[READUINT16(save_p)], META_MAPHEADER);
break;
@ -1423,5 +1412,3 @@ int Lua_optoption(lua_State *L, int narg,
return i;
return -1;
}
#endif // HAVE_BLUA

View file

@ -10,8 +10,6 @@
/// \file lua_script.h
/// \brief Lua scripting basics
#ifdef HAVE_BLUA
#include "m_fixed.h"
#include "doomtype.h"
#include "d_player.h"
@ -102,5 +100,3 @@ void COM_Lua_f(void);
#define INLEVEL if (gamestate != GS_LEVEL && !titlemapinaction)\
return luaL_error(L, "This can only be used in a level!");
#endif

View file

@ -11,9 +11,8 @@
/// \brief player skin structure library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h"
#include "r_things.h"
#include "r_skins.h"
#include "sounds.h"
#include "lua_script.h"
@ -358,5 +357,3 @@ int LUA_SkinLib(lua_State *L)
return 0;
}
#endif

View file

@ -11,7 +11,6 @@
/// \brief thinker library for Lua scripting
#include "doomdef.h"
#ifdef HAVE_BLUA
#include "p_local.h"
#include "lua_script.h"
#include "lua_libs.h"
@ -139,5 +138,3 @@ int LUA_ThinkerLib(lua_State *L)
lua_setglobal(L, "mobjs");
return 0;
}
#endif

View file

@ -788,7 +788,7 @@ void Command_CauseCfail_f(void)
}
#endif
#if defined(HAVE_BLUA) && defined(LUA_ALLOW_BYTECODE)
#ifdef LUA_ALLOW_BYTECODE
void Command_Dumplua_f(void)
{
if (modifiedgame)
@ -1025,13 +1025,9 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling)
if (ceiling)
{
#ifdef ESLOPE
// Truncate position to match where mapthing would be when spawned
// (this applies to every further P_GetZAt call as well)
fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->ceilingheight;
#else
fixed_t cheight = sec->ceilingheight;
#endif
if (((cheight - player->mo->z - player->mo->height)>>FRACBITS) >= (1 << (16-ZSHIFT)))
{
@ -1042,11 +1038,7 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling)
}
else
{
#ifdef ESLOPE
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight;
#else
fixed_t fheight = sec->floorheight;
#endif
if (((player->mo->z - fheight)>>FRACBITS) >= (1 << (16-ZSHIFT)))
{
CONS_Printf(M_GetText("Sorry, you're too %s to place this object (max: %d %s).\n"), M_GetText("high"),
@ -1062,9 +1054,7 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
mapthing_t *mt = mapthings;
sector_t *sec = player->mo->subsector->sector;
#ifdef HAVE_BLUA
LUA_InvalidateMapthings();
#endif
mapthings = Z_Realloc(mapthings, ++nummapthings * sizeof (*mapthings), PU_LEVEL, NULL);
@ -1095,20 +1085,12 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
mt->y = (INT16)(player->mo->y>>FRACBITS);
if (ceiling)
{
#ifdef ESLOPE
fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, mt->x << FRACBITS, mt->y << FRACBITS) : sec->ceilingheight;
#else
fixed_t cheight = sec->ceilingheight;
#endif
mt->z = (UINT16)((cheight - player->mo->z - player->mo->height)>>FRACBITS);
}
else
{
#ifdef ESLOPE
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, mt->x << FRACBITS, mt->y << FRACBITS) : sec->floorheight;
#else
fixed_t fheight = sec->floorheight;
#endif
mt->z = (UINT16)((player->mo->z - fheight)>>FRACBITS);
}
mt->angle = (INT16)(FixedInt(AngleFixed(player->mo->angle)));
@ -1354,20 +1336,12 @@ void OP_ObjectplaceMovement(player_t *player)
if (!!(mobjinfo[op_currentthing].flags & MF_SPAWNCEILING) ^ !!(cv_opflags.value & MTF_OBJECTFLIP))
{
#ifdef ESLOPE
fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->ceilingheight;
#else
fixed_t cheight = sec->ceilingheight;
#endif
op_displayflags = (UINT16)((cheight - player->mo->z - mobjinfo[op_currentthing].height)>>FRACBITS);
}
else
{
#ifdef ESLOPE
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight;
#else
fixed_t fheight = sec->floorheight;
#endif
op_displayflags = (UINT16)((player->mo->z - fheight)>>FRACBITS);
}
op_displayflags <<= ZSHIFT;

View file

@ -68,7 +68,7 @@ void Command_Toggletwod_f(void);
#ifdef _DEBUG
void Command_CauseCfail_f(void);
#endif
#if defined(HAVE_BLUA) && defined(LUA_ALLOW_BYTECODE)
#ifdef LUA_ALLOW_BYTECODE
void Command_Dumplua_f(void);
#endif

View file

@ -18,7 +18,7 @@
#include "v_video.h" // video flags
#include "g_game.h" // record info
#include "r_things.h" // numskins
#include "r_skins.h" // numskins
#include "r_draw.h" // R_GetColorByName
// Map triggers for linedef executors

View file

@ -2204,7 +2204,7 @@ menu_t OP_DataOptionsDef = DEFAULTMENUSTYLE(
menu_t OP_ScreenshotOptionsDef =
{
MN_OP_MAIN + (MN_OP_DATA << 6) + (MN_OP_SCREENSHOTS << 12),
"M_DATA",
"M_SCREEN",
sizeof (OP_ScreenshotOptionsMenu)/sizeof (menuitem_t),
&OP_DataOptionsDef,
OP_ScreenshotOptionsMenu,
@ -5074,6 +5074,17 @@ static boolean M_SetNextMapOnPlatter(void)
}
#endif
static boolean M_GametypeHasLevels(INT32 gt)
{
INT32 mapnum;
for (mapnum = 0; mapnum < NUMMAPS; mapnum++)
if (M_CanShowLevelOnPlatter(mapnum, gt))
return true;
return false;
}
static INT32 M_CountRowsToShowOnPlatter(INT32 gt)
{
INT32 mapnum = 0, prevmapnum = 0, col = 0, rows = 0;
@ -5391,7 +5402,10 @@ static void M_HandleLevelPlatter(INT32 choice)
case KEY_RIGHTARROW:
if (levellistmode == LLM_CREATESERVER && !lsrow)
{
CV_AddValue(&cv_newgametype, 1);
INT32 startinggametype = cv_newgametype.value;
do
CV_AddValue(&cv_newgametype, 1);
while (cv_newgametype.value != startinggametype && !M_GametypeHasLevels(cv_newgametype.value));
S_StartSound(NULL,sfx_menu1);
lscol = 0;
@ -5420,7 +5434,10 @@ static void M_HandleLevelPlatter(INT32 choice)
case KEY_LEFTARROW:
if (levellistmode == LLM_CREATESERVER && !lsrow)
{
CV_AddValue(&cv_newgametype, -1);
INT32 startinggametype = cv_newgametype.value;
do
CV_AddValue(&cv_newgametype, -1);
while (cv_newgametype.value != startinggametype && !M_GametypeHasLevels(cv_newgametype.value));
S_StartSound(NULL,sfx_menu1);
lscol = 0;
@ -6657,12 +6674,6 @@ static void M_HandleAddons(INT32 choice)
M_AddonExec(KEY_ENTER);
break;
case EXT_LUA:
#ifndef HAVE_BLUA
S_StartSound(NULL, sfx_lose);
M_StartMessage(va("%c%s\x80\nThis copy of SRB2 was compiled\nwithout support for .lua files.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING);
break;
#endif
/* FALLTHRU */
case EXT_SOC:
case EXT_WAD:
#ifdef USE_KART
@ -10099,13 +10110,13 @@ static void M_ReplayTimeAttack(INT32 choice)
static void M_EraseGuest(INT32 choice)
{
const char *rguest = va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value));
(void)choice;
if (FIL_FileExists(rguest))
remove(rguest);
if (currentMenu == &SP_NightsGuestReplayDef)
M_SetupNextMenu(&SP_NightsAttackDef);
else
M_SetupNextMenu(&SP_TimeAttackDef);
if (choice == 'y' || choice == KEY_ENTER)
{
if (FIL_FileExists(rguest))
remove(rguest);
}
M_SetupNextMenu(currentMenu->prevMenu->prevMenu);
Nextmap_OnChange();
M_StartMessage(M_GetText("Guest replay data erased.\n"),NULL,MM_NOTHING);
}
@ -10394,7 +10405,7 @@ static void M_DrawConnectMenu(void)
for (i = 0; i < min(serverlistcount - serverlistpage * SERVERS_PER_PAGE, SERVERS_PER_PAGE); i++)
{
INT32 slindex = i + serverlistpage * SERVERS_PER_PAGE;
UINT32 globalflags = ((serverlist[slindex].info.numberofplayer >= serverlist[slindex].info.maxplayer) ? V_TRANSLUCENT : 0)
UINT32 globalflags = (serverlist[slindex].info.refusereason ? V_TRANSLUCENT : 0)
|((itemOn == FIRSTSERVERLINE+i) ? V_YELLOWMAP : 0)|V_ALLOWLOWERCASE;
V_DrawString(currentMenu->x, S_LINEY(i), globalflags, serverlist[slindex].info.servername);

View file

@ -15,9 +15,10 @@
#ifndef __X_MENU__
#define __X_MENU__
#include "doomstat.h" // for NUMGAMETYPES
#include "d_event.h"
#include "command.h"
#include "r_things.h" // for SKINNAMESIZE
#include "r_skins.h" // for SKINNAMESIZE
#include "f_finale.h" // for ttmode_enum
//

File diff suppressed because it is too large Load diff

View file

@ -15,9 +15,7 @@
#include "doomstat.h"
#include "m_random.h"
#include "p_local.h"
#ifdef ESLOPE
#include "p_slopes.h"
#endif
#include "r_state.h"
#include "s_sound.h"
#include "z_zone.h"
@ -3178,12 +3176,10 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover)
if (R_PointInSubsector(a, b)->sector == sec)
{
mobj_t *spawned = NULL;
#ifdef ESLOPE
if (*rover->t_slope)
topz = P_GetZAt(*rover->t_slope, a, b) - (spacing>>1);
if (*rover->b_slope)
bottomz = P_GetZAt(*rover->b_slope, a, b);
#endif
for (c = topz; c > bottomz; c -= spacing)
{

View file

@ -365,10 +365,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (special->flags & (MF_ENEMY|MF_BOSS) && special->flags2 & MF2_FRET)
return;
#ifdef HAVE_BLUA
if (LUAh_TouchSpecial(special, toucher) || P_MobjWasRemoved(special))
return;
#endif
// 0 = none, 1 = elemental pierce, 2 = bubble bounce
elementalpierce = (((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (player->pflags & PF_SHIELDABILITY)
@ -1919,10 +1917,8 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour
if (!netgame)
return; // Presumably it's obvious what's happening in splitscreen.
#ifdef HAVE_BLUA
if (LUAh_HurtMsg(player, inflictor, source, damagetype))
return;
#endif
deadtarget = (player->mo->health <= 0);
@ -2395,10 +2391,8 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
target->flags2 &= ~(MF2_SKULLFLY|MF2_NIGHTSPULL);
target->health = 0; // This makes it easy to check if something's dead elsewhere.
#ifdef HAVE_BLUA
if (LUAh_MobjDeath(target, inflictor, source, damagetype) || P_MobjWasRemoved(target))
return;
#endif
// Let EVERYONE know what happened to a player! 01-29-2002 Tails
if (target->player && !target->player->spectator)
@ -3511,11 +3505,7 @@ void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source)
boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
{
player_t *player;
#ifdef HAVE_BLUA
boolean force = false;
#else
static const boolean force = false;
#endif
if (objectplacing)
return false;
@ -3533,7 +3523,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
return false;
}
#ifdef HAVE_BLUA
// Everything above here can't be forced.
if (!metalrecording)
{
@ -3545,7 +3534,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
else if (shouldForce == 2)
return false;
}
#endif
if (!force)
{
@ -3579,10 +3567,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
if (!force && target->flags2 & MF2_FRET) // Currently flashing from being hit
return false;
#ifdef HAVE_BLUA
if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype) || P_MobjWasRemoved(target))
return true;
#endif
if (target->health > 1)
target->flags2 |= MF2_FRET;
@ -3631,10 +3617,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|| (G_GametypeHasTeams() && player->ctfteam == source->player->ctfteam)))
return false; // Don't run eachother over in special stages and team games and such
}
#ifdef HAVE_BLUA
if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype))
return true;
#endif
P_NiGHTSDamage(target, source); // -5s :(
return true;
}
@ -3687,18 +3671,14 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
if (force
|| (inflictor && inflictor->flags & MF_MISSILE && inflictor->flags2 & MF2_SUPERFIRE)) // Super Sonic is stunned!
{
#ifdef HAVE_BLUA
if (!LUAh_MobjDamage(target, inflictor, source, damage, damagetype))
#endif
P_SuperDamage(player, inflictor, source, damage);
return true;
}
return false;
}
#ifdef HAVE_BLUA
else if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype))
return true;
#endif
else if (player->powers[pw_shield] || (player->bot && !ultimatemode)) //If One-Hit Shield
{
P_ShieldDamage(player, inflictor, source, damage, damagetype);

View file

@ -66,9 +66,7 @@ typedef enum
THINK_POLYOBJ,
THINK_MAIN,
THINK_MOBJ,
#ifdef ESLOPE
THINK_DYNSLOPE,
#endif
THINK_PRECIP,
NUM_THINKERLISTS
} thinklistnum_t; /**< Thinker lists. */
@ -250,7 +248,7 @@ extern jingle_t jingleinfo[NUMJINGLES];
#define JINGLEPOSTFADE 1000
void P_PlayJingle(player_t *player, jingletype_t jingletype);
boolean P_EvaluateMusicStatus(UINT16 status);
boolean P_EvaluateMusicStatus(UINT16 status, const char *musname);
void P_PlayJingleMusic(player_t *player, const char *musname, UINT16 musflags, boolean looping, UINT16 status);
//
@ -383,9 +381,7 @@ extern mobj_t *tmfloorthing, *tmhitthing, *tmthing;
extern camera_t *mapcampointer;
extern fixed_t tmx;
extern fixed_t tmy;
#ifdef ESLOPE
extern pslope_t *tmfloorslope, *tmceilingslope;
#endif
/* cphipps 2004/08/30 */
extern void P_MapStart(void);

View file

@ -27,9 +27,7 @@
#include "r_splats.h"
#ifdef ESLOPE
#include "p_slopes.h"
#endif
#include "z_zone.h"
@ -53,9 +51,7 @@ static fixed_t tmdropoffz, tmdrpoffceilz; // drop-off floor/ceiling heights
mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz is from a sector
mobj_t *tmhitthing; // the solid thing you bumped into (for collisions)
ffloor_t *tmfloorrover, *tmceilingrover;
#ifdef ESLOPE
pslope_t *tmfloorslope, *tmceilingslope;
#endif
// keep track of the line that lowers the ceiling,
// so missiles don't explode against sky hack walls
@ -262,9 +258,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
if (!vertispeed && !horizspeed)
return false;
#ifdef ESLOPE
object->standingslope = NULL; // Okay, now we know it's not going to be relevant - no launching off at silly angles for you.
#endif
if (spring->eflags & MFE_VERTICALFLIP)
vertispeed *= -1;
@ -439,9 +433,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
P_SetPlayerMobjState(object, S_PLAY_FALL);
}
#ifdef ESLOPE
object->standingslope = NULL; // And again.
#endif
final = true;
@ -491,9 +483,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
zdist = object->z - spring->z;
}
#ifdef ESLOPE
object->standingslope = NULL; // No launching off at silly angles for you.
#endif
switch (spring->type)
{
@ -756,11 +746,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->z + tmthing->height < thing->z)
return true; // underneath
#ifdef HAVE_BLUA
// REX HAS SEEN YOU
if (!LUAh_SeenPlayer(tmthing->target->player, thing->player))
return false;
#endif
seenplayer = thing->player;
return false;
@ -948,7 +936,6 @@ static boolean PIT_CheckThing(mobj_t *thing)
return true; // the line doesn't cross between either pair of opposite corners
}
#ifdef HAVE_BLUA
{
UINT8 shouldCollide = LUAh_MobjCollide(thing, tmthing); // checks hook for thing's type
if (P_MobjWasRemoved(tmthing) || P_MobjWasRemoved(thing))
@ -957,9 +944,8 @@ static boolean PIT_CheckThing(mobj_t *thing)
return false; // force collide
else if (shouldCollide == 2)
return true; // force no collide
}
{
UINT8 shouldCollide = LUAh_MobjMoveCollide(tmthing, thing); // checks hook for tmthing's type
shouldCollide = LUAh_MobjMoveCollide(tmthing, thing); // checks hook for tmthing's type
if (P_MobjWasRemoved(tmthing) || P_MobjWasRemoved(thing))
return true; // one of them was removed???
if (shouldCollide == 1)
@ -967,7 +953,6 @@ static boolean PIT_CheckThing(mobj_t *thing)
else if (shouldCollide == 2)
return true; // force no collide
}
#endif
if (tmthing->type == MT_LAVAFALL_LAVA && (thing->type == MT_RING || thing->type == MT_REDTEAMRING || thing->type == MT_BLUETEAMRING || thing->type == MT_FLINGRING))
{
@ -1741,9 +1726,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
{
tmfloorz = thing->z + thing->height;
tmfloorrover = NULL;
#ifdef ESLOPE
tmfloorslope = NULL;
#endif
}
return true;
}
@ -1762,18 +1745,14 @@ static boolean PIT_CheckThing(mobj_t *thing)
tmfloorz = tmceilingz = topz; // block while in air
tmceilingrover = NULL;
#ifdef ESLOPE
tmceilingslope = NULL;
#endif
tmfloorthing = thing; // needed for side collision
}
else if (topz < tmceilingz && tmthing->z <= thing->z+thing->height)
{
tmceilingz = topz;
tmceilingrover = NULL;
#ifdef ESLOPE
tmceilingslope = NULL;
#endif
tmfloorthing = thing; // thing we may stand on
}
}
@ -1788,9 +1767,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
{
tmceilingz = thing->z;
tmceilingrover = NULL;
#ifdef ESLOPE
tmceilingslope = NULL;
#endif
}
return true;
}
@ -1809,18 +1786,14 @@ static boolean PIT_CheckThing(mobj_t *thing)
tmfloorz = tmceilingz = topz; // block while in air
tmfloorrover = NULL;
#ifdef ESLOPE
tmfloorslope = NULL;
#endif
tmfloorthing = thing; // needed for side collision
}
else if (topz > tmfloorz && tmthing->z+tmthing->height >= thing->z)
{
tmfloorz = topz;
tmfloorrover = NULL;
#ifdef ESLOPE
tmfloorslope = NULL;
#endif
tmfloorthing = thing; // thing we may stand on
}
}
@ -1946,7 +1919,6 @@ static boolean PIT_CheckLine(line_t *ld)
// this line is out of the if so upper and lower textures can be hit by a splat
blockingline = ld;
#ifdef HAVE_BLUA
{
UINT8 shouldCollide = LUAh_MobjLineCollide(tmthing, blockingline); // checks hook for thing's type
if (P_MobjWasRemoved(tmthing))
@ -1956,7 +1928,6 @@ static boolean PIT_CheckLine(line_t *ld)
else if (shouldCollide == 2)
return true; // force no collide
}
#endif
if (!ld->backsector) // one sided line
{
@ -1983,18 +1954,14 @@ static boolean PIT_CheckLine(line_t *ld)
tmceilingz = opentop;
ceilingline = ld;
tmceilingrover = openceilingrover;
#ifdef ESLOPE
tmceilingslope = opentopslope;
#endif
}
if (openbottom > tmfloorz)
{
tmfloorz = openbottom;
tmfloorrover = openfloorrover;
#ifdef ESLOPE
tmfloorslope = openbottomslope;
#endif
}
if (highceiling > tmdrpoffceilz)
@ -2075,10 +2042,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->ceilingheight;
tmfloorrover = NULL;
tmceilingrover = NULL;
#ifdef ESLOPE
tmfloorslope = newsubsec->sector->f_slope;
tmceilingslope = newsubsec->sector->c_slope;
#endif
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
if (newsubsec->sector->ffloors)
@ -2119,9 +2084,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
if (tmfloorz < topheight - sinklevel) {
tmfloorz = topheight - sinklevel;
tmfloorrover = rover;
#ifdef ESLOPE
tmfloorslope = *rover->t_slope;
#endif
}
}
else if (thing->eflags & MFE_VERTICALFLIP && thingtop <= bottomheight + sinklevel && thing->momz >= 0)
@ -2129,9 +2092,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
if (tmceilingz > bottomheight + sinklevel) {
tmceilingz = bottomheight + sinklevel;
tmceilingrover = rover;
#ifdef ESLOPE
tmceilingslope = *rover->b_slope;
#endif
}
}
}
@ -2154,9 +2115,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
if (tmfloorz < thing->z) {
tmfloorz = thing->z;
tmfloorrover = rover;
#ifdef ESLOPE
tmfloorslope = NULL;
#endif
}
}
// Quicksand blocks never change heights otherwise.
@ -2173,9 +2132,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
{
tmfloorz = tmdropoffz = topheight;
tmfloorrover = rover;
#ifdef ESLOPE
tmfloorslope = *rover->t_slope;
#endif
}
if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2)
&& !(rover->flags & FF_PLATFORM)
@ -2183,9 +2140,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
{
tmceilingz = tmdrpoffceilz = bottomheight;
tmceilingrover = rover;
#ifdef ESLOPE
tmceilingslope = *rover->b_slope;
#endif
}
}
}
@ -2260,17 +2215,13 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
if (polytop > tmfloorz && abs(delta1) < abs(delta2)) {
tmfloorz = tmdropoffz = polytop;
#ifdef ESLOPE
tmfloorslope = NULL;
#endif
tmfloorrover = NULL;
}
if (polybottom < tmceilingz && abs(delta1) >= abs(delta2)) {
tmceilingz = tmdrpoffceilz = polybottom;
#ifdef ESLOPE
tmceilingslope = NULL;
#endif
tmceilingrover = NULL;
}
}
@ -2671,10 +2622,8 @@ boolean PIT_PushableMoved(mobj_t *thing)
line_t *oldblockline = blockingline;
ffloor_t *oldflrrover = tmfloorrover;
ffloor_t *oldceilrover = tmceilingrover;
#ifdef ESLOPE
pslope_t *oldfslope = tmfloorslope;
pslope_t *oldcslope = tmceilingslope;
#endif
// Move the player
P_TryMove(thing, thing->x+stand->momx, thing->y+stand->momy, true);
@ -2689,10 +2638,8 @@ boolean PIT_PushableMoved(mobj_t *thing)
blockingline = oldblockline;
tmfloorrover = oldflrrover;
tmceilingrover = oldceilrover;
#ifdef ESLOPE
tmfloorslope = oldfslope;
tmceilingslope = oldcslope;
#endif
thing->momz = stand->momz;
}
else
@ -2714,9 +2661,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
fixed_t tryy = thing->y;
fixed_t radius = thing->radius;
fixed_t thingtop = thing->z + thing->height;
#ifdef ESLOPE
fixed_t startingonground = P_IsObjectOnGround(thing);
#endif
floatok = false;
if (radius < MAXRADIUS/2)
@ -2802,14 +2747,12 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
thing->ceilingrover = tmceilingrover;
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
}
#ifdef ESLOPE
else if (tmceilingz < thingtop && thingtop - tmceilingz <= maxstep)
{
thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height;
thing->ceilingrover = tmceilingrover;
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
}
#endif
}
else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->z - tmfloorz <= maxstep)
{
@ -2817,14 +2760,12 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
thing->floorrover = tmfloorrover;
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
}
#ifdef ESLOPE
else if (tmfloorz > thing->z && tmfloorz - thing->z <= maxstep)
{
thing->z = thing->floorz = tmfloorz;
thing->floorrover = tmfloorrover;
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
}
#endif
}
if (thing->eflags & MFE_VERTICALFLIP)
@ -2888,7 +2829,6 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
thing->floorrover = tmfloorrover;
thing->ceilingrover = tmceilingrover;
#ifdef ESLOPE
if (!(thing->flags & MF_NOCLIPHEIGHT))
{
// Assign thing's standingslope if needed
@ -2909,7 +2849,6 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
}
else // don't set standingslope if you're not going to clip against it
thing->standingslope = NULL;
#endif
thing->x = x;
thing->y = y;
@ -3275,13 +3214,8 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle)
glidesector = R_PointInSubsector(player->mo->x + platx, player->mo->y + platy);
#ifdef ESLOPE
floorz = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y) : glidesector->sector->floorheight;
ceilingz = glidesector->sector->c_slope ? P_GetZAt(glidesector->sector->c_slope, player->mo->x, player->mo->y) : glidesector->sector->ceilingheight;
#else
floorz = glidesector->sector->floorheight;
ceilingz = glidesector->sector->ceilingheight;
#endif
if (glidesector->sector != player->mo->subsector->sector)
{
@ -3299,12 +3233,10 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle)
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y);
if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y);
#endif
floorclimb = true;
@ -3460,12 +3392,10 @@ isblocking:
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, slidemo->x, slidemo->y);
if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, slidemo->x, slidemo->y);
#endif
if (topheight < slidemo->z)
continue;
@ -3670,10 +3600,8 @@ static void P_CheckLavaWall(mobj_t *mo, sector_t *sec)
if (rover->master->flags & ML_BLOCKMONSTERS)
continue;
topheight =
#ifdef ESLOPE
*rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) :
#endif
topheight = *rover->t_slope ?
P_GetZAt(*rover->t_slope, mo->x, mo->y) :
*rover->topheight;
if (mo->eflags & MFE_VERTICALFLIP)
@ -3687,10 +3615,8 @@ static void P_CheckLavaWall(mobj_t *mo, sector_t *sec)
continue;
}
bottomheight =
#ifdef ESLOPE
*rover->b_slope ? P_GetZAt(*rover->b_slope, mo->x, mo->y) :
#endif
bottomheight = *rover->b_slope ?
P_GetZAt(*rover->b_slope, mo->x, mo->y) :
*rover->bottomheight;
if (mo->eflags & MFE_VERTICALFLIP)
@ -4278,12 +4204,10 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
/*#ifdef ESLOPE
if (rover->t_slope)
/*if (rover->t_slope)
topheight = P_GetZAt(rover->t_slope, thing->x, thing->y);
if (rover->b_slope)
bottomheight = P_GetZAt(rover->b_slope, thing->x, thing->y);
#endif*/
bottomheight = P_GetZAt(rover->b_slope, thing->x, thing->y);*/
delta1 = thing->z - (bottomheight + topheight)/2;
delta2 = thingtop - (bottomheight + topheight)/2;
@ -5064,10 +4988,8 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
sector_t *sec = R_PointInSubsector(x, y)->sector;
fixed_t floorz = sec->floorheight;
#ifdef ESLOPE
if (sec->f_slope)
floorz = P_GetZAt(sec->f_slope, x, y);
#endif
// Intercept the stupid 'fall through 3dfloors' bug Tails 03-17-2002
if (sec->ffloors)
@ -5087,12 +5009,10 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, x, y);
if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, x, y);
#endif
if (rover->flags & FF_QUICKSAND)
{

View file

@ -277,9 +277,7 @@ fixed_t P_InterceptVector(divline_t *v2, divline_t *v1)
// OPTIMIZE: keep this precalculated
//
fixed_t opentop, openbottom, openrange, lowfloor, highceiling;
#ifdef ESLOPE
pslope_t *opentopslope, *openbottomslope;
#endif
ffloor_t *openfloorrover, *openceilingrover;
// P_CameraLineOpening
@ -307,24 +305,20 @@ void P_CameraLineOpening(line_t *linedef)
{
frontfloor = sectors[front->camsec].floorheight;
frontceiling = sectors[front->camsec].ceilingheight;
#ifdef ESLOPE
if (sectors[front->camsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
frontfloor = P_GetZAt(sectors[front->camsec].f_slope, camera.x, camera.y);
if (sectors[front->camsec].c_slope)
frontceiling = P_GetZAt(sectors[front->camsec].c_slope, camera.x, camera.y);
#endif
}
else if (front->heightsec >= 0)
{
frontfloor = sectors[front->heightsec].floorheight;
frontceiling = sectors[front->heightsec].ceilingheight;
#ifdef ESLOPE
if (sectors[front->heightsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
frontfloor = P_GetZAt(sectors[front->heightsec].f_slope, camera.x, camera.y);
if (sectors[front->heightsec].c_slope)
frontceiling = P_GetZAt(sectors[front->heightsec].c_slope, camera.x, camera.y);
#endif
}
else
{
@ -335,23 +329,19 @@ void P_CameraLineOpening(line_t *linedef)
{
backfloor = sectors[back->camsec].floorheight;
backceiling = sectors[back->camsec].ceilingheight;
#ifdef ESLOPE
if (sectors[back->camsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
frontfloor = P_GetZAt(sectors[back->camsec].f_slope, camera.x, camera.y);
if (sectors[back->camsec].c_slope)
frontceiling = P_GetZAt(sectors[back->camsec].c_slope, camera.x, camera.y);
#endif
}
else if (back->heightsec >= 0)
{
backfloor = sectors[back->heightsec].floorheight;
backceiling = sectors[back->heightsec].ceilingheight;
#ifdef ESLOPE
if (sectors[back->heightsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
frontfloor = P_GetZAt(sectors[back->heightsec].f_slope, camera.x, camera.y);
if (sectors[back->heightsec].c_slope)
frontceiling = P_GetZAt(sectors[back->heightsec].c_slope, camera.x, camera.y);
#endif
}
else
{
@ -469,9 +459,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
openbottom = INT32_MIN;
highceiling = INT32_MIN;
lowfloor = INT32_MAX;
#ifdef ESLOPE
opentopslope = openbottomslope = NULL;
#endif
}
else
#endif
@ -485,17 +473,13 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{
opentop = frontheight;
highceiling = backheight;
#ifdef ESLOPE
opentopslope = front->c_slope;
#endif
}
else
{
opentop = backheight;
highceiling = frontheight;
#ifdef ESLOPE
opentopslope = back->c_slope;
#endif
}
frontheight = P_GetFloorZ(mobj, front, tmx, tmy, linedef);
@ -505,17 +489,13 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{
openbottom = frontheight;
lowfloor = backheight;
#ifdef ESLOPE
openbottomslope = front->f_slope;
#endif
}
else
{
openbottom = backheight;
lowfloor = frontheight;
#ifdef ESLOPE
openbottomslope = back->f_slope;
#endif
}
}
@ -647,9 +627,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{
if (bottomheight < opentop) {
opentop = bottomheight;
#ifdef ESLOPE
opentopslope = *rover->b_slope;
#endif
openceilingrover = rover;
}
else if (bottomheight < highceiling)
@ -660,9 +638,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{
if (topheight > openbottom) {
openbottom = topheight;
#ifdef ESLOPE
openbottomslope = *rover->t_slope;
#endif
openfloorrover = rover;
}
else if (topheight > lowfloor)
@ -693,9 +669,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{
if (bottomheight < opentop) {
opentop = bottomheight;
#ifdef ESLOPE
opentopslope = *rover->b_slope;
#endif
openceilingrover = rover;
}
else if (bottomheight < highceiling)
@ -706,9 +680,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{
if (topheight > openbottom) {
openbottom = topheight;
#ifdef ESLOPE
openbottomslope = *rover->t_slope;
#endif
openfloorrover = rover;
}
else if (topheight > lowfloor)

View file

@ -55,9 +55,7 @@ void P_CreatePrecipSecNodeList(precipmobj_t *thing, fixed_t x,fixed_t y);
boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y);
extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling;
#ifdef ESLOPE
extern pslope_t *opentopslope, *openbottomslope;
#endif
extern ffloor_t *openfloorrover, *openceilingrover;
void P_LineOpening(line_t *plinedef, mobj_t *mobj);

View file

@ -19,7 +19,7 @@
#include "p_local.h"
#include "p_setup.h"
#include "r_main.h"
#include "r_things.h"
#include "r_skins.h"
#include "r_sky.h"
#include "r_splats.h"
#include "s_sound.h"
@ -31,9 +31,7 @@
#include "i_video.h"
#include "lua_hook.h"
#include "b_bot.h"
#ifdef ESLOPE
#include "p_slopes.h"
#endif
#include "f_finale.h"
#include "m_cond.h"
@ -62,9 +60,7 @@ void P_RunCachedActions(void)
{
var1 = states[ac->statenum].var1;
var2 = states[ac->statenum].var2;
#ifdef HAVE_BLUA
astate = &states[ac->statenum];
#endif
if (ac->mobj && !P_MobjWasRemoved(ac->mobj)) // just in case...
states[ac->statenum].action.acp1(ac->mobj);
next = ac->next;
@ -459,9 +455,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
{
var1 = st->var1;
var2 = st->var2;
#ifdef HAVE_BLUA
astate = st;
#endif
st->action.acp1(mobj);
// woah. a player was removed by an action.
@ -585,9 +579,7 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
{
var1 = st->var1;
var2 = st->var2;
#ifdef HAVE_BLUA
astate = st;
#endif
st->action.acp1(mobj);
if (P_MobjWasRemoved(mobj))
return false;
@ -937,12 +929,10 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover)
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y);
#endif
if (mobj->z > topheight)
return false;
@ -953,7 +943,6 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover)
return true;
}
#ifdef ESLOPE
// P_GetFloorZ (and its ceiling counterpart)
// Gets the floor height (or ceiling height) of the mobj's contact point in sector, assuming object's center if moved to [x, y]
// If line is supplied, it's a divider line on the sector. Set it to NULL if you're not checking for collision with a line
@ -1057,15 +1046,12 @@ static fixed_t HighestOnLine(fixed_t radius, fixed_t x, fixed_t y, line_t *line,
P_GetZAt(slope, v2.x, v2.y)
);
}
#endif
fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
{
#ifdef ESLOPE
I_Assert(mobj != NULL);
#endif
I_Assert(sector != NULL);
#ifdef ESLOPE
if (sector->f_slope) {
fixed_t testx, testy;
pslope_t *slope = sector->f_slope;
@ -1135,25 +1121,14 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
} else // Well, that makes it easy. Just get the floor height
#else
(void)mobj;
(void)boundsec;
(void)x;
(void)y;
(void)line;
(void)lowest;
(void)perfect;
#endif
return sector->floorheight;
}
fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
{
#ifdef ESLOPE
I_Assert(mobj != NULL);
#endif
I_Assert(sector != NULL);
#ifdef ESLOPE
if (sector->c_slope) {
fixed_t testx, testy;
pslope_t *slope = sector->c_slope;
@ -1223,26 +1198,15 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
} else // Well, that makes it easy. Just get the ceiling height
#else
(void)mobj;
(void)boundsec;
(void)x;
(void)y;
(void)line;
(void)lowest;
(void)perfect;
#endif
return sector->ceilingheight;
}
// Now do the same as all above, but for cameras because apparently cameras are special?
fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
{
#ifdef ESLOPE
I_Assert(mobj != NULL);
#endif
I_Assert(sector != NULL);
#ifdef ESLOPE
if (sector->f_slope) {
fixed_t testx, testy;
pslope_t *slope = sector->f_slope;
@ -1312,25 +1276,14 @@ fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fix
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
} else // Well, that makes it easy. Just get the floor height
#else
(void)mobj;
(void)boundsec;
(void)x;
(void)y;
(void)line;
(void)lowest;
(void)perfect;
#endif
return sector->floorheight;
}
fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
{
#ifdef ESLOPE
I_Assert(mobj != NULL);
#endif
I_Assert(sector != NULL);
#ifdef ESLOPE
if (sector->c_slope) {
fixed_t testx, testy;
pslope_t *slope = sector->c_slope;
@ -1400,15 +1353,6 @@ fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, f
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
} else // Well, that makes it easy. Just get the ceiling height
#else
(void)mobj;
(void)boundsec;
(void)x;
(void)y;
(void)line;
(void)lowest;
(void)perfect;
#endif
return sector->ceilingheight;
}
static void P_PlayerFlip(mobj_t *mo)
@ -1680,10 +1624,7 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
else if (abs(player->rmomx) < FixedMul(STOPSPEED, mo->scale)
&& abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale)
&& (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove && !(player->pflags & PF_SPINNING))
#ifdef ESLOPE
&& !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2))
#endif
)
&& !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2)))
{
// if in a walking frame, stop moving
if (player->panim == PA_WALK)
@ -1830,11 +1771,9 @@ void P_XYMovement(mobj_t *mo)
fixed_t xmove, ymove;
fixed_t oldx, oldy; // reducing bobbing/momentum on ice when up against walls
boolean moved;
#ifdef ESLOPE
pslope_t *oldslope = NULL;
vector3_t slopemom;
fixed_t predictedz = 0;
#endif
I_Assert(mo != NULL);
I_Assert(!P_MobjWasRemoved(mo));
@ -1864,7 +1803,6 @@ void P_XYMovement(mobj_t *mo)
oldx = mo->x;
oldy = mo->y;
#ifdef ESLOPE
if (mo->flags & MF_NOCLIPHEIGHT)
mo->standingslope = NULL;
@ -1889,7 +1827,6 @@ void P_XYMovement(mobj_t *mo)
}
} else if (P_IsObjectOnGround(mo) && !mo->momz)
predictedz = mo->z;
#endif
// Pushables can break some blocks
if (CheckForBustableBlocks && ((mo->flags & MF_PUSHABLE) || ((mo->info->flags & MF_PUSHABLE) && mo->fuse)))
@ -1906,15 +1843,12 @@ void P_XYMovement(mobj_t *mo)
B_MoveBlocked(player);
}
#ifdef HAVE_BLUA
if (LUAh_MobjMoveBlocked(mo))
{
if (P_MobjWasRemoved(mo))
return;
}
else
#endif
if (P_MobjWasRemoved(mo))
else if (P_MobjWasRemoved(mo))
return;
else if (mo->flags & MF_BOUNCE)
{
@ -1965,7 +1899,6 @@ void P_XYMovement(mobj_t *mo)
}
else if (player || mo->flags & (MF_SLIDEME|MF_PUSHABLE))
{ // try to slide along it
#ifdef ESLOPE
// Wall transfer part 1.
pslope_t *transferslope = NULL;
fixed_t transfermomz = 0;
@ -1975,14 +1908,12 @@ void P_XYMovement(mobj_t *mo)
if (((transferslope->zangle < ANGLE_180) ? transferslope->zangle : InvAngle(transferslope->zangle)) >= ANGLE_45) // Prevent some weird stuff going on on shallow slopes.
transfermomz = P_GetWallTransferMomZ(mo, transferslope);
}
#endif
P_SlideMove(mo);
if (player)
player->powers[pw_pushing] = 3;
xmove = ymove = 0;
#ifdef ESLOPE
// Wall transfer part 2.
if (transfermomz && transferslope) // Are we "transferring onto the wall" (really just a disguised vertical launch)?
{
@ -2005,7 +1936,6 @@ void P_XYMovement(mobj_t *mo)
}
}
}
#endif
}
else if (mo->type == MT_SPINFIRE)
{
@ -2061,7 +1991,6 @@ void P_XYMovement(mobj_t *mo)
if (P_MobjWasRemoved(mo)) // MF_SPECIAL touched a player! O_o;;
return;
#ifdef ESLOPE
if (moved && oldslope && !(mo->flags & MF_NOCLIPHEIGHT)) { // Check to see if we ran off
if (oldslope != mo->standingslope) { // First, compare different slopes
@ -2107,7 +2036,6 @@ void P_XYMovement(mobj_t *mo)
//CONS_Printf("Launched off of flat surface running into downward slope\n");
}
}
#endif
// Check the gravity status.
P_CheckGravity(mo, false);
@ -2158,11 +2086,9 @@ void P_XYMovement(mobj_t *mo)
if (player && player->powers[pw_carry] == CR_NIGHTSMODE)
return; // no friction for NiGHTS players
#ifdef ESLOPE
if ((mo->type == MT_BIGTUMBLEWEED || mo->type == MT_LITTLETUMBLEWEED)
&& (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8)) // Special exception for tumbleweeds on slopes
return;
#endif
if (((!(mo->eflags & MFE_VERTICALFLIP) && mo->z > mo->floorz) || (mo->eflags & MFE_VERTICALFLIP && mo->z+mo->height < mo->ceilingz))
&& !(player && player->pflags & PF_SLIDING))
@ -2430,7 +2356,6 @@ static boolean P_ZMovement(mobj_t *mo)
mo->z += mo->momz;
onground = P_IsObjectOnGround(mo);
#ifdef ESLOPE
if (mo->standingslope)
{
if (mo->flags & MF_NOCLIPHEIGHT)
@ -2438,7 +2363,6 @@ static boolean P_ZMovement(mobj_t *mo)
else if (!onground)
P_SlopeLaunch(mo);
}
#endif
switch (mo->type)
{
@ -2640,7 +2564,6 @@ static boolean P_ZMovement(mobj_t *mo)
else
mo->z = mo->floorz;
#ifdef ESLOPE
if (!(mo->flags & MF_MISSILE) && mo->standingslope) // You're still on the ground; why are we here?
{
mo->momz = 0;
@ -2653,7 +2576,6 @@ static boolean P_ZMovement(mobj_t *mo)
mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope;
P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope);
}
#endif
// hit the floor
if (mo->type == MT_FIREBALL) // special case for the fireball
@ -2753,13 +2675,11 @@ static boolean P_ZMovement(mobj_t *mo)
else
mom.y -= FixedMul(6*FRACUNIT, mo->scale);
}
#ifdef ESLOPE
else if (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8)
{
// Pop the object up a bit to encourage bounciness
//mom.z = P_MobjFlip(mo)*mo->scale;
}
#endif
else
{
mom.x = mom.y = mom.z = 0;
@ -2799,11 +2719,9 @@ static boolean P_ZMovement(mobj_t *mo)
else if (tmfloorthing)
mom.z = tmfloorthing->momz;
#ifdef ESLOPE
if (mo->standingslope) { // MT_STEAM will never have a standingslope, see above.
P_QuantizeMomentumToSlope(&mom, mo->standingslope);
}
#endif
mo->momx = mom.x;
mo->momy = mom.y;
@ -2925,7 +2843,6 @@ static void P_PlayerZMovement(mobj_t *mo)
|| mo->player->playerstate == PST_REBORN)
return;
#ifdef ESLOPE
if (mo->standingslope)
{
if (mo->flags & MF_NOCLIPHEIGHT)
@ -2933,7 +2850,6 @@ static void P_PlayerZMovement(mobj_t *mo)
else if (!onground)
P_SlopeLaunch(mo);
}
#endif
// clip movement
if (onground && !(mo->flags & MF_NOCLIPHEIGHT))
@ -2961,12 +2877,10 @@ static void P_PlayerZMovement(mobj_t *mo)
if (mo->player->panim == PA_PAIN)
P_SetPlayerMobjState(mo, S_PLAY_WALK);
#ifdef ESLOPE
if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)) {
// Handle landing on slope during Z movement
P_HandleSlopeLanding(mo, (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope));
}
#endif
if (P_MobjFlip(mo)*mo->momz < 0) // falling
{
@ -3299,10 +3213,8 @@ static boolean P_SceneryZMovement(mobj_t *mo)
//
boolean P_CanRunOnWater(player_t *player, ffloor_t *rover)
{
fixed_t topheight =
#ifdef ESLOPE
*rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) :
#endif
fixed_t topheight = *rover->t_slope ?
P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) :
*rover->topheight;
if (!player->powers[pw_carry] && !player->homing
@ -3349,13 +3261,11 @@ void P_MobjCheckWater(mobj_t *mobj)
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y);
#endif
if (mobj->eflags & MFE_VERTICALFLIP)
{
@ -3605,13 +3515,11 @@ static void P_SceneryCheckWater(mobj_t *mobj)
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y);
#endif
if (topheight <= mobj->z
|| bottomheight > (mobj->z + (mobj->height>>1)))
@ -3656,14 +3564,12 @@ static boolean P_CameraCheckHeat(camera_t *thiscam)
if (!(rover->flags & FF_EXISTS))
continue;
if (halfheight >= (
#ifdef ESLOPE
*rover->t_slope ? P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) :
#endif
*rover->topheight) || halfheight <= (
#ifdef ESLOPE
*rover->b_slope ? P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) :
#endif
if (halfheight >= (*rover->t_slope ?
P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) :
*rover->topheight))
continue;
if (halfheight <= (*rover->b_slope ?
P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) :
*rover->bottomheight))
continue;
@ -3692,14 +3598,12 @@ static boolean P_CameraCheckWater(camera_t *thiscam)
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKOTHERS)
continue;
if (halfheight >= (
#ifdef ESLOPE
*rover->t_slope ? P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) :
#endif
*rover->topheight) || halfheight <= (
#ifdef ESLOPE
if (halfheight >= (*rover->t_slope ?
P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) :
*rover->topheight))
continue;
if (halfheight <= (
*rover->b_slope ? P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) :
#endif
*rover->bottomheight))
continue;
@ -3889,9 +3793,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
P_MobjCheckWater(mobj);
#ifdef ESLOPE
P_ButteredSlope(mobj);
#endif
// momentum movement
mobj->eflags &= ~MFE_JUSTSTEPPEDDOWN;
@ -4050,10 +3952,8 @@ static void CalculatePrecipFloor(precipmobj_t *mobj)
mobjsecsubsec = mobj->subsector->sector;
else
return;
mobj->floorz =
#ifdef ESLOPE
mobjsecsubsec->f_slope ? P_GetZAt(mobjsecsubsec->f_slope, mobj->x, mobj->y) :
#endif
mobj->floorz = mobjsecsubsec->f_slope ?
P_GetZAt(mobjsecsubsec->f_slope, mobj->x, mobj->y) :
mobjsecsubsec->floorheight;
if (mobjsecsubsec->ffloors)
{
@ -4069,12 +3969,10 @@ static void CalculatePrecipFloor(precipmobj_t *mobj)
if (!(rover->flags & FF_BLOCKOTHERS) && !(rover->flags & FF_SWIMMABLE))
continue;
#ifdef ESLOPE
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
else
#endif
topheight = *rover->topheight;
topheight = *rover->topheight;
if (topheight > mobj->floorz)
mobj->floorz = topheight;
@ -7643,12 +7541,10 @@ static void P_RosySceneryThink(mobj_t *mobj)
static void P_MobjSceneryThink(mobj_t *mobj)
{
#ifdef HAVE_BLUA
if (LUAh_MobjThinker(mobj))
return;
if (P_MobjWasRemoved(mobj))
return;
#endif
if ((mobj->flags2 & MF2_SHIELD) && !P_AddShield(mobj))
return;
@ -7993,9 +7889,7 @@ static void P_MobjSceneryThink(mobj_t *mobj)
if (!mobj->fuse)
{
#ifdef HAVE_BLUA
if (!LUAh_MobjFuse(mobj))
#endif
P_RemoveMobj(mobj);
return;
}
@ -8054,9 +7948,7 @@ static void P_MobjSceneryThink(mobj_t *mobj)
mobj->fuse--;
if (!mobj->fuse)
{
#ifdef HAVE_BLUA
if (!LUAh_MobjFuse(mobj))
#endif
P_RemoveMobj(mobj);
return;
}
@ -8085,7 +7977,6 @@ static boolean P_MobjPushableThink(mobj_t *mobj)
static boolean P_MobjBossThink(mobj_t *mobj)
{
#ifdef HAVE_BLUA
if (LUAh_BossThinker(mobj))
{
if (P_MobjWasRemoved(mobj))
@ -8094,7 +7985,6 @@ static boolean P_MobjBossThink(mobj_t *mobj)
else if (P_MobjWasRemoved(mobj))
return false;
else
#endif
switch (mobj->type)
{
case MT_EGGMOBILE:
@ -9393,8 +9283,11 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
if (mobj->tracer && mobj->tracer->player && mobj->tracer->health > 0
&& P_AproxDistance(P_AproxDistance(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y), mobj->tracer->z - mobj->z) <= mobj->radius*16)
{
var1 = mobj->info->speed;
var2 = 1;
// Home in on the target.
P_HomingAttack(mobj, mobj->tracer);
A_HomingChase(mobj);
if (mobj->z < mobj->floorz)
mobj->z = mobj->floorz;
@ -10004,113 +9897,110 @@ static boolean P_FuseThink(mobj_t *mobj)
if (mobj->fuse)
return true;
#ifdef HAVE_BLUA
if (LUAh_MobjFuse(mobj) || P_MobjWasRemoved(mobj))
;
else
#endif
if (mobj->info->flags & MF_MONITOR)
else if (mobj->info->flags & MF_MONITOR)
{
P_MonitorFuseThink(mobj);
return false;
}
else switch (mobj->type)
{
// gargoyle and snowman handled in P_PushableThinker, not here
case MT_THROWNGRENADE:
case MT_CYBRAKDEMON_NAPALM_BOMB_LARGE:
P_SetMobjState(mobj, mobj->info->deathstate);
break;
case MT_LHRT:
P_KillMobj(mobj, NULL, NULL, 0);
break;
case MT_BLUEFLAG:
case MT_REDFLAG:
P_FlagFuseThink(mobj);
P_RemoveMobj(mobj);
return false;
case MT_FANG:
if (mobj->flags2 & MF2_SLIDEPUSH)
{
P_MonitorFuseThink(mobj);
var1 = 0;
var2 = 0;
A_BossDeath(mobj);
return false;
}
else switch (mobj->type)
P_SetMobjState(mobj, mobj->state->nextstate);
if (P_MobjWasRemoved(mobj))
return false;
break;
case MT_METALSONIC_BATTLE:
break; // don't remove
case MT_SPIKE:
P_SetMobjState(mobj, mobj->state->nextstate);
mobj->fuse = mobj->info->speed;
if (mobj->spawnpoint)
mobj->fuse += mobj->spawnpoint->angle;
break;
case MT_WALLSPIKE:
P_SetMobjState(mobj, mobj->state->nextstate);
mobj->fuse = mobj->info->speed;
if (mobj->spawnpoint)
mobj->fuse += (mobj->spawnpoint->angle / 360);
break;
case MT_NIGHTSCORE:
P_RemoveMobj(mobj);
return false;
case MT_LAVAFALL:
if (mobj->state - states == S_LAVAFALL_DORMANT)
{
// gargoyle and snowman handled in P_PushableThinker, not here
case MT_THROWNGRENADE:
case MT_CYBRAKDEMON_NAPALM_BOMB_LARGE:
P_SetMobjState(mobj, mobj->info->deathstate);
mobj->fuse = 30;
P_SetMobjState(mobj, S_LAVAFALL_TELL);
S_StartSound(mobj, mobj->info->seesound);
}
else if (mobj->state - states == S_LAVAFALL_TELL)
{
mobj->fuse = 40;
P_SetMobjState(mobj, S_LAVAFALL_SHOOT);
S_StopSound(mobj);
S_StartSound(mobj, mobj->info->attacksound);
}
else
{
mobj->fuse = 30;
P_SetMobjState(mobj, S_LAVAFALL_DORMANT);
S_StopSound(mobj);
}
return false;
case MT_PYREFLY:
if (mobj->health <= 0)
break;
case MT_LHRT:
P_KillMobj(mobj, NULL, NULL, 0);
break;
case MT_BLUEFLAG:
case MT_REDFLAG:
P_FlagFuseThink(mobj);
P_RemoveMobj(mobj);
return false;
case MT_FANG:
if (mobj->flags2 & MF2_SLIDEPUSH)
{
var1 = 0;
var2 = 0;
A_BossDeath(mobj);
return false;
}
P_SetMobjState(mobj, mobj->state->nextstate);
if (P_MobjWasRemoved(mobj))
return false;
break;
case MT_METALSONIC_BATTLE:
break; // don't remove
case MT_SPIKE:
P_SetMobjState(mobj, mobj->state->nextstate);
mobj->fuse = mobj->info->speed;
if (mobj->spawnpoint)
mobj->fuse += mobj->spawnpoint->angle;
break;
case MT_WALLSPIKE:
P_SetMobjState(mobj, mobj->state->nextstate);
mobj->fuse = mobj->info->speed;
if (mobj->spawnpoint)
mobj->fuse += (mobj->spawnpoint->angle / 360);
break;
case MT_NIGHTSCORE:
P_RemoveMobj(mobj);
return false;
case MT_LAVAFALL:
if (mobj->state - states == S_LAVAFALL_DORMANT)
{
mobj->fuse = 30;
P_SetMobjState(mobj, S_LAVAFALL_TELL);
S_StartSound(mobj, mobj->info->seesound);
}
else if (mobj->state - states == S_LAVAFALL_TELL)
{
mobj->fuse = 40;
P_SetMobjState(mobj, S_LAVAFALL_SHOOT);
S_StopSound(mobj);
S_StartSound(mobj, mobj->info->attacksound);
}
else
{
mobj->fuse = 30;
P_SetMobjState(mobj, S_LAVAFALL_DORMANT);
S_StopSound(mobj);
}
return false;
case MT_PYREFLY:
if (mobj->health <= 0)
break;
mobj->extravalue2 = (mobj->extravalue2 + 1) % 3;
if (mobj->extravalue2 == 0)
{
P_SetMobjState(mobj, mobj->info->spawnstate);
mobj->fuse = 100;
S_StopSound(mobj);
S_StartSound(mobj, sfx_s3k8c);
}
else if (mobj->extravalue2 == 1)
{
mobj->fuse = 50;
S_StartSound(mobj, sfx_s3ka3);
}
else
{
P_SetMobjState(mobj, mobj->info->meleestate);
mobj->fuse = 100;
S_StopSound(mobj);
S_StartSound(mobj, sfx_s3kc2l);
}
return false;
case MT_PLAYER:
break; // don't remove
default:
P_SetMobjState(mobj, mobj->info->xdeathstate); // will remove the mobj if S_NULL.
break;
// Looking for monitors? They moved to a special condition above.
mobj->extravalue2 = (mobj->extravalue2 + 1) % 3;
if (mobj->extravalue2 == 0)
{
P_SetMobjState(mobj, mobj->info->spawnstate);
mobj->fuse = 100;
S_StopSound(mobj);
S_StartSound(mobj, sfx_s3k8c);
}
else if (mobj->extravalue2 == 1)
{
mobj->fuse = 50;
S_StartSound(mobj, sfx_s3ka3);
}
else
{
P_SetMobjState(mobj, mobj->info->meleestate);
mobj->fuse = 100;
S_StopSound(mobj);
S_StartSound(mobj, sfx_s3kc2l);
}
return false;
case MT_PLAYER:
break; // don't remove
default:
P_SetMobjState(mobj, mobj->info->xdeathstate); // will remove the mobj if S_NULL.
break;
// Looking for monitors? They moved to a special condition above.
}
return !P_MobjWasRemoved(mobj);
}
@ -10179,7 +10069,6 @@ void P_MobjThinker(mobj_t *mobj)
return;
}
#ifdef HAVE_BLUA
// Check for a Lua thinker first
if (!mobj->player)
{
@ -10193,7 +10082,7 @@ void P_MobjThinker(mobj_t *mobj)
if (P_MobjWasRemoved(mobj))
return;
}
#endif
// if it's pushable, or if it would be pushable other than temporary disablement, use the
// separate thinker
if (mobj->flags & MF_PUSHABLE || (mobj->info->flags & MF_PUSHABLE && mobj->fuse))
@ -10262,7 +10151,7 @@ void P_MobjThinker(mobj_t *mobj)
mobj->eflags &= ~MFE_JUSTHITFLOOR;
}
#ifdef ESLOPE // Sliding physics for slidey mobjs!
// Sliding physics for slidey mobjs!
if (mobj->type == MT_FLINGRING
|| mobj->type == MT_FLINGCOIN
|| mobj->type == MT_FLINGBLUESPHERE
@ -10277,7 +10166,6 @@ void P_MobjThinker(mobj_t *mobj)
//if (mobj->standingslope) CONS_Printf("slope physics on mobj\n");
P_ButteredSlope(mobj);
}
#endif
if (mobj->flags & (MF_ENEMY|MF_BOSS) && mobj->health
&& P_CheckDeathPitCollide(mobj)) // extra pit check in case these didn't have momz
@ -10611,15 +10499,11 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
// Make sure scale matches destscale immediately when spawned
P_SetScale(mobj, mobj->destscale);
mobj->floorz =
#ifdef ESLOPE
mobj->subsector->sector->f_slope ? P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
#endif
mobj->floorz = mobj->subsector->sector->f_slope ?
P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
mobj->subsector->sector->floorheight;
mobj->ceilingz =
#ifdef ESLOPE
mobj->subsector->sector->c_slope ? P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
#endif
mobj->ceilingz = mobj->subsector->sector->c_slope ?
P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
mobj->subsector->sector->ceilingheight;
mobj->floorrover = NULL;
@ -10656,7 +10540,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
// Set shadowscale here, before spawn hook so that Lua can change it
mobj->shadowscale = P_DefaultMobjShadowScale(mobj);
#ifdef HAVE_BLUA
// DANGER! This can cause P_SpawnMobj to return NULL!
// Avoid using P_RemoveMobj on the newly created mobj in "MobjSpawn" Lua hooks!
if (LUAh_MobjSpawn(mobj))
@ -10667,7 +10550,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
else if (P_MobjWasRemoved(mobj))
return NULL;
else
#endif
switch (mobj->type)
{
case MT_ALTVIEWMAN:
@ -10937,9 +10819,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
{
var1 = st->var1;
var2 = st->var2;
#ifdef HAVE_BLUA
astate = st;
#endif
st->action.acp1(mobj);
// DANGER! This can cause P_SpawnMobj to return NULL!
// Avoid using MF_RUNSPAWNFUNC on mobjs whose spawn state expects target or tracer to already be set!
@ -10977,15 +10857,11 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
// set subsector and/or block links
P_SetPrecipitationThingPosition(mobj);
mobj->floorz = starting_floorz =
#ifdef ESLOPE
mobj->subsector->sector->f_slope ? P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
#endif
mobj->floorz = starting_floorz = mobj->subsector->sector->f_slope ?
P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
mobj->subsector->sector->floorheight;
mobj->ceilingz =
#ifdef ESLOPE
mobj->subsector->sector->c_slope ? P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
#endif
mobj->ceilingz = mobj->subsector->sector->c_slope ?
P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
mobj->subsector->sector->ceilingheight;
mobj->floorrover = NULL;
@ -11037,16 +10913,12 @@ size_t iquehead, iquetail;
void P_RemoveMobj(mobj_t *mobj)
{
I_Assert(mobj != NULL);
#ifdef HAVE_BLUA
if (P_MobjWasRemoved(mobj))
return; // something already removing this mobj.
mobj->thinker.function.acp1 = (actionf_p1)P_RemoveThinkerDelayed; // shh. no recursing.
LUAh_MobjRemoved(mobj);
mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker; // needed for P_UnsetThingPosition, etc. to work.
#else
I_Assert(!P_MobjWasRemoved(mobj));
#endif
// Rings only, please!
if (mobj->spawnpoint &&
@ -11625,16 +11497,12 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
// set Z height
sector = R_PointInSubsector(x, y)->sector;
floor =
#ifdef ESLOPE
sector->f_slope ? P_GetZAt(sector->f_slope, x, y) :
#endif
sector->floorheight;
ceiling =
#ifdef ESLOPE
sector->c_slope ? P_GetZAt(sector->c_slope, x, y) :
#endif
sector->ceilingheight;
floor = sector->f_slope ?
P_GetZAt(sector->f_slope, x, y) :
sector->floorheight;
ceiling = sector->c_slope ?
P_GetZAt(sector->c_slope, x, y) :
sector->ceilingheight;
ceilingspawn = ceiling - mobjinfo[MT_PLAYER].height;
if (mthing)
@ -11704,16 +11572,12 @@ void P_MovePlayerToStarpost(INT32 playernum)
P_SetThingPosition(mobj);
sector = R_PointInSubsector(mobj->x, mobj->y)->sector;
floor =
#ifdef ESLOPE
sector->f_slope ? P_GetZAt(sector->f_slope, mobj->x, mobj->y) :
#endif
sector->floorheight;
ceiling =
#ifdef ESLOPE
sector->c_slope ? P_GetZAt(sector->c_slope, mobj->x, mobj->y) :
#endif
sector->ceilingheight;
floor = sector->f_slope ?
P_GetZAt(sector->f_slope, mobj->x, mobj->y) :
sector->floorheight;
ceiling = sector->c_slope ?
P_GetZAt(sector->c_slope, mobj->x, mobj->y) :
sector->ceilingheight;
z = p->starpostz << FRACBITS;
@ -11762,17 +11626,11 @@ static fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x,
// Establish height.
if (flip)
return (
#ifdef ESLOPE
ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) :
#endif
ss->sector->ceilingheight) - offset - mobjinfo[mobjtype].height;
return (ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) : ss->sector->ceilingheight)
- offset - mobjinfo[mobjtype].height;
else
return (
#ifdef ESLOPE
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) :
#endif
ss->sector->floorheight) + offset;
return (ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) : ss->sector->floorheight)
+ offset;
}
static fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mthing, const fixed_t x, const fixed_t y)
@ -12710,7 +12568,6 @@ static boolean P_SetupBooster(mapthing_t* mthing, mobj_t* mobj, boolean strong)
static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean *doangle)
{
#ifdef HAVE_BLUA
boolean override = LUAh_MapThingSpawn(mobj, mthing);
if (P_MobjWasRemoved(mobj))
@ -12718,7 +12575,6 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
if (override)
return true;
#endif
switch (mobj->type)
{

View file

@ -370,9 +370,7 @@ typedef struct mobj_s
INT32 cusval;
INT32 cvmem;
#ifdef ESLOPE
struct pslope_s *standingslope; // The slope that the object is standing on (shouldn't need synced in savegames, right?)
#endif
boolean colorized; // Whether the mobj uses the rainbow colormap
fixed_t shadowscale; // If this object casts a shadow, and the size relative to radius

View file

@ -22,7 +22,7 @@
#include "p_setup.h"
#include "p_saveg.h"
#include "r_data.h"
#include "r_things.h"
#include "r_skins.h"
#include "r_state.h"
#include "w_wad.h"
#include "y_inter.h"
@ -31,9 +31,7 @@
#include "r_sky.h"
#include "p_polyobj.h"
#include "lua_script.h"
#ifdef ESLOPE
#include "p_slopes.h"
#endif
savedata_t savedata;
UINT8 *save_p;
@ -1252,9 +1250,7 @@ typedef enum
MD2_HPREV = 1<<8,
MD2_FLOORROVER = 1<<9,
MD2_CEILINGROVER = 1<<10,
#ifdef ESLOPE
MD2_SLOPE = 1<<11,
#endif
MD2_COLORIZED = 1<<12,
MD2_ROLLANGLE = 1<<13,
MD2_SHADOWSCALE = 1<<14,
@ -1294,10 +1290,8 @@ typedef enum
tc_fade,
tc_fadecolormap,
tc_planedisplace,
#ifdef ESLOPE
tc_dynslopeline,
tc_dynslopevert,
#endif // ESLOPE
#ifdef POLYOBJECTS
tc_polyrotate, // haleyjd 03/26/06: polyobjects
tc_polymove,
@ -1336,13 +1330,11 @@ static inline UINT32 SavePlayer(const player_t *player)
return 0xFFFFFFFF;
}
#ifdef ESLOPE
static UINT32 SaveSlope(const pslope_t *slope)
{
if (slope) return (UINT32)(slope->id);
return 0xFFFFFFFF;
}
#endif // ESLOPE
//
// SaveMobjThinker
@ -1471,10 +1463,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
diff2 |= MD2_FLOORROVER;
if (mobj->ceilingrover)
diff2 |= MD2_CEILINGROVER;
#ifdef ESLOPE
if (mobj->standingslope)
diff2 |= MD2_SLOPE;
#endif
if (mobj->colorized)
diff2 |= MD2_COLORIZED;
if (mobj->rollangle)
@ -1639,10 +1629,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
WRITEUINT32(save_p, mobj->hnext->mobjnum);
if (diff2 & MD2_HPREV)
WRITEUINT32(save_p, mobj->hprev->mobjnum);
#ifdef ESLOPE
if (diff2 & MD2_SLOPE)
WRITEUINT16(save_p, mobj->standingslope->id);
#endif
if (diff2 & MD2_COLORIZED)
WRITEUINT8(save_p, mobj->colorized);
if (diff2 & MD2_ROLLANGLE)
@ -1993,7 +1981,7 @@ static void SavePlaneDisplaceThinker(const thinker_t *th, const UINT8 type)
WRITEFIXED(save_p, ht->speed);
WRITEUINT8(save_p, ht->type);
}
#ifdef ESLOPE
/// Save a dynamic slope thinker.
static inline void SaveDynamicSlopeThinker(const thinker_t *th, const UINT8 type)
{
@ -2008,7 +1996,6 @@ static inline void SaveDynamicSlopeThinker(const thinker_t *th, const UINT8 type
WRITEMEM(save_p, ht->tags, sizeof(ht->tags));
WRITEMEM(save_p, ht->vex, sizeof(ht->vex));
}
#endif // ESLOPE
#ifdef POLYOBJECTS
@ -2391,7 +2378,6 @@ static void P_NetArchiveThinkers(void)
continue;
}
#endif
#ifdef ESLOPE
else if (th->function.acp1 == (actionf_p1)T_DynamicSlopeLine)
{
SaveDynamicSlopeThinker(th, tc_dynslopeline);
@ -2402,7 +2388,6 @@ static void P_NetArchiveThinkers(void)
SaveDynamicSlopeThinker(th, tc_dynslopevert);
continue;
}
#endif // ESLOPE
#ifdef PARANOIA
else if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed) // wait garbage collection
I_Error("unknown thinker type %p", th->function.acp1);
@ -2463,7 +2448,6 @@ static inline player_t *LoadPlayer(UINT32 player)
return &players[player];
}
#ifdef ESLOPE
static inline pslope_t *LoadSlope(UINT32 slopeid)
{
pslope_t *p = slopelist;
@ -2475,7 +2459,6 @@ static inline pslope_t *LoadSlope(UINT32 slopeid)
} while ((p = p->next));
return NULL;
}
#endif // ESLOPE
//
// LoadMobjThinker
@ -2720,10 +2703,8 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
mobj->hnext = (mobj_t *)(size_t)READUINT32(save_p);
if (diff2 & MD2_HPREV)
mobj->hprev = (mobj_t *)(size_t)READUINT32(save_p);
#ifdef ESLOPE
if (diff2 & MD2_SLOPE)
mobj->standingslope = P_SlopeById(READUINT16(save_p));
#endif
if (diff2 & MD2_COLORIZED)
mobj->colorized = READUINT8(save_p);
if (diff2 & MD2_ROLLANGLE)
@ -3183,7 +3164,6 @@ static inline thinker_t* LoadPlaneDisplaceThinker(actionf_p1 thinker)
return &ht->thinker;
}
#ifdef ESLOPE
/// Save a dynamic slope thinker.
static inline thinker_t* LoadDynamicSlopeThinker(actionf_p1 thinker)
{
@ -3198,7 +3178,6 @@ static inline thinker_t* LoadDynamicSlopeThinker(actionf_p1 thinker)
READMEM(save_p, ht->vex, sizeof(ht->vex));
return &ht->thinker;
}
#endif // ESLOPE
#ifdef POLYOBJECTS
@ -3578,7 +3557,7 @@ static void P_NetUnArchiveThinkers(void)
th = LoadPolyfadeThinker((actionf_p1)T_PolyObjFade);
break;
#endif
#ifdef ESLOPE
case tc_dynslopeline:
th = LoadDynamicSlopeThinker((actionf_p1)T_DynamicSlopeLine);
break;
@ -3586,7 +3565,6 @@ static void P_NetUnArchiveThinkers(void)
case tc_dynslopevert:
th = LoadDynamicSlopeThinker((actionf_p1)T_DynamicSlopeVert);
break;
#endif // ESLOPE
case tc_scroll:
th = LoadScrollThinker((actionf_p1)T_Scroll);
@ -4183,8 +4161,6 @@ void P_SaveGame(void)
{
P_ArchiveMisc();
P_ArchivePlayer();
// yes, even in non HAVE_BLUA
P_ArchiveLuabanksAndConsistency();
}
@ -4220,9 +4196,7 @@ void P_SaveNetGame(void)
P_NetArchiveSpecials();
P_NetArchiveColormaps();
}
#ifdef HAVE_BLUA
LUA_Archive();
#endif
P_ArchiveLuabanksAndConsistency();
}
@ -4264,9 +4238,7 @@ boolean P_LoadNetGame(void)
P_RelinkPointers();
P_FinishMobjs();
}
#ifdef HAVE_BLUA
LUA_UnArchive();
#endif
// This is stupid and hacky, but maybe it'll work!
P_SetRandSeed(P_GetInitSeed());

View file

@ -27,7 +27,7 @@
#include "i_system.h"
#include "r_data.h"
#include "r_things.h"
#include "r_things.h" // for R_AddSpriteDefs
#include "r_patch.h"
#include "r_sky.h"
#include "r_draw.h"
@ -57,9 +57,7 @@
#include "filesrch.h" // refreshdirmenu
#ifdef HAVE_BLUA
#include "lua_hud.h" // level title
#endif
#include "f_finale.h" // wipes
@ -79,9 +77,7 @@
#include "hardware/hw_model.h"
#endif
#ifdef ESLOPE
#include "p_slopes.h"
#endif
#include "fastcmp.h" // textmap parsing
@ -911,11 +907,9 @@ static void P_InitializeSector(sector_t *ss)
ss->preciplist = NULL;
ss->touching_preciplist = NULL;
#ifdef ESLOPE
ss->f_slope = NULL;
ss->c_slope = NULL;
ss->hasslope = false;
#endif
ss->spawn_lightlevel = ss->lightlevel;
@ -3526,9 +3520,7 @@ boolean P_LoadLevel(boolean fromnetsave)
// Close text prompt before freeing the old level
F_EndTextPrompt(false, true);
#ifdef HAVE_BLUA
LUA_InvalidateLevel();
#endif
for (ss = sectors; sectors+numsectors != ss; ss++)
{
@ -3584,9 +3576,7 @@ boolean P_LoadLevel(boolean fromnetsave)
// anything that P_SpawnSlopes/P_LoadThings needs to know
P_InitSpecials();
#ifdef ESLOPE
P_SpawnSlopes(fromnetsave);
#endif
P_SpawnMapThings(!fromnetsave);
skyboxmo[0] = skyboxviewpnts[0];
@ -3665,9 +3655,7 @@ boolean P_LoadLevel(boolean fromnetsave)
G_CopyTiccmd(&players[i].cmd, &netcmds[buf][i], 1);
}
P_PreTicker(2);
#ifdef HAVE_BLUA
LUAh_MapLoad();
#endif
}
// No render mode, stop here.
@ -3859,10 +3847,8 @@ boolean P_AddWadFile(const char *wadfilename)
// Update the detected resources.
// Note: ALWAYS load Lua scripts first, SOCs right after, and the remaining resources afterwards.
#ifdef HAVE_BLUA
// if (luaNum) // Lua scripts.
// P_LoadLuaScrRange(wadnum, luaPos, luaNum);
#endif
// if (socNum) // SOCs.
// P_LoadDehackRange(wadnum, socPos, socNum);
if (sfxNum) // Sounds. TODO: Function currently only updates already existing sounds, the rest is handled somewhere else.

View file

@ -218,9 +218,7 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
const vertex_t *v1,*v2;
fixed_t frac;
fixed_t frontf, backf, frontc, backc;
#ifdef ESLOPE
fixed_t fracx, fracy;
#endif
if (seg->glseg)
continue;
@ -263,7 +261,6 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
front = seg->frontsector;
back = seg->backsector;
#ifdef ESLOPE
// calculate position at intercept
fracx = los->strace.x + FixedMul(los->strace.dx, frac);
fracy = los->strace.y + FixedMul(los->strace.dy, frac);
@ -272,12 +269,6 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
frontc = (front->c_slope) ? P_GetZAt(front->c_slope, fracx, fracy) : front->ceilingheight;
backf = (back->f_slope) ? P_GetZAt(back->f_slope, fracx, fracy) : back->floorheight;
backc = (back->c_slope) ? P_GetZAt(back->c_slope, fracx, fracy) : back->ceilingheight;
#else
frontf = front->floorheight;
frontc = front->ceilingheight;
backf = back->floorheight;
backc = back->ceilingheight;
#endif
// crosses a two sided line
// no wall to block sight with?
if (frontf == backf && frontc == backc
@ -327,13 +318,8 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
continue;
}
#ifdef ESLOPE
topz = (*rover->t_slope) ? P_GetZAt(*rover->t_slope, fracx, fracy) : *rover->topheight;
bottomz = (*rover->b_slope) ? P_GetZAt(*rover->b_slope, fracx, fracy) : *rover->bottomheight;
#else
topz = *rover->topheight;
bottomz = *rover->bottomheight;
#endif
topslope = FixedDiv(topz - los->sightzstart , frac);
bottomslope = FixedDiv(bottomz - los->sightzstart , frac);
if (topslope >= los->topslope && bottomslope <= los->bottomslope)
@ -348,13 +334,8 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
continue;
}
#ifdef ESLOPE
topz = (*rover->t_slope) ? P_GetZAt(*rover->t_slope, fracx, fracy) : *rover->topheight;
bottomz = (*rover->b_slope) ? P_GetZAt(*rover->b_slope, fracx, fracy) : *rover->bottomheight;
#else
topz = *rover->topheight;
bottomz = *rover->bottomheight;
#endif
topslope = FixedDiv(topz - los->sightzstart , frac);
bottomslope = FixedDiv(bottomz - los->sightzstart , frac);
if (topslope >= los->topslope && bottomslope <= los->bottomslope)
@ -487,7 +468,6 @@ boolean P_CheckSight(mobj_t *t1, mobj_t *t2)
continue;
}
#ifdef ESLOPE
if (*rover->t_slope)
{
topz1 = P_GetZAt(*rover->t_slope, t1->x, t1->y);
@ -503,10 +483,6 @@ boolean P_CheckSight(mobj_t *t1, mobj_t *t2)
}
else
bottomz1 = bottomz2 = *rover->bottomheight;
#else
topz1 = topz2 = *rover->topheight;
bottomz1 = bottomz2 = *rover->bottomheight;
#endif
// Check for blocking floors here.
if ((los.sightzstart < bottomz1 && t2->z >= topz2)

View file

@ -23,8 +23,6 @@
#include "p_maputl.h"
#include "w_wad.h"
#ifdef ESLOPE
pslope_t *slopelist = NULL;
UINT16 slopecount = 0;
@ -844,6 +842,3 @@ void P_ButteredSlope(mobj_t *mo)
P_Thrust(mo, mo->standingslope->xydirection, thrust);
}
// EOF
#endif // #ifdef ESLOPE

View file

@ -15,8 +15,6 @@
#include "m_fixed.h" // Vectors
#ifdef ESLOPE
extern pslope_t *slopelist;
extern UINT16 slopecount;
@ -74,5 +72,4 @@ typedef struct
void T_DynamicSlopeLine (dynplanethink_t* th);
void T_DynamicSlopeVert (dynplanethink_t* th);
#endif // #ifdef ESLOPE
#endif // #ifndef P_SLOPES_H__

View file

@ -36,7 +36,7 @@
#include "m_cond.h" //unlock triggers
#include "lua_hook.h" // LUAh_LinedefExecute
#include "f_finale.h" // control text prompt
#include "r_things.h" // skins
#include "r_skins.h" // skins
#ifdef HW3SOUND
#include "hardware/hw3sound.h"
@ -3366,14 +3366,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
}
case 443: // Calls a named Lua function
#ifdef HAVE_BLUA
if (line->text)
LUAh_LinedefExecute(line, mo, callsec);
else
CONS_Alert(CONS_WARNING, "Linedef %s is missing the hook name of the Lua function to call! (This should be given in the front texture fields)\n", sizeu1(line-lines));
#else
CONS_Alert(CONS_ERROR, "The map is trying to run a Lua script, but this exe was not compiled with Lua support!\n");
#endif
break;
case 444: // Earthquake camera
@ -5792,7 +5788,6 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
fflr->topyoffs = &sec2->ceiling_yoffs;
fflr->topangle = &sec2->ceilingpic_angle;
#ifdef ESLOPE
// Add slopes
fflr->t_slope = &sec2->c_slope;
fflr->b_slope = &sec2->f_slope;
@ -5800,7 +5795,6 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
// (this fixes FOF slopes glitching initially at level load in software mode)
if (sec2->hasslope)
sec->hasslope = true;
#endif
if ((flags & FF_SOLID) && (master->flags & ML_EFFECT1)) // Block player only
flags &= ~FF_BLOCKOTHERS;
@ -6278,15 +6272,11 @@ void T_LaserFlash(laserthink_t *flash)
sourcesec = fflr->master->frontsector; // Less to type!
#ifdef ESLOPE
top = (*fflr->t_slope) ? P_GetZAt(*fflr->t_slope, sector->soundorg.x, sector->soundorg.y)
: *fflr->topheight;
bottom = (*fflr->b_slope) ? P_GetZAt(*fflr->b_slope, sector->soundorg.x, sector->soundorg.y)
: *fflr->bottomheight;
sector->soundorg.z = (top + bottom)/2;
#else
sector->soundorg.z = (*fflr->topheight + *fflr->bottomheight)/2;
#endif
S_StartSound(&sector->soundorg, sfx_laser);
// Seek out objects to DESTROY! MUAHAHHAHAHAA!!!*cough*
@ -7931,12 +7921,10 @@ void T_Disappear(disappear_t *d)
if (!(lines[d->sourceline].flags & ML_NOCLIMB))
{
#ifdef ESLOPE
if (*rover->t_slope)
sectors[s].soundorg.z = P_GetZAt(*rover->t_slope, sectors[s].soundorg.x, sectors[s].soundorg.y);
else
#endif
sectors[s].soundorg.z = *rover->topheight;
sectors[s].soundorg.z = *rover->topheight;
S_StartSound(&sectors[s].soundorg, sfx_appear);
}
}

View file

@ -269,9 +269,7 @@ void P_RemoveThinkerDelayed(thinker_t *thinker)
//
void P_RemoveThinker(thinker_t *thinker)
{
#ifdef HAVE_BLUA
LUA_InvalidateUserdata(thinker);
#endif
thinker->function.acp1 = (actionf_p1)P_RemoveThinkerDelayed;
}
@ -643,9 +641,7 @@ void P_Ticker(boolean run)
if (demoplayback)
G_ReadDemoTiccmd(&players[consoleplayer].cmd, 0);
#ifdef HAVE_BLUA
LUAh_PreThinkFrame();
#endif
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
@ -671,9 +667,7 @@ void P_Ticker(boolean run)
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
P_PlayerAfterThink(&players[i]);
#ifdef HAVE_BLUA
LUAh_ThinkFrame();
#endif
}
// Run shield positioning
@ -745,9 +739,7 @@ void P_Ticker(boolean run)
if (modeattacking)
G_GhostTicker();
#ifdef HAVE_BLUA
LUAh_PostThinkFrame();
#endif
}
P_MapEnd();
@ -767,9 +759,8 @@ void P_PreTicker(INT32 frames)
{
P_MapStart();
#ifdef HAVE_BLUA
LUAh_PreThinkFrame();
#endif
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
{
@ -793,9 +784,7 @@ void P_PreTicker(INT32 frames)
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
P_PlayerAfterThink(&players[i]);
#ifdef HAVE_BLUA
LUAh_ThinkFrame();
#endif
// Run shield positioning
P_RunShields();
@ -804,9 +793,7 @@ void P_PreTicker(INT32 frames)
P_UpdateSpecials();
P_RespawnSpecials();
#ifdef HAVE_BLUA
LUAh_PostThinkFrame();
#endif
P_MapEnd();
}

View file

@ -22,7 +22,7 @@
#include "p_local.h"
#include "r_main.h"
#include "s_sound.h"
#include "r_things.h"
#include "r_skins.h"
#include "d_think.h"
#include "r_sky.h"
#include "p_setup.h"
@ -395,7 +395,7 @@ void P_GiveFinishFlags(player_t *player)
mobj_t* flag = P_SpawnMobjFromMobj(player->mo, xoffs, yoffs, 0, MT_FINISHFLAG);
flag->angle = angle;
angle += FixedAngle(120*FRACUNIT);
P_SetTarget(&flag->target, player->mo);
}
}
@ -1109,7 +1109,6 @@ boolean P_PlayerCanDamage(player_t *player, mobj_t *thing)
if (!player->mo || player->spectator || !thing || P_MobjWasRemoved(thing))
return false;
#ifdef HAVE_BLUA
{
UINT8 shouldCollide = LUAh_PlayerCanDamage(player, thing);
if (P_MobjWasRemoved(thing))
@ -1119,7 +1118,6 @@ boolean P_PlayerCanDamage(player_t *player, mobj_t *thing)
else if (shouldCollide == 2)
return false; // force no
}
#endif
// Invinc/super. Not for Monitors.
if (!(thing->flags & MF_MONITOR) && (player->powers[pw_invulnerability] || player->powers[pw_super]))
@ -1521,7 +1519,7 @@ void P_PlayJingle(player_t *player, jingletype_t jingletype)
char newmusic[7];
strncpy(newmusic, musname, 7);
#if defined(HAVE_BLUA) && defined(HAVE_LUA_MUSICPLUS)
#ifdef HAVE_LUA_MUSICPLUS
if(LUAh_MusicJingle(jingletype, newmusic, &musflags, &looping))
return;
#endif
@ -1536,7 +1534,7 @@ void P_PlayJingle(player_t *player, jingletype_t jingletype)
void P_PlayJingleMusic(player_t *player, const char *musname, UINT16 musflags, boolean looping, UINT16 status)
{
// If gamestate != GS_LEVEL, always play the jingle (1-up intermission)
if (gamestate == GS_LEVEL && !P_IsLocalPlayer(player))
if (gamestate == GS_LEVEL && player && !P_IsLocalPlayer(player))
return;
S_RetainMusic(musname, musflags, looping, 0, status);
@ -1544,7 +1542,7 @@ void P_PlayJingleMusic(player_t *player, const char *musname, UINT16 musflags, b
S_ChangeMusicInternal(musname, looping);
}
boolean P_EvaluateMusicStatus(UINT16 status)
boolean P_EvaluateMusicStatus(UINT16 status, const char *musname)
{
// \todo lua hook
int i;
@ -1601,8 +1599,11 @@ boolean P_EvaluateMusicStatus(UINT16 status)
result = (players[i].nightstime && players[i].nightstime <= 10*TICRATE);
break;
case JT_NONE: // Null state
case JT_OTHER: // Other state
result = LUAh_ShouldJingleContinue(&players[i], musname);
break;
case JT_NONE: // Null state
case JT_MASTER: // Main level music
default:
result = true;
@ -1865,10 +1866,8 @@ void P_SpawnShieldOrb(player_t *player)
I_Error("P_SpawnShieldOrb: player->mo is NULL!\n");
#endif
#ifdef HAVE_BLUA
if (LUAh_ShieldSpawn(player))
return;
#endif
if (player->powers[pw_shield] & SH_FORCE)
orbtype = MT_FORCE_ORB;
@ -2275,13 +2274,8 @@ boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space
if (GETSECSPECIAL(rover->master->frontsector->special, 1) != SPACESPECIAL)
continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, mo->x, mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
if (mo->z + (mo->height/2) > topheight)
continue;
@ -2518,13 +2512,8 @@ boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand
if (!(rover->flags & FF_QUICKSAND))
continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, mo->x, mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
if (mo->z + flipoffset > topheight)
continue;
@ -2694,9 +2683,7 @@ static void P_CheckBouncySectors(player_t *player)
fixed_t oldx;
fixed_t oldy;
fixed_t oldz;
#ifdef ESLOPE
vector3_t momentum;
#endif
oldx = player->mo->x;
oldy = player->mo->y;
@ -2751,7 +2738,6 @@ static void P_CheckBouncySectors(player_t *player)
{
fixed_t newmom;
#ifdef ESLOPE
pslope_t *slope;
if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) { // Hit top
slope = *rover->t_slope;
@ -2767,9 +2753,6 @@ static void P_CheckBouncySectors(player_t *player)
P_ReverseQuantizeMomentumToSlope(&momentum, slope);
newmom = momentum.z = -FixedMul(momentum.z,linedist)/2;
#else
newmom = -FixedMul(player->mo->momz,linedist);
#endif
if (abs(newmom) < (linedist*2))
{
@ -2792,7 +2775,6 @@ static void P_CheckBouncySectors(player_t *player)
else if (newmom < -P_GetPlayerHeight(player)/2)
newmom = -P_GetPlayerHeight(player)/2;
#ifdef ESLOPE
momentum.z = newmom*2;
if (slope)
@ -2801,9 +2783,6 @@ static void P_CheckBouncySectors(player_t *player)
player->mo->momx = momentum.x;
player->mo->momy = momentum.y;
player->mo->momz = momentum.z/2;
#else
player->mo->momz = newmom;
#endif
if (player->pflags & PF_SPINNING)
{
@ -2860,13 +2839,8 @@ static void P_CheckQuicksand(player_t *player)
if (!(rover->flags & FF_QUICKSAND))
continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
if (topheight >= player->mo->z && bottomheight < player->mo->z + player->mo->height)
{
@ -3200,26 +3174,21 @@ static void P_DoClimbing(player_t *player)
boolean thrust = false;
boolean boostup = false;
boolean skyclimber = false;
fixed_t floorheight, ceilingheight; // ESLOPE
fixed_t floorheight, ceilingheight;
if (!glidesector)
floorclimb = true;
else
{
#ifdef ESLOPE
floorheight = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y)
: glidesector->sector->floorheight;
ceilingheight = glidesector->sector->c_slope ? P_GetZAt(glidesector->sector->c_slope, player->mo->x, player->mo->y)
: glidesector->sector->ceilingheight;
#else
floorheight = glidesector->sector->floorheight;
ceilingheight = glidesector->sector->ceilingheight;
#endif
if (glidesector->sector->ffloors)
{
ffloor_t *rover;
fixed_t topheight, bottomheight; // ESLOPE
fixed_t topheight, bottomheight;
for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
{
@ -3228,13 +3197,8 @@ static void P_DoClimbing(player_t *player)
floorclimb = true;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
// Only supports rovers that are moving like an 'elevator', not just the top or bottom.
if (rover->master->frontsector->floorspeed && rover->master->frontsector->ceilspeed == 42)
@ -3275,11 +3239,7 @@ static void P_DoClimbing(player_t *player)
if (roverbelow == rover)
continue;
#ifdef ESLOPE
bottomheight2 = *roverbelow->b_slope ? P_GetZAt(*roverbelow->b_slope, player->mo->x, player->mo->y) : *roverbelow->bottomheight;
#else
bottomheight2 = *roverbelow->bottomheight;
#endif
if (bottomheight2 < topheight + FixedMul(16*FRACUNIT, player->mo->scale))
foundfof = true;
@ -3325,11 +3285,7 @@ static void P_DoClimbing(player_t *player)
if (roverbelow == rover)
continue;
#ifdef ESLOPE
topheight2 = *roverbelow->t_slope ? P_GetZAt(*roverbelow->t_slope, player->mo->x, player->mo->y) : *roverbelow->topheight;
#else
topheight2 = *roverbelow->topheight;
#endif
if (topheight2 > bottomheight - FixedMul(16*FRACUNIT, player->mo->scale))
foundfof = true;
@ -3384,11 +3340,7 @@ static void P_DoClimbing(player_t *player)
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
continue;
#ifdef ESLOPE
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
#else
bottomheight = *rover->bottomheight;
#endif
if (bottomheight < floorheight + FixedMul(16*FRACUNIT, player->mo->scale))
{
@ -3429,11 +3381,7 @@ static void P_DoClimbing(player_t *player)
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
#else
topheight = *rover->topheight;
#endif
if (topheight > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale))
{
@ -3808,12 +3756,10 @@ static void P_DoTeeter(player_t *player)
ceilingheight = sec->ceilingheight;
floorheight = sec->floorheight;
#ifdef ESLOPE
if (sec->c_slope)
ceilingheight = P_GetZAt(sec->c_slope, checkx, checky);
if (sec->f_slope)
floorheight = P_GetZAt(sec->f_slope, checkx, checky);
#endif
highestceilingheight = (ceilingheight > highestceilingheight) ? ceilingheight : highestceilingheight;
lowestfloorheight = (floorheight < lowestfloorheight) ? floorheight : lowestfloorheight;
@ -3824,13 +3770,8 @@ static void P_DoTeeter(player_t *player)
{
if (!(rover->flags & FF_EXISTS)) continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
if (P_CheckSolidLava(rover))
;
@ -4633,17 +4574,13 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
&& (player->pflags & PF_JUMPSTASIS || player->mo->state-states != S_PLAY_GLIDE_LANDING))
return;
#ifdef HAVE_BLUA
if (cmd->buttons & BT_USE)
{
if (LUAh_SpinSpecial(player))
return;
}
#endif
#ifdef ESLOPE
canstand = (!player->mo->standingslope || (player->mo->standingslope->flags & SL_NOPHYSICS) || abs(player->mo->standingslope->zdelta) < FRACUNIT/2);
#endif
///////////////////////////////
// ability-specific behavior //
@ -5125,11 +5062,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
}
}
}
if (cmd->buttons & BT_USE // Spin button effects
#ifdef HAVE_BLUA
&& !LUAh_ShieldSpecial(player)
#endif
)
if (cmd->buttons & BT_USE && !LUAh_ShieldSpecial(player)) // Spin button effects
{
// Force stop
if ((player->powers[pw_shield] & ~(SH_FORCEHP|SH_STACK)) == SH_FORCE)
@ -5207,51 +5140,48 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
// and you don't have a shield, do it!
P_DoSuperTransformation(player, false);
}
else
#ifdef HAVE_BLUA
if (!LUAh_JumpSpinSpecial(player))
#endif
switch (player->charability)
{
case CA_THOK:
if (player->powers[pw_super]) // Super Sonic float
{
if ((player->speed > 5*player->mo->scale) // FixedMul(5<<FRACBITS, player->mo->scale), but scale is FRACUNIT-based
&& (P_MobjFlip(player->mo)*player->mo->momz <= 0))
else if (!LUAh_JumpSpinSpecial(player))
switch (player->charability)
{
case CA_THOK:
if (player->powers[pw_super]) // Super Sonic float
{
if (player->panim != PA_RUN && player->panim != PA_WALK)
if ((player->speed > 5*player->mo->scale) // FixedMul(5<<FRACBITS, player->mo->scale), but scale is FRACUNIT-based
&& (P_MobjFlip(player->mo)*player->mo->momz <= 0))
{
if (player->speed >= FixedMul(player->runspeed, player->mo->scale))
P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT_RUN);
else
P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT);
}
if (player->panim != PA_RUN && player->panim != PA_WALK)
{
if (player->speed >= FixedMul(player->runspeed, player->mo->scale))
P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT_RUN);
else
P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT);
}
player->mo->momz = 0;
player->pflags &= ~(PF_STARTJUMP|PF_SPINNING);
player->mo->momz = 0;
player->pflags &= ~(PF_STARTJUMP|PF_SPINNING);
}
}
}
break;
case CA_TELEKINESIS:
if (!(player->pflags & (PF_THOKKED|PF_USEDOWN)) || (player->charflags & SF_MULTIABILITY))
{
P_Telekinesis(player,
-FixedMul(player->actionspd, player->mo->scale), // -ve thrust (pulling towards player)
FixedMul(384*FRACUNIT, player->mo->scale));
}
break;
case CA_TWINSPIN:
if ((player->charability2 == CA2_MELEE) && (!(player->pflags & (PF_THOKKED|PF_USEDOWN)) || player->charflags & SF_MULTIABILITY))
{
player->pflags |= PF_THOKKED;
S_StartSound(player->mo, sfx_s3k42);
player->mo->frame = 0;
P_SetPlayerMobjState(player->mo, S_PLAY_TWINSPIN);
}
break;
default:
break;
}
break;
case CA_TELEKINESIS:
if (!(player->pflags & (PF_THOKKED|PF_USEDOWN)) || (player->charflags & SF_MULTIABILITY))
{
P_Telekinesis(player,
-FixedMul(player->actionspd, player->mo->scale), // -ve thrust (pulling towards player)
FixedMul(384*FRACUNIT, player->mo->scale));
}
break;
case CA_TWINSPIN:
if ((player->charability2 == CA2_MELEE) && (!(player->pflags & (PF_THOKKED|PF_USEDOWN)) || player->charflags & SF_MULTIABILITY))
{
player->pflags |= PF_THOKKED;
S_StartSound(player->mo, sfx_s3k42);
player->mo->frame = 0;
P_SetPlayerMobjState(player->mo, S_PLAY_TWINSPIN);
}
break;
default:
break;
}
}
}
@ -5287,16 +5217,13 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
if (cmd->buttons & BT_JUMP && !player->exiting && !P_PlayerInPain(player))
{
#ifdef HAVE_BLUA
if (LUAh_JumpSpecial(player))
;
else
#endif
if (player->pflags & PF_JUMPDOWN) // all situations below this require jump button not to be pressed already
// all situations below this require jump button not to be pressed already
else if (player->pflags & PF_JUMPDOWN)
;
else
// Jump S3&K style while in quicksand.
if (P_InQuicksand(player->mo))
else if (P_InQuicksand(player->mo))
{
P_DoJump(player, true);
player->secondjump = 0;
@ -5308,9 +5235,8 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
P_SetTarget(&player->mo->tracer, NULL);
player->powers[pw_flashing] = TICRATE/4;
}
else
// can't jump while in air, can't jump while jumping
if (onground || player->climbing || player->powers[pw_carry])
else if (onground || player->climbing || player->powers[pw_carry])
{
P_DoJump(player, true);
player->secondjump = 0;
@ -5326,9 +5252,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
}*/
else if (player->pflags & PF_JUMPED)
{
#ifdef HAVE_BLUA
if (!LUAh_AbilitySpecial(player))
#endif
switch (player->charability)
{
case CA_THOK:
@ -5523,30 +5447,28 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
}
else if (player->pflags & PF_THOKKED)
{
#ifdef HAVE_BLUA
if (!LUAh_AbilitySpecial(player))
#endif
switch (player->charability)
{
case CA_FLY:
case CA_SWIM: // Swim
if (player->charability == CA_SWIM && !(player->mo->eflags & MFE_UNDERWATER))
; // Can't do anything if you're a fish out of water!
else if (player->powers[pw_tailsfly]) // If currently flying, give an ascend boost.
{
player->fly1 = 20;
switch (player->charability)
{
case CA_FLY:
case CA_SWIM: // Swim
if (player->charability == CA_SWIM && !(player->mo->eflags & MFE_UNDERWATER))
; // Can't do anything if you're a fish out of water!
else if (player->powers[pw_tailsfly]) // If currently flying, give an ascend boost.
{
player->fly1 = 20;
if (player->charability == CA_SWIM)
player->fly1 /= 2;
if (player->charability == CA_SWIM)
player->fly1 /= 2;
// Slow down!
if (player->speed > FixedMul(8*FRACUNIT, player->mo->scale) && player->speed > FixedMul(player->normalspeed>>1, player->mo->scale))
P_Thrust(player->mo, R_PointToAngle2(0,0,player->mo->momx,player->mo->momy), FixedMul(-4*FRACUNIT, player->mo->scale));
}
break;
default:
break;
}
// Slow down!
if (player->speed > FixedMul(8*FRACUNIT, player->mo->scale) && player->speed > FixedMul(player->normalspeed>>1, player->mo->scale))
P_Thrust(player->mo, R_PointToAngle2(0,0,player->mo->momx,player->mo->momy), FixedMul(-4*FRACUNIT, player->mo->scale));
}
break;
default:
break;
}
}
else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_WHIRLWIND && !player->powers[pw_super])
P_DoJumpShield(player);
@ -5921,12 +5843,10 @@ static void P_3dMovement(player_t *player)
controlstyle_e controlstyle;
boolean spin = ((onground = P_IsObjectOnGround(player->mo)) && (player->pflags & (PF_SPINNING|PF_THOKKED)) == PF_SPINNING && (player->rmomx || player->rmomy) && !(player->pflags & PF_STARTDASH));
fixed_t oldMagnitude, newMagnitude;
#ifdef ESLOPE
vector3_t totalthrust;
totalthrust.x = totalthrust.y = 0; // I forget if this is needed
totalthrust.z = FRACUNIT*P_MobjFlip(player->mo)/3; // A bit of extra push-back on slopes
#endif // ESLOPE
// Get the old momentum; this will be needed at the end of the function! -SH
oldMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0);
@ -6127,12 +6047,8 @@ static void P_3dMovement(player_t *player)
movepushforward = FixedMul(movepushforward, player->mo->scale);
#ifdef ESLOPE
totalthrust.x += P_ReturnThrustX(player->mo, movepushangle, movepushforward);
totalthrust.y += P_ReturnThrustY(player->mo, movepushangle, movepushforward);
#else
P_Thrust(player->mo, movepushangle, movepushforward);
#endif
}
// Sideways movement
if (player->climbing)
@ -6175,12 +6091,8 @@ static void P_3dMovement(player_t *player)
movepushforward = FixedMul(movepushforward, player->mo->scale);
#ifdef ESLOPE
totalthrust.x += P_ReturnThrustX(player->mo, controldirection, movepushforward);
totalthrust.y += P_ReturnThrustY(player->mo, controldirection, movepushforward);
#else
P_Thrust(player->mo, controldirection, movepushforward);
#endif
}
}
else if (cmd->sidemove && !(player->pflags & PF_GLIDING) && !player->exiting && !P_PlayerInPain(player))
@ -6209,15 +6121,10 @@ static void P_3dMovement(player_t *player)
// Finally move the player now that their speed/direction has been decided.
movepushside = FixedMul(movepushside, player->mo->scale);
#ifdef ESLOPE
totalthrust.x += P_ReturnThrustX(player->mo, movepushsideangle, movepushside);
totalthrust.y += P_ReturnThrustY(player->mo, movepushsideangle, movepushside);
#else
P_Thrust(player->mo, movepushsideangle, movepushside);
#endif
}
#ifdef ESLOPE
if ((totalthrust.x || totalthrust.y)
&& player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && abs(player->mo->standingslope->zdelta) > FRACUNIT/2) {
// Factor thrust to slope, but only for the part pushing up it!
@ -6237,7 +6144,6 @@ static void P_3dMovement(player_t *player)
player->mo->momx += totalthrust.x;
player->mo->momy += totalthrust.y;
#endif
// Time to ask three questions:
// 1) Are we over topspeed?
@ -7850,14 +7756,13 @@ void P_ElementalFire(player_t *player, boolean cropcircle)
newx = player->mo->x + P_ReturnThrustX(player->mo, (travelangle + ((i&1) ? -1 : 1)*ANGLE_135), FixedMul(24*FRACUNIT, player->mo->scale));
newy = player->mo->y + P_ReturnThrustY(player->mo, (travelangle + ((i&1) ? -1 : 1)*ANGLE_135), FixedMul(24*FRACUNIT, player->mo->scale));
#ifdef ESLOPE
if (player->mo->standingslope)
{
ground = P_GetZAt(player->mo->standingslope, newx, newy);
if (player->mo->eflags & MFE_VERTICALFLIP)
ground -= FixedMul(mobjinfo[MT_SPINFIRE].height, player->mo->scale);
}
#endif
flame = P_SpawnMobj(newx, newy, ground, MT_SPINFIRE);
P_SetTarget(&flame->target, player->mo);
flame->angle = travelangle;
@ -9422,7 +9327,7 @@ boolean P_HomingAttack(mobj_t *source, mobj_t *enemy) // Home in on your target
if (enemy->health <= 0) // dead
return false;
if (!((enemy->flags & (MF_ENEMY|MF_BOSS|MF_MONITOR) && (enemy->flags & MF_SHOOTABLE)) || (enemy->flags & MF_SPRING)) == !(enemy->flags2 & MF2_INVERTAIMABLE)) // allows if it has the flags desired XOR it has the invert aimable flag
if (source->player && (!((enemy->flags & (MF_ENEMY|MF_BOSS|MF_MONITOR) && (enemy->flags & MF_SHOOTABLE)) || (enemy->flags & MF_SPRING)) == !(enemy->flags2 & MF2_INVERTAIMABLE))) // allows if it has the flags desired XOR it has the invert aimable flag
return false;
if (enemy->flags2 & MF2_FRET)
@ -10633,10 +10538,8 @@ 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)
{
@ -10650,11 +10553,9 @@ 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
LUAh_ViewpointSwitch(player, &players[consoleplayer], true);
displayplayer = consoleplayer;
}
@ -10672,10 +10573,8 @@ boolean P_SpectatorJoinGame(player_t *player)
// respawn in place and sit there for the rest of the round.
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);
@ -10699,11 +10598,9 @@ 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
LUAh_ViewpointSwitch(player, &players[consoleplayer], true);
displayplayer = consoleplayer;
}
@ -10766,13 +10663,8 @@ static void P_CalcPostImg(player_t *player)
if (!(rover->flags & FF_EXISTS))
continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
if (pviewheight >= topheight || pviewheight <= bottomheight)
continue;
@ -10794,13 +10686,8 @@ static void P_CalcPostImg(player_t *player)
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKPLAYER)
continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
#else
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
#endif
if (pviewheight >= topheight || pviewheight <= bottomheight)
continue;
@ -11626,9 +11513,7 @@ void P_PlayerThink(player_t *player)
}
if (player->playerstate == PST_REBORN)
{
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
return;
}
}
@ -11732,9 +11617,7 @@ void P_PlayerThink(player_t *player)
if (player->playerstate == PST_DEAD)
{
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
return;
}
}
@ -11857,9 +11740,7 @@ void P_PlayerThink(player_t *player)
{
player->mo->flags2 &= ~MF2_SHADOW;
P_DeathThink(player);
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
return;
}
@ -11901,9 +11782,7 @@ void P_PlayerThink(player_t *player)
{
if (P_SpectatorJoinGame(player))
{
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
return; // player->mo was removed.
}
}
@ -12008,9 +11887,7 @@ void P_PlayerThink(player_t *player)
if (!player->mo)
{
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
return; // P_MovePlayer removed player->mo.
}
@ -12452,9 +12329,7 @@ void P_PlayerThink(player_t *player)
}
#undef dashmode
#ifdef HAVE_BLUA
LUAh_PlayerThink(player);
#endif
/*
// Colormap verification
@ -13004,11 +12879,9 @@ void P_PlayerAfterThink(player_t *player)
if (player->followmobj)
{
#ifdef HAVE_BLUA
if (LUAh_FollowMobj(player, player->followmobj) || P_MobjWasRemoved(player->followmobj))
{;}
else
#endif
{
switch (player->followmobj->type)
{

View file

@ -359,10 +359,8 @@ boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back)
#endif
back->ceilingpic == front->ceilingpic
&& back->floorpic == front->floorpic
#ifdef ESLOPE
&& back->f_slope == front->f_slope
&& back->c_slope == front->c_slope
#endif
&& back->lightlevel == front->lightlevel
&& !line->sidedef->midtexture
// Check offsets too!
@ -497,7 +495,6 @@ static void R_AddLine(seg_t *line)
}
// Closed door.
#ifdef ESLOPE
if (frontsector->f_slope || frontsector->c_slope || backsector->f_slope || backsector->c_slope)
{
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
@ -542,7 +539,6 @@ static void R_AddLine(seg_t *line)
goto clippass;
}
else
#endif
{
// if both ceilings are skies, consider it always "open"
// same for floors
@ -863,16 +859,12 @@ static void R_Subsector(size_t num)
floorcolormap = ceilingcolormap = frontsector->extra_colormap;
floorcenterz =
#ifdef ESLOPE
frontsector->f_slope ? P_GetZAt(frontsector->f_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
#endif
floorcenterz = frontsector->f_slope ?
P_GetZAt(frontsector->f_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
frontsector->floorheight;
ceilingcenterz =
#ifdef ESLOPE
frontsector->c_slope ? P_GetZAt(frontsector->c_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
#endif
ceilingcenterz = frontsector->c_slope ?
P_GetZAt(frontsector->c_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
frontsector->ceilingheight;
// Check and prep all 3D floors. Set the sector floor/ceiling light levels and colormaps.
@ -899,34 +891,23 @@ static void R_Subsector(size_t num)
sub->sector->extra_colormap = frontsector->extra_colormap;
if (((
#ifdef ESLOPE
frontsector->f_slope ? P_GetZAt(frontsector->f_slope, viewx, viewy) :
#endif
frontsector->floorheight) < viewz || frontsector->floorpic == skyflatnum
|| (frontsector->heightsec != -1
&& sectors[frontsector->heightsec].ceilingpic == skyflatnum)))
if ((frontsector->f_slope ? P_GetZAt(frontsector->f_slope, viewx, viewy) : frontsector->floorheight) < viewz
|| frontsector->floorpic == skyflatnum
|| (frontsector->heightsec != -1 && sectors[frontsector->heightsec].ceilingpic == skyflatnum))
{
floorplane = R_FindPlane(frontsector->floorheight, frontsector->floorpic, floorlightlevel,
frontsector->floor_xoffs, frontsector->floor_yoffs, frontsector->floorpic_angle, floorcolormap, NULL
#ifdef POLYOBJECTS_PLANES
, NULL
#endif
#ifdef ESLOPE
, frontsector->f_slope
#endif
);
, frontsector->f_slope);
}
else
floorplane = NULL;
if (((
#ifdef ESLOPE
frontsector->c_slope ? P_GetZAt(frontsector->c_slope, viewx, viewy) :
#endif
frontsector->ceilingheight) > viewz || frontsector->ceilingpic == skyflatnum
|| (frontsector->heightsec != -1
&& sectors[frontsector->heightsec].floorpic == skyflatnum)))
if ((frontsector->c_slope ? P_GetZAt(frontsector->c_slope, viewx, viewy) : frontsector->ceilingheight) > viewz
|| frontsector->ceilingpic == skyflatnum
|| (frontsector->heightsec != -1 && sectors[frontsector->heightsec].floorpic == skyflatnum))
{
ceilingplane = R_FindPlane(frontsector->ceilingheight, frontsector->ceilingpic,
ceilinglightlevel, frontsector->ceiling_xoffs, frontsector->ceiling_yoffs, frontsector->ceilingpic_angle,
@ -934,18 +915,13 @@ static void R_Subsector(size_t num)
#ifdef POLYOBJECTS_PLANES
, NULL
#endif
#ifdef ESLOPE
, frontsector->c_slope
#endif
);
, frontsector->c_slope);
}
else
ceilingplane = NULL;
numffloors = 0;
#ifdef ESLOPE
ffloor[numffloors].slope = NULL;
#endif
ffloor[numffloors].plane = NULL;
ffloor[numffloors].polyobj = NULL;
if (frontsector->ffloors)
@ -970,16 +946,12 @@ static void R_Subsector(size_t num)
ffloor[numffloors].plane = NULL;
ffloor[numffloors].polyobj = NULL;
heightcheck =
#ifdef ESLOPE
*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) :
#endif
heightcheck = *rover->b_slope ?
P_GetZAt(*rover->b_slope, viewx, viewy) :
*rover->bottomheight;
planecenterz =
#ifdef ESLOPE
*rover->b_slope ? P_GetZAt(*rover->b_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
#endif
planecenterz = *rover->b_slope ?
P_GetZAt(*rover->b_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
*rover->bottomheight;
if (planecenterz <= ceilingcenterz
&& planecenterz >= floorcenterz
@ -995,18 +967,13 @@ static void R_Subsector(size_t num)
#ifdef POLYOBJECTS_PLANES
, NULL
#endif
#ifdef ESLOPE
, *rover->b_slope
#endif
);
, *rover->b_slope);
#ifdef ESLOPE
ffloor[numffloors].slope = *rover->b_slope;
// Tell the renderer this sector has slopes in it.
if (ffloor[numffloors].slope)
frontsector->hasslope = true;
#endif
ffloor[numffloors].height = heightcheck;
ffloor[numffloors].ffloor = rover;
@ -1017,16 +984,12 @@ static void R_Subsector(size_t num)
ffloor[numffloors].plane = NULL;
ffloor[numffloors].polyobj = NULL;
heightcheck =
#ifdef ESLOPE
*rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) :
#endif
heightcheck = *rover->t_slope ?
P_GetZAt(*rover->t_slope, viewx, viewy) :
*rover->topheight;
planecenterz =
#ifdef ESLOPE
*rover->t_slope ? P_GetZAt(*rover->t_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
#endif
planecenterz = *rover->t_slope ?
P_GetZAt(*rover->t_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
*rover->topheight;
if (planecenterz >= floorcenterz
&& planecenterz <= ceilingcenterz
@ -1041,18 +1004,13 @@ static void R_Subsector(size_t num)
#ifdef POLYOBJECTS_PLANES
, NULL
#endif
#ifdef ESLOPE
, *rover->t_slope
#endif
);
, *rover->t_slope);
#ifdef ESLOPE
ffloor[numffloors].slope = *rover->t_slope;
// Tell the renderer this sector has slopes in it.
if (ffloor[numffloors].slope)
frontsector->hasslope = true;
#endif
ffloor[numffloors].height = heightcheck;
ffloor[numffloors].ffloor = rover;
@ -1090,18 +1048,13 @@ static void R_Subsector(size_t num)
ffloor[numffloors].plane = R_FindPlane(polysec->floorheight, polysec->floorpic,
(light == -1 ? frontsector->lightlevel : *frontsector->lightlist[light].lightlevel), polysec->floor_xoffs, polysec->floor_yoffs,
polysec->floorpic_angle-po->angle,
(light == -1 ? frontsector->extra_colormap : *frontsector->lightlist[light].extra_colormap), NULL, po
#ifdef ESLOPE
, NULL // will ffloors be slopable eventually?
#endif
);
(light == -1 ? frontsector->extra_colormap : *frontsector->lightlist[light].extra_colormap), NULL, po,
NULL); // will ffloors be slopable eventually?
ffloor[numffloors].height = polysec->floorheight;
ffloor[numffloors].polyobj = po;
#ifdef ESLOPE
ffloor[numffloors].slope = NULL;
#endif
// ffloor[numffloors].ffloor = rover;
//ffloor[numffloors].ffloor = rover;
po->visplane = ffloor[numffloors].plane;
numffloors++;
}
@ -1118,18 +1071,13 @@ static void R_Subsector(size_t num)
light = R_GetPlaneLight(frontsector, polysec->floorheight, viewz < polysec->floorheight);
ffloor[numffloors].plane = R_FindPlane(polysec->ceilingheight, polysec->ceilingpic,
(light == -1 ? frontsector->lightlevel : *frontsector->lightlist[light].lightlevel), polysec->ceiling_xoffs, polysec->ceiling_yoffs, polysec->ceilingpic_angle-po->angle,
(light == -1 ? frontsector->extra_colormap : *frontsector->lightlist[light].extra_colormap), NULL, po
#ifdef ESLOPE
, NULL // will ffloors be slopable eventually?
#endif
);
(light == -1 ? frontsector->extra_colormap : *frontsector->lightlist[light].extra_colormap), NULL, po,
NULL); // will ffloors be slopable eventually?
ffloor[numffloors].polyobj = po;
ffloor[numffloors].height = polysec->ceilingheight;
#ifdef ESLOPE
ffloor[numffloors].slope = NULL;
#endif
// ffloor[numffloors].ffloor = rover;
//ffloor[numffloors].ffloor = rover;
po->visplane = ffloor[numffloors].plane;
numffloors++;
}
@ -1192,11 +1140,9 @@ void R_Prep3DFloors(sector_t *sector)
fixed_t bestheight, maxheight;
INT32 count, i;
sector_t *sec;
#ifdef ESLOPE
pslope_t *bestslope = NULL;
fixed_t heighttest; // I think it's better to check the Z height at the sector's center
// than assume unsloped heights are accurate indicators of order in sloped sectors. -Red
#endif
count = 1;
for (rover = sector->ffloors; rover; rover = rover->next)
@ -1219,14 +1165,10 @@ void R_Prep3DFloors(sector_t *sector)
else
memset(sector->lightlist, 0, sizeof (lightlist_t) * count);
#ifdef ESLOPE
heighttest = sector->c_slope ? P_GetZAt(sector->c_slope, sector->soundorg.x, sector->soundorg.y) : sector->ceilingheight;
sector->lightlist[0].height = heighttest + 1;
sector->lightlist[0].slope = sector->c_slope;
#else
sector->lightlist[0].height = sector->ceilingheight + 1;
#endif
sector->lightlist[0].lightlevel = &sector->lightlevel;
sector->lightlist[0].caster = NULL;
sector->lightlist[0].extra_colormap = &sector->extra_colormap;
@ -1244,7 +1186,6 @@ void R_Prep3DFloors(sector_t *sector)
&& !(rover->flags & FF_CUTLEVEL) && !(rover->flags & FF_CUTSPRITES)))
continue;
#ifdef ESLOPE
heighttest = *rover->t_slope ? P_GetZAt(*rover->t_slope, sector->soundorg.x, sector->soundorg.y) : *rover->topheight;
if (heighttest > bestheight && heighttest < maxheight)
@ -1266,21 +1207,6 @@ void R_Prep3DFloors(sector_t *sector)
continue;
}
}
#else
if (*rover->topheight > bestheight && *rover->topheight < maxheight)
{
best = rover;
bestheight = *rover->topheight;
continue;
}
if (rover->flags & FF_DOUBLESHADOW && *rover->bottomheight > bestheight
&& *rover->bottomheight < maxheight)
{
best = rover;
bestheight = *rover->bottomheight;
continue;
}
#endif
}
if (!best)
{
@ -1291,9 +1217,7 @@ void R_Prep3DFloors(sector_t *sector)
sector->lightlist[i].height = maxheight = bestheight;
sector->lightlist[i].caster = best;
sector->lightlist[i].flags = best->flags;
#ifdef ESLOPE
sector->lightlist[i].slope = bestslope;
#endif
sec = &sectors[best->secnum];
if (best->flags & FF_NOSHADE)
@ -1314,12 +1238,8 @@ void R_Prep3DFloors(sector_t *sector)
if (best->flags & FF_DOUBLESHADOW)
{
#ifdef ESLOPE
heighttest = *best->b_slope ? P_GetZAt(*best->b_slope, sector->soundorg.x, sector->soundorg.y) : *best->bottomheight;
if (bestheight == heighttest) ///TODO: do this in a more efficient way -Red
#else
if (bestheight == *best->bottomheight)
#endif
{
sector->lightlist[i].lightlevel = sector->lightlist[best->lastlight].lightlevel;
sector->lightlist[i].extra_colormap =

View file

@ -171,11 +171,9 @@ typedef struct ffloor_s
fixed_t *bottomyoffs;
angle_t *bottomangle;
#ifdef ESLOPE
// Pointers to pointers. Yup.
struct pslope_s **t_slope;
struct pslope_s **b_slope;
#endif
size_t secnum;
ffloortype_e flags;
@ -208,9 +206,7 @@ typedef struct lightlist_s
extracolormap_t **extra_colormap; // pointer-to-a-pointer, so we can react to colormap changes
INT32 flags;
ffloor_t *caster;
#ifdef ESLOPE
struct pslope_s *slope; // FF_DOUBLESHADOW makes me have to store this pointer here. Bluh bluh.
#endif
} lightlist_t;
@ -244,7 +240,6 @@ typedef struct linechain_s
// Slopes
#ifdef ESLOPE
typedef enum {
SL_NOPHYSICS = 1, /// This plane will have no physics applied besides the positioning.
SL_DYNAMIC = 1<<1, /// This plane slope will be assigned a thinker to make it dynamic.
@ -268,7 +263,6 @@ typedef struct pslope_s
UINT8 flags; // Slope options
} pslope_t;
#endif
typedef enum
{
@ -379,12 +373,10 @@ typedef struct sector_s
precipmobj_t *preciplist;
struct mprecipsecnode_s *touching_preciplist;
#ifdef ESLOPE
// Eternity engine slope
pslope_t *f_slope; // floor slope
pslope_t *c_slope; // ceiling slope
boolean hasslope; // The sector, or one of its visible FOFs, contains a slope
#endif
// for fade thinker
INT16 spawn_lightlevel;
@ -668,11 +660,9 @@ typedef struct drawseg_s
UINT8 portalpass; // if > 0 and <= portalrender, do not affect sprite clipping
#ifdef ESLOPE
fixed_t maskedtextureheight[MAXVIDWIDTH]; // For handling sloped midtextures
vertex_t leftpos, rightpos; // Used for rendering FOF walls with slopes
#endif
} drawseg_t;
typedef enum

View file

@ -105,12 +105,10 @@ boolean ds_powersoftwo;
UINT8 *ds_source; // start of a 64*64 tile image
UINT8 *ds_transmap; // one of the translucency tables
#ifdef ESLOPE
pslope_t *ds_slope; // Current slope being used
floatv3_t ds_su[MAXVIDHEIGHT], ds_sv[MAXVIDHEIGHT], ds_sz[MAXVIDHEIGHT]; // Vectors for... stuff?
floatv3_t *ds_sup, *ds_svp, *ds_szp;
float focallengthf, zeroheight;
#endif
/** \brief Variable flat sizes
*/

View file

@ -62,7 +62,6 @@ extern boolean ds_powersoftwo;
extern UINT8 *ds_source;
extern UINT8 *ds_transmap;
#ifdef ESLOPE
typedef struct {
float x, y, z;
} floatv3_t;
@ -71,7 +70,6 @@ extern pslope_t *ds_slope; // Current slope being used
extern floatv3_t ds_su[MAXVIDHEIGHT], ds_sv[MAXVIDHEIGHT], ds_sz[MAXVIDHEIGHT]; // Vectors for... stuff?
extern floatv3_t *ds_sup, *ds_svp, *ds_szp;
extern float focallengthf, zeroheight;
#endif
// Variable flat sizes
extern UINT32 nflatxshift;
@ -152,7 +150,6 @@ void R_DrawSpan_8(void);
void R_DrawSplat_8(void);
void R_DrawTranslucentSpan_8(void);
void R_DrawTranslucentSplat_8(void);
#ifdef ESLOPE
void R_DrawTiltedSpan_8(void);
void R_DrawTiltedTranslucentSpan_8(void);
#ifndef NOWATER
@ -161,7 +158,6 @@ void R_DrawTiltedTranslucentWaterSpan_8(void);
void R_DrawTiltedSplat_8(void);
void R_CalcTiltedLighting(fixed_t start, fixed_t end);
extern INT32 tiltlighting[MAXVIDWIDTH];
#endif
#ifndef NOWATER
void R_DrawTranslucentWaterSpan_8(void);
extern INT32 ds_bgofs;
@ -174,14 +170,12 @@ void R_DrawSpan_NPO2_8(void);
void R_DrawTranslucentSpan_NPO2_8(void);
void R_DrawSplat_NPO2_8(void);
void R_DrawTranslucentSplat_NPO2_8(void);
#ifdef ESLOPE
void R_DrawTiltedSpan_NPO2_8(void);
void R_DrawTiltedTranslucentSpan_NPO2_8(void);
#ifndef NOWATER
void R_DrawTiltedTranslucentWaterSpan_NPO2_8(void);
#endif
void R_DrawTiltedSplat_NPO2_8(void);
#endif
#ifndef NOWATER
void R_DrawTranslucentWaterSpan_NPO2_8(void);
#endif

View file

@ -620,7 +620,6 @@ void R_DrawSpan_8 (void)
}
}
#ifdef ESLOPE
// R_CalcTiltedLighting
// Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly.
INT32 tiltlighting[MAXVIDWIDTH];
@ -1199,7 +1198,6 @@ void R_DrawTiltedSplat_8(void)
}
#endif
}
#endif // ESLOPE
/** \brief The R_DrawSplat_8 function
Just like R_DrawSpan_8, but skips transparent pixels.

View file

@ -61,8 +61,6 @@ void R_DrawSpan_NPO2_8 (void)
}
}
#ifdef ESLOPE
#define PLANELIGHTFLOAT (BASEVIDWIDTH * BASEVIDWIDTH / vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f * FIXED_TO_FLOAT(fovtan))
/** \brief The R_DrawTiltedSpan_NPO2_8 function
@ -661,7 +659,6 @@ void R_DrawTiltedSplat_NPO2_8(void)
}
#endif
}
#endif // ESLOPE
/** \brief The R_DrawSplat_NPO2_8 function
Just like R_DrawSpan_NPO2_8, but skips transparent pixels.
@ -846,7 +843,6 @@ void R_DrawTranslucentWaterSpan_NPO2_8(void)
}
}
#ifdef ESLOPE
/** \brief The R_DrawTiltedTranslucentWaterSpan_NPO2_8 function
Like DrawTiltedTranslucentSpan_NPO2, but for water
*/
@ -1043,5 +1039,4 @@ void R_DrawTiltedTranslucentWaterSpan_NPO2_8(void)
}
#endif
}
#endif // ESLOPE
#endif // NOWATER

View file

@ -459,9 +459,7 @@ static void R_InitTextureMapping(void)
focallength = FixedDiv(projection,
FINETANGENT(FINEANGLES/4+FIELDOFVIEW/2));
#ifdef ESLOPE
focallengthf = FIXED_TO_FLOAT(focallength);
#endif
for (i = 0; i < FINEANGLES/2; i++)
{

View file

@ -202,7 +202,6 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
// Needed for ds_bgofs
R_PlaneRipple(currentplane, y, planeheight);
#ifdef ESLOPE
if (currentplane->slope)
{
ds_sup = &ds_su[y];
@ -210,7 +209,6 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
ds_szp = &ds_sz[y];
}
else
#endif
{
ds_xfrac += ripple_xfrac;
ds_yfrac += ripple_yfrac;
@ -227,12 +225,10 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
if (pindex >= MAXLIGHTZ)
pindex = MAXLIGHTZ - 1;
#ifdef ESLOPE
if (currentplane->slope)
ds_colormap = colormaps;
else
#endif
ds_colormap = planezlight[pindex];
ds_colormap = planezlight[pindex];
if (currentplane->extra_colormap)
ds_colormap = currentplane->extra_colormap->colormap + (ds_colormap - colormaps);
@ -345,17 +341,12 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
#ifdef POLYOBJECTS_PLANES
, polyobj_t *polyobj
#endif
#ifdef ESLOPE
, pslope_t *slope
#endif
)
, pslope_t *slope)
{
visplane_t *check;
unsigned hash;
#ifdef ESLOPE
if (slope); else // Don't mess with this right now if a slope is involved
#endif
if (!slope) // Don't mess with this right now if a slope is involved
{
xoff += viewx;
yoff -= viewy;
@ -413,10 +404,7 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
&& check->viewx == viewx && check->viewy == viewy && check->viewz == viewz
&& check->viewangle == viewangle
&& check->plangle == plangle
#ifdef ESLOPE
&& check->slope == slope
#endif
)
&& check->slope == slope)
{
return check;
}
@ -441,9 +429,7 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
#ifdef POLYOBJECTS_PLANES
check->polyobj = polyobj;
#endif
#ifdef ESLOPE
check->slope = slope;
#endif
memset(check->top, 0xff, sizeof (check->top));
memset(check->bottom, 0x00, sizeof (check->bottom));
@ -513,9 +499,7 @@ visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop)
#ifdef POLYOBJECTS_PLANES
new_pl->polyobj = pl->polyobj;
#endif
#ifdef ESLOPE
new_pl->slope = pl->slope;
#endif
pl = new_pl;
pl->minx = start;
pl->maxx = stop;
@ -860,7 +844,6 @@ static UINT8 *R_GetTextureFlat(levelflat_t *levelflat, boolean leveltexture, boo
return flat;
}
#ifdef ESLOPE
static void R_SlopeVectors(visplane_t *pl, INT32 i, float fudge)
{
// Potentially override other stuff for now cus we're mean. :< But draw a slope plane!
@ -951,7 +934,6 @@ d.z = (v1.x * v2.y) - (v1.y * v2.x)
}
#undef SFMULT
}
#endif // ESLOPE
void R_DrawSinglePlane(visplane_t *pl)
{
@ -1087,10 +1069,8 @@ void R_DrawSinglePlane(visplane_t *pl)
}
else light = (pl->lightlevel >> LIGHTSEGSHIFT);
#ifdef ESLOPE
if (!pl->slope) // Don't mess with angle on slopes! We'll handle this ourselves later
#endif
if (viewangle != pl->viewangle+pl->plangle)
if (!pl->slope // Don't mess with angle on slopes! We'll handle this ourselves later
&& viewangle != pl->viewangle+pl->plangle)
{
memset(cachedheight, 0, sizeof (cachedheight));
angle = (pl->viewangle+pl->plangle-ANGLE_90)>>ANGLETOFINESHIFT;
@ -1148,7 +1128,6 @@ void R_DrawSinglePlane(visplane_t *pl)
if (light < 0)
light = 0;
#ifdef ESLOPE
if (pl->slope)
{
float fudgecanyon = 0;
@ -1248,10 +1227,9 @@ void R_DrawSinglePlane(visplane_t *pl)
spanfunctype = SPANDRAWFUNC_TILTED;
planezlight = scalelight[light];
} else
#endif // ESLOPE
planezlight = zlight[light];
}
else
planezlight = zlight[light];
// Use the correct span drawer depending on the powers-of-twoness
if (!ds_powersoftwo)

View file

@ -50,9 +50,7 @@ typedef struct visplane_s
#ifdef POLYOBJECTS_PLANES
polyobj_t *polyobj;
#endif
#ifdef ESLOPE
pslope_t *slope;
#endif
} visplane_t;
extern visplane_t *visplanes[MAXVISPLANES];
@ -86,10 +84,7 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, fixed_t
#ifdef POLYOBJECTS_PLANES
, polyobj_t *polyobj
#endif
#ifdef ESLOPE
, pslope_t *slope
#endif
);
, pslope_t *slope);
visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop);
void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop);
void R_PlaneBounds(visplane_t *plane);
@ -110,13 +105,11 @@ typedef struct planemgr_s
INT16 f_clip[MAXVIDWIDTH];
INT16 c_clip[MAXVIDWIDTH];
#ifdef ESLOPE
// For slope rendering; the height at the other end
fixed_t f_pos_slope;
fixed_t b_pos_slope;
struct pslope_s *slope;
#endif
struct ffloor_s *ffloor;
#ifdef POLYOBJECTS_PLANES

File diff suppressed because it is too large Load diff

825
src/r_skins.c Normal file
View file

@ -0,0 +1,825 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file r_skins.c
/// \brief Loading skins
#include "doomdef.h"
#include "console.h"
#include "g_game.h"
#include "r_local.h"
#include "st_stuff.h"
#include "w_wad.h"
#include "z_zone.h"
#include "m_misc.h"
#include "info.h" // spr2names
#include "i_video.h" // rendermode
#include "i_system.h"
#include "r_things.h"
#include "r_skins.h"
#include "p_local.h"
#include "dehacked.h" // get_number (for thok)
#include "m_cond.h"
#ifdef HWRENDER
#include "hardware/hw_md2.h"
#endif
#ifdef PC_DOS
#include <stdio.h> // for snprintf
int snprintf(char *str, size_t n, const char *fmt, ...);
//int vsnprintf(char *str, size_t n, const char *fmt, va_list ap);
#endif
INT32 numskins = 0;
skin_t skins[MAXSKINS];
// FIXTHIS: don't work because it must be inistilised before the config load
//#define SKINVALUES
#ifdef SKINVALUES
CV_PossibleValue_t skin_cons_t[MAXSKINS+1];
#endif
//
// P_GetSkinSprite2
// For non-super players, tries each sprite2's immediate predecessor until it finds one with a number of frames or ends up at standing.
// For super players, does the same as above - but tries the super equivalent for each sprite2 before the non-super version.
//
UINT8 P_GetSkinSprite2(skin_t *skin, UINT8 spr2, player_t *player)
{
UINT8 super = 0, i = 0;
if (!skin)
return 0;
if ((playersprite_t)(spr2 & ~FF_SPR2SUPER) >= free_spr2)
return 0;
while (!skin->sprites[spr2].numframes
&& spr2 != SPR2_STND
&& ++i < 32) // recursion limiter
{
if (spr2 & FF_SPR2SUPER)
{
super = FF_SPR2SUPER;
spr2 &= ~FF_SPR2SUPER;
continue;
}
switch(spr2)
{
// Normal special cases.
case SPR2_JUMP:
spr2 = ((player
? player->charflags
: skin->flags)
& SF_NOJUMPSPIN) ? SPR2_SPNG : SPR2_ROLL;
break;
case SPR2_TIRE:
spr2 = ((player
? player->charability
: skin->ability)
== CA_SWIM) ? SPR2_SWIM : SPR2_FLY;
break;
// Use the handy list, that's what it's there for!
default:
spr2 = spr2defaults[spr2];
break;
}
spr2 |= super;
}
if (i >= 32) // probably an infinite loop...
return 0;
return spr2;
}
static void Sk_SetDefaultValue(skin_t *skin)
{
INT32 i;
//
// set default skin values
//
memset(skin, 0, sizeof (skin_t));
snprintf(skin->name,
sizeof skin->name, "skin %u", (UINT32)(skin-skins));
skin->name[sizeof skin->name - 1] = '\0';
skin->wadnum = INT16_MAX;
skin->flags = 0;
strcpy(skin->realname, "Someone");
strcpy(skin->hudname, "???");
skin->starttranscolor = 96;
skin->prefcolor = SKINCOLOR_GREEN;
skin->supercolor = SKINCOLOR_SUPERGOLD1;
skin->prefoppositecolor = 0; // use tables
skin->normalspeed = 36<<FRACBITS;
skin->runspeed = 28<<FRACBITS;
skin->thrustfactor = 5;
skin->accelstart = 96;
skin->acceleration = 40;
skin->ability = CA_NONE;
skin->ability2 = CA2_SPINDASH;
skin->jumpfactor = FRACUNIT;
skin->actionspd = 30<<FRACBITS;
skin->mindash = 15<<FRACBITS;
skin->maxdash = 70<<FRACBITS;
skin->radius = mobjinfo[MT_PLAYER].radius;
skin->height = mobjinfo[MT_PLAYER].height;
skin->spinheight = FixedMul(skin->height, 2*FRACUNIT/3);
skin->shieldscale = FRACUNIT;
skin->camerascale = FRACUNIT;
skin->thokitem = -1;
skin->spinitem = -1;
skin->revitem = -1;
skin->followitem = 0;
skin->highresscale = FRACUNIT;
skin->contspeed = 17;
skin->contangle = 0;
skin->availability = 0;
for (i = 0; i < sfx_skinsoundslot0; i++)
if (S_sfx[i].skinsound != -1)
skin->soundsid[S_sfx[i].skinsound] = i;
}
//
// Initialize the basic skins
//
void R_InitSkins(void)
{
#ifdef SKINVALUES
INT32 i;
for (i = 0; i <= MAXSKINS; i++)
{
skin_cons_t[i].value = 0;
skin_cons_t[i].strvalue = NULL;
}
#endif
// no default skin!
numskins = 0;
}
UINT32 R_GetSkinAvailabilities(void)
{
INT32 s;
UINT32 response = 0;
for (s = 0; s < MAXSKINS; s++)
{
if (skins[s].availability && unlockables[skins[s].availability - 1].unlocked)
response |= (1 << s);
}
return response;
}
// returns true if available in circumstances, otherwise nope
// warning don't use with an invalid skinnum other than -1 which always returns true
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)
|| (((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.
|| (metalrecording && skinnum == 5) // Force 3.
);
}
// returns true if the skin name is found (loaded from pwad)
// warning return -1 if not found
INT32 R_SkinAvailable(const char *name)
{
INT32 i;
for (i = 0; i < numskins; i++)
{
// search in the skin list
if (stricmp(skins[i].name,name)==0)
return i;
}
return -1;
}
// network code calls this when a 'skin change' is received
void SetPlayerSkin(INT32 playernum, const char *skinname)
{
INT32 i = R_SkinAvailable(skinname);
player_t *player = &players[playernum];
if ((i != -1) && R_SkinUsable(playernum, i))
{
SetPlayerSkinByNum(playernum, i);
return;
}
if (P_IsLocalPlayer(player))
CONS_Alert(CONS_WARNING, M_GetText("Skin '%s' not found.\n"), skinname);
else if(server || IsPlayerAdmin(consoleplayer))
CONS_Alert(CONS_WARNING, M_GetText("Player %d (%s) skin '%s' not found\n"), playernum, player_names[playernum], skinname);
SetPlayerSkinByNum(playernum, 0);
}
// Same as SetPlayerSkin, but uses the skin #.
// network code calls this when a 'skin change' is received
void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
{
player_t *player = &players[playernum];
skin_t *skin = &skins[skinnum];
UINT8 newcolor = 0;
if (skinnum >= 0 && skinnum < numskins && R_SkinUsable(playernum, skinnum)) // Make sure it exists!
{
player->skin = skinnum;
player->camerascale = skin->camerascale;
player->shieldscale = skin->shieldscale;
player->charability = (UINT8)skin->ability;
player->charability2 = (UINT8)skin->ability2;
player->charflags = (UINT32)skin->flags;
player->thokitem = skin->thokitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].painchance : (UINT32)skin->thokitem;
player->spinitem = skin->spinitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].damage : (UINT32)skin->spinitem;
player->revitem = skin->revitem < 0 ? (mobjtype_t)mobjinfo[MT_PLAYER].raisestate : (UINT32)skin->revitem;
player->followitem = skin->followitem;
if (((player->powers[pw_shield] & SH_NOSTACK) == SH_PINK) && (player->revitem == MT_LHRT || player->spinitem == MT_LHRT || player->thokitem == MT_LHRT)) // Healers can't keep their buff.
player->powers[pw_shield] &= SH_STACK;
player->actionspd = skin->actionspd;
player->mindash = skin->mindash;
player->maxdash = skin->maxdash;
player->normalspeed = skin->normalspeed;
player->runspeed = skin->runspeed;
player->thrustfactor = skin->thrustfactor;
player->accelstart = skin->accelstart;
player->acceleration = skin->acceleration;
player->jumpfactor = skin->jumpfactor;
player->height = skin->height;
player->spinheight = skin->spinheight;
if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback))
{
if (playernum == consoleplayer)
CV_StealthSetValue(&cv_playercolor, skin->prefcolor);
else if (playernum == secondarydisplayplayer)
CV_StealthSetValue(&cv_playercolor2, skin->prefcolor);
player->skincolor = newcolor = skin->prefcolor;
}
if (player->followmobj)
{
P_RemoveMobj(player->followmobj);
P_SetTarget(&player->followmobj, NULL);
}
if (player->mo)
{
fixed_t radius = FixedMul(skin->radius, player->mo->scale);
if ((player->powers[pw_carry] == CR_NIGHTSMODE) && (skin->sprites[SPR2_NFLY].numframes == 0)) // If you don't have a sprite for flying horizontally, use the default NiGHTS skin.
{
skin = &skins[DEFAULTNIGHTSSKIN];
player->followitem = skin->followitem;
if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback))
newcolor = skin->prefcolor; // will be updated in thinker to flashing
}
player->mo->skin = skin;
if (newcolor)
player->mo->color = newcolor;
P_SetScale(player->mo, player->mo->scale);
player->mo->radius = radius;
P_SetPlayerMobjState(player->mo, player->mo->state-states); // Prevent visual errors when switching between skins with differing number of frames
}
return;
}
if (P_IsLocalPlayer(player))
CONS_Alert(CONS_WARNING, M_GetText("Requested skin %d not found\n"), skinnum);
else if(server || IsPlayerAdmin(consoleplayer))
CONS_Alert(CONS_WARNING, "Player %d (%s) skin %d not found\n", playernum, player_names[playernum], skinnum);
SetPlayerSkinByNum(playernum, 0); // not found put the sonic skin
}
//
// Add skins from a pwad, each skin preceded by 'S_SKIN' marker
//
// Does the same is in w_wad, but check only for
// the first 6 characters (this is so we can have S_SKIN1, S_SKIN2..
// for wad editors that don't like multiple resources of the same name)
//
static UINT16 W_CheckForSkinMarkerInPwad(UINT16 wadid, UINT16 startlump)
{
UINT16 i;
const char *S_SKIN = "S_SKIN";
lumpinfo_t *lump_p;
// scan forward, start at <startlump>
if (startlump < wadfiles[wadid]->numlumps)
{
lump_p = wadfiles[wadid]->lumpinfo + startlump;
for (i = startlump; i < wadfiles[wadid]->numlumps; i++, lump_p++)
if (memcmp(lump_p->name,S_SKIN,6)==0)
return i;
}
return INT16_MAX; // not found
}
#define HUDNAMEWRITE(value) STRBUFCPY(skin->hudname, value)
// turn _ into spaces and . into katana dot
#define SYMBOLCONVERT(name) for (value = name; *value; value++)\
{\
if (*value == '_') *value = ' ';\
else if (*value == '.') *value = '\x1E';\
}
//
// Patch skins from a pwad, each skin preceded by 'P_SKIN' marker
//
// Does the same is in w_wad, but check only for
// the first 6 characters (this is so we can have P_SKIN1, P_SKIN2..
// for wad editors that don't like multiple resources of the same name)
//
static UINT16 W_CheckForPatchSkinMarkerInPwad(UINT16 wadid, UINT16 startlump)
{
UINT16 i;
const char *P_SKIN = "P_SKIN";
lumpinfo_t *lump_p;
// scan forward, start at <startlump>
if (startlump < wadfiles[wadid]->numlumps)
{
lump_p = wadfiles[wadid]->lumpinfo + startlump;
for (i = startlump; i < wadfiles[wadid]->numlumps; i++, lump_p++)
if (memcmp(lump_p->name,P_SKIN,6)==0)
return i;
}
return INT16_MAX; // not found
}
static void R_LoadSkinSprites(UINT16 wadnum, UINT16 *lump, UINT16 *lastlump, skin_t *skin)
{
UINT16 newlastlump;
UINT8 sprite2;
*lump += 1; // start after S_SKIN
*lastlump = W_CheckNumForNamePwad("S_END",wadnum,*lump); // stop at S_END
// old wadding practices die hard -- stop at S_SKIN (or P_SKIN) or S_START if they come before S_END.
newlastlump = W_CheckForSkinMarkerInPwad(wadnum,*lump);
if (newlastlump < *lastlump) *lastlump = newlastlump;
newlastlump = W_CheckForPatchSkinMarkerInPwad(wadnum,*lump);
if (newlastlump < *lastlump) *lastlump = newlastlump;
newlastlump = W_CheckNumForNamePwad("S_START",wadnum,*lump);
if (newlastlump < *lastlump) *lastlump = newlastlump;
// ...and let's handle super, too
newlastlump = W_CheckNumForNamePwad("S_SUPER",wadnum,*lump);
if (newlastlump < *lastlump)
{
newlastlump++;
// load all sprite sets we are aware of... for super!
for (sprite2 = 0; sprite2 < free_spr2; sprite2++)
R_AddSingleSpriteDef(spr2names[sprite2], &skin->sprites[FF_SPR2SUPER|sprite2], wadnum, newlastlump, *lastlump);
newlastlump--;
*lastlump = newlastlump; // okay, make the normal sprite set loading end there
}
// load all sprite sets we are aware of... for normal stuff.
for (sprite2 = 0; sprite2 < free_spr2; sprite2++)
R_AddSingleSpriteDef(spr2names[sprite2], &skin->sprites[sprite2], wadnum, *lump, *lastlump);
if (skin->sprites[0].numframes == 0)
I_Error("R_LoadSkinSprites: no frames found for sprite SPR2_%s\n", spr2names[0]);
}
// returns whether found appropriate property
static boolean R_ProcessPatchableFields(skin_t *skin, char *stoken, char *value)
{
// custom translation table
if (!stricmp(stoken, "startcolor"))
skin->starttranscolor = atoi(value);
#define FULLPROCESS(field) else if (!stricmp(stoken, #field)) skin->field = get_number(value);
// character type identification
FULLPROCESS(flags)
FULLPROCESS(ability)
FULLPROCESS(ability2)
FULLPROCESS(thokitem)
FULLPROCESS(spinitem)
FULLPROCESS(revitem)
FULLPROCESS(followitem)
#undef FULLPROCESS
#define GETFRACBITS(field) else if (!stricmp(stoken, #field)) skin->field = atoi(value)<<FRACBITS;
GETFRACBITS(normalspeed)
GETFRACBITS(runspeed)
GETFRACBITS(mindash)
GETFRACBITS(maxdash)
GETFRACBITS(actionspd)
GETFRACBITS(radius)
GETFRACBITS(height)
GETFRACBITS(spinheight)
#undef GETFRACBITS
#define GETINT(field) else if (!stricmp(stoken, #field)) skin->field = atoi(value);
GETINT(thrustfactor)
GETINT(accelstart)
GETINT(acceleration)
GETINT(contspeed)
GETINT(contangle)
#undef GETINT
#define GETSKINCOLOR(field) else if (!stricmp(stoken, #field)) skin->field = R_GetColorByName(value);
GETSKINCOLOR(prefcolor)
GETSKINCOLOR(prefoppositecolor)
#undef GETSKINCOLOR
else if (!stricmp(stoken, "supercolor"))
skin->supercolor = R_GetSuperColorByName(value);
#define GETFLOAT(field) else if (!stricmp(stoken, #field)) skin->field = FLOAT_TO_FIXED(atof(value));
GETFLOAT(jumpfactor)
GETFLOAT(highresscale)
GETFLOAT(shieldscale)
GETFLOAT(camerascale)
#undef GETFLOAT
#define GETFLAG(field) else if (!stricmp(stoken, #field)) { \
strupr(value); \
if (atoi(value) || value[0] == 'T' || value[0] == 'Y') \
skin->flags |= (SF_##field); \
else \
skin->flags &= ~(SF_##field); \
}
// parameters for individual character flags
// these are uppercase so they can be concatenated with SF_
// 1, true, yes are all valid values
GETFLAG(SUPER)
GETFLAG(NOSUPERSPIN)
GETFLAG(NOSPINDASHDUST)
GETFLAG(HIRES)
GETFLAG(NOSKID)
GETFLAG(NOSPEEDADJUST)
GETFLAG(RUNONWATER)
GETFLAG(NOJUMPSPIN)
GETFLAG(NOJUMPDAMAGE)
GETFLAG(STOMPDAMAGE)
GETFLAG(MARIODAMAGE)
GETFLAG(MACHINE)
GETFLAG(DASHMODE)
GETFLAG(FASTEDGE)
GETFLAG(MULTIABILITY)
GETFLAG(NONIGHTSROTATION)
#undef GETFLAG
else // let's check if it's a sound, otherwise error out
{
boolean found = false;
sfxenum_t i;
size_t stokenadjust;
// Remove the prefix. (We need to affect an adjusting variable so that we can print error messages if it's not actually a sound.)
if ((stoken[0] == 'D' || stoken[0] == 'd') && (stoken[1] == 'S' || stoken[1] == 's')) // DS*
stokenadjust = 2;
else // sfx_*
stokenadjust = 4;
// Remove the prefix. (We can affect this directly since we're not going to use it again.)
if ((value[0] == 'D' || value[0] == 'd') && (value[1] == 'S' || value[1] == 's')) // DS*
value += 2;
else // sfx_*
value += 4;
// copy name of sounds that are remapped
// for this skin
for (i = 0; i < sfx_skinsoundslot0; i++)
{
if (!S_sfx[i].name)
continue;
if (S_sfx[i].skinsound != -1
&& !stricmp(S_sfx[i].name,
stoken + stokenadjust))
{
skin->soundsid[S_sfx[i].skinsound] =
S_AddSoundFx(value, S_sfx[i].singularity, S_sfx[i].pitch, true);
found = true;
}
}
return found;
}
return true;
}
//
// Find skin sprites, sounds & optional status bar face, & add them
//
void R_AddSkins(UINT16 wadnum)
{
UINT16 lump, lastlump = 0;
char *buf;
char *buf2;
char *stoken;
char *value;
size_t size;
skin_t *skin;
boolean hudname, realname;
//
// search for all skin markers in pwad
//
while ((lump = W_CheckForSkinMarkerInPwad(wadnum, lastlump)) != INT16_MAX)
{
// advance by default
lastlump = lump + 1;
if (numskins >= MAXSKINS)
{
CONS_Debug(DBG_RENDER, "ignored skin (%d skins maximum)\n", MAXSKINS);
continue; // so we know how many skins couldn't be added
}
buf = W_CacheLumpNumPwad(wadnum, lump, PU_CACHE);
size = W_LumpLengthPwad(wadnum, lump);
// for strtok
buf2 = malloc(size+1);
if (!buf2)
I_Error("R_AddSkins: No more free memory\n");
M_Memcpy(buf2,buf,size);
buf2[size] = '\0';
// set defaults
skin = &skins[numskins];
Sk_SetDefaultValue(skin);
skin->wadnum = wadnum;
hudname = realname = false;
// parse
stoken = strtok (buf2, "\r\n= ");
while (stoken)
{
if ((stoken[0] == '/' && stoken[1] == '/')
|| (stoken[0] == '#'))// skip comments
{
stoken = strtok(NULL, "\r\n"); // skip end of line
goto next_token; // find the real next token
}
value = strtok(NULL, "\r\n= ");
if (!value)
I_Error("R_AddSkins: syntax error in S_SKIN lump# %d(%s) in WAD %s\n", lump, W_CheckNameForNumPwad(wadnum,lump), wadfiles[wadnum]->filename);
// Some of these can't go in R_ProcessPatchableFields because they have side effects for future lines.
// Others can't go in there because we don't want them to be patchable.
if (!stricmp(stoken, "name"))
{
INT32 skinnum = R_SkinAvailable(value);
strlwr(value);
if (skinnum == -1)
STRBUFCPY(skin->name, value);
// the skin name must uniquely identify a single skin
// if the name is already used I make the name 'namex'
// using the default skin name's number set above
else
{
const size_t stringspace =
strlen(value) + sizeof (numskins) + 1;
char *value2 = Z_Malloc(stringspace, PU_STATIC, NULL);
snprintf(value2, stringspace,
"%s%d", value, numskins);
value2[stringspace - 1] = '\0';
if (R_SkinAvailable(value2) == -1)
// I'm lazy so if NEW name is already used I leave the 'skin x'
// default skin name set in Sk_SetDefaultValue
STRBUFCPY(skin->name, value2);
Z_Free(value2);
}
// copy to hudname and fullname as a default.
if (!realname)
{
STRBUFCPY(skin->realname, skin->name);
for (value = skin->realname; *value; value++)
{
if (*value == '_') *value = ' '; // turn _ into spaces.
else if (*value == '.') *value = '\x1E'; // turn . into katana dot.
}
}
if (!hudname)
{
HUDNAMEWRITE(skin->name);
strupr(skin->hudname);
SYMBOLCONVERT(skin->hudname)
}
}
else if (!stricmp(stoken, "realname"))
{ // Display name (eg. "Knuckles")
realname = true;
STRBUFCPY(skin->realname, value);
SYMBOLCONVERT(skin->realname)
if (!hudname)
HUDNAMEWRITE(skin->realname);
}
else if (!stricmp(stoken, "hudname"))
{ // Life icon name (eg. "K.T.E")
hudname = true;
HUDNAMEWRITE(value);
SYMBOLCONVERT(skin->hudname)
if (!realname)
STRBUFCPY(skin->realname, skin->hudname);
}
else if (!stricmp(stoken, "availability"))
{
skin->availability = atoi(value);
if (skin->availability >= MAXUNLOCKABLES)
skin->availability = 0;
}
else if (!R_ProcessPatchableFields(skin, stoken, value))
CONS_Debug(DBG_SETUP, "R_AddSkins: Unknown keyword '%s' in S_SKIN lump #%d (WAD %s)\n", stoken, lump, wadfiles[wadnum]->filename);
next_token:
stoken = strtok(NULL, "\r\n= ");
}
free(buf2);
// Add sprites
R_LoadSkinSprites(wadnum, &lump, &lastlump, skin);
//ST_LoadFaceGraphics(numskins); -- nah let's do this elsewhere
R_FlushTranslationColormapCache();
if (!skin->availability) // Safe to print...
CONS_Printf(M_GetText("Added skin '%s'\n"), skin->name);
#ifdef SKINVALUES
skin_cons_t[numskins].value = numskins;
skin_cons_t[numskins].strvalue = skin->name;
#endif
#ifdef HWRENDER
if (rendermode == render_opengl)
HWR_AddPlayerModel(numskins);
#endif
numskins++;
}
return;
}
//
// Patch skin sprites
//
void R_PatchSkins(UINT16 wadnum)
{
UINT16 lump, lastlump = 0;
char *buf;
char *buf2;
char *stoken;
char *value;
size_t size;
skin_t *skin;
boolean noskincomplain, realname, hudname;
//
// search for all skin patch markers in pwad
//
while ((lump = W_CheckForPatchSkinMarkerInPwad(wadnum, lastlump)) != INT16_MAX)
{
INT32 skinnum = 0;
// advance by default
lastlump = lump + 1;
buf = W_CacheLumpNumPwad(wadnum, lump, PU_CACHE);
size = W_LumpLengthPwad(wadnum, lump);
// for strtok
buf2 = malloc(size+1);
if (!buf2)
I_Error("R_PatchSkins: No more free memory\n");
M_Memcpy(buf2,buf,size);
buf2[size] = '\0';
skin = NULL;
noskincomplain = realname = hudname = false;
/*
Parse. Has more phases than the parser in R_AddSkins because it needs to have the patching name first (no default skin name is acceptible for patching, unlike skin creation)
*/
stoken = strtok(buf2, "\r\n= ");
while (stoken)
{
if ((stoken[0] == '/' && stoken[1] == '/')
|| (stoken[0] == '#'))// skip comments
{
stoken = strtok(NULL, "\r\n"); // skip end of line
goto next_token; // find the real next token
}
value = strtok(NULL, "\r\n= ");
if (!value)
I_Error("R_PatchSkins: syntax error in P_SKIN lump# %d(%s) in WAD %s\n", lump, W_CheckNameForNumPwad(wadnum,lump), wadfiles[wadnum]->filename);
if (!skin) // Get the name!
{
if (!stricmp(stoken, "name"))
{
strlwr(value);
skinnum = R_SkinAvailable(value);
if (skinnum != -1)
skin = &skins[skinnum];
else
{
CONS_Debug(DBG_SETUP, "R_PatchSkins: unknown skin name in P_SKIN lump# %d(%s) in WAD %s\n", lump, W_CheckNameForNumPwad(wadnum,lump), wadfiles[wadnum]->filename);
noskincomplain = true;
}
}
}
else // Get the properties!
{
// Some of these can't go in R_ProcessPatchableFields because they have side effects for future lines.
if (!stricmp(stoken, "realname"))
{ // Display name (eg. "Knuckles")
realname = true;
STRBUFCPY(skin->realname, value);
SYMBOLCONVERT(skin->realname)
if (!hudname)
HUDNAMEWRITE(skin->realname);
}
else if (!stricmp(stoken, "hudname"))
{ // Life icon name (eg. "K.T.E")
hudname = true;
HUDNAMEWRITE(value);
SYMBOLCONVERT(skin->hudname)
if (!realname)
STRBUFCPY(skin->realname, skin->hudname);
}
else if (!R_ProcessPatchableFields(skin, stoken, value))
CONS_Debug(DBG_SETUP, "R_PatchSkins: Unknown keyword '%s' in P_SKIN lump #%d (WAD %s)\n", stoken, lump, wadfiles[wadnum]->filename);
}
if (!skin)
break;
next_token:
stoken = strtok(NULL, "\r\n= ");
}
free(buf2);
if (!skin) // Didn't include a name parameter? What a waste.
{
if (!noskincomplain)
CONS_Debug(DBG_SETUP, "R_PatchSkins: no skin name given in P_SKIN lump #%d (WAD %s)\n", lump, wadfiles[wadnum]->filename);
continue;
}
// Patch sprites
R_LoadSkinSprites(wadnum, &lump, &lastlump, skin);
//ST_LoadFaceGraphics(skinnum); -- nah let's do this elsewhere
R_FlushTranslationColormapCache();
if (!skin->availability) // Safe to print...
CONS_Printf(M_GetText("Patched skin '%s'\n"), skin->name);
}
return;
}
#undef HUDNAMEWRITE
#undef SYMBOLCONVERT

103
src/r_skins.h Normal file
View file

@ -0,0 +1,103 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2020 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file r_skins.h
/// \brief Skins stuff
#ifndef __R_SKINS__
#define __R_SKINS__
#include "info.h"
#include "sounds.h"
#include "d_player.h" // skinflags
#include "r_patch.h" // spriteinfo_t
#include "r_defs.h" // spritedef_t
/// Defaults
#define SKINNAMESIZE 16
// should be all lowercase!! S_SKIN processing does a strlwr
#define DEFAULTSKIN "sonic"
#define DEFAULTSKIN2 "tails" // secondary player
#define DEFAULTNIGHTSSKIN 0
/// The skin_t struct
typedef struct
{
char name[SKINNAMESIZE+1]; // INT16 descriptive name of the skin
UINT16 wadnum;
skinflags_t flags;
char realname[SKINNAMESIZE+1]; // Display name for level completion.
char hudname[SKINNAMESIZE+1]; // HUD name to display (officially exactly 5 characters long)
UINT8 ability; // ability definition
UINT8 ability2; // secondary ability definition
INT32 thokitem;
INT32 spinitem;
INT32 revitem;
INT32 followitem;
fixed_t actionspd;
fixed_t mindash;
fixed_t maxdash;
fixed_t normalspeed; // Normal ground
fixed_t runspeed; // Speed that you break into your run animation
UINT8 thrustfactor; // Thrust = thrustfactor * acceleration
UINT8 accelstart; // Acceleration if speed = 0
UINT8 acceleration; // Acceleration
fixed_t jumpfactor; // multiple of standard jump height
fixed_t radius; // Bounding box changes.
fixed_t height;
fixed_t spinheight;
fixed_t shieldscale; // no change to bounding box, but helps set the shield's sprite size
fixed_t camerascale;
// Definable color translation table
UINT8 starttranscolor;
UINT8 prefcolor;
UINT8 supercolor;
UINT8 prefoppositecolor; // if 0 use tables instead
fixed_t highresscale; // scale of highres, default is 0.5
UINT8 contspeed; // continue screen animation speed
UINT8 contangle; // initial angle on continue screen
// specific sounds per skin
sfxenum_t soundsid[NUMSKINSOUNDS]; // sound # in S_sfx table
// contains super versions too
spritedef_t sprites[NUMPLAYERSPRITES*2];
spriteinfo_t sprinfo[NUMPLAYERSPRITES*2];
UINT8 availability; // lock?
} skin_t;
/// Externs
extern INT32 numskins;
extern skin_t skins[MAXSKINS];
/// Function prototypes
void R_InitSkins(void);
void SetPlayerSkin(INT32 playernum,const char *skinname);
void SetPlayerSkinByNum(INT32 playernum,INT32 skinnum); // Tails 03-16-2002
boolean R_SkinUsable(INT32 playernum, INT32 skinnum);
UINT32 R_GetSkinAvailabilities(void);
INT32 R_SkinAvailable(const char *name);
void R_PatchSkins(UINT16 wadnum);
void R_AddSkins(UINT16 wadnum);
UINT8 P_GetSkinSprite2(skin_t *skin, UINT8 spr2, player_t *player);
#endif //__R_SKINS__

View file

@ -30,11 +30,8 @@
#include "p_tick.h"
#include "p_local.h"
#include "p_slopes.h"
#include "dehacked.h" // get_number (for thok)
#include "d_netfil.h" // blargh. for nameonly().
#include "m_cheat.h" // objectplace
#include "m_cond.h"
#include "fastcmp.h"
#ifdef HWRENDER
#include "hardware/hw_md2.h"
#include "hardware/hw_glob.h"
@ -42,14 +39,6 @@
#include "hardware/hw_drv.h"
#endif
#ifdef PC_DOS
#include <stdio.h> // for snprintf
int snprintf(char *str, size_t n, const char *fmt, ...);
//int vsnprintf(char *str, size_t n, const char *fmt, va_list ap);
#endif
static void R_InitSkins(void);
#define MINZ (FRACUNIT*4)
#define BASEYCENTER (BASEVIDHEIGHT/2)
@ -233,7 +222,7 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch
//
// Returns true if the sprite was succesfully added
//
static boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16 wadnum, UINT16 startlump, UINT16 endlump)
boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16 wadnum, UINT16 startlump, UINT16 endlump)
{
UINT16 l;
UINT8 frame;
@ -245,6 +234,8 @@ static boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef,
memset(sprtemp,0xFF, sizeof (sprtemp));
maxframe = (size_t)-1;
spritename = sprname;
// are we 'patching' a sprite already loaded ?
// if so, it might patch only certain frames, not all
if (spritedef->numframes) // (then spriteframes is not null)
@ -476,11 +467,10 @@ void R_AddSpriteDefs(UINT16 wadnum)
//
for (i = 0; i < numsprites; i++)
{
spritename = sprnames[i];
if (spritename[4] && wadnum >= (UINT16)spritename[4])
if (sprnames[i][4] && wadnum >= (UINT16)sprnames[i][4])
continue;
if (R_AddSingleSpriteDef(spritename, &sprites[i], wadnum, start, end))
if (R_AddSingleSpriteDef(sprnames[i], &sprites[i], wadnum, start, end))
{
#ifdef HWRENDER
if (rendermode == render_opengl)
@ -489,7 +479,7 @@ void R_AddSpriteDefs(UINT16 wadnum)
// if a new sprite was added (not just replaced)
addsprites++;
#ifndef ZDEBUG
CONS_Debug(DBG_SETUP, "sprite %s set in pwad %d\n", spritename, wadnum);
CONS_Debug(DBG_SETUP, "sprite %s set in pwad %d\n", sprnames[i], wadnum);
#endif
}
}
@ -1040,10 +1030,8 @@ static void R_SplitSprite(vissprite_t *sprite)
if (!(sector->lightlist[i].caster->flags & FF_CUTSPRITES))
continue;
#ifdef ESLOPE
if (sector->lightlist[i].slope)
testheight = P_GetZAt(sector->lightlist[i].slope, sprite->gx, sprite->gy);
#endif
if (testheight >= sprite->gzt)
continue;
@ -1331,9 +1319,9 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
if (thing->subsector->sector->numlights)
{
INT32 lightnum;
#ifdef ESLOPE // R_GetPlaneLight won't work on sloped lights!
light = thing->subsector->sector->numlights - 1;
// R_GetPlaneLight won't work on sloped lights!
for (lightnum = 1; lightnum < thing->subsector->sector->numlights; lightnum++) {
fixed_t h = thing->subsector->sector->lightlist[lightnum].slope ? P_GetZAt(thing->subsector->sector->lightlist[lightnum].slope, thing->x, thing->y)
: thing->subsector->sector->lightlist[lightnum].height;
@ -1342,9 +1330,7 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
break;
}
}
#else
light = R_GetPlaneLight(thing->subsector->sector, shadow->gzt, false);
#endif
//light = R_GetPlaneLight(thing->subsector->sector, shadow->gzt, false);
}
if (thing->subsector->sector->numlights)
@ -1740,9 +1726,9 @@ static void R_ProjectSprite(mobj_t *thing)
if (thing->subsector->sector->numlights)
{
INT32 lightnum;
#ifdef ESLOPE // R_GetPlaneLight won't work on sloped lights!
light = thing->subsector->sector->numlights - 1;
// R_GetPlaneLight won't work on sloped lights!
for (lightnum = 1; lightnum < thing->subsector->sector->numlights; lightnum++) {
fixed_t h = thing->subsector->sector->lightlist[lightnum].slope ? P_GetZAt(thing->subsector->sector->lightlist[lightnum].slope, thing->x, thing->y)
: thing->subsector->sector->lightlist[lightnum].height;
@ -1751,9 +1737,7 @@ static void R_ProjectSprite(mobj_t *thing)
break;
}
}
#else
light = R_GetPlaneLight(thing->subsector->sector, gzt, false);
#endif
//light = R_GetPlaneLight(thing->subsector->sector, gzt, false);
lightnum = (*thing->subsector->sector->lightlist[light].lightlevel >> LIGHTSEGSHIFT);
if (lightnum < 0)
@ -2403,13 +2387,12 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps
if (rover->szt > r2->plane->low || rover->sz < r2->plane->high)
continue;
#ifdef ESLOPE
// Effective height may be different for each comparison in the case of slopes
if (r2->plane->slope) {
planeobjectz = P_GetZAt(r2->plane->slope, rover->gx, rover->gy);
planecameraz = P_GetZAt(r2->plane->slope, viewx, viewy);
} else
#endif
}
else
planeobjectz = planecameraz = r2->plane->height;
if (rover->mobjflags & MF_NOCLIPHEIGHT)
@ -2468,20 +2451,18 @@ static void R_CreateDrawNodes(maskcount_t* mask, drawnode_t* head, boolean temps
if (scale <= rover->sortscale)
continue;
#ifdef ESLOPE
if (*r2->ffloor->t_slope) {
topplaneobjectz = P_GetZAt(*r2->ffloor->t_slope, rover->gx, rover->gy);
topplanecameraz = P_GetZAt(*r2->ffloor->t_slope, viewx, viewy);
} else
#endif
}
else
topplaneobjectz = topplanecameraz = *r2->ffloor->topheight;
#ifdef ESLOPE
if (*r2->ffloor->b_slope) {
botplaneobjectz = P_GetZAt(*r2->ffloor->b_slope, rover->gx, rover->gy);
botplanecameraz = P_GetZAt(*r2->ffloor->b_slope, viewx, viewy);
} else
#endif
}
else
botplaneobjectz = botplanecameraz = *r2->ffloor->bottomheight;
if ((topplanecameraz > viewz && botplanecameraz < viewz) ||
@ -2964,795 +2945,3 @@ void R_DrawMasked(maskcount_t* masks, UINT8 nummasks)
free(heads);
}
// ==========================================================================
//
// SKINS CODE
//
// ==========================================================================
INT32 numskins = 0;
skin_t skins[MAXSKINS];
// FIXTHIS: don't work because it must be inistilised before the config load
//#define SKINVALUES
#ifdef SKINVALUES
CV_PossibleValue_t skin_cons_t[MAXSKINS+1];
#endif
//
// P_GetSkinSprite2
// For non-super players, tries each sprite2's immediate predecessor until it finds one with a number of frames or ends up at standing.
// For super players, does the same as above - but tries the super equivalent for each sprite2 before the non-super version.
//
UINT8 P_GetSkinSprite2(skin_t *skin, UINT8 spr2, player_t *player)
{
UINT8 super = 0, i = 0;
if (!skin)
return 0;
if ((playersprite_t)(spr2 & ~FF_SPR2SUPER) >= free_spr2)
return 0;
while (!skin->sprites[spr2].numframes
&& spr2 != SPR2_STND
&& ++i < 32) // recursion limiter
{
if (spr2 & FF_SPR2SUPER)
{
super = FF_SPR2SUPER;
spr2 &= ~FF_SPR2SUPER;
continue;
}
switch(spr2)
{
// Normal special cases.
case SPR2_JUMP:
spr2 = ((player
? player->charflags
: skin->flags)
& SF_NOJUMPSPIN) ? SPR2_SPNG : SPR2_ROLL;
break;
case SPR2_TIRE:
spr2 = ((player
? player->charability
: skin->ability)
== CA_SWIM) ? SPR2_SWIM : SPR2_FLY;
break;
// Use the handy list, that's what it's there for!
default:
spr2 = spr2defaults[spr2];
break;
}
spr2 |= super;
}
if (i >= 32) // probably an infinite loop...
return 0;
return spr2;
}
static void Sk_SetDefaultValue(skin_t *skin)
{
INT32 i;
//
// set default skin values
//
memset(skin, 0, sizeof (skin_t));
snprintf(skin->name,
sizeof skin->name, "skin %u", (UINT32)(skin-skins));
skin->name[sizeof skin->name - 1] = '\0';
skin->wadnum = INT16_MAX;
skin->flags = 0;
strcpy(skin->realname, "Someone");
strcpy(skin->hudname, "???");
skin->starttranscolor = 96;
skin->prefcolor = SKINCOLOR_GREEN;
skin->supercolor = SKINCOLOR_SUPERGOLD1;
skin->prefoppositecolor = 0; // use tables
skin->normalspeed = 36<<FRACBITS;
skin->runspeed = 28<<FRACBITS;
skin->thrustfactor = 5;
skin->accelstart = 96;
skin->acceleration = 40;
skin->ability = CA_NONE;
skin->ability2 = CA2_SPINDASH;
skin->jumpfactor = FRACUNIT;
skin->actionspd = 30<<FRACBITS;
skin->mindash = 15<<FRACBITS;
skin->maxdash = 70<<FRACBITS;
skin->radius = mobjinfo[MT_PLAYER].radius;
skin->height = mobjinfo[MT_PLAYER].height;
skin->spinheight = FixedMul(skin->height, 2*FRACUNIT/3);
skin->shieldscale = FRACUNIT;
skin->camerascale = FRACUNIT;
skin->thokitem = -1;
skin->spinitem = -1;
skin->revitem = -1;
skin->followitem = 0;
skin->highresscale = FRACUNIT;
skin->contspeed = 17;
skin->contangle = 0;
skin->availability = 0;
for (i = 0; i < sfx_skinsoundslot0; i++)
if (S_sfx[i].skinsound != -1)
skin->soundsid[S_sfx[i].skinsound] = i;
}
//
// Initialize the basic skins
//
void R_InitSkins(void)
{
#ifdef SKINVALUES
INT32 i;
for (i = 0; i <= MAXSKINS; i++)
{
skin_cons_t[i].value = 0;
skin_cons_t[i].strvalue = NULL;
}
#endif
// no default skin!
numskins = 0;
}
UINT32 R_GetSkinAvailabilities(void)
{
INT32 s;
UINT32 response = 0;
for (s = 0; s < MAXSKINS; s++)
{
if (skins[s].availability && unlockables[skins[s].availability - 1].unlocked)
response |= (1 << s);
}
return response;
}
// returns true if available in circumstances, otherwise nope
// warning don't use with an invalid skinnum other than -1 which always returns true
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)
|| (((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.
|| (metalrecording && skinnum == 5) // Force 3.
);
}
// returns true if the skin name is found (loaded from pwad)
// warning return -1 if not found
INT32 R_SkinAvailable(const char *name)
{
INT32 i;
for (i = 0; i < numskins; i++)
{
// search in the skin list
if (stricmp(skins[i].name,name)==0)
return i;
}
return -1;
}
// network code calls this when a 'skin change' is received
void SetPlayerSkin(INT32 playernum, const char *skinname)
{
INT32 i = R_SkinAvailable(skinname);
player_t *player = &players[playernum];
if ((i != -1) && R_SkinUsable(playernum, i))
{
SetPlayerSkinByNum(playernum, i);
return;
}
if (P_IsLocalPlayer(player))
CONS_Alert(CONS_WARNING, M_GetText("Skin '%s' not found.\n"), skinname);
else if(server || IsPlayerAdmin(consoleplayer))
CONS_Alert(CONS_WARNING, M_GetText("Player %d (%s) skin '%s' not found\n"), playernum, player_names[playernum], skinname);
SetPlayerSkinByNum(playernum, 0);
}
// Same as SetPlayerSkin, but uses the skin #.
// network code calls this when a 'skin change' is received
void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
{
player_t *player = &players[playernum];
skin_t *skin = &skins[skinnum];
UINT8 newcolor = 0;
if (skinnum >= 0 && skinnum < numskins && R_SkinUsable(playernum, skinnum)) // Make sure it exists!
{
player->skin = skinnum;
player->camerascale = skin->camerascale;
player->shieldscale = skin->shieldscale;
player->charability = (UINT8)skin->ability;
player->charability2 = (UINT8)skin->ability2;
player->charflags = (UINT32)skin->flags;
player->thokitem = skin->thokitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].painchance : (UINT32)skin->thokitem;
player->spinitem = skin->spinitem < 0 ? (UINT32)mobjinfo[MT_PLAYER].damage : (UINT32)skin->spinitem;
player->revitem = skin->revitem < 0 ? (mobjtype_t)mobjinfo[MT_PLAYER].raisestate : (UINT32)skin->revitem;
player->followitem = skin->followitem;
if (((player->powers[pw_shield] & SH_NOSTACK) == SH_PINK) && (player->revitem == MT_LHRT || player->spinitem == MT_LHRT || player->thokitem == MT_LHRT)) // Healers can't keep their buff.
player->powers[pw_shield] &= SH_STACK;
player->actionspd = skin->actionspd;
player->mindash = skin->mindash;
player->maxdash = skin->maxdash;
player->normalspeed = skin->normalspeed;
player->runspeed = skin->runspeed;
player->thrustfactor = skin->thrustfactor;
player->accelstart = skin->accelstart;
player->acceleration = skin->acceleration;
player->jumpfactor = skin->jumpfactor;
player->height = skin->height;
player->spinheight = skin->spinheight;
if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback))
{
if (playernum == consoleplayer)
CV_StealthSetValue(&cv_playercolor, skin->prefcolor);
else if (playernum == secondarydisplayplayer)
CV_StealthSetValue(&cv_playercolor2, skin->prefcolor);
player->skincolor = newcolor = skin->prefcolor;
}
if (player->followmobj)
{
P_RemoveMobj(player->followmobj);
P_SetTarget(&player->followmobj, NULL);
}
if (player->mo)
{
fixed_t radius = FixedMul(skin->radius, player->mo->scale);
if ((player->powers[pw_carry] == CR_NIGHTSMODE) && (skin->sprites[SPR2_NFLY].numframes == 0)) // If you don't have a sprite for flying horizontally, use the default NiGHTS skin.
{
skin = &skins[DEFAULTNIGHTSSKIN];
player->followitem = skin->followitem;
if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback))
newcolor = skin->prefcolor; // will be updated in thinker to flashing
}
player->mo->skin = skin;
if (newcolor)
player->mo->color = newcolor;
P_SetScale(player->mo, player->mo->scale);
player->mo->radius = radius;
P_SetPlayerMobjState(player->mo, player->mo->state-states); // Prevent visual errors when switching between skins with differing number of frames
}
return;
}
if (P_IsLocalPlayer(player))
CONS_Alert(CONS_WARNING, M_GetText("Requested skin %d not found\n"), skinnum);
else if(server || IsPlayerAdmin(consoleplayer))
CONS_Alert(CONS_WARNING, "Player %d (%s) skin %d not found\n", playernum, player_names[playernum], skinnum);
SetPlayerSkinByNum(playernum, 0); // not found put the sonic skin
}
//
// Add skins from a pwad, each skin preceded by 'S_SKIN' marker
//
// Does the same is in w_wad, but check only for
// the first 6 characters (this is so we can have S_SKIN1, S_SKIN2..
// for wad editors that don't like multiple resources of the same name)
//
static UINT16 W_CheckForSkinMarkerInPwad(UINT16 wadid, UINT16 startlump)
{
UINT16 i;
const char *S_SKIN = "S_SKIN";
lumpinfo_t *lump_p;
// scan forward, start at <startlump>
if (startlump < wadfiles[wadid]->numlumps)
{
lump_p = wadfiles[wadid]->lumpinfo + startlump;
for (i = startlump; i < wadfiles[wadid]->numlumps; i++, lump_p++)
if (memcmp(lump_p->name,S_SKIN,6)==0)
return i;
}
return INT16_MAX; // not found
}
#define HUDNAMEWRITE(value) STRBUFCPY(skin->hudname, value)
// turn _ into spaces and . into katana dot
#define SYMBOLCONVERT(name) for (value = name; *value; value++)\
{\
if (*value == '_') *value = ' ';\
else if (*value == '.') *value = '\x1E';\
}
//
// Patch skins from a pwad, each skin preceded by 'P_SKIN' marker
//
// Does the same is in w_wad, but check only for
// the first 6 characters (this is so we can have P_SKIN1, P_SKIN2..
// for wad editors that don't like multiple resources of the same name)
//
static UINT16 W_CheckForPatchSkinMarkerInPwad(UINT16 wadid, UINT16 startlump)
{
UINT16 i;
const char *P_SKIN = "P_SKIN";
lumpinfo_t *lump_p;
// scan forward, start at <startlump>
if (startlump < wadfiles[wadid]->numlumps)
{
lump_p = wadfiles[wadid]->lumpinfo + startlump;
for (i = startlump; i < wadfiles[wadid]->numlumps; i++, lump_p++)
if (memcmp(lump_p->name,P_SKIN,6)==0)
return i;
}
return INT16_MAX; // not found
}
static void R_LoadSkinSprites(UINT16 wadnum, UINT16 *lump, UINT16 *lastlump, skin_t *skin)
{
UINT16 newlastlump;
UINT8 sprite2;
*lump += 1; // start after S_SKIN
*lastlump = W_CheckNumForNamePwad("S_END",wadnum,*lump); // stop at S_END
// old wadding practices die hard -- stop at S_SKIN (or P_SKIN) or S_START if they come before S_END.
newlastlump = W_CheckForSkinMarkerInPwad(wadnum,*lump);
if (newlastlump < *lastlump) *lastlump = newlastlump;
newlastlump = W_CheckForPatchSkinMarkerInPwad(wadnum,*lump);
if (newlastlump < *lastlump) *lastlump = newlastlump;
newlastlump = W_CheckNumForNamePwad("S_START",wadnum,*lump);
if (newlastlump < *lastlump) *lastlump = newlastlump;
// ...and let's handle super, too
newlastlump = W_CheckNumForNamePwad("S_SUPER",wadnum,*lump);
if (newlastlump < *lastlump)
{
newlastlump++;
// load all sprite sets we are aware of... for super!
for (sprite2 = 0; sprite2 < free_spr2; sprite2++)
R_AddSingleSpriteDef((spritename = spr2names[sprite2]), &skin->sprites[FF_SPR2SUPER|sprite2], wadnum, newlastlump, *lastlump);
newlastlump--;
*lastlump = newlastlump; // okay, make the normal sprite set loading end there
}
// load all sprite sets we are aware of... for normal stuff.
for (sprite2 = 0; sprite2 < free_spr2; sprite2++)
R_AddSingleSpriteDef((spritename = spr2names[sprite2]), &skin->sprites[sprite2], wadnum, *lump, *lastlump);
if (skin->sprites[0].numframes == 0)
I_Error("R_LoadSkinSprites: no frames found for sprite SPR2_%s\n", spr2names[0]);
}
// returns whether found appropriate property
static boolean R_ProcessPatchableFields(skin_t *skin, char *stoken, char *value)
{
// custom translation table
if (!stricmp(stoken, "startcolor"))
skin->starttranscolor = atoi(value);
#define FULLPROCESS(field) else if (!stricmp(stoken, #field)) skin->field = get_number(value);
// character type identification
FULLPROCESS(flags)
FULLPROCESS(ability)
FULLPROCESS(ability2)
FULLPROCESS(thokitem)
FULLPROCESS(spinitem)
FULLPROCESS(revitem)
FULLPROCESS(followitem)
#undef FULLPROCESS
#define GETFRACBITS(field) else if (!stricmp(stoken, #field)) skin->field = atoi(value)<<FRACBITS;
GETFRACBITS(normalspeed)
GETFRACBITS(runspeed)
GETFRACBITS(mindash)
GETFRACBITS(maxdash)
GETFRACBITS(actionspd)
GETFRACBITS(radius)
GETFRACBITS(height)
GETFRACBITS(spinheight)
#undef GETFRACBITS
#define GETINT(field) else if (!stricmp(stoken, #field)) skin->field = atoi(value);
GETINT(thrustfactor)
GETINT(accelstart)
GETINT(acceleration)
GETINT(contspeed)
GETINT(contangle)
#undef GETINT
#define GETSKINCOLOR(field) else if (!stricmp(stoken, #field)) skin->field = R_GetColorByName(value);
GETSKINCOLOR(prefcolor)
GETSKINCOLOR(prefoppositecolor)
#undef GETSKINCOLOR
else if (!stricmp(stoken, "supercolor"))
skin->supercolor = R_GetSuperColorByName(value);
#define GETFLOAT(field) else if (!stricmp(stoken, #field)) skin->field = FLOAT_TO_FIXED(atof(value));
GETFLOAT(jumpfactor)
GETFLOAT(highresscale)
GETFLOAT(shieldscale)
GETFLOAT(camerascale)
#undef GETFLOAT
#define GETFLAG(field) else if (!stricmp(stoken, #field)) { \
strupr(value); \
if (atoi(value) || value[0] == 'T' || value[0] == 'Y') \
skin->flags |= (SF_##field); \
else \
skin->flags &= ~(SF_##field); \
}
// parameters for individual character flags
// these are uppercase so they can be concatenated with SF_
// 1, true, yes are all valid values
GETFLAG(SUPER)
GETFLAG(NOSUPERSPIN)
GETFLAG(NOSPINDASHDUST)
GETFLAG(HIRES)
GETFLAG(NOSKID)
GETFLAG(NOSPEEDADJUST)
GETFLAG(RUNONWATER)
GETFLAG(NOJUMPSPIN)
GETFLAG(NOJUMPDAMAGE)
GETFLAG(STOMPDAMAGE)
GETFLAG(MARIODAMAGE)
GETFLAG(MACHINE)
GETFLAG(DASHMODE)
GETFLAG(FASTEDGE)
GETFLAG(MULTIABILITY)
GETFLAG(NONIGHTSROTATION)
#undef GETFLAG
else // let's check if it's a sound, otherwise error out
{
boolean found = false;
sfxenum_t i;
size_t stokenadjust;
// Remove the prefix. (We need to affect an adjusting variable so that we can print error messages if it's not actually a sound.)
if ((stoken[0] == 'D' || stoken[0] == 'd') && (stoken[1] == 'S' || stoken[1] == 's')) // DS*
stokenadjust = 2;
else // sfx_*
stokenadjust = 4;
// Remove the prefix. (We can affect this directly since we're not going to use it again.)
if ((value[0] == 'D' || value[0] == 'd') && (value[1] == 'S' || value[1] == 's')) // DS*
value += 2;
else // sfx_*
value += 4;
// copy name of sounds that are remapped
// for this skin
for (i = 0; i < sfx_skinsoundslot0; i++)
{
if (!S_sfx[i].name)
continue;
if (S_sfx[i].skinsound != -1
&& !stricmp(S_sfx[i].name,
stoken + stokenadjust))
{
skin->soundsid[S_sfx[i].skinsound] =
S_AddSoundFx(value, S_sfx[i].singularity, S_sfx[i].pitch, true);
found = true;
}
}
return found;
}
return true;
}
//
// Find skin sprites, sounds & optional status bar face, & add them
//
void R_AddSkins(UINT16 wadnum)
{
UINT16 lump, lastlump = 0;
char *buf;
char *buf2;
char *stoken;
char *value;
size_t size;
skin_t *skin;
boolean hudname, realname;
//
// search for all skin markers in pwad
//
while ((lump = W_CheckForSkinMarkerInPwad(wadnum, lastlump)) != INT16_MAX)
{
// advance by default
lastlump = lump + 1;
if (numskins >= MAXSKINS)
{
CONS_Debug(DBG_RENDER, "ignored skin (%d skins maximum)\n", MAXSKINS);
continue; // so we know how many skins couldn't be added
}
buf = W_CacheLumpNumPwad(wadnum, lump, PU_CACHE);
size = W_LumpLengthPwad(wadnum, lump);
// for strtok
buf2 = malloc(size+1);
if (!buf2)
I_Error("R_AddSkins: No more free memory\n");
M_Memcpy(buf2,buf,size);
buf2[size] = '\0';
// set defaults
skin = &skins[numskins];
Sk_SetDefaultValue(skin);
skin->wadnum = wadnum;
hudname = realname = false;
// parse
stoken = strtok (buf2, "\r\n= ");
while (stoken)
{
if ((stoken[0] == '/' && stoken[1] == '/')
|| (stoken[0] == '#'))// skip comments
{
stoken = strtok(NULL, "\r\n"); // skip end of line
goto next_token; // find the real next token
}
value = strtok(NULL, "\r\n= ");
if (!value)
I_Error("R_AddSkins: syntax error in S_SKIN lump# %d(%s) in WAD %s\n", lump, W_CheckNameForNumPwad(wadnum,lump), wadfiles[wadnum]->filename);
// Some of these can't go in R_ProcessPatchableFields because they have side effects for future lines.
// Others can't go in there because we don't want them to be patchable.
if (!stricmp(stoken, "name"))
{
INT32 skinnum = R_SkinAvailable(value);
strlwr(value);
if (skinnum == -1)
STRBUFCPY(skin->name, value);
// the skin name must uniquely identify a single skin
// if the name is already used I make the name 'namex'
// using the default skin name's number set above
else
{
const size_t stringspace =
strlen(value) + sizeof (numskins) + 1;
char *value2 = Z_Malloc(stringspace, PU_STATIC, NULL);
snprintf(value2, stringspace,
"%s%d", value, numskins);
value2[stringspace - 1] = '\0';
if (R_SkinAvailable(value2) == -1)
// I'm lazy so if NEW name is already used I leave the 'skin x'
// default skin name set in Sk_SetDefaultValue
STRBUFCPY(skin->name, value2);
Z_Free(value2);
}
// copy to hudname and fullname as a default.
if (!realname)
{
STRBUFCPY(skin->realname, skin->name);
for (value = skin->realname; *value; value++)
{
if (*value == '_') *value = ' '; // turn _ into spaces.
else if (*value == '.') *value = '\x1E'; // turn . into katana dot.
}
}
if (!hudname)
{
HUDNAMEWRITE(skin->name);
strupr(skin->hudname);
SYMBOLCONVERT(skin->hudname)
}
}
else if (!stricmp(stoken, "realname"))
{ // Display name (eg. "Knuckles")
realname = true;
STRBUFCPY(skin->realname, value);
SYMBOLCONVERT(skin->realname)
if (!hudname)
HUDNAMEWRITE(skin->realname);
}
else if (!stricmp(stoken, "hudname"))
{ // Life icon name (eg. "K.T.E")
hudname = true;
HUDNAMEWRITE(value);
SYMBOLCONVERT(skin->hudname)
if (!realname)
STRBUFCPY(skin->realname, skin->hudname);
}
else if (!stricmp(stoken, "availability"))
{
skin->availability = atoi(value);
if (skin->availability >= MAXUNLOCKABLES)
skin->availability = 0;
}
else if (!R_ProcessPatchableFields(skin, stoken, value))
CONS_Debug(DBG_SETUP, "R_AddSkins: Unknown keyword '%s' in S_SKIN lump #%d (WAD %s)\n", stoken, lump, wadfiles[wadnum]->filename);
next_token:
stoken = strtok(NULL, "\r\n= ");
}
free(buf2);
// Add sprites
R_LoadSkinSprites(wadnum, &lump, &lastlump, skin);
//ST_LoadFaceGraphics(numskins); -- nah let's do this elsewhere
R_FlushTranslationColormapCache();
if (!skin->availability) // Safe to print...
CONS_Printf(M_GetText("Added skin '%s'\n"), skin->name);
#ifdef SKINVALUES
skin_cons_t[numskins].value = numskins;
skin_cons_t[numskins].strvalue = skin->name;
#endif
#ifdef HWRENDER
if (rendermode == render_opengl)
HWR_AddPlayerModel(numskins);
#endif
numskins++;
}
return;
}
//
// Patch skin sprites
//
void R_PatchSkins(UINT16 wadnum)
{
UINT16 lump, lastlump = 0;
char *buf;
char *buf2;
char *stoken;
char *value;
size_t size;
skin_t *skin;
boolean noskincomplain, realname, hudname;
//
// search for all skin patch markers in pwad
//
while ((lump = W_CheckForPatchSkinMarkerInPwad(wadnum, lastlump)) != INT16_MAX)
{
INT32 skinnum = 0;
// advance by default
lastlump = lump + 1;
buf = W_CacheLumpNumPwad(wadnum, lump, PU_CACHE);
size = W_LumpLengthPwad(wadnum, lump);
// for strtok
buf2 = malloc(size+1);
if (!buf2)
I_Error("R_PatchSkins: No more free memory\n");
M_Memcpy(buf2,buf,size);
buf2[size] = '\0';
skin = NULL;
noskincomplain = realname = hudname = false;
/*
Parse. Has more phases than the parser in R_AddSkins because it needs to have the patching name first (no default skin name is acceptible for patching, unlike skin creation)
*/
stoken = strtok(buf2, "\r\n= ");
while (stoken)
{
if ((stoken[0] == '/' && stoken[1] == '/')
|| (stoken[0] == '#'))// skip comments
{
stoken = strtok(NULL, "\r\n"); // skip end of line
goto next_token; // find the real next token
}
value = strtok(NULL, "\r\n= ");
if (!value)
I_Error("R_PatchSkins: syntax error in P_SKIN lump# %d(%s) in WAD %s\n", lump, W_CheckNameForNumPwad(wadnum,lump), wadfiles[wadnum]->filename);
if (!skin) // Get the name!
{
if (!stricmp(stoken, "name"))
{
strlwr(value);
skinnum = R_SkinAvailable(value);
if (skinnum != -1)
skin = &skins[skinnum];
else
{
CONS_Debug(DBG_SETUP, "R_PatchSkins: unknown skin name in P_SKIN lump# %d(%s) in WAD %s\n", lump, W_CheckNameForNumPwad(wadnum,lump), wadfiles[wadnum]->filename);
noskincomplain = true;
}
}
}
else // Get the properties!
{
// Some of these can't go in R_ProcessPatchableFields because they have side effects for future lines.
if (!stricmp(stoken, "realname"))
{ // Display name (eg. "Knuckles")
realname = true;
STRBUFCPY(skin->realname, value);
SYMBOLCONVERT(skin->realname)
if (!hudname)
HUDNAMEWRITE(skin->realname);
}
else if (!stricmp(stoken, "hudname"))
{ // Life icon name (eg. "K.T.E")
hudname = true;
HUDNAMEWRITE(value);
SYMBOLCONVERT(skin->hudname)
if (!realname)
STRBUFCPY(skin->realname, skin->hudname);
}
else if (!R_ProcessPatchableFields(skin, stoken, value))
CONS_Debug(DBG_SETUP, "R_PatchSkins: Unknown keyword '%s' in P_SKIN lump #%d (WAD %s)\n", stoken, lump, wadfiles[wadnum]->filename);
}
if (!skin)
break;
next_token:
stoken = strtok(NULL, "\r\n= ");
}
free(buf2);
if (!skin) // Didn't include a name parameter? What a waste.
{
if (!noskincomplain)
CONS_Debug(DBG_SETUP, "R_PatchSkins: no skin name given in P_SKIN lump #%d (WAD %s)\n", lump, wadfiles[wadnum]->filename);
continue;
}
// Patch sprites
R_LoadSkinSprites(wadnum, &lump, &lastlump, skin);
//ST_LoadFaceGraphics(skinnum); -- nah let's do this elsewhere
R_FlushTranslationColormapCache();
if (!skin->availability) // Safe to print...
CONS_Printf(M_GetText("Patched skin '%s'\n"), skin->name);
}
return;
}
#undef HUDNAMEWRITE
#undef SYMBOLCONVERT

View file

@ -14,26 +14,27 @@
#ifndef __R_THINGS__
#define __R_THINGS__
#include "sounds.h"
#include "r_plane.h"
#include "r_patch.h"
#include "r_portal.h"
#include "r_defs.h"
#include "r_skins.h"
// number of sprite lumps for spritewidth,offset,topoffset lookup tables
// Fab: this is a hack : should allocate the lookup tables per sprite
#define MAXVISSPRITES 2048 // added 2-2-98 was 128
#define VISSPRITECHUNKBITS 6 // 2^6 = 64 sprites per chunk
#define VISSPRITESPERCHUNK (1 << VISSPRITECHUNKBITS)
#define VISSPRITEINDEXMASK (VISSPRITESPERCHUNK - 1)
// --------------
// SPRITE LOADING
// --------------
#define FEETADJUST (4<<FRACBITS) // R_AddSingleSpriteDef
// Constant arrays used for psprite clipping
// and initializing clipping.
extern INT16 negonearray[MAXVIDWIDTH];
extern INT16 screenheightarray[MAXVIDWIDTH];
boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16 wadnum, UINT16 startlump, UINT16 endlump);
//faB: find sprites in wadfile, replace existing, add new ones
// (only sprites from namelist are added or replaced)
void R_AddSpriteDefs(UINT16 wadnum);
// ---------------------
// MASKED COLUMN DRAWING
// ---------------------
// vars for R_DrawMaskedColumn
extern INT16 *mfloorclip;
@ -47,9 +48,14 @@ extern fixed_t windowbottom;
void R_DrawMaskedColumn(column_t *column);
void R_DrawFlippedMaskedColumn(column_t *column, INT32 texheight);
//faB: find sprites in wadfile, replace existing, add new ones
// (only sprites from namelist are added or replaced)
void R_AddSpriteDefs(UINT16 wadnum);
// ----------------
// SPRITE RENDERING
// ----------------
// Constant arrays used for psprite clipping
// and initializing clipping.
extern INT16 negonearray[MAXVIDWIDTH];
extern INT16 screenheightarray[MAXVIDWIDTH];
fixed_t R_GetShadowZ(mobj_t *thing, pslope_t **shadowslope);
@ -68,6 +74,9 @@ boolean R_ThingVisibleWithinDist (mobj_t *thing,
boolean R_PrecipThingVisible (precipmobj_t *precipthing,
fixed_t precip_draw_dist);
// --------------
// MASKED DRAWING
// --------------
/** Used to count the amount of masked elements
* per portal to later group them in separate
* drawnode lists.
@ -82,73 +91,18 @@ typedef struct
void R_DrawMasked(maskcount_t* masks, UINT8 nummasks);
// -----------
// SKINS STUFF
// -----------
#define SKINNAMESIZE 16
// should be all lowercase!! S_SKIN processing does a strlwr
#define DEFAULTSKIN "sonic"
#define DEFAULTSKIN2 "tails" // secondary player
#define DEFAULTNIGHTSSKIN 0
// ----------
// VISSPRITES
// ----------
typedef struct
{
char name[SKINNAMESIZE+1]; // INT16 descriptive name of the skin
UINT16 wadnum;
skinflags_t flags;
// number of sprite lumps for spritewidth,offset,topoffset lookup tables
// Fab: this is a hack : should allocate the lookup tables per sprite
#define MAXVISSPRITES 2048 // added 2-2-98 was 128
char realname[SKINNAMESIZE+1]; // Display name for level completion.
char hudname[SKINNAMESIZE+1]; // HUD name to display (officially exactly 5 characters long)
#define VISSPRITECHUNKBITS 6 // 2^6 = 64 sprites per chunk
#define VISSPRITESPERCHUNK (1 << VISSPRITECHUNKBITS)
#define VISSPRITEINDEXMASK (VISSPRITESPERCHUNK - 1)
UINT8 ability; // ability definition
UINT8 ability2; // secondary ability definition
INT32 thokitem;
INT32 spinitem;
INT32 revitem;
INT32 followitem;
fixed_t actionspd;
fixed_t mindash;
fixed_t maxdash;
fixed_t normalspeed; // Normal ground
fixed_t runspeed; // Speed that you break into your run animation
UINT8 thrustfactor; // Thrust = thrustfactor * acceleration
UINT8 accelstart; // Acceleration if speed = 0
UINT8 acceleration; // Acceleration
fixed_t jumpfactor; // multiple of standard jump height
fixed_t radius; // Bounding box changes.
fixed_t height;
fixed_t spinheight;
fixed_t shieldscale; // no change to bounding box, but helps set the shield's sprite size
fixed_t camerascale;
// Definable color translation table
UINT8 starttranscolor;
UINT8 prefcolor;
UINT8 supercolor;
UINT8 prefoppositecolor; // if 0 use tables instead
fixed_t highresscale; // scale of highres, default is 0.5
UINT8 contspeed; // continue screen animation speed
UINT8 contangle; // initial angle on continue screen
// specific sounds per skin
sfxenum_t soundsid[NUMSKINSOUNDS]; // sound # in S_sfx table
// contains super versions too
spritedef_t sprites[NUMPLAYERSPRITES*2];
spriteinfo_t sprinfo[NUMPLAYERSPRITES*2];
UINT8 availability; // lock?
} skin_t;
// -----------
// NOT SKINS STUFF !
// -----------
typedef enum
{
// actual cuts
@ -227,6 +181,12 @@ typedef struct vissprite_s
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
} vissprite_t;
extern UINT32 visspritecount;
// ----------
// DRAW NODES
// ----------
// A drawnode is something that points to a 3D floor, 3D side, or masked
// middle texture. This is used for sorting with sprites.
typedef struct drawnode_s
@ -241,23 +201,11 @@ typedef struct drawnode_s
struct drawnode_s *prev;
} drawnode_t;
extern INT32 numskins;
extern skin_t skins[MAXSKINS];
extern UINT32 visspritecount;
void SetPlayerSkin(INT32 playernum,const char *skinname);
void SetPlayerSkinByNum(INT32 playernum,INT32 skinnum); // Tails 03-16-2002
boolean R_SkinUsable(INT32 playernum, INT32 skinnum);
UINT32 R_GetSkinAvailabilities(void);
INT32 R_SkinAvailable(const char *name);
void R_PatchSkins(UINT16 wadnum);
void R_AddSkins(UINT16 wadnum);
UINT8 P_GetSkinSprite2(skin_t *skin, UINT8 spr2, player_t *player);
void R_InitDrawNodes(void);
char *GetPlayerFacePic(INT32 skinnum);
// -----------------------
// SPRITE FRAME CHARACTERS
// -----------------------
// Functions to go from sprite character ID to frame number
// for 2.1 compatibility this still uses the old 'A' + frame code

View file

@ -27,7 +27,7 @@ extern INT32 msg_id;
#include "g_game.h"
#include "m_argv.h"
#include "r_main.h" // R_PointToAngle2() used to calc stereo sep.
#include "r_things.h" // for skins
#include "r_skins.h" // for skins
#include "i_system.h"
#include "i_sound.h"
#include "s_sound.h"
@ -40,7 +40,7 @@ extern INT32 msg_id;
#include "m_misc.h" // for tunes command
#include "m_cond.h" // for conditionsets
#if defined(HAVE_BLUA) && defined(HAVE_LUA_MUSICPLUS)
#ifdef HAVE_LUA_MUSICPLUS
#include "lua_hook.h" // MusicChange hook
#endif
@ -2045,7 +2045,7 @@ static musicstack_t *S_GetMusicStackEntry(UINT16 status, boolean fromfirst, INT1
if (!status || mst->status == status)
{
if (P_EvaluateMusicStatus(mst->status))
if (P_EvaluateMusicStatus(mst->status, mst->musname))
{
if (!S_MusicExists(mst->musname, !midi_disabled, !digital_disabled)) // paranoia
S_RemoveMusicStackEntry(mst); // then continue
@ -2314,7 +2314,7 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32
return;
strncpy(newmusic, mmusic, 7);
#if defined(HAVE_BLUA) && defined(HAVE_LUA_MUSICPLUS)
#ifdef HAVE_LUA_MUSICPLUS
if(LUAh_MusicChange(music_name, newmusic, &mflags, &looping, &position, &prefadems, &fadeinms))
return;
#endif

View file

@ -127,14 +127,12 @@ void SCR_SetDrawFuncs(void)
#ifndef NOWATER
spanfuncs[SPANDRAWFUNC_WATER] = R_DrawTranslucentWaterSpan_8;
#endif
#ifdef ESLOPE
spanfuncs[SPANDRAWFUNC_TILTED] = R_DrawTiltedSpan_8;
spanfuncs[SPANDRAWFUNC_TILTEDTRANS] = R_DrawTiltedTranslucentSpan_8;
#ifndef NOWATER
spanfuncs[SPANDRAWFUNC_TILTEDWATER] = R_DrawTiltedTranslucentWaterSpan_8;
#endif
spanfuncs[SPANDRAWFUNC_TILTEDSPLAT] = R_DrawTiltedSplat_8;
#endif
// Lactozilla: Non-powers-of-two
spanfuncs_npo2[BASEDRAWFUNC] = R_DrawSpan_NPO2_8;
@ -145,14 +143,12 @@ void SCR_SetDrawFuncs(void)
#ifndef NOWATER
spanfuncs_npo2[SPANDRAWFUNC_WATER] = R_DrawTranslucentWaterSpan_NPO2_8;
#endif
#ifdef ESLOPE
spanfuncs_npo2[SPANDRAWFUNC_TILTED] = R_DrawTiltedSpan_NPO2_8;
spanfuncs_npo2[SPANDRAWFUNC_TILTEDTRANS] = R_DrawTiltedTranslucentSpan_NPO2_8;
#ifndef NOWATER
spanfuncs_npo2[SPANDRAWFUNC_TILTEDWATER] = R_DrawTiltedTranslucentWaterSpan_NPO2_8;
#endif
spanfuncs_npo2[SPANDRAWFUNC_TILTEDSPLAT] = R_DrawTiltedSplat_NPO2_8;
#endif
#ifdef RUSEASM
if (R_ASM)

View file

@ -140,13 +140,11 @@ enum
#ifndef NOWATER
SPANDRAWFUNC_WATER,
#endif
#ifdef ESLOPE
SPANDRAWFUNC_TILTED,
SPANDRAWFUNC_TILTEDTRANS,
SPANDRAWFUNC_TILTEDSPLAT,
#ifndef NOWATER
SPANDRAWFUNC_TILTEDWATER,
#endif
#endif
SPANDRAWFUNC_MAX

View file

@ -213,6 +213,7 @@
<ClInclude Include="..\fastcmp.h" />
<ClInclude Include="..\filesrch.h" />
<ClInclude Include="..\f_finale.h" />
<ClInclude Include="..\g_demo.h" />
<ClInclude Include="..\g_game.h" />
<ClInclude Include="..\g_input.h" />
<ClInclude Include="..\g_state.h" />
@ -284,6 +285,7 @@
<ClInclude Include="..\r_patch.h" />
<ClInclude Include="..\r_portal.h" />
<ClInclude Include="..\r_segs.h" />
<ClInclude Include="..\r_skins.h" />
<ClInclude Include="..\r_sky.h" />
<ClInclude Include="..\r_splats.h" />
<ClInclude Include="..\r_state.h" />
@ -363,6 +365,7 @@
<ClCompile Include="..\filesrch.c" />
<ClCompile Include="..\f_finale.c" />
<ClCompile Include="..\f_wipe.c" />
<ClCompile Include="..\g_demo.c" />
<ClCompile Include="..\g_game.c" />
<ClCompile Include="..\g_input.c" />
<ClCompile Include="..\hardware\hw3sound.c" />
@ -446,6 +449,7 @@
<ClCompile Include="..\r_patch.c" />
<ClCompile Include="..\r_portal.c" />
<ClCompile Include="..\r_segs.c" />
<ClCompile Include="..\r_skins.c" />
<ClCompile Include="..\r_sky.c" />
<ClCompile Include="..\r_splats.c" />
<ClCompile Include="..\r_things.c" />

View file

@ -180,6 +180,9 @@
<ClInclude Include="..\f_finale.h">
<Filter>F_Frame</Filter>
</ClInclude>
<ClInclude Include="..\g_demo.h">
<Filter>G_Game</Filter>
</ClInclude>
<ClInclude Include="..\g_game.h">
<Filter>G_Game</Filter>
</ClInclude>
@ -417,6 +420,9 @@
<ClInclude Include="..\r_segs.h">
<Filter>R_Rend</Filter>
</ClInclude>
<ClInclude Include="..\r_skins.h">
<Filter>R_Rend</Filter>
</ClInclude>
<ClInclude Include="..\r_sky.h">
<Filter>R_Rend</Filter>
</ClInclude>
@ -597,6 +603,9 @@
<ClCompile Include="..\f_wipe.c">
<Filter>F_Frame</Filter>
</ClCompile>
<ClCompile Include="..\g_demo.c">
<Filter>G_Game</Filter>
</ClCompile>
<ClCompile Include="..\g_game.c">
<Filter>G_Game</Filter>
</ClCompile>
@ -849,6 +858,9 @@
<ClCompile Include="..\r_segs.c">
<Filter>R_Rend</Filter>
</ClCompile>
<ClCompile Include="..\r_skins.c">
<Filter>R_Rend</Filter>
</ClCompile>
<ClCompile Include="..\r_sky.c">
<Filter>R_Rend</Filter>
</ClCompile>

View file

@ -50,7 +50,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;"
PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -145,7 +145,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;"
PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
PreprocessorDefinitions="_DEBUG;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -248,7 +248,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;"
PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;USEASM;HAVE_PNG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
PrecompiledHeaderFile=".\..\..\objs\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch"
@ -350,7 +350,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;"
PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;HAVE_BLUA;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
PreprocessorDefinitions="NDEBUG;SDLMAIN;NO_STDIO_REDIRECT;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;HAVE_PNG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
PrecompiledHeaderFile=".\..\..\objs\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch"

View file

@ -1060,10 +1060,8 @@ void I_GetEvent(void)
M_SetupJoystickMenu(0);
break;
case SDL_QUIT:
#ifdef HAVE_BLUA
if (Playing())
LUAh_GameQuit();
#endif
I_Quit();
M_QuitResponse('y');
break;

View file

@ -1272,7 +1272,6 @@
HAVE_SDL,
HAVE_MIXER,
HAVE_PNG,
HAVE_BLUA,
LUA_USE_POSIX,
COMPVERSION,
HWRENDER,
@ -1395,7 +1394,6 @@
HAVE_SDL,
HAVE_MIXER,
HAVE_PNG,
HAVE_BLUA,
LUA_USE_POSIX,
COMPVERSION,
HWRENDER,

View file

@ -15,7 +15,7 @@
#include "i_sound.h"
#include "sounds.h"
#include "r_defs.h"
#include "r_things.h"
#include "r_skins.h"
#include "z_zone.h"
#include "w_wad.h"
#include "lua_script.h"

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