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 - /var/cache/apt/archives
- checkout - checkout
- run: - run:
name: Compile without network support and BLUA name: Compile without network support
command: make -C src LINUX=1 ERRORMODE=1 -k NONET=1 NO_LUA=1 command: make -C src LINUX=1 ERRORMODE=1 -k NONET=1
- run: - run:
name: wipe build name: wipe build
command: make -C src LINUX=1 cleandep 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)"; 112 = "Trigger Line Ex. (NiGHTS Mare)";
128 = "Check for Linedef Executor on FOFs"; 128 = "Check for Linedef Executor on FOFs";
144 = "Egg Capsule"; 144 = "Egg Capsule";
160 = "Special Stage Time/Rings Parameters"; 160 = "Special Stage Time/Spheres Parameters";
176 = "Custom Global Gravity"; 176 = "Custom Global Gravity";
512 = "Wind/Current"; 512 = "Wind/Current";
1024 = "Conveyor Belt"; 1024 = "Conveyor Belt";
@ -490,7 +490,7 @@ gen_sectortypes
112 = "Trigger Line Ex. (NiGHTS Mare)"; 112 = "Trigger Line Ex. (NiGHTS Mare)";
128 = "Check for Linedef Executor on FOFs"; 128 = "Check for Linedef Executor on FOFs";
144 = "Egg Capsule"; 144 = "Egg Capsule";
160 = "Special Stage Time/Rings Parameters"; 160 = "Special Stage Time/Spheres Parameters";
176 = "Custom Global Gravity"; 176 = "Custom Global Gravity";
} }
@ -766,6 +766,7 @@ linedeftypes
{ {
title = "Parameters"; title = "Parameters";
prefix = "(22)"; prefix = "(22)";
flags32text = "[5] Render outer sides only";
flags64text = "[6] Trigger linedef executor"; flags64text = "[6] Trigger linedef executor";
flags128text = "[7] Intangible"; flags128text = "[7] Intangible";
flags256text = "[8] Stopped by pushables"; flags256text = "[8] Stopped by pushables";
@ -788,7 +789,6 @@ linedeftypes
{ {
title = "Angular Displacement by Front Sector"; title = "Angular Displacement by Front Sector";
prefix = "(32)"; prefix = "(32)";
flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Don't turn players"; flags64text = "[6] Don't turn players";
flags512text = "[9] Turn all objects"; flags512text = "[9] Turn all objects";
} }
@ -1136,7 +1136,6 @@ linedeftypes
{ {
title = "Goo Water, Translucent, No Sides"; title = "Goo Water, Translucent, No Sides";
prefix = "(125)"; prefix = "(125)";
flags8text = "[3] Slope skew sides";
flags64text = "[6] Use two light levels"; flags64text = "[6] Use two light levels";
flags512text = "[9] Use target light level"; flags512text = "[9] Use target light level";
flags1024text = "[10] Ripple effect"; flags1024text = "[10] Ripple effect";
@ -1227,6 +1226,18 @@ linedeftypes
3dfloorflags = "19F"; 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 160
{ {
title = "Floating, Bobbing"; title = "Floating, Bobbing";
@ -1282,7 +1293,6 @@ linedeftypes
title = "Rising Platform, Solid, Invisible"; title = "Rising Platform, Solid, Invisible";
prefix = "(193)"; prefix = "(193)";
flags2text = "[1] Sink when stepped on"; flags2text = "[1] Sink when stepped on";
flags8text = "[3] Slope skew sides";
flags32text = "[5] Only block player"; flags32text = "[5] Only block player";
flags64text = "[6] Spindash to move"; flags64text = "[6] Spindash to move";
flags128text = "[7] Only block non-players"; flags128text = "[7] Only block non-players";
@ -1488,16 +1498,22 @@ linedeftypes
{ {
title = "Mario Block"; title = "Mario Block";
prefix = "(250)"; prefix = "(250)";
flags8text = "[3] Slope skew sides";
flags32text = "[5] Invisible block"; flags32text = "[5] Invisible block";
flags64text = "[6] Brick block"; flags64text = "[6] Brick block";
3dfloor = true; 3dfloor = true;
3dfloorflags = "40019F"; 3dfloorflags = "40019F";
flags323dfloorflagsremove = "19E";
flags643dfloorflagsadd = "200000";
} }
251 251
{ {
title = "Thwomp Block"; title = "Thwomp Block";
prefix = "(251)"; prefix = "(251)";
flags8text = "[3] Slope skew sides";
flags32text = "[5] Only block player";
flags128text = "[7] Only block non-players";
flags512text = "[9] Custom crushing sound"; flags512text = "[9] Custom crushing sound";
flags1024text = "[10] Custom speed"; flags1024text = "[10] Custom speed";
3dfloor = true; 3dfloor = true;
@ -1513,8 +1529,8 @@ linedeftypes
flags512text = "[9] Shattered by pushables"; flags512text = "[9] Shattered by pushables";
flags1024text = "[10] Trigger linedef executor"; flags1024text = "[10] Trigger linedef executor";
3dfloor = true; 3dfloor = true;
3dfloorflags = "8800019"; 3dfloorflags = "880001D";
flags643dfloorflagsadd = "200006"; flags643dfloorflagsadd = "200002";
} }
253 253
@ -1525,7 +1541,7 @@ linedeftypes
flags512text = "[9] Shattered by pushables"; flags512text = "[9] Shattered by pushables";
flags1024text = "[10] Trigger linedef executor"; flags1024text = "[10] Trigger linedef executor";
3dfloor = true; 3dfloor = true;
3dfloorflags = "8801019"; 3dfloorflags = "880101D";
} }
254 254
@ -1533,6 +1549,7 @@ linedeftypes
title = "Bustable Block"; title = "Bustable Block";
prefix = "(254)"; prefix = "(254)";
flags8text = "[3] Slope skew sides"; flags8text = "[3] Slope skew sides";
flags32text = "[5] Only block player";
flags64text = "[6] Strong characters only"; flags64text = "[6] Strong characters only";
flags128text = "[7] Only block non-players"; flags128text = "[7] Only block non-players";
flags512text = "[9] Shattered by pushables"; flags512text = "[9] Shattered by pushables";
@ -1593,6 +1610,7 @@ linedeftypes
{ {
title = "Custom FOF"; title = "Custom FOF";
prefix = "(259)"; prefix = "(259)";
flags8text = "[3] Slope skew sides";
flags32text = "[5] Only block player"; flags32text = "[5] Only block player";
flags128text = "[7] Only block non-players"; flags128text = "[7] Only block non-players";
flags512text = "[9] Shattered by pushables"; flags512text = "[9] Shattered by pushables";
@ -2161,6 +2179,14 @@ linedeftypes
flags8text = "[3] Set delay by backside sector"; 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 457
{ {
title = "Track Object's Angle"; title = "Track Object's Angle";
@ -2180,12 +2206,14 @@ linedeftypes
{ {
title = "Award Rings"; title = "Award Rings";
prefix = "(460)"; prefix = "(460)";
flags8text = "[3] Set delay by backside sector";
} }
461 461
{ {
title = "Spawn Object"; title = "Spawn Object";
prefix = "(461)"; prefix = "(461)";
flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Spawn inside a range"; flags64text = "[6] Spawn inside a range";
} }
@ -2193,6 +2221,7 @@ linedeftypes
{ {
title = "Stop Timer/Exit Stage in Record Attack"; title = "Stop Timer/Exit Stage in Record Attack";
prefix = "(462)"; prefix = "(462)";
flags8text = "[3] Set delay by backside sector";
} }
} }
@ -2206,7 +2235,7 @@ linedeftypes
prefix = "(413)"; prefix = "(413)";
flags2text = "[1] Keep after death"; flags2text = "[1] Keep after death";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags32text = "[5] Seek to current song position"; flags32text = "[5] Seek from current position";
flags64text = "[6] For everyone"; flags64text = "[6] For everyone";
flags128text = "[7] Fade to custom volume"; flags128text = "[7] Fade to custom volume";
flags512text = "[9] Don't loop"; flags512text = "[9] Don't loop";
@ -2220,7 +2249,7 @@ linedeftypes
flags2text = "[1] From calling sector"; flags2text = "[1] From calling sector";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags64text = "[6] From nowhere for triggerer"; flags64text = "[6] From nowhere for triggerer";
flags512text = "[9] For everyone"; flags512text = "[9] From nowhere for everyone";
flags1024text = "[10] From tagged sectors"; flags1024text = "[10] From tagged sectors";
} }
@ -2298,7 +2327,6 @@ linedeftypes
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
} }
445 445
{ {
title = "Make FOF Disappear/Reappear"; title = "Make FOF Disappear/Reappear";
@ -2325,7 +2353,7 @@ linedeftypes
flags32text = "[5] Subtract Red value"; flags32text = "[5] Subtract Red value";
flags64text = "[6] Subtract Green value"; flags64text = "[6] Subtract Green value";
flags128text = "[7] Subtract Blue value"; flags128text = "[7] Subtract Blue value";
flags256text = "[8] Calc relative values"; flags256text = "[8] Set relative to current";
flags32768text = "[15] Use backside colormap"; flags32768text = "[15] Use backside colormap";
} }
@ -2359,7 +2387,7 @@ linedeftypes
prefix = "(452)"; prefix = "(452)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags64text = "[6] Do not handle FF_TRANS"; flags64text = "[6] Do not handle FF_TRANS";
flags256text = "[8] Set relative to current val"; flags256text = "[8] Set relative to current";
} }
453 453
@ -2371,7 +2399,7 @@ linedeftypes
flags32text = "[5] No collision during fade"; flags32text = "[5] No collision during fade";
flags64text = "[6] Do not handle FF_TRANS"; flags64text = "[6] Do not handle FF_TRANS";
flags128text = "[7] Do not handle lighting"; flags128text = "[7] Do not handle lighting";
flags256text = "[8] Set relative to current val"; flags256text = "[8] Set relative to current";
flags512text = "[9] Speed = Tic Duration"; flags512text = "[9] Speed = Tic Duration";
flags1024text = "[10] Override existing fade"; flags1024text = "[10] Override existing fade";
flags16384text = "[14] Do not handle collision"; flags16384text = "[14] Do not handle collision";
@ -2395,7 +2423,7 @@ linedeftypes
flags32text = "[5] Subtract Red value"; flags32text = "[5] Subtract Red value";
flags64text = "[6] Subtract Green value"; flags64text = "[6] Subtract Green value";
flags128text = "[7] Subtract Blue value"; flags128text = "[7] Subtract Blue value";
flags256text = "[8] Calc relative values"; flags256text = "[8] Set relative to current";
flags512text = "[9] Speed = Tic Duration"; flags512text = "[9] Speed = Tic Duration";
flags1024text = "[10] Override existing fade"; flags1024text = "[10] Override existing fade";
flags16384text = "[14] Fade from invisible black"; flags16384text = "[14] Fade from invisible black";
@ -2416,9 +2444,7 @@ linedeftypes
flags2text = "[1] Close text prompt"; flags2text = "[1] Close text prompt";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags32text = "[5] Run executor tag on close"; flags32text = "[5] Run executor tag on close";
flags64text = "[6] For everyone"; flags128text = "[7] Don't disable controls";
flags128text = "[7] Do not block controls";
flags256text = "[8] Do not freeze time";
flags32768text = "[15] Find prompt by name"; flags32768text = "[15] Find prompt by name";
} }
} }
@ -2524,7 +2550,7 @@ linedeftypes
prefix = "(491)"; prefix = "(491)";
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags16text = "[4] Set raw alpha by Front X"; flags16text = "[4] Set raw alpha by Front X";
flags256text = "[8] Calc relative values"; flags256text = "[8] Set relative to current";
} }
492 492
@ -2534,7 +2560,7 @@ linedeftypes
flags8text = "[3] Set delay by backside sector"; flags8text = "[3] Set delay by backside sector";
flags16text = "[4] Set raw alpha by Front X"; flags16text = "[4] Set raw alpha by Front X";
flags32text = "[5] No collision during fade"; flags32text = "[5] No collision during fade";
flags256text = "[8] Calc relative values"; flags256text = "[8] Set relative to current";
flags512text = "[9] Speed = Tic Duration"; flags512text = "[9] Speed = Tic Duration";
flags1024text = "[10] Override existing fade"; flags1024text = "[10] Override existing fade";
flags16384text = "[14] Do not handle collision"; flags16384text = "[14] Do not handle collision";
@ -2632,76 +2658,84 @@ linedeftypes
{ {
title = "Carry Objects on Floor"; title = "Carry Objects on Floor";
prefix = "(520)"; prefix = "(520)";
flags64text = "[6] Exclusive";
} }
521 521
{ {
title = "Carry Objects on Floor (Accelerative)"; title = "Carry Objects on Floor (Accelerative)";
prefix = "(521)"; prefix = "(521)";
flags64text = "[6] Even across edges"; flags64text = "[6] Exclusive";
} }
522 522
{ {
title = "Carry Objects on Floor (Displacement)"; title = "Carry Objects on Floor (Displacement)";
prefix = "(522)"; prefix = "(522)";
flags64text = "[6] Exclusive";
} }
523 523
{ {
title = "Carry Objects on Ceiling"; title = "Carry Objects on Ceiling";
prefix = "(523)"; prefix = "(523)";
flags64text = "[6] Even across edges"; flags64text = "[6] Exclusive";
} }
524 524
{ {
title = "Carry Objects on Ceiling (Accelerative)"; title = "Carry Objects on Ceiling (Accelerative)";
prefix = "(524)"; prefix = "(524)";
flags64text = "[6] Exclusive";
} }
525 525
{ {
title = "Carry Objects on Ceiling (Displacement)"; title = "Carry Objects on Ceiling (Displacement)";
prefix = "(525)"; prefix = "(525)";
flags64text = "[6] Exclusive";
} }
530 530
{ {
title = "Scroll Floor Texture and Carry Objects"; title = "Scroll Floor Texture and Carry Objects";
prefix = "(530)"; prefix = "(530)";
flags64text = "[6] Even across edges"; flags64text = "[6] Exclusive";
} }
531 531
{ {
title = "Scroll Floor Texture and Carry Objects (Accelerative)"; title = "Scroll Floor Texture and Carry Objects (Accelerative)";
prefix = "(531)"; prefix = "(531)";
flags64text = "[6] Exclusive";
} }
532 532
{ {
title = "Scroll Floor Texture and Carry Objects (Displacement)"; title = "Scroll Floor Texture and Carry Objects (Displacement)";
prefix = "(532)"; prefix = "(532)";
flags64text = "[6] Exclusive";
} }
533 533
{ {
title = "Scroll Ceiling Texture and Carry Objects"; title = "Scroll Ceiling Texture and Carry Objects";
prefix = "(533)"; prefix = "(533)";
flags64text = "[6] Even across edges"; flags64text = "[6] Exclusive";
} }
534 534
{ {
title = "Scroll Ceiling Texture and Carry Objects (Accelerative)"; title = "Scroll Ceiling Texture and Carry Objects (Accelerative)";
prefix = "(534)"; prefix = "(534)";
flags64text = "[6] Exclusive";
} }
535 535
{ {
title = "Scroll Ceiling Texture and Carry Objects (Displacement)"; title = "Scroll Ceiling Texture and Carry Objects (Displacement)";
prefix = "(535)"; prefix = "(535)";
flags64text = "[6] Exclusive";
} }
} }
@ -2714,7 +2748,7 @@ linedeftypes
title = "Wind"; title = "Wind";
prefix = "(541)"; prefix = "(541)";
flags512text = "[9] Player slides"; flags512text = "[9] Player slides";
flags64text = "[6] Even across edges"; flags64text = "[6] Exclusive";
} }
542 542
@ -2722,7 +2756,7 @@ linedeftypes
title = "Upwards Wind"; title = "Upwards Wind";
prefix = "(542)"; prefix = "(542)";
flags512text = "[9] Player slides"; flags512text = "[9] Player slides";
flags64text = "[6] Even across edges"; flags64text = "[6] Exclusive";
} }
543 543
@ -2730,7 +2764,7 @@ linedeftypes
title = "Downwards Wind"; title = "Downwards Wind";
prefix = "(543)"; prefix = "(543)";
flags512text = "[9] Player slides"; flags512text = "[9] Player slides";
flags64text = "[6] Even across edges"; flags64text = "[6] Exclusive";
} }
544 544
@ -2738,7 +2772,7 @@ linedeftypes
title = "Current"; title = "Current";
prefix = "(544)"; prefix = "(544)";
flags512text = "[9] Player slides"; flags512text = "[9] Player slides";
flags64text = "[6] Even across edges"; flags64text = "[6] Exclusive";
} }
545 545
@ -2746,7 +2780,7 @@ linedeftypes
title = "Upwards Current"; title = "Upwards Current";
prefix = "(545)"; prefix = "(545)";
flags512text = "[9] Player slides"; flags512text = "[9] Player slides";
flags64text = "[6] Even across edges"; flags64text = "[6] Exclusive";
} }
546 546
@ -2754,13 +2788,14 @@ linedeftypes
title = "Downwards Current"; title = "Downwards Current";
prefix = "(546)"; prefix = "(546)";
flags512text = "[9] Player slides"; flags512text = "[9] Player slides";
flags64text = "[6] Even across edges"; flags64text = "[6] Exclusive";
} }
547 547
{ {
title = "Push/Pull"; title = "Push/Pull";
prefix = "(547)"; prefix = "(547)";
flags64text = "[6] Exclusive";
} }
} }
@ -3407,8 +3442,8 @@ thingtypes
sprite = "ESHIA1"; sprite = "ESHIA1";
width = 16; width = 16;
height = 48; height = 48;
flags1text = "[1] 90 degrees counter-clockwise"; flags1text = "[1] 90 degrees clockwise";
flags4text = "[4] 90 degrees clockwise"; flags4text = "[4] 90 degrees counter-clockwise";
flags8text = "[8] Double speed"; flags8text = "[8] Double speed";
} }
115 115
@ -3897,9 +3932,10 @@ thingtypes
title = "Monitors"; title = "Monitors";
width = 18; width = 18;
height = 40; height = 40;
flags1text = "[1] Run Linedef Executor on pop"; flags1text = "[1] Run linedef executor on pop";
flags4text = "[4] Random (Strong)"; flags4text = "[4] Random (Strong)";
flags8text = "[8] Random (Weak)"; flags8text = "[8] Random (Weak)";
angletext = "Tag";
400 400
{ {
@ -4029,7 +4065,8 @@ thingtypes
title = "Monitors (Respawning)"; title = "Monitors (Respawning)";
width = 20; width = 20;
height = 44; height = 44;
flags1text = "[1] Run Linedef Executor on pop"; flags1text = "[1] Run linedef executor on pop";
angletext = "Tag";
431 431
{ {
@ -4125,7 +4162,9 @@ thingtypes
sprite = "STPTA0M0"; sprite = "STPTA0M0";
width = 64; width = 64;
height = 128; height = 128;
flags4text = "[4] Respawn at center";
angletext = "Angle/Order"; angletext = "Angle/Order";
parametertext = "Order";
} }
520 520
{ {
@ -4152,6 +4191,7 @@ thingtypes
sprite = "WSPKALAR"; sprite = "WSPKALAR";
width = 16; width = 16;
height = 14; height = 14;
arrow = 1;
flags1text = "[1] Start retracted"; flags1text = "[1] Start retracted";
flags4text = "[4] Retractable"; flags4text = "[4] Retractable";
flags8text = "[8] Intangible"; flags8text = "[8] Intangible";
@ -4558,6 +4598,7 @@ thingtypes
sprite = "TOADA0"; sprite = "TOADA0";
width = 32; width = 32;
height = 16; height = 16;
angletext = "Tag";
} }
757 757
{ {
@ -5832,7 +5873,7 @@ thingtypes
sprite = "CAPSA0"; sprite = "CAPSA0";
width = 72; width = 72;
height = 144; height = 144;
angletext = "Rings"; angletext = "Spheres";
parametertext = "Mare"; parametertext = "Mare";
} }
} }
@ -6273,7 +6314,7 @@ thingtypes
sprite = "PUMKA0"; sprite = "PUMKA0";
width = 16; width = 16;
height = 40; height = 40;
flags1text = "Don't flicker"; flags1text = "[1] Don't flicker";
} }
2007 2007
{ {
@ -6281,7 +6322,7 @@ thingtypes
sprite = "PUMKB0"; sprite = "PUMKB0";
width = 16; width = 16;
height = 40; height = 40;
flags1text = "Don't flicker"; flags1text = "[1] Don't flicker";
} }
2008 2008
{ {
@ -6289,7 +6330,7 @@ thingtypes
sprite = "PUMKC0"; sprite = "PUMKC0";
width = 16; width = 16;
height = 40; height = 40;
flags1text = "Don't flicker"; flags1text = "[1] Don't flicker";
} }
2009 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_finale.c
f_wipe.c f_wipe.c
filesrch.c filesrch.c
g_demo.c
g_game.c g_game.c
g_input.c g_input.c
hu_stuff.c hu_stuff.c
@ -71,6 +72,7 @@ set(SRB2_CORE_HEADERS
f_finale.h f_finale.h
fastcmp.h fastcmp.h
filesrch.h filesrch.h
g_demo.h
g_game.h g_game.h
g_input.h g_input.h
g_state.h g_state.h
@ -120,6 +122,7 @@ set(SRB2_CORE_RENDER_SOURCES
r_main.c r_main.c
r_plane.c r_plane.c
r_segs.c r_segs.c
r_skins.c
r_sky.c r_sky.c
r_splats.c r_splats.c
r_things.c r_things.c
@ -134,6 +137,7 @@ set(SRB2_CORE_RENDER_SOURCES
r_main.h r_main.h
r_plane.h r_plane.h
r_segs.h r_segs.h
r_skins.h
r_sky.h r_sky.h
r_splats.h r_splats.h
r_state.h r_state.h
@ -214,8 +218,6 @@ source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES})
### Configuration ### Configuration
set(SRB2_CONFIG_HAVE_BLUA ON CACHE BOOL
"Enable Lua interpreter support")
set(SRB2_CONFIG_HAVE_PNG ON CACHE BOOL 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.") "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 set(SRB2_CONFIG_HAVE_ZLIB ON CACHE BOOL
@ -239,8 +241,6 @@ if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only
"Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME, OpenMPT).") "Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME, OpenMPT).")
endif() endif()
if(${SRB2_CONFIG_HAVE_BLUA})
add_definitions(-DHAVE_BLUA)
set(SRB2_LUA_SOURCES set(SRB2_LUA_SOURCES
lua_baselib.c lua_baselib.c
lua_blockmaplib.c lua_blockmaplib.c
@ -325,7 +325,6 @@ if(${SRB2_CONFIG_HAVE_BLUA})
prepend_sources(SRB2_BLUA_HEADERS) prepend_sources(SRB2_BLUA_HEADERS)
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS}) source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
endif()
if(${SRB2_CONFIG_HAVE_GME}) if(${SRB2_CONFIG_HAVE_GME})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES}) if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})

View file

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

View file

@ -920,10 +920,8 @@ static inline void AM_drawWalls(void)
{ {
size_t i; size_t i;
static mline_t l; static mline_t l;
#ifdef ESLOPE
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
fixed_t backf1 = 0, backf2 = 0, backc1 = 0, backc2 = 0; // back floor ceiling ends fixed_t backf1 = 0, backf2 = 0, backc1 = 0, backc2 = 0; // back floor ceiling ends
#endif
for (i = 0; i < numlines; i++) 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.a.y = lines[i].v1->y >> FRACTOMAPBITS;
l.b.x = lines[i].v2->x >> FRACTOMAPBITS; l.b.x = lines[i].v2->x >> FRACTOMAPBITS;
l.b.y = lines[i].v2->y >> FRACTOMAPBITS; l.b.y = lines[i].v2->y >> FRACTOMAPBITS;
#ifdef ESLOPE
#define SLOPEPARAMS(slope, end1, end2, normalheight) \ #define SLOPEPARAMS(slope, end1, end2, normalheight) \
if (slope) { \ if (slope) { \
end1 = P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y); \ 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) SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
} }
#undef SLOPEPARAMS #undef SLOPEPARAMS
#endif
if (!lines[i].backsector) // 1-sided if (!lines[i].backsector) // 1-sided
{ {
@ -955,19 +952,11 @@ static inline void AM_drawWalls(void)
else else
AM_drawMline(&l, WALLCOLORS); AM_drawMline(&l, WALLCOLORS);
} }
#ifdef ESLOPE
else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|| (frontf1 == frontc1 && frontf2 == frontc2)) // Front is thok barrier || (frontf1 == frontc1 && frontf2 == frontc2)) // Front is thok barrier
{ {
if (backf1 == backc1 && backf2 == backc2 if (backf1 == backc1 && backf2 == backc2
&& frontf1 == frontc1 && frontf2 == frontc2) // BOTH are thok barriers && 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) if (lines[i].flags & ML_NOCLIMB)
AM_drawMline(&l, NOCLIMBTSWALLCOLORS); AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
@ -985,20 +974,10 @@ static inline void AM_drawWalls(void)
else else
{ {
if (lines[i].flags & ML_NOCLIMB) { if (lines[i].flags & ML_NOCLIMB) {
#ifdef ESLOPE
if (backf1 != frontf1 || backf2 != frontf2) { if (backf1 != frontf1 || backf2 != frontf2) {
#else
if (lines[i].backsector->floorheight
!= lines[i].frontsector->floorheight) {
#endif
AM_drawMline(&l, NOCLIMBFDWALLCOLORS); // floor level change AM_drawMline(&l, NOCLIMBFDWALLCOLORS); // floor level change
} }
#ifdef ESLOPE
else if (backc1 != frontc1 || backc2 != frontc2) { 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 AM_drawMline(&l, NOCLIMBCDWALLCOLORS); // ceiling level change
} }
else else
@ -1006,20 +985,10 @@ static inline void AM_drawWalls(void)
} }
else else
{ {
#ifdef ESLOPE
if (backf1 != frontf1 || backf2 != frontf2) { if (backf1 != frontf1 || backf2 != frontf2) {
#else
if (lines[i].backsector->floorheight
!= lines[i].frontsector->floorheight) {
#endif
AM_drawMline(&l, FDWALLCOLORS); // floor level change AM_drawMline(&l, FDWALLCOLORS); // floor level change
} }
#ifdef ESLOPE
else if (backc1 != frontc1 || backc2 != frontc2) { 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 AM_drawMline(&l, CDWALLCOLORS); // ceiling level change
} }
else 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) if (!sonic || sonic->health <= 0)
return; return;
#ifdef HAVE_BLUA
// Lua can handle it! // Lua can handle it!
if (LUAh_BotAI(sonic, tails, cmd)) if (LUAh_BotAI(sonic, tails, cmd))
return; return;
#endif
if (tails->player->powers[pw_carry] == CR_MACESPIN || tails->player->powers[pw_carry] == CR_GENERIC) 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. // Bot AI isn't programmed in analog.
CV_SetValue(&cv_analog[1], false); CV_SetValue(&cv_analog[1], false);
#ifdef HAVE_BLUA
// Let Lua scripts build ticcmds // Let Lua scripts build ticcmds
if (LUAh_BotTiccmd(player, cmd)) if (LUAh_BotTiccmd(player, cmd))
return; return;
#endif
// We don't have any main character AI, sorry. D: // We don't have any main character AI, sorry. D:
if (player-players == consoleplayer) if (player-players == consoleplayer)

View file

@ -10,8 +10,6 @@ WFLAGS+=-Wno-logical-op
endif endif
endif endif
OPTS+=-DHAVE_BLUA
OBJS:=$(OBJS) \ OBJS:=$(OBJS) \
$(OBJDIR)/lapi.o \ $(OBJDIR)/lapi.o \
$(OBJDIR)/lbaselib.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! if (!stricmp(name, cmd->name)) //case insensitive now that we have lower and uppercase!
{ {
#ifdef HAVE_BLUA
// don't I_Error for Lua commands // don't I_Error for Lua commands
// Lua commands can replace game commands, and they have priority. // 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, // 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. // it's good to have this here so we find out.
if (cmd->function != COM_Lua_f) if (cmd->function != COM_Lua_f)
#endif
I_Error("Command %s already exists\n", name); I_Error("Command %s already exists\n", name);
return; return;
@ -501,7 +499,6 @@ void COM_AddCommand(const char *name, com_func_t func)
com_commands = cmd; com_commands = cmd;
} }
#ifdef HAVE_BLUA
/** Adds a console command for Lua. /** Adds a console command for Lua.
* No I_Errors allowed; return a negative code instead. * No I_Errors allowed; return a negative code instead.
* *
@ -534,7 +531,6 @@ int COM_AddLuaCommand(const char *name)
com_commands = cmd; com_commands = cmd;
return 0; return 0;
} }
#endif
/** Tests if a command exists. /** Tests if a command exists.
* *
@ -1427,9 +1423,7 @@ finish:
} }
var->flags |= CV_MODIFIED; var->flags |= CV_MODIFIED;
// raise 'on change' code // raise 'on change' code
#ifdef HAVE_BLUA
LUA_CVarChanged(var->name); // let consolelib know what cvar this is. LUA_CVarChanged(var->name); // let consolelib know what cvar this is.
#endif
if (var->flags & CV_CALL && !stealth) if (var->flags & CV_CALL && !stealth)
var->func(); var->func();

View file

@ -1289,6 +1289,37 @@ static boolean CL_SendJoin(void)
return HSendPacket(servernode, true, 0, sizeof (clientconfig_pak)); 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) static void SV_SendServerInfo(INT32 node, tic_t servertime)
{ {
UINT8 *p; 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.numberofplayer = (UINT8)D_NumPlayers();
netbuffer->u.serverinfo.maxplayer = (UINT8)cv_maxplayers.value; 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], strncpy(netbuffer->u.serverinfo.gametypename, Gametype_Names[gametype],
sizeof netbuffer->u.serverinfo.gametypename); sizeof netbuffer->u.serverinfo.gametypename);
netbuffer->u.serverinfo.modifiedgame = (UINT8)modifiedgame; 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. // 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(); D_QuitNetGame();
CL_Reset(); CL_Reset();
D_StartTitle(); D_StartTitle();
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); 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; return false;
} }
@ -2439,14 +2485,14 @@ static void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
if (!playeringame[playernum]) if (!playeringame[playernum])
return; return;
if (server && !demoplayback) if (server && !demoplayback && playernode[playernum] != UINT8_MAX)
{ {
INT32 node = playernode[playernum]; INT32 node = playernode[playernum];
playerpernode[node]--; playerpernode[node]--;
if (playerpernode[node] <= 0) if (playerpernode[node] <= 0)
{ {
nodeingame[playernode[playernum]] = false; nodeingame[node] = false;
Net_CloseConnection(playernode[playernum]); Net_CloseConnection(node);
ResetNode(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 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 // don't look through someone's view who isn't there
if (playernum == displayplayer) if (playernum == displayplayer)
{ {
#ifdef HAVE_BLUA
// Call ViewpointSwitch hooks here. // Call ViewpointSwitch hooks here.
// The viewpoint was forcibly changed. // The viewpoint was forcibly changed.
LUAh_ViewpointSwitch(&players[consoleplayer], &players[displayplayer], true); LUAh_ViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true);
#endif
displayplayer = consoleplayer; 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 RemoveAdminPlayer(playernum); // don't stay admin after you're gone
} }
#ifdef HAVE_BLUA
LUA_InvalidatePlayer(&players[playernum]); LUA_InvalidatePlayer(&players[playernum]);
#endif
if (G_TagGametype()) //Check if you still have a game. Location flexible. =P if (G_TagGametype()) //Check if you still have a game. Location flexible. =P
P_CheckSurvivors(); P_CheckSurvivors();
@ -2792,17 +2830,14 @@ static void Command_Kick(void)
if (pn == -1 || pn == 0) if (pn == -1 || pn == 0)
return; return;
if (server)
{
// Special case if we are trying to kick a player who is downloading the game state: // 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 // trigger a timeout instead of kicking them, because a kick would only
// take effect after they have finished downloading // take effect after they have finished downloading
if (sendingsavegame[playernode[pn]]) if (server && playernode[pn] != UINT8_MAX && sendingsavegame[playernode[pn]])
{ {
Net_ConnectionTimeout(playernode[pn]); Net_ConnectionTimeout(playernode[pn]);
return; return;
} }
}
WRITESINT8(p, pn); WRITESINT8(p, pn);
@ -2859,7 +2894,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
// Is playernum authorized to make this kick? // Is playernum authorized to make this kick?
if (playernum != serverplayer && !IsPlayerAdmin(playernum) if (playernum != serverplayer && !IsPlayerAdmin(playernum)
&& !(playerpernode[playernode[playernum]] == 2 && !(playernode[playernum] != UINT8_MAX && playerpernode[playernode[playernum]] == 2
&& nodetoplayer2[playernode[playernum]] == pnum)) && nodetoplayer2[playernode[playernum]] == pnum))
{ {
// We received a kick command from someone who isn't the // 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) else if (keepbody)
{ {
if (server && !demoplayback) if (server && !demoplayback && playernode[pnum] != UINT8_MAX)
{ {
INT32 node = playernode[pnum]; INT32 node = playernode[pnum];
playerpernode[node]--; playerpernode[node]--;
@ -3134,9 +3169,7 @@ void SV_ResetServer(void)
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
{ {
#ifdef HAVE_BLUA
LUA_InvalidatePlayer(&players[i]); LUA_InvalidatePlayer(&players[i]);
#endif
playeringame[i] = false; playeringame[i] = false;
playernode[i] = UINT8_MAX; playernode[i] = UINT8_MAX;
memset(playeraddress[i], 0, sizeof(*playeraddress)); memset(playeraddress[i], 0, sizeof(*playeraddress));
@ -3197,10 +3230,8 @@ void D_QuitNetGame(void)
// abort send/receive of files // abort send/receive of files
CloseNetFile(); CloseNetFile();
#ifdef HAVE_BLUA
RemoveAllLuaFileTransfers(); RemoveAllLuaFileTransfers();
waitingforluafiletransfer = false; waitingforluafiletransfer = false;
#endif
if (server) if (server)
{ {
@ -3234,37 +3265,6 @@ void D_QuitNetGame(void)
#endif #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....) // Adds a node to the game (player will follow at map change or at savegame....)
static inline void SV_AddNode(INT32 node) 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') if (server && multiplayer && motd[0] != '\0')
COM_BufAddText(va("sayto %d %s\n", newplayernum, motd)); COM_BufAddText(va("sayto %d %s\n", newplayernum, motd));
#ifdef HAVE_BLUA
if (!rejoined) if (!rejoined)
LUAh_PlayerJoin(newplayernum); LUAh_PlayerJoin(newplayernum);
#endif
} }
static boolean SV_AddWaitingPlayers(const char *name, const char *name2) static boolean SV_AddWaitingPlayers(const char *name, const char *name2)
@ -3595,7 +3593,7 @@ static void HandleConnect(SINT8 node)
rejoinernum = FindRejoinerNum(node); rejoinernum = FindRejoinerNum(node);
if (bannednode && bannednode[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 || else if (netbuffer->u.clientcfg._255 != 255 ||
netbuffer->u.clientcfg.packetversion != PACKETVERSION) netbuffer->u.clientcfg.packetversion != PACKETVERSION)
SV_SendRefuse(node, "Incompatible packet formats."); SV_SendRefuse(node, "Incompatible packet formats.");
@ -3606,17 +3604,15 @@ static void HandleConnect(SINT8 node)
|| netbuffer->u.clientcfg.subversion != SUBVERSION) || 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)); 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) 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) else if (D_NumPlayers() >= cv_maxplayers.value && rejoinernum == -1)
SV_SendRefuse(node, va(M_GetText("Maximum players reached: %d"), cv_maxplayers.value)); SV_SendRefuse(node, va(M_GetText("Maximum players reached: %d"), cv_maxplayers.value));
else if (netgame && netbuffer->u.clientcfg.localplayers > 1) // Hacked client? else if (netgame && netbuffer->u.clientcfg.localplayers > 1) // Hacked client?
SV_SendRefuse(node, M_GetText("Too many players from\nthis node.")); SV_SendRefuse(node, M_GetText("Too many players from\nthis node."));
else if (netgame && !netbuffer->u.clientcfg.localplayers) // Stealth join? else if (netgame && !netbuffer->u.clientcfg.localplayers) // Stealth join?
SV_SendRefuse(node, M_GetText("No players from\nthis node.")); SV_SendRefuse(node, M_GetText("No players from\nthis node."));
#ifdef HAVE_BLUA
else if (luafiletransfers) 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.")); 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 else
{ {
#ifndef NONET #ifndef NONET
@ -4203,7 +4199,6 @@ static void HandlePacketFromPlayer(SINT8 node)
Net_CloseConnection(node); Net_CloseConnection(node);
nodeingame[node] = false; nodeingame[node] = false;
break; break;
#ifdef HAVE_BLUA
case PT_ASKLUAFILE: case PT_ASKLUAFILE:
if (server && luafiletransfers && luafiletransfers->nodestatus[node] == LFTNS_ASKED) 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) if (server && luafiletransfers && luafiletransfers->nodestatus[node] == LFTNS_SENDING)
SV_HandleLuaFileSent(node); SV_HandleLuaFileSent(node);
break; break;
#endif
// -------------------------------------------- CLIENT RECEIVE ---------- // -------------------------------------------- CLIENT RECEIVE ----------
case PT_RESYNCHEND: case PT_RESYNCHEND:
// Only accept PT_RESYNCHEND from the server. // Only accept PT_RESYNCHEND from the server.
@ -4344,12 +4338,10 @@ static void HandlePacketFromPlayer(SINT8 node)
if (client) if (client)
Got_Filetxpak(); Got_Filetxpak();
break; break;
#ifdef HAVE_BLUA
case PT_SENDINGLUAFILE: case PT_SENDINGLUAFILE:
if (client) if (client)
CL_PrepareDownloadLuaFile(); CL_PrepareDownloadLuaFile();
break; break;
#endif
default: default:
DEBFILE(va("UNKNOWN PACKET TYPE RECEIVED %d from host %d\n", DEBFILE(va("UNKNOWN PACKET TYPE RECEIVED %d from host %d\n",
netbuffer->packettype, node)); netbuffer->packettype, node));
@ -4971,7 +4963,7 @@ void NetUpdate(void)
PingUpdate(); PingUpdate();
// update node latency values so we can take an average later. // update node latency values so we can take an average later.
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i]) if (playeringame[i] && playernode[i] != UINT8_MAX)
realpingtable[i] += G_TicsToMilliseconds(GetLag(playernode[i])); realpingtable[i] += G_TicsToMilliseconds(GetLag(playernode[i]));
pingmeasurecount++; 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 version and subversion. It should only account for the
basic fields of the packet, and change infrequently. basic fields of the packet, and change infrequently.
*/ */
#define PACKETVERSION 2 #define PACKETVERSION 3
// Network play related stuff. // Network play related stuff.
// There is a data struct that stores network // There is a data struct that stores network
@ -36,7 +36,7 @@ basic fields of the packet, and change infrequently.
// be transmitted. // be transmitted.
// Networking and tick handling related. // Networking and tick handling related.
#define BACKUPTICS 32 #define BACKUPTICS 96
#define MAXTEXTCMD 256 #define MAXTEXTCMD 256
// //
// Packet structure // Packet structure
@ -67,11 +67,9 @@ typedef enum
PT_RESYNCHEND, // Player is now resynched and is being requested to remake the gametic PT_RESYNCHEND, // Player is now resynched and is being requested to remake the gametic
PT_RESYNCHGET, // Player got resynch packet PT_RESYNCHGET, // Player got resynch packet
#ifdef HAVE_BLUA
PT_SENDINGLUAFILE, // Server telling a client Lua needs to open a file 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_ASKLUAFILE, // Client telling the server they don't have the file
PT_HASLUAFILE, // Client telling the server they 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. // Add non-PT_CANFAIL packet types here to avoid breaking MS compatibility.
@ -367,6 +365,7 @@ typedef struct
UINT8 subversion; UINT8 subversion;
UINT8 numberofplayer; UINT8 numberofplayer;
UINT8 maxplayer; UINT8 maxplayer;
UINT8 refusereason; // 0: joinable, 1: joins disabled, 2: full
char gametypename[24]; char gametypename[24];
UINT8 modifiedgame; UINT8 modifiedgame;
UINT8 cheatsenabled; UINT8 cheatsenabled;

View file

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

View file

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

View file

@ -22,7 +22,7 @@
#include "g_input.h" #include "g_input.h"
#include "m_menu.h" #include "m_menu.h"
#include "r_local.h" #include "r_local.h"
#include "r_things.h" #include "r_skins.h"
#include "p_local.h" #include "p_local.h"
#include "p_setup.h" #include "p_setup.h"
#include "s_sound.h" #include "s_sound.h"
@ -157,10 +157,8 @@ static void Command_Isgamemodified_f(void);
static void Command_Cheats_f(void); static void Command_Cheats_f(void);
#ifdef _DEBUG #ifdef _DEBUG
static void Command_Togglemodified_f(void); static void Command_Togglemodified_f(void);
#ifdef HAVE_BLUA
static void Command_Archivetest_f(void); static void Command_Archivetest_f(void);
#endif #endif
#endif
// ========================================================================= // =========================================================================
// CLIENT VARIABLES // CLIENT VARIABLES
@ -415,11 +413,9 @@ const char *netxcmdnames[MAXNETXCMD - 1] =
"DELFILE", // replace next time we add an XD "DELFILE", // replace next time we add an XD
"SETMOTD", "SETMOTD",
"SUICIDE", "SUICIDE",
#ifdef HAVE_BLUA
"LUACMD", "LUACMD",
"LUAVAR", "LUAVAR",
"LUAFILE" "LUAFILE"
#endif
}; };
// ========================================================================= // =========================================================================
@ -452,10 +448,8 @@ void D_RegisterServerCommands(void)
RegisterNetXCmd(XD_PAUSE, Got_Pause); RegisterNetXCmd(XD_PAUSE, Got_Pause);
RegisterNetXCmd(XD_SUICIDE, Got_Suicide); RegisterNetXCmd(XD_SUICIDE, Got_Suicide);
RegisterNetXCmd(XD_RUNSOC, Got_RunSOCcmd); RegisterNetXCmd(XD_RUNSOC, Got_RunSOCcmd);
#ifdef HAVE_BLUA
RegisterNetXCmd(XD_LUACMD, Got_Luacmd); RegisterNetXCmd(XD_LUACMD, Got_Luacmd);
RegisterNetXCmd(XD_LUAFILE, Got_LuaFile); RegisterNetXCmd(XD_LUAFILE, Got_LuaFile);
#endif
// Remote Administration // Remote Administration
COM_AddCommand("password", Command_Changepassword_f); COM_AddCommand("password", Command_Changepassword_f);
@ -504,9 +498,7 @@ void D_RegisterServerCommands(void)
COM_AddCommand("cheats", Command_Cheats_f); // test COM_AddCommand("cheats", Command_Cheats_f); // test
#ifdef _DEBUG #ifdef _DEBUG
COM_AddCommand("togglemodified", Command_Togglemodified_f); COM_AddCommand("togglemodified", Command_Togglemodified_f);
#ifdef HAVE_BLUA
COM_AddCommand("archivetest", Command_Archivetest_f); COM_AddCommand("archivetest", Command_Archivetest_f);
#endif
#endif #endif
// for master server connection // for master server connection
@ -915,7 +907,7 @@ void D_RegisterClientCommands(void)
#ifdef _DEBUG #ifdef _DEBUG
COM_AddCommand("causecfail", Command_CauseCfail_f); COM_AddCommand("causecfail", Command_CauseCfail_f);
#endif #endif
#if defined(HAVE_BLUA) && defined(LUA_ALLOW_BYTECODE) #ifdef LUA_ALLOW_BYTECODE
COM_AddCommand("dumplua", Command_Dumplua_f); COM_AddCommand("dumplua", Command_Dumplua_f);
#endif #endif
} }
@ -2029,9 +2021,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
UINT8 flags; UINT8 flags;
INT32 resetplayer = 1, lastgametype; INT32 resetplayer = 1, lastgametype;
UINT8 skipprecutscene, FLS; UINT8 skipprecutscene, FLS;
#ifdef HAVE_BLUA
INT16 mapnumber; INT16 mapnumber;
#endif
if (playernum != serverplayer && !IsPlayerAdmin(playernum)) if (playernum != serverplayer && !IsPlayerAdmin(playernum))
{ {
@ -2093,10 +2083,8 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
CV_StealthSetValue(&cv_playercolor, players[0].skincolor); CV_StealthSetValue(&cv_playercolor, players[0].skincolor);
} }
#ifdef HAVE_BLUA
mapnumber = M_MapNumber(mapname[3], mapname[4]); mapnumber = M_MapNumber(mapname[3], mapname[4]);
LUAh_MapChange(mapnumber); LUAh_MapChange(mapnumber);
#endif
G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene, FLS); G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene, FLS);
if (demoplayback && !timingdemo) if (demoplayback && !timingdemo)
@ -2680,11 +2668,9 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
return; return;
} }
#ifdef HAVE_BLUA
// Don't switch team, just go away, please, go awaayyyy, aaauuauugghhhghgh // 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)) if (!LUAh_TeamSwitch(&players[playernum], NetPacket.packet.newteam, players[playernum].spectator, NetPacket.packet.autobalance, NetPacket.packet.scrambled))
return; return;
#endif
//no status changes after hidetime //no status changes after hidetime
if ((gametyperules & GTR_HIDEFROZEN) && (leveltime >= (hidetime * TICRATE))) 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. //reset view if you are changed, or viewing someone who was changed.
if (playernum == consoleplayer || displayplayer == playernum) if (playernum == consoleplayer || displayplayer == playernum)
{ {
#ifdef HAVE_BLUA
// Call ViewpointSwitch hooks here. // Call ViewpointSwitch hooks here.
// The viewpoint was forcibly changed. // The viewpoint was forcibly changed.
if (displayplayer != consoleplayer) // You're already viewing yourself. No big deal. if (displayplayer != consoleplayer) // You're already viewing yourself. No big deal.
LUAh_ViewpointSwitch(&players[playernum], &players[displayplayer], true); LUAh_ViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true);
#endif
displayplayer = consoleplayer; displayplayer = consoleplayer;
} }
@ -3344,10 +3328,6 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
boolean kick = false; boolean kick = false;
boolean toomany = false; boolean toomany = false;
INT32 i,j; INT32 i,j;
serverinfo_pak *dummycheck = NULL;
// Shut the compiler up.
(void)dummycheck;
READSTRINGN(*cp, filename, 240); READSTRINGN(*cp, filename, 240);
READMEM(*cp, md5sum, 16); READMEM(*cp, md5sum, 16);
@ -3574,10 +3554,8 @@ static void Command_Playintro_f(void)
*/ */
FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void) FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void)
{ {
#ifdef HAVE_BLUA
if (Playing()) if (Playing())
LUAh_GameQuit(); LUAh_GameQuit();
#endif
I_Quit(); I_Quit();
} }
@ -4239,10 +4217,8 @@ void Command_ExitGame_f(void)
{ {
INT32 i; INT32 i;
#ifdef HAVE_BLUA
if (Playing()) if (Playing())
LUAh_GameQuit(); LUAh_GameQuit();
#endif
D_QuitNetGame(); D_QuitNetGame();
CL_Reset(); CL_Reset();
@ -4345,7 +4321,6 @@ static void Command_Togglemodified_f(void)
modifiedgame = !modifiedgame; modifiedgame = !modifiedgame;
} }
#ifdef HAVE_BLUA
extern UINT8 *save_p; extern UINT8 *save_p;
static void Command_Archivetest_f(void) static void Command_Archivetest_f(void)
{ {
@ -4390,7 +4365,6 @@ static void Command_Archivetest_f(void)
CONS_Printf("Done. No crash.\n"); CONS_Printf("Done. No crash.\n");
} }
#endif #endif
#endif
/** Makes a change to ::cv_forceskin take effect immediately. /** Makes a change to ::cv_forceskin take effect immediately.
* *

View file

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

View file

@ -95,11 +95,9 @@ char downloaddir[512] = "DOWNLOAD";
INT32 lastfilenum = -1; INT32 lastfilenum = -1;
#endif #endif
#ifdef HAVE_BLUA
luafiletransfer_t *luafiletransfers = NULL; luafiletransfer_t *luafiletransfers = NULL;
boolean waitingforluafiletransfer = false; boolean waitingforluafiletransfer = false;
char luafiledir[256 + 16] = "luafiles"; char luafiledir[256 + 16] = "luafiles";
#endif
/** Fills a serverinfo packet with information about wad files loaded. /** 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) void AddLuaFileTransfer(const char *filename, const char *mode)
{ {
luafiletransfer_t **prevnext; // A pointer to the "next" field of the last transfer in the list 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 // Make sure all directories in the file path exist
MakePathDirs(fileneeded[0].filename); MakePathDirs(fileneeded[0].filename);
} }
#endif
// Number of files to send // Number of files to send
// Little optimization to quickly test if there is a file in the queue // 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++; filestosend++;
} }
#ifdef HAVE_BLUA
/** Adds a file requested by Lua to the file list for a node /** Adds a file requested by Lua to the file list for a node
* *
* \param node The node to send the file to * \param node The node to send the file to
@ -798,7 +793,6 @@ boolean SV_SendLuaFile(INT32 node, const char *filename, boolean textmode)
filestosend++; filestosend++;
return true; return true;
} }
#endif
/** Stops sending a file for a node, and removes the file request from the list, /** 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 * 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; file->status = FS_FOUND;
CONS_Printf(M_GetText("Downloading %s...(done)\n"), CONS_Printf(M_GetText("Downloading %s...(done)\n"),
filename); filename);
#ifdef HAVE_BLUA
if (luafiletransfers) if (luafiletransfers)
{ {
// Tell the server we have received the file // Tell the server we have received the file
netbuffer->packettype = PT_HASLUAFILE; netbuffer->packettype = PT_HASLUAFILE;
HSendPacket(servernode, true, 0, 0); HSendPacket(servernode, true, 0, 0);
} }
#endif
} }
} }
else else

View file

@ -72,7 +72,6 @@ boolean CL_CheckDownloadable(void);
boolean CL_SendRequestFile(void); boolean CL_SendRequestFile(void);
boolean Got_RequestFilePak(INT32 node); boolean Got_RequestFilePak(INT32 node);
#ifdef HAVE_BLUA
typedef enum typedef enum
{ {
LFTNS_WAITING, // This node is waiting for the server to send the file 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 StoreLuaFileCallback(INT32 id);
void RemoveLuaFileCallback(INT32 id); void RemoveLuaFileCallback(INT32 id);
void MakePathDirs(char *path); void MakePathDirs(char *path);
#endif
void SV_AbortSendFiles(INT32 node); void SV_AbortSendFiles(INT32 node);
void CloseNetFile(void); void CloseNetFile(void);

View file

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

View file

@ -493,7 +493,6 @@ extern UINT16 emeralds;
#define EMERALD7 64 #define EMERALD7 64
#define ALL7EMERALDS(v) ((v & (EMERALD1|EMERALD2|EMERALD3|EMERALD4|EMERALD5|EMERALD6|EMERALD7)) == (EMERALD1|EMERALD2|EMERALD3|EMERALD4|EMERALD5|EMERALD6|EMERALD7)) #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 #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]; extern INT32 luabanks[NUM_LUABANKS];

View file

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

View file

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

View file

@ -60,7 +60,7 @@ typedef enum
#endif #endif
EXT_PK3, EXT_PK3,
EXT_SOC, EXT_SOC,
EXT_LUA, // allowed even if not HAVE_BLUA so that we can yell on load attempt EXT_LUA,
NUM_EXT, NUM_EXT,
NUM_EXT_TABLE = NUM_EXT-EXT_START, NUM_EXT_TABLE = NUM_EXT-EXT_START,
EXT_LOADED = 0x80 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 "doomdef.h"
#include "doomstat.h" #include "doomstat.h"
#include "d_event.h" #include "d_event.h"
#include "g_demo.h"
extern char gamedatafilename[64]; extern char gamedatafilename[64];
extern char timeattackfolder[64]; extern char timeattackfolder[64];
@ -31,21 +32,6 @@ extern char player_names[MAXPLAYERS][MAXPLAYERNAME+1];
extern player_t players[MAXPLAYERS]; extern player_t players[MAXPLAYERS];
extern boolean playeringame[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 // gametic at level start
extern tic_t levelstarttic; extern tic_t levelstarttic;
@ -173,7 +159,6 @@ void G_DoLoadLevel(boolean resetplayer);
void G_StartTitleCard(void); void G_StartTitleCard(void);
void G_PreLevelTitleCard(void); void G_PreLevelTitleCard(void);
boolean G_IsTitleCardAvailable(void); boolean G_IsTitleCardAvailable(void);
void G_DeferedPlayDemo(const char *demo);
// Can be called by the startup code or M_Responder, calls P_SetupLevel. // Can be called by the startup code or M_Responder, calls P_SetupLevel.
void G_LoadGame(UINT32 slot, INT16 mapoverride); void G_LoadGame(UINT32 slot, INT16 mapoverride);
@ -184,54 +169,6 @@ void G_SaveGame(UINT32 slot);
void G_SaveGameOver(UINT32 slot, boolean modifylives); 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 gametypedefaultrules[NUMGAMETYPES];
extern UINT32 gametypetol[NUMGAMETYPES]; extern UINT32 gametypetol[NUMGAMETYPES];
extern INT16 gametyperankings[NUMGAMETYPES]; extern INT16 gametyperankings[NUMGAMETYPES];

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,8 +10,6 @@
/// \file lua_hook.h /// \file lua_hook.h
/// \brief hooks for Lua scripting /// \brief hooks for Lua scripting
#ifdef HAVE_BLUA
#include "r_defs.h" #include "r_defs.h"
#include "d_player.h" #include "d_player.h"
@ -58,6 +56,7 @@ enum hook {
hook_ViewpointSwitch, hook_ViewpointSwitch,
hook_SeenPlayer, hook_SeenPlayer,
hook_PlayerThink, hook_PlayerThink,
hook_ShouldJingleContinue,
hook_GameQuit, hook_GameQuit,
hook_MAX // last hook 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 boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend); // Hook for MT_NAMECHECK
#endif #endif
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink #define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
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 void LUAh_GameQuit(void); // Hook for game quitting
#endif

View file

@ -11,11 +11,10 @@
/// \brief hooks for Lua scripting /// \brief hooks for Lua scripting
#include "doomdef.h" #include "doomdef.h"
#ifdef HAVE_BLUA
#include "doomstat.h" #include "doomstat.h"
#include "p_mobj.h" #include "p_mobj.h"
#include "g_game.h" #include "g_game.h"
#include "r_things.h" #include "r_skins.h"
#include "b_bot.h" #include "b_bot.h"
#include "z_zone.h" #include "z_zone.h"
@ -69,6 +68,7 @@ const char *const hookNames[hook_MAX+1] = {
"ViewpointSwitch", "ViewpointSwitch",
"SeenPlayer", "SeenPlayer",
"PlayerThink", "PlayerThink",
"ShouldJingleContinue",
"GameQuit", "GameQuit",
NULL NULL
}; };
@ -82,6 +82,7 @@ struct hook_s
union { union {
mobjtype_t mt; mobjtype_t mt;
char *skinname; char *skinname;
char *musname;
char *funcname; char *funcname;
} s; } s;
boolean error; boolean error;
@ -150,6 +151,7 @@ static int lib_addHook(lua_State *L)
luaL_argcheck(L, hook.s.mt < NUMMOBJTYPES, 2, "invalid mobjtype_t"); luaL_argcheck(L, hook.s.mt < NUMMOBJTYPES, 2, "invalid mobjtype_t");
break; break;
case hook_BotAI: case hook_BotAI:
case hook_ShouldJingleContinue:
hook.s.skinname = NULL; hook.s.skinname = NULL;
if (lua_isstring(L, 2)) if (lua_isstring(L, 2))
{ // lowercase copy { // 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 /// \brief custom HUD rendering library for Lua scripting
#include "doomdef.h" #include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h" #include "fastcmp.h"
#include "r_defs.h" #include "r_defs.h"
#include "r_local.h" #include "r_local.h"
@ -1466,5 +1465,3 @@ void LUAh_IntermissionHUD(void)
lua_pop(gL, -1); lua_pop(gL, -1);
hud_running = false; hud_running = false;
} }
#endif

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,8 +10,6 @@
/// \file lua_script.h /// \file lua_script.h
/// \brief Lua scripting basics /// \brief Lua scripting basics
#ifdef HAVE_BLUA
#include "m_fixed.h" #include "m_fixed.h"
#include "doomtype.h" #include "doomtype.h"
#include "d_player.h" #include "d_player.h"
@ -102,5 +100,3 @@ void COM_Lua_f(void);
#define INLEVEL if (gamestate != GS_LEVEL && !titlemapinaction)\ #define INLEVEL if (gamestate != GS_LEVEL && !titlemapinaction)\
return luaL_error(L, "This can only be used in a level!"); 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 /// \brief player skin structure library for Lua scripting
#include "doomdef.h" #include "doomdef.h"
#ifdef HAVE_BLUA
#include "fastcmp.h" #include "fastcmp.h"
#include "r_things.h" #include "r_skins.h"
#include "sounds.h" #include "sounds.h"
#include "lua_script.h" #include "lua_script.h"
@ -358,5 +357,3 @@ int LUA_SkinLib(lua_State *L)
return 0; return 0;
} }
#endif

View file

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

View file

@ -788,7 +788,7 @@ void Command_CauseCfail_f(void)
} }
#endif #endif
#if defined(HAVE_BLUA) && defined(LUA_ALLOW_BYTECODE) #ifdef LUA_ALLOW_BYTECODE
void Command_Dumplua_f(void) void Command_Dumplua_f(void)
{ {
if (modifiedgame) if (modifiedgame)
@ -1025,13 +1025,9 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling)
if (ceiling) if (ceiling)
{ {
#ifdef ESLOPE
// Truncate position to match where mapthing would be when spawned // Truncate position to match where mapthing would be when spawned
// (this applies to every further P_GetZAt call as well) // (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; 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))) 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 else
{ {
#ifdef ESLOPE
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight; 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))) 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"), 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; mapthing_t *mt = mapthings;
sector_t *sec = player->mo->subsector->sector; sector_t *sec = player->mo->subsector->sector;
#ifdef HAVE_BLUA
LUA_InvalidateMapthings(); LUA_InvalidateMapthings();
#endif
mapthings = Z_Realloc(mapthings, ++nummapthings * sizeof (*mapthings), PU_LEVEL, NULL); 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); mt->y = (INT16)(player->mo->y>>FRACBITS);
if (ceiling) if (ceiling)
{ {
#ifdef ESLOPE
fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, mt->x << FRACBITS, mt->y << FRACBITS) : sec->ceilingheight; 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); mt->z = (UINT16)((cheight - player->mo->z - player->mo->height)>>FRACBITS);
} }
else else
{ {
#ifdef ESLOPE
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, mt->x << FRACBITS, mt->y << FRACBITS) : sec->floorheight; 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->z = (UINT16)((player->mo->z - fheight)>>FRACBITS);
} }
mt->angle = (INT16)(FixedInt(AngleFixed(player->mo->angle))); 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)) 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; 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); op_displayflags = (UINT16)((cheight - player->mo->z - mobjinfo[op_currentthing].height)>>FRACBITS);
} }
else else
{ {
#ifdef ESLOPE
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight; 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 = (UINT16)((player->mo->z - fheight)>>FRACBITS);
} }
op_displayflags <<= ZSHIFT; op_displayflags <<= ZSHIFT;

View file

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

View file

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

View file

@ -2204,7 +2204,7 @@ menu_t OP_DataOptionsDef = DEFAULTMENUSTYLE(
menu_t OP_ScreenshotOptionsDef = menu_t OP_ScreenshotOptionsDef =
{ {
MN_OP_MAIN + (MN_OP_DATA << 6) + (MN_OP_SCREENSHOTS << 12), MN_OP_MAIN + (MN_OP_DATA << 6) + (MN_OP_SCREENSHOTS << 12),
"M_DATA", "M_SCREEN",
sizeof (OP_ScreenshotOptionsMenu)/sizeof (menuitem_t), sizeof (OP_ScreenshotOptionsMenu)/sizeof (menuitem_t),
&OP_DataOptionsDef, &OP_DataOptionsDef,
OP_ScreenshotOptionsMenu, OP_ScreenshotOptionsMenu,
@ -5074,6 +5074,17 @@ static boolean M_SetNextMapOnPlatter(void)
} }
#endif #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) static INT32 M_CountRowsToShowOnPlatter(INT32 gt)
{ {
INT32 mapnum = 0, prevmapnum = 0, col = 0, rows = 0; INT32 mapnum = 0, prevmapnum = 0, col = 0, rows = 0;
@ -5391,7 +5402,10 @@ static void M_HandleLevelPlatter(INT32 choice)
case KEY_RIGHTARROW: case KEY_RIGHTARROW:
if (levellistmode == LLM_CREATESERVER && !lsrow) if (levellistmode == LLM_CREATESERVER && !lsrow)
{ {
INT32 startinggametype = cv_newgametype.value;
do
CV_AddValue(&cv_newgametype, 1); CV_AddValue(&cv_newgametype, 1);
while (cv_newgametype.value != startinggametype && !M_GametypeHasLevels(cv_newgametype.value));
S_StartSound(NULL,sfx_menu1); S_StartSound(NULL,sfx_menu1);
lscol = 0; lscol = 0;
@ -5420,7 +5434,10 @@ static void M_HandleLevelPlatter(INT32 choice)
case KEY_LEFTARROW: case KEY_LEFTARROW:
if (levellistmode == LLM_CREATESERVER && !lsrow) if (levellistmode == LLM_CREATESERVER && !lsrow)
{ {
INT32 startinggametype = cv_newgametype.value;
do
CV_AddValue(&cv_newgametype, -1); CV_AddValue(&cv_newgametype, -1);
while (cv_newgametype.value != startinggametype && !M_GametypeHasLevels(cv_newgametype.value));
S_StartSound(NULL,sfx_menu1); S_StartSound(NULL,sfx_menu1);
lscol = 0; lscol = 0;
@ -6657,12 +6674,6 @@ static void M_HandleAddons(INT32 choice)
M_AddonExec(KEY_ENTER); M_AddonExec(KEY_ENTER);
break; break;
case EXT_LUA: 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_SOC:
case EXT_WAD: case EXT_WAD:
#ifdef USE_KART #ifdef USE_KART
@ -10099,13 +10110,13 @@ static void M_ReplayTimeAttack(INT32 choice)
static void M_EraseGuest(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)); const char *rguest = va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value));
(void)choice;
if (choice == 'y' || choice == KEY_ENTER)
{
if (FIL_FileExists(rguest)) if (FIL_FileExists(rguest))
remove(rguest); remove(rguest);
if (currentMenu == &SP_NightsGuestReplayDef) }
M_SetupNextMenu(&SP_NightsAttackDef); M_SetupNextMenu(currentMenu->prevMenu->prevMenu);
else
M_SetupNextMenu(&SP_TimeAttackDef);
Nextmap_OnChange(); Nextmap_OnChange();
M_StartMessage(M_GetText("Guest replay data erased.\n"),NULL,MM_NOTHING); 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++) for (i = 0; i < min(serverlistcount - serverlistpage * SERVERS_PER_PAGE, SERVERS_PER_PAGE); i++)
{ {
INT32 slindex = i + serverlistpage * SERVERS_PER_PAGE; 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; |((itemOn == FIRSTSERVERLINE+i) ? V_YELLOWMAP : 0)|V_ALLOWLOWERCASE;
V_DrawString(currentMenu->x, S_LINEY(i), globalflags, serverlist[slindex].info.servername); V_DrawString(currentMenu->x, S_LINEY(i), globalflags, serverlist[slindex].info.servername);

View file

@ -15,9 +15,10 @@
#ifndef __X_MENU__ #ifndef __X_MENU__
#define __X_MENU__ #define __X_MENU__
#include "doomstat.h" // for NUMGAMETYPES
#include "d_event.h" #include "d_event.h"
#include "command.h" #include "command.h"
#include "r_things.h" // for SKINNAMESIZE #include "r_skins.h" // for SKINNAMESIZE
#include "f_finale.h" // for ttmode_enum #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 "doomstat.h"
#include "m_random.h" #include "m_random.h"
#include "p_local.h" #include "p_local.h"
#ifdef ESLOPE
#include "p_slopes.h" #include "p_slopes.h"
#endif
#include "r_state.h" #include "r_state.h"
#include "s_sound.h" #include "s_sound.h"
#include "z_zone.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) if (R_PointInSubsector(a, b)->sector == sec)
{ {
mobj_t *spawned = NULL; mobj_t *spawned = NULL;
#ifdef ESLOPE
if (*rover->t_slope) if (*rover->t_slope)
topz = P_GetZAt(*rover->t_slope, a, b) - (spacing>>1); topz = P_GetZAt(*rover->t_slope, a, b) - (spacing>>1);
if (*rover->b_slope) if (*rover->b_slope)
bottomz = P_GetZAt(*rover->b_slope, a, b); bottomz = P_GetZAt(*rover->b_slope, a, b);
#endif
for (c = topz; c > bottomz; c -= spacing) 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) if (special->flags & (MF_ENEMY|MF_BOSS) && special->flags2 & MF2_FRET)
return; return;
#ifdef HAVE_BLUA
if (LUAh_TouchSpecial(special, toucher) || P_MobjWasRemoved(special)) if (LUAh_TouchSpecial(special, toucher) || P_MobjWasRemoved(special))
return; return;
#endif
// 0 = none, 1 = elemental pierce, 2 = bubble bounce // 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) 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) if (!netgame)
return; // Presumably it's obvious what's happening in splitscreen. return; // Presumably it's obvious what's happening in splitscreen.
#ifdef HAVE_BLUA
if (LUAh_HurtMsg(player, inflictor, source, damagetype)) if (LUAh_HurtMsg(player, inflictor, source, damagetype))
return; return;
#endif
deadtarget = (player->mo->health <= 0); 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->flags2 &= ~(MF2_SKULLFLY|MF2_NIGHTSPULL);
target->health = 0; // This makes it easy to check if something's dead elsewhere. 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)) if (LUAh_MobjDeath(target, inflictor, source, damagetype) || P_MobjWasRemoved(target))
return; return;
#endif
// Let EVERYONE know what happened to a player! 01-29-2002 Tails // Let EVERYONE know what happened to a player! 01-29-2002 Tails
if (target->player && !target->player->spectator) 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) boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
{ {
player_t *player; player_t *player;
#ifdef HAVE_BLUA
boolean force = false; boolean force = false;
#else
static const boolean force = false;
#endif
if (objectplacing) if (objectplacing)
return false; return false;
@ -3533,7 +3523,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
return false; return false;
} }
#ifdef HAVE_BLUA
// Everything above here can't be forced. // Everything above here can't be forced.
if (!metalrecording) if (!metalrecording)
{ {
@ -3545,7 +3534,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
else if (shouldForce == 2) else if (shouldForce == 2)
return false; return false;
} }
#endif
if (!force) 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 if (!force && target->flags2 & MF2_FRET) // Currently flashing from being hit
return false; return false;
#ifdef HAVE_BLUA
if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype) || P_MobjWasRemoved(target)) if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype) || P_MobjWasRemoved(target))
return true; return true;
#endif
if (target->health > 1) if (target->health > 1)
target->flags2 |= MF2_FRET; 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))) || (G_GametypeHasTeams() && player->ctfteam == source->player->ctfteam)))
return false; // Don't run eachother over in special stages and team games and such 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)) if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype))
return true; return true;
#endif
P_NiGHTSDamage(target, source); // -5s :( P_NiGHTSDamage(target, source); // -5s :(
return true; return true;
} }
@ -3687,18 +3671,14 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
if (force if (force
|| (inflictor && inflictor->flags & MF_MISSILE && inflictor->flags2 & MF2_SUPERFIRE)) // Super Sonic is stunned! || (inflictor && inflictor->flags & MF_MISSILE && inflictor->flags2 & MF2_SUPERFIRE)) // Super Sonic is stunned!
{ {
#ifdef HAVE_BLUA
if (!LUAh_MobjDamage(target, inflictor, source, damage, damagetype)) if (!LUAh_MobjDamage(target, inflictor, source, damage, damagetype))
#endif
P_SuperDamage(player, inflictor, source, damage); P_SuperDamage(player, inflictor, source, damage);
return true; return true;
} }
return false; return false;
} }
#ifdef HAVE_BLUA
else if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype)) else if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype))
return true; return true;
#endif
else if (player->powers[pw_shield] || (player->bot && !ultimatemode)) //If One-Hit Shield else if (player->powers[pw_shield] || (player->bot && !ultimatemode)) //If One-Hit Shield
{ {
P_ShieldDamage(player, inflictor, source, damage, damagetype); P_ShieldDamage(player, inflictor, source, damage, damagetype);

View file

@ -66,9 +66,7 @@ typedef enum
THINK_POLYOBJ, THINK_POLYOBJ,
THINK_MAIN, THINK_MAIN,
THINK_MOBJ, THINK_MOBJ,
#ifdef ESLOPE
THINK_DYNSLOPE, THINK_DYNSLOPE,
#endif
THINK_PRECIP, THINK_PRECIP,
NUM_THINKERLISTS NUM_THINKERLISTS
} thinklistnum_t; /**< Thinker lists. */ } thinklistnum_t; /**< Thinker lists. */
@ -250,7 +248,7 @@ extern jingle_t jingleinfo[NUMJINGLES];
#define JINGLEPOSTFADE 1000 #define JINGLEPOSTFADE 1000
void P_PlayJingle(player_t *player, jingletype_t jingletype); 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); 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 camera_t *mapcampointer;
extern fixed_t tmx; extern fixed_t tmx;
extern fixed_t tmy; extern fixed_t tmy;
#ifdef ESLOPE
extern pslope_t *tmfloorslope, *tmceilingslope; extern pslope_t *tmfloorslope, *tmceilingslope;
#endif
/* cphipps 2004/08/30 */ /* cphipps 2004/08/30 */
extern void P_MapStart(void); extern void P_MapStart(void);

View file

@ -27,9 +27,7 @@
#include "r_splats.h" #include "r_splats.h"
#ifdef ESLOPE
#include "p_slopes.h" #include "p_slopes.h"
#endif
#include "z_zone.h" #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 *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) mobj_t *tmhitthing; // the solid thing you bumped into (for collisions)
ffloor_t *tmfloorrover, *tmceilingrover; ffloor_t *tmfloorrover, *tmceilingrover;
#ifdef ESLOPE
pslope_t *tmfloorslope, *tmceilingslope; pslope_t *tmfloorslope, *tmceilingslope;
#endif
// keep track of the line that lowers the ceiling, // keep track of the line that lowers the ceiling,
// so missiles don't explode against sky hack walls // 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) if (!vertispeed && !horizspeed)
return false; 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. 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) if (spring->eflags & MFE_VERTICALFLIP)
vertispeed *= -1; vertispeed *= -1;
@ -439,9 +433,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
P_SetPlayerMobjState(object, S_PLAY_FALL); P_SetPlayerMobjState(object, S_PLAY_FALL);
} }
#ifdef ESLOPE
object->standingslope = NULL; // And again. object->standingslope = NULL; // And again.
#endif
final = true; final = true;
@ -491,9 +483,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
zdist = object->z - spring->z; zdist = object->z - spring->z;
} }
#ifdef ESLOPE
object->standingslope = NULL; // No launching off at silly angles for you. object->standingslope = NULL; // No launching off at silly angles for you.
#endif
switch (spring->type) switch (spring->type)
{ {
@ -756,11 +746,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
if (tmthing->z + tmthing->height < thing->z) if (tmthing->z + tmthing->height < thing->z)
return true; // underneath return true; // underneath
#ifdef HAVE_BLUA
// REX HAS SEEN YOU // REX HAS SEEN YOU
if (!LUAh_SeenPlayer(tmthing->target->player, thing->player)) if (!LUAh_SeenPlayer(tmthing->target->player, thing->player))
return false; return false;
#endif
seenplayer = thing->player; seenplayer = thing->player;
return false; 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 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 UINT8 shouldCollide = LUAh_MobjCollide(thing, tmthing); // checks hook for thing's type
if (P_MobjWasRemoved(tmthing) || P_MobjWasRemoved(thing)) if (P_MobjWasRemoved(tmthing) || P_MobjWasRemoved(thing))
@ -957,9 +944,8 @@ static boolean PIT_CheckThing(mobj_t *thing)
return false; // force collide return false; // force collide
else if (shouldCollide == 2) else if (shouldCollide == 2)
return true; // force no collide return true; // force no collide
}
{ shouldCollide = LUAh_MobjMoveCollide(tmthing, thing); // checks hook for tmthing's type
UINT8 shouldCollide = LUAh_MobjMoveCollide(tmthing, thing); // checks hook for tmthing's type
if (P_MobjWasRemoved(tmthing) || P_MobjWasRemoved(thing)) if (P_MobjWasRemoved(tmthing) || P_MobjWasRemoved(thing))
return true; // one of them was removed??? return true; // one of them was removed???
if (shouldCollide == 1) if (shouldCollide == 1)
@ -967,7 +953,6 @@ static boolean PIT_CheckThing(mobj_t *thing)
else if (shouldCollide == 2) else if (shouldCollide == 2)
return true; // force no collide 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)) 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; tmfloorz = thing->z + thing->height;
tmfloorrover = NULL; tmfloorrover = NULL;
#ifdef ESLOPE
tmfloorslope = NULL; tmfloorslope = NULL;
#endif
} }
return true; return true;
} }
@ -1762,18 +1745,14 @@ static boolean PIT_CheckThing(mobj_t *thing)
tmfloorz = tmceilingz = topz; // block while in air tmfloorz = tmceilingz = topz; // block while in air
tmceilingrover = NULL; tmceilingrover = NULL;
#ifdef ESLOPE
tmceilingslope = NULL; tmceilingslope = NULL;
#endif
tmfloorthing = thing; // needed for side collision tmfloorthing = thing; // needed for side collision
} }
else if (topz < tmceilingz && tmthing->z <= thing->z+thing->height) else if (topz < tmceilingz && tmthing->z <= thing->z+thing->height)
{ {
tmceilingz = topz; tmceilingz = topz;
tmceilingrover = NULL; tmceilingrover = NULL;
#ifdef ESLOPE
tmceilingslope = NULL; tmceilingslope = NULL;
#endif
tmfloorthing = thing; // thing we may stand on tmfloorthing = thing; // thing we may stand on
} }
} }
@ -1788,9 +1767,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
{ {
tmceilingz = thing->z; tmceilingz = thing->z;
tmceilingrover = NULL; tmceilingrover = NULL;
#ifdef ESLOPE
tmceilingslope = NULL; tmceilingslope = NULL;
#endif
} }
return true; return true;
} }
@ -1809,18 +1786,14 @@ static boolean PIT_CheckThing(mobj_t *thing)
tmfloorz = tmceilingz = topz; // block while in air tmfloorz = tmceilingz = topz; // block while in air
tmfloorrover = NULL; tmfloorrover = NULL;
#ifdef ESLOPE
tmfloorslope = NULL; tmfloorslope = NULL;
#endif
tmfloorthing = thing; // needed for side collision tmfloorthing = thing; // needed for side collision
} }
else if (topz > tmfloorz && tmthing->z+tmthing->height >= thing->z) else if (topz > tmfloorz && tmthing->z+tmthing->height >= thing->z)
{ {
tmfloorz = topz; tmfloorz = topz;
tmfloorrover = NULL; tmfloorrover = NULL;
#ifdef ESLOPE
tmfloorslope = NULL; tmfloorslope = NULL;
#endif
tmfloorthing = thing; // thing we may stand on 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 // this line is out of the if so upper and lower textures can be hit by a splat
blockingline = ld; blockingline = ld;
#ifdef HAVE_BLUA
{ {
UINT8 shouldCollide = LUAh_MobjLineCollide(tmthing, blockingline); // checks hook for thing's type UINT8 shouldCollide = LUAh_MobjLineCollide(tmthing, blockingline); // checks hook for thing's type
if (P_MobjWasRemoved(tmthing)) if (P_MobjWasRemoved(tmthing))
@ -1956,7 +1928,6 @@ static boolean PIT_CheckLine(line_t *ld)
else if (shouldCollide == 2) else if (shouldCollide == 2)
return true; // force no collide return true; // force no collide
} }
#endif
if (!ld->backsector) // one sided line if (!ld->backsector) // one sided line
{ {
@ -1983,18 +1954,14 @@ static boolean PIT_CheckLine(line_t *ld)
tmceilingz = opentop; tmceilingz = opentop;
ceilingline = ld; ceilingline = ld;
tmceilingrover = openceilingrover; tmceilingrover = openceilingrover;
#ifdef ESLOPE
tmceilingslope = opentopslope; tmceilingslope = opentopslope;
#endif
} }
if (openbottom > tmfloorz) if (openbottom > tmfloorz)
{ {
tmfloorz = openbottom; tmfloorz = openbottom;
tmfloorrover = openfloorrover; tmfloorrover = openfloorrover;
#ifdef ESLOPE
tmfloorslope = openbottomslope; tmfloorslope = openbottomslope;
#endif
} }
if (highceiling > tmdrpoffceilz) 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; tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->ceilingheight;
tmfloorrover = NULL; tmfloorrover = NULL;
tmceilingrover = NULL; tmceilingrover = NULL;
#ifdef ESLOPE
tmfloorslope = newsubsec->sector->f_slope; tmfloorslope = newsubsec->sector->f_slope;
tmceilingslope = newsubsec->sector->c_slope; tmceilingslope = newsubsec->sector->c_slope;
#endif
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered. // Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
if (newsubsec->sector->ffloors) if (newsubsec->sector->ffloors)
@ -2119,9 +2084,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
if (tmfloorz < topheight - sinklevel) { if (tmfloorz < topheight - sinklevel) {
tmfloorz = topheight - sinklevel; tmfloorz = topheight - sinklevel;
tmfloorrover = rover; tmfloorrover = rover;
#ifdef ESLOPE
tmfloorslope = *rover->t_slope; tmfloorslope = *rover->t_slope;
#endif
} }
} }
else if (thing->eflags & MFE_VERTICALFLIP && thingtop <= bottomheight + sinklevel && thing->momz >= 0) 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) { if (tmceilingz > bottomheight + sinklevel) {
tmceilingz = bottomheight + sinklevel; tmceilingz = bottomheight + sinklevel;
tmceilingrover = rover; tmceilingrover = rover;
#ifdef ESLOPE
tmceilingslope = *rover->b_slope; 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) { if (tmfloorz < thing->z) {
tmfloorz = thing->z; tmfloorz = thing->z;
tmfloorrover = rover; tmfloorrover = rover;
#ifdef ESLOPE
tmfloorslope = NULL; tmfloorslope = NULL;
#endif
} }
} }
// Quicksand blocks never change heights otherwise. // 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; tmfloorz = tmdropoffz = topheight;
tmfloorrover = rover; tmfloorrover = rover;
#ifdef ESLOPE
tmfloorslope = *rover->t_slope; tmfloorslope = *rover->t_slope;
#endif
} }
if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2) if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2)
&& !(rover->flags & FF_PLATFORM) && !(rover->flags & FF_PLATFORM)
@ -2183,9 +2140,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
{ {
tmceilingz = tmdrpoffceilz = bottomheight; tmceilingz = tmdrpoffceilz = bottomheight;
tmceilingrover = rover; tmceilingrover = rover;
#ifdef ESLOPE
tmceilingslope = *rover->b_slope; 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)) { if (polytop > tmfloorz && abs(delta1) < abs(delta2)) {
tmfloorz = tmdropoffz = polytop; tmfloorz = tmdropoffz = polytop;
#ifdef ESLOPE
tmfloorslope = NULL; tmfloorslope = NULL;
#endif
tmfloorrover = NULL; tmfloorrover = NULL;
} }
if (polybottom < tmceilingz && abs(delta1) >= abs(delta2)) { if (polybottom < tmceilingz && abs(delta1) >= abs(delta2)) {
tmceilingz = tmdrpoffceilz = polybottom; tmceilingz = tmdrpoffceilz = polybottom;
#ifdef ESLOPE
tmceilingslope = NULL; tmceilingslope = NULL;
#endif
tmceilingrover = NULL; tmceilingrover = NULL;
} }
} }
@ -2671,10 +2622,8 @@ boolean PIT_PushableMoved(mobj_t *thing)
line_t *oldblockline = blockingline; line_t *oldblockline = blockingline;
ffloor_t *oldflrrover = tmfloorrover; ffloor_t *oldflrrover = tmfloorrover;
ffloor_t *oldceilrover = tmceilingrover; ffloor_t *oldceilrover = tmceilingrover;
#ifdef ESLOPE
pslope_t *oldfslope = tmfloorslope; pslope_t *oldfslope = tmfloorslope;
pslope_t *oldcslope = tmceilingslope; pslope_t *oldcslope = tmceilingslope;
#endif
// Move the player // Move the player
P_TryMove(thing, thing->x+stand->momx, thing->y+stand->momy, true); P_TryMove(thing, thing->x+stand->momx, thing->y+stand->momy, true);
@ -2689,10 +2638,8 @@ boolean PIT_PushableMoved(mobj_t *thing)
blockingline = oldblockline; blockingline = oldblockline;
tmfloorrover = oldflrrover; tmfloorrover = oldflrrover;
tmceilingrover = oldceilrover; tmceilingrover = oldceilrover;
#ifdef ESLOPE
tmfloorslope = oldfslope; tmfloorslope = oldfslope;
tmceilingslope = oldcslope; tmceilingslope = oldcslope;
#endif
thing->momz = stand->momz; thing->momz = stand->momz;
} }
else 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 tryy = thing->y;
fixed_t radius = thing->radius; fixed_t radius = thing->radius;
fixed_t thingtop = thing->z + thing->height; fixed_t thingtop = thing->z + thing->height;
#ifdef ESLOPE
fixed_t startingonground = P_IsObjectOnGround(thing); fixed_t startingonground = P_IsObjectOnGround(thing);
#endif
floatok = false; floatok = false;
if (radius < MAXRADIUS/2) 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->ceilingrover = tmceilingrover;
thing->eflags |= MFE_JUSTSTEPPEDDOWN; thing->eflags |= MFE_JUSTSTEPPEDDOWN;
} }
#ifdef ESLOPE
else if (tmceilingz < thingtop && thingtop - tmceilingz <= maxstep) else if (tmceilingz < thingtop && thingtop - tmceilingz <= maxstep)
{ {
thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height; thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height;
thing->ceilingrover = tmceilingrover; thing->ceilingrover = tmceilingrover;
thing->eflags |= MFE_JUSTSTEPPEDDOWN; thing->eflags |= MFE_JUSTSTEPPEDDOWN;
} }
#endif
} }
else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->z - tmfloorz <= maxstep) 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->floorrover = tmfloorrover;
thing->eflags |= MFE_JUSTSTEPPEDDOWN; thing->eflags |= MFE_JUSTSTEPPEDDOWN;
} }
#ifdef ESLOPE
else if (tmfloorz > thing->z && tmfloorz - thing->z <= maxstep) else if (tmfloorz > thing->z && tmfloorz - thing->z <= maxstep)
{ {
thing->z = thing->floorz = tmfloorz; thing->z = thing->floorz = tmfloorz;
thing->floorrover = tmfloorrover; thing->floorrover = tmfloorrover;
thing->eflags |= MFE_JUSTSTEPPEDDOWN; thing->eflags |= MFE_JUSTSTEPPEDDOWN;
} }
#endif
} }
if (thing->eflags & MFE_VERTICALFLIP) 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->floorrover = tmfloorrover;
thing->ceilingrover = tmceilingrover; thing->ceilingrover = tmceilingrover;
#ifdef ESLOPE
if (!(thing->flags & MF_NOCLIPHEIGHT)) if (!(thing->flags & MF_NOCLIPHEIGHT))
{ {
// Assign thing's standingslope if needed // 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 else // don't set standingslope if you're not going to clip against it
thing->standingslope = NULL; thing->standingslope = NULL;
#endif
thing->x = x; thing->x = x;
thing->y = y; 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); 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; 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; 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) if (glidesector->sector != player->mo->subsector->sector)
{ {
@ -3299,12 +3233,10 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle)
topheight = *rover->topheight; topheight = *rover->topheight;
bottomheight = *rover->bottomheight; bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope) if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y); topheight = P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y);
if (*rover->b_slope) if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y); bottomheight = P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y);
#endif
floorclimb = true; floorclimb = true;
@ -3460,12 +3392,10 @@ isblocking:
topheight = *rover->topheight; topheight = *rover->topheight;
bottomheight = *rover->bottomheight; bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope) if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, slidemo->x, slidemo->y); topheight = P_GetZAt(*rover->t_slope, slidemo->x, slidemo->y);
if (*rover->b_slope) if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, slidemo->x, slidemo->y); bottomheight = P_GetZAt(*rover->b_slope, slidemo->x, slidemo->y);
#endif
if (topheight < slidemo->z) if (topheight < slidemo->z)
continue; continue;
@ -3670,10 +3600,8 @@ static void P_CheckLavaWall(mobj_t *mo, sector_t *sec)
if (rover->master->flags & ML_BLOCKMONSTERS) if (rover->master->flags & ML_BLOCKMONSTERS)
continue; continue;
topheight = topheight = *rover->t_slope ?
#ifdef ESLOPE P_GetZAt(*rover->t_slope, mo->x, mo->y) :
*rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) :
#endif
*rover->topheight; *rover->topheight;
if (mo->eflags & MFE_VERTICALFLIP) if (mo->eflags & MFE_VERTICALFLIP)
@ -3687,10 +3615,8 @@ static void P_CheckLavaWall(mobj_t *mo, sector_t *sec)
continue; continue;
} }
bottomheight = bottomheight = *rover->b_slope ?
#ifdef ESLOPE P_GetZAt(*rover->b_slope, mo->x, mo->y) :
*rover->b_slope ? P_GetZAt(*rover->b_slope, mo->x, mo->y) :
#endif
*rover->bottomheight; *rover->bottomheight;
if (mo->eflags & MFE_VERTICALFLIP) if (mo->eflags & MFE_VERTICALFLIP)
@ -4278,12 +4204,10 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
topheight = *rover->topheight; topheight = *rover->topheight;
bottomheight = *rover->bottomheight; bottomheight = *rover->bottomheight;
/*#ifdef ESLOPE /*if (rover->t_slope)
if (rover->t_slope)
topheight = P_GetZAt(rover->t_slope, thing->x, thing->y); topheight = P_GetZAt(rover->t_slope, thing->x, thing->y);
if (rover->b_slope) if (rover->b_slope)
bottomheight = P_GetZAt(rover->b_slope, thing->x, thing->y); bottomheight = P_GetZAt(rover->b_slope, thing->x, thing->y);*/
#endif*/
delta1 = thing->z - (bottomheight + topheight)/2; delta1 = thing->z - (bottomheight + topheight)/2;
delta2 = thingtop - (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; sector_t *sec = R_PointInSubsector(x, y)->sector;
fixed_t floorz = sec->floorheight; fixed_t floorz = sec->floorheight;
#ifdef ESLOPE
if (sec->f_slope) if (sec->f_slope)
floorz = P_GetZAt(sec->f_slope, x, y); floorz = P_GetZAt(sec->f_slope, x, y);
#endif
// Intercept the stupid 'fall through 3dfloors' bug Tails 03-17-2002 // Intercept the stupid 'fall through 3dfloors' bug Tails 03-17-2002
if (sec->ffloors) 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; topheight = *rover->topheight;
bottomheight = *rover->bottomheight; bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope) if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, x, y); topheight = P_GetZAt(*rover->t_slope, x, y);
if (*rover->b_slope) if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, x, y); bottomheight = P_GetZAt(*rover->b_slope, x, y);
#endif
if (rover->flags & FF_QUICKSAND) 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 // OPTIMIZE: keep this precalculated
// //
fixed_t opentop, openbottom, openrange, lowfloor, highceiling; fixed_t opentop, openbottom, openrange, lowfloor, highceiling;
#ifdef ESLOPE
pslope_t *opentopslope, *openbottomslope; pslope_t *opentopslope, *openbottomslope;
#endif
ffloor_t *openfloorrover, *openceilingrover; ffloor_t *openfloorrover, *openceilingrover;
// P_CameraLineOpening // P_CameraLineOpening
@ -307,24 +305,20 @@ void P_CameraLineOpening(line_t *linedef)
{ {
frontfloor = sectors[front->camsec].floorheight; frontfloor = sectors[front->camsec].floorheight;
frontceiling = sectors[front->camsec].ceilingheight; frontceiling = sectors[front->camsec].ceilingheight;
#ifdef ESLOPE
if (sectors[front->camsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope) 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); frontfloor = P_GetZAt(sectors[front->camsec].f_slope, camera.x, camera.y);
if (sectors[front->camsec].c_slope) if (sectors[front->camsec].c_slope)
frontceiling = P_GetZAt(sectors[front->camsec].c_slope, camera.x, camera.y); frontceiling = P_GetZAt(sectors[front->camsec].c_slope, camera.x, camera.y);
#endif
} }
else if (front->heightsec >= 0) else if (front->heightsec >= 0)
{ {
frontfloor = sectors[front->heightsec].floorheight; frontfloor = sectors[front->heightsec].floorheight;
frontceiling = sectors[front->heightsec].ceilingheight; frontceiling = sectors[front->heightsec].ceilingheight;
#ifdef ESLOPE
if (sectors[front->heightsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope) 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); frontfloor = P_GetZAt(sectors[front->heightsec].f_slope, camera.x, camera.y);
if (sectors[front->heightsec].c_slope) if (sectors[front->heightsec].c_slope)
frontceiling = P_GetZAt(sectors[front->heightsec].c_slope, camera.x, camera.y); frontceiling = P_GetZAt(sectors[front->heightsec].c_slope, camera.x, camera.y);
#endif
} }
else else
{ {
@ -335,23 +329,19 @@ void P_CameraLineOpening(line_t *linedef)
{ {
backfloor = sectors[back->camsec].floorheight; backfloor = sectors[back->camsec].floorheight;
backceiling = sectors[back->camsec].ceilingheight; backceiling = sectors[back->camsec].ceilingheight;
#ifdef ESLOPE
if (sectors[back->camsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope) 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); frontfloor = P_GetZAt(sectors[back->camsec].f_slope, camera.x, camera.y);
if (sectors[back->camsec].c_slope) if (sectors[back->camsec].c_slope)
frontceiling = P_GetZAt(sectors[back->camsec].c_slope, camera.x, camera.y); frontceiling = P_GetZAt(sectors[back->camsec].c_slope, camera.x, camera.y);
#endif
} }
else if (back->heightsec >= 0) else if (back->heightsec >= 0)
{ {
backfloor = sectors[back->heightsec].floorheight; backfloor = sectors[back->heightsec].floorheight;
backceiling = sectors[back->heightsec].ceilingheight; backceiling = sectors[back->heightsec].ceilingheight;
#ifdef ESLOPE
if (sectors[back->heightsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope) 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); frontfloor = P_GetZAt(sectors[back->heightsec].f_slope, camera.x, camera.y);
if (sectors[back->heightsec].c_slope) if (sectors[back->heightsec].c_slope)
frontceiling = P_GetZAt(sectors[back->heightsec].c_slope, camera.x, camera.y); frontceiling = P_GetZAt(sectors[back->heightsec].c_slope, camera.x, camera.y);
#endif
} }
else else
{ {
@ -469,9 +459,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
openbottom = INT32_MIN; openbottom = INT32_MIN;
highceiling = INT32_MIN; highceiling = INT32_MIN;
lowfloor = INT32_MAX; lowfloor = INT32_MAX;
#ifdef ESLOPE
opentopslope = openbottomslope = NULL; opentopslope = openbottomslope = NULL;
#endif
} }
else else
#endif #endif
@ -485,17 +473,13 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{ {
opentop = frontheight; opentop = frontheight;
highceiling = backheight; highceiling = backheight;
#ifdef ESLOPE
opentopslope = front->c_slope; opentopslope = front->c_slope;
#endif
} }
else else
{ {
opentop = backheight; opentop = backheight;
highceiling = frontheight; highceiling = frontheight;
#ifdef ESLOPE
opentopslope = back->c_slope; opentopslope = back->c_slope;
#endif
} }
frontheight = P_GetFloorZ(mobj, front, tmx, tmy, linedef); frontheight = P_GetFloorZ(mobj, front, tmx, tmy, linedef);
@ -505,17 +489,13 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{ {
openbottom = frontheight; openbottom = frontheight;
lowfloor = backheight; lowfloor = backheight;
#ifdef ESLOPE
openbottomslope = front->f_slope; openbottomslope = front->f_slope;
#endif
} }
else else
{ {
openbottom = backheight; openbottom = backheight;
lowfloor = frontheight; lowfloor = frontheight;
#ifdef ESLOPE
openbottomslope = back->f_slope; openbottomslope = back->f_slope;
#endif
} }
} }
@ -647,9 +627,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{ {
if (bottomheight < opentop) { if (bottomheight < opentop) {
opentop = bottomheight; opentop = bottomheight;
#ifdef ESLOPE
opentopslope = *rover->b_slope; opentopslope = *rover->b_slope;
#endif
openceilingrover = rover; openceilingrover = rover;
} }
else if (bottomheight < highceiling) else if (bottomheight < highceiling)
@ -660,9 +638,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{ {
if (topheight > openbottom) { if (topheight > openbottom) {
openbottom = topheight; openbottom = topheight;
#ifdef ESLOPE
openbottomslope = *rover->t_slope; openbottomslope = *rover->t_slope;
#endif
openfloorrover = rover; openfloorrover = rover;
} }
else if (topheight > lowfloor) else if (topheight > lowfloor)
@ -693,9 +669,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{ {
if (bottomheight < opentop) { if (bottomheight < opentop) {
opentop = bottomheight; opentop = bottomheight;
#ifdef ESLOPE
opentopslope = *rover->b_slope; opentopslope = *rover->b_slope;
#endif
openceilingrover = rover; openceilingrover = rover;
} }
else if (bottomheight < highceiling) else if (bottomheight < highceiling)
@ -706,9 +680,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{ {
if (topheight > openbottom) { if (topheight > openbottom) {
openbottom = topheight; openbottom = topheight;
#ifdef ESLOPE
openbottomslope = *rover->t_slope; openbottomslope = *rover->t_slope;
#endif
openfloorrover = rover; openfloorrover = rover;
} }
else if (topheight > lowfloor) 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); boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y);
extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling; extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling;
#ifdef ESLOPE
extern pslope_t *opentopslope, *openbottomslope; extern pslope_t *opentopslope, *openbottomslope;
#endif
extern ffloor_t *openfloorrover, *openceilingrover; extern ffloor_t *openfloorrover, *openceilingrover;
void P_LineOpening(line_t *plinedef, mobj_t *mobj); void P_LineOpening(line_t *plinedef, mobj_t *mobj);

View file

@ -19,7 +19,7 @@
#include "p_local.h" #include "p_local.h"
#include "p_setup.h" #include "p_setup.h"
#include "r_main.h" #include "r_main.h"
#include "r_things.h" #include "r_skins.h"
#include "r_sky.h" #include "r_sky.h"
#include "r_splats.h" #include "r_splats.h"
#include "s_sound.h" #include "s_sound.h"
@ -31,9 +31,7 @@
#include "i_video.h" #include "i_video.h"
#include "lua_hook.h" #include "lua_hook.h"
#include "b_bot.h" #include "b_bot.h"
#ifdef ESLOPE
#include "p_slopes.h" #include "p_slopes.h"
#endif
#include "f_finale.h" #include "f_finale.h"
#include "m_cond.h" #include "m_cond.h"
@ -62,9 +60,7 @@ void P_RunCachedActions(void)
{ {
var1 = states[ac->statenum].var1; var1 = states[ac->statenum].var1;
var2 = states[ac->statenum].var2; var2 = states[ac->statenum].var2;
#ifdef HAVE_BLUA
astate = &states[ac->statenum]; astate = &states[ac->statenum];
#endif
if (ac->mobj && !P_MobjWasRemoved(ac->mobj)) // just in case... if (ac->mobj && !P_MobjWasRemoved(ac->mobj)) // just in case...
states[ac->statenum].action.acp1(ac->mobj); states[ac->statenum].action.acp1(ac->mobj);
next = ac->next; next = ac->next;
@ -459,9 +455,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
{ {
var1 = st->var1; var1 = st->var1;
var2 = st->var2; var2 = st->var2;
#ifdef HAVE_BLUA
astate = st; astate = st;
#endif
st->action.acp1(mobj); st->action.acp1(mobj);
// woah. a player was removed by an action. // woah. a player was removed by an action.
@ -585,9 +579,7 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
{ {
var1 = st->var1; var1 = st->var1;
var2 = st->var2; var2 = st->var2;
#ifdef HAVE_BLUA
astate = st; astate = st;
#endif
st->action.acp1(mobj); st->action.acp1(mobj);
if (P_MobjWasRemoved(mobj)) if (P_MobjWasRemoved(mobj))
return false; return false;
@ -937,12 +929,10 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover)
topheight = *rover->topheight; topheight = *rover->topheight;
bottomheight = *rover->bottomheight; bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope) if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y); topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
if (*rover->b_slope) if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y); bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y);
#endif
if (mobj->z > topheight) if (mobj->z > topheight)
return false; return false;
@ -953,7 +943,6 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover)
return true; return true;
} }
#ifdef ESLOPE
// P_GetFloorZ (and its ceiling counterpart) // 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] // 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 // 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) 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) 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); I_Assert(mobj != NULL);
#endif
I_Assert(sector != NULL); I_Assert(sector != NULL);
#ifdef ESLOPE
if (sector->f_slope) { if (sector->f_slope) {
fixed_t testx, testy; fixed_t testx, testy;
pslope_t *slope = sector->f_slope; 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); return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
} else // Well, that makes it easy. Just get the floor height } 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; 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) 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); I_Assert(mobj != NULL);
#endif
I_Assert(sector != NULL); I_Assert(sector != NULL);
#ifdef ESLOPE
if (sector->c_slope) { if (sector->c_slope) {
fixed_t testx, testy; fixed_t testx, testy;
pslope_t *slope = sector->c_slope; 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); return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
} else // Well, that makes it easy. Just get the ceiling height } 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; return sector->ceilingheight;
} }
// Now do the same as all above, but for cameras because apparently cameras are special? // 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) 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); I_Assert(mobj != NULL);
#endif
I_Assert(sector != NULL); I_Assert(sector != NULL);
#ifdef ESLOPE
if (sector->f_slope) { if (sector->f_slope) {
fixed_t testx, testy; fixed_t testx, testy;
pslope_t *slope = sector->f_slope; 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); return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
} else // Well, that makes it easy. Just get the floor height } 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; 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) 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); I_Assert(mobj != NULL);
#endif
I_Assert(sector != NULL); I_Assert(sector != NULL);
#ifdef ESLOPE
if (sector->c_slope) { if (sector->c_slope) {
fixed_t testx, testy; fixed_t testx, testy;
pslope_t *slope = sector->c_slope; 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); return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
} else // Well, that makes it easy. Just get the ceiling height } 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; return sector->ceilingheight;
} }
static void P_PlayerFlip(mobj_t *mo) 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) else if (abs(player->rmomx) < FixedMul(STOPSPEED, mo->scale)
&& abs(player->rmomy) < 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)) && (!(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)))
&& !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2))
#endif
)
{ {
// if in a walking frame, stop moving // if in a walking frame, stop moving
if (player->panim == PA_WALK) if (player->panim == PA_WALK)
@ -1830,11 +1771,9 @@ void P_XYMovement(mobj_t *mo)
fixed_t xmove, ymove; fixed_t xmove, ymove;
fixed_t oldx, oldy; // reducing bobbing/momentum on ice when up against walls fixed_t oldx, oldy; // reducing bobbing/momentum on ice when up against walls
boolean moved; boolean moved;
#ifdef ESLOPE
pslope_t *oldslope = NULL; pslope_t *oldslope = NULL;
vector3_t slopemom; vector3_t slopemom;
fixed_t predictedz = 0; fixed_t predictedz = 0;
#endif
I_Assert(mo != NULL); I_Assert(mo != NULL);
I_Assert(!P_MobjWasRemoved(mo)); I_Assert(!P_MobjWasRemoved(mo));
@ -1864,7 +1803,6 @@ void P_XYMovement(mobj_t *mo)
oldx = mo->x; oldx = mo->x;
oldy = mo->y; oldy = mo->y;
#ifdef ESLOPE
if (mo->flags & MF_NOCLIPHEIGHT) if (mo->flags & MF_NOCLIPHEIGHT)
mo->standingslope = NULL; mo->standingslope = NULL;
@ -1889,7 +1827,6 @@ void P_XYMovement(mobj_t *mo)
} }
} else if (P_IsObjectOnGround(mo) && !mo->momz) } else if (P_IsObjectOnGround(mo) && !mo->momz)
predictedz = mo->z; predictedz = mo->z;
#endif
// Pushables can break some blocks // Pushables can break some blocks
if (CheckForBustableBlocks && ((mo->flags & MF_PUSHABLE) || ((mo->info->flags & MF_PUSHABLE) && mo->fuse))) 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); B_MoveBlocked(player);
} }
#ifdef HAVE_BLUA
if (LUAh_MobjMoveBlocked(mo)) if (LUAh_MobjMoveBlocked(mo))
{ {
if (P_MobjWasRemoved(mo)) if (P_MobjWasRemoved(mo))
return; return;
} }
else else if (P_MobjWasRemoved(mo))
#endif
if (P_MobjWasRemoved(mo))
return; return;
else if (mo->flags & MF_BOUNCE) 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)) else if (player || mo->flags & (MF_SLIDEME|MF_PUSHABLE))
{ // try to slide along it { // try to slide along it
#ifdef ESLOPE
// Wall transfer part 1. // Wall transfer part 1.
pslope_t *transferslope = NULL; pslope_t *transferslope = NULL;
fixed_t transfermomz = 0; 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. 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); transfermomz = P_GetWallTransferMomZ(mo, transferslope);
} }
#endif
P_SlideMove(mo); P_SlideMove(mo);
if (player) if (player)
player->powers[pw_pushing] = 3; player->powers[pw_pushing] = 3;
xmove = ymove = 0; xmove = ymove = 0;
#ifdef ESLOPE
// Wall transfer part 2. // Wall transfer part 2.
if (transfermomz && transferslope) // Are we "transferring onto the wall" (really just a disguised vertical launch)? 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) 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;; if (P_MobjWasRemoved(mo)) // MF_SPECIAL touched a player! O_o;;
return; return;
#ifdef ESLOPE
if (moved && oldslope && !(mo->flags & MF_NOCLIPHEIGHT)) { // Check to see if we ran off if (moved && oldslope && !(mo->flags & MF_NOCLIPHEIGHT)) { // Check to see if we ran off
if (oldslope != mo->standingslope) { // First, compare different slopes 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"); //CONS_Printf("Launched off of flat surface running into downward slope\n");
} }
} }
#endif
// Check the gravity status. // Check the gravity status.
P_CheckGravity(mo, false); P_CheckGravity(mo, false);
@ -2158,11 +2086,9 @@ void P_XYMovement(mobj_t *mo)
if (player && player->powers[pw_carry] == CR_NIGHTSMODE) if (player && player->powers[pw_carry] == CR_NIGHTSMODE)
return; // no friction for NiGHTS players return; // no friction for NiGHTS players
#ifdef ESLOPE
if ((mo->type == MT_BIGTUMBLEWEED || mo->type == MT_LITTLETUMBLEWEED) if ((mo->type == MT_BIGTUMBLEWEED || mo->type == MT_LITTLETUMBLEWEED)
&& (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8)) // Special exception for tumbleweeds on slopes && (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8)) // Special exception for tumbleweeds on slopes
return; return;
#endif
if (((!(mo->eflags & MFE_VERTICALFLIP) && mo->z > mo->floorz) || (mo->eflags & MFE_VERTICALFLIP && mo->z+mo->height < mo->ceilingz)) if (((!(mo->eflags & MFE_VERTICALFLIP) && mo->z > mo->floorz) || (mo->eflags & MFE_VERTICALFLIP && mo->z+mo->height < mo->ceilingz))
&& !(player && player->pflags & PF_SLIDING)) && !(player && player->pflags & PF_SLIDING))
@ -2430,7 +2356,6 @@ static boolean P_ZMovement(mobj_t *mo)
mo->z += mo->momz; mo->z += mo->momz;
onground = P_IsObjectOnGround(mo); onground = P_IsObjectOnGround(mo);
#ifdef ESLOPE
if (mo->standingslope) if (mo->standingslope)
{ {
if (mo->flags & MF_NOCLIPHEIGHT) if (mo->flags & MF_NOCLIPHEIGHT)
@ -2438,7 +2363,6 @@ static boolean P_ZMovement(mobj_t *mo)
else if (!onground) else if (!onground)
P_SlopeLaunch(mo); P_SlopeLaunch(mo);
} }
#endif
switch (mo->type) switch (mo->type)
{ {
@ -2640,7 +2564,6 @@ static boolean P_ZMovement(mobj_t *mo)
else else
mo->z = mo->floorz; mo->z = mo->floorz;
#ifdef ESLOPE
if (!(mo->flags & MF_MISSILE) && mo->standingslope) // You're still on the ground; why are we here? if (!(mo->flags & MF_MISSILE) && mo->standingslope) // You're still on the ground; why are we here?
{ {
mo->momz = 0; mo->momz = 0;
@ -2653,7 +2576,6 @@ static boolean P_ZMovement(mobj_t *mo)
mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope; mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope;
P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope); P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope);
} }
#endif
// hit the floor // hit the floor
if (mo->type == MT_FIREBALL) // special case for the fireball if (mo->type == MT_FIREBALL) // special case for the fireball
@ -2753,13 +2675,11 @@ static boolean P_ZMovement(mobj_t *mo)
else else
mom.y -= FixedMul(6*FRACUNIT, mo->scale); mom.y -= FixedMul(6*FRACUNIT, mo->scale);
} }
#ifdef ESLOPE
else if (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8) else if (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8)
{ {
// Pop the object up a bit to encourage bounciness // Pop the object up a bit to encourage bounciness
//mom.z = P_MobjFlip(mo)*mo->scale; //mom.z = P_MobjFlip(mo)*mo->scale;
} }
#endif
else else
{ {
mom.x = mom.y = mom.z = 0; mom.x = mom.y = mom.z = 0;
@ -2799,11 +2719,9 @@ static boolean P_ZMovement(mobj_t *mo)
else if (tmfloorthing) else if (tmfloorthing)
mom.z = tmfloorthing->momz; mom.z = tmfloorthing->momz;
#ifdef ESLOPE
if (mo->standingslope) { // MT_STEAM will never have a standingslope, see above. if (mo->standingslope) { // MT_STEAM will never have a standingslope, see above.
P_QuantizeMomentumToSlope(&mom, mo->standingslope); P_QuantizeMomentumToSlope(&mom, mo->standingslope);
} }
#endif
mo->momx = mom.x; mo->momx = mom.x;
mo->momy = mom.y; mo->momy = mom.y;
@ -2925,7 +2843,6 @@ static void P_PlayerZMovement(mobj_t *mo)
|| mo->player->playerstate == PST_REBORN) || mo->player->playerstate == PST_REBORN)
return; return;
#ifdef ESLOPE
if (mo->standingslope) if (mo->standingslope)
{ {
if (mo->flags & MF_NOCLIPHEIGHT) if (mo->flags & MF_NOCLIPHEIGHT)
@ -2933,7 +2850,6 @@ static void P_PlayerZMovement(mobj_t *mo)
else if (!onground) else if (!onground)
P_SlopeLaunch(mo); P_SlopeLaunch(mo);
} }
#endif
// clip movement // clip movement
if (onground && !(mo->flags & MF_NOCLIPHEIGHT)) if (onground && !(mo->flags & MF_NOCLIPHEIGHT))
@ -2961,12 +2877,10 @@ static void P_PlayerZMovement(mobj_t *mo)
if (mo->player->panim == PA_PAIN) if (mo->player->panim == PA_PAIN)
P_SetPlayerMobjState(mo, S_PLAY_WALK); P_SetPlayerMobjState(mo, S_PLAY_WALK);
#ifdef ESLOPE
if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)) { if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)) {
// Handle landing on slope during Z movement // Handle landing on slope during Z movement
P_HandleSlopeLanding(mo, (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)); P_HandleSlopeLanding(mo, (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope));
} }
#endif
if (P_MobjFlip(mo)*mo->momz < 0) // falling 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) boolean P_CanRunOnWater(player_t *player, ffloor_t *rover)
{ {
fixed_t topheight = fixed_t topheight = *rover->t_slope ?
#ifdef ESLOPE P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) :
*rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) :
#endif
*rover->topheight; *rover->topheight;
if (!player->powers[pw_carry] && !player->homing if (!player->powers[pw_carry] && !player->homing
@ -3349,13 +3261,11 @@ void P_MobjCheckWater(mobj_t *mobj)
topheight = *rover->topheight; topheight = *rover->topheight;
bottomheight = *rover->bottomheight; bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope) if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y); topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
if (*rover->b_slope) if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y); bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y);
#endif
if (mobj->eflags & MFE_VERTICALFLIP) if (mobj->eflags & MFE_VERTICALFLIP)
{ {
@ -3605,13 +3515,11 @@ static void P_SceneryCheckWater(mobj_t *mobj)
topheight = *rover->topheight; topheight = *rover->topheight;
bottomheight = *rover->bottomheight; bottomheight = *rover->bottomheight;
#ifdef ESLOPE
if (*rover->t_slope) if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y); topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
if (*rover->b_slope) if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y); bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y);
#endif
if (topheight <= mobj->z if (topheight <= mobj->z
|| bottomheight > (mobj->z + (mobj->height>>1))) || bottomheight > (mobj->z + (mobj->height>>1)))
@ -3656,14 +3564,12 @@ static boolean P_CameraCheckHeat(camera_t *thiscam)
if (!(rover->flags & FF_EXISTS)) if (!(rover->flags & FF_EXISTS))
continue; continue;
if (halfheight >= ( if (halfheight >= (*rover->t_slope ?
#ifdef ESLOPE P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) :
*rover->t_slope ? P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) : *rover->topheight))
#endif continue;
*rover->topheight) || halfheight <= ( if (halfheight <= (*rover->b_slope ?
#ifdef ESLOPE P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) :
*rover->b_slope ? P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) :
#endif
*rover->bottomheight)) *rover->bottomheight))
continue; 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) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKOTHERS)
continue; continue;
if (halfheight >= ( if (halfheight >= (*rover->t_slope ?
#ifdef ESLOPE P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) :
*rover->t_slope ? P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) : *rover->topheight))
#endif continue;
*rover->topheight) || halfheight <= ( if (halfheight <= (
#ifdef ESLOPE
*rover->b_slope ? P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) : *rover->b_slope ? P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) :
#endif
*rover->bottomheight)) *rover->bottomheight))
continue; continue;
@ -3889,9 +3793,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
P_MobjCheckWater(mobj); P_MobjCheckWater(mobj);
#ifdef ESLOPE
P_ButteredSlope(mobj); P_ButteredSlope(mobj);
#endif
// momentum movement // momentum movement
mobj->eflags &= ~MFE_JUSTSTEPPEDDOWN; mobj->eflags &= ~MFE_JUSTSTEPPEDDOWN;
@ -4050,10 +3952,8 @@ static void CalculatePrecipFloor(precipmobj_t *mobj)
mobjsecsubsec = mobj->subsector->sector; mobjsecsubsec = mobj->subsector->sector;
else else
return; return;
mobj->floorz = mobj->floorz = mobjsecsubsec->f_slope ?
#ifdef ESLOPE P_GetZAt(mobjsecsubsec->f_slope, mobj->x, mobj->y) :
mobjsecsubsec->f_slope ? P_GetZAt(mobjsecsubsec->f_slope, mobj->x, mobj->y) :
#endif
mobjsecsubsec->floorheight; mobjsecsubsec->floorheight;
if (mobjsecsubsec->ffloors) if (mobjsecsubsec->ffloors)
{ {
@ -4069,11 +3969,9 @@ static void CalculatePrecipFloor(precipmobj_t *mobj)
if (!(rover->flags & FF_BLOCKOTHERS) && !(rover->flags & FF_SWIMMABLE)) if (!(rover->flags & FF_BLOCKOTHERS) && !(rover->flags & FF_SWIMMABLE))
continue; continue;
#ifdef ESLOPE
if (*rover->t_slope) if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y); topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
else else
#endif
topheight = *rover->topheight; topheight = *rover->topheight;
if (topheight > mobj->floorz) if (topheight > mobj->floorz)
@ -7643,12 +7541,10 @@ static void P_RosySceneryThink(mobj_t *mobj)
static void P_MobjSceneryThink(mobj_t *mobj) static void P_MobjSceneryThink(mobj_t *mobj)
{ {
#ifdef HAVE_BLUA
if (LUAh_MobjThinker(mobj)) if (LUAh_MobjThinker(mobj))
return; return;
if (P_MobjWasRemoved(mobj)) if (P_MobjWasRemoved(mobj))
return; return;
#endif
if ((mobj->flags2 & MF2_SHIELD) && !P_AddShield(mobj)) if ((mobj->flags2 & MF2_SHIELD) && !P_AddShield(mobj))
return; return;
@ -7993,9 +7889,7 @@ static void P_MobjSceneryThink(mobj_t *mobj)
if (!mobj->fuse) if (!mobj->fuse)
{ {
#ifdef HAVE_BLUA
if (!LUAh_MobjFuse(mobj)) if (!LUAh_MobjFuse(mobj))
#endif
P_RemoveMobj(mobj); P_RemoveMobj(mobj);
return; return;
} }
@ -8054,9 +7948,7 @@ static void P_MobjSceneryThink(mobj_t *mobj)
mobj->fuse--; mobj->fuse--;
if (!mobj->fuse) if (!mobj->fuse)
{ {
#ifdef HAVE_BLUA
if (!LUAh_MobjFuse(mobj)) if (!LUAh_MobjFuse(mobj))
#endif
P_RemoveMobj(mobj); P_RemoveMobj(mobj);
return; return;
} }
@ -8085,7 +7977,6 @@ static boolean P_MobjPushableThink(mobj_t *mobj)
static boolean P_MobjBossThink(mobj_t *mobj) static boolean P_MobjBossThink(mobj_t *mobj)
{ {
#ifdef HAVE_BLUA
if (LUAh_BossThinker(mobj)) if (LUAh_BossThinker(mobj))
{ {
if (P_MobjWasRemoved(mobj)) if (P_MobjWasRemoved(mobj))
@ -8094,7 +7985,6 @@ static boolean P_MobjBossThink(mobj_t *mobj)
else if (P_MobjWasRemoved(mobj)) else if (P_MobjWasRemoved(mobj))
return false; return false;
else else
#endif
switch (mobj->type) switch (mobj->type)
{ {
case MT_EGGMOBILE: case MT_EGGMOBILE:
@ -9393,8 +9283,11 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
if (mobj->tracer && mobj->tracer->player && mobj->tracer->health > 0 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) && 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. // Home in on the target.
P_HomingAttack(mobj, mobj->tracer); A_HomingChase(mobj);
if (mobj->z < mobj->floorz) if (mobj->z < mobj->floorz)
mobj->z = mobj->floorz; mobj->z = mobj->floorz;
@ -10004,12 +9897,9 @@ static boolean P_FuseThink(mobj_t *mobj)
if (mobj->fuse) if (mobj->fuse)
return true; return true;
#ifdef HAVE_BLUA
if (LUAh_MobjFuse(mobj) || P_MobjWasRemoved(mobj)) if (LUAh_MobjFuse(mobj) || P_MobjWasRemoved(mobj))
; ;
else else if (mobj->info->flags & MF_MONITOR)
#endif
if (mobj->info->flags & MF_MONITOR)
{ {
P_MonitorFuseThink(mobj); P_MonitorFuseThink(mobj);
return false; return false;
@ -10179,7 +10069,6 @@ void P_MobjThinker(mobj_t *mobj)
return; return;
} }
#ifdef HAVE_BLUA
// Check for a Lua thinker first // Check for a Lua thinker first
if (!mobj->player) if (!mobj->player)
{ {
@ -10193,7 +10082,7 @@ void P_MobjThinker(mobj_t *mobj)
if (P_MobjWasRemoved(mobj)) if (P_MobjWasRemoved(mobj))
return; return;
} }
#endif
// if it's pushable, or if it would be pushable other than temporary disablement, use the // if it's pushable, or if it would be pushable other than temporary disablement, use the
// separate thinker // separate thinker
if (mobj->flags & MF_PUSHABLE || (mobj->info->flags & MF_PUSHABLE && mobj->fuse)) 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; mobj->eflags &= ~MFE_JUSTHITFLOOR;
} }
#ifdef ESLOPE // Sliding physics for slidey mobjs! // Sliding physics for slidey mobjs!
if (mobj->type == MT_FLINGRING if (mobj->type == MT_FLINGRING
|| mobj->type == MT_FLINGCOIN || mobj->type == MT_FLINGCOIN
|| mobj->type == MT_FLINGBLUESPHERE || mobj->type == MT_FLINGBLUESPHERE
@ -10277,7 +10166,6 @@ void P_MobjThinker(mobj_t *mobj)
//if (mobj->standingslope) CONS_Printf("slope physics on mobj\n"); //if (mobj->standingslope) CONS_Printf("slope physics on mobj\n");
P_ButteredSlope(mobj); P_ButteredSlope(mobj);
} }
#endif
if (mobj->flags & (MF_ENEMY|MF_BOSS) && mobj->health if (mobj->flags & (MF_ENEMY|MF_BOSS) && mobj->health
&& P_CheckDeathPitCollide(mobj)) // extra pit check in case these didn't have momz && 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 // Make sure scale matches destscale immediately when spawned
P_SetScale(mobj, mobj->destscale); P_SetScale(mobj, mobj->destscale);
mobj->floorz = mobj->floorz = mobj->subsector->sector->f_slope ?
#ifdef ESLOPE P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
mobj->subsector->sector->f_slope ? P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
#endif
mobj->subsector->sector->floorheight; mobj->subsector->sector->floorheight;
mobj->ceilingz = mobj->ceilingz = mobj->subsector->sector->c_slope ?
#ifdef ESLOPE P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
mobj->subsector->sector->c_slope ? P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
#endif
mobj->subsector->sector->ceilingheight; mobj->subsector->sector->ceilingheight;
mobj->floorrover = NULL; 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 // Set shadowscale here, before spawn hook so that Lua can change it
mobj->shadowscale = P_DefaultMobjShadowScale(mobj); mobj->shadowscale = P_DefaultMobjShadowScale(mobj);
#ifdef HAVE_BLUA
// DANGER! This can cause P_SpawnMobj to return NULL! // DANGER! This can cause P_SpawnMobj to return NULL!
// Avoid using P_RemoveMobj on the newly created mobj in "MobjSpawn" Lua hooks! // Avoid using P_RemoveMobj on the newly created mobj in "MobjSpawn" Lua hooks!
if (LUAh_MobjSpawn(mobj)) 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)) else if (P_MobjWasRemoved(mobj))
return NULL; return NULL;
else else
#endif
switch (mobj->type) switch (mobj->type)
{ {
case MT_ALTVIEWMAN: 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; var1 = st->var1;
var2 = st->var2; var2 = st->var2;
#ifdef HAVE_BLUA
astate = st; astate = st;
#endif
st->action.acp1(mobj); st->action.acp1(mobj);
// DANGER! This can cause P_SpawnMobj to return NULL! // 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! // 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 // set subsector and/or block links
P_SetPrecipitationThingPosition(mobj); P_SetPrecipitationThingPosition(mobj);
mobj->floorz = starting_floorz = mobj->floorz = starting_floorz = mobj->subsector->sector->f_slope ?
#ifdef ESLOPE P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
mobj->subsector->sector->f_slope ? P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
#endif
mobj->subsector->sector->floorheight; mobj->subsector->sector->floorheight;
mobj->ceilingz = mobj->ceilingz = mobj->subsector->sector->c_slope ?
#ifdef ESLOPE P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
mobj->subsector->sector->c_slope ? P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
#endif
mobj->subsector->sector->ceilingheight; mobj->subsector->sector->ceilingheight;
mobj->floorrover = NULL; mobj->floorrover = NULL;
@ -11037,16 +10913,12 @@ size_t iquehead, iquetail;
void P_RemoveMobj(mobj_t *mobj) void P_RemoveMobj(mobj_t *mobj)
{ {
I_Assert(mobj != NULL); I_Assert(mobj != NULL);
#ifdef HAVE_BLUA
if (P_MobjWasRemoved(mobj)) if (P_MobjWasRemoved(mobj))
return; // something already removing this mobj. return; // something already removing this mobj.
mobj->thinker.function.acp1 = (actionf_p1)P_RemoveThinkerDelayed; // shh. no recursing. mobj->thinker.function.acp1 = (actionf_p1)P_RemoveThinkerDelayed; // shh. no recursing.
LUAh_MobjRemoved(mobj); LUAh_MobjRemoved(mobj);
mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker; // needed for P_UnsetThingPosition, etc. to work. 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! // Rings only, please!
if (mobj->spawnpoint && if (mobj->spawnpoint &&
@ -11625,15 +11497,11 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
// set Z height // set Z height
sector = R_PointInSubsector(x, y)->sector; sector = R_PointInSubsector(x, y)->sector;
floor = floor = sector->f_slope ?
#ifdef ESLOPE P_GetZAt(sector->f_slope, x, y) :
sector->f_slope ? P_GetZAt(sector->f_slope, x, y) :
#endif
sector->floorheight; sector->floorheight;
ceiling = ceiling = sector->c_slope ?
#ifdef ESLOPE P_GetZAt(sector->c_slope, x, y) :
sector->c_slope ? P_GetZAt(sector->c_slope, x, y) :
#endif
sector->ceilingheight; sector->ceilingheight;
ceilingspawn = ceiling - mobjinfo[MT_PLAYER].height; ceilingspawn = ceiling - mobjinfo[MT_PLAYER].height;
@ -11704,15 +11572,11 @@ void P_MovePlayerToStarpost(INT32 playernum)
P_SetThingPosition(mobj); P_SetThingPosition(mobj);
sector = R_PointInSubsector(mobj->x, mobj->y)->sector; sector = R_PointInSubsector(mobj->x, mobj->y)->sector;
floor = floor = sector->f_slope ?
#ifdef ESLOPE P_GetZAt(sector->f_slope, mobj->x, mobj->y) :
sector->f_slope ? P_GetZAt(sector->f_slope, mobj->x, mobj->y) :
#endif
sector->floorheight; sector->floorheight;
ceiling = ceiling = sector->c_slope ?
#ifdef ESLOPE P_GetZAt(sector->c_slope, mobj->x, mobj->y) :
sector->c_slope ? P_GetZAt(sector->c_slope, mobj->x, mobj->y) :
#endif
sector->ceilingheight; sector->ceilingheight;
z = p->starpostz << FRACBITS; z = p->starpostz << FRACBITS;
@ -11762,17 +11626,11 @@ static fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x,
// Establish height. // Establish height.
if (flip) if (flip)
return ( return (ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) : ss->sector->ceilingheight)
#ifdef ESLOPE - offset - mobjinfo[mobjtype].height;
ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) :
#endif
ss->sector->ceilingheight) - offset - mobjinfo[mobjtype].height;
else else
return ( return (ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) : ss->sector->floorheight)
#ifdef ESLOPE + offset;
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) :
#endif
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) 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) static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean *doangle)
{ {
#ifdef HAVE_BLUA
boolean override = LUAh_MapThingSpawn(mobj, mthing); boolean override = LUAh_MapThingSpawn(mobj, mthing);
if (P_MobjWasRemoved(mobj)) if (P_MobjWasRemoved(mobj))
@ -12718,7 +12575,6 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
if (override) if (override)
return true; return true;
#endif
switch (mobj->type) switch (mobj->type)
{ {

View file

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

View file

@ -27,7 +27,7 @@
#include "i_system.h" #include "i_system.h"
#include "r_data.h" #include "r_data.h"
#include "r_things.h" #include "r_things.h" // for R_AddSpriteDefs
#include "r_patch.h" #include "r_patch.h"
#include "r_sky.h" #include "r_sky.h"
#include "r_draw.h" #include "r_draw.h"
@ -57,9 +57,7 @@
#include "filesrch.h" // refreshdirmenu #include "filesrch.h" // refreshdirmenu
#ifdef HAVE_BLUA
#include "lua_hud.h" // level title #include "lua_hud.h" // level title
#endif
#include "f_finale.h" // wipes #include "f_finale.h" // wipes
@ -79,9 +77,7 @@
#include "hardware/hw_model.h" #include "hardware/hw_model.h"
#endif #endif
#ifdef ESLOPE
#include "p_slopes.h" #include "p_slopes.h"
#endif
#include "fastcmp.h" // textmap parsing #include "fastcmp.h" // textmap parsing
@ -911,11 +907,9 @@ static void P_InitializeSector(sector_t *ss)
ss->preciplist = NULL; ss->preciplist = NULL;
ss->touching_preciplist = NULL; ss->touching_preciplist = NULL;
#ifdef ESLOPE
ss->f_slope = NULL; ss->f_slope = NULL;
ss->c_slope = NULL; ss->c_slope = NULL;
ss->hasslope = false; ss->hasslope = false;
#endif
ss->spawn_lightlevel = ss->lightlevel; ss->spawn_lightlevel = ss->lightlevel;
@ -3526,9 +3520,7 @@ boolean P_LoadLevel(boolean fromnetsave)
// Close text prompt before freeing the old level // Close text prompt before freeing the old level
F_EndTextPrompt(false, true); F_EndTextPrompt(false, true);
#ifdef HAVE_BLUA
LUA_InvalidateLevel(); LUA_InvalidateLevel();
#endif
for (ss = sectors; sectors+numsectors != ss; ss++) 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 // anything that P_SpawnSlopes/P_LoadThings needs to know
P_InitSpecials(); P_InitSpecials();
#ifdef ESLOPE
P_SpawnSlopes(fromnetsave); P_SpawnSlopes(fromnetsave);
#endif
P_SpawnMapThings(!fromnetsave); P_SpawnMapThings(!fromnetsave);
skyboxmo[0] = skyboxviewpnts[0]; skyboxmo[0] = skyboxviewpnts[0];
@ -3665,9 +3655,7 @@ boolean P_LoadLevel(boolean fromnetsave)
G_CopyTiccmd(&players[i].cmd, &netcmds[buf][i], 1); G_CopyTiccmd(&players[i].cmd, &netcmds[buf][i], 1);
} }
P_PreTicker(2); P_PreTicker(2);
#ifdef HAVE_BLUA
LUAh_MapLoad(); LUAh_MapLoad();
#endif
} }
// No render mode, stop here. // No render mode, stop here.
@ -3859,10 +3847,8 @@ boolean P_AddWadFile(const char *wadfilename)
// Update the detected resources. // Update the detected resources.
// Note: ALWAYS load Lua scripts first, SOCs right after, and the remaining resources afterwards. // Note: ALWAYS load Lua scripts first, SOCs right after, and the remaining resources afterwards.
#ifdef HAVE_BLUA
// if (luaNum) // Lua scripts. // if (luaNum) // Lua scripts.
// P_LoadLuaScrRange(wadnum, luaPos, luaNum); // P_LoadLuaScrRange(wadnum, luaPos, luaNum);
#endif
// if (socNum) // SOCs. // if (socNum) // SOCs.
// P_LoadDehackRange(wadnum, socPos, socNum); // P_LoadDehackRange(wadnum, socPos, socNum);
if (sfxNum) // Sounds. TODO: Function currently only updates already existing sounds, the rest is handled somewhere else. 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; const vertex_t *v1,*v2;
fixed_t frac; fixed_t frac;
fixed_t frontf, backf, frontc, backc; fixed_t frontf, backf, frontc, backc;
#ifdef ESLOPE
fixed_t fracx, fracy; fixed_t fracx, fracy;
#endif
if (seg->glseg) if (seg->glseg)
continue; continue;
@ -263,7 +261,6 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
front = seg->frontsector; front = seg->frontsector;
back = seg->backsector; back = seg->backsector;
#ifdef ESLOPE
// calculate position at intercept // calculate position at intercept
fracx = los->strace.x + FixedMul(los->strace.dx, frac); fracx = los->strace.x + FixedMul(los->strace.dx, frac);
fracy = los->strace.y + FixedMul(los->strace.dy, 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; 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; 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; 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 // crosses a two sided line
// no wall to block sight with? // no wall to block sight with?
if (frontf == backf && frontc == backc if (frontf == backf && frontc == backc
@ -327,13 +318,8 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
continue; continue;
} }
#ifdef ESLOPE
topz = (*rover->t_slope) ? P_GetZAt(*rover->t_slope, fracx, fracy) : *rover->topheight; 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; 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); topslope = FixedDiv(topz - los->sightzstart , frac);
bottomslope = FixedDiv(bottomz - los->sightzstart , frac); bottomslope = FixedDiv(bottomz - los->sightzstart , frac);
if (topslope >= los->topslope && bottomslope <= los->bottomslope) if (topslope >= los->topslope && bottomslope <= los->bottomslope)
@ -348,13 +334,8 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
continue; continue;
} }
#ifdef ESLOPE
topz = (*rover->t_slope) ? P_GetZAt(*rover->t_slope, fracx, fracy) : *rover->topheight; 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; 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); topslope = FixedDiv(topz - los->sightzstart , frac);
bottomslope = FixedDiv(bottomz - los->sightzstart , frac); bottomslope = FixedDiv(bottomz - los->sightzstart , frac);
if (topslope >= los->topslope && bottomslope <= los->bottomslope) if (topslope >= los->topslope && bottomslope <= los->bottomslope)
@ -487,7 +468,6 @@ boolean P_CheckSight(mobj_t *t1, mobj_t *t2)
continue; continue;
} }
#ifdef ESLOPE
if (*rover->t_slope) if (*rover->t_slope)
{ {
topz1 = P_GetZAt(*rover->t_slope, t1->x, t1->y); topz1 = P_GetZAt(*rover->t_slope, t1->x, t1->y);
@ -503,10 +483,6 @@ boolean P_CheckSight(mobj_t *t1, mobj_t *t2)
} }
else else
bottomz1 = bottomz2 = *rover->bottomheight; bottomz1 = bottomz2 = *rover->bottomheight;
#else
topz1 = topz2 = *rover->topheight;
bottomz1 = bottomz2 = *rover->bottomheight;
#endif
// Check for blocking floors here. // Check for blocking floors here.
if ((los.sightzstart < bottomz1 && t2->z >= topz2) if ((los.sightzstart < bottomz1 && t2->z >= topz2)

View file

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

View file

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

View file

@ -36,7 +36,7 @@
#include "m_cond.h" //unlock triggers #include "m_cond.h" //unlock triggers
#include "lua_hook.h" // LUAh_LinedefExecute #include "lua_hook.h" // LUAh_LinedefExecute
#include "f_finale.h" // control text prompt #include "f_finale.h" // control text prompt
#include "r_things.h" // skins #include "r_skins.h" // skins
#ifdef HW3SOUND #ifdef HW3SOUND
#include "hardware/hw3sound.h" #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 case 443: // Calls a named Lua function
#ifdef HAVE_BLUA
if (line->text) if (line->text)
LUAh_LinedefExecute(line, mo, callsec); LUAh_LinedefExecute(line, mo, callsec);
else 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)); 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; break;
case 444: // Earthquake camera 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->topyoffs = &sec2->ceiling_yoffs;
fflr->topangle = &sec2->ceilingpic_angle; fflr->topangle = &sec2->ceilingpic_angle;
#ifdef ESLOPE
// Add slopes // Add slopes
fflr->t_slope = &sec2->c_slope; fflr->t_slope = &sec2->c_slope;
fflr->b_slope = &sec2->f_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) // (this fixes FOF slopes glitching initially at level load in software mode)
if (sec2->hasslope) if (sec2->hasslope)
sec->hasslope = true; sec->hasslope = true;
#endif
if ((flags & FF_SOLID) && (master->flags & ML_EFFECT1)) // Block player only if ((flags & FF_SOLID) && (master->flags & ML_EFFECT1)) // Block player only
flags &= ~FF_BLOCKOTHERS; flags &= ~FF_BLOCKOTHERS;
@ -6278,15 +6272,11 @@ void T_LaserFlash(laserthink_t *flash)
sourcesec = fflr->master->frontsector; // Less to type! sourcesec = fflr->master->frontsector; // Less to type!
#ifdef ESLOPE
top = (*fflr->t_slope) ? P_GetZAt(*fflr->t_slope, sector->soundorg.x, sector->soundorg.y) top = (*fflr->t_slope) ? P_GetZAt(*fflr->t_slope, sector->soundorg.x, sector->soundorg.y)
: *fflr->topheight; : *fflr->topheight;
bottom = (*fflr->b_slope) ? P_GetZAt(*fflr->b_slope, sector->soundorg.x, sector->soundorg.y) bottom = (*fflr->b_slope) ? P_GetZAt(*fflr->b_slope, sector->soundorg.x, sector->soundorg.y)
: *fflr->bottomheight; : *fflr->bottomheight;
sector->soundorg.z = (top + bottom)/2; sector->soundorg.z = (top + bottom)/2;
#else
sector->soundorg.z = (*fflr->topheight + *fflr->bottomheight)/2;
#endif
S_StartSound(&sector->soundorg, sfx_laser); S_StartSound(&sector->soundorg, sfx_laser);
// Seek out objects to DESTROY! MUAHAHHAHAHAA!!!*cough* // Seek out objects to DESTROY! MUAHAHHAHAHAA!!!*cough*
@ -7931,11 +7921,9 @@ void T_Disappear(disappear_t *d)
if (!(lines[d->sourceline].flags & ML_NOCLIMB)) if (!(lines[d->sourceline].flags & ML_NOCLIMB))
{ {
#ifdef ESLOPE
if (*rover->t_slope) if (*rover->t_slope)
sectors[s].soundorg.z = P_GetZAt(*rover->t_slope, sectors[s].soundorg.x, sectors[s].soundorg.y); sectors[s].soundorg.z = P_GetZAt(*rover->t_slope, sectors[s].soundorg.x, sectors[s].soundorg.y);
else else
#endif
sectors[s].soundorg.z = *rover->topheight; sectors[s].soundorg.z = *rover->topheight;
S_StartSound(&sectors[s].soundorg, sfx_appear); 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) void P_RemoveThinker(thinker_t *thinker)
{ {
#ifdef HAVE_BLUA
LUA_InvalidateUserdata(thinker); LUA_InvalidateUserdata(thinker);
#endif
thinker->function.acp1 = (actionf_p1)P_RemoveThinkerDelayed; thinker->function.acp1 = (actionf_p1)P_RemoveThinkerDelayed;
} }
@ -643,9 +641,7 @@ void P_Ticker(boolean run)
if (demoplayback) if (demoplayback)
G_ReadDemoTiccmd(&players[consoleplayer].cmd, 0); G_ReadDemoTiccmd(&players[consoleplayer].cmd, 0);
#ifdef HAVE_BLUA
LUAh_PreThinkFrame(); LUAh_PreThinkFrame();
#endif
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) 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)) if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
P_PlayerAfterThink(&players[i]); P_PlayerAfterThink(&players[i]);
#ifdef HAVE_BLUA
LUAh_ThinkFrame(); LUAh_ThinkFrame();
#endif
} }
// Run shield positioning // Run shield positioning
@ -745,9 +739,7 @@ void P_Ticker(boolean run)
if (modeattacking) if (modeattacking)
G_GhostTicker(); G_GhostTicker();
#ifdef HAVE_BLUA
LUAh_PostThinkFrame(); LUAh_PostThinkFrame();
#endif
} }
P_MapEnd(); P_MapEnd();
@ -767,9 +759,8 @@ void P_PreTicker(INT32 frames)
{ {
P_MapStart(); P_MapStart();
#ifdef HAVE_BLUA
LUAh_PreThinkFrame(); LUAh_PreThinkFrame();
#endif
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) 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)) if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo))
P_PlayerAfterThink(&players[i]); P_PlayerAfterThink(&players[i]);
#ifdef HAVE_BLUA
LUAh_ThinkFrame(); LUAh_ThinkFrame();
#endif
// Run shield positioning // Run shield positioning
P_RunShields(); P_RunShields();
@ -804,9 +793,7 @@ void P_PreTicker(INT32 frames)
P_UpdateSpecials(); P_UpdateSpecials();
P_RespawnSpecials(); P_RespawnSpecials();
#ifdef HAVE_BLUA
LUAh_PostThinkFrame(); LUAh_PostThinkFrame();
#endif
P_MapEnd(); P_MapEnd();
} }

View file

@ -22,7 +22,7 @@
#include "p_local.h" #include "p_local.h"
#include "r_main.h" #include "r_main.h"
#include "s_sound.h" #include "s_sound.h"
#include "r_things.h" #include "r_skins.h"
#include "d_think.h" #include "d_think.h"
#include "r_sky.h" #include "r_sky.h"
#include "p_setup.h" #include "p_setup.h"
@ -1109,7 +1109,6 @@ boolean P_PlayerCanDamage(player_t *player, mobj_t *thing)
if (!player->mo || player->spectator || !thing || P_MobjWasRemoved(thing)) if (!player->mo || player->spectator || !thing || P_MobjWasRemoved(thing))
return false; return false;
#ifdef HAVE_BLUA
{ {
UINT8 shouldCollide = LUAh_PlayerCanDamage(player, thing); UINT8 shouldCollide = LUAh_PlayerCanDamage(player, thing);
if (P_MobjWasRemoved(thing)) if (P_MobjWasRemoved(thing))
@ -1119,7 +1118,6 @@ boolean P_PlayerCanDamage(player_t *player, mobj_t *thing)
else if (shouldCollide == 2) else if (shouldCollide == 2)
return false; // force no return false; // force no
} }
#endif
// Invinc/super. Not for Monitors. // Invinc/super. Not for Monitors.
if (!(thing->flags & MF_MONITOR) && (player->powers[pw_invulnerability] || player->powers[pw_super])) 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]; char newmusic[7];
strncpy(newmusic, musname, 7); strncpy(newmusic, musname, 7);
#if defined(HAVE_BLUA) && defined(HAVE_LUA_MUSICPLUS) #ifdef HAVE_LUA_MUSICPLUS
if(LUAh_MusicJingle(jingletype, newmusic, &musflags, &looping)) if(LUAh_MusicJingle(jingletype, newmusic, &musflags, &looping))
return; return;
#endif #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) 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, always play the jingle (1-up intermission)
if (gamestate == GS_LEVEL && !P_IsLocalPlayer(player)) if (gamestate == GS_LEVEL && player && !P_IsLocalPlayer(player))
return; return;
S_RetainMusic(musname, musflags, looping, 0, status); 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); S_ChangeMusicInternal(musname, looping);
} }
boolean P_EvaluateMusicStatus(UINT16 status) boolean P_EvaluateMusicStatus(UINT16 status, const char *musname)
{ {
// \todo lua hook // \todo lua hook
int i; int i;
@ -1601,8 +1599,11 @@ boolean P_EvaluateMusicStatus(UINT16 status)
result = (players[i].nightstime && players[i].nightstime <= 10*TICRATE); result = (players[i].nightstime && players[i].nightstime <= 10*TICRATE);
break; break;
case JT_NONE: // Null state
case JT_OTHER: // Other state case JT_OTHER: // Other state
result = LUAh_ShouldJingleContinue(&players[i], musname);
break;
case JT_NONE: // Null state
case JT_MASTER: // Main level music case JT_MASTER: // Main level music
default: default:
result = true; result = true;
@ -1865,10 +1866,8 @@ void P_SpawnShieldOrb(player_t *player)
I_Error("P_SpawnShieldOrb: player->mo is NULL!\n"); I_Error("P_SpawnShieldOrb: player->mo is NULL!\n");
#endif #endif
#ifdef HAVE_BLUA
if (LUAh_ShieldSpawn(player)) if (LUAh_ShieldSpawn(player))
return; return;
#endif
if (player->powers[pw_shield] & SH_FORCE) if (player->powers[pw_shield] & SH_FORCE)
orbtype = MT_FORCE_ORB; 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) if (GETSECSPECIAL(rover->master->frontsector->special, 1) != SPACESPECIAL)
continue; continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : *rover->topheight; 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; 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) if (mo->z + (mo->height/2) > topheight)
continue; continue;
@ -2518,13 +2512,8 @@ boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand
if (!(rover->flags & FF_QUICKSAND)) if (!(rover->flags & FF_QUICKSAND))
continue; continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : *rover->topheight; 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; 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) if (mo->z + flipoffset > topheight)
continue; continue;
@ -2694,9 +2683,7 @@ static void P_CheckBouncySectors(player_t *player)
fixed_t oldx; fixed_t oldx;
fixed_t oldy; fixed_t oldy;
fixed_t oldz; fixed_t oldz;
#ifdef ESLOPE
vector3_t momentum; vector3_t momentum;
#endif
oldx = player->mo->x; oldx = player->mo->x;
oldy = player->mo->y; oldy = player->mo->y;
@ -2751,7 +2738,6 @@ static void P_CheckBouncySectors(player_t *player)
{ {
fixed_t newmom; fixed_t newmom;
#ifdef ESLOPE
pslope_t *slope; pslope_t *slope;
if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) { // Hit top if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) { // Hit top
slope = *rover->t_slope; slope = *rover->t_slope;
@ -2767,9 +2753,6 @@ static void P_CheckBouncySectors(player_t *player)
P_ReverseQuantizeMomentumToSlope(&momentum, slope); P_ReverseQuantizeMomentumToSlope(&momentum, slope);
newmom = momentum.z = -FixedMul(momentum.z,linedist)/2; newmom = momentum.z = -FixedMul(momentum.z,linedist)/2;
#else
newmom = -FixedMul(player->mo->momz,linedist);
#endif
if (abs(newmom) < (linedist*2)) if (abs(newmom) < (linedist*2))
{ {
@ -2792,7 +2775,6 @@ static void P_CheckBouncySectors(player_t *player)
else if (newmom < -P_GetPlayerHeight(player)/2) else if (newmom < -P_GetPlayerHeight(player)/2)
newmom = -P_GetPlayerHeight(player)/2; newmom = -P_GetPlayerHeight(player)/2;
#ifdef ESLOPE
momentum.z = newmom*2; momentum.z = newmom*2;
if (slope) if (slope)
@ -2801,9 +2783,6 @@ static void P_CheckBouncySectors(player_t *player)
player->mo->momx = momentum.x; player->mo->momx = momentum.x;
player->mo->momy = momentum.y; player->mo->momy = momentum.y;
player->mo->momz = momentum.z/2; player->mo->momz = momentum.z/2;
#else
player->mo->momz = newmom;
#endif
if (player->pflags & PF_SPINNING) if (player->pflags & PF_SPINNING)
{ {
@ -2860,13 +2839,8 @@ static void P_CheckQuicksand(player_t *player)
if (!(rover->flags & FF_QUICKSAND)) if (!(rover->flags & FF_QUICKSAND))
continue; continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; 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; 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) 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 thrust = false;
boolean boostup = false; boolean boostup = false;
boolean skyclimber = false; boolean skyclimber = false;
fixed_t floorheight, ceilingheight; // ESLOPE fixed_t floorheight, ceilingheight;
if (!glidesector) if (!glidesector)
floorclimb = true; floorclimb = true;
else else
{ {
#ifdef ESLOPE
floorheight = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y) floorheight = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y)
: glidesector->sector->floorheight; : glidesector->sector->floorheight;
ceilingheight = glidesector->sector->c_slope ? P_GetZAt(glidesector->sector->c_slope, player->mo->x, player->mo->y) ceilingheight = glidesector->sector->c_slope ? P_GetZAt(glidesector->sector->c_slope, player->mo->x, player->mo->y)
: glidesector->sector->ceilingheight; : glidesector->sector->ceilingheight;
#else
floorheight = glidesector->sector->floorheight;
ceilingheight = glidesector->sector->ceilingheight;
#endif
if (glidesector->sector->ffloors) if (glidesector->sector->ffloors)
{ {
ffloor_t *rover; ffloor_t *rover;
fixed_t topheight, bottomheight; // ESLOPE fixed_t topheight, bottomheight;
for (rover = glidesector->sector->ffloors; rover; rover = rover->next) for (rover = glidesector->sector->ffloors; rover; rover = rover->next)
{ {
@ -3228,13 +3197,8 @@ static void P_DoClimbing(player_t *player)
floorclimb = true; floorclimb = true;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; 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; 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. // 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) if (rover->master->frontsector->floorspeed && rover->master->frontsector->ceilspeed == 42)
@ -3275,11 +3239,7 @@ static void P_DoClimbing(player_t *player)
if (roverbelow == rover) if (roverbelow == rover)
continue; continue;
#ifdef ESLOPE
bottomheight2 = *roverbelow->b_slope ? P_GetZAt(*roverbelow->b_slope, player->mo->x, player->mo->y) : *roverbelow->bottomheight; 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)) if (bottomheight2 < topheight + FixedMul(16*FRACUNIT, player->mo->scale))
foundfof = true; foundfof = true;
@ -3325,11 +3285,7 @@ static void P_DoClimbing(player_t *player)
if (roverbelow == rover) if (roverbelow == rover)
continue; continue;
#ifdef ESLOPE
topheight2 = *roverbelow->t_slope ? P_GetZAt(*roverbelow->t_slope, player->mo->x, player->mo->y) : *roverbelow->topheight; 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)) if (topheight2 > bottomheight - FixedMul(16*FRACUNIT, player->mo->scale))
foundfof = true; 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)) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
continue; continue;
#ifdef ESLOPE
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight; 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)) 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)) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
continue; continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; 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)) if (topheight > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale))
{ {
@ -3808,12 +3756,10 @@ static void P_DoTeeter(player_t *player)
ceilingheight = sec->ceilingheight; ceilingheight = sec->ceilingheight;
floorheight = sec->floorheight; floorheight = sec->floorheight;
#ifdef ESLOPE
if (sec->c_slope) if (sec->c_slope)
ceilingheight = P_GetZAt(sec->c_slope, checkx, checky); ceilingheight = P_GetZAt(sec->c_slope, checkx, checky);
if (sec->f_slope) if (sec->f_slope)
floorheight = P_GetZAt(sec->f_slope, checkx, checky); floorheight = P_GetZAt(sec->f_slope, checkx, checky);
#endif
highestceilingheight = (ceilingheight > highestceilingheight) ? ceilingheight : highestceilingheight; highestceilingheight = (ceilingheight > highestceilingheight) ? ceilingheight : highestceilingheight;
lowestfloorheight = (floorheight < lowestfloorheight) ? floorheight : lowestfloorheight; lowestfloorheight = (floorheight < lowestfloorheight) ? floorheight : lowestfloorheight;
@ -3824,13 +3770,8 @@ static void P_DoTeeter(player_t *player)
{ {
if (!(rover->flags & FF_EXISTS)) continue; 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; 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; 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)) 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)) && (player->pflags & PF_JUMPSTASIS || player->mo->state-states != S_PLAY_GLIDE_LANDING))
return; return;
#ifdef HAVE_BLUA
if (cmd->buttons & BT_USE) if (cmd->buttons & BT_USE)
{ {
if (LUAh_SpinSpecial(player)) if (LUAh_SpinSpecial(player))
return; return;
} }
#endif
#ifdef ESLOPE
canstand = (!player->mo->standingslope || (player->mo->standingslope->flags & SL_NOPHYSICS) || abs(player->mo->standingslope->zdelta) < FRACUNIT/2); canstand = (!player->mo->standingslope || (player->mo->standingslope->flags & SL_NOPHYSICS) || abs(player->mo->standingslope->zdelta) < FRACUNIT/2);
#endif
/////////////////////////////// ///////////////////////////////
// ability-specific behavior // // 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 if (cmd->buttons & BT_USE && !LUAh_ShieldSpecial(player)) // Spin button effects
#ifdef HAVE_BLUA
&& !LUAh_ShieldSpecial(player)
#endif
)
{ {
// Force stop // Force stop
if ((player->powers[pw_shield] & ~(SH_FORCEHP|SH_STACK)) == SH_FORCE) if ((player->powers[pw_shield] & ~(SH_FORCEHP|SH_STACK)) == SH_FORCE)
@ -5207,10 +5140,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
// and you don't have a shield, do it! // and you don't have a shield, do it!
P_DoSuperTransformation(player, false); P_DoSuperTransformation(player, false);
} }
else else if (!LUAh_JumpSpinSpecial(player))
#ifdef HAVE_BLUA
if (!LUAh_JumpSpinSpecial(player))
#endif
switch (player->charability) switch (player->charability)
{ {
case CA_THOK: case CA_THOK:
@ -5287,16 +5217,13 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
if (cmd->buttons & BT_JUMP && !player->exiting && !P_PlayerInPain(player)) if (cmd->buttons & BT_JUMP && !player->exiting && !P_PlayerInPain(player))
{ {
#ifdef HAVE_BLUA
if (LUAh_JumpSpecial(player)) if (LUAh_JumpSpecial(player))
; ;
else // all situations below this require jump button not to be pressed already
#endif else if (player->pflags & PF_JUMPDOWN)
if (player->pflags & PF_JUMPDOWN) // all situations below this require jump button not to be pressed already
; ;
else
// Jump S3&K style while in quicksand. // Jump S3&K style while in quicksand.
if (P_InQuicksand(player->mo)) else if (P_InQuicksand(player->mo))
{ {
P_DoJump(player, true); P_DoJump(player, true);
player->secondjump = 0; player->secondjump = 0;
@ -5308,9 +5235,8 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
P_SetTarget(&player->mo->tracer, NULL); P_SetTarget(&player->mo->tracer, NULL);
player->powers[pw_flashing] = TICRATE/4; player->powers[pw_flashing] = TICRATE/4;
} }
else
// can't jump while in air, can't jump while jumping // 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); P_DoJump(player, true);
player->secondjump = 0; player->secondjump = 0;
@ -5326,9 +5252,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
}*/ }*/
else if (player->pflags & PF_JUMPED) else if (player->pflags & PF_JUMPED)
{ {
#ifdef HAVE_BLUA
if (!LUAh_AbilitySpecial(player)) if (!LUAh_AbilitySpecial(player))
#endif
switch (player->charability) switch (player->charability)
{ {
case CA_THOK: case CA_THOK:
@ -5523,9 +5447,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
} }
else if (player->pflags & PF_THOKKED) else if (player->pflags & PF_THOKKED)
{ {
#ifdef HAVE_BLUA
if (!LUAh_AbilitySpecial(player)) if (!LUAh_AbilitySpecial(player))
#endif
switch (player->charability) switch (player->charability)
{ {
case CA_FLY: case CA_FLY:
@ -5921,12 +5843,10 @@ static void P_3dMovement(player_t *player)
controlstyle_e controlstyle; 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)); 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; fixed_t oldMagnitude, newMagnitude;
#ifdef ESLOPE
vector3_t totalthrust; vector3_t totalthrust;
totalthrust.x = totalthrust.y = 0; // I forget if this is needed 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 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 // 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); 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); movepushforward = FixedMul(movepushforward, player->mo->scale);
#ifdef ESLOPE
totalthrust.x += P_ReturnThrustX(player->mo, movepushangle, movepushforward); totalthrust.x += P_ReturnThrustX(player->mo, movepushangle, movepushforward);
totalthrust.y += P_ReturnThrustY(player->mo, movepushangle, movepushforward); totalthrust.y += P_ReturnThrustY(player->mo, movepushangle, movepushforward);
#else
P_Thrust(player->mo, movepushangle, movepushforward);
#endif
} }
// Sideways movement // Sideways movement
if (player->climbing) if (player->climbing)
@ -6175,12 +6091,8 @@ static void P_3dMovement(player_t *player)
movepushforward = FixedMul(movepushforward, player->mo->scale); movepushforward = FixedMul(movepushforward, player->mo->scale);
#ifdef ESLOPE
totalthrust.x += P_ReturnThrustX(player->mo, controldirection, movepushforward); totalthrust.x += P_ReturnThrustX(player->mo, controldirection, movepushforward);
totalthrust.y += P_ReturnThrustY(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)) 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. // Finally move the player now that their speed/direction has been decided.
movepushside = FixedMul(movepushside, player->mo->scale); movepushside = FixedMul(movepushside, player->mo->scale);
#ifdef ESLOPE
totalthrust.x += P_ReturnThrustX(player->mo, movepushsideangle, movepushside); totalthrust.x += P_ReturnThrustX(player->mo, movepushsideangle, movepushside);
totalthrust.y += P_ReturnThrustY(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) if ((totalthrust.x || totalthrust.y)
&& player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && abs(player->mo->standingslope->zdelta) > FRACUNIT/2) { && 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! // 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->momx += totalthrust.x;
player->mo->momy += totalthrust.y; player->mo->momy += totalthrust.y;
#endif
// Time to ask three questions: // Time to ask three questions:
// 1) Are we over topspeed? // 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)); 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)); 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) if (player->mo->standingslope)
{ {
ground = P_GetZAt(player->mo->standingslope, newx, newy); ground = P_GetZAt(player->mo->standingslope, newx, newy);
if (player->mo->eflags & MFE_VERTICALFLIP) if (player->mo->eflags & MFE_VERTICALFLIP)
ground -= FixedMul(mobjinfo[MT_SPINFIRE].height, player->mo->scale); ground -= FixedMul(mobjinfo[MT_SPINFIRE].height, player->mo->scale);
} }
#endif
flame = P_SpawnMobj(newx, newy, ground, MT_SPINFIRE); flame = P_SpawnMobj(newx, newy, ground, MT_SPINFIRE);
P_SetTarget(&flame->target, player->mo); P_SetTarget(&flame->target, player->mo);
flame->angle = travelangle; 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 if (enemy->health <= 0) // dead
return false; 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; return false;
if (enemy->flags2 & MF2_FRET) if (enemy->flags2 & MF2_FRET)
@ -10633,10 +10538,8 @@ boolean P_SpectatorJoinGame(player_t *player)
else else
changeto = (P_RandomFixed() & 1) + 1; changeto = (P_RandomFixed() & 1) + 1;
#ifdef HAVE_BLUA
if (!LUAh_TeamSwitch(player, changeto, true, false, false)) if (!LUAh_TeamSwitch(player, changeto, true, false, false))
return false; return false;
#endif
if (player->mo) if (player->mo)
{ {
@ -10650,11 +10553,9 @@ boolean P_SpectatorJoinGame(player_t *player)
//Reset away view //Reset away view
if (P_IsLocalPlayer(player) && displayplayer != consoleplayer) if (P_IsLocalPlayer(player) && displayplayer != consoleplayer)
{ {
#ifdef HAVE_BLUA
// Call ViewpointSwitch hooks here. // Call ViewpointSwitch hooks here.
// The viewpoint was forcibly changed. // The viewpoint was forcibly changed.
LUAh_ViewpointSwitch(player, &players[displayplayer], true); LUAh_ViewpointSwitch(player, &players[consoleplayer], true);
#endif
displayplayer = consoleplayer; displayplayer = consoleplayer;
} }
@ -10672,10 +10573,8 @@ boolean P_SpectatorJoinGame(player_t *player)
// respawn in place and sit there for the rest of the round. // respawn in place and sit there for the rest of the round.
if (!((gametyperules & GTR_HIDEFROZEN) && leveltime > (hidetime * TICRATE))) if (!((gametyperules & GTR_HIDEFROZEN) && leveltime > (hidetime * TICRATE)))
{ {
#ifdef HAVE_BLUA
if (!LUAh_TeamSwitch(player, 3, true, false, false)) if (!LUAh_TeamSwitch(player, 3, true, false, false))
return false; return false;
#endif
if (player->mo) if (player->mo)
{ {
P_RemoveMobj(player->mo); P_RemoveMobj(player->mo);
@ -10699,11 +10598,9 @@ boolean P_SpectatorJoinGame(player_t *player)
//Reset away view //Reset away view
if (P_IsLocalPlayer(player) && displayplayer != consoleplayer) if (P_IsLocalPlayer(player) && displayplayer != consoleplayer)
{ {
#ifdef HAVE_BLUA
// Call ViewpointSwitch hooks here. // Call ViewpointSwitch hooks here.
// The viewpoint was forcibly changed. // The viewpoint was forcibly changed.
LUAh_ViewpointSwitch(player, &players[displayplayer], true); LUAh_ViewpointSwitch(player, &players[consoleplayer], true);
#endif
displayplayer = consoleplayer; displayplayer = consoleplayer;
} }
@ -10766,13 +10663,8 @@ static void P_CalcPostImg(player_t *player)
if (!(rover->flags & FF_EXISTS)) if (!(rover->flags & FF_EXISTS))
continue; continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; 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; 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) if (pviewheight >= topheight || pviewheight <= bottomheight)
continue; 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) if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKPLAYER)
continue; continue;
#ifdef ESLOPE
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight; 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; 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) if (pviewheight >= topheight || pviewheight <= bottomheight)
continue; continue;
@ -11626,9 +11513,7 @@ void P_PlayerThink(player_t *player)
} }
if (player->playerstate == PST_REBORN) if (player->playerstate == PST_REBORN)
{ {
#ifdef HAVE_BLUA
LUAh_PlayerThink(player); LUAh_PlayerThink(player);
#endif
return; return;
} }
} }
@ -11732,9 +11617,7 @@ void P_PlayerThink(player_t *player)
if (player->playerstate == PST_DEAD) if (player->playerstate == PST_DEAD)
{ {
#ifdef HAVE_BLUA
LUAh_PlayerThink(player); LUAh_PlayerThink(player);
#endif
return; return;
} }
} }
@ -11857,9 +11740,7 @@ void P_PlayerThink(player_t *player)
{ {
player->mo->flags2 &= ~MF2_SHADOW; player->mo->flags2 &= ~MF2_SHADOW;
P_DeathThink(player); P_DeathThink(player);
#ifdef HAVE_BLUA
LUAh_PlayerThink(player); LUAh_PlayerThink(player);
#endif
return; return;
} }
@ -11901,9 +11782,7 @@ void P_PlayerThink(player_t *player)
{ {
if (P_SpectatorJoinGame(player)) if (P_SpectatorJoinGame(player))
{ {
#ifdef HAVE_BLUA
LUAh_PlayerThink(player); LUAh_PlayerThink(player);
#endif
return; // player->mo was removed. return; // player->mo was removed.
} }
} }
@ -12008,9 +11887,7 @@ void P_PlayerThink(player_t *player)
if (!player->mo) if (!player->mo)
{ {
#ifdef HAVE_BLUA
LUAh_PlayerThink(player); LUAh_PlayerThink(player);
#endif
return; // P_MovePlayer removed player->mo. return; // P_MovePlayer removed player->mo.
} }
@ -12452,9 +12329,7 @@ void P_PlayerThink(player_t *player)
} }
#undef dashmode #undef dashmode
#ifdef HAVE_BLUA
LUAh_PlayerThink(player); LUAh_PlayerThink(player);
#endif
/* /*
// Colormap verification // Colormap verification
@ -13004,11 +12879,9 @@ void P_PlayerAfterThink(player_t *player)
if (player->followmobj) if (player->followmobj)
{ {
#ifdef HAVE_BLUA
if (LUAh_FollowMobj(player, player->followmobj) || P_MobjWasRemoved(player->followmobj)) if (LUAh_FollowMobj(player, player->followmobj) || P_MobjWasRemoved(player->followmobj))
{;} {;}
else else
#endif
{ {
switch (player->followmobj->type) switch (player->followmobj->type)
{ {

View file

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

View file

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

View file

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

View file

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

View file

@ -620,7 +620,6 @@ void R_DrawSpan_8 (void)
} }
} }
#ifdef ESLOPE
// R_CalcTiltedLighting // R_CalcTiltedLighting
// Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly. // Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly.
INT32 tiltlighting[MAXVIDWIDTH]; INT32 tiltlighting[MAXVIDWIDTH];
@ -1199,7 +1198,6 @@ void R_DrawTiltedSplat_8(void)
} }
#endif #endif
} }
#endif // ESLOPE
/** \brief The R_DrawSplat_8 function /** \brief The R_DrawSplat_8 function
Just like R_DrawSpan_8, but skips transparent pixels. 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)) #define PLANELIGHTFLOAT (BASEVIDWIDTH * BASEVIDWIDTH / vid.width / (zeroheight - FIXED_TO_FLOAT(viewz)) / 21.0f * FIXED_TO_FLOAT(fovtan))
/** \brief The R_DrawTiltedSpan_NPO2_8 function /** \brief The R_DrawTiltedSpan_NPO2_8 function
@ -661,7 +659,6 @@ void R_DrawTiltedSplat_NPO2_8(void)
} }
#endif #endif
} }
#endif // ESLOPE
/** \brief The R_DrawSplat_NPO2_8 function /** \brief The R_DrawSplat_NPO2_8 function
Just like R_DrawSpan_NPO2_8, but skips transparent pixels. 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 /** \brief The R_DrawTiltedTranslucentWaterSpan_NPO2_8 function
Like DrawTiltedTranslucentSpan_NPO2, but for water Like DrawTiltedTranslucentSpan_NPO2, but for water
*/ */
@ -1043,5 +1039,4 @@ void R_DrawTiltedTranslucentWaterSpan_NPO2_8(void)
} }
#endif #endif
} }
#endif // ESLOPE
#endif // NOWATER #endif // NOWATER

View file

@ -459,9 +459,7 @@ static void R_InitTextureMapping(void)
focallength = FixedDiv(projection, focallength = FixedDiv(projection,
FINETANGENT(FINEANGLES/4+FIELDOFVIEW/2)); FINETANGENT(FINEANGLES/4+FIELDOFVIEW/2));
#ifdef ESLOPE
focallengthf = FIXED_TO_FLOAT(focallength); focallengthf = FIXED_TO_FLOAT(focallength);
#endif
for (i = 0; i < FINEANGLES/2; i++) 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 // Needed for ds_bgofs
R_PlaneRipple(currentplane, y, planeheight); R_PlaneRipple(currentplane, y, planeheight);
#ifdef ESLOPE
if (currentplane->slope) if (currentplane->slope)
{ {
ds_sup = &ds_su[y]; ds_sup = &ds_su[y];
@ -210,7 +209,6 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
ds_szp = &ds_sz[y]; ds_szp = &ds_sz[y];
} }
else else
#endif
{ {
ds_xfrac += ripple_xfrac; ds_xfrac += ripple_xfrac;
ds_yfrac += ripple_yfrac; ds_yfrac += ripple_yfrac;
@ -227,11 +225,9 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
if (pindex >= MAXLIGHTZ) if (pindex >= MAXLIGHTZ)
pindex = MAXLIGHTZ - 1; pindex = MAXLIGHTZ - 1;
#ifdef ESLOPE
if (currentplane->slope) if (currentplane->slope)
ds_colormap = colormaps; ds_colormap = colormaps;
else else
#endif
ds_colormap = planezlight[pindex]; ds_colormap = planezlight[pindex];
if (currentplane->extra_colormap) if (currentplane->extra_colormap)
@ -345,17 +341,12 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
#ifdef POLYOBJECTS_PLANES #ifdef POLYOBJECTS_PLANES
, polyobj_t *polyobj , polyobj_t *polyobj
#endif #endif
#ifdef ESLOPE , pslope_t *slope)
, pslope_t *slope
#endif
)
{ {
visplane_t *check; visplane_t *check;
unsigned hash; unsigned hash;
#ifdef ESLOPE if (!slope) // Don't mess with this right now if a slope is involved
if (slope); else // Don't mess with this right now if a slope is involved
#endif
{ {
xoff += viewx; xoff += viewx;
yoff -= viewy; 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->viewx == viewx && check->viewy == viewy && check->viewz == viewz
&& check->viewangle == viewangle && check->viewangle == viewangle
&& check->plangle == plangle && check->plangle == plangle
#ifdef ESLOPE && check->slope == slope)
&& check->slope == slope
#endif
)
{ {
return check; return check;
} }
@ -441,9 +429,7 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
#ifdef POLYOBJECTS_PLANES #ifdef POLYOBJECTS_PLANES
check->polyobj = polyobj; check->polyobj = polyobj;
#endif #endif
#ifdef ESLOPE
check->slope = slope; check->slope = slope;
#endif
memset(check->top, 0xff, sizeof (check->top)); memset(check->top, 0xff, sizeof (check->top));
memset(check->bottom, 0x00, sizeof (check->bottom)); 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 #ifdef POLYOBJECTS_PLANES
new_pl->polyobj = pl->polyobj; new_pl->polyobj = pl->polyobj;
#endif #endif
#ifdef ESLOPE
new_pl->slope = pl->slope; new_pl->slope = pl->slope;
#endif
pl = new_pl; pl = new_pl;
pl->minx = start; pl->minx = start;
pl->maxx = stop; pl->maxx = stop;
@ -860,7 +844,6 @@ static UINT8 *R_GetTextureFlat(levelflat_t *levelflat, boolean leveltexture, boo
return flat; return flat;
} }
#ifdef ESLOPE
static void R_SlopeVectors(visplane_t *pl, INT32 i, float fudge) 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! // 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 #undef SFMULT
} }
#endif // ESLOPE
void R_DrawSinglePlane(visplane_t *pl) void R_DrawSinglePlane(visplane_t *pl)
{ {
@ -1087,10 +1069,8 @@ void R_DrawSinglePlane(visplane_t *pl)
} }
else light = (pl->lightlevel >> LIGHTSEGSHIFT); else light = (pl->lightlevel >> LIGHTSEGSHIFT);
#ifdef ESLOPE if (!pl->slope // Don't mess with angle on slopes! We'll handle this ourselves later
if (!pl->slope) // Don't mess with angle on slopes! We'll handle this ourselves later && viewangle != pl->viewangle+pl->plangle)
#endif
if (viewangle != pl->viewangle+pl->plangle)
{ {
memset(cachedheight, 0, sizeof (cachedheight)); memset(cachedheight, 0, sizeof (cachedheight));
angle = (pl->viewangle+pl->plangle-ANGLE_90)>>ANGLETOFINESHIFT; angle = (pl->viewangle+pl->plangle-ANGLE_90)>>ANGLETOFINESHIFT;
@ -1148,7 +1128,6 @@ void R_DrawSinglePlane(visplane_t *pl)
if (light < 0) if (light < 0)
light = 0; light = 0;
#ifdef ESLOPE
if (pl->slope) if (pl->slope)
{ {
float fudgecanyon = 0; float fudgecanyon = 0;
@ -1248,9 +1227,8 @@ void R_DrawSinglePlane(visplane_t *pl)
spanfunctype = SPANDRAWFUNC_TILTED; spanfunctype = SPANDRAWFUNC_TILTED;
planezlight = scalelight[light]; planezlight = scalelight[light];
} else }
#endif // ESLOPE else
planezlight = zlight[light]; planezlight = zlight[light];
// Use the correct span drawer depending on the powers-of-twoness // Use the correct span drawer depending on the powers-of-twoness

View file

@ -50,9 +50,7 @@ typedef struct visplane_s
#ifdef POLYOBJECTS_PLANES #ifdef POLYOBJECTS_PLANES
polyobj_t *polyobj; polyobj_t *polyobj;
#endif #endif
#ifdef ESLOPE
pslope_t *slope; pslope_t *slope;
#endif
} visplane_t; } visplane_t;
extern visplane_t *visplanes[MAXVISPLANES]; 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 #ifdef POLYOBJECTS_PLANES
, polyobj_t *polyobj , polyobj_t *polyobj
#endif #endif
#ifdef ESLOPE , pslope_t *slope);
, pslope_t *slope
#endif
);
visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop); visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop);
void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop); void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop);
void R_PlaneBounds(visplane_t *plane); void R_PlaneBounds(visplane_t *plane);
@ -110,13 +105,11 @@ typedef struct planemgr_s
INT16 f_clip[MAXVIDWIDTH]; INT16 f_clip[MAXVIDWIDTH];
INT16 c_clip[MAXVIDWIDTH]; INT16 c_clip[MAXVIDWIDTH];
#ifdef ESLOPE
// For slope rendering; the height at the other end // For slope rendering; the height at the other end
fixed_t f_pos_slope; fixed_t f_pos_slope;
fixed_t b_pos_slope; fixed_t b_pos_slope;
struct pslope_s *slope; struct pslope_s *slope;
#endif
struct ffloor_s *ffloor; struct ffloor_s *ffloor;
#ifdef POLYOBJECTS_PLANES #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_tick.h"
#include "p_local.h" #include "p_local.h"
#include "p_slopes.h" #include "p_slopes.h"
#include "dehacked.h" // get_number (for thok)
#include "d_netfil.h" // blargh. for nameonly(). #include "d_netfil.h" // blargh. for nameonly().
#include "m_cheat.h" // objectplace #include "m_cheat.h" // objectplace
#include "m_cond.h"
#include "fastcmp.h"
#ifdef HWRENDER #ifdef HWRENDER
#include "hardware/hw_md2.h" #include "hardware/hw_md2.h"
#include "hardware/hw_glob.h" #include "hardware/hw_glob.h"
@ -42,14 +39,6 @@
#include "hardware/hw_drv.h" #include "hardware/hw_drv.h"
#endif #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 MINZ (FRACUNIT*4)
#define BASEYCENTER (BASEVIDHEIGHT/2) #define BASEYCENTER (BASEVIDHEIGHT/2)
@ -233,7 +222,7 @@ static void R_InstallSpriteLump(UINT16 wad, // graphics patch
// //
// Returns true if the sprite was succesfully added // 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; UINT16 l;
UINT8 frame; UINT8 frame;
@ -245,6 +234,8 @@ static boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef,
memset(sprtemp,0xFF, sizeof (sprtemp)); memset(sprtemp,0xFF, sizeof (sprtemp));
maxframe = (size_t)-1; maxframe = (size_t)-1;
spritename = sprname;
// are we 'patching' a sprite already loaded ? // are we 'patching' a sprite already loaded ?
// if so, it might patch only certain frames, not all // if so, it might patch only certain frames, not all
if (spritedef->numframes) // (then spriteframes is not null) if (spritedef->numframes) // (then spriteframes is not null)
@ -476,11 +467,10 @@ void R_AddSpriteDefs(UINT16 wadnum)
// //
for (i = 0; i < numsprites; i++) for (i = 0; i < numsprites; i++)
{ {
spritename = sprnames[i]; if (sprnames[i][4] && wadnum >= (UINT16)sprnames[i][4])
if (spritename[4] && wadnum >= (UINT16)spritename[4])
continue; continue;
if (R_AddSingleSpriteDef(spritename, &sprites[i], wadnum, start, end)) if (R_AddSingleSpriteDef(sprnames[i], &sprites[i], wadnum, start, end))
{ {
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode == render_opengl) if (rendermode == render_opengl)
@ -489,7 +479,7 @@ void R_AddSpriteDefs(UINT16 wadnum)
// if a new sprite was added (not just replaced) // if a new sprite was added (not just replaced)
addsprites++; addsprites++;
#ifndef ZDEBUG #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 #endif
} }
} }
@ -1040,10 +1030,8 @@ static void R_SplitSprite(vissprite_t *sprite)
if (!(sector->lightlist[i].caster->flags & FF_CUTSPRITES)) if (!(sector->lightlist[i].caster->flags & FF_CUTSPRITES))
continue; continue;
#ifdef ESLOPE
if (sector->lightlist[i].slope) if (sector->lightlist[i].slope)
testheight = P_GetZAt(sector->lightlist[i].slope, sprite->gx, sprite->gy); testheight = P_GetZAt(sector->lightlist[i].slope, sprite->gx, sprite->gy);
#endif
if (testheight >= sprite->gzt) if (testheight >= sprite->gzt)
continue; continue;
@ -1331,9 +1319,9 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
if (thing->subsector->sector->numlights) if (thing->subsector->sector->numlights)
{ {
INT32 lightnum; INT32 lightnum;
#ifdef ESLOPE // R_GetPlaneLight won't work on sloped lights!
light = thing->subsector->sector->numlights - 1; light = thing->subsector->sector->numlights - 1;
// R_GetPlaneLight won't work on sloped lights!
for (lightnum = 1; lightnum < thing->subsector->sector->numlights; lightnum++) { 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) 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; : thing->subsector->sector->lightlist[lightnum].height;
@ -1342,9 +1330,7 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale,
break; break;
} }
} }
#else //light = R_GetPlaneLight(thing->subsector->sector, shadow->gzt, false);
light = R_GetPlaneLight(thing->subsector->sector, shadow->gzt, false);
#endif
} }
if (thing->subsector->sector->numlights) if (thing->subsector->sector->numlights)
@ -1740,9 +1726,9 @@ static void R_ProjectSprite(mobj_t *thing)
if (thing->subsector->sector->numlights) if (thing->subsector->sector->numlights)
{ {
INT32 lightnum; INT32 lightnum;
#ifdef ESLOPE // R_GetPlaneLight won't work on sloped lights!
light = thing->subsector->sector->numlights - 1; light = thing->subsector->sector->numlights - 1;
// R_GetPlaneLight won't work on sloped lights!
for (lightnum = 1; lightnum < thing->subsector->sector->numlights; lightnum++) { 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) 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; : thing->subsector->sector->lightlist[lightnum].height;
@ -1751,9 +1737,7 @@ static void R_ProjectSprite(mobj_t *thing)
break; break;
} }
} }
#else //light = R_GetPlaneLight(thing->subsector->sector, gzt, false);
light = R_GetPlaneLight(thing->subsector->sector, gzt, false);
#endif
lightnum = (*thing->subsector->sector->lightlist[light].lightlevel >> LIGHTSEGSHIFT); lightnum = (*thing->subsector->sector->lightlist[light].lightlevel >> LIGHTSEGSHIFT);
if (lightnum < 0) 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) if (rover->szt > r2->plane->low || rover->sz < r2->plane->high)
continue; continue;
#ifdef ESLOPE
// Effective height may be different for each comparison in the case of slopes // Effective height may be different for each comparison in the case of slopes
if (r2->plane->slope) { if (r2->plane->slope) {
planeobjectz = P_GetZAt(r2->plane->slope, rover->gx, rover->gy); planeobjectz = P_GetZAt(r2->plane->slope, rover->gx, rover->gy);
planecameraz = P_GetZAt(r2->plane->slope, viewx, viewy); planecameraz = P_GetZAt(r2->plane->slope, viewx, viewy);
} else }
#endif else
planeobjectz = planecameraz = r2->plane->height; planeobjectz = planecameraz = r2->plane->height;
if (rover->mobjflags & MF_NOCLIPHEIGHT) 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) if (scale <= rover->sortscale)
continue; continue;
#ifdef ESLOPE
if (*r2->ffloor->t_slope) { if (*r2->ffloor->t_slope) {
topplaneobjectz = P_GetZAt(*r2->ffloor->t_slope, rover->gx, rover->gy); topplaneobjectz = P_GetZAt(*r2->ffloor->t_slope, rover->gx, rover->gy);
topplanecameraz = P_GetZAt(*r2->ffloor->t_slope, viewx, viewy); topplanecameraz = P_GetZAt(*r2->ffloor->t_slope, viewx, viewy);
} else }
#endif else
topplaneobjectz = topplanecameraz = *r2->ffloor->topheight; topplaneobjectz = topplanecameraz = *r2->ffloor->topheight;
#ifdef ESLOPE
if (*r2->ffloor->b_slope) { if (*r2->ffloor->b_slope) {
botplaneobjectz = P_GetZAt(*r2->ffloor->b_slope, rover->gx, rover->gy); botplaneobjectz = P_GetZAt(*r2->ffloor->b_slope, rover->gx, rover->gy);
botplanecameraz = P_GetZAt(*r2->ffloor->b_slope, viewx, viewy); botplanecameraz = P_GetZAt(*r2->ffloor->b_slope, viewx, viewy);
} else }
#endif else
botplaneobjectz = botplanecameraz = *r2->ffloor->bottomheight; botplaneobjectz = botplanecameraz = *r2->ffloor->bottomheight;
if ((topplanecameraz > viewz && botplanecameraz < viewz) || if ((topplanecameraz > viewz && botplanecameraz < viewz) ||
@ -2964,795 +2945,3 @@ void R_DrawMasked(maskcount_t* masks, UINT8 nummasks)
free(heads); 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__ #ifndef __R_THINGS__
#define __R_THINGS__ #define __R_THINGS__
#include "sounds.h"
#include "r_plane.h" #include "r_plane.h"
#include "r_patch.h" #include "r_patch.h"
#include "r_portal.h" #include "r_portal.h"
#include "r_defs.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 // SPRITE LOADING
#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)
#define FEETADJUST (4<<FRACBITS) // R_AddSingleSpriteDef #define FEETADJUST (4<<FRACBITS) // R_AddSingleSpriteDef
// Constant arrays used for psprite clipping boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16 wadnum, UINT16 startlump, UINT16 endlump);
// and initializing clipping.
extern INT16 negonearray[MAXVIDWIDTH]; //faB: find sprites in wadfile, replace existing, add new ones
extern INT16 screenheightarray[MAXVIDWIDTH]; // (only sprites from namelist are added or replaced)
void R_AddSpriteDefs(UINT16 wadnum);
// ---------------------
// MASKED COLUMN DRAWING
// ---------------------
// vars for R_DrawMaskedColumn // vars for R_DrawMaskedColumn
extern INT16 *mfloorclip; extern INT16 *mfloorclip;
@ -47,9 +48,14 @@ extern fixed_t windowbottom;
void R_DrawMaskedColumn(column_t *column); void R_DrawMaskedColumn(column_t *column);
void R_DrawFlippedMaskedColumn(column_t *column, INT32 texheight); 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) // SPRITE RENDERING
void R_AddSpriteDefs(UINT16 wadnum); // ----------------
// 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); 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, boolean R_PrecipThingVisible (precipmobj_t *precipthing,
fixed_t precip_draw_dist); fixed_t precip_draw_dist);
// --------------
// MASKED DRAWING
// --------------
/** Used to count the amount of masked elements /** Used to count the amount of masked elements
* per portal to later group them in separate * per portal to later group them in separate
* drawnode lists. * drawnode lists.
@ -82,73 +91,18 @@ typedef struct
void R_DrawMasked(maskcount_t* masks, UINT8 nummasks); void R_DrawMasked(maskcount_t* masks, UINT8 nummasks);
// ----------- // ----------
// SKINS STUFF // VISSPRITES
// ----------- // ----------
#define SKINNAMESIZE 16
// should be all lowercase!! S_SKIN processing does a strlwr
#define DEFAULTSKIN "sonic"
#define DEFAULTSKIN2 "tails" // secondary player
#define DEFAULTNIGHTSSKIN 0
typedef struct // number of sprite lumps for spritewidth,offset,topoffset lookup tables
{ // Fab: this is a hack : should allocate the lookup tables per sprite
char name[SKINNAMESIZE+1]; // INT16 descriptive name of the skin #define MAXVISSPRITES 2048 // added 2-2-98 was 128
UINT16 wadnum;
skinflags_t flags;
char realname[SKINNAMESIZE+1]; // Display name for level completion. #define VISSPRITECHUNKBITS 6 // 2^6 = 64 sprites per chunk
char hudname[SKINNAMESIZE+1]; // HUD name to display (officially exactly 5 characters long) #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 typedef enum
{ {
// actual cuts // actual cuts
@ -227,6 +181,12 @@ typedef struct vissprite_s
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
} vissprite_t; } vissprite_t;
extern UINT32 visspritecount;
// ----------
// DRAW NODES
// ----------
// A drawnode is something that points to a 3D floor, 3D side, or masked // A drawnode is something that points to a 3D floor, 3D side, or masked
// middle texture. This is used for sorting with sprites. // middle texture. This is used for sorting with sprites.
typedef struct drawnode_s typedef struct drawnode_s
@ -241,23 +201,11 @@ typedef struct drawnode_s
struct drawnode_s *prev; struct drawnode_s *prev;
} drawnode_t; } 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); void R_InitDrawNodes(void);
char *GetPlayerFacePic(INT32 skinnum); // -----------------------
// SPRITE FRAME CHARACTERS
// -----------------------
// Functions to go from sprite character ID to frame number // Functions to go from sprite character ID to frame number
// for 2.1 compatibility this still uses the old 'A' + frame code // 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 "g_game.h"
#include "m_argv.h" #include "m_argv.h"
#include "r_main.h" // R_PointToAngle2() used to calc stereo sep. #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_system.h"
#include "i_sound.h" #include "i_sound.h"
#include "s_sound.h" #include "s_sound.h"
@ -40,7 +40,7 @@ extern INT32 msg_id;
#include "m_misc.h" // for tunes command #include "m_misc.h" // for tunes command
#include "m_cond.h" // for conditionsets #include "m_cond.h" // for conditionsets
#if defined(HAVE_BLUA) && defined(HAVE_LUA_MUSICPLUS) #ifdef HAVE_LUA_MUSICPLUS
#include "lua_hook.h" // MusicChange hook #include "lua_hook.h" // MusicChange hook
#endif #endif
@ -2045,7 +2045,7 @@ static musicstack_t *S_GetMusicStackEntry(UINT16 status, boolean fromfirst, INT1
if (!status || mst->status == status) 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 if (!S_MusicExists(mst->musname, !midi_disabled, !digital_disabled)) // paranoia
S_RemoveMusicStackEntry(mst); // then continue S_RemoveMusicStackEntry(mst); // then continue
@ -2314,7 +2314,7 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32
return; return;
strncpy(newmusic, mmusic, 7); 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)) if(LUAh_MusicChange(music_name, newmusic, &mflags, &looping, &position, &prefadems, &fadeinms))
return; return;
#endif #endif

View file

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

View file

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

View file

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

View file

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

View file

@ -50,7 +50,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;" 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" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@ -145,7 +145,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;" 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" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@ -248,7 +248,7 @@
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;" 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" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"
PrecompiledHeaderFile=".\..\..\objs\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch" PrecompiledHeaderFile=".\..\..\objs\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch"
@ -350,7 +350,7 @@
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\libs\libpng-src&quot;;&quot;$(ProjectDir)..\..\libs\zlib&quot;" 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" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"
PrecompiledHeaderFile=".\..\..\objs\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch" PrecompiledHeaderFile=".\..\..\objs\VC9\$(Platform)\$(Configuration)\SDL\Srb2SDL-vc9.pch"

View file

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

View file

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

View file

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

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