mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Merge branch 'master' of https://git.magicalgirl.moe/STJr/SRB2.git into fickleheart/SRB2-menu-soc-bullshit
# Conflicts: # src/m_menu.c
This commit is contained in:
commit
e5bc0583e5
146 changed files with 9359 additions and 17875 deletions
|
@ -51,8 +51,8 @@ jobs:
|
|||
- /var/cache/apt/archives
|
||||
- checkout
|
||||
- run:
|
||||
name: Compile without network support and BLUA
|
||||
command: make -C src LINUX=1 ERRORMODE=1 -k NONET=1 NO_LUA=1
|
||||
name: Compile without network support
|
||||
command: make -C src LINUX=1 ERRORMODE=1 -k NONET=1
|
||||
- run:
|
||||
name: wipe build
|
||||
command: make -C src LINUX=1 cleandep
|
||||
|
|
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
|
|||
# DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string.
|
||||
# Version change is fine.
|
||||
project(SRB2
|
||||
VERSION 2.2.2
|
||||
VERSION 2.2.3
|
||||
LANGUAGES C)
|
||||
|
||||
if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
version: 2.2.2.{branch}-{build}
|
||||
version: 2.2.3.{branch}-{build}
|
||||
os: MinGW
|
||||
|
||||
environment:
|
||||
|
|
|
@ -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
|
||||
{
|
||||
}
|
|
@ -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
|
@ -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";
|
||||
}
|
||||
}
|
|
@ -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
|
@ -15,7 +15,7 @@
|
|||
* Oogaland
|
||||
* Rob
|
||||
* Shadow Hog
|
||||
* Spherallic
|
||||
* sphere
|
||||
* SRB2-Playah
|
||||
* SSNTails
|
||||
* SteelT
|
||||
|
@ -435,7 +435,7 @@ sectortypes
|
|||
112 = "Trigger Line Ex. (NiGHTS Mare)";
|
||||
128 = "Check for Linedef Executor on FOFs";
|
||||
144 = "Egg Capsule";
|
||||
160 = "Special Stage Time/Rings Parameters";
|
||||
160 = "Special Stage Time/Spheres Parameters";
|
||||
176 = "Custom Global Gravity";
|
||||
512 = "Wind/Current";
|
||||
1024 = "Conveyor Belt";
|
||||
|
@ -490,7 +490,7 @@ gen_sectortypes
|
|||
112 = "Trigger Line Ex. (NiGHTS Mare)";
|
||||
128 = "Check for Linedef Executor on FOFs";
|
||||
144 = "Egg Capsule";
|
||||
160 = "Special Stage Time/Rings Parameters";
|
||||
160 = "Special Stage Time/Spheres Parameters";
|
||||
176 = "Custom Global Gravity";
|
||||
}
|
||||
|
||||
|
@ -738,12 +738,6 @@ linedeftypes
|
|||
flags2text = "[1] Use control sector tag";
|
||||
flags64text = "[6] No sound effect";
|
||||
}
|
||||
|
||||
65
|
||||
{
|
||||
title = "Bridge Thinker <disabled>";
|
||||
prefix = "(65)";
|
||||
}
|
||||
}
|
||||
|
||||
polyobject
|
||||
|
@ -766,6 +760,8 @@ linedeftypes
|
|||
{
|
||||
title = "Parameters";
|
||||
prefix = "(22)";
|
||||
flags8text = "[3] Set translucency by X offset";
|
||||
flags32text = "[5] Render outer sides only";
|
||||
flags64text = "[6] Trigger linedef executor";
|
||||
flags128text = "[7] Intangible";
|
||||
flags256text = "[8] Stopped by pushables";
|
||||
|
@ -788,7 +784,6 @@ linedeftypes
|
|||
{
|
||||
title = "Angular Displacement by Front Sector";
|
||||
prefix = "(32)";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
flags64text = "[6] Don't turn players";
|
||||
flags512text = "[9] Turn all objects";
|
||||
}
|
||||
|
@ -1136,7 +1131,6 @@ linedeftypes
|
|||
{
|
||||
title = "Goo Water, Translucent, No Sides";
|
||||
prefix = "(125)";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags64text = "[6] Use two light levels";
|
||||
flags512text = "[9] Use target light level";
|
||||
flags1024text = "[10] Ripple effect";
|
||||
|
@ -1227,6 +1221,18 @@ linedeftypes
|
|||
3dfloorflags = "19F";
|
||||
}
|
||||
|
||||
153
|
||||
{
|
||||
title = "Dynamically Sinking Platform";
|
||||
prefix = "(153)";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Spindash to move";
|
||||
flags128text = "[7] Only block non-players";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "19F";
|
||||
}
|
||||
|
||||
160
|
||||
{
|
||||
title = "Floating, Bobbing";
|
||||
|
@ -1282,7 +1288,6 @@ linedeftypes
|
|||
title = "Rising Platform, Solid, Invisible";
|
||||
prefix = "(193)";
|
||||
flags2text = "[1] Sink when stepped on";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Spindash to move";
|
||||
flags128text = "[7] Only block non-players";
|
||||
|
@ -1488,16 +1493,22 @@ linedeftypes
|
|||
{
|
||||
title = "Mario Block";
|
||||
prefix = "(250)";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags32text = "[5] Invisible block";
|
||||
flags64text = "[6] Brick block";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "40019F";
|
||||
flags323dfloorflagsremove = "19E";
|
||||
flags643dfloorflagsadd = "200000";
|
||||
}
|
||||
|
||||
251
|
||||
{
|
||||
title = "Thwomp Block";
|
||||
prefix = "(251)";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags32text = "[5] Only block player";
|
||||
flags128text = "[7] Only block non-players";
|
||||
flags512text = "[9] Custom crushing sound";
|
||||
flags1024text = "[10] Custom speed";
|
||||
3dfloor = true;
|
||||
|
@ -1513,8 +1524,8 @@ linedeftypes
|
|||
flags512text = "[9] Shattered by pushables";
|
||||
flags1024text = "[10] Trigger linedef executor";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "8800019";
|
||||
flags643dfloorflagsadd = "200006";
|
||||
3dfloorflags = "880001D";
|
||||
flags643dfloorflagsadd = "200002";
|
||||
}
|
||||
|
||||
253
|
||||
|
@ -1525,7 +1536,7 @@ linedeftypes
|
|||
flags512text = "[9] Shattered by pushables";
|
||||
flags1024text = "[10] Trigger linedef executor";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "8801019";
|
||||
3dfloorflags = "880101D";
|
||||
}
|
||||
|
||||
254
|
||||
|
@ -1533,6 +1544,7 @@ linedeftypes
|
|||
title = "Bustable Block";
|
||||
prefix = "(254)";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Strong characters only";
|
||||
flags128text = "[7] Only block non-players";
|
||||
flags512text = "[9] Shattered by pushables";
|
||||
|
@ -1593,6 +1605,7 @@ linedeftypes
|
|||
{
|
||||
title = "Custom FOF";
|
||||
prefix = "(259)";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags32text = "[5] Only block player";
|
||||
flags128text = "[7] Only block non-players";
|
||||
flags512text = "[9] Shattered by pushables";
|
||||
|
@ -1896,6 +1909,27 @@ linedeftypes
|
|||
prefix = "(333)";
|
||||
}
|
||||
|
||||
334
|
||||
{
|
||||
title = "Object Dye - Continuous";
|
||||
flags64text = "[6] Disable for this color";
|
||||
prefix = "(334)";
|
||||
}
|
||||
|
||||
335
|
||||
{
|
||||
title = "Object Dye - Each Time";
|
||||
flags64text = "[6] Disable for this color";
|
||||
prefix = "(335)";
|
||||
}
|
||||
|
||||
336
|
||||
{
|
||||
title = "Object Dye - Once";
|
||||
flags64text = "[6] Disable for this color";
|
||||
prefix = "(336)";
|
||||
}
|
||||
|
||||
399
|
||||
{
|
||||
title = "Level Load";
|
||||
|
@ -2161,6 +2195,14 @@ linedeftypes
|
|||
flags8text = "[3] Set delay by backside sector";
|
||||
}
|
||||
|
||||
449
|
||||
{
|
||||
title = "Enable Bosses with Parameter";
|
||||
prefix = "(449)";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
flags64text = "[6] Disable bosses";
|
||||
}
|
||||
|
||||
457
|
||||
{
|
||||
title = "Track Object's Angle";
|
||||
|
@ -2180,12 +2222,15 @@ linedeftypes
|
|||
{
|
||||
title = "Award Rings";
|
||||
prefix = "(460)";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
}
|
||||
|
||||
461
|
||||
{
|
||||
title = "Spawn Object";
|
||||
prefix = "(461)";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
flags32text = "[5] Use line angle for object";
|
||||
flags64text = "[6] Spawn inside a range";
|
||||
}
|
||||
|
||||
|
@ -2193,6 +2238,20 @@ linedeftypes
|
|||
{
|
||||
title = "Stop Timer/Exit Stage in Record Attack";
|
||||
prefix = "(462)";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
}
|
||||
|
||||
463
|
||||
{
|
||||
title = "Dye Object";
|
||||
prefix = "(463)";
|
||||
}
|
||||
|
||||
464
|
||||
{
|
||||
title = "Trigger Egg Capsule";
|
||||
prefix = "(464)";
|
||||
flags64text = "[6] Don't end level";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2206,7 +2265,7 @@ linedeftypes
|
|||
prefix = "(413)";
|
||||
flags2text = "[1] Keep after death";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
flags32text = "[5] Seek to current song position";
|
||||
flags32text = "[5] Seek from current position";
|
||||
flags64text = "[6] For everyone";
|
||||
flags128text = "[7] Fade to custom volume";
|
||||
flags512text = "[9] Don't loop";
|
||||
|
@ -2220,7 +2279,7 @@ linedeftypes
|
|||
flags2text = "[1] From calling sector";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
flags64text = "[6] From nowhere for triggerer";
|
||||
flags512text = "[9] For everyone";
|
||||
flags512text = "[9] From nowhere for everyone";
|
||||
flags1024text = "[10] From tagged sectors";
|
||||
}
|
||||
|
||||
|
@ -2298,7 +2357,6 @@ linedeftypes
|
|||
flags8text = "[3] Set delay by backside sector";
|
||||
}
|
||||
|
||||
|
||||
445
|
||||
{
|
||||
title = "Make FOF Disappear/Reappear";
|
||||
|
@ -2325,7 +2383,7 @@ linedeftypes
|
|||
flags32text = "[5] Subtract Red value";
|
||||
flags64text = "[6] Subtract Green value";
|
||||
flags128text = "[7] Subtract Blue value";
|
||||
flags256text = "[8] Calc relative values";
|
||||
flags256text = "[8] Set relative to current";
|
||||
flags32768text = "[15] Use backside colormap";
|
||||
}
|
||||
|
||||
|
@ -2359,7 +2417,7 @@ linedeftypes
|
|||
prefix = "(452)";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
flags64text = "[6] Do not handle FF_TRANS";
|
||||
flags256text = "[8] Set relative to current val";
|
||||
flags256text = "[8] Set relative to current";
|
||||
}
|
||||
|
||||
453
|
||||
|
@ -2371,7 +2429,7 @@ linedeftypes
|
|||
flags32text = "[5] No collision during fade";
|
||||
flags64text = "[6] Do not handle FF_TRANS";
|
||||
flags128text = "[7] Do not handle lighting";
|
||||
flags256text = "[8] Set relative to current val";
|
||||
flags256text = "[8] Set relative to current";
|
||||
flags512text = "[9] Speed = Tic Duration";
|
||||
flags1024text = "[10] Override existing fade";
|
||||
flags16384text = "[14] Do not handle collision";
|
||||
|
@ -2395,7 +2453,7 @@ linedeftypes
|
|||
flags32text = "[5] Subtract Red value";
|
||||
flags64text = "[6] Subtract Green value";
|
||||
flags128text = "[7] Subtract Blue value";
|
||||
flags256text = "[8] Calc relative values";
|
||||
flags256text = "[8] Set relative to current";
|
||||
flags512text = "[9] Speed = Tic Duration";
|
||||
flags1024text = "[10] Override existing fade";
|
||||
flags16384text = "[14] Fade from invisible black";
|
||||
|
@ -2416,9 +2474,7 @@ linedeftypes
|
|||
flags2text = "[1] Close text prompt";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
flags32text = "[5] Run executor tag on close";
|
||||
flags64text = "[6] For everyone";
|
||||
flags128text = "[7] Do not block controls";
|
||||
flags256text = "[8] Do not freeze time";
|
||||
flags128text = "[7] Don't disable controls";
|
||||
flags32768text = "[15] Find prompt by name";
|
||||
}
|
||||
}
|
||||
|
@ -2524,7 +2580,7 @@ linedeftypes
|
|||
prefix = "(491)";
|
||||
flags8text = "[3] Set delay by backside sector";
|
||||
flags16text = "[4] Set raw alpha by Front X";
|
||||
flags256text = "[8] Calc relative values";
|
||||
flags256text = "[8] Set relative to current";
|
||||
}
|
||||
|
||||
492
|
||||
|
@ -2534,7 +2590,7 @@ linedeftypes
|
|||
flags8text = "[3] Set delay by backside sector";
|
||||
flags16text = "[4] Set raw alpha by Front X";
|
||||
flags32text = "[5] No collision during fade";
|
||||
flags256text = "[8] Calc relative values";
|
||||
flags256text = "[8] Set relative to current";
|
||||
flags512text = "[9] Speed = Tic Duration";
|
||||
flags1024text = "[10] Override existing fade";
|
||||
flags16384text = "[14] Do not handle collision";
|
||||
|
@ -2632,76 +2688,84 @@ linedeftypes
|
|||
{
|
||||
title = "Carry Objects on Floor";
|
||||
prefix = "(520)";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
521
|
||||
{
|
||||
title = "Carry Objects on Floor (Accelerative)";
|
||||
prefix = "(521)";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
522
|
||||
{
|
||||
title = "Carry Objects on Floor (Displacement)";
|
||||
prefix = "(522)";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
523
|
||||
{
|
||||
title = "Carry Objects on Ceiling";
|
||||
prefix = "(523)";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
524
|
||||
{
|
||||
title = "Carry Objects on Ceiling (Accelerative)";
|
||||
prefix = "(524)";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
525
|
||||
{
|
||||
title = "Carry Objects on Ceiling (Displacement)";
|
||||
prefix = "(525)";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
530
|
||||
{
|
||||
title = "Scroll Floor Texture and Carry Objects";
|
||||
prefix = "(530)";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
531
|
||||
{
|
||||
title = "Scroll Floor Texture and Carry Objects (Accelerative)";
|
||||
prefix = "(531)";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
532
|
||||
{
|
||||
title = "Scroll Floor Texture and Carry Objects (Displacement)";
|
||||
prefix = "(532)";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
533
|
||||
{
|
||||
title = "Scroll Ceiling Texture and Carry Objects";
|
||||
prefix = "(533)";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
534
|
||||
{
|
||||
title = "Scroll Ceiling Texture and Carry Objects (Accelerative)";
|
||||
prefix = "(534)";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
535
|
||||
{
|
||||
title = "Scroll Ceiling Texture and Carry Objects (Displacement)";
|
||||
prefix = "(535)";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2714,7 +2778,7 @@ linedeftypes
|
|||
title = "Wind";
|
||||
prefix = "(541)";
|
||||
flags512text = "[9] Player slides";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
542
|
||||
|
@ -2722,7 +2786,7 @@ linedeftypes
|
|||
title = "Upwards Wind";
|
||||
prefix = "(542)";
|
||||
flags512text = "[9] Player slides";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
543
|
||||
|
@ -2730,7 +2794,7 @@ linedeftypes
|
|||
title = "Downwards Wind";
|
||||
prefix = "(543)";
|
||||
flags512text = "[9] Player slides";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
544
|
||||
|
@ -2738,7 +2802,7 @@ linedeftypes
|
|||
title = "Current";
|
||||
prefix = "(544)";
|
||||
flags512text = "[9] Player slides";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
545
|
||||
|
@ -2746,7 +2810,7 @@ linedeftypes
|
|||
title = "Upwards Current";
|
||||
prefix = "(545)";
|
||||
flags512text = "[9] Player slides";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
546
|
||||
|
@ -2754,13 +2818,14 @@ linedeftypes
|
|||
title = "Downwards Current";
|
||||
prefix = "(546)";
|
||||
flags512text = "[9] Player slides";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
547
|
||||
{
|
||||
title = "Push/Pull";
|
||||
prefix = "(547)";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3407,8 +3472,8 @@ thingtypes
|
|||
sprite = "ESHIA1";
|
||||
width = 16;
|
||||
height = 48;
|
||||
flags1text = "[1] 90 degrees counter-clockwise";
|
||||
flags4text = "[4] 90 degrees clockwise";
|
||||
flags1text = "[1] 90 degrees clockwise";
|
||||
flags4text = "[4] 90 degrees counter-clockwise";
|
||||
flags8text = "[8] Double speed";
|
||||
}
|
||||
115
|
||||
|
@ -3674,6 +3739,7 @@ thingtypes
|
|||
width = 8;
|
||||
height = 16;
|
||||
sprite = "internal:capsule";
|
||||
angletext = "Tag";
|
||||
}
|
||||
292
|
||||
{
|
||||
|
@ -3870,6 +3936,8 @@ thingtypes
|
|||
{
|
||||
title = "Emerald Hunt Location";
|
||||
sprite = "SHRDA0";
|
||||
flags8height = 24;
|
||||
flags8text = "[8] Float";
|
||||
}
|
||||
321
|
||||
{
|
||||
|
@ -3897,9 +3965,10 @@ thingtypes
|
|||
title = "Monitors";
|
||||
width = 18;
|
||||
height = 40;
|
||||
flags1text = "[1] Run Linedef Executor on pop";
|
||||
flags1text = "[1] Run linedef executor on pop";
|
||||
flags4text = "[4] Random (Strong)";
|
||||
flags8text = "[8] Random (Weak)";
|
||||
angletext = "Tag";
|
||||
|
||||
400
|
||||
{
|
||||
|
@ -4029,7 +4098,8 @@ thingtypes
|
|||
title = "Monitors (Respawning)";
|
||||
width = 20;
|
||||
height = 44;
|
||||
flags1text = "[1] Run Linedef Executor on pop";
|
||||
flags1text = "[1] Run linedef executor on pop";
|
||||
angletext = "Tag";
|
||||
|
||||
431
|
||||
{
|
||||
|
@ -4125,7 +4195,9 @@ thingtypes
|
|||
sprite = "STPTA0M0";
|
||||
width = 64;
|
||||
height = 128;
|
||||
flags4text = "[4] Respawn at center";
|
||||
angletext = "Angle/Order";
|
||||
parametertext = "Order";
|
||||
}
|
||||
520
|
||||
{
|
||||
|
@ -4152,6 +4224,7 @@ thingtypes
|
|||
sprite = "WSPKALAR";
|
||||
width = 16;
|
||||
height = 14;
|
||||
arrow = 1;
|
||||
flags1text = "[1] Start retracted";
|
||||
flags4text = "[4] Retractable";
|
||||
flags8text = "[8] Intangible";
|
||||
|
@ -4558,6 +4631,7 @@ thingtypes
|
|||
sprite = "TOADA0";
|
||||
width = 32;
|
||||
height = 16;
|
||||
angletext = "Tag";
|
||||
}
|
||||
757
|
||||
{
|
||||
|
@ -5832,7 +5906,7 @@ thingtypes
|
|||
sprite = "CAPSA0";
|
||||
width = 72;
|
||||
height = 144;
|
||||
angletext = "Rings";
|
||||
angletext = "Spheres";
|
||||
parametertext = "Mare";
|
||||
}
|
||||
}
|
||||
|
@ -6273,7 +6347,7 @@ thingtypes
|
|||
sprite = "PUMKA0";
|
||||
width = 16;
|
||||
height = 40;
|
||||
flags1text = "Don't flicker";
|
||||
flags1text = "[1] Don't flicker";
|
||||
}
|
||||
2007
|
||||
{
|
||||
|
@ -6281,7 +6355,7 @@ thingtypes
|
|||
sprite = "PUMKB0";
|
||||
width = 16;
|
||||
height = 40;
|
||||
flags1text = "Don't flicker";
|
||||
flags1text = "[1] Don't flicker";
|
||||
}
|
||||
2008
|
||||
{
|
||||
|
@ -6289,7 +6363,7 @@ thingtypes
|
|||
sprite = "PUMKC0";
|
||||
width = 16;
|
||||
height = 40;
|
||||
flags1text = "Don't flicker";
|
||||
flags1text = "[1] Don't flicker";
|
||||
}
|
||||
2009
|
||||
{
|
||||
|
|
|
@ -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");
|
||||
}
|
|
@ -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");
|
||||
}
|
|
@ -16,6 +16,7 @@ set(SRB2_CORE_SOURCES
|
|||
f_finale.c
|
||||
f_wipe.c
|
||||
filesrch.c
|
||||
g_demo.c
|
||||
g_game.c
|
||||
g_input.c
|
||||
hu_stuff.c
|
||||
|
@ -71,6 +72,7 @@ set(SRB2_CORE_HEADERS
|
|||
f_finale.h
|
||||
fastcmp.h
|
||||
filesrch.h
|
||||
g_demo.h
|
||||
g_game.h
|
||||
g_input.h
|
||||
g_state.h
|
||||
|
@ -120,6 +122,7 @@ set(SRB2_CORE_RENDER_SOURCES
|
|||
r_main.c
|
||||
r_plane.c
|
||||
r_segs.c
|
||||
r_skins.c
|
||||
r_sky.c
|
||||
r_splats.c
|
||||
r_things.c
|
||||
|
@ -134,6 +137,7 @@ set(SRB2_CORE_RENDER_SOURCES
|
|||
r_main.h
|
||||
r_plane.h
|
||||
r_segs.h
|
||||
r_skins.h
|
||||
r_sky.h
|
||||
r_splats.h
|
||||
r_state.h
|
||||
|
@ -214,8 +218,6 @@ source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES})
|
|||
|
||||
|
||||
### Configuration
|
||||
set(SRB2_CONFIG_HAVE_BLUA ON CACHE BOOL
|
||||
"Enable Lua interpreter support")
|
||||
set(SRB2_CONFIG_HAVE_PNG ON CACHE BOOL
|
||||
"Enable PNG support. Depends on zlib, so will be disabled if you don't enable that too.")
|
||||
set(SRB2_CONFIG_HAVE_ZLIB ON CACHE BOOL
|
||||
|
@ -239,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).")
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_BLUA})
|
||||
add_definitions(-DHAVE_BLUA)
|
||||
set(SRB2_LUA_SOURCES
|
||||
lua_baselib.c
|
||||
lua_blockmaplib.c
|
||||
|
@ -279,6 +279,7 @@ if(${SRB2_CONFIG_HAVE_BLUA})
|
|||
blua/lfunc.c
|
||||
blua/lgc.c
|
||||
blua/linit.c
|
||||
blua/liolib.c
|
||||
blua/llex.c
|
||||
blua/lmem.c
|
||||
blua/lobject.c
|
||||
|
@ -324,7 +325,6 @@ if(${SRB2_CONFIG_HAVE_BLUA})
|
|||
prepend_sources(SRB2_BLUA_HEADERS)
|
||||
|
||||
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_GME})
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
|
|
|
@ -340,9 +340,7 @@ CFLAGS+=-DHAVE_MINIUPNPC
|
|||
endif
|
||||
endif
|
||||
|
||||
ifndef NO_LUA
|
||||
include blua/Makefile.cfg
|
||||
endif
|
||||
|
||||
ifdef NOMD5
|
||||
OPTS+=-DNOMD5
|
||||
|
@ -424,6 +422,7 @@ OBJS:=$(i_main_o) \
|
|||
$(OBJDIR)/z_zone.o \
|
||||
$(OBJDIR)/f_finale.o \
|
||||
$(OBJDIR)/f_wipe.o \
|
||||
$(OBJDIR)/g_demo.o \
|
||||
$(OBJDIR)/g_game.o \
|
||||
$(OBJDIR)/g_input.o \
|
||||
$(OBJDIR)/am_map.o \
|
||||
|
@ -468,6 +467,7 @@ OBJS:=$(i_main_o) \
|
|||
$(OBJDIR)/r_main.o \
|
||||
$(OBJDIR)/r_plane.o \
|
||||
$(OBJDIR)/r_segs.o \
|
||||
$(OBJDIR)/r_skins.o \
|
||||
$(OBJDIR)/r_sky.o \
|
||||
$(OBJDIR)/r_splats.o \
|
||||
$(OBJDIR)/r_things.o \
|
||||
|
@ -682,9 +682,7 @@ $(OBJDIR)/depend.dep:
|
|||
ifndef NOHW
|
||||
$(CC) $(CFLAGS) -MM hardware/*.c >> $(OBJDIR)/depend.ped
|
||||
endif
|
||||
ifndef NO_LUA
|
||||
$(CC) $(CFLAGS) -MM blua/*.c >> $(OBJDIR)/depend.ped
|
||||
endif
|
||||
@sed -e 's,\(.*\)\.o: ,$(subst /,\/,$(OBJDIR))\/&,g' < $(OBJDIR)/depend.ped > $(OBJDIR)/depend.dep
|
||||
$(REMOVE) $(OBJDIR)/depend.ped
|
||||
@echo "Created dependency file, depend.dep"
|
||||
|
|
33
src/am_map.c
33
src/am_map.c
|
@ -920,10 +920,8 @@ static inline void AM_drawWalls(void)
|
|||
{
|
||||
size_t i;
|
||||
static mline_t l;
|
||||
#ifdef ESLOPE
|
||||
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
|
||||
fixed_t backf1 = 0, backf2 = 0, backc1 = 0, backc2 = 0; // back floor ceiling ends
|
||||
#endif
|
||||
|
||||
for (i = 0; i < numlines; i++)
|
||||
{
|
||||
|
@ -931,7 +929,7 @@ static inline void AM_drawWalls(void)
|
|||
l.a.y = lines[i].v1->y >> FRACTOMAPBITS;
|
||||
l.b.x = lines[i].v2->x >> FRACTOMAPBITS;
|
||||
l.b.y = lines[i].v2->y >> FRACTOMAPBITS;
|
||||
#ifdef ESLOPE
|
||||
|
||||
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||
if (slope) { \
|
||||
end1 = P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y); \
|
||||
|
@ -946,7 +944,6 @@ static inline void AM_drawWalls(void)
|
|||
SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
|
||||
}
|
||||
#undef SLOPEPARAMS
|
||||
#endif
|
||||
|
||||
if (!lines[i].backsector) // 1-sided
|
||||
{
|
||||
|
@ -955,19 +952,11 @@ static inline void AM_drawWalls(void)
|
|||
else
|
||||
AM_drawMline(&l, WALLCOLORS);
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|
||||
|| (frontf1 == frontc1 && frontf2 == frontc2)) // Front is thok barrier
|
||||
{
|
||||
if (backf1 == backc1 && backf2 == backc2
|
||||
&& frontf1 == frontc1 && frontf2 == frontc2) // BOTH are thok barriers
|
||||
#else
|
||||
else if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight // Back is thok barrier
|
||||
|| lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // Front is thok barrier
|
||||
{
|
||||
if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight
|
||||
&& lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // BOTH are thok barriers
|
||||
#endif
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB)
|
||||
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
|
||||
|
@ -985,20 +974,10 @@ static inline void AM_drawWalls(void)
|
|||
else
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB) {
|
||||
#ifdef ESLOPE
|
||||
if (backf1 != frontf1 || backf2 != frontf2) {
|
||||
#else
|
||||
if (lines[i].backsector->floorheight
|
||||
!= lines[i].frontsector->floorheight) {
|
||||
#endif
|
||||
AM_drawMline(&l, NOCLIMBFDWALLCOLORS); // floor level change
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
else if (backc1 != frontc1 || backc2 != frontc2) {
|
||||
#else
|
||||
else if (lines[i].backsector->ceilingheight
|
||||
!= lines[i].frontsector->ceilingheight) {
|
||||
#endif
|
||||
AM_drawMline(&l, NOCLIMBCDWALLCOLORS); // ceiling level change
|
||||
}
|
||||
else
|
||||
|
@ -1006,20 +985,10 @@ static inline void AM_drawWalls(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
if (backf1 != frontf1 || backf2 != frontf2) {
|
||||
#else
|
||||
if (lines[i].backsector->floorheight
|
||||
!= lines[i].frontsector->floorheight) {
|
||||
#endif
|
||||
AM_drawMline(&l, FDWALLCOLORS); // floor level change
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
else if (backc1 != frontc1 || backc2 != frontc2) {
|
||||
#else
|
||||
else if (lines[i].backsector->ceilingheight
|
||||
!= lines[i].frontsector->ceilingheight) {
|
||||
#endif
|
||||
AM_drawMline(&l, CDWALLCOLORS); // ceiling level change
|
||||
}
|
||||
else
|
||||
|
|
|
@ -19,10 +19,10 @@ boolean allow_fullscreen = false;
|
|||
consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
void I_StartupGraphics(void){}
|
||||
void I_StartupHardwareGraphics(void){}
|
||||
|
||||
void I_ShutdownGraphics(void){}
|
||||
|
||||
void VID_StartupOpenGL(void){}
|
||||
|
||||
void I_SetPalette(RGBA_t *palette)
|
||||
{
|
||||
(void)palette;
|
||||
|
@ -52,10 +52,8 @@ INT32 VID_SetMode(INT32 modenum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
// ..............
|
||||
}
|
||||
void VID_CheckRenderer(void) {}
|
||||
void VID_CheckGLLoaded(rendermode_t oldrender) {}
|
||||
|
||||
const char *VID_GetModeName(INT32 modenum)
|
||||
{
|
||||
|
|
19
src/b_bot.c
19
src/b_bot.c
|
@ -74,11 +74,9 @@ static void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
|
|||
if (!sonic || sonic->health <= 0)
|
||||
return;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// Lua can handle it!
|
||||
if (LUAh_BotAI(sonic, tails, cmd))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (tails->player->powers[pw_carry] == CR_MACESPIN || tails->player->powers[pw_carry] == CR_GENERIC)
|
||||
{
|
||||
|
@ -364,11 +362,9 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
|
|||
// Bot AI isn't programmed in analog.
|
||||
CV_SetValue(&cv_analog[1], false);
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// Let Lua scripts build ticcmds
|
||||
if (LUAh_BotTiccmd(player, cmd))
|
||||
return;
|
||||
#endif
|
||||
|
||||
// We don't have any main character AI, sorry. D:
|
||||
if (player-players == consoleplayer)
|
||||
|
@ -463,6 +459,21 @@ boolean B_CheckRespawn(player_t *player)
|
|||
if (!sonic || sonic->health <= 0)
|
||||
return false;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// B_RespawnBot doesn't do anything if the condition above this isn't met
|
||||
{
|
||||
UINT8 shouldForce = LUAh_BotRespawn(sonic, tails);
|
||||
|
||||
if (P_MobjWasRemoved(sonic) || P_MobjWasRemoved(tails))
|
||||
return (shouldForce == 1); // mobj was removed
|
||||
|
||||
if (shouldForce == 1)
|
||||
return true;
|
||||
else if (shouldForce == 2)
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check if Sonic is busy first.
|
||||
// If he's doing any of these things, he probably doesn't want to see us.
|
||||
if (sonic->player->pflags & (PF_GLIDING|PF_SLIDING|PF_BOUNCING)
|
||||
|
|
|
@ -10,14 +10,13 @@ WFLAGS+=-Wno-logical-op
|
|||
endif
|
||||
endif
|
||||
|
||||
OPTS+=-DHAVE_BLUA
|
||||
|
||||
OBJS:=$(OBJS) \
|
||||
$(OBJDIR)/lapi.o \
|
||||
$(OBJDIR)/lbaselib.o \
|
||||
$(OBJDIR)/ldo.o \
|
||||
$(OBJDIR)/lfunc.o \
|
||||
$(OBJDIR)/linit.o \
|
||||
$(OBJDIR)/liolib.o \
|
||||
$(OBJDIR)/llex.o \
|
||||
$(OBJDIR)/lmem.o \
|
||||
$(OBJDIR)/lobject.o \
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
static const luaL_Reg lualibs[] = {
|
||||
{"", luaopen_base},
|
||||
{LUA_TABLIBNAME, luaopen_table},
|
||||
{LUA_IOLIBNAME, luaopen_io},
|
||||
{LUA_STRLIBNAME, luaopen_string},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
|
635
src/blua/liolib.c
Normal file
635
src/blua/liolib.c
Normal file
|
@ -0,0 +1,635 @@
|
|||
/*
|
||||
** $Id: liolib.c,v 2.73.1.3 2008/01/18 17:47:43 roberto Exp $
|
||||
** Standard I/O (and system) library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define liolib_c
|
||||
#define LUA_LIB
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
#include "lauxlib.h"
|
||||
#include "lualib.h"
|
||||
#include "../i_system.h"
|
||||
#include "../g_game.h"
|
||||
#include "../d_netfil.h"
|
||||
#include "../lua_libs.h"
|
||||
#include "../byteptr.h"
|
||||
#include "../lua_script.h"
|
||||
#include "../m_misc.h"
|
||||
|
||||
|
||||
#define IO_INPUT 1
|
||||
#define IO_OUTPUT 2
|
||||
|
||||
#define FILELIMIT (1024 * 1024) // Size limit for reading/writing files
|
||||
|
||||
#define FMT_FILECALLBACKID "file_callback_%d"
|
||||
|
||||
|
||||
// Allow scripters to write files of these types to SRB2's folder
|
||||
static const char *whitelist[] = {
|
||||
".bmp",
|
||||
".cfg",
|
||||
".csv",
|
||||
".dat",
|
||||
".png",
|
||||
".sav2",
|
||||
".txt",
|
||||
};
|
||||
|
||||
|
||||
static int pushresult (lua_State *L, int i, const char *filename) {
|
||||
int en = errno; /* calls to Lua API may change this value */
|
||||
if (i) {
|
||||
lua_pushboolean(L, 1);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
lua_pushnil(L);
|
||||
if (filename)
|
||||
lua_pushfstring(L, "%s: %s", filename, strerror(en));
|
||||
else
|
||||
lua_pushfstring(L, "%s", strerror(en));
|
||||
lua_pushinteger(L, en);
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define tofilep(L) ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE))
|
||||
|
||||
|
||||
static int io_type (lua_State *L) {
|
||||
void *ud;
|
||||
luaL_checkany(L, 1);
|
||||
ud = lua_touserdata(L, 1);
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LUA_FILEHANDLE);
|
||||
if (ud == NULL || !lua_getmetatable(L, 1) || !lua_rawequal(L, -2, -1))
|
||||
lua_pushnil(L); /* not a file */
|
||||
else if (*((FILE **)ud) == NULL)
|
||||
lua_pushliteral(L, "closed file");
|
||||
else
|
||||
lua_pushliteral(L, "file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static FILE *tofile (lua_State *L) {
|
||||
FILE **f = tofilep(L);
|
||||
if (*f == NULL)
|
||||
luaL_error(L, "attempt to use a closed file");
|
||||
return *f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** When creating file handles, always creates a `closed' file handle
|
||||
** before opening the actual file; so, if there is a memory error, the
|
||||
** file is not left opened.
|
||||
*/
|
||||
static FILE **newfile (lua_State *L) {
|
||||
FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *));
|
||||
*pf = NULL; /* file handle is currently `closed' */
|
||||
luaL_getmetatable(L, LUA_FILEHANDLE);
|
||||
lua_setmetatable(L, -2);
|
||||
return pf;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** function to (not) close the standard files stdin, stdout, and stderr
|
||||
*/
|
||||
static int io_noclose (lua_State *L) {
|
||||
lua_pushnil(L);
|
||||
lua_pushliteral(L, "cannot close standard file");
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** function to close regular files
|
||||
*/
|
||||
static int io_fclose (lua_State *L) {
|
||||
FILE **p = tofilep(L);
|
||||
int ok = (fclose(*p) == 0);
|
||||
*p = NULL;
|
||||
return pushresult(L, ok, NULL);
|
||||
}
|
||||
|
||||
|
||||
static int aux_close (lua_State *L) {
|
||||
lua_getfenv(L, 1);
|
||||
lua_getfield(L, -1, "__close");
|
||||
return (lua_tocfunction(L, -1))(L);
|
||||
}
|
||||
|
||||
|
||||
static int io_close (lua_State *L) {
|
||||
if (lua_isnone(L, 1))
|
||||
lua_rawgeti(L, LUA_ENVIRONINDEX, IO_OUTPUT);
|
||||
tofile(L); /* make sure argument is a file */
|
||||
return aux_close(L);
|
||||
}
|
||||
|
||||
|
||||
static int io_gc (lua_State *L) {
|
||||
FILE *f = *tofilep(L);
|
||||
/* ignore closed files */
|
||||
if (f != NULL)
|
||||
aux_close(L);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int io_tostring (lua_State *L) {
|
||||
FILE *f = *tofilep(L);
|
||||
if (f == NULL)
|
||||
lua_pushliteral(L, "file (closed)");
|
||||
else
|
||||
lua_pushfstring(L, "file (%p)", f);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Create directories in the path
|
||||
void MakePathDirs(char *path)
|
||||
{
|
||||
char *c;
|
||||
|
||||
for (c = path; *c; c++)
|
||||
if (*c == '/' || *c == '\\')
|
||||
{
|
||||
char sep = *c;
|
||||
*c = '\0';
|
||||
I_mkdir(path, 0755);
|
||||
*c = sep;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int CheckFileName(lua_State *L, const char *filename)
|
||||
{
|
||||
int length = strlen(filename);
|
||||
boolean pass = false;
|
||||
size_t i;
|
||||
|
||||
if (strchr(filename, '\\'))
|
||||
{
|
||||
luaL_error(L, "access denied to %s: \\ is not allowed, use / instead", filename);
|
||||
return pushresult(L,0,filename);
|
||||
}
|
||||
|
||||
for (i = 0; i < (sizeof (whitelist) / sizeof(const char *)); i++)
|
||||
if (!stricmp(&filename[length - strlen(whitelist[i])], whitelist[i]))
|
||||
{
|
||||
pass = true;
|
||||
break;
|
||||
}
|
||||
if (strstr(filename, "./")
|
||||
|| strstr(filename, "..") || strchr(filename, ':')
|
||||
|| filename[0] == '/'
|
||||
|| !pass)
|
||||
{
|
||||
luaL_error(L, "access denied to %s", filename);
|
||||
return pushresult(L,0,filename);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int io_open (lua_State *L) {
|
||||
const char *filename = luaL_checkstring(L, 1);
|
||||
const char *mode = luaL_optstring(L, 2, "r");
|
||||
int checkresult;
|
||||
|
||||
checkresult = CheckFileName(L, filename);
|
||||
if (checkresult)
|
||||
return checkresult;
|
||||
|
||||
luaL_checktype(L, 3, LUA_TFUNCTION);
|
||||
|
||||
if (!(strchr(mode, 'r') || strchr(mode, '+')))
|
||||
luaL_error(L, "open() is only for reading, use openlocal() for writing");
|
||||
|
||||
AddLuaFileTransfer(filename, mode);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int io_openlocal (lua_State *L) {
|
||||
FILE **pf;
|
||||
const char *filename = luaL_checkstring(L, 1);
|
||||
const char *mode = luaL_optstring(L, 2, "r");
|
||||
char *realfilename;
|
||||
luafiletransfer_t *filetransfer;
|
||||
int checkresult;
|
||||
|
||||
checkresult = CheckFileName(L, filename);
|
||||
if (checkresult)
|
||||
return checkresult;
|
||||
|
||||
realfilename = va("%s" PATHSEP "%s", luafiledir, filename);
|
||||
|
||||
if (client && strnicmp(filename, "client/", strlen("client/")))
|
||||
I_Error("Access denied to %s\n"
|
||||
"Clients can only access files stored in luafiles/client/\n",
|
||||
filename);
|
||||
|
||||
// Prevent access if the file is being downloaded
|
||||
for (filetransfer = luafiletransfers; filetransfer; filetransfer = filetransfer->next)
|
||||
if (!stricmp(filetransfer->filename, filename))
|
||||
I_Error("Access denied to %s\n"
|
||||
"Files can't be opened while being downloaded\n",
|
||||
filename);
|
||||
|
||||
MakePathDirs(realfilename);
|
||||
|
||||
// Open and return the file
|
||||
pf = newfile(L);
|
||||
*pf = fopen(realfilename, mode);
|
||||
return (*pf == NULL) ? pushresult(L, 0, filename) : 1;
|
||||
}
|
||||
|
||||
|
||||
void Got_LuaFile(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
FILE **pf = NULL;
|
||||
UINT8 success = READUINT8(*cp); // The first (and only) byte indicates whether the file could be opened
|
||||
|
||||
if (playernum != serverplayer)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal luafile command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
SendKick(playernum, KICK_MSG_CON_FAIL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!luafiletransfers)
|
||||
I_Error("No Lua file transfer\n");
|
||||
|
||||
// Retrieve the callback and push it on the stack
|
||||
lua_pushfstring(gL, FMT_FILECALLBACKID, luafiletransfers->id);
|
||||
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||
|
||||
// Push the first argument (file handle or nil) on the stack
|
||||
if (success)
|
||||
{
|
||||
pf = newfile(gL); // Create and push the file handle
|
||||
*pf = fopen(luafiletransfers->realfilename, luafiletransfers->mode); // Open the file
|
||||
if (!*pf)
|
||||
I_Error("Can't open file \"%s\"\n", luafiletransfers->realfilename); // The file SHOULD exist
|
||||
}
|
||||
else
|
||||
lua_pushnil(gL);
|
||||
|
||||
// Push the second argument (file name) on the stack
|
||||
lua_pushstring(gL, luafiletransfers->filename);
|
||||
|
||||
// Call the callback
|
||||
LUA_Call(gL, 2);
|
||||
|
||||
if (success)
|
||||
{
|
||||
// Close the file
|
||||
if (*pf)
|
||||
{
|
||||
fclose(*pf);
|
||||
*pf = NULL;
|
||||
}
|
||||
|
||||
if (client)
|
||||
remove(luafiletransfers->realfilename);
|
||||
}
|
||||
|
||||
RemoveLuaFileTransfer();
|
||||
|
||||
if (server && luafiletransfers)
|
||||
{
|
||||
if (FIL_FileOK(luafiletransfers->realfilename))
|
||||
SV_PrepareSendLuaFileToNextNode();
|
||||
else
|
||||
{
|
||||
// Send a net command with 0 as its first byte to indicate the file couldn't be opened
|
||||
success = 0;
|
||||
SendNetXCmd(XD_LUAFILE, &success, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void StoreLuaFileCallback(INT32 id)
|
||||
{
|
||||
lua_pushfstring(gL, FMT_FILECALLBACKID, id);
|
||||
lua_pushvalue(gL, 3); // Parameter 3 is the callback
|
||||
lua_settable(gL, LUA_REGISTRYINDEX); // registry[callbackid] = callback
|
||||
}
|
||||
|
||||
|
||||
void RemoveLuaFileCallback(INT32 id)
|
||||
{
|
||||
lua_pushfstring(gL, FMT_FILECALLBACKID, id);
|
||||
lua_pushnil(gL);
|
||||
lua_settable(gL, LUA_REGISTRYINDEX); // registry[callbackid] = nil
|
||||
}
|
||||
|
||||
|
||||
static int io_tmpfile (lua_State *L) {
|
||||
FILE **pf = newfile(L);
|
||||
*pf = tmpfile();
|
||||
return (*pf == NULL) ? pushresult(L, 0, NULL) : 1;
|
||||
}
|
||||
|
||||
|
||||
static int io_readline (lua_State *L);
|
||||
|
||||
|
||||
static void aux_lines (lua_State *L, int idx, int toclose) {
|
||||
lua_pushvalue(L, idx);
|
||||
lua_pushboolean(L, toclose); /* close/not close file when finished */
|
||||
lua_pushcclosure(L, io_readline, 2);
|
||||
}
|
||||
|
||||
|
||||
static int f_lines (lua_State *L) {
|
||||
tofile(L); /* check that it's a valid file handle */
|
||||
aux_lines(L, 1, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
** READ
|
||||
** =======================================================
|
||||
*/
|
||||
|
||||
|
||||
static int read_number (lua_State *L, FILE *f) {
|
||||
lua_Number d;
|
||||
if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) {
|
||||
lua_pushnumber(L, d);
|
||||
return 1;
|
||||
}
|
||||
else return 0; /* read fails */
|
||||
}
|
||||
|
||||
|
||||
static int test_eof (lua_State *L, FILE *f) {
|
||||
int c = getc(f);
|
||||
ungetc(c, f);
|
||||
lua_pushlstring(L, NULL, 0);
|
||||
return (c != EOF);
|
||||
}
|
||||
|
||||
|
||||
static int read_line (lua_State *L, FILE *f) {
|
||||
luaL_Buffer b;
|
||||
luaL_buffinit(L, &b);
|
||||
for (;;) {
|
||||
size_t l;
|
||||
char *p = luaL_prepbuffer(&b);
|
||||
if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) { /* eof? */
|
||||
luaL_pushresult(&b); /* close buffer */
|
||||
return (lua_objlen(L, -1) > 0); /* check whether read something */
|
||||
}
|
||||
l = strlen(p);
|
||||
if (l == 0 || p[l-1] != '\n')
|
||||
luaL_addsize(&b, l);
|
||||
else {
|
||||
luaL_addsize(&b, l - 1); /* do not include `eol' */
|
||||
luaL_pushresult(&b); /* close buffer */
|
||||
return 1; /* read at least an `eol' */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int read_chars (lua_State *L, FILE *f, size_t n) {
|
||||
size_t rlen; /* how much to read */
|
||||
size_t nr; /* number of chars actually read */
|
||||
luaL_Buffer b;
|
||||
luaL_buffinit(L, &b);
|
||||
rlen = LUAL_BUFFERSIZE; /* try to read that much each time */
|
||||
do {
|
||||
char *p = luaL_prepbuffer(&b);
|
||||
if (rlen > n) rlen = n; /* cannot read more than asked */
|
||||
nr = fread(p, sizeof(char), rlen, f);
|
||||
luaL_addsize(&b, nr);
|
||||
n -= nr; /* still have to read `n' chars */
|
||||
} while (n > 0 && nr == rlen); /* until end of count or eof */
|
||||
luaL_pushresult(&b); /* close buffer */
|
||||
return (n == 0 || lua_objlen(L, -1) > 0);
|
||||
}
|
||||
|
||||
|
||||
static int g_read (lua_State *L, FILE *f, int first) {
|
||||
int nargs = lua_gettop(L) - 1;
|
||||
int success;
|
||||
int n;
|
||||
clearerr(f);
|
||||
if (nargs == 0) { /* no arguments? */
|
||||
success = read_line(L, f);
|
||||
n = first+1; /* to return 1 result */
|
||||
}
|
||||
else { /* ensure stack space for all results and for auxlib's buffer */
|
||||
luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments");
|
||||
success = 1;
|
||||
for (n = first; nargs-- && success; n++) {
|
||||
if (lua_type(L, n) == LUA_TNUMBER) {
|
||||
size_t l = (size_t)lua_tointeger(L, n);
|
||||
success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l);
|
||||
}
|
||||
else {
|
||||
const char *p = lua_tostring(L, n);
|
||||
luaL_argcheck(L, p && p[0] == '*', n, "invalid option");
|
||||
switch (p[1]) {
|
||||
case 'n': /* number */
|
||||
success = read_number(L, f);
|
||||
break;
|
||||
case 'l': /* line */
|
||||
success = read_line(L, f);
|
||||
break;
|
||||
case 'a': /* file */
|
||||
read_chars(L, f, ~((size_t)0)); /* read MAX_SIZE_T chars */
|
||||
success = 1; /* always success */
|
||||
break;
|
||||
default:
|
||||
return luaL_argerror(L, n, "invalid format");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ferror(f))
|
||||
return pushresult(L, 0, NULL);
|
||||
if (!success) {
|
||||
lua_pop(L, 1); /* remove last result */
|
||||
lua_pushnil(L); /* push nil instead */
|
||||
}
|
||||
return n - first;
|
||||
}
|
||||
|
||||
|
||||
static int f_read (lua_State *L) {
|
||||
return g_read(L, tofile(L), 2);
|
||||
}
|
||||
|
||||
|
||||
static int io_readline (lua_State *L) {
|
||||
FILE *f = *(FILE **)lua_touserdata(L, lua_upvalueindex(1));
|
||||
int sucess;
|
||||
if (f == NULL) /* file is already closed? */
|
||||
luaL_error(L, "file is already closed");
|
||||
sucess = read_line(L, f);
|
||||
if (ferror(f))
|
||||
return luaL_error(L, "%s", strerror(errno));
|
||||
if (sucess) return 1;
|
||||
else { /* EOF */
|
||||
if (lua_toboolean(L, lua_upvalueindex(2))) { /* generator created file? */
|
||||
lua_settop(L, 0);
|
||||
lua_pushvalue(L, lua_upvalueindex(1));
|
||||
aux_close(L); /* close it */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
|
||||
static int g_write (lua_State *L, FILE *f, int arg) {
|
||||
int nargs = lua_gettop(L) - 1;
|
||||
int status = 1;
|
||||
for (; nargs--; arg++) {
|
||||
if (lua_type(L, arg) == LUA_TNUMBER) {
|
||||
/* optimization: could be done exactly as for strings */
|
||||
status = status &&
|
||||
fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0;
|
||||
}
|
||||
else {
|
||||
size_t l;
|
||||
const char *s = luaL_checklstring(L, arg, &l);
|
||||
if (ftell(f) + l > FILELIMIT) {
|
||||
luaL_error(L,"write limit bypassed in file. Changes have been discarded.");
|
||||
break;
|
||||
}
|
||||
status = status && (fwrite(s, sizeof(char), l, f) == l);
|
||||
}
|
||||
}
|
||||
return pushresult(L, status, NULL);
|
||||
}
|
||||
|
||||
|
||||
static int f_write (lua_State *L) {
|
||||
return g_write(L, tofile(L), 2);
|
||||
}
|
||||
|
||||
|
||||
static int f_seek (lua_State *L) {
|
||||
static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END};
|
||||
static const char *const modenames[] = {"set", "cur", "end", NULL};
|
||||
FILE *f = tofile(L);
|
||||
int op = luaL_checkoption(L, 2, "cur", modenames);
|
||||
long offset = luaL_optlong(L, 3, 0);
|
||||
op = fseek(f, offset, mode[op]);
|
||||
if (op)
|
||||
return pushresult(L, 0, NULL); /* error */
|
||||
else {
|
||||
lua_pushinteger(L, ftell(f));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int f_setvbuf (lua_State *L) {
|
||||
static const int mode[] = {_IONBF, _IOFBF, _IOLBF};
|
||||
static const char *const modenames[] = {"no", "full", "line", NULL};
|
||||
FILE *f = tofile(L);
|
||||
int op = luaL_checkoption(L, 2, NULL, modenames);
|
||||
lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE);
|
||||
int res = setvbuf(f, NULL, mode[op], sz);
|
||||
return pushresult(L, res == 0, NULL);
|
||||
}
|
||||
|
||||
|
||||
static int f_flush (lua_State *L) {
|
||||
return pushresult(L, fflush(tofile(L)) == 0, NULL);
|
||||
}
|
||||
|
||||
|
||||
static const luaL_Reg iolib[] = {
|
||||
{"close", io_close},
|
||||
{"open", io_open},
|
||||
{"openlocal", io_openlocal},
|
||||
{"tmpfile", io_tmpfile},
|
||||
{"type", io_type},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
static const luaL_Reg flib[] = {
|
||||
{"close", io_close},
|
||||
{"flush", f_flush},
|
||||
{"lines", f_lines},
|
||||
{"read", f_read},
|
||||
{"seek", f_seek},
|
||||
{"setvbuf", f_setvbuf},
|
||||
{"write", f_write},
|
||||
{"__gc", io_gc},
|
||||
{"__tostring", io_tostring},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
static void createmeta (lua_State *L) {
|
||||
luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */
|
||||
lua_pushvalue(L, -1); /* push metatable */
|
||||
lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */
|
||||
luaL_register(L, NULL, flib); /* file methods */
|
||||
}
|
||||
|
||||
|
||||
static void createstdfile (lua_State *L, FILE *f, int k, const char *fname) {
|
||||
*newfile(L) = f;
|
||||
if (k > 0) {
|
||||
lua_pushvalue(L, -1);
|
||||
lua_rawseti(L, LUA_ENVIRONINDEX, k);
|
||||
}
|
||||
lua_pushvalue(L, -2); /* copy environment */
|
||||
lua_setfenv(L, -2); /* set it */
|
||||
lua_setfield(L, -3, fname);
|
||||
}
|
||||
|
||||
|
||||
static void newfenv (lua_State *L, lua_CFunction cls) {
|
||||
lua_createtable(L, 0, 1);
|
||||
lua_pushcfunction(L, cls);
|
||||
lua_setfield(L, -2, "__close");
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API int luaopen_io (lua_State *L) {
|
||||
createmeta(L);
|
||||
/* create (private) environment (with fields IO_INPUT, IO_OUTPUT, __close) */
|
||||
newfenv(L, io_fclose);
|
||||
lua_replace(L, LUA_ENVIRONINDEX);
|
||||
/* open library */
|
||||
luaL_register(L, LUA_IOLIBNAME, iolib);
|
||||
/* create (and set) default files */
|
||||
newfenv(L, io_noclose); /* close function for default files */
|
||||
createstdfile(L, stdin, IO_INPUT, "stdin");
|
||||
createstdfile(L, stdout, IO_OUTPUT, "stdout");
|
||||
createstdfile(L, stderr, 0, "stderr");
|
||||
lua_pop(L, 1); /* pop environment for default files */
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -21,6 +21,9 @@ LUALIB_API int (luaopen_base) (lua_State *L);
|
|||
#define LUA_TABLIBNAME "table"
|
||||
LUALIB_API int (luaopen_table) (lua_State *L);
|
||||
|
||||
#define LUA_IOLIBNAME "io"
|
||||
LUALIB_API int (luaopen_io) (lua_State *L);
|
||||
|
||||
#define LUA_STRLIBNAME "string"
|
||||
LUALIB_API int (luaopen_string) (lua_State *L);
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ static boolean joyaxis2_default = false;
|
|||
static INT32 joyaxis_count = 0;
|
||||
static INT32 joyaxis2_count = 0;
|
||||
|
||||
#define COM_BUF_SIZE 8192 // command buffer size
|
||||
#define COM_BUF_SIZE (32<<10) // command buffer size
|
||||
#define MAX_ALIAS_RECURSION 100 // max recursion allowed for aliases
|
||||
|
||||
static INT32 com_wait; // one command per frame (for cmd sequences)
|
||||
|
@ -481,13 +481,11 @@ void COM_AddCommand(const char *name, com_func_t func)
|
|||
{
|
||||
if (!stricmp(name, cmd->name)) //case insensitive now that we have lower and uppercase!
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
// don't I_Error for Lua commands
|
||||
// Lua commands can replace game commands, and they have priority.
|
||||
// BUT, if for some reason we screwed up and made two console commands with the same name,
|
||||
// it's good to have this here so we find out.
|
||||
if (cmd->function != COM_Lua_f)
|
||||
#endif
|
||||
I_Error("Command %s already exists\n", name);
|
||||
|
||||
return;
|
||||
|
@ -501,7 +499,6 @@ void COM_AddCommand(const char *name, com_func_t func)
|
|||
com_commands = cmd;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
/** Adds a console command for Lua.
|
||||
* No I_Errors allowed; return a negative code instead.
|
||||
*
|
||||
|
@ -534,7 +531,6 @@ int COM_AddLuaCommand(const char *name)
|
|||
com_commands = cmd;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Tests if a command exists.
|
||||
*
|
||||
|
@ -1427,9 +1423,7 @@ finish:
|
|||
}
|
||||
var->flags |= CV_MODIFIED;
|
||||
// raise 'on change' code
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_CVarChanged(var->name); // let consolelib know what cvar this is.
|
||||
#endif
|
||||
if (var->flags & CV_CALL && !stealth)
|
||||
var->func();
|
||||
|
||||
|
|
|
@ -28,12 +28,13 @@
|
|||
/* Manually defined asset hashes for non-CMake builds
|
||||
* Last updated 2020 / 02 / 15 - v2.2.1 - main assets
|
||||
* Last updated 2020 / 02 / 22 - v2.2.2 - patch.pk3
|
||||
* Last updated 2020 / 05 / 10 - v2.2.3 - player.dta & patch.pk3
|
||||
*/
|
||||
#define ASSET_HASH_SRB2_PK3 "0277c9416756627004e83cbb5b2e3e28"
|
||||
#define ASSET_HASH_ZONES_PK3 "f7e88afb6af7996a834c7d663144bead"
|
||||
#define ASSET_HASH_PLAYER_DTA "ad49e07b17cc662f1ad70c454910b4ae"
|
||||
#define ASSET_HASH_PLAYER_DTA "8a4507ddf9bc0682c09174400f26ad65"
|
||||
#ifdef USE_PATCH_DTA
|
||||
#define ASSET_HASH_PATCH_PK3 "ee54330ecb743314c5f962af4db731ff"
|
||||
#define ASSET_HASH_PATCH_PK3 "d56064ff33a0a4a17d38512cbcb5613d"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -97,6 +97,7 @@ static void CON_InputInit(void);
|
|||
static void CON_RecalcSize(void);
|
||||
static void CON_ChangeHeight(void);
|
||||
|
||||
static void CON_DrawBackpic(void);
|
||||
static void CONS_hudlines_Change(void);
|
||||
static void CONS_backcolor_Change(void);
|
||||
|
||||
|
@ -613,15 +614,6 @@ void CON_Ticker(void)
|
|||
con_tick++;
|
||||
con_tick &= 7;
|
||||
|
||||
// if the menu is open then close the console.
|
||||
if (menuactive && con_destlines)
|
||||
{
|
||||
consoletoggle = false;
|
||||
con_destlines = 0;
|
||||
CON_ClearHUD();
|
||||
I_UpdateMouseGrab();
|
||||
}
|
||||
|
||||
// console key was pushed
|
||||
if (consoletoggle)
|
||||
{
|
||||
|
@ -793,7 +785,7 @@ boolean CON_Responder(event_t *ev)
|
|||
// check other keys only if console prompt is active
|
||||
if (!consoleready && key < NUMINPUTS) // metzgermeister: boundary check!!
|
||||
{
|
||||
if (bindtable[key])
|
||||
if (! menuactive && bindtable[key])
|
||||
{
|
||||
COM_BufAddText(bindtable[key]);
|
||||
COM_BufAddText("\n");
|
||||
|
@ -1539,6 +1531,51 @@ static void CON_DrawHudlines(void)
|
|||
con_clearlines = y; // this is handled by HU_Erase();
|
||||
}
|
||||
|
||||
// Lactozilla: Draws the console's background picture.
|
||||
static void CON_DrawBackpic(void)
|
||||
{
|
||||
patch_t *con_backpic;
|
||||
lumpnum_t piclump;
|
||||
int x, w, h;
|
||||
|
||||
// Get the lumpnum for CONSBACK, or fallback into MISSING.
|
||||
piclump = W_CheckNumForName("CONSBACK");
|
||||
if (piclump == LUMPERROR)
|
||||
piclump = W_GetNumForName("MISSING");
|
||||
|
||||
// Cache the Software patch.
|
||||
con_backpic = W_CacheSoftwarePatchNum(piclump, PU_PATCH);
|
||||
|
||||
// Center the backpic, and draw a vertically cropped patch.
|
||||
w = (con_backpic->width * vid.dupx);
|
||||
x = (vid.width / 2) - (w / 2);
|
||||
h = con_curlines/vid.dupy;
|
||||
|
||||
// If the patch doesn't fill the entire screen,
|
||||
// then fill the sides with a solid color.
|
||||
if (x > 0)
|
||||
{
|
||||
column_t *column = (column_t *)((UINT8 *)(con_backpic) + LONG(con_backpic->columnofs[0]));
|
||||
if (!column->topdelta)
|
||||
{
|
||||
UINT8 *source = (UINT8 *)(column) + 3;
|
||||
INT32 color = (source[0] | V_NOSCALESTART);
|
||||
// left side
|
||||
V_DrawFill(0, 0, x, con_curlines, color);
|
||||
// right side
|
||||
V_DrawFill((x + w), 0, (vid.width - w), con_curlines, color);
|
||||
}
|
||||
}
|
||||
|
||||
// Cache the patch normally.
|
||||
con_backpic = W_CachePatchNum(piclump, PU_PATCH);
|
||||
V_DrawCroppedPatch(x << FRACBITS, 0, FRACUNIT, V_NOSCALESTART, con_backpic,
|
||||
0, ( BASEVIDHEIGHT - h ), BASEVIDWIDTH, h);
|
||||
|
||||
// Unlock the cached patch.
|
||||
W_UnlockCachedPatch(con_backpic);
|
||||
}
|
||||
|
||||
// draw the console background, text, and prompt if enough place
|
||||
//
|
||||
static void CON_DrawConsole(void)
|
||||
|
@ -1560,19 +1597,7 @@ static void CON_DrawConsole(void)
|
|||
|
||||
// draw console background
|
||||
if (cons_backpic.value || con_forcepic)
|
||||
{
|
||||
patch_t *con_backpic = W_CachePatchName("CONSBACK", PU_PATCH);
|
||||
int h;
|
||||
|
||||
h = con_curlines/vid.dupy;
|
||||
|
||||
// Jimita: CON_DrawBackpic just called V_DrawScaledPatch
|
||||
//V_DrawScaledPatch(0, 0, 0, con_backpic);
|
||||
V_DrawCroppedPatch(0, 0, FRACUNIT, 0, con_backpic,
|
||||
0, ( BASEVIDHEIGHT - h ), BASEVIDWIDTH, h);
|
||||
|
||||
W_UnlockCachedPatch(con_backpic);
|
||||
}
|
||||
CON_DrawBackpic();
|
||||
else
|
||||
{
|
||||
// inu: no more width (was always 0 and vid.width)
|
||||
|
|
163
src/d_clisrv.c
163
src/d_clisrv.c
|
@ -85,6 +85,10 @@ tic_t jointimeout = (10*TICRATE);
|
|||
static boolean sendingsavegame[MAXNETNODES]; // Are we sending the savegame?
|
||||
static tic_t freezetimeout[MAXNETNODES]; // Until when can this node freeze the server before getting a timeout?
|
||||
|
||||
// Incremented by cv_joindelay when a client joins, decremented each tic.
|
||||
// If higher than cv_joindelay * 2 (3 joins in a short timespan), joins are temporarily disabled.
|
||||
static tic_t joindelay = 0;
|
||||
|
||||
UINT16 pingmeasurecount = 1;
|
||||
UINT32 realpingtable[MAXPLAYERS]; //the base table of ping where an average will be sent to everyone.
|
||||
UINT32 playerpingtable[MAXPLAYERS]; //table of player latency values.
|
||||
|
@ -1289,6 +1293,37 @@ static boolean CL_SendJoin(void)
|
|||
return HSendPacket(servernode, true, 0, sizeof (clientconfig_pak));
|
||||
}
|
||||
|
||||
static INT32 FindRejoinerNum(SINT8 node)
|
||||
{
|
||||
char strippednodeaddress[64];
|
||||
const char *nodeaddress;
|
||||
char *port;
|
||||
INT32 i;
|
||||
|
||||
// Make sure there is no dead dress before proceeding to the stripping
|
||||
if (!I_GetNodeAddress)
|
||||
return -1;
|
||||
nodeaddress = I_GetNodeAddress(node);
|
||||
if (!nodeaddress)
|
||||
return -1;
|
||||
|
||||
// Strip the address of its port
|
||||
strcpy(strippednodeaddress, nodeaddress);
|
||||
port = strchr(strippednodeaddress, ':');
|
||||
if (port)
|
||||
*port = '\0';
|
||||
|
||||
// Check if any player matches the stripped address
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && playeraddress[i][0] && playernode[i] == UINT8_MAX
|
||||
&& !strcmp(playeraddress[i], strippednodeaddress))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
||||
{
|
||||
UINT8 *p;
|
||||
|
@ -1306,6 +1341,16 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
|||
|
||||
netbuffer->u.serverinfo.numberofplayer = (UINT8)D_NumPlayers();
|
||||
netbuffer->u.serverinfo.maxplayer = (UINT8)cv_maxplayers.value;
|
||||
|
||||
if (!node || FindRejoinerNum(node) != -1)
|
||||
netbuffer->u.serverinfo.refusereason = 0;
|
||||
else if (!cv_allownewplayer.value)
|
||||
netbuffer->u.serverinfo.refusereason = 1;
|
||||
else if (D_NumPlayers() >= cv_maxplayers.value)
|
||||
netbuffer->u.serverinfo.refusereason = 2;
|
||||
else
|
||||
netbuffer->u.serverinfo.refusereason = 0;
|
||||
|
||||
strncpy(netbuffer->u.serverinfo.gametypename, Gametype_Names[gametype],
|
||||
sizeof netbuffer->u.serverinfo.gametypename);
|
||||
netbuffer->u.serverinfo.modifiedgame = (UINT8)modifiedgame;
|
||||
|
@ -1863,12 +1908,17 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent)
|
|||
}
|
||||
|
||||
// Quit here rather than downloading files and being refused later.
|
||||
if (serverlist[i].info.numberofplayer >= serverlist[i].info.maxplayer)
|
||||
if (serverlist[i].info.refusereason)
|
||||
{
|
||||
D_QuitNetGame();
|
||||
CL_Reset();
|
||||
D_StartTitle();
|
||||
if (serverlist[i].info.refusereason == 1)
|
||||
M_StartMessage(M_GetText("The server is not accepting\njoins for the moment.\n\nPress ESC\n"), NULL, MM_NOTHING);
|
||||
else if (serverlist[i].info.refusereason == 2)
|
||||
M_StartMessage(va(M_GetText("Maximum players reached: %d\n\nPress ESC\n"), serverlist[i].info.maxplayer), NULL, MM_NOTHING);
|
||||
else
|
||||
M_StartMessage(M_GetText("You can't join.\nI don't know why,\nbut you can't join.\n\nPress ESC\n"), NULL, MM_NOTHING);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2439,14 +2489,14 @@ static void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
|
|||
if (!playeringame[playernum])
|
||||
return;
|
||||
|
||||
if (server && !demoplayback)
|
||||
if (server && !demoplayback && playernode[playernum] != UINT8_MAX)
|
||||
{
|
||||
INT32 node = playernode[playernum];
|
||||
playerpernode[node]--;
|
||||
if (playerpernode[node] <= 0)
|
||||
{
|
||||
nodeingame[playernode[playernum]] = false;
|
||||
Net_CloseConnection(playernode[playernum]);
|
||||
nodeingame[node] = false;
|
||||
Net_CloseConnection(node);
|
||||
ResetNode(node);
|
||||
}
|
||||
}
|
||||
|
@ -2501,20 +2551,14 @@ static void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUAh_PlayerQuit(&players[playernum], reason); // Lua hook for player quitting
|
||||
#else
|
||||
(void)reason;
|
||||
#endif
|
||||
|
||||
// don't look through someone's view who isn't there
|
||||
if (playernum == displayplayer)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
// Call ViewpointSwitch hooks here.
|
||||
// The viewpoint was forcibly changed.
|
||||
LUAh_ViewpointSwitch(&players[consoleplayer], &players[displayplayer], true);
|
||||
#endif
|
||||
LUAh_ViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true);
|
||||
displayplayer = consoleplayer;
|
||||
}
|
||||
|
||||
|
@ -2535,9 +2579,7 @@ static void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
|
|||
RemoveAdminPlayer(playernum); // don't stay admin after you're gone
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_InvalidatePlayer(&players[playernum]);
|
||||
#endif
|
||||
|
||||
if (G_TagGametype()) //Check if you still have a game. Location flexible. =P
|
||||
P_CheckSurvivors();
|
||||
|
@ -2792,17 +2834,14 @@ static void Command_Kick(void)
|
|||
if (pn == -1 || pn == 0)
|
||||
return;
|
||||
|
||||
if (server)
|
||||
{
|
||||
// Special case if we are trying to kick a player who is downloading the game state:
|
||||
// trigger a timeout instead of kicking them, because a kick would only
|
||||
// take effect after they have finished downloading
|
||||
if (sendingsavegame[playernode[pn]])
|
||||
if (server && playernode[pn] != UINT8_MAX && sendingsavegame[playernode[pn]])
|
||||
{
|
||||
Net_ConnectionTimeout(playernode[pn]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
WRITESINT8(p, pn);
|
||||
|
||||
|
@ -2859,7 +2898,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
|||
|
||||
// Is playernum authorized to make this kick?
|
||||
if (playernum != serverplayer && !IsPlayerAdmin(playernum)
|
||||
&& !(playerpernode[playernode[playernum]] == 2
|
||||
&& !(playernode[playernum] != UINT8_MAX && playerpernode[playernode[playernum]] == 2
|
||||
&& nodetoplayer2[playernode[playernum]] == pnum))
|
||||
{
|
||||
// We received a kick command from someone who isn't the
|
||||
|
@ -3018,7 +3057,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
|||
}
|
||||
else if (keepbody)
|
||||
{
|
||||
if (server && !demoplayback)
|
||||
if (server && !demoplayback && playernode[pnum] != UINT8_MAX)
|
||||
{
|
||||
INT32 node = playernode[pnum];
|
||||
playerpernode[node]--;
|
||||
|
@ -3042,6 +3081,8 @@ consvar_t cv_allownewplayer = {"allowjoin", "On", CV_NETVAR, CV_OnOff, NULL, 0,
|
|||
consvar_t cv_joinnextround = {"joinnextround", "Off", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; /// \todo not done
|
||||
static CV_PossibleValue_t maxplayers_cons_t[] = {{2, "MIN"}, {32, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_maxplayers = {"maxplayers", "8", CV_SAVE, maxplayers_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
static CV_PossibleValue_t joindelay_cons_t[] = {{1, "MIN"}, {3600, "MAX"}, {0, "Off"}, {0, NULL}};
|
||||
consvar_t cv_joindelay = {"joindelay", "10", CV_SAVE, joindelay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
static CV_PossibleValue_t rejointimeout_cons_t[] = {{1, "MIN"}, {60 * FRACUNIT, "MAX"}, {0, "Off"}, {0, NULL}};
|
||||
consvar_t cv_rejointimeout = {"rejointimeout", "Off", CV_SAVE|CV_FLOAT, rejointimeout_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
|
@ -3129,14 +3170,14 @@ void SV_ResetServer(void)
|
|||
neededtic = maketic;
|
||||
tictoclear = maketic;
|
||||
|
||||
joindelay = 0;
|
||||
|
||||
for (i = 0; i < MAXNETNODES; i++)
|
||||
ResetNode(i);
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_InvalidatePlayer(&players[i]);
|
||||
#endif
|
||||
playeringame[i] = false;
|
||||
playernode[i] = UINT8_MAX;
|
||||
memset(playeraddress[i], 0, sizeof(*playeraddress));
|
||||
|
@ -3197,6 +3238,8 @@ void D_QuitNetGame(void)
|
|||
|
||||
// abort send/receive of files
|
||||
CloseNetFile();
|
||||
RemoveAllLuaFileTransfers();
|
||||
waitingforluafiletransfer = false;
|
||||
|
||||
if (server)
|
||||
{
|
||||
|
@ -3230,37 +3273,6 @@ void D_QuitNetGame(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static INT32 FindRejoinerNum(SINT8 node)
|
||||
{
|
||||
char strippednodeaddress[64];
|
||||
const char *nodeaddress;
|
||||
char *port;
|
||||
INT32 i;
|
||||
|
||||
// Make sure there is no dead dress before proceeding to the stripping
|
||||
if (!I_GetNodeAddress)
|
||||
return -1;
|
||||
nodeaddress = I_GetNodeAddress(node);
|
||||
if (!nodeaddress)
|
||||
return -1;
|
||||
|
||||
// Strip the address of its port
|
||||
strcpy(strippednodeaddress, nodeaddress);
|
||||
port = strchr(strippednodeaddress, ':');
|
||||
if (port)
|
||||
*port = '\0';
|
||||
|
||||
// Check if any player matches the stripped address
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && playeraddress[i][0] && playernode[i] == UINT8_MAX
|
||||
&& !strcmp(playeraddress[i], strippednodeaddress))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Adds a node to the game (player will follow at map change or at savegame....)
|
||||
static inline void SV_AddNode(INT32 node)
|
||||
{
|
||||
|
@ -3398,10 +3410,8 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
|
|||
if (server && multiplayer && motd[0] != '\0')
|
||||
COM_BufAddText(va("sayto %d %s\n", newplayernum, motd));
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (!rejoined)
|
||||
LUAh_PlayerJoin(newplayernum);
|
||||
#endif
|
||||
}
|
||||
|
||||
static boolean SV_AddWaitingPlayers(const char *name, const char *name2)
|
||||
|
@ -3591,7 +3601,7 @@ static void HandleConnect(SINT8 node)
|
|||
rejoinernum = FindRejoinerNum(node);
|
||||
|
||||
if (bannednode && bannednode[node])
|
||||
SV_SendRefuse(node, M_GetText("You have been banned\nfrom the server"));
|
||||
SV_SendRefuse(node, M_GetText("You have been banned\nfrom the server."));
|
||||
else if (netbuffer->u.clientcfg._255 != 255 ||
|
||||
netbuffer->u.clientcfg.packetversion != PACKETVERSION)
|
||||
SV_SendRefuse(node, "Incompatible packet formats.");
|
||||
|
@ -3602,13 +3612,18 @@ static void HandleConnect(SINT8 node)
|
|||
|| netbuffer->u.clientcfg.subversion != SUBVERSION)
|
||||
SV_SendRefuse(node, va(M_GetText("Different SRB2 versions cannot\nplay a netgame!\n(server version %d.%d.%d)"), VERSION/100, VERSION%100, SUBVERSION));
|
||||
else if (!cv_allownewplayer.value && node && rejoinernum == -1)
|
||||
SV_SendRefuse(node, M_GetText("The server is not accepting\njoins for the moment"));
|
||||
SV_SendRefuse(node, M_GetText("The server is not accepting\njoins for the moment."));
|
||||
else if (D_NumPlayers() >= cv_maxplayers.value && rejoinernum == -1)
|
||||
SV_SendRefuse(node, va(M_GetText("Maximum players reached: %d"), cv_maxplayers.value));
|
||||
else if (netgame && netbuffer->u.clientcfg.localplayers > 1) // Hacked client?
|
||||
SV_SendRefuse(node, M_GetText("Too many players from\nthis node."));
|
||||
else if (netgame && !netbuffer->u.clientcfg.localplayers) // Stealth join?
|
||||
SV_SendRefuse(node, M_GetText("No players from\nthis node."));
|
||||
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."));
|
||||
else if (netgame && joindelay > 2 * (tic_t)cv_joindelay.value * TICRATE)
|
||||
SV_SendRefuse(node, va(M_GetText("Too many people are connecting.\nPlease wait %d seconds and then\ntry rejoining."),
|
||||
(joindelay - 2 * cv_joindelay.value * TICRATE) / TICRATE));
|
||||
else
|
||||
{
|
||||
#ifndef NONET
|
||||
|
@ -3666,6 +3681,7 @@ static void HandleConnect(SINT8 node)
|
|||
DEBFILE("send savegame\n");
|
||||
}
|
||||
SV_AddWaitingPlayers(names[0], names[1]);
|
||||
joindelay += cv_joindelay.value * TICRATE;
|
||||
player_joining = true;
|
||||
}
|
||||
#else
|
||||
|
@ -3966,7 +3982,7 @@ static void HandlePacketFromPlayer(SINT8 node)
|
|||
case PT_RESYNCHGET:
|
||||
if (client)
|
||||
break;
|
||||
SV_AcknowledgeResynchAck(netconsole, netbuffer->u.resynchgot);
|
||||
SV_AcknowledgeResynchAck(node, netbuffer->u.resynchgot);
|
||||
break;
|
||||
case PT_CLIENTCMD:
|
||||
case PT_CLIENT2CMD:
|
||||
|
@ -4195,6 +4211,18 @@ static void HandlePacketFromPlayer(SINT8 node)
|
|||
Net_CloseConnection(node);
|
||||
nodeingame[node] = false;
|
||||
break;
|
||||
case PT_ASKLUAFILE:
|
||||
if (server && luafiletransfers && luafiletransfers->nodestatus[node] == LFTNS_ASKED)
|
||||
{
|
||||
char *name = va("%s" PATHSEP "%s", luafiledir, luafiletransfers->filename);
|
||||
boolean textmode = !strchr(luafiletransfers->mode, 'b');
|
||||
SV_SendLuaFile(node, name, textmode);
|
||||
}
|
||||
break;
|
||||
case PT_HASLUAFILE:
|
||||
if (server && luafiletransfers && luafiletransfers->nodestatus[node] == LFTNS_SENDING)
|
||||
SV_HandleLuaFileSent(node);
|
||||
break;
|
||||
// -------------------------------------------- CLIENT RECEIVE ----------
|
||||
case PT_RESYNCHEND:
|
||||
// Only accept PT_RESYNCHEND from the server.
|
||||
|
@ -4322,6 +4350,10 @@ static void HandlePacketFromPlayer(SINT8 node)
|
|||
if (client)
|
||||
Got_Filetxpak();
|
||||
break;
|
||||
case PT_SENDINGLUAFILE:
|
||||
if (client)
|
||||
CL_PrepareDownloadLuaFile();
|
||||
break;
|
||||
default:
|
||||
DEBFILE(va("UNKNOWN PACKET TYPE RECEIVED %d from host %d\n",
|
||||
netbuffer->packettype, node));
|
||||
|
@ -4855,7 +4887,8 @@ static inline void PingUpdate(void)
|
|||
{
|
||||
for (i = 1; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && (realpingtable[i] / pingmeasurecount > (unsigned)cv_maxping.value))
|
||||
if (playeringame[i] && !players[i].quittime
|
||||
&& (realpingtable[i] / pingmeasurecount > (unsigned)cv_maxping.value))
|
||||
{
|
||||
if (players[i].jointime > 30 * TICRATE)
|
||||
laggers[i] = true;
|
||||
|
@ -4874,8 +4907,8 @@ static inline void PingUpdate(void)
|
|||
if (playeringame[i] && laggers[i])
|
||||
{
|
||||
pingtimeout[i]++;
|
||||
if (pingtimeout[i] > cv_pingtimeout.value)
|
||||
// ok your net has been bad for too long, you deserve to die.
|
||||
if (pingtimeout[i] > cv_pingtimeout.value)
|
||||
{
|
||||
pingtimeout[i] = 0;
|
||||
SendKick(i, KICK_MSG_PING_HIGH | KICK_MSG_KEEP_BODY);
|
||||
|
@ -4943,7 +4976,7 @@ void NetUpdate(void)
|
|||
PingUpdate();
|
||||
// update node latency values so we can take an average later.
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i])
|
||||
if (playeringame[i] && playernode[i] != UINT8_MAX)
|
||||
realpingtable[i] += G_TicsToMilliseconds(GetLag(playernode[i]));
|
||||
pingmeasurecount++;
|
||||
}
|
||||
|
@ -5017,12 +5050,21 @@ void NetUpdate(void)
|
|||
hu_resynching = true;
|
||||
}
|
||||
}
|
||||
|
||||
Net_AckTicker();
|
||||
|
||||
// Handle timeouts to prevent definitive freezes from happenning
|
||||
if (server)
|
||||
{
|
||||
for (i = 1; i < MAXNETNODES; i++)
|
||||
if (nodeingame[i] && freezetimeout[i] < I_GetTime())
|
||||
Net_ConnectionTimeout(i);
|
||||
|
||||
// In case the cvar value was lowered
|
||||
if (joindelay)
|
||||
joindelay = min(joindelay - 1, 3 * (tic_t)cv_joindelay.value * TICRATE);
|
||||
}
|
||||
|
||||
nowtime /= NEWTICRATERATIO;
|
||||
if (nowtime > resptime)
|
||||
{
|
||||
|
@ -5030,6 +5072,7 @@ void NetUpdate(void)
|
|||
M_Ticker();
|
||||
CON_Ticker();
|
||||
}
|
||||
|
||||
SV_FileSendTicker();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,14 +20,11 @@
|
|||
#include "d_player.h"
|
||||
|
||||
/*
|
||||
The 'packet version' may be used with packets whose
|
||||
format is expected to change between versions.
|
||||
|
||||
This version is independent of the mod name, and standard
|
||||
version and subversion. It should only account for the
|
||||
basic fields of the packet, and change infrequently.
|
||||
The 'packet version' is used to distinguish packet formats.
|
||||
This version is independent of VERSION and SUBVERSION. Different
|
||||
applications may follow different packet versions.
|
||||
*/
|
||||
#define PACKETVERSION 2
|
||||
#define PACKETVERSION 3
|
||||
|
||||
// Network play related stuff.
|
||||
// There is a data struct that stores network
|
||||
|
@ -36,7 +33,7 @@ basic fields of the packet, and change infrequently.
|
|||
// be transmitted.
|
||||
|
||||
// Networking and tick handling related.
|
||||
#define BACKUPTICS 32
|
||||
#define BACKUPTICS 96
|
||||
#define MAXTEXTCMD 256
|
||||
//
|
||||
// Packet structure
|
||||
|
@ -67,6 +64,10 @@ typedef enum
|
|||
PT_RESYNCHEND, // Player is now resynched and is being requested to remake the gametic
|
||||
PT_RESYNCHGET, // Player got resynch packet
|
||||
|
||||
PT_SENDINGLUAFILE, // Server telling a client Lua needs to open a file
|
||||
PT_ASKLUAFILE, // Client telling the server they don't have the file
|
||||
PT_HASLUAFILE, // Client telling the server they have the file
|
||||
|
||||
// Add non-PT_CANFAIL packet types here to avoid breaking MS compatibility.
|
||||
|
||||
PT_CANFAIL, // This is kind of a priority. Anything bigger than CANFAIL
|
||||
|
@ -361,6 +362,7 @@ typedef struct
|
|||
UINT8 subversion;
|
||||
UINT8 numberofplayer;
|
||||
UINT8 maxplayer;
|
||||
UINT8 refusereason; // 0: joinable, 1: joins disabled, 2: full
|
||||
char gametypename[24];
|
||||
UINT8 modifiedgame;
|
||||
UINT8 cheatsenabled;
|
||||
|
@ -513,7 +515,7 @@ extern UINT32 realpingtable[MAXPLAYERS];
|
|||
extern UINT32 playerpingtable[MAXPLAYERS];
|
||||
extern tic_t servermaxping;
|
||||
|
||||
extern consvar_t cv_allownewplayer, cv_joinnextround, cv_maxplayers, cv_rejointimeout;
|
||||
extern consvar_t cv_allownewplayer, cv_joinnextround, cv_maxplayers, cv_joindelay, cv_rejointimeout;
|
||||
extern consvar_t cv_resynchattempts, cv_blamecfail;
|
||||
extern consvar_t cv_maxsend, cv_noticedownload, cv_downloadspeed;
|
||||
|
||||
|
|
81
src/d_main.c
81
src/d_main.c
|
@ -91,9 +91,7 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
|
|||
#include "hardware/hw3sound.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
#include "lua_script.h"
|
||||
#endif
|
||||
|
||||
// platform independant focus loss
|
||||
UINT8 window_notinfocus = false;
|
||||
|
@ -510,13 +508,11 @@ static void D_Display(void)
|
|||
// vid size change is now finished if it was on...
|
||||
vid.recalc = 0;
|
||||
|
||||
// FIXME: draw either console or menu, not the two
|
||||
if (gamestate != GS_TIMEATTACK)
|
||||
CON_Drawer();
|
||||
|
||||
M_Drawer(); // menu is drawn even on top of everything
|
||||
// focus lost moved to M_Drawer
|
||||
|
||||
CON_Drawer();
|
||||
|
||||
//
|
||||
// wipe update
|
||||
//
|
||||
|
@ -750,9 +746,7 @@ void D_SRB2Loop(void)
|
|||
HW3S_EndFrameUpdate();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_Step();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -884,6 +878,40 @@ static inline void D_CleanFile(void)
|
|||
}
|
||||
}
|
||||
|
||||
///\brief Checks if a netgame URL is being handled, and changes working directory to the EXE's if so.
|
||||
/// Done because browsers (at least, Firefox on Windows) launch the game from the browser's directory, which causes problems.
|
||||
static void ChangeDirForUrlHandler(void)
|
||||
{
|
||||
// URL handlers are opened by web browsers (at least Firefox) from the browser's working directory, not the game's stored directory,
|
||||
// so chdir to that directory unless overridden.
|
||||
if (M_GetUrlProtocolArg() != NULL && !M_CheckParm("-nochdir"))
|
||||
{
|
||||
size_t i;
|
||||
|
||||
CONS_Printf("%s connect links load game files from the SRB2 application's stored directory. Switching to ", SERVER_URL_PROTOCOL);
|
||||
strlcpy(srb2path, myargv[0], sizeof(srb2path));
|
||||
|
||||
// Get just the directory, minus the EXE name
|
||||
for (i = strlen(srb2path)-1; i > 0; i--)
|
||||
{
|
||||
if (srb2path[i] == '/' || srb2path[i] == '\\')
|
||||
{
|
||||
srb2path[i] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CONS_Printf("%s\n", srb2path);
|
||||
|
||||
#if defined (_WIN32)
|
||||
SetCurrentDirectoryA(srb2path);
|
||||
#else
|
||||
if (chdir(srb2path) == -1)
|
||||
I_OutputMsg("Couldn't change working directory\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// Identify the SRB2 version, and IWAD file to use.
|
||||
// ==========================================================================
|
||||
|
@ -965,6 +993,7 @@ static void IdentifyVersion(void)
|
|||
}
|
||||
|
||||
MUSICTEST("music.dta")
|
||||
MUSICTEST("patch_music.pk3")
|
||||
#ifdef DEVELOP // remove when music_new.dta is merged into music.dta
|
||||
MUSICTEST("music_new.dta")
|
||||
#endif
|
||||
|
@ -1072,6 +1101,9 @@ void D_SRB2Main(void)
|
|||
// Test Dehacked lists
|
||||
DEH_Check();
|
||||
|
||||
// Netgame URL special case: change working dir to EXE folder.
|
||||
ChangeDirForUrlHandler();
|
||||
|
||||
// identify the main IWAD file to use
|
||||
IdentifyVersion();
|
||||
|
||||
|
@ -1128,7 +1160,8 @@ void D_SRB2Main(void)
|
|||
// can't use sprintf since there is %u in savegamename
|
||||
strcatbf(savegamename, srb2home, PATHSEP);
|
||||
|
||||
#else
|
||||
snprintf(luafiledir, sizeof luafiledir, "%s" PATHSEP "luafiles", srb2home);
|
||||
#else // DEFAULTDIR
|
||||
snprintf(srb2home, sizeof srb2home, "%s", userhome);
|
||||
snprintf(downloaddir, sizeof downloaddir, "%s", userhome);
|
||||
if (dedicated)
|
||||
|
@ -1138,7 +1171,9 @@ void D_SRB2Main(void)
|
|||
|
||||
// can't use sprintf since there is %u in savegamename
|
||||
strcatbf(savegamename, userhome, PATHSEP);
|
||||
#endif
|
||||
|
||||
snprintf(luafiledir, sizeof luafiledir, "%s" PATHSEP "luafiles", userhome);
|
||||
#endif // DEFAULTDIR
|
||||
}
|
||||
|
||||
configfile[sizeof configfile - 1] = '\0';
|
||||
|
@ -1154,9 +1189,15 @@ void D_SRB2Main(void)
|
|||
if (M_CheckParm("-password") && M_IsNextParm())
|
||||
D_SetPassword(M_GetNextParm());
|
||||
|
||||
CONS_Printf("Z_Init(): Init zone memory allocation daemon. \n");
|
||||
Z_Init();
|
||||
|
||||
// Do this up here so that WADs loaded through the command line can use ExecCfg
|
||||
COM_Init();
|
||||
|
||||
// add any files specified on the command line with -file wadfile
|
||||
// to the wad list
|
||||
if (!(M_CheckParm("-connect") && !M_CheckParm("-server")))
|
||||
if (!((M_GetUrlProtocolArg() || M_CheckParm("-connect")) && !M_CheckParm("-server")))
|
||||
{
|
||||
if (M_CheckParm("-file"))
|
||||
{
|
||||
|
@ -1181,9 +1222,6 @@ void D_SRB2Main(void)
|
|||
if (M_CheckParm("-server") || dedicated)
|
||||
netgame = server = true;
|
||||
|
||||
CONS_Printf("Z_Init(): Init zone memory allocation daemon. \n");
|
||||
Z_Init();
|
||||
|
||||
// adapt tables to SRB2's needs, including extra slots for dehacked file support
|
||||
P_PatchInfoTables();
|
||||
|
||||
|
@ -1191,7 +1229,7 @@ void D_SRB2Main(void)
|
|||
M_InitMenuPresTables();
|
||||
|
||||
// init title screen display params
|
||||
if (M_CheckParm("-connect"))
|
||||
if (M_GetUrlProtocolArg() || M_CheckParm("-connect"))
|
||||
F_InitMenuPresValues();
|
||||
|
||||
//---------------------------------------------------- READY TIME
|
||||
|
@ -1255,7 +1293,6 @@ void D_SRB2Main(void)
|
|||
CONS_Printf("HU_Init(): Setting up heads up display.\n");
|
||||
HU_Init();
|
||||
|
||||
COM_Init();
|
||||
CON_Init();
|
||||
|
||||
D_RegisterServerCommands();
|
||||
|
@ -1280,13 +1317,19 @@ void D_SRB2Main(void)
|
|||
// Lactozilla: Does the render mode need to change?
|
||||
if ((setrenderneeded != 0) && (setrenderneeded != rendermode))
|
||||
{
|
||||
CONS_Printf("Switching the renderer...\n");
|
||||
CONS_Printf(M_GetText("Switching the renderer...\n"));
|
||||
Z_PreparePatchFlush();
|
||||
|
||||
// set needpatchflush / needpatchrecache true for D_CheckRendererState
|
||||
needpatchflush = true;
|
||||
needpatchrecache = true;
|
||||
|
||||
// Set cv_renderer to the new render mode
|
||||
VID_CheckRenderer();
|
||||
SCR_ChangeRendererCVars(setrenderneeded);
|
||||
SCR_ChangeRendererCVars(rendermode);
|
||||
|
||||
// check the renderer's state
|
||||
D_CheckRendererState();
|
||||
setrenderneeded = 0;
|
||||
}
|
||||
|
||||
wipegamestate = gamestate;
|
||||
|
|
|
@ -715,6 +715,8 @@ void Net_CloseConnection(INT32 node)
|
|||
|
||||
InitNode(&nodes[node]);
|
||||
SV_AbortSendFiles(node);
|
||||
if (server)
|
||||
SV_AbortLuaFileTransfer(node);
|
||||
I_NetFreeNodenum(node);
|
||||
#endif
|
||||
}
|
||||
|
@ -799,6 +801,10 @@ static const char *packettypename[NUMPACKETTYPE] =
|
|||
"RESYNCHEND",
|
||||
"RESYNCHGET",
|
||||
|
||||
"SENDINGLUAFILE",
|
||||
"ASKLUAFILE",
|
||||
"HASLUAFILE",
|
||||
|
||||
"FILEFRAGMENT",
|
||||
"TEXTCMD",
|
||||
"TEXTCMD2",
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "g_input.h"
|
||||
#include "m_menu.h"
|
||||
#include "r_local.h"
|
||||
#include "r_things.h"
|
||||
#include "r_skins.h"
|
||||
#include "p_local.h"
|
||||
#include "p_setup.h"
|
||||
#include "s_sound.h"
|
||||
|
@ -157,10 +157,8 @@ static void Command_Isgamemodified_f(void);
|
|||
static void Command_Cheats_f(void);
|
||||
#ifdef _DEBUG
|
||||
static void Command_Togglemodified_f(void);
|
||||
#ifdef HAVE_BLUA
|
||||
static void Command_Archivetest_f(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// =========================================================================
|
||||
// CLIENT VARIABLES
|
||||
|
@ -415,10 +413,9 @@ const char *netxcmdnames[MAXNETXCMD - 1] =
|
|||
"DELFILE", // replace next time we add an XD
|
||||
"SETMOTD",
|
||||
"SUICIDE",
|
||||
#ifdef HAVE_BLUA
|
||||
"LUACMD",
|
||||
"LUAVAR"
|
||||
#endif
|
||||
"LUAVAR",
|
||||
"LUAFILE"
|
||||
};
|
||||
|
||||
// =========================================================================
|
||||
|
@ -451,9 +448,8 @@ void D_RegisterServerCommands(void)
|
|||
RegisterNetXCmd(XD_PAUSE, Got_Pause);
|
||||
RegisterNetXCmd(XD_SUICIDE, Got_Suicide);
|
||||
RegisterNetXCmd(XD_RUNSOC, Got_RunSOCcmd);
|
||||
#ifdef HAVE_BLUA
|
||||
RegisterNetXCmd(XD_LUACMD, Got_Luacmd);
|
||||
#endif
|
||||
RegisterNetXCmd(XD_LUAFILE, Got_LuaFile);
|
||||
|
||||
// Remote Administration
|
||||
COM_AddCommand("password", Command_Changepassword_f);
|
||||
|
@ -502,9 +498,7 @@ void D_RegisterServerCommands(void)
|
|||
COM_AddCommand("cheats", Command_Cheats_f); // test
|
||||
#ifdef _DEBUG
|
||||
COM_AddCommand("togglemodified", Command_Togglemodified_f);
|
||||
#ifdef HAVE_BLUA
|
||||
COM_AddCommand("archivetest", Command_Archivetest_f);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// for master server connection
|
||||
|
@ -579,6 +573,7 @@ void D_RegisterServerCommands(void)
|
|||
|
||||
// d_clisrv
|
||||
CV_RegisterVar(&cv_maxplayers);
|
||||
CV_RegisterVar(&cv_joindelay);
|
||||
CV_RegisterVar(&cv_rejointimeout);
|
||||
CV_RegisterVar(&cv_resynchattempts);
|
||||
CV_RegisterVar(&cv_maxsend);
|
||||
|
@ -913,7 +908,7 @@ void D_RegisterClientCommands(void)
|
|||
#ifdef _DEBUG
|
||||
COM_AddCommand("causecfail", Command_CauseCfail_f);
|
||||
#endif
|
||||
#if defined(HAVE_BLUA) && defined(LUA_ALLOW_BYTECODE)
|
||||
#ifdef LUA_ALLOW_BYTECODE
|
||||
COM_AddCommand("dumplua", Command_Dumplua_f);
|
||||
#endif
|
||||
}
|
||||
|
@ -1258,7 +1253,7 @@ static void SendNameAndColor(void)
|
|||
|
||||
players[consoleplayer].skincolor = cv_playercolor.value;
|
||||
|
||||
if (players[consoleplayer].mo)
|
||||
if (players[consoleplayer].mo && !players[consoleplayer].powers[pw_dye])
|
||||
players[consoleplayer].mo->color = players[consoleplayer].skincolor;
|
||||
|
||||
if (metalrecording)
|
||||
|
@ -1370,8 +1365,9 @@ static void SendNameAndColor2(void)
|
|||
if (botingame)
|
||||
{
|
||||
players[secondplaya].skincolor = botcolor;
|
||||
if (players[secondplaya].mo)
|
||||
if (players[secondplaya].mo && !players[secondplaya].powers[pw_dye])
|
||||
players[secondplaya].mo->color = players[secondplaya].skincolor;
|
||||
|
||||
SetPlayerSkinByNum(secondplaya, botskin-1);
|
||||
return;
|
||||
}
|
||||
|
@ -1384,7 +1380,7 @@ static void SendNameAndColor2(void)
|
|||
|
||||
// don't use secondarydisplayplayer: the second player must be 1
|
||||
players[secondplaya].skincolor = cv_playercolor2.value;
|
||||
if (players[secondplaya].mo)
|
||||
if (players[secondplaya].mo && !players[secondplaya].powers[pw_dye])
|
||||
players[secondplaya].mo->color = players[secondplaya].skincolor;
|
||||
|
||||
if (cv_forceskin.value >= 0 && (netgame || multiplayer)) // Server wants everyone to use the same player
|
||||
|
@ -2027,9 +2023,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
|||
UINT8 flags;
|
||||
INT32 resetplayer = 1, lastgametype;
|
||||
UINT8 skipprecutscene, FLS;
|
||||
#ifdef HAVE_BLUA
|
||||
INT16 mapnumber;
|
||||
#endif
|
||||
|
||||
if (playernum != serverplayer && !IsPlayerAdmin(playernum))
|
||||
{
|
||||
|
@ -2091,10 +2085,8 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
|||
CV_StealthSetValue(&cv_playercolor, players[0].skincolor);
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
mapnumber = M_MapNumber(mapname[3], mapname[4]);
|
||||
LUAh_MapChange(mapnumber);
|
||||
#endif
|
||||
|
||||
G_InitNew(ultimatemode, mapname, resetplayer, skipprecutscene, FLS);
|
||||
if (demoplayback && !timingdemo)
|
||||
|
@ -2678,11 +2670,9 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// Don't switch team, just go away, please, go awaayyyy, aaauuauugghhhghgh
|
||||
if (!LUAh_TeamSwitch(&players[playernum], NetPacket.packet.newteam, players[playernum].spectator, NetPacket.packet.autobalance, NetPacket.packet.scrambled))
|
||||
return;
|
||||
#endif
|
||||
|
||||
//no status changes after hidetime
|
||||
if ((gametyperules & GTR_HIDEFROZEN) && (leveltime >= (hidetime * TICRATE)))
|
||||
|
@ -2839,12 +2829,10 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
|||
//reset view if you are changed, or viewing someone who was changed.
|
||||
if (playernum == consoleplayer || displayplayer == playernum)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
// Call ViewpointSwitch hooks here.
|
||||
// The viewpoint was forcibly changed.
|
||||
if (displayplayer != consoleplayer) // You're already viewing yourself. No big deal.
|
||||
LUAh_ViewpointSwitch(&players[playernum], &players[displayplayer], true);
|
||||
#endif
|
||||
LUAh_ViewpointSwitch(&players[consoleplayer], &players[consoleplayer], true);
|
||||
displayplayer = consoleplayer;
|
||||
}
|
||||
|
||||
|
@ -3342,10 +3330,6 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
|
|||
boolean kick = false;
|
||||
boolean toomany = false;
|
||||
INT32 i,j;
|
||||
serverinfo_pak *dummycheck = NULL;
|
||||
|
||||
// Shut the compiler up.
|
||||
(void)dummycheck;
|
||||
|
||||
READSTRINGN(*cp, filename, 240);
|
||||
READMEM(*cp, md5sum, 16);
|
||||
|
@ -4334,7 +4318,6 @@ static void Command_Togglemodified_f(void)
|
|||
modifiedgame = !modifiedgame;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
extern UINT8 *save_p;
|
||||
static void Command_Archivetest_f(void)
|
||||
{
|
||||
|
@ -4379,7 +4362,6 @@ static void Command_Archivetest_f(void)
|
|||
CONS_Printf("Done. No crash.\n");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Makes a change to ::cv_forceskin take effect immediately.
|
||||
*
|
||||
|
|
|
@ -142,10 +142,9 @@ typedef enum
|
|||
XD_SETMOTD, // 19
|
||||
XD_SUICIDE, // 20
|
||||
XD_DEMOTED, // 21
|
||||
#ifdef HAVE_BLUA
|
||||
XD_LUACMD, // 22
|
||||
XD_LUAVAR, // 23
|
||||
#endif
|
||||
XD_LUAFILE, // 24
|
||||
MAXNETXCMD
|
||||
} netxcmd_t;
|
||||
|
||||
|
|
240
src/d_netfil.c
240
src/d_netfil.c
|
@ -69,6 +69,7 @@ typedef struct filetx_s
|
|||
UINT32 size; // Size of the file
|
||||
UINT8 fileid;
|
||||
INT32 node; // Destination
|
||||
boolean textmode; // For files requested by Lua without the "b" option
|
||||
struct filetx_s *next; // Next file in the list
|
||||
} filetx_t;
|
||||
|
||||
|
@ -94,6 +95,11 @@ char downloaddir[512] = "DOWNLOAD";
|
|||
INT32 lastfilenum = -1;
|
||||
#endif
|
||||
|
||||
luafiletransfer_t *luafiletransfers = NULL;
|
||||
boolean waitingforluafiletransfer = false;
|
||||
char luafiledir[256 + 16] = "luafiles";
|
||||
|
||||
|
||||
/** Fills a serverinfo packet with information about wad files loaded.
|
||||
*
|
||||
* \todo Give this function a better name since it is in global scope.
|
||||
|
@ -159,6 +165,7 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr)
|
|||
fileneeded[i].file = NULL; // The file isn't open yet
|
||||
READSTRINGN(p, fileneeded[i].filename, MAX_WADPATH); // The next bytes are the file name
|
||||
READMEM(p, fileneeded[i].md5sum, 16); // The last 16 bytes are the file checksum
|
||||
fileneeded[i].textmode = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,6 +177,7 @@ void CL_PrepareDownloadSaveGame(const char *tmpsave)
|
|||
fileneeded[0].file = NULL;
|
||||
memset(fileneeded[0].md5sum, 0, 16);
|
||||
strcpy(fileneeded[0].filename, tmpsave);
|
||||
fileneeded[0].textmode = false;
|
||||
}
|
||||
|
||||
/** Checks the server to see if we CAN download all the files,
|
||||
|
@ -448,6 +456,162 @@ void CL_LoadServerFiles(void)
|
|||
}
|
||||
}
|
||||
|
||||
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 *filetransfer;
|
||||
static INT32 id;
|
||||
|
||||
//CONS_Printf("AddLuaFileTransfer \"%s\"\n", filename);
|
||||
|
||||
// Find the last transfer in the list and set a pointer to its "next" field
|
||||
prevnext = &luafiletransfers;
|
||||
while (*prevnext)
|
||||
prevnext = &((*prevnext)->next);
|
||||
|
||||
// Allocate file transfer information and append it to the transfer list
|
||||
filetransfer = malloc(sizeof(luafiletransfer_t));
|
||||
if (!filetransfer)
|
||||
I_Error("AddLuaFileTransfer: Out of memory\n");
|
||||
*prevnext = filetransfer;
|
||||
filetransfer->next = NULL;
|
||||
|
||||
// Allocate the file name
|
||||
filetransfer->filename = strdup(filename);
|
||||
if (!filetransfer->filename)
|
||||
I_Error("AddLuaFileTransfer: Out of memory\n");
|
||||
|
||||
// Create and allocate the real file name
|
||||
if (server)
|
||||
filetransfer->realfilename = strdup(va("%s" PATHSEP "%s",
|
||||
luafiledir, filename));
|
||||
else
|
||||
filetransfer->realfilename = strdup(va("%s" PATHSEP "client" PATHSEP "$$$%d%d.tmp",
|
||||
luafiledir, rand(), rand()));
|
||||
if (!filetransfer->realfilename)
|
||||
I_Error("AddLuaFileTransfer: Out of memory\n");
|
||||
|
||||
strlcpy(filetransfer->mode, mode, sizeof(filetransfer->mode));
|
||||
|
||||
if (server)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
// Set status to "waiting" for everyone
|
||||
for (i = 0; i < MAXNETNODES; i++)
|
||||
filetransfer->nodestatus[i] = LFTNS_WAITING;
|
||||
|
||||
if (!luafiletransfers->next) // Only if there is no transfer already going on
|
||||
{
|
||||
if (FIL_ReadFileOK(filetransfer->realfilename))
|
||||
SV_PrepareSendLuaFileToNextNode();
|
||||
else
|
||||
{
|
||||
// Send a net command with 0 as its first byte to indicate the file couldn't be opened
|
||||
UINT8 success = 0;
|
||||
SendNetXCmd(XD_LUAFILE, &success, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store the callback so it can be called once everyone has the file
|
||||
filetransfer->id = id;
|
||||
StoreLuaFileCallback(id);
|
||||
id++;
|
||||
|
||||
if (waitingforluafiletransfer)
|
||||
{
|
||||
waitingforluafiletransfer = false;
|
||||
CL_PrepareDownloadLuaFile();
|
||||
}
|
||||
}
|
||||
|
||||
void SV_PrepareSendLuaFileToNextNode(void)
|
||||
{
|
||||
INT32 i;
|
||||
UINT8 success = 1;
|
||||
|
||||
// Find a client to send the file to
|
||||
for (i = 1; i < MAXNETNODES; i++)
|
||||
if (nodeingame[i] && luafiletransfers->nodestatus[i] == LFTNS_WAITING) // Node waiting
|
||||
{
|
||||
// Tell the client we're about to send them the file
|
||||
netbuffer->packettype = PT_SENDINGLUAFILE;
|
||||
if (!HSendPacket(i, true, 0, 0))
|
||||
I_Error("Failed to send a PT_SENDINGLUAFILE packet\n"); // !!! Todo: Handle failure a bit better lol
|
||||
|
||||
luafiletransfers->nodestatus[i] = LFTNS_ASKED;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// No client found, everyone has the file
|
||||
// Send a net command with 1 as its first byte to indicate the file could be opened
|
||||
SendNetXCmd(XD_LUAFILE, &success, 1);
|
||||
}
|
||||
|
||||
void SV_HandleLuaFileSent(UINT8 node)
|
||||
{
|
||||
luafiletransfers->nodestatus[node] = LFTNS_SENT;
|
||||
SV_PrepareSendLuaFileToNextNode();
|
||||
}
|
||||
|
||||
void RemoveLuaFileTransfer(void)
|
||||
{
|
||||
luafiletransfer_t *filetransfer = luafiletransfers;
|
||||
|
||||
RemoveLuaFileCallback(filetransfer->id);
|
||||
|
||||
luafiletransfers = filetransfer->next;
|
||||
|
||||
free(filetransfer->filename);
|
||||
free(filetransfer->realfilename);
|
||||
free(filetransfer);
|
||||
}
|
||||
|
||||
void RemoveAllLuaFileTransfers(void)
|
||||
{
|
||||
while (luafiletransfers)
|
||||
RemoveLuaFileTransfer();
|
||||
}
|
||||
|
||||
void SV_AbortLuaFileTransfer(INT32 node)
|
||||
{
|
||||
if (luafiletransfers
|
||||
&& (luafiletransfers->nodestatus[node] == LFTNS_ASKED
|
||||
|| luafiletransfers->nodestatus[node] == LFTNS_SENDING))
|
||||
{
|
||||
luafiletransfers->nodestatus[node] = LFTNS_WAITING;
|
||||
SV_PrepareSendLuaFileToNextNode();
|
||||
}
|
||||
}
|
||||
|
||||
void CL_PrepareDownloadLuaFile(void)
|
||||
{
|
||||
// If there is no transfer in the list, this normally means the server
|
||||
// called io.open before us, so we have to wait until we call it too
|
||||
if (!luafiletransfers)
|
||||
{
|
||||
waitingforluafiletransfer = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Tell the server we are ready to receive the file
|
||||
netbuffer->packettype = PT_ASKLUAFILE;
|
||||
HSendPacket(servernode, true, 0, 0);
|
||||
|
||||
fileneedednum = 1;
|
||||
fileneeded[0].status = FS_REQUESTED;
|
||||
fileneeded[0].totalsize = UINT32_MAX;
|
||||
fileneeded[0].file = NULL;
|
||||
memset(fileneeded[0].md5sum, 0, 16);
|
||||
strcpy(fileneeded[0].filename, luafiletransfers->realfilename);
|
||||
fileneeded[0].textmode = !strchr(luafiletransfers->mode, 'b');
|
||||
|
||||
// Make sure all directories in the file path exist
|
||||
MakePathDirs(fileneeded[0].filename);
|
||||
}
|
||||
|
||||
// Number of files to send
|
||||
// Little optimization to quickly test if there is a file in the queue
|
||||
static INT32 filestosend = 0;
|
||||
|
@ -458,6 +622,7 @@ static INT32 filestosend = 0;
|
|||
* \param filename The file to send
|
||||
* \param fileid ???
|
||||
* \sa SV_SendRam
|
||||
* \sa SV_SendLuaFile
|
||||
*
|
||||
*/
|
||||
static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
|
||||
|
@ -548,6 +713,7 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
|
|||
* \param freemethod How to free the block after it has been sent
|
||||
* \param fileid ???
|
||||
* \sa SV_SendFile
|
||||
* \sa SV_SendLuaFile
|
||||
*
|
||||
*/
|
||||
void SV_SendRam(INT32 node, void *data, size_t size, freemethod_t freemethod, UINT8 fileid)
|
||||
|
@ -579,6 +745,55 @@ void SV_SendRam(INT32 node, void *data, size_t size, freemethod_t freemethod, UI
|
|||
filestosend++;
|
||||
}
|
||||
|
||||
/** Adds a file requested by Lua to the file list for a node
|
||||
*
|
||||
* \param node The node to send the file to
|
||||
* \param filename The file to send
|
||||
* \sa SV_SendFile
|
||||
* \sa SV_SendRam
|
||||
*
|
||||
*/
|
||||
boolean SV_SendLuaFile(INT32 node, const char *filename, boolean textmode)
|
||||
{
|
||||
filetx_t **q; // A pointer to the "next" field of the last file in the list
|
||||
filetx_t *p; // The new file request
|
||||
//INT32 i;
|
||||
//char wadfilename[MAX_WADPATH];
|
||||
|
||||
luafiletransfers->nodestatus[node] = LFTNS_SENDING;
|
||||
|
||||
// Find the last file in the list and set a pointer to its "next" field
|
||||
q = &transfer[node].txlist;
|
||||
while (*q)
|
||||
q = &((*q)->next);
|
||||
|
||||
// Allocate a file request and append it to the file list
|
||||
p = *q = (filetx_t *)malloc(sizeof (filetx_t));
|
||||
if (!p)
|
||||
I_Error("SV_SendLuaFile: No more memory\n");
|
||||
|
||||
// Initialise with zeros
|
||||
memset(p, 0, sizeof (filetx_t));
|
||||
|
||||
// Allocate the file name
|
||||
p->id.filename = (char *)malloc(MAX_WADPATH); // !!!
|
||||
if (!p->id.filename)
|
||||
I_Error("SV_SendLuaFile: No more memory\n");
|
||||
|
||||
// Set the file name and get rid of the path
|
||||
strlcpy(p->id.filename, filename, MAX_WADPATH); // !!!
|
||||
//nameonly(p->id.filename);
|
||||
|
||||
// Open in text mode if required by the Lua script
|
||||
p->textmode = textmode;
|
||||
|
||||
DEBFILE(va("Sending Lua file %s to %d\n", filename, node));
|
||||
p->ram = SF_FILE; // It's a file, we need to close it and free its name once we're done sending it
|
||||
p->next = NULL; // End of list
|
||||
filestosend++;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 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
|
||||
*
|
||||
|
@ -684,7 +899,7 @@ void SV_FileSendTicker(void)
|
|||
long filesize;
|
||||
|
||||
transfer[i].currentfile =
|
||||
fopen(f->id.filename, "rb");
|
||||
fopen(f->id.filename, f->textmode ? "r" : "rb");
|
||||
|
||||
if (!transfer[i].currentfile)
|
||||
I_Error("File %s does not exist",
|
||||
|
@ -715,11 +930,20 @@ void SV_FileSendTicker(void)
|
|||
size = f->size-transfer[i].position;
|
||||
if (ram)
|
||||
M_Memcpy(p->data, &f->id.ram[transfer[i].position], size);
|
||||
else
|
||||
{
|
||||
size_t n = fread(p->data, 1, size, transfer[i].currentfile);
|
||||
if (n != size) // Either an error or Windows turning CR-LF into LF
|
||||
{
|
||||
if (f->textmode && feof(transfer[i].currentfile))
|
||||
size = n;
|
||||
else if (fread(p->data, 1, size, transfer[i].currentfile) != size)
|
||||
I_Error("SV_FileSendTicker: can't read %s byte on %s at %d because %s", sizeu1(size), f->id.filename, transfer[i].position, M_FileError(transfer[i].currentfile));
|
||||
}
|
||||
}
|
||||
p->position = LONG(transfer[i].position);
|
||||
// Put flag so receiver knows the total size
|
||||
if (transfer[i].position + size == f->size)
|
||||
if (transfer[i].position + size == f->size || (f->textmode && feof(transfer[i].currentfile)))
|
||||
p->position |= LONG(0x80000000);
|
||||
p->fileid = f->fileid;
|
||||
p->size = SHORT((UINT16)size);
|
||||
|
@ -728,7 +952,7 @@ void SV_FileSendTicker(void)
|
|||
if (HSendPacket(i, true, 0, FILETXHEADER + size)) // Reliable SEND
|
||||
{ // Success
|
||||
transfer[i].position = (UINT32)(transfer[i].position + size);
|
||||
if (transfer[i].position == f->size) // Finish?
|
||||
if (transfer[i].position == f->size || (f->textmode && feof(transfer[i].currentfile))) // Finish?
|
||||
SV_EndFileSend(i);
|
||||
}
|
||||
else
|
||||
|
@ -772,7 +996,7 @@ void Got_Filetxpak(void)
|
|||
{
|
||||
if (file->file)
|
||||
I_Error("Got_Filetxpak: already open file\n");
|
||||
file->file = fopen(filename, "wb");
|
||||
file->file = fopen(filename, file->textmode ? "w" : "wb");
|
||||
if (!file->file)
|
||||
I_Error("Can't create file %s: %s", filename, strerror(errno));
|
||||
CONS_Printf("\r%s...\n",filename);
|
||||
|
@ -793,7 +1017,7 @@ void Got_Filetxpak(void)
|
|||
}
|
||||
// We can receive packet in the wrong order, anyway all os support gaped file
|
||||
fseek(file->file, pos, SEEK_SET);
|
||||
if (fwrite(netbuffer->u.filetxpak.data,size,1,file->file) != 1)
|
||||
if (size && fwrite(netbuffer->u.filetxpak.data,size,1,file->file) != 1)
|
||||
I_Error("Can't write to %s: %s\n",filename, M_FileError(file->file));
|
||||
file->currentsize += size;
|
||||
|
||||
|
@ -805,6 +1029,12 @@ void Got_Filetxpak(void)
|
|||
file->status = FS_FOUND;
|
||||
CONS_Printf(M_GetText("Downloading %s...(done)\n"),
|
||||
filename);
|
||||
if (luafiletransfers)
|
||||
{
|
||||
// Tell the server we have received the file
|
||||
netbuffer->packettype = PT_HASLUAFILE;
|
||||
HSendPacket(servernode, true, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#ifndef __D_NETFIL__
|
||||
#define __D_NETFIL__
|
||||
|
||||
#include "d_net.h"
|
||||
#include "w_wad.h"
|
||||
|
||||
typedef enum
|
||||
|
@ -43,6 +44,7 @@ typedef struct
|
|||
UINT32 currentsize;
|
||||
UINT32 totalsize;
|
||||
filestatus_t status; // The value returned by recsearch
|
||||
boolean textmode; // For files requested by Lua without the "b" option
|
||||
} fileneeded_t;
|
||||
|
||||
extern INT32 fileneedednum;
|
||||
|
@ -70,6 +72,42 @@ boolean CL_CheckDownloadable(void);
|
|||
boolean CL_SendRequestFile(void);
|
||||
boolean Got_RequestFilePak(INT32 node);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LFTNS_WAITING, // This node is waiting for the server to send the file
|
||||
LFTNS_ASKED, // The server has told the node they're ready to send the file
|
||||
LFTNS_SENDING, // The server is sending the file to this node
|
||||
LFTNS_SENT // The node already has the file
|
||||
} luafiletransfernodestatus_t;
|
||||
|
||||
typedef struct luafiletransfer_s
|
||||
{
|
||||
char *filename;
|
||||
char *realfilename;
|
||||
char mode[4]; // rb+/wb+/ab+ + null character
|
||||
INT32 id; // Callback ID
|
||||
luafiletransfernodestatus_t nodestatus[MAXNETNODES];
|
||||
struct luafiletransfer_s *next;
|
||||
} luafiletransfer_t;
|
||||
|
||||
extern luafiletransfer_t *luafiletransfers;
|
||||
extern boolean waitingforluafiletransfer;
|
||||
extern char luafiledir[256 + 16];
|
||||
|
||||
void AddLuaFileTransfer(const char *filename, const char *mode);
|
||||
void SV_PrepareSendLuaFileToNextNode(void);
|
||||
boolean SV_SendLuaFile(INT32 node, const char *filename, boolean textmode);
|
||||
void SV_PrepareSendLuaFile(const char *filename);
|
||||
void SV_HandleLuaFileSent(UINT8 node);
|
||||
void RemoveLuaFileTransfer(void);
|
||||
void RemoveAllLuaFileTransfers(void);
|
||||
void SV_AbortLuaFileTransfer(INT32 node);
|
||||
void CL_PrepareDownloadLuaFile(void);
|
||||
void Got_LuaFile(UINT8 **cp, INT32 playernum);
|
||||
void StoreLuaFileCallback(INT32 id);
|
||||
void RemoveLuaFileCallback(INT32 id);
|
||||
void MakePathDirs(char *path);
|
||||
|
||||
void SV_AbortSendFiles(INT32 node);
|
||||
void CloseNetFile(void);
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ typedef enum
|
|||
SF_FASTEDGE = 1<<12, // Faster edge teeter?
|
||||
SF_MULTIABILITY = 1<<13, // Revenge of Final Demo.
|
||||
SF_NONIGHTSROTATION = 1<<14, // Disable sprite rotation for NiGHTS
|
||||
SF_NONIGHTSSUPER = 1<<15, // Disable super colors for NiGHTS (if you have SF_SUPER)
|
||||
// free up to and including 1<<31
|
||||
} skinflags_t;
|
||||
|
||||
|
@ -278,6 +279,9 @@ typedef enum
|
|||
pw_nights_linkfreeze,
|
||||
|
||||
pw_nocontrol, //for linedef exec 427
|
||||
|
||||
pw_dye, // for dyes
|
||||
|
||||
pw_justlaunched, // Launched off a slope this tic (0=none, 1=standard launch, 2=half-pipe launch)
|
||||
|
||||
NUMPOWERS
|
||||
|
|
105
src/dehacked.c
105
src/dehacked.c
|
@ -31,6 +31,7 @@
|
|||
#include "r_data.h"
|
||||
#include "r_draw.h"
|
||||
#include "r_patch.h"
|
||||
#include "r_things.h" // R_Char2Frame
|
||||
#include "r_sky.h"
|
||||
#include "fastcmp.h"
|
||||
#include "lua_script.h"
|
||||
|
@ -39,9 +40,7 @@
|
|||
|
||||
#include "m_cond.h"
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
#include "v_video.h" // video flags (for lua)
|
||||
#endif
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_light.h"
|
||||
|
@ -76,10 +75,8 @@ static UINT16 get_mus(const char *word, UINT8 dehacked_mode);
|
|||
#endif
|
||||
static hudnum_t get_huditem(const char *word);
|
||||
static menutype_t get_menutype(const char *word);
|
||||
#ifndef HAVE_BLUA
|
||||
static INT16 get_gametype(const char *word);
|
||||
static powertype_t get_power(const char *word);
|
||||
#endif
|
||||
//static INT16 get_gametype(const char *word);
|
||||
//static powertype_t get_power(const char *word);
|
||||
|
||||
boolean deh_loaded = false;
|
||||
static int dbg_line;
|
||||
|
@ -1249,7 +1246,7 @@ static void readgametype(MYFILE *f, char *gtname)
|
|||
newgttol = (UINT32)i;
|
||||
else
|
||||
{
|
||||
UINT16 tol = 0;
|
||||
UINT32 tol = 0;
|
||||
tmp = strtok(word2,",");
|
||||
do {
|
||||
for (i = 0; TYPEOFLEVEL[i].name; i++)
|
||||
|
@ -1415,7 +1412,6 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
// Lua custom options also go above, contents may be case sensitive.
|
||||
if (fastncmp(word, "LUA.", 4))
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
UINT8 j;
|
||||
customoption_t *modoption;
|
||||
|
||||
|
@ -1449,9 +1445,6 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
modoption->option[31] = '\0';
|
||||
strncpy(modoption->value, word2, 255);
|
||||
modoption->value[255] = '\0';
|
||||
#else
|
||||
// Silently ignore.
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1591,7 +1584,7 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
mapheaderinfo[num-1]->typeoflevel = (UINT32)i;
|
||||
else
|
||||
{
|
||||
UINT16 tol = 0;
|
||||
UINT32 tol = 0;
|
||||
tmp = strtok(word2,",");
|
||||
do {
|
||||
for (i = 0; TYPEOFLEVEL[i].name; i++)
|
||||
|
@ -1870,6 +1863,12 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
}
|
||||
else if (fastcmp(word, "STARTRINGS"))
|
||||
mapheaderinfo[num-1]->startrings = (UINT16)i;
|
||||
else if (fastcmp(word, "SPECIALSTAGETIME"))
|
||||
mapheaderinfo[num-1]->sstimer = i;
|
||||
else if (fastcmp(word, "SPECIALSTAGESPHERES"))
|
||||
mapheaderinfo[num-1]->ssspheres = i;
|
||||
else if (fastcmp(word, "GRAVITY"))
|
||||
mapheaderinfo[num-1]->gravity = FLOAT_TO_FIXED(atof(word2));
|
||||
else
|
||||
deh_warning("Level header %d: unknown word '%s'", num, word);
|
||||
}
|
||||
|
@ -2916,6 +2915,7 @@ static actionpointer_t actionpointers[] =
|
|||
{{A_SetRandomTics}, "A_SETRANDOMTICS"},
|
||||
{{A_ChangeColorRelative}, "A_CHANGECOLORRELATIVE"},
|
||||
{{A_ChangeColorAbsolute}, "A_CHANGECOLORABSOLUTE"},
|
||||
{{A_Dye}, "A_DYE"},
|
||||
{{A_MoveRelative}, "A_MOVERELATIVE"},
|
||||
{{A_MoveAbsolute}, "A_MOVEABSOLUTE"},
|
||||
{{A_Thrust}, "A_THRUST"},
|
||||
|
@ -3033,6 +3033,7 @@ static actionpointer_t actionpointers[] =
|
|||
{{A_DragonbomberSpawn}, "A_DRAGONBOMERSPAWN"},
|
||||
{{A_DragonWing}, "A_DRAGONWING"},
|
||||
{{A_DragonSegment}, "A_DRAGONSEGMENT"},
|
||||
{{A_ChangeHeight}, "A_CHANGEHEIGHT"},
|
||||
{{NULL}, "NONE"},
|
||||
|
||||
// This NULL entry must be the last in the list
|
||||
|
@ -3123,10 +3124,8 @@ static void readframe(MYFILE *f, INT32 num)
|
|||
}
|
||||
|
||||
z = 0;
|
||||
#ifdef HAVE_BLUA
|
||||
found = LUA_SetLuaAction(&states[num], actiontocompare);
|
||||
if (!found)
|
||||
#endif
|
||||
while (actionpointers[z].name)
|
||||
{
|
||||
if (fastcmp(actiontocompare, actionpointers[z].name))
|
||||
|
@ -3889,7 +3888,26 @@ static void readmaincfg(MYFILE *f)
|
|||
value = atoi(word2); // used for numerical settings
|
||||
|
||||
if (fastcmp(word, "EXECCFG"))
|
||||
{
|
||||
if (strchr(word2, '.'))
|
||||
COM_BufAddText(va("exec %s\n", word2));
|
||||
else
|
||||
{
|
||||
lumpnum_t lumpnum;
|
||||
char newname[9];
|
||||
|
||||
strncpy(newname, word2, 8);
|
||||
|
||||
newname[8] = '\0';
|
||||
|
||||
lumpnum = W_CheckNumForName(newname);
|
||||
|
||||
if (lumpnum == LUMPERROR || W_LumpLength(lumpnum) == 0)
|
||||
CONS_Debug(DBG_SETUP, "SOC Error: script lump %s not found/not valid.\n", newname);
|
||||
else
|
||||
COM_BufInsertText(W_CacheLumpNum(lumpnum, PU_CACHE));
|
||||
}
|
||||
}
|
||||
|
||||
else if (fastcmp(word, "SPSTAGE_START"))
|
||||
{
|
||||
|
@ -4131,6 +4149,10 @@ static void readmaincfg(MYFILE *f)
|
|||
{
|
||||
maxXtraLife = (UINT8)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "USECONTINUES"))
|
||||
{
|
||||
useContinues = (UINT8)(value || word2[0] == 'T' || word2[0] == 'Y');
|
||||
}
|
||||
|
||||
else if (fastcmp(word, "GAMEDATA"))
|
||||
{
|
||||
|
@ -6210,6 +6232,14 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
|
|||
"S_ROCKET",
|
||||
|
||||
"S_LASER",
|
||||
"S_LASER2",
|
||||
"S_LASERFLASH",
|
||||
|
||||
"S_LASERFLAME1",
|
||||
"S_LASERFLAME2",
|
||||
"S_LASERFLAME3",
|
||||
"S_LASERFLAME4",
|
||||
"S_LASERFLAME5",
|
||||
|
||||
"S_TORPEDO",
|
||||
|
||||
|
@ -8848,14 +8878,12 @@ static const char *const MOBJEFLAG_LIST[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
static const char *const MAPTHINGFLAG_LIST[4] = {
|
||||
"EXTRA", // Extra flag for objects.
|
||||
"OBJECTFLIP", // Reverse gravity flag for objects.
|
||||
"OBJECTSPECIAL", // Special flag used with certain objects.
|
||||
"AMBUSH" // Deaf monsters/do not react to sound.
|
||||
};
|
||||
#endif
|
||||
|
||||
static const char *const PLAYERFLAG_LIST[] = {
|
||||
|
||||
|
@ -8952,7 +8980,6 @@ static const char *const GAMETYPERULE_LIST[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// Linedef flags
|
||||
static const char *const ML_LIST[16] = {
|
||||
"IMPASSIBLE",
|
||||
|
@ -8972,7 +8999,6 @@ static const char *const ML_LIST[16] = {
|
|||
"BOUNCY",
|
||||
"TFERLINE"
|
||||
};
|
||||
#endif
|
||||
|
||||
// This DOES differ from r_draw's Color_Names, unfortunately.
|
||||
// Also includes Super colors
|
||||
|
@ -9145,7 +9171,11 @@ static const char *const POWERS_LIST[] = {
|
|||
|
||||
//for linedef exec 427
|
||||
"NOCONTROL",
|
||||
"JUSTLAUNCHED",
|
||||
|
||||
//for dyes
|
||||
"DYE",
|
||||
|
||||
"JUSTLAUNCHED"
|
||||
};
|
||||
|
||||
static const char *const HUDITEMS_LIST[] = {
|
||||
|
@ -9276,11 +9306,7 @@ static const char *const MENUTYPES_LIST[] = {
|
|||
struct {
|
||||
const char *n;
|
||||
// has to be able to hold both fixed_t and angle_t, so drastic measure!!
|
||||
#ifdef HAVE_BLUA
|
||||
lua_Integer v;
|
||||
#else
|
||||
INT64 v;
|
||||
#endif
|
||||
} const INT_CONST[] = {
|
||||
// If a mod removes some variables here,
|
||||
// please leave the names in-tact and just set
|
||||
|
@ -9489,6 +9515,7 @@ struct {
|
|||
{"SF_FASTEDGE",SF_FASTEDGE},
|
||||
{"SF_MULTIABILITY",SF_MULTIABILITY},
|
||||
{"SF_NONIGHTSROTATION",SF_NONIGHTSROTATION},
|
||||
{"SF_NONIGHTSSUPER",SF_NONIGHTSSUPER},
|
||||
|
||||
// Dashmode constants
|
||||
{"DASHMODE_THRESHOLD",DASHMODE_THRESHOLD},
|
||||
|
@ -9536,7 +9563,6 @@ struct {
|
|||
{"ME_ULTIMATE",ME_ULTIMATE},
|
||||
{"ME_PERFECT",ME_PERFECT},
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// p_local.h constants
|
||||
{"FLOATSPEED",FLOATSPEED},
|
||||
{"MAXSTEPMOVE",MAXSTEPMOVE},
|
||||
|
@ -9671,11 +9697,11 @@ struct {
|
|||
{"FF_CUTEXTRA",FF_CUTEXTRA}, ///< Cuts out hidden translucent pixels.
|
||||
{"FF_CUTLEVEL",FF_CUTLEVEL}, ///< Cuts out all hidden pixels.
|
||||
{"FF_CUTSPRITES",FF_CUTSPRITES}, ///< Final step in making 3D water.
|
||||
{"FF_BOTHPLANES",FF_BOTHPLANES}, ///< Renders both planes all the time.
|
||||
{"FF_BOTHPLANES",FF_BOTHPLANES}, ///< Render inside and outside planes.
|
||||
{"FF_EXTRA",FF_EXTRA}, ///< Gets cut by ::FF_CUTEXTRA.
|
||||
{"FF_TRANSLUCENT",FF_TRANSLUCENT}, ///< See through!
|
||||
{"FF_FOG",FF_FOG}, ///< Fog "brush."
|
||||
{"FF_INVERTPLANES",FF_INVERTPLANES}, ///< Reverse the plane visibility rules.
|
||||
{"FF_INVERTPLANES",FF_INVERTPLANES}, ///< Only render inside planes.
|
||||
{"FF_ALLSIDES",FF_ALLSIDES}, ///< Render inside and outside sides.
|
||||
{"FF_INVERTSIDES",FF_INVERTSIDES}, ///< Only render inside sides.
|
||||
{"FF_DOUBLESHADOW",FF_DOUBLESHADOW}, ///< Make two lightlist entries to reset light?
|
||||
|
@ -9701,11 +9727,10 @@ struct {
|
|||
// Node flags
|
||||
{"NF_SUBSECTOR",NF_SUBSECTOR}, // Indicate a leaf.
|
||||
#endif
|
||||
#ifdef ESLOPE
|
||||
|
||||
// Slope flags
|
||||
{"SL_NOPHYSICS",SL_NOPHYSICS},
|
||||
{"SL_DYNAMIC",SL_DYNAMIC},
|
||||
#endif
|
||||
|
||||
// Angles
|
||||
{"ANG1",ANG1},
|
||||
|
@ -9869,7 +9894,6 @@ struct {
|
|||
{"TC_RAINBOW",TC_RAINBOW},
|
||||
{"TC_BLINK",TC_BLINK},
|
||||
{"TC_DASHMODE",TC_DASHMODE},
|
||||
#endif
|
||||
|
||||
{NULL,0}
|
||||
};
|
||||
|
@ -10026,8 +10050,7 @@ static menutype_t get_menutype(const char *word)
|
|||
return MN_NONE;
|
||||
}
|
||||
|
||||
#ifndef HAVE_BLUA
|
||||
static INT16 get_gametype(const char *word)
|
||||
/*static INT16 get_gametype(const char *word)
|
||||
{ // Returns the value of GT_ enumerations
|
||||
INT16 i;
|
||||
if (*word >= '0' && *word <= '9')
|
||||
|
@ -10053,7 +10076,7 @@ static powertype_t get_power(const char *word)
|
|||
return i;
|
||||
deh_warning("Couldn't find power named 'pw_%s'",word);
|
||||
return pw_invulnerability;
|
||||
}
|
||||
}*/
|
||||
|
||||
/// \todo Make ANY of this completely over-the-top math craziness obey the order of operations.
|
||||
static fixed_t op_mul(fixed_t a, fixed_t b) { return a*b; }
|
||||
|
@ -10081,7 +10104,7 @@ struct {
|
|||
};
|
||||
|
||||
// Returns the full word, cut at the first symbol or whitespace
|
||||
static char *read_word(const char *line)
|
||||
/*static char *read_word(const char *line)
|
||||
{
|
||||
// Part 1: You got the start of the word, now find the end.
|
||||
const char *p;
|
||||
|
@ -10241,7 +10264,7 @@ static fixed_t find_const(const char **rword)
|
|||
free(word);
|
||||
return r;
|
||||
}
|
||||
else if (fastncmp("GT_",word,4)) {
|
||||
else if (fastncmp("GT_",word,3)) {
|
||||
r = get_gametype(word);
|
||||
free(word);
|
||||
return r;
|
||||
|
@ -10311,16 +10334,14 @@ static fixed_t find_const(const char **rword)
|
|||
const_warning("constant",word);
|
||||
free(word);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}*/
|
||||
|
||||
// Loops through every constant and operation in word and performs its calculations, returning the final value.
|
||||
fixed_t get_number(const char *word)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
return LUA_EvalMath(word);
|
||||
#else
|
||||
// DESPERATELY NEEDED: Order of operations support! :x
|
||||
|
||||
/*// DESPERATELY NEEDED: Order of operations support! :x
|
||||
fixed_t i = find_const(&word);
|
||||
INT32 o;
|
||||
while(*word) {
|
||||
|
@ -10330,8 +10351,7 @@ fixed_t get_number(const char *word)
|
|||
else
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
#endif
|
||||
return i;*/
|
||||
}
|
||||
|
||||
void DEH_Check(void)
|
||||
|
@ -10356,7 +10376,6 @@ void DEH_Check(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
|
||||
|
@ -10982,5 +11001,3 @@ void LUA_SetActionByName(void *state, const char *actiontocompare)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HAVE_BLUA
|
||||
|
|
|
@ -34,11 +34,9 @@ void DEH_Check(void);
|
|||
|
||||
fixed_t get_number(const char *word);
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
boolean LUA_SetLuaAction(void *state, const char *actiontocompare);
|
||||
const char *LUA_GetActionName(void *action);
|
||||
void LUA_SetActionByName(void *state, const char *actiontocompare);
|
||||
#endif
|
||||
|
||||
extern boolean deh_loaded;
|
||||
|
||||
|
|
|
@ -339,7 +339,4 @@ void I_StartupGraphics(void)
|
|||
|
||||
}
|
||||
|
||||
void I_StartupHardwareGraphics(void)
|
||||
{
|
||||
// oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo yeah oh yeah woo y
|
||||
}
|
||||
void VID_StartupOpenGL(void) {}
|
||||
|
|
|
@ -378,10 +378,8 @@ INT32 VID_SetMode (INT32 modenum) //, UINT8 *palette)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
// ..............
|
||||
}
|
||||
void VID_CheckRenderer(void) {}
|
||||
void VID_CheckGLLoaded(rendermode_t oldrender) {}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -143,13 +143,16 @@ extern char logfilename[1024];
|
|||
// we use comprevision and compbranch instead.
|
||||
#else
|
||||
#define VERSION 202 // Game version
|
||||
#define SUBVERSION 2 // more precise version number
|
||||
#define VERSIONSTRING "v2.2.2"
|
||||
#define VERSIONSTRINGW L"v2.2.2"
|
||||
#define SUBVERSION 3 // more precise version number
|
||||
#define VERSIONSTRING "v2.2.3"
|
||||
#define VERSIONSTRINGW L"v2.2.3"
|
||||
// Hey! If you change this, add 1 to the MODVERSION below!
|
||||
// Otherwise we can't force updates!
|
||||
#endif
|
||||
|
||||
/* A custom URL protocol for server links. */
|
||||
#define SERVER_URL_PROTOCOL "srb2://"
|
||||
|
||||
// Does this version require an added patch file?
|
||||
// Comment or uncomment this as necessary.
|
||||
#define USE_PATCH_DTA
|
||||
|
@ -210,7 +213,7 @@ extern char logfilename[1024];
|
|||
// it's only for detection of the version the player is using so the MS can alert them of an update.
|
||||
// Only set it higher, not lower, obviously.
|
||||
// Note that we use this to help keep internal testing in check; this is why v2.2.0 is not version "1".
|
||||
#define MODVERSION 42
|
||||
#define MODVERSION 43
|
||||
|
||||
// To version config.cfg, MAJOREXECVERSION is set equal to MODVERSION automatically.
|
||||
// Increment MINOREXECVERSION whenever a config change is needed that does not correspond
|
||||
|
@ -562,14 +565,9 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
// None of these that are disabled in the normal build are guaranteed to work perfectly
|
||||
// Compile them at your own risk!
|
||||
|
||||
/// Kalaron/Eternity Engine slope code (SRB2CB ported)
|
||||
#define ESLOPE
|
||||
|
||||
#ifdef ESLOPE
|
||||
/// Backwards compatibility with SRB2CB's slope linedef types.
|
||||
/// \note A simple shim that prints a warning.
|
||||
#define ESLOPE_TYPESHIM
|
||||
#endif
|
||||
|
||||
/// Allows the use of devmode in multiplayer. AKA "fishcake"
|
||||
//#define NETGAME_DEVMODE
|
||||
|
@ -580,9 +578,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
/// Dumps the contents of a network save game upon consistency failure for debugging.
|
||||
//#define DUMPCONSISTENCY
|
||||
|
||||
/// Polyobject fake flat code
|
||||
#define POLYOBJECTS_PLANES
|
||||
|
||||
/// See name of player in your crosshair
|
||||
#define SEENAMES
|
||||
|
||||
|
|
|
@ -319,6 +319,9 @@ typedef struct
|
|||
|
||||
char selectheading[22]; ///< Level select heading. Allows for controllable grouping.
|
||||
UINT16 startrings; ///< Number of rings players start with.
|
||||
INT32 sstimer; ///< Timer for special stages.
|
||||
UINT32 ssspheres; ///< Sphere requirement in special stages.
|
||||
fixed_t gravity; ///< Map-wide gravity.
|
||||
|
||||
// Title card.
|
||||
char ltzzpatch[8]; ///< Zig zag patch.
|
||||
|
@ -493,7 +496,6 @@ extern UINT16 emeralds;
|
|||
#define EMERALD7 64
|
||||
#define ALL7EMERALDS(v) ((v & (EMERALD1|EMERALD2|EMERALD3|EMERALD4|EMERALD5|EMERALD6|EMERALD7)) == (EMERALD1|EMERALD2|EMERALD3|EMERALD4|EMERALD5|EMERALD6|EMERALD7))
|
||||
|
||||
// yes, even in non HAVE_BLUA
|
||||
#define NUM_LUABANKS 16 // please only make this number go up between versions, never down. you'll break saves otherwise. also, must fit in UINT8
|
||||
extern INT32 luabanks[NUM_LUABANKS];
|
||||
|
||||
|
@ -576,6 +578,8 @@ extern UINT8 creditscutscene;
|
|||
|
||||
extern UINT8 use1upSound;
|
||||
extern UINT8 maxXtraLife; // Max extra lives from rings
|
||||
extern UINT8 useContinues;
|
||||
#define continuesInSession (!multiplayer && (useContinues || ultimatemode || !(cursaveslot > 0)))
|
||||
|
||||
extern mobj_t *hunt1, *hunt2, *hunt3; // Emerald hunt locations
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ boolean allow_fullscreen = false;
|
|||
consvar_t cv_vidwait = {"vid_wait", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
void I_StartupGraphics(void){}
|
||||
void I_StartupHardwareGraphics(void){}
|
||||
|
||||
void I_ShutdownGraphics(void){}
|
||||
|
||||
void VID_StartupOpenGL(void){}
|
||||
|
||||
void I_SetPalette(RGBA_t *palette)
|
||||
{
|
||||
(void)palette;
|
||||
|
@ -40,10 +40,8 @@ INT32 VID_SetMode(INT32 modenum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void VID_CheckRenderer(void)
|
||||
{
|
||||
// ..............
|
||||
}
|
||||
void VID_CheckRenderer(void) {}
|
||||
void VID_CheckGLLoaded(rendermode_t oldrender) {}
|
||||
|
||||
const char *VID_GetModeName(INT32 modenum)
|
||||
{
|
||||
|
|
|
@ -39,9 +39,7 @@
|
|||
#include "fastcmp.h"
|
||||
#include "console.h"
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
#include "lua_hud.h"
|
||||
#endif
|
||||
|
||||
// Stage of animation:
|
||||
// 0 = text, 1 = art screen
|
||||
|
@ -2762,11 +2760,7 @@ void F_TitleScreenDrawer(void)
|
|||
// rei|miru: use title pics?
|
||||
hidepics = curhidepics;
|
||||
if (hidepics)
|
||||
#ifdef HAVE_BLUA
|
||||
goto luahook;
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
|
||||
switch(curttmode)
|
||||
{
|
||||
|
@ -3488,10 +3482,8 @@ void F_TitleScreenDrawer(void)
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
luahook:
|
||||
LUAh_TitleHUD();
|
||||
#endif
|
||||
}
|
||||
|
||||
// separate animation timer for backgrounds, since we also count
|
||||
|
@ -3626,7 +3618,7 @@ void F_StartContinue(void)
|
|||
{
|
||||
I_Assert(!netgame && !multiplayer);
|
||||
|
||||
if (players[consoleplayer].continues <= 0)
|
||||
if (continuesInSession && players[consoleplayer].continues <= 0)
|
||||
{
|
||||
Command_ExitGame_f();
|
||||
return;
|
||||
|
@ -3733,7 +3725,9 @@ void F_ContinueDrawer(void)
|
|||
}
|
||||
|
||||
// Draw the continue markers! Show continues.
|
||||
if (ncontinues > 10)
|
||||
if (!continuesInSession)
|
||||
;
|
||||
else if (ncontinues > 10)
|
||||
{
|
||||
if (!(continuetime & 1) || continuetime > 17)
|
||||
V_DrawContinueIcon(x, 68, 0, players[consoleplayer].skin, players[consoleplayer].skincolor);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "i_video.h"
|
||||
#include "v_video.h"
|
||||
|
||||
#include "r_state.h" // fadecolormap
|
||||
#include "r_draw.h" // transtable
|
||||
#include "p_pspr.h" // tr_transxxx
|
||||
#include "p_local.h"
|
||||
|
@ -32,9 +33,7 @@
|
|||
|
||||
#include "doomstat.h"
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
#include "lua_hud.h" // level title
|
||||
#endif
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_main.h"
|
||||
|
|
|
@ -60,7 +60,7 @@ typedef enum
|
|||
#endif
|
||||
EXT_PK3,
|
||||
EXT_SOC,
|
||||
EXT_LUA, // allowed even if not HAVE_BLUA so that we can yell on load attempt
|
||||
EXT_LUA,
|
||||
NUM_EXT,
|
||||
NUM_EXT_TABLE = NUM_EXT-EXT_START,
|
||||
EXT_LOADED = 0x80
|
||||
|
|
2501
src/g_demo.c
Normal file
2501
src/g_demo.c
Normal file
File diff suppressed because it is too large
Load diff
86
src/g_demo.h
Normal file
86
src/g_demo.h
Normal 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__
|
2537
src/g_game.c
2537
src/g_game.c
File diff suppressed because it is too large
Load diff
67
src/g_game.h
67
src/g_game.h
|
@ -17,6 +17,7 @@
|
|||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "d_event.h"
|
||||
#include "g_demo.h"
|
||||
|
||||
extern char gamedatafilename[64];
|
||||
extern char timeattackfolder[64];
|
||||
|
@ -31,21 +32,6 @@ extern char player_names[MAXPLAYERS][MAXPLAYERNAME+1];
|
|||
extern player_t players[MAXPLAYERS];
|
||||
extern boolean playeringame[MAXPLAYERS];
|
||||
|
||||
// ======================================
|
||||
// DEMO playback/recording related stuff.
|
||||
// ======================================
|
||||
|
||||
// demoplaying back and demo recording
|
||||
extern boolean demoplayback, titledemo, demorecording, timingdemo;
|
||||
extern tic_t demostarttime;
|
||||
|
||||
// Quit after playing a demo from cmdline.
|
||||
extern boolean singledemo;
|
||||
extern boolean demo_start;
|
||||
extern boolean demosynced;
|
||||
|
||||
extern mobj_t *metalplayback;
|
||||
|
||||
// gametic at level start
|
||||
extern tic_t levelstarttic;
|
||||
|
||||
|
@ -173,7 +159,6 @@ void G_DoLoadLevel(boolean resetplayer);
|
|||
void G_StartTitleCard(void);
|
||||
void G_PreLevelTitleCard(void);
|
||||
boolean G_IsTitleCardAvailable(void);
|
||||
void G_DeferedPlayDemo(const char *demo);
|
||||
|
||||
// Can be called by the startup code or M_Responder, calls P_SetupLevel.
|
||||
void G_LoadGame(UINT32 slot, INT16 mapoverride);
|
||||
|
@ -184,54 +169,6 @@ void G_SaveGame(UINT32 slot);
|
|||
|
||||
void G_SaveGameOver(UINT32 slot, boolean modifylives);
|
||||
|
||||
// Only called by startup code.
|
||||
void G_RecordDemo(const char *name);
|
||||
void G_RecordMetal(void);
|
||||
void G_BeginRecording(void);
|
||||
void G_BeginMetal(void);
|
||||
|
||||
// Only called by shutdown code.
|
||||
void G_SetDemoTime(UINT32 ptime, UINT32 pscore, UINT16 prings);
|
||||
UINT8 G_CmpDemoTime(char *oldname, char *newname);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GHC_NORMAL = 0,
|
||||
GHC_SUPER,
|
||||
GHC_FIREFLOWER,
|
||||
GHC_INVINCIBLE,
|
||||
GHC_NIGHTSSKIN, // not actually a colour
|
||||
GHC_RETURNSKIN // ditto
|
||||
} ghostcolor_t;
|
||||
|
||||
// Record/playback tics
|
||||
void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum);
|
||||
void G_WriteDemoTiccmd(ticcmd_t *cmd, INT32 playernum);
|
||||
void G_GhostAddThok(void);
|
||||
void G_GhostAddSpin(void);
|
||||
void G_GhostAddRev(void);
|
||||
void G_GhostAddColor(ghostcolor_t color);
|
||||
void G_GhostAddFlip(void);
|
||||
void G_GhostAddScale(fixed_t scale);
|
||||
void G_GhostAddHit(mobj_t *victim);
|
||||
void G_WriteGhostTic(mobj_t *ghost);
|
||||
void G_ConsGhostTic(void);
|
||||
void G_GhostTicker(void);
|
||||
void G_ReadMetalTic(mobj_t *metal);
|
||||
void G_WriteMetalTic(mobj_t *metal);
|
||||
void G_SaveMetal(UINT8 **buffer);
|
||||
void G_LoadMetal(UINT8 **buffer);
|
||||
|
||||
void G_DoPlayDemo(char *defdemoname);
|
||||
void G_TimeDemo(const char *name);
|
||||
void G_AddGhost(char *defdemoname);
|
||||
void G_DoPlayMetal(void);
|
||||
void G_DoneLevelLoad(void);
|
||||
void G_StopMetalDemo(void);
|
||||
ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(boolean kill);
|
||||
void G_StopDemo(void);
|
||||
boolean G_CheckDemoStatus(void);
|
||||
|
||||
extern UINT32 gametypedefaultrules[NUMGAMETYPES];
|
||||
extern UINT32 gametypetol[NUMGAMETYPES];
|
||||
extern INT16 gametyperankings[NUMGAMETYPES];
|
||||
|
@ -309,6 +246,6 @@ FUNCMATH INT32 G_TicsToCentiseconds(tic_t tics);
|
|||
FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics);
|
||||
|
||||
// Don't split up TOL handling
|
||||
INT16 G_TOLFlag(INT32 pgametype);
|
||||
UINT32 G_TOLFlag(INT32 pgametype);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "../tables.h"
|
||||
#include "../sounds.h"
|
||||
#include "../r_main.h"
|
||||
#include "../r_things.h"
|
||||
#include "../r_skins.h"
|
||||
#include "../m_random.h"
|
||||
#include "../p_local.h"
|
||||
#include "hw3dsdrv.h"
|
||||
|
|
|
@ -887,12 +887,10 @@ static void AdjustSegs(void)
|
|||
float distv1,distv2,tmp;
|
||||
nearv1 = nearv2 = MYMAX;
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// Don't touch polyobject segs. We'll compensate
|
||||
// for this when we go about drawing them.
|
||||
if (lseg->polyseg)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
if (p) {
|
||||
for (j = 0; j < p->numpts; j++)
|
||||
|
|
|
@ -234,11 +234,11 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
|
|||
if (mipmap->colormap)
|
||||
texel = mipmap->colormap[texel];
|
||||
|
||||
// transparent pixel
|
||||
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX)
|
||||
alpha = 0x00;
|
||||
else
|
||||
// If the mipmap is chromakeyed, check if the texel's color
|
||||
// is equivalent to the chroma key's color index.
|
||||
alpha = 0xff;
|
||||
if ((mipmap->flags & TF_CHROMAKEYED) && (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX))
|
||||
alpha = 0x00;
|
||||
|
||||
// hope compiler will get this switch out of the loops (dreams...)
|
||||
// gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?)
|
||||
|
|
|
@ -291,7 +291,7 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
|||
if (cx >= -0.1f && cx <= 0.1f && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT)
|
||||
{
|
||||
// Need to temporarily cache the real patch to get the colour of the top left pixel
|
||||
patch_t *realpatch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
patch_t *realpatch = W_CacheSoftwarePatchNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
const column_t *column = (const column_t *)((const UINT8 *)(realpatch) + LONG((realpatch)->columnofs[0]));
|
||||
if (!column->topdelta)
|
||||
{
|
||||
|
@ -450,7 +450,7 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
|||
if (cx >= -0.1f && cx <= 0.1f && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT)
|
||||
{
|
||||
// Need to temporarily cache the real patch to get the colour of the top left pixel
|
||||
patch_t *realpatch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
patch_t *realpatch = W_CacheSoftwarePatchNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
const column_t *column = (const column_t *)((const UINT8 *)(realpatch) + LONG((realpatch)->columnofs[0]));
|
||||
if (!column->topdelta)
|
||||
{
|
||||
|
|
|
@ -298,6 +298,8 @@ light_t *t_lspr[NUMSPRITES] =
|
|||
|
||||
// Projectiles
|
||||
&lspr[NOLIGHT], // SPR_MISL
|
||||
&lspr[SMALLREDBALL_L], // SPR_LASR
|
||||
&lspr[REDSHINE_L], // SPR_LASF
|
||||
&lspr[NOLIGHT], // SPR_TORP
|
||||
&lspr[NOLIGHT], // SPR_ENRG
|
||||
&lspr[NOLIGHT], // SPR_MINE
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1221,7 +1221,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false); // Always use the light at the top instead of whatever I was doing before
|
||||
|
||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||
lightlevel = *sector->lightlist[light].lightlevel;
|
||||
lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel;
|
||||
|
||||
if (*sector->lightlist[light].extra_colormap)
|
||||
colormap = *sector->lightlist[light].extra_colormap;
|
||||
|
@ -1229,7 +1229,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
else
|
||||
{
|
||||
if (!(spr->mobj->frame & FF_FULLBRIGHT))
|
||||
lightlevel = sector->lightlevel;
|
||||
lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel;
|
||||
|
||||
if (sector->extra_colormap)
|
||||
colormap = sector->extra_colormap;
|
||||
|
@ -1478,7 +1478,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
|
||||
// rotation pivot
|
||||
p.centerx = FIXED_TO_FLOAT(spr->mobj->radius/2);
|
||||
p.centery = FIXED_TO_FLOAT(spr->mobj->height/2);
|
||||
p.centery = FIXED_TO_FLOAT(spr->mobj->height/(flip ? -2 : 2));
|
||||
|
||||
// rotation axis
|
||||
if (sprinfo->available)
|
||||
|
@ -1490,6 +1490,9 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
p.rollflip = 1;
|
||||
else if ((sprframe->rotate & SRF_LEFT) && (ang >= ANGLE_180)) // See from left
|
||||
p.rollflip = -1;
|
||||
|
||||
if (flip)
|
||||
p.rollflip *= -1;
|
||||
}
|
||||
|
||||
p.anglex = 0.0f;
|
||||
|
|
|
@ -610,10 +610,8 @@ static boolean isCeilingFloating(sector_t *thisSector)
|
|||
if (!adjSector) // assume floating sectors have surrounding sectors
|
||||
return false;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (adjSector->c_slope) // Don't bother with slopes
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if (!refSector)
|
||||
{
|
||||
|
@ -663,10 +661,8 @@ static boolean isFloorFloating(sector_t *thisSector)
|
|||
if (!adjSector) // assume floating sectors have surrounding sectors
|
||||
return false;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (adjSector->f_slope) // Don't bother with slopes
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if (!refSector)
|
||||
{
|
||||
|
|
|
@ -49,8 +49,7 @@ static const GLubyte white[4] = { 255, 255, 255, 255 };
|
|||
// ==========================================================================
|
||||
|
||||
// With OpenGL 1.1+, the first texture should be 1
|
||||
#define NOTEXTURE_NUM 1 // small white texture
|
||||
#define FIRST_TEX_AVAIL (NOTEXTURE_NUM + 1)
|
||||
static GLuint NOTEXTURE_NUM = 0;
|
||||
|
||||
#define N_PI_DEMI (M_PIl/2.0f) //(1.5707963268f)
|
||||
|
||||
|
@ -63,7 +62,6 @@ static float NEAR_CLIPPING_PLANE = NZCLIP_PLANE;
|
|||
// **************************************************************************
|
||||
|
||||
|
||||
static GLuint NextTexAvail = FIRST_TEX_AVAIL;
|
||||
static GLuint tex_downloaded = 0;
|
||||
static GLfloat fov = 90.0f;
|
||||
#if 0
|
||||
|
@ -94,16 +92,10 @@ static GLfloat modelMatrix[16];
|
|||
static GLfloat projMatrix[16];
|
||||
static GLint viewport[4];
|
||||
|
||||
// Yay for arbitrary numbers! NextTexAvail is buggy for some reason.
|
||||
// Sryder: NextTexAvail is broken for these because palette changes or changes to the texture filter or antialiasing
|
||||
// flush all of the stored textures, leaving them unavailable at times such as between levels
|
||||
// These need to start at 0 and be set to their number, and be reset to 0 when deleted so that intel GPUs
|
||||
// can know when the textures aren't there, as textures are always considered resident in their virtual memory
|
||||
// TODO: Store them in a more normal way
|
||||
#define SCRTEX_SCREENTEXTURE 4294967295U
|
||||
#define SCRTEX_STARTSCREENWIPE 4294967294U
|
||||
#define SCRTEX_ENDSCREENWIPE 4294967293U
|
||||
#define SCRTEX_FINALSCREENTEXTURE 4294967292U
|
||||
static GLuint screentexture = 0;
|
||||
static GLuint startScreenWipe = 0;
|
||||
static GLuint endScreenWipe = 0;
|
||||
|
@ -243,6 +235,7 @@ FUNCPRINTF void DBG_Printf(const char *lpFmt, ...)
|
|||
|
||||
/* 1.1 functions */
|
||||
/* texture objects */ //GL_EXT_texture_object
|
||||
#define pglGenTextures glGenTextures
|
||||
#define pglDeleteTextures glDeleteTextures
|
||||
#define pglBindTexture glBindTexture
|
||||
/* texture mapping */ //GL_EXT_copy_texture
|
||||
|
@ -359,6 +352,8 @@ static PFNglFogfv pglFogfv;
|
|||
|
||||
/* 1.1 functions */
|
||||
/* texture objects */ //GL_EXT_texture_object
|
||||
typedef void (APIENTRY * PFNglGenTextures) (GLsizei n, const GLuint *textures);
|
||||
static PFNglGenTextures pglGenTextures;
|
||||
typedef void (APIENTRY * PFNglDeleteTextures) (GLsizei n, const GLuint *textures);
|
||||
static PFNglDeleteTextures pglDeleteTextures;
|
||||
typedef void (APIENTRY * PFNglBindTexture) (GLenum target, GLuint texture);
|
||||
|
@ -487,6 +482,7 @@ boolean SetupGLfunc(void)
|
|||
GETOPENGLFUNC(pglFogf , glFogf)
|
||||
GETOPENGLFUNC(pglFogfv , glFogfv)
|
||||
|
||||
GETOPENGLFUNC(pglGenTextures , glGenTextures)
|
||||
GETOPENGLFUNC(pglDeleteTextures , glDeleteTextures)
|
||||
GETOPENGLFUNC(pglBindTexture , glBindTexture)
|
||||
|
||||
|
@ -527,6 +523,8 @@ static void SetNoTexture(void)
|
|||
// Set small white texture.
|
||||
if (tex_downloaded != NOTEXTURE_NUM)
|
||||
{
|
||||
if (NOTEXTURE_NUM == 0)
|
||||
pglGenTextures(1, &NOTEXTURE_NUM);
|
||||
pglBindTexture(GL_TEXTURE_2D, NOTEXTURE_NUM);
|
||||
tex_downloaded = NOTEXTURE_NUM;
|
||||
}
|
||||
|
@ -641,11 +639,6 @@ void SetModelView(GLint w, GLint h)
|
|||
// -----------------+
|
||||
void SetStates(void)
|
||||
{
|
||||
// Bind little white RGBA texture to ID NOTEXTURE_NUM.
|
||||
/*
|
||||
FUINT Data[8*8];
|
||||
INT32 i;
|
||||
*/
|
||||
#ifdef GL_LIGHT_MODEL_AMBIENT
|
||||
GLfloat LightDiffuse[] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
#endif
|
||||
|
@ -679,16 +672,8 @@ void SetStates(void)
|
|||
CurrentPolyFlags = 0xffffffff;
|
||||
SetBlend(0);
|
||||
|
||||
/*
|
||||
for (i = 0; i < 64; i++)
|
||||
Data[i] = 0xffFFffFF; // white pixel
|
||||
*/
|
||||
|
||||
tex_downloaded = (GLuint)-1;
|
||||
tex_downloaded = 0;
|
||||
SetNoTexture();
|
||||
//pglBindTexture(GL_TEXTURE_2D, NOTEXTURE_NUM);
|
||||
//tex_downloaded = NOTEXTURE_NUM;
|
||||
//pglTexImage2D(GL_TEXTURE_2D, 0, 4, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, Data);
|
||||
|
||||
pglPolygonOffset(-1.0f, -1.0f);
|
||||
|
||||
|
@ -723,33 +708,12 @@ void Flush(void)
|
|||
|
||||
while (gr_cachehead)
|
||||
{
|
||||
// this is not necessary at all, because you have loaded them normally,
|
||||
// and so they already are in your list!
|
||||
#if 0
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
FTextureInfo *tmp = gr_cachehead->nextskin;
|
||||
|
||||
// The memory should be freed in the main code
|
||||
while (tmp)
|
||||
{
|
||||
pglDeleteTextures(1, &tmp->downloaded);
|
||||
tmp->downloaded = 0;
|
||||
tmp = tmp->nextcolormap;
|
||||
}
|
||||
#endif
|
||||
if (gr_cachehead->downloaded)
|
||||
pglDeleteTextures(1, (GLuint *)&gr_cachehead->downloaded);
|
||||
gr_cachehead->downloaded = 0;
|
||||
gr_cachehead = gr_cachehead->nextmipmap;
|
||||
}
|
||||
gr_cachetail = gr_cachehead = NULL; //Hurdler: well, gr_cachehead is already NULL
|
||||
NextTexAvail = FIRST_TEX_AVAIL;
|
||||
#if 0
|
||||
if (screentexture != FIRST_TEX_AVAIL)
|
||||
{
|
||||
pglDeleteTextures(1, &screentexture);
|
||||
screentexture = FIRST_TEX_AVAIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
tex_downloaded = 0;
|
||||
}
|
||||
|
@ -1128,8 +1092,10 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
|
|||
static RGBA_t tex[2048*2048];
|
||||
const GLvoid *ptex = tex;
|
||||
INT32 w, h;
|
||||
GLuint texnum = 0;
|
||||
|
||||
//DBG_Printf ("DownloadMipmap %d %x\n",NextTexAvail,pTexInfo->grInfo.data);
|
||||
pglGenTextures(1, &texnum);
|
||||
//DBG_Printf ("DownloadMipmap %d %x\n",(INT32)texnum,pTexInfo->grInfo.data);
|
||||
|
||||
w = pTexInfo->width;
|
||||
h = pTexInfo->height;
|
||||
|
@ -1217,9 +1183,10 @@ EXPORT void HWRAPI(SetTexture) (FTextureInfo *pTexInfo)
|
|||
else
|
||||
DBG_Printf ("SetTexture(bad format) %ld\n", pTexInfo->grInfo.format);
|
||||
|
||||
pTexInfo->downloaded = NextTexAvail++;
|
||||
tex_downloaded = pTexInfo->downloaded;
|
||||
pglBindTexture(GL_TEXTURE_2D, pTexInfo->downloaded);
|
||||
// the texture number was already generated by pglGenTextures
|
||||
pglBindTexture(GL_TEXTURE_2D, texnum);
|
||||
pTexInfo->downloaded = texnum;
|
||||
tex_downloaded = texnum;
|
||||
|
||||
// disable texture filtering on any texture that has holes so there's no dumb borders or blending issues
|
||||
if (pTexInfo->flags & TF_TRANSPARENT)
|
||||
|
@ -2419,7 +2386,7 @@ EXPORT void HWRAPI(StartScreenWipe) (void)
|
|||
|
||||
// Create screen texture
|
||||
if (firstTime)
|
||||
startScreenWipe = SCRTEX_STARTSCREENWIPE;
|
||||
pglGenTextures(1, &startScreenWipe);
|
||||
pglBindTexture(GL_TEXTURE_2D, startScreenWipe);
|
||||
|
||||
if (firstTime)
|
||||
|
@ -2450,7 +2417,7 @@ EXPORT void HWRAPI(EndScreenWipe)(void)
|
|||
|
||||
// Create screen texture
|
||||
if (firstTime)
|
||||
endScreenWipe = SCRTEX_ENDSCREENWIPE;
|
||||
pglGenTextures(1, &endScreenWipe);
|
||||
pglBindTexture(GL_TEXTURE_2D, endScreenWipe);
|
||||
|
||||
if (firstTime)
|
||||
|
@ -2621,7 +2588,7 @@ EXPORT void HWRAPI(MakeScreenTexture) (void)
|
|||
|
||||
// Create screen texture
|
||||
if (firstTime)
|
||||
screentexture = SCRTEX_SCREENTEXTURE;
|
||||
pglGenTextures(1, &screentexture);
|
||||
pglBindTexture(GL_TEXTURE_2D, screentexture);
|
||||
|
||||
if (firstTime)
|
||||
|
@ -2651,7 +2618,7 @@ EXPORT void HWRAPI(MakeScreenFinalTexture) (void)
|
|||
|
||||
// Create screen texture
|
||||
if (firstTime)
|
||||
finalScreenTexture = SCRTEX_FINALSCREENTEXTURE;
|
||||
pglGenTextures(1, &finalScreenTexture);
|
||||
pglBindTexture(GL_TEXTURE_2D, finalScreenTexture);
|
||||
|
||||
if (firstTime)
|
||||
|
|
|
@ -47,10 +47,8 @@
|
|||
#include "hardware/hw_main.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
#include "lua_hud.h"
|
||||
#include "lua_hook.h"
|
||||
#endif
|
||||
|
||||
// coords are scaled
|
||||
#define HU_INPUTX 0
|
||||
|
@ -688,10 +686,8 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
|||
|
||||
// run the lua hook even if we were supposed to eat the msg, netgame consistency goes first.
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUAh_PlayerMsg(playernum, target, flags, msg))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (spam_eatmsg)
|
||||
return; // don't proceed if we were supposed to eat the message.
|
||||
|
@ -787,10 +783,12 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
|||
case SKINCOLOR_RED:
|
||||
case SKINCOLOR_CRIMSON:
|
||||
case SKINCOLOR_FLAME:
|
||||
case SKINCOLOR_KETCHUP:
|
||||
cstart = "\x85"; // V_REDMAP
|
||||
break;
|
||||
case SKINCOLOR_YOGURT:
|
||||
case SKINCOLOR_BROWN:
|
||||
case SKINCOLOR_BRONZE:
|
||||
case SKINCOLOR_TAN:
|
||||
case SKINCOLOR_BEIGE:
|
||||
case SKINCOLOR_QUAIL:
|
||||
|
@ -818,6 +816,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
|||
cstart = "\x8e"; // V_ROSYMAP
|
||||
break;
|
||||
case SKINCOLOR_SUNSET:
|
||||
case SKINCOLOR_COPPER:
|
||||
case SKINCOLOR_APRICOT:
|
||||
case SKINCOLOR_ORANGE:
|
||||
case SKINCOLOR_RUST:
|
||||
|
@ -831,6 +830,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
|||
break;
|
||||
case SKINCOLOR_LIME:
|
||||
case SKINCOLOR_PERIDOT:
|
||||
case SKINCOLOR_APPLE:
|
||||
cstart = "\x8b"; // V_PERIDOTMAP
|
||||
break;
|
||||
case SKINCOLOR_SEAFOAM:
|
||||
|
@ -851,12 +851,14 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
|||
case SKINCOLOR_BLUE:
|
||||
case SKINCOLOR_COBALT:
|
||||
case SKINCOLOR_DUSK:
|
||||
case SKINCOLOR_BLUEBELL:
|
||||
cstart = "\x84"; // V_BLUEMAP
|
||||
break;
|
||||
case SKINCOLOR_BUBBLEGUM:
|
||||
case SKINCOLOR_MAGENTA:
|
||||
case SKINCOLOR_NEON:
|
||||
case SKINCOLOR_VIOLET:
|
||||
case SKINCOLOR_RASPBERRY:
|
||||
cstart = "\x81"; // V_MAGENTAMAP
|
||||
break;
|
||||
}
|
||||
|
@ -2171,18 +2173,14 @@ void HU_Drawer(void)
|
|||
{
|
||||
if (netgame || multiplayer)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_HudEnabled(hud_rankings))
|
||||
#endif
|
||||
HU_DrawRankings();
|
||||
if (gametype == GT_COOP)
|
||||
HU_DrawNetplayCoopOverlay();
|
||||
}
|
||||
else
|
||||
HU_DrawCoopOverlay();
|
||||
#ifdef HAVE_BLUA
|
||||
LUAh_ScoresHUD();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (gamestate != GS_LEVEL)
|
||||
|
@ -3165,29 +3163,20 @@ static void HU_DrawRankings(void)
|
|||
|
||||
static void HU_DrawCoopOverlay(void)
|
||||
{
|
||||
if (token
|
||||
#ifdef HAVE_BLUA
|
||||
&& LUA_HudEnabled(hud_tokens)
|
||||
#endif
|
||||
)
|
||||
if (token && LUA_HudEnabled(hud_tokens))
|
||||
{
|
||||
V_DrawString(168, 176, 0, va("- %d", token));
|
||||
V_DrawSmallScaledPatch(148, 172, 0, tokenicon);
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_HudEnabled(hud_tabemblems))
|
||||
#endif
|
||||
if (!modifiedgame || savemoddata)
|
||||
if (LUA_HudEnabled(hud_tabemblems) && (!modifiedgame || savemoddata))
|
||||
{
|
||||
V_DrawString(160, 144, 0, va("- %d/%d", M_CountEmblems(), numemblems+numextraemblems));
|
||||
V_DrawScaledPatch(128, 144 - SHORT(emblemicon->height)/4, 0, emblemicon);
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (!LUA_HudEnabled(hud_coopemeralds))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (emeralds & EMERALD1)
|
||||
V_DrawScaledPatch((BASEVIDWIDTH/2)-8 , (BASEVIDHEIGHT/3)-32, 0, emeraldpics[0][0]);
|
||||
|
@ -3209,20 +3198,14 @@ static void HU_DrawNetplayCoopOverlay(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (token
|
||||
#ifdef HAVE_BLUA
|
||||
&& LUA_HudEnabled(hud_tokens)
|
||||
#endif
|
||||
)
|
||||
if (token && LUA_HudEnabled(hud_tokens))
|
||||
{
|
||||
V_DrawString(168, 10, 0, va("- %d", token));
|
||||
V_DrawSmallScaledPatch(148, 6, 0, tokenicon);
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (!LUA_HudEnabled(hud_coopemeralds))
|
||||
return;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 7; ++i)
|
||||
{
|
||||
|
|
|
@ -1423,6 +1423,7 @@ static void SOCK_ClearBans(void)
|
|||
boolean I_InitTcpNetwork(void)
|
||||
{
|
||||
char serverhostname[255];
|
||||
const char *urlparam = NULL;
|
||||
boolean ret = false;
|
||||
// initilize the OS's TCP/IP stack
|
||||
if (!I_InitTcpDriver())
|
||||
|
@ -1476,10 +1477,12 @@ boolean I_InitTcpNetwork(void)
|
|||
|
||||
ret = true;
|
||||
}
|
||||
else if (M_CheckParm("-connect"))
|
||||
else if ((urlparam = M_GetUrlProtocolArg()) != NULL || M_CheckParm("-connect"))
|
||||
{
|
||||
if (M_IsNextParm())
|
||||
strcpy(serverhostname, M_GetNextParm());
|
||||
if (urlparam != NULL)
|
||||
strlcpy(serverhostname, urlparam, sizeof(serverhostname));
|
||||
else if (M_IsNextParm())
|
||||
strlcpy(serverhostname, M_GetNextParm(), sizeof(serverhostname));
|
||||
else
|
||||
serverhostname[0] = 0; // assuming server in the LAN, use broadcast to detect it
|
||||
|
||||
|
|
|
@ -32,10 +32,14 @@ typedef enum
|
|||
render_none = 3 // for dedicated server
|
||||
} rendermode_t;
|
||||
|
||||
/** \brief currect render mode
|
||||
/** \brief current render mode
|
||||
*/
|
||||
extern rendermode_t rendermode;
|
||||
|
||||
/** \brief OpenGL state
|
||||
0 = never loaded, 1 = loaded successfully, -1 = failed loading
|
||||
*/
|
||||
extern INT32 vid_opengl_state;
|
||||
|
||||
/** \brief use highcolor modes if true
|
||||
*/
|
||||
|
@ -44,9 +48,8 @@ extern boolean highcolor;
|
|||
/** \brief setup video mode
|
||||
*/
|
||||
void I_StartupGraphics(void);
|
||||
void I_StartupHardwareGraphics(void);
|
||||
|
||||
/** \brief restore old video mode
|
||||
/** \brief shutdown video mode
|
||||
*/
|
||||
void I_ShutdownGraphics(void);
|
||||
|
||||
|
@ -82,11 +85,22 @@ INT32 VID_GetModeForSize(INT32 w, INT32 h);
|
|||
|
||||
\param modenum video mode to set to
|
||||
|
||||
\return currect video mode
|
||||
\return current video mode
|
||||
*/
|
||||
INT32 VID_SetMode(INT32 modenum);
|
||||
|
||||
/** \brief Checks the render state
|
||||
*/
|
||||
void VID_CheckRenderer(void);
|
||||
|
||||
/** \brief Load OpenGL mode
|
||||
*/
|
||||
void VID_StartupOpenGL(void);
|
||||
|
||||
/** \brief Checks if OpenGL loaded
|
||||
*/
|
||||
void VID_CheckGLLoaded(rendermode_t oldrender);
|
||||
|
||||
/** \brief The VID_GetModeName function
|
||||
|
||||
\param modenum video mode number
|
||||
|
|
30
src/info.c
30
src/info.c
|
@ -187,6 +187,8 @@ char sprnames[NUMSPRITES + 1][5] =
|
|||
|
||||
// Projectiles
|
||||
"MISL",
|
||||
"LASR", // GFZ3 laser
|
||||
"LASF", // GFZ3 laser flames
|
||||
"TORP", // Torpedo
|
||||
"ENRG", // Energy ball
|
||||
"MINE", // Skim mine
|
||||
|
@ -2058,7 +2060,15 @@ state_t states[NUMSTATES] =
|
|||
|
||||
{SPR_MISL, FF_FULLBRIGHT, 1, {A_SmokeTrailer}, MT_SMOKE, 0, S_ROCKET}, // S_ROCKET
|
||||
|
||||
{SPR_MISL, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_NULL}, // S_LASER
|
||||
{SPR_LASR, FF_FULLBRIGHT|0, 2, {NULL}, 0, 0, S_NULL}, // S_LASER
|
||||
{SPR_LASR, FF_FULLBRIGHT|1, 2, {NULL}, 0, 0, S_NULL}, // S_LASER2
|
||||
{SPR_LASR, FF_FULLBRIGHT|2, 2, {NULL}, 0, 0, S_NULL}, // S_LASERFLASH
|
||||
|
||||
{SPR_LASF, FF_FULLBRIGHT|0, 2, {NULL}, 0, 0, S_LASERFLAME2}, // S_LASERFLAME1
|
||||
{SPR_LASF, FF_FULLBRIGHT|1, 1, {A_ChangeHeight}, 156*FRACUNIT, 3, S_LASERFLAME3}, // S_LASERFLAME2
|
||||
{SPR_LASF, FF_FULLBRIGHT|2, 0, {A_ChangeHeight}, 32*FRACUNIT, 3, S_LASERFLAME4}, // S_LASERFLAME3
|
||||
{SPR_LASF, FF_ANIMATE|FF_PAPERSPRITE|FF_FULLBRIGHT|2, 4, {NULL}, 1, 2, S_LASERFLAME5}, // S_LASERFLAME4
|
||||
{SPR_LASF, FF_ANIMATE|FF_PAPERSPRITE|FF_FULLBRIGHT|4, 28, {NULL}, 2, 2, S_NULL}, // S_LASERFLAME5
|
||||
|
||||
{SPR_TORP, 0, 1, {A_SmokeTrailer}, MT_SMOKE, 0, S_TORPEDO}, // S_TORPEDO
|
||||
|
||||
|
@ -5665,28 +5675,28 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
|
||||
{ // MT_EGGMOBILE_FIRE
|
||||
-1, // doomednum
|
||||
S_SPINFIRE1, // spawnstate
|
||||
S_LASERFLAME1, // spawnstate
|
||||
1, // spawnhealth
|
||||
S_NULL, // seestate
|
||||
sfx_None, // seesound
|
||||
sfx_s3kc2s, // seesound
|
||||
8, // reactiontime
|
||||
sfx_None, // attacksound
|
||||
S_NULL, // painstate
|
||||
0, // painchance
|
||||
sfx_None, // painsound
|
||||
sfx_s3k8d, // painsound
|
||||
S_NULL, // meleestate
|
||||
S_NULL, // missilestate
|
||||
S_NULL, // deathstate
|
||||
S_NULL, // xdeathstate
|
||||
sfx_None, // deathsound
|
||||
0, // speed
|
||||
8*FRACUNIT, // radius
|
||||
14*FRACUNIT, // height
|
||||
24*FRACUNIT, // radius
|
||||
84*FRACUNIT, // height
|
||||
0, // display offset
|
||||
DMG_FIRE, // mass
|
||||
1, // damage
|
||||
sfx_None, // activesound
|
||||
MF_NOBLOCKMAP|MF_MISSILE|MF_NOGRAVITY|MF_FIRE, // flags
|
||||
MF_NOGRAVITY|MF_FIRE|MF_PAIN, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
|
@ -9637,8 +9647,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
S_NULL, // painstate
|
||||
0, // painchance
|
||||
sfx_None, // painsound
|
||||
S_NULL, // meleestate
|
||||
S_NULL, // missilestate
|
||||
S_LASERFLASH, // meleestate
|
||||
S_LASER2, // missilestate
|
||||
S_NULL, // deathstate
|
||||
S_NULL, // xdeathstate
|
||||
sfx_None, // deathsound
|
||||
|
@ -9649,7 +9659,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // mass
|
||||
20, // damage
|
||||
sfx_None, // activesound
|
||||
MF_NOBLOCKMAP|MF_MISSILE|MF_NOGRAVITY, // flags
|
||||
MF_MISSILE|MF_NOGRAVITY, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
|
|
12
src/info.h
12
src/info.h
|
@ -165,6 +165,7 @@ void A_SetTics();
|
|||
void A_SetRandomTics();
|
||||
void A_ChangeColorRelative();
|
||||
void A_ChangeColorAbsolute();
|
||||
void A_Dye();
|
||||
void A_MoveRelative();
|
||||
void A_MoveAbsolute();
|
||||
void A_Thrust();
|
||||
|
@ -283,6 +284,7 @@ void A_RolloutRock();
|
|||
void A_DragonbomberSpawn();
|
||||
void A_DragonWing();
|
||||
void A_DragonSegment();
|
||||
void A_ChangeHeight();
|
||||
|
||||
// ratio of states to sprites to mobj types is roughly 6 : 1 : 1
|
||||
#define NUMMOBJFREESLOTS 512
|
||||
|
@ -450,6 +452,8 @@ typedef enum sprite
|
|||
|
||||
// Projectiles
|
||||
SPR_MISL,
|
||||
SPR_LASR, // GFZ3 laser
|
||||
SPR_LASF, // GFZ3 laser flames
|
||||
SPR_TORP, // Torpedo
|
||||
SPR_ENRG, // Energy ball
|
||||
SPR_MINE, // Skim mine
|
||||
|
@ -2219,6 +2223,14 @@ typedef enum state
|
|||
S_ROCKET,
|
||||
|
||||
S_LASER,
|
||||
S_LASER2,
|
||||
S_LASERFLASH,
|
||||
|
||||
S_LASERFLAME1,
|
||||
S_LASERFLAME2,
|
||||
S_LASERFLAME3,
|
||||
S_LASERFLAME4,
|
||||
S_LASERFLAME5,
|
||||
|
||||
S_TORPEDO,
|
||||
|
||||
|
|
|
@ -11,17 +11,14 @@
|
|||
/// \brief basic functions for Lua scripting
|
||||
|
||||
#include "doomdef.h"
|
||||
#ifdef HAVE_BLUA
|
||||
#include "fastcmp.h"
|
||||
#include "p_local.h"
|
||||
#include "p_setup.h" // So we can have P_SetupLevelSky
|
||||
#ifdef ESLOPE
|
||||
#include "p_slopes.h" // P_GetZAt
|
||||
#endif
|
||||
#include "z_zone.h"
|
||||
#include "r_main.h"
|
||||
#include "r_draw.h"
|
||||
#include "r_things.h"
|
||||
#include "r_things.h" // R_Frame2Char etc
|
||||
#include "m_random.h"
|
||||
#include "s_sound.h"
|
||||
#include "g_game.h"
|
||||
|
@ -221,11 +218,17 @@ static const char *GetUserdataUType(lua_State *L)
|
|||
// or players[0].powers -> "player_t.powers"
|
||||
static int lib_userdataType(lua_State *L)
|
||||
{
|
||||
int type;
|
||||
lua_settop(L, 1); // pop everything except arg 1 (in case somebody decided to add more)
|
||||
luaL_checktype(L, 1, LUA_TUSERDATA);
|
||||
type = lua_type(L, 1);
|
||||
if (type == LUA_TLIGHTUSERDATA || type == LUA_TUSERDATA)
|
||||
{
|
||||
lua_pushstring(L, GetUserdataUType(L));
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return luaL_typerror(L, 1, "userdata");
|
||||
}
|
||||
|
||||
static int lib_isPlayerAdmin(lua_State *L)
|
||||
{
|
||||
|
@ -1040,11 +1043,60 @@ static int lib_pSetObjectMomZ(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lib_pPlayJingle(lua_State *L)
|
||||
{
|
||||
player_t *player = NULL;
|
||||
jingletype_t jingletype = luaL_checkinteger(L, 2);
|
||||
//NOHUD
|
||||
//INLEVEL
|
||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (jingletype >= NUMJINGLES)
|
||||
return luaL_error(L, "jingletype %d out of range (0 - %d)", jingletype, NUMJINGLES-1);
|
||||
P_PlayJingle(player, jingletype);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_pPlayJingleMusic(lua_State *L)
|
||||
{
|
||||
player_t *player = NULL;
|
||||
const char *musnamearg = luaL_checkstring(L, 2);
|
||||
char musname[7], *p = musname;
|
||||
UINT16 musflags = luaL_optinteger(L, 3, 0);
|
||||
boolean looping = lua_opttrueboolean(L, 4);
|
||||
jingletype_t jingletype = luaL_optinteger(L, 5, JT_OTHER);
|
||||
//NOHUD
|
||||
//INLEVEL
|
||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (jingletype >= NUMJINGLES)
|
||||
return luaL_error(L, "jingletype %d out of range (0 - %d)", jingletype, NUMJINGLES-1);
|
||||
|
||||
musname[6] = '\0';
|
||||
strncpy(musname, musnamearg, 6);
|
||||
|
||||
while (*p) {
|
||||
*p = tolower(*p);
|
||||
++p;
|
||||
}
|
||||
|
||||
P_PlayJingleMusic(player, musname, musflags, looping, jingletype);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_pRestoreMusic(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
//NOHUD
|
||||
//INLEVEL
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
if (P_IsLocalPlayer(player))
|
||||
|
@ -1674,11 +1726,15 @@ static int lib_pPlayVictorySound(lua_State *L)
|
|||
|
||||
static int lib_pPlayLivesJingle(lua_State *L)
|
||||
{
|
||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
player_t *player = NULL;
|
||||
//NOHUD
|
||||
//INLEVEL
|
||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
if (!player)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
P_PlayLivesJingle(player);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2123,7 +2179,6 @@ static int lib_evStartCrumble(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef ESLOPE
|
||||
// P_SLOPES
|
||||
////////////
|
||||
|
||||
|
@ -2139,7 +2194,6 @@ static int lib_pGetZAt(lua_State *L)
|
|||
lua_pushfixed(L, P_GetZAt(slope, x, y));
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
// R_DEFS
|
||||
////////////
|
||||
|
@ -2342,7 +2396,7 @@ static int lib_sStartSound(lua_State *L)
|
|||
const void *origin = NULL;
|
||||
sfxenum_t sound_id = luaL_checkinteger(L, 2);
|
||||
player_t *player = NULL;
|
||||
//NOHUD // kys @whoever did this.
|
||||
//NOHUD
|
||||
if (sound_id >= NUMSFX)
|
||||
return luaL_error(L, "sfx %d out of range (0 - %d)", sound_id, NUMSFX-1);
|
||||
if (!lua_isnil(L, 1))
|
||||
|
@ -2373,7 +2427,7 @@ static int lib_sStartSoundAtVolume(lua_State *L)
|
|||
sfxenum_t sound_id = luaL_checkinteger(L, 2);
|
||||
INT32 volume = (INT32)luaL_checkinteger(L, 3);
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
//NOHUD
|
||||
|
||||
if (!lua_isnil(L, 1))
|
||||
{
|
||||
|
@ -2397,7 +2451,7 @@ static int lib_sStartSoundAtVolume(lua_State *L)
|
|||
static int lib_sStopSound(lua_State *L)
|
||||
{
|
||||
void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
NOHUD
|
||||
//NOHUD
|
||||
if (!origin)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
S_StopSound(origin);
|
||||
|
@ -2414,7 +2468,7 @@ static int lib_sChangeMusic(lua_State *L)
|
|||
boolean looping;
|
||||
player_t *player = NULL;
|
||||
UINT16 music_flags = 0;
|
||||
NOHUD
|
||||
//NOHUD
|
||||
|
||||
if (lua_isnumber(L, 1))
|
||||
{
|
||||
|
@ -2443,7 +2497,7 @@ static int lib_sChangeMusic(lua_State *L)
|
|||
boolean looping = (boolean)lua_opttrueboolean(L, 2);
|
||||
player_t *player = NULL;
|
||||
UINT16 music_flags = 0;
|
||||
NOHUD
|
||||
//NOHUD
|
||||
|
||||
#endif
|
||||
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
||||
|
@ -2474,7 +2528,7 @@ static int lib_sSpeedMusic(lua_State *L)
|
|||
fixed_t fixedspeed = luaL_checkfixed(L, 1);
|
||||
float speed = FIXED_TO_FLOAT(fixedspeed);
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
//NOHUD
|
||||
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||
|
@ -2489,7 +2543,7 @@ static int lib_sSpeedMusic(lua_State *L)
|
|||
static int lib_sStopMusic(lua_State *L)
|
||||
{
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
//NOHUD
|
||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
|
@ -2505,7 +2559,7 @@ static int lib_sSetInternalMusicVolume(lua_State *L)
|
|||
{
|
||||
UINT32 volume = (UINT32)luaL_checkinteger(L, 1);
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
//NOHUD
|
||||
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||
|
@ -2525,7 +2579,7 @@ static int lib_sSetInternalMusicVolume(lua_State *L)
|
|||
static int lib_sStopFadingMusic(lua_State *L)
|
||||
{
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
//NOHUD
|
||||
if (!lua_isnone(L, 1) && lua_isuserdata(L, 1))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||
|
@ -2548,7 +2602,7 @@ static int lib_sFadeMusic(lua_State *L)
|
|||
UINT32 ms;
|
||||
INT32 source_volume;
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
//NOHUD
|
||||
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER));
|
||||
|
@ -2576,8 +2630,6 @@ static int lib_sFadeMusic(lua_State *L)
|
|||
ms = (UINT32)luaL_checkinteger(L, 3);
|
||||
}
|
||||
|
||||
NOHUD
|
||||
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
lua_pushboolean(L, S_FadeMusicFromVolume(target_volume, source_volume, ms));
|
||||
else
|
||||
|
@ -2589,7 +2641,7 @@ static int lib_sFadeOutStopMusic(lua_State *L)
|
|||
{
|
||||
UINT32 ms = (UINT32)luaL_checkinteger(L, 1);
|
||||
player_t *player = NULL;
|
||||
NOHUD
|
||||
//NOHUD
|
||||
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||
{
|
||||
player = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
|
||||
|
@ -2605,10 +2657,29 @@ static int lib_sFadeOutStopMusic(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lib_sGetMusicLength(lua_State *L)
|
||||
{
|
||||
lua_pushinteger(L, S_GetMusicLength());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_sGetMusicPosition(lua_State *L)
|
||||
{
|
||||
lua_pushinteger(L, S_GetMusicPosition());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_sSetMusicPosition(lua_State *L)
|
||||
{
|
||||
UINT32 pos = (UINT32)luaL_checkinteger(L, 1);
|
||||
lua_pushboolean(L, S_SetMusicPosition(pos));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_sOriginPlaying(lua_State *L)
|
||||
{
|
||||
void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
NOHUD
|
||||
//NOHUD
|
||||
INLEVEL
|
||||
if (!origin)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
|
@ -2619,7 +2690,7 @@ static int lib_sOriginPlaying(lua_State *L)
|
|||
static int lib_sIdPlaying(lua_State *L)
|
||||
{
|
||||
sfxenum_t id = luaL_checkinteger(L, 1);
|
||||
NOHUD
|
||||
//NOHUD
|
||||
if (id >= NUMSFX)
|
||||
return luaL_error(L, "sfx %d out of range (0 - %d)", id, NUMSFX-1);
|
||||
lua_pushboolean(L, S_IdPlaying(id));
|
||||
|
@ -2630,7 +2701,7 @@ static int lib_sSoundPlaying(lua_State *L)
|
|||
{
|
||||
void *origin = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
sfxenum_t id = luaL_checkinteger(L, 2);
|
||||
NOHUD
|
||||
//NOHUD
|
||||
INLEVEL
|
||||
if (!origin)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
|
@ -2648,7 +2719,7 @@ static int lib_sStartMusicCaption(lua_State *L)
|
|||
const char *caption = luaL_checkstring(L, 1);
|
||||
UINT16 lifespan = (UINT16)luaL_checkinteger(L, 2);
|
||||
//HUDSAFE
|
||||
INLEVEL
|
||||
//INLEVEL
|
||||
|
||||
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
|
||||
{
|
||||
|
@ -3069,6 +3140,8 @@ static luaL_Reg lib[] = {
|
|||
{"P_InSpaceSector",lib_pInSpaceSector},
|
||||
{"P_InQuicksand",lib_pInQuicksand},
|
||||
{"P_SetObjectMomZ",lib_pSetObjectMomZ},
|
||||
{"P_PlayJingle",lib_pPlayJingle},
|
||||
{"P_PlayJingleMusic",lib_pPlayJingleMusic},
|
||||
{"P_RestoreMusic",lib_pRestoreMusic},
|
||||
{"P_SpawnShieldOrb",lib_pSpawnShieldOrb},
|
||||
{"P_SpawnGhostMobj",lib_pSpawnGhostMobj},
|
||||
|
@ -3151,10 +3224,8 @@ static luaL_Reg lib[] = {
|
|||
{"EV_CrumbleChain",lib_evCrumbleChain},
|
||||
{"EV_StartCrumble",lib_evStartCrumble},
|
||||
|
||||
#ifdef ESLOPE
|
||||
// p_slopes
|
||||
{"P_GetZAt",lib_pGetZAt},
|
||||
#endif
|
||||
|
||||
// r_defs
|
||||
{"R_PointToAngle",lib_rPointToAngle},
|
||||
|
@ -3189,6 +3260,9 @@ static luaL_Reg lib[] = {
|
|||
{"S_StopFadingMusic",lib_sStopFadingMusic},
|
||||
{"S_FadeMusic",lib_sFadeMusic},
|
||||
{"S_FadeOutStopMusic",lib_sFadeOutStopMusic},
|
||||
{"S_GetMusicLength",lib_sGetMusicLength},
|
||||
{"S_GetMusicPosition",lib_sGetMusicPosition},
|
||||
{"S_SetMusicPosition",lib_sSetMusicPosition},
|
||||
{"S_OriginPlaying",lib_sOriginPlaying},
|
||||
{"S_IdPlaying",lib_sIdPlaying},
|
||||
{"S_SoundPlaying",lib_sSoundPlaying},
|
||||
|
@ -3237,5 +3311,3 @@ int LUA_BaseLib(lua_State *L)
|
|||
luaL_register(L, NULL, lib);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
/// \brief blockmap library for Lua scripting
|
||||
|
||||
#include "doomdef.h"
|
||||
#ifdef HAVE_BLUA
|
||||
#include "p_local.h"
|
||||
#include "r_main.h" // validcount
|
||||
#include "lua_script.h"
|
||||
|
@ -81,9 +80,7 @@ static UINT8 lib_searchBlockmap_Lines(lua_State *L, INT32 x, INT32 y, mobj_t *th
|
|||
{
|
||||
INT32 offset;
|
||||
const INT32 *list; // Big blockmap
|
||||
#ifdef POLYOBJECTS
|
||||
polymaplink_t *plink; // haleyjd 02/22/06
|
||||
#endif
|
||||
line_t *ld;
|
||||
|
||||
if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
|
||||
|
@ -91,7 +88,6 @@ static UINT8 lib_searchBlockmap_Lines(lua_State *L, INT32 x, INT32 y, mobj_t *th
|
|||
|
||||
offset = y*bmapwidth + x;
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// haleyjd 02/22/06: consider polyobject lines
|
||||
plink = polyblocklinks[offset];
|
||||
|
||||
|
@ -134,7 +130,6 @@ static UINT8 lib_searchBlockmap_Lines(lua_State *L, INT32 x, INT32 y, mobj_t *th
|
|||
}
|
||||
plink = (polymaplink_t *)(plink->link.next);
|
||||
}
|
||||
#endif
|
||||
|
||||
offset = *(blockmap + offset); // offset = blockmap[y*bmapwidth+x];
|
||||
|
||||
|
@ -264,5 +259,3 @@ int LUA_BlockmapLib(lua_State *L)
|
|||
lua_register(L, "searchBlockmap", lib_searchBlockmap);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
/// \brief console modifying/etc library for Lua scripting
|
||||
|
||||
#include "doomdef.h"
|
||||
#ifdef HAVE_BLUA
|
||||
#include "fastcmp.h"
|
||||
#include "p_local.h"
|
||||
#include "g_game.h"
|
||||
|
@ -431,23 +430,9 @@ static int lib_cvRegisterVar(lua_State *L)
|
|||
|
||||
static int lib_cvFindVar(lua_State *L)
|
||||
{
|
||||
consvar_t *cv;
|
||||
if (( cv = CV_FindVar(luaL_checkstring(L,1)) ))
|
||||
{
|
||||
lua_settop(L,1);/* We only want one argument in the stack. */
|
||||
lua_pushlightuserdata(L, cv);/* Now the second value on stack. */
|
||||
luaL_getmetatable(L, META_CVAR);
|
||||
/*
|
||||
The metatable is the last value on the stack, so this
|
||||
applies it to the second value, which is the cvar.
|
||||
*/
|
||||
lua_setmetatable(L,2);
|
||||
lua_pushvalue(L,2);
|
||||
LUA_PushLightUserdata(L, CV_FindVar(luaL_checkstring(L,1)), META_CVAR);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CONS_Printf for a single player
|
||||
// Use 'print' in baselib for a global message.
|
||||
|
@ -551,5 +536,3 @@ int LUA_ConsoleLib(lua_State *L)
|
|||
luaL_register(L, NULL, lib);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
/// \file lua_hook.h
|
||||
/// \brief hooks for Lua scripting
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "d_player.h"
|
||||
|
||||
|
@ -42,6 +40,7 @@ enum hook {
|
|||
hook_JumpSpinSpecial,
|
||||
hook_BotTiccmd,
|
||||
hook_BotAI,
|
||||
hook_BotRespawn,
|
||||
hook_LinedefExecute,
|
||||
hook_PlayerMsg,
|
||||
hook_HurtMsg,
|
||||
|
@ -58,6 +57,7 @@ enum hook {
|
|||
hook_ViewpointSwitch,
|
||||
hook_SeenPlayer,
|
||||
hook_PlayerThink,
|
||||
hook_ShouldJingleContinue,
|
||||
|
||||
hook_MAX // last hook
|
||||
};
|
||||
|
@ -92,6 +92,7 @@ boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8
|
|||
#define LUAh_JumpSpinSpecial(player) LUAh_PlayerHook(player, hook_JumpSpinSpecial) // Hook for P_DoJumpStuff (Spin button effect (mid-air))
|
||||
boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd
|
||||
boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name
|
||||
boolean LUAh_BotRespawn(mobj_t *sonic, mobj_t *tails); // Hook for B_CheckRespawn
|
||||
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors
|
||||
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages
|
||||
boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source, UINT8 damagetype); // Hook for hurt messages
|
||||
|
@ -110,5 +111,4 @@ UINT8 LUAh_ViewpointSwitch(player_t *player, player_t *newdisplayplayer, boolean
|
|||
boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend); // Hook for MT_NAMECHECK
|
||||
#endif
|
||||
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
|
||||
|
||||
#endif
|
||||
boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname); // Hook for whether a jingle of the given music should continue playing
|
||||
|
|
|
@ -11,11 +11,10 @@
|
|||
/// \brief hooks for Lua scripting
|
||||
|
||||
#include "doomdef.h"
|
||||
#ifdef HAVE_BLUA
|
||||
#include "doomstat.h"
|
||||
#include "p_mobj.h"
|
||||
#include "g_game.h"
|
||||
#include "r_things.h"
|
||||
#include "r_skins.h"
|
||||
#include "b_bot.h"
|
||||
#include "z_zone.h"
|
||||
|
||||
|
@ -53,6 +52,7 @@ const char *const hookNames[hook_MAX+1] = {
|
|||
"JumpSpinSpecial",
|
||||
"BotTiccmd",
|
||||
"BotAI",
|
||||
"BotRespawn",
|
||||
"LinedefExecute",
|
||||
"PlayerMsg",
|
||||
"HurtMsg",
|
||||
|
@ -69,6 +69,7 @@ const char *const hookNames[hook_MAX+1] = {
|
|||
"ViewpointSwitch",
|
||||
"SeenPlayer",
|
||||
"PlayerThink",
|
||||
"ShouldJingleContinue",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -80,8 +81,7 @@ struct hook_s
|
|||
UINT16 id;
|
||||
union {
|
||||
mobjtype_t mt;
|
||||
char *skinname;
|
||||
char *funcname;
|
||||
char *str;
|
||||
} s;
|
||||
boolean error;
|
||||
};
|
||||
|
@ -142,34 +142,24 @@ static int lib_addHook(lua_State *L)
|
|||
case hook_HurtMsg:
|
||||
case hook_MobjMoveBlocked:
|
||||
case hook_MapThingSpawn:
|
||||
case hook_FollowMobj:
|
||||
hook.s.mt = MT_NULL;
|
||||
if (lua_isnumber(L, 2))
|
||||
hook.s.mt = lua_tonumber(L, 2);
|
||||
luaL_argcheck(L, hook.s.mt < NUMMOBJTYPES, 2, "invalid mobjtype_t");
|
||||
break;
|
||||
case hook_BotAI:
|
||||
hook.s.skinname = NULL;
|
||||
case hook_ShouldJingleContinue:
|
||||
hook.s.str = NULL;
|
||||
if (lua_isstring(L, 2))
|
||||
{ // lowercase copy
|
||||
const char *s = lua_tostring(L, 2);
|
||||
char *p = hook.s.skinname = ZZ_Alloc(strlen(s)+1);
|
||||
do {
|
||||
*p = tolower(*s);
|
||||
++p;
|
||||
} while(*(++s));
|
||||
*p = 0;
|
||||
hook.s.str = Z_StrDup(lua_tostring(L, 2));
|
||||
strlwr(hook.s.str);
|
||||
}
|
||||
break;
|
||||
case hook_LinedefExecute: // Linedef executor functions
|
||||
{ // uppercase copy
|
||||
const char *s = luaL_checkstring(L, 2);
|
||||
char *p = hook.s.funcname = ZZ_Alloc(strlen(s)+1);
|
||||
do {
|
||||
*p = toupper(*s);
|
||||
++p;
|
||||
} while(*(++s));
|
||||
*p = 0;
|
||||
}
|
||||
hook.s.str = Z_StrDup(luaL_checkstring(L, 2));
|
||||
strupr(hook.s.str);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -203,6 +193,7 @@ static int lib_addHook(lua_State *L)
|
|||
case hook_MobjRemoved:
|
||||
case hook_MobjMoveBlocked:
|
||||
case hook_MapThingSpawn:
|
||||
case hook_FollowMobj:
|
||||
lastp = &mobjhooks[hook.s.mt];
|
||||
break;
|
||||
case hook_JumpSpecial:
|
||||
|
@ -210,7 +201,6 @@ static int lib_addHook(lua_State *L)
|
|||
case hook_SpinSpecial:
|
||||
case hook_JumpSpinSpecial:
|
||||
case hook_PlayerSpawn:
|
||||
case hook_FollowMobj:
|
||||
case hook_PlayerCanDamage:
|
||||
case hook_TeamSwitch:
|
||||
case hook_ViewpointSwitch:
|
||||
|
@ -1072,7 +1062,7 @@ boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
|
|||
for (hookp = roothook; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type != hook_BotAI
|
||||
|| (hookp->s.skinname && strcmp(hookp->s.skinname, ((skin_t*)tails->skin)->name)))
|
||||
|| (hookp->s.str && strcmp(hookp->s.str, ((skin_t*)tails->skin)->name)))
|
||||
continue;
|
||||
|
||||
if (lua_gettop(gL) == 0)
|
||||
|
@ -1122,6 +1112,51 @@ boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd)
|
|||
return hooked;
|
||||
}
|
||||
|
||||
// Hook for B_CheckRespawn
|
||||
boolean LUAh_BotRespawn(mobj_t *sonic, mobj_t *tails)
|
||||
{
|
||||
hook_p hookp;
|
||||
UINT8 shouldRespawn = 0; // 0 = default, 1 = force yes, 2 = force no.
|
||||
if (!gL || !(hooksAvailable[hook_BotRespawn/8] & (1<<(hook_BotRespawn%8))))
|
||||
return false;
|
||||
|
||||
lua_settop(gL, 0);
|
||||
|
||||
for (hookp = roothook; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type != hook_BotRespawn)
|
||||
continue;
|
||||
|
||||
if (lua_gettop(gL) == 0)
|
||||
{
|
||||
LUA_PushUserdata(gL, sonic, META_MOBJ);
|
||||
LUA_PushUserdata(gL, tails, META_MOBJ);
|
||||
}
|
||||
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))
|
||||
{
|
||||
if (lua_toboolean(gL, -1))
|
||||
shouldRespawn = 1; // Force yes
|
||||
else
|
||||
shouldRespawn = 2; // Force no
|
||||
}
|
||||
lua_pop(gL, 1);
|
||||
}
|
||||
|
||||
lua_settop(gL, 0);
|
||||
return shouldRespawn;
|
||||
}
|
||||
|
||||
// Hook for linedef executors
|
||||
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector)
|
||||
{
|
||||
|
@ -1134,7 +1169,7 @@ boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector)
|
|||
|
||||
for (hookp = linedefexecutorhooks; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (strcmp(hookp->s.funcname, line->text))
|
||||
if (strcmp(hookp->s.str, line->text))
|
||||
continue;
|
||||
|
||||
if (lua_gettop(gL) == 0)
|
||||
|
@ -1364,7 +1399,34 @@ boolean LUAh_FollowMobj(player_t *player, mobj_t *mobj)
|
|||
|
||||
lua_settop(gL, 0);
|
||||
|
||||
for (hookp = playerhooks; hookp; hookp = hookp->next)
|
||||
// Look for all generic mobj follow item hooks
|
||||
for (hookp = mobjhooks[MT_NULL]; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type != hook_FollowMobj)
|
||||
continue;
|
||||
|
||||
if (lua_gettop(gL) == 0)
|
||||
{
|
||||
LUA_PushUserdata(gL, player, META_PLAYER);
|
||||
LUA_PushUserdata(gL, mobj, META_MOBJ);
|
||||
}
|
||||
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_toboolean(gL, -1))
|
||||
hooked = true;
|
||||
lua_pop(gL, 1);
|
||||
}
|
||||
|
||||
for (hookp = mobjhooks[mobj->type]; hookp; hookp = hookp->next)
|
||||
{
|
||||
if (hookp->type != hook_FollowMobj)
|
||||
continue;
|
||||
|
@ -1632,4 +1694,45 @@ boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend)
|
|||
}
|
||||
#endif // SEENAMES
|
||||
|
||||
#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.str && strcmp(hookp->s.str, 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;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
/// \brief custom HUD rendering library for Lua scripting
|
||||
|
||||
#include "doomdef.h"
|
||||
#ifdef HAVE_BLUA
|
||||
#include "fastcmp.h"
|
||||
#include "r_defs.h"
|
||||
#include "r_local.h"
|
||||
|
@ -413,9 +412,9 @@ static int libd_cachePatch(lua_State *L)
|
|||
HUDONLY
|
||||
|
||||
luapat = patchinfohead;
|
||||
lumpnum = W_CheckNumForName(luaL_checkstring(L, 1));
|
||||
lumpnum = W_CheckNumForLongName(luaL_checkstring(L, 1));
|
||||
if (lumpnum == LUMPERROR)
|
||||
lumpnum = W_GetNumForName("MISSING");
|
||||
lumpnum = W_GetNumForLongName("MISSING");
|
||||
|
||||
for (i = 0; i < numluapatches; i++)
|
||||
{
|
||||
|
@ -455,7 +454,7 @@ static int libd_cachePatch(lua_State *L)
|
|||
numluapatches++;
|
||||
#else
|
||||
HUDONLY
|
||||
LUA_PushUserdata(L, W_CachePatchName(luaL_checkstring(L, 1), PU_PATCH), META_PATCH);
|
||||
LUA_PushUserdata(L, W_CachePatchLongName(luaL_checkstring(L, 1), PU_PATCH), META_PATCH);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
@ -1466,5 +1465,3 @@ void LUAh_IntermissionHUD(void)
|
|||
lua_pop(gL, -1);
|
||||
hud_running = false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
/// \brief infotable editing library for Lua scripting
|
||||
|
||||
#include "doomdef.h"
|
||||
#ifdef HAVE_BLUA
|
||||
#include "fastcmp.h"
|
||||
#include "info.h"
|
||||
#include "dehacked.h"
|
||||
|
@ -389,10 +388,7 @@ static int lib_setSpriteInfo(lua_State *L)
|
|||
lua_Integer i = 0;
|
||||
const char *str = NULL;
|
||||
if (lua_isnumber(L, 2))
|
||||
{
|
||||
i = lua_tointeger(L, 2);
|
||||
i++; // shift index in case of missing rotsprite support
|
||||
}
|
||||
else
|
||||
str = luaL_checkstring(L, 2);
|
||||
|
||||
|
@ -1635,7 +1631,6 @@ int LUA_InfoLib(lua_State *L)
|
|||
lua_pushcfunction(L, lib_spriteinfolen);
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_setmetatable(L, -2);
|
||||
lua_pushvalue(L, -1);
|
||||
lua_setglobal(L, "spriteinfo");
|
||||
|
||||
luaL_newmetatable(L, META_LUABANKS);
|
||||
|
@ -1651,5 +1646,3 @@ int LUA_InfoLib(lua_State *L)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
/// \file lua_libs.h
|
||||
/// \brief libraries for Lua scripting
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
|
||||
extern lua_State *gL;
|
||||
|
||||
#define LREG_VALID "VALID_USERDATA"
|
||||
|
@ -45,11 +43,9 @@ extern lua_State *gL;
|
|||
#define META_SEG "SEG_T*"
|
||||
#define META_NODE "NODE_T*"
|
||||
#endif
|
||||
#ifdef ESLOPE
|
||||
#define META_SLOPE "PSLOPE_T*"
|
||||
#define META_VECTOR2 "VECTOR2_T"
|
||||
#define META_VECTOR3 "VECTOR3_T"
|
||||
#endif
|
||||
#define META_MAPHEADER "MAPHEADER_T*"
|
||||
|
||||
#define META_CVAR "CONSVAR_T*"
|
||||
|
@ -88,5 +84,3 @@ int LUA_ThinkerLib(lua_State *L);
|
|||
int LUA_MapLib(lua_State *L);
|
||||
int LUA_BlockmapLib(lua_State *L);
|
||||
int LUA_HudLib(lua_State *L);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,14 +11,11 @@
|
|||
/// \brief game map library for Lua scripting
|
||||
|
||||
#include "doomdef.h"
|
||||
#ifdef HAVE_BLUA
|
||||
#include "r_state.h"
|
||||
#include "p_local.h"
|
||||
#include "p_setup.h"
|
||||
#include "z_zone.h"
|
||||
#ifdef ESLOPE
|
||||
#include "p_slopes.h"
|
||||
#endif
|
||||
#include "r_main.h"
|
||||
|
||||
#include "lua_script.h"
|
||||
|
@ -42,13 +39,9 @@ enum sector_e {
|
|||
sector_heightsec,
|
||||
sector_camsec,
|
||||
sector_lines,
|
||||
#ifdef ESLOPE
|
||||
sector_ffloors,
|
||||
sector_fslope,
|
||||
sector_cslope
|
||||
#else
|
||||
sector_ffloors
|
||||
#endif
|
||||
};
|
||||
|
||||
static const char *const sector_opt[] = {
|
||||
|
@ -65,10 +58,8 @@ static const char *const sector_opt[] = {
|
|||
"camsec",
|
||||
"lines",
|
||||
"ffloors",
|
||||
#ifdef ESLOPE
|
||||
"f_slope",
|
||||
"c_slope",
|
||||
#endif
|
||||
NULL};
|
||||
|
||||
enum subsector_e {
|
||||
|
@ -181,10 +172,8 @@ enum ffloor_e {
|
|||
ffloor_toplightlevel,
|
||||
ffloor_bottomheight,
|
||||
ffloor_bottompic,
|
||||
#ifdef ESLOPE
|
||||
ffloor_tslope,
|
||||
ffloor_bslope,
|
||||
#endif
|
||||
ffloor_sector,
|
||||
ffloor_flags,
|
||||
ffloor_master,
|
||||
|
@ -201,10 +190,8 @@ static const char *const ffloor_opt[] = {
|
|||
"toplightlevel",
|
||||
"bottomheight",
|
||||
"bottompic",
|
||||
#ifdef ESLOPE
|
||||
"t_slope",
|
||||
"b_slope",
|
||||
#endif
|
||||
"sector", // secnum pushed as control sector userdata
|
||||
"flags",
|
||||
"master", // control linedef
|
||||
|
@ -290,7 +277,6 @@ static const char *const bbox_opt[] = {
|
|||
"right",
|
||||
NULL};
|
||||
|
||||
#ifdef ESLOPE
|
||||
enum slope_e {
|
||||
slope_valid = 0,
|
||||
slope_o,
|
||||
|
@ -325,7 +311,6 @@ static const char *const vector_opt[] = {
|
|||
"y",
|
||||
"z",
|
||||
NULL};
|
||||
#endif
|
||||
|
||||
static const char *const array_opt[] ={"iterate",NULL};
|
||||
static const char *const valid_opt[] ={"valid",NULL};
|
||||
|
@ -571,14 +556,12 @@ static int sector_get(lua_State *L)
|
|||
LUA_PushUserdata(L, sector->ffloors, META_FFLOOR);
|
||||
lua_pushcclosure(L, sector_iterate, 2); // push lib_iterateFFloors and sector->ffloors as upvalues for the function
|
||||
return 1;
|
||||
#ifdef ESLOPE
|
||||
case sector_fslope: // f_slope
|
||||
LUA_PushUserdata(L, sector->f_slope, META_SLOPE);
|
||||
return 1;
|
||||
case sector_cslope: // c_slope
|
||||
LUA_PushUserdata(L, sector->c_slope, META_SLOPE);
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -602,10 +585,8 @@ static int sector_set(lua_State *L)
|
|||
case sector_camsec: // camsec
|
||||
case sector_lines: // lines
|
||||
case sector_ffloors: // ffloors
|
||||
#ifdef ESLOPE
|
||||
case sector_fslope: // f_slope
|
||||
case sector_cslope: // c_slope
|
||||
#endif
|
||||
default:
|
||||
return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]);
|
||||
case sector_floorheight: { // floorheight
|
||||
|
@ -1693,14 +1674,12 @@ static int ffloor_get(lua_State *L)
|
|||
lua_pushlstring(L, levelflat->name, i);
|
||||
return 1;
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
case ffloor_tslope:
|
||||
LUA_PushUserdata(L, *ffloor->t_slope, META_SLOPE);
|
||||
return 1;
|
||||
case ffloor_bslope:
|
||||
LUA_PushUserdata(L, *ffloor->b_slope, META_SLOPE);
|
||||
return 1;
|
||||
#endif
|
||||
case ffloor_sector:
|
||||
LUA_PushUserdata(L, §ors[ffloor->secnum], META_SECTOR);
|
||||
return 1;
|
||||
|
@ -1740,10 +1719,8 @@ static int ffloor_set(lua_State *L)
|
|||
switch(field)
|
||||
{
|
||||
case ffloor_valid: // valid
|
||||
#ifdef ESLOPE
|
||||
case ffloor_tslope: // t_slope
|
||||
case ffloor_bslope: // b_slope
|
||||
#endif
|
||||
case ffloor_sector: // sector
|
||||
case ffloor_master: // master
|
||||
case ffloor_target: // target
|
||||
|
@ -1804,7 +1781,6 @@ static int ffloor_set(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef ESLOPE
|
||||
//////////////
|
||||
// pslope_t //
|
||||
//////////////
|
||||
|
@ -1977,7 +1953,6 @@ static int vector3_get(lua_State *L)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/////////////////////
|
||||
// mapheaderinfo[] //
|
||||
|
@ -2107,6 +2082,12 @@ static int mapheaderinfo_get(lua_State *L)
|
|||
lua_pushinteger(L, header->menuflags);
|
||||
else if (fastcmp(field,"startrings"))
|
||||
lua_pushinteger(L, header->startrings);
|
||||
else if (fastcmp(field, "sstimer"))
|
||||
lua_pushinteger(L, header->sstimer);
|
||||
else if (fastcmp(field, "ssspheres"))
|
||||
lua_pushinteger(L, header->ssspheres);
|
||||
else if (fastcmp(field, "gravity"))
|
||||
lua_pushfixed(L, header->gravity);
|
||||
// TODO add support for reading numGradedMares and grades
|
||||
else {
|
||||
// Read custom vars now
|
||||
|
@ -2226,7 +2207,6 @@ int LUA_MapLib(lua_State *L)
|
|||
lua_setfield(L, -2, "__index");
|
||||
lua_pop(L, 1);
|
||||
|
||||
#ifdef ESLOPE
|
||||
luaL_newmetatable(L, META_SLOPE);
|
||||
lua_pushcfunction(L, slope_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
|
@ -2244,7 +2224,6 @@ int LUA_MapLib(lua_State *L)
|
|||
lua_pushcfunction(L, vector3_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
lua_pop(L, 1);
|
||||
#endif
|
||||
|
||||
luaL_newmetatable(L, META_MAPHEADER);
|
||||
lua_pushcfunction(L, mapheaderinfo_get);
|
||||
|
@ -2337,5 +2316,3 @@ int LUA_MapLib(lua_State *L)
|
|||
lua_setglobal(L, "mapheaderinfo");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
/// \brief basic math library for Lua scripting
|
||||
|
||||
#include "doomdef.h"
|
||||
#ifdef HAVE_BLUA
|
||||
//#include "fastcmp.h"
|
||||
#include "tables.h"
|
||||
#include "p_local.h"
|
||||
|
@ -217,5 +216,3 @@ int LUA_MathLib(lua_State *L)
|
|||
luaL_register(L, NULL, lib);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,9 +11,8 @@
|
|||
/// \brief mobj/thing library for Lua scripting
|
||||
|
||||
#include "doomdef.h"
|
||||
#ifdef HAVE_BLUA
|
||||
#include "fastcmp.h"
|
||||
#include "r_things.h"
|
||||
#include "r_skins.h"
|
||||
#include "p_local.h"
|
||||
#include "g_game.h"
|
||||
#include "p_setup.h"
|
||||
|
@ -85,9 +84,7 @@ enum mobj_e {
|
|||
mobj_extravalue2,
|
||||
mobj_cusval,
|
||||
mobj_cvmem,
|
||||
#ifdef ESLOPE
|
||||
mobj_standingslope,
|
||||
#endif
|
||||
mobj_colorized,
|
||||
mobj_shadowscale
|
||||
};
|
||||
|
@ -153,9 +150,7 @@ static const char *const mobj_opt[] = {
|
|||
"extravalue2",
|
||||
"cusval",
|
||||
"cvmem",
|
||||
#ifdef ESLOPE
|
||||
"standingslope",
|
||||
#endif
|
||||
"colorized",
|
||||
"shadowscale",
|
||||
NULL};
|
||||
|
@ -384,11 +379,9 @@ static int mobj_get(lua_State *L)
|
|||
case mobj_cvmem:
|
||||
lua_pushinteger(L, mo->cvmem);
|
||||
break;
|
||||
#ifdef ESLOPE
|
||||
case mobj_standingslope:
|
||||
LUA_PushUserdata(L, mo->standingslope, META_SLOPE);
|
||||
break;
|
||||
#endif
|
||||
case mobj_colorized:
|
||||
lua_pushboolean(L, mo->colorized);
|
||||
break;
|
||||
|
@ -717,10 +710,8 @@ static int mobj_set(lua_State *L)
|
|||
case mobj_cvmem:
|
||||
mo->cvmem = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
#ifdef ESLOPE
|
||||
case mobj_standingslope:
|
||||
return NOSET;
|
||||
#endif
|
||||
case mobj_colorized:
|
||||
mo->colorized = luaL_checkboolean(L, 3);
|
||||
break;
|
||||
|
@ -915,5 +906,3 @@ int LUA_MobjLib(lua_State *L)
|
|||
lua_setglobal(L, "mapthings");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
/// \brief player object library for Lua scripting
|
||||
|
||||
#include "doomdef.h"
|
||||
#ifdef HAVE_BLUA
|
||||
#include "fastcmp.h"
|
||||
#include "p_mobj.h"
|
||||
#include "d_player.h"
|
||||
|
@ -97,6 +96,10 @@ static int player_get(lua_State *L)
|
|||
lua_pushboolean(L, true);
|
||||
else if (fastcmp(field,"name"))
|
||||
lua_pushstring(L, player_names[plr-players]);
|
||||
else if (fastcmp(field,"realmo"))
|
||||
LUA_PushUserdata(L, plr->mo, META_MOBJ);
|
||||
// Kept for backward-compatibility
|
||||
// Should be fixed to work like "realmo" later
|
||||
else if (fastcmp(field,"mo"))
|
||||
{
|
||||
if (plr->spectator)
|
||||
|
@ -398,7 +401,7 @@ static int player_set(lua_State *L)
|
|||
if (hud_running)
|
||||
return luaL_error(L, "Do not alter player_t in HUD rendering code!");
|
||||
|
||||
if (fastcmp(field,"mo")) {
|
||||
if (fastcmp(field,"mo") || fastcmp(field,"realmo")) {
|
||||
mobj_t *newmo = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
|
||||
plr->mo->player = NULL; // remove player pointer from old mobj
|
||||
(newmo->player = plr)->mo = newmo; // set player pointer for new mobj, and set new mobj as the player's mobj
|
||||
|
@ -874,5 +877,3 @@ int LUA_PlayerLib(lua_State *L)
|
|||
lua_setglobal(L, "players");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
121
src/lua_script.c
121
src/lua_script.c
|
@ -11,7 +11,6 @@
|
|||
/// \brief Lua scripting basics
|
||||
|
||||
#include "doomdef.h"
|
||||
#ifdef HAVE_BLUA
|
||||
#include "fastcmp.h"
|
||||
#include "dehacked.h"
|
||||
#include "z_zone.h"
|
||||
|
@ -24,9 +23,7 @@
|
|||
#include "byteptr.h"
|
||||
#include "p_saveg.h"
|
||||
#include "p_local.h"
|
||||
#ifdef ESLOPE
|
||||
#include "p_slopes.h" // for P_SlopeById
|
||||
#endif
|
||||
#ifdef LUA_ALLOW_BYTECODE
|
||||
#include "d_netfil.h" // for LUA_DumpFile
|
||||
#endif
|
||||
|
@ -444,9 +441,9 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump)
|
|||
else // If it's not a .lua file, copy the lump name in too.
|
||||
{
|
||||
lumpinfo_t *lump_p = &wadfiles[wad]->lumpinfo[lump];
|
||||
len += 1 + strlen(lump_p->name2); // length of file name, '|', and lump name
|
||||
len += 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name
|
||||
name = malloc(len+1);
|
||||
sprintf(name, "%s|%s", wadfiles[wad]->filename, lump_p->name2);
|
||||
sprintf(name, "%s|%s", wadfiles[wad]->filename, lump_p->fullname);
|
||||
name[len] = '\0';
|
||||
}
|
||||
|
||||
|
@ -571,6 +568,27 @@ fixed_t LUA_EvalMath(const char *word)
|
|||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
LUA_PushUserdata but no userdata is created.
|
||||
You can't invalidate it therefore.
|
||||
*/
|
||||
|
||||
void LUA_PushLightUserdata (lua_State *L, void *data, const char *meta)
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
lua_pushlightuserdata(L, data);
|
||||
luaL_getmetatable(L, meta);
|
||||
/*
|
||||
The metatable is the last value on the stack, so this
|
||||
applies it to the second value, which is the userdata.
|
||||
*/
|
||||
lua_setmetatable(L, -2);
|
||||
}
|
||||
else
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
// Takes a pointer, any pointer, and a metatable name
|
||||
// Creates a userdata for that pointer with the given metatable
|
||||
// Pushes it to the stack and stores it in the registry.
|
||||
|
@ -712,9 +730,13 @@ void LUA_InvalidatePlayer(player_t *player)
|
|||
enum
|
||||
{
|
||||
ARCH_NULL=0,
|
||||
ARCH_BOOLEAN,
|
||||
ARCH_SIGNED,
|
||||
ARCH_STRING,
|
||||
ARCH_TRUE,
|
||||
ARCH_FALSE,
|
||||
ARCH_INT8,
|
||||
ARCH_INT16,
|
||||
ARCH_INT32,
|
||||
ARCH_SMALLSTRING,
|
||||
ARCH_LARGESTRING,
|
||||
ARCH_TABLE,
|
||||
|
||||
ARCH_MOBJINFO,
|
||||
|
@ -732,9 +754,7 @@ enum
|
|||
ARCH_NODE,
|
||||
#endif
|
||||
ARCH_FFLOOR,
|
||||
#ifdef ESLOPE
|
||||
ARCH_SLOPE,
|
||||
#endif
|
||||
ARCH_MAPHEADER,
|
||||
|
||||
ARCH_TEND=0xFF,
|
||||
|
@ -759,9 +779,7 @@ static const struct {
|
|||
{META_NODE, ARCH_NODE},
|
||||
#endif
|
||||
{META_FFLOOR, ARCH_FFLOOR},
|
||||
#ifdef ESLOPE
|
||||
{META_SLOPE, ARCH_SLOPE},
|
||||
#endif
|
||||
{META_MAPHEADER, ARCH_MAPHEADER},
|
||||
{NULL, ARCH_NULL}
|
||||
};
|
||||
|
@ -803,22 +821,33 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
|
|||
WRITEUINT8(save_p, ARCH_NULL);
|
||||
return 2;
|
||||
case LUA_TBOOLEAN:
|
||||
WRITEUINT8(save_p, ARCH_BOOLEAN);
|
||||
WRITEUINT8(save_p, lua_toboolean(gL, myindex));
|
||||
WRITEUINT8(save_p, lua_toboolean(gL, myindex) ? ARCH_TRUE : ARCH_FALSE);
|
||||
break;
|
||||
case LUA_TNUMBER:
|
||||
{
|
||||
lua_Integer number = lua_tointeger(gL, myindex);
|
||||
WRITEUINT8(save_p, ARCH_SIGNED);
|
||||
if (number >= INT8_MIN && number <= INT8_MAX)
|
||||
{
|
||||
WRITEUINT8(save_p, ARCH_INT8);
|
||||
WRITESINT8(save_p, number);
|
||||
}
|
||||
else if (number >= INT16_MIN && number <= INT16_MAX)
|
||||
{
|
||||
WRITEUINT8(save_p, ARCH_INT16);
|
||||
WRITEINT16(save_p, number);
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITEUINT8(save_p, ARCH_INT32);
|
||||
WRITEFIXED(save_p, number);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LUA_TSTRING:
|
||||
{
|
||||
UINT16 len = (UINT16)lua_objlen(gL, myindex); // get length of string, including embedded zeros
|
||||
UINT32 len = (UINT32)lua_objlen(gL, myindex); // get length of string, including embedded zeros
|
||||
const char *s = lua_tostring(gL, myindex);
|
||||
UINT16 i = 0;
|
||||
WRITEUINT8(save_p, ARCH_STRING);
|
||||
UINT32 i = 0;
|
||||
// if you're wondering why we're writing a string to save_p this way,
|
||||
// it turns out that Lua can have embedded zeros ('\0') in the strings,
|
||||
// so we can't use WRITESTRING as that cuts off when it finds a '\0'.
|
||||
|
@ -826,7 +855,16 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
|
|||
// fixing the awful crashes previously encountered for reading strings longer than 1024
|
||||
// (yes I know that's kind of a stupid thing to care about, but it'd be evil to trim or ignore them?)
|
||||
// -- Monster Iestyn 05/08/18
|
||||
WRITEUINT16(save_p, len); // save size of string
|
||||
if (len < 255)
|
||||
{
|
||||
WRITEUINT8(save_p, ARCH_SMALLSTRING);
|
||||
WRITEUINT8(save_p, len); // save size of string
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITEUINT8(save_p, ARCH_LARGESTRING);
|
||||
WRITEUINT32(save_p, len); // save size of string
|
||||
}
|
||||
while (i < len)
|
||||
WRITECHAR(save_p, s[i++]); // write chars individually, including the embedded zeros
|
||||
break;
|
||||
|
@ -996,16 +1034,8 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
|
|||
if (!rover)
|
||||
WRITEUINT8(save_p, ARCH_NULL);
|
||||
else {
|
||||
ffloor_t *r2;
|
||||
UINT16 i = 0;
|
||||
// search for id
|
||||
for (r2 = rover->target->ffloors; r2; r2 = r2->next)
|
||||
{
|
||||
if (r2 == rover)
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
if (!r2)
|
||||
UINT16 i = P_GetFFloorID(rover);
|
||||
if (i == UINT16_MAX) // invalid ID
|
||||
WRITEUINT8(save_p, ARCH_NULL);
|
||||
else
|
||||
{
|
||||
|
@ -1016,7 +1046,6 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
|
|||
}
|
||||
break;
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
case ARCH_SLOPE:
|
||||
{
|
||||
pslope_t *slope = *((pslope_t **)lua_touserdata(gL, myindex));
|
||||
|
@ -1028,7 +1057,6 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
|
|||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case ARCH_MAPHEADER:
|
||||
{
|
||||
mapheader_t *header = *((mapheader_t **)lua_touserdata(gL, myindex));
|
||||
|
@ -1166,21 +1194,36 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
|
|||
case ARCH_NULL:
|
||||
lua_pushnil(gL);
|
||||
break;
|
||||
case ARCH_BOOLEAN:
|
||||
lua_pushboolean(gL, READUINT8(save_p));
|
||||
case ARCH_TRUE:
|
||||
lua_pushboolean(gL, true);
|
||||
break;
|
||||
case ARCH_SIGNED:
|
||||
case ARCH_FALSE:
|
||||
lua_pushboolean(gL, false);
|
||||
break;
|
||||
case ARCH_INT8:
|
||||
lua_pushinteger(gL, READSINT8(save_p));
|
||||
break;
|
||||
case ARCH_INT16:
|
||||
lua_pushinteger(gL, READINT16(save_p));
|
||||
break;
|
||||
case ARCH_INT32:
|
||||
lua_pushinteger(gL, READFIXED(save_p));
|
||||
break;
|
||||
case ARCH_STRING:
|
||||
case ARCH_SMALLSTRING:
|
||||
case ARCH_LARGESTRING:
|
||||
{
|
||||
UINT16 len = READUINT16(save_p); // length of string, including embedded zeros
|
||||
UINT32 len;
|
||||
char *value;
|
||||
UINT16 i = 0;
|
||||
UINT32 i = 0;
|
||||
|
||||
// See my comments in the ArchiveValue function;
|
||||
// it's much the same for reading strings as writing them!
|
||||
// (i.e. we can't use READSTRING either)
|
||||
// -- Monster Iestyn 05/08/18
|
||||
if (type == ARCH_SMALLSTRING)
|
||||
len = READUINT8(save_p); // length of string, including embedded zeros
|
||||
else
|
||||
len = READUINT32(save_p); // length of string, including embedded zeros
|
||||
value = malloc(len); // make temp buffer of size len
|
||||
// now read the actual string
|
||||
while (i < len)
|
||||
|
@ -1250,11 +1293,9 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
|
|||
LUA_PushUserdata(gL, rover, META_FFLOOR);
|
||||
break;
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
case ARCH_SLOPE:
|
||||
LUA_PushUserdata(gL, P_SlopeById(READUINT16(save_p)), META_SLOPE);
|
||||
break;
|
||||
#endif
|
||||
case ARCH_MAPHEADER:
|
||||
LUA_PushUserdata(gL, mapheaderinfo[READUINT16(save_p)], META_MAPHEADER);
|
||||
break;
|
||||
|
@ -1423,5 +1464,3 @@ int Lua_optoption(lua_State *L, int narg,
|
|||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif // HAVE_BLUA
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
/// \file lua_script.h
|
||||
/// \brief Lua scripting basics
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
|
||||
#include "m_fixed.h"
|
||||
#include "doomtype.h"
|
||||
#include "d_player.h"
|
||||
|
@ -46,6 +44,7 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump);
|
|||
void LUA_DumpFile(const char *filename);
|
||||
#endif
|
||||
fixed_t LUA_EvalMath(const char *word);
|
||||
void LUA_PushLightUserdata(lua_State *L, void *data, const char *meta);
|
||||
void LUA_PushUserdata(lua_State *L, void *data, const char *meta);
|
||||
void LUA_InvalidateUserdata(void *data);
|
||||
void LUA_InvalidateLevel(void);
|
||||
|
@ -102,5 +101,3 @@ void COM_Lua_f(void);
|
|||
|
||||
#define INLEVEL if (gamestate != GS_LEVEL && !titlemapinaction)\
|
||||
return luaL_error(L, "This can only be used in a level!");
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,9 +11,8 @@
|
|||
/// \brief player skin structure library for Lua scripting
|
||||
|
||||
#include "doomdef.h"
|
||||
#ifdef HAVE_BLUA
|
||||
#include "fastcmp.h"
|
||||
#include "r_things.h"
|
||||
#include "r_skins.h"
|
||||
#include "sounds.h"
|
||||
|
||||
#include "lua_script.h"
|
||||
|
@ -358,5 +357,3 @@ int LUA_SkinLib(lua_State *L)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
/// \brief thinker library for Lua scripting
|
||||
|
||||
#include "doomdef.h"
|
||||
#ifdef HAVE_BLUA
|
||||
#include "p_local.h"
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
|
@ -139,5 +138,3 @@ int LUA_ThinkerLib(lua_State *L)
|
|||
lua_setglobal(L, "mobjs");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
19
src/m_argv.c
19
src/m_argv.c
|
@ -34,6 +34,25 @@ boolean myargmalloc = false;
|
|||
*/
|
||||
static INT32 found;
|
||||
|
||||
/** \brief Parses a server URL (such as srb2://127.0.0.1) as may be passed to the game via a web browser, etc.
|
||||
|
||||
\return the contents of the URL after the protocol (a server to join), or NULL if not found
|
||||
*/
|
||||
const char *M_GetUrlProtocolArg(void)
|
||||
{
|
||||
INT32 i;
|
||||
const size_t len = strlen(SERVER_URL_PROTOCOL);
|
||||
|
||||
for (i = 1; i < myargc; i++)
|
||||
{
|
||||
if (strlen(myargv[i]) > len && !strnicmp(myargv[i], SERVER_URL_PROTOCOL, len))
|
||||
{
|
||||
return &myargv[i][len];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** \brief The M_CheckParm function
|
||||
|
||||
|
|
|
@ -21,6 +21,9 @@ extern INT32 myargc;
|
|||
extern char **myargv;
|
||||
extern boolean myargmalloc;
|
||||
|
||||
// Looks for an srb2:// (or similar) URL passed in as an argument and returns the IP to connect to if found.
|
||||
const char *M_GetUrlProtocolArg(void);
|
||||
|
||||
// Returns the position of the given parameter in the arg list (0 if not found).
|
||||
INT32 M_CheckParm(const char *check);
|
||||
|
||||
|
|
|
@ -788,7 +788,7 @@ void Command_CauseCfail_f(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_BLUA) && defined(LUA_ALLOW_BYTECODE)
|
||||
#ifdef LUA_ALLOW_BYTECODE
|
||||
void Command_Dumplua_f(void)
|
||||
{
|
||||
if (modifiedgame)
|
||||
|
@ -934,6 +934,12 @@ void Command_Setcontinues_f(void)
|
|||
REQUIRE_NOULTIMATE;
|
||||
REQUIRE_PANDORA;
|
||||
|
||||
if (!continuesInSession)
|
||||
{
|
||||
CONS_Printf(M_GetText("This session does not use continues.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (COM_Argc() > 1)
|
||||
{
|
||||
INT32 numcontinues = atoi(COM_Argv(1));
|
||||
|
@ -1025,13 +1031,9 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling)
|
|||
|
||||
if (ceiling)
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
// Truncate position to match where mapthing would be when spawned
|
||||
// (this applies to every further P_GetZAt call as well)
|
||||
fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->ceilingheight;
|
||||
#else
|
||||
fixed_t cheight = sec->ceilingheight;
|
||||
#endif
|
||||
|
||||
if (((cheight - player->mo->z - player->mo->height)>>FRACBITS) >= (1 << (16-ZSHIFT)))
|
||||
{
|
||||
|
@ -1042,11 +1044,7 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight;
|
||||
#else
|
||||
fixed_t fheight = sec->floorheight;
|
||||
#endif
|
||||
if (((player->mo->z - fheight)>>FRACBITS) >= (1 << (16-ZSHIFT)))
|
||||
{
|
||||
CONS_Printf(M_GetText("Sorry, you're too %s to place this object (max: %d %s).\n"), M_GetText("high"),
|
||||
|
@ -1062,9 +1060,7 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
|
|||
mapthing_t *mt = mapthings;
|
||||
sector_t *sec = player->mo->subsector->sector;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_InvalidateMapthings();
|
||||
#endif
|
||||
|
||||
mapthings = Z_Realloc(mapthings, ++nummapthings * sizeof (*mapthings), PU_LEVEL, NULL);
|
||||
|
||||
|
@ -1095,20 +1091,12 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
|
|||
mt->y = (INT16)(player->mo->y>>FRACBITS);
|
||||
if (ceiling)
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, mt->x << FRACBITS, mt->y << FRACBITS) : sec->ceilingheight;
|
||||
#else
|
||||
fixed_t cheight = sec->ceilingheight;
|
||||
#endif
|
||||
mt->z = (UINT16)((cheight - player->mo->z - player->mo->height)>>FRACBITS);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, mt->x << FRACBITS, mt->y << FRACBITS) : sec->floorheight;
|
||||
#else
|
||||
fixed_t fheight = sec->floorheight;
|
||||
#endif
|
||||
mt->z = (UINT16)((player->mo->z - fheight)>>FRACBITS);
|
||||
}
|
||||
mt->angle = (INT16)(FixedInt(AngleFixed(player->mo->angle)));
|
||||
|
@ -1354,20 +1342,12 @@ void OP_ObjectplaceMovement(player_t *player)
|
|||
|
||||
if (!!(mobjinfo[op_currentthing].flags & MF_SPAWNCEILING) ^ !!(cv_opflags.value & MTF_OBJECTFLIP))
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->ceilingheight;
|
||||
#else
|
||||
fixed_t cheight = sec->ceilingheight;
|
||||
#endif
|
||||
op_displayflags = (UINT16)((cheight - player->mo->z - mobjinfo[op_currentthing].height)>>FRACBITS);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight;
|
||||
#else
|
||||
fixed_t fheight = sec->floorheight;
|
||||
#endif
|
||||
op_displayflags = (UINT16)((player->mo->z - fheight)>>FRACBITS);
|
||||
}
|
||||
op_displayflags <<= ZSHIFT;
|
||||
|
|
|
@ -68,7 +68,7 @@ void Command_Toggletwod_f(void);
|
|||
#ifdef _DEBUG
|
||||
void Command_CauseCfail_f(void);
|
||||
#endif
|
||||
#if defined(HAVE_BLUA) && defined(LUA_ALLOW_BYTECODE)
|
||||
#ifdef LUA_ALLOW_BYTECODE
|
||||
void Command_Dumplua_f(void);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "v_video.h" // video flags
|
||||
|
||||
#include "g_game.h" // record info
|
||||
#include "r_things.h" // numskins
|
||||
#include "r_skins.h" // numskins
|
||||
#include "r_draw.h" // R_GetColorByName
|
||||
|
||||
// Map triggers for linedef executors
|
||||
|
|
|
@ -38,8 +38,20 @@ typedef INT32 fixed_t;
|
|||
/*!
|
||||
\brief convert fixed_t into floating number
|
||||
*/
|
||||
#define FIXED_TO_FLOAT(x) (((float)(x)) / ((float)FRACUNIT))
|
||||
#define FLOAT_TO_FIXED(f) (fixed_t)((f) * ((float)FRACUNIT))
|
||||
|
||||
FUNCMATH FUNCINLINE static ATTRINLINE float FixedToFloat(fixed_t x)
|
||||
{
|
||||
return x / (float)FRACUNIT;
|
||||
}
|
||||
|
||||
FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FloatToFixed(float f)
|
||||
{
|
||||
return (fixed_t)(f * FRACUNIT);
|
||||
}
|
||||
|
||||
// for backwards compat
|
||||
#define FIXED_TO_FLOAT(x) FixedToFloat(x) // (((float)(x)) / ((float)FRACUNIT))
|
||||
#define FLOAT_TO_FIXED(f) FloatToFixed(f) // (fixed_t)((f) * ((float)FRACUNIT))
|
||||
|
||||
|
||||
#if defined (__WATCOMC__) && FRACBITS == 16
|
||||
|
|
168
src/m_menu.c
168
src/m_menu.c
|
@ -312,6 +312,7 @@ static void M_AssignJoystick(INT32 choice);
|
|||
static void M_ChangeControl(INT32 choice);
|
||||
|
||||
// Video & Sound
|
||||
static void M_VideoOptions(INT32 choice);
|
||||
menu_t OP_VideoOptionsDef, OP_VideoModeDef, OP_ColorOptionsDef;
|
||||
#ifdef HWRENDER
|
||||
static void M_OpenGLOptionsMenu(void);
|
||||
|
@ -521,6 +522,8 @@ static menuitem_t MISC_AddonsMenu[] =
|
|||
// ---------------------------------
|
||||
static menuitem_t MAPauseMenu[] =
|
||||
{
|
||||
{IT_CALL | IT_STRING, NULL, "Emblem Hints...", M_EmblemHints, 32},
|
||||
|
||||
{IT_CALL | IT_STRING, NULL, "Continue", M_SelectableClearMenus,48},
|
||||
{IT_CALL | IT_STRING, NULL, "Retry", M_ModeAttackRetry, 56},
|
||||
{IT_CALL | IT_STRING, NULL, "Abort", M_ModeAttackEndGame, 64},
|
||||
|
@ -528,6 +531,7 @@ static menuitem_t MAPauseMenu[] =
|
|||
|
||||
typedef enum
|
||||
{
|
||||
mapause_hints,
|
||||
mapause_continue,
|
||||
mapause_retry,
|
||||
mapause_abort
|
||||
|
@ -731,7 +735,7 @@ static menuitem_t SR_EmblemHintMenu[] =
|
|||
{
|
||||
{IT_STRING | IT_ARROWS, NULL, "Page", M_HandleEmblemHints, 10},
|
||||
{IT_STRING|IT_CVAR, NULL, "Emblem Radar", &cv_itemfinder, 20},
|
||||
{IT_WHITESTRING|IT_SUBMENU, NULL, "Back", &SPauseDef, 30}
|
||||
{IT_WHITESTRING|IT_CALL, NULL, "Back", M_GoBack, 30}
|
||||
};
|
||||
|
||||
// --------------------------------
|
||||
|
@ -1034,7 +1038,7 @@ static menuitem_t OP_MainMenu[] =
|
|||
{IT_SUBMENU | IT_STRING, NULL, "Player 2 Controls...", &OP_P2ControlsDef, 20},
|
||||
{IT_CVAR | IT_STRING, NULL, "Controls per key", &cv_controlperkey, 30},
|
||||
|
||||
{IT_SUBMENU | IT_STRING, NULL, "Video Options...", &OP_VideoOptionsDef, 50},
|
||||
{IT_CALL | IT_STRING, NULL, "Video Options...", M_VideoOptions, 50},
|
||||
{IT_SUBMENU | IT_STRING, NULL, "Sound Options...", &OP_SoundOptionsDef, 60},
|
||||
|
||||
{IT_CALL | IT_STRING, NULL, "Server Options...", M_ServerOptions, 80},
|
||||
|
@ -1285,6 +1289,16 @@ static menuitem_t OP_Camera2ExtendedOptionsMenu[] =
|
|||
{IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair2, 126},
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
op_video_resolution = 1,
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
op_video_fullscreen,
|
||||
#endif
|
||||
op_video_vsync,
|
||||
op_video_renderer,
|
||||
};
|
||||
|
||||
static menuitem_t OP_VideoOptionsMenu[] =
|
||||
{
|
||||
{IT_HEADER, NULL, "Screen", NULL, 0},
|
||||
|
@ -1615,7 +1629,8 @@ static menuitem_t OP_ServerOptionsMenu[] =
|
|||
#ifndef NONET
|
||||
{IT_HEADER, NULL, "Advanced", NULL, 225},
|
||||
{IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "Master server", &cv_masterserver, 231},
|
||||
{IT_STRING | IT_CVAR, NULL, "Attempts to resynchronise", &cv_resynchattempts, 245},
|
||||
{IT_STRING | IT_CVAR, NULL, "Join delay", &cv_joindelay, 246},
|
||||
{IT_STRING | IT_CVAR, NULL, "Attempts to resynchronise", &cv_resynchattempts, 251},
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -2086,6 +2101,20 @@ menu_t OP_PlaystyleDef = {
|
|||
0, 0, 0, NULL
|
||||
};
|
||||
|
||||
static void M_VideoOptions(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
#ifdef HWRENDER
|
||||
if (vid_opengl_state == -1)
|
||||
{
|
||||
OP_VideoOptionsMenu[op_video_renderer].status = (IT_TRANSTEXT | IT_PAIR);
|
||||
OP_VideoOptionsMenu[op_video_renderer].patch = "Renderer";
|
||||
OP_VideoOptionsMenu[op_video_renderer].text = "Software";
|
||||
}
|
||||
|
||||
#endif
|
||||
M_SetupNextMenu(&OP_VideoOptionsDef);
|
||||
}
|
||||
|
||||
menu_t OP_VideoOptionsDef =
|
||||
{
|
||||
|
@ -2184,7 +2213,7 @@ menu_t OP_DataOptionsDef = DEFAULTMENUSTYLE(
|
|||
menu_t OP_ScreenshotOptionsDef =
|
||||
{
|
||||
MTREE3(MN_OP_MAIN, MN_OP_DATA, MN_OP_SCREENSHOTS),
|
||||
"M_DATA",
|
||||
"M_SCREEN",
|
||||
sizeof (OP_ScreenshotOptionsMenu)/sizeof (menuitem_t),
|
||||
&OP_DataOptionsDef,
|
||||
OP_ScreenshotOptionsMenu,
|
||||
|
@ -3158,6 +3187,9 @@ boolean M_Responder(event_t *ev)
|
|||
if (gamestate == GS_TITLESCREEN && finalecount < TICRATE)
|
||||
return false;
|
||||
|
||||
if (CON_Ready())
|
||||
return false;
|
||||
|
||||
if (noFurtherInput)
|
||||
{
|
||||
// Ignore input after enter/escape/other buttons
|
||||
|
@ -3517,6 +3549,7 @@ boolean M_Responder(event_t *ev)
|
|||
return false;
|
||||
|
||||
default:
|
||||
CON_Responder(ev);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3610,6 +3643,7 @@ void M_StartControlPanel(void)
|
|||
else if (modeattacking)
|
||||
{
|
||||
currentMenu = &MAPauseDef;
|
||||
MAPauseMenu[mapause_hints].status = (M_SecretUnlocked(SECRET_EMBLEMHINTS)) ? (IT_STRING | IT_CALL) : (IT_DISABLED);
|
||||
itemOn = mapause_continue;
|
||||
}
|
||||
else if (!(netgame || multiplayer)) // Single Player
|
||||
|
@ -5050,6 +5084,17 @@ static boolean M_SetNextMapOnPlatter(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
static boolean M_GametypeHasLevels(INT32 gt)
|
||||
{
|
||||
INT32 mapnum;
|
||||
|
||||
for (mapnum = 0; mapnum < NUMMAPS; mapnum++)
|
||||
if (M_CanShowLevelOnPlatter(mapnum, gt))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static INT32 M_CountRowsToShowOnPlatter(INT32 gt)
|
||||
{
|
||||
INT32 mapnum = 0, prevmapnum = 0, col = 0, rows = 0;
|
||||
|
@ -5367,7 +5412,10 @@ static void M_HandleLevelPlatter(INT32 choice)
|
|||
case KEY_RIGHTARROW:
|
||||
if (levellistmode == LLM_CREATESERVER && !lsrow)
|
||||
{
|
||||
INT32 startinggametype = cv_newgametype.value;
|
||||
do
|
||||
CV_AddValue(&cv_newgametype, 1);
|
||||
while (cv_newgametype.value != startinggametype && !M_GametypeHasLevels(cv_newgametype.value));
|
||||
S_StartSound(NULL,sfx_menu1);
|
||||
lscol = 0;
|
||||
|
||||
|
@ -5396,7 +5444,10 @@ static void M_HandleLevelPlatter(INT32 choice)
|
|||
case KEY_LEFTARROW:
|
||||
if (levellistmode == LLM_CREATESERVER && !lsrow)
|
||||
{
|
||||
INT32 startinggametype = cv_newgametype.value;
|
||||
do
|
||||
CV_AddValue(&cv_newgametype, -1);
|
||||
while (cv_newgametype.value != startinggametype && !M_GametypeHasLevels(cv_newgametype.value));
|
||||
S_StartSound(NULL,sfx_menu1);
|
||||
lscol = 0;
|
||||
|
||||
|
@ -5716,6 +5767,8 @@ static void M_DrawNightsAttackSuperSonic(void)
|
|||
const UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_YELLOW, GTC_CACHE);
|
||||
INT32 timer = (ntsatkdrawtimer/4) % 2;
|
||||
angle_t fa = (FixedAngle(((ntsatkdrawtimer * 4) % 360)<<FRACBITS)>>ANGLETOFINESHIFT) & FINEMASK;
|
||||
ntssupersonic[0] = W_CachePatchName("NTSSONC1", PU_PATCH);
|
||||
ntssupersonic[1] = W_CachePatchName("NTSSONC2", PU_PATCH);
|
||||
V_DrawFixedPatch(235<<FRACBITS, (120<<FRACBITS) - (8*FINESINE(fa)), FRACUNIT, 0, ntssupersonic[timer], colormap);
|
||||
}
|
||||
|
||||
|
@ -6631,12 +6684,6 @@ static void M_HandleAddons(INT32 choice)
|
|||
M_AddonExec(KEY_ENTER);
|
||||
break;
|
||||
case EXT_LUA:
|
||||
#ifndef HAVE_BLUA
|
||||
S_StartSound(NULL, sfx_lose);
|
||||
M_StartMessage(va("%c%s\x80\nThis copy of SRB2 was compiled\nwithout support for .lua files.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING);
|
||||
break;
|
||||
#endif
|
||||
/* FALLTHRU */
|
||||
case EXT_SOC:
|
||||
case EXT_WAD:
|
||||
#ifdef USE_KART
|
||||
|
@ -6687,6 +6734,7 @@ static void M_PandorasBox(INT32 choice)
|
|||
else
|
||||
CV_StealthSetValue(&cv_dummylives, max(players[consoleplayer].lives, 1));
|
||||
CV_StealthSetValue(&cv_dummycontinues, players[consoleplayer].continues);
|
||||
SR_PandorasBox[3].status = (continuesInSession) ? (IT_STRING | IT_CVAR) : (IT_GRAYEDOUT);
|
||||
SR_PandorasBox[6].status = (players[consoleplayer].charflags & SF_SUPER) ? (IT_GRAYEDOUT) : (IT_STRING | IT_CALL);
|
||||
SR_PandorasBox[7].status = (emeralds == ((EMERALD7)*2)-1) ? (IT_GRAYEDOUT) : (IT_STRING | IT_CALL);
|
||||
M_SetupNextMenu(&SR_PandoraDef);
|
||||
|
@ -6703,7 +6751,7 @@ static boolean M_ExitPandorasBox(void)
|
|||
}
|
||||
if (cv_dummylives.value != players[consoleplayer].lives)
|
||||
COM_ImmedExecute(va("setlives %d", cv_dummylives.value));
|
||||
if (cv_dummycontinues.value != players[consoleplayer].continues)
|
||||
if (continuesInSession && cv_dummycontinues.value != players[consoleplayer].continues)
|
||||
COM_ImmedExecute(va("setcontinues %d", cv_dummycontinues.value));
|
||||
return true;
|
||||
}
|
||||
|
@ -7267,6 +7315,7 @@ static void M_EmblemHints(INT32 choice)
|
|||
SR_EmblemHintMenu[0].status = (local > NUMHINTS*2) ? (IT_STRING | IT_ARROWS) : (IT_DISABLED);
|
||||
SR_EmblemHintMenu[1].status = (M_SecretUnlocked(SECRET_ITEMFINDER)) ? (IT_CVAR|IT_STRING) : (IT_SECRET);
|
||||
hintpage = 1;
|
||||
SR_EmblemHintDef.prevMenu = currentMenu;
|
||||
M_SetupNextMenu(&SR_EmblemHintDef);
|
||||
itemOn = 2; // always start on back.
|
||||
}
|
||||
|
@ -7947,12 +7996,20 @@ static void M_CustomLevelSelect(INT32 choice)
|
|||
static void M_SinglePlayerMenu(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
SP_MainMenu[sptutorial].status =
|
||||
tutorialmap ? IT_CALL|IT_STRING : IT_NOTHING|IT_DISABLED;
|
||||
SP_MainMenu[sprecordattack].status =
|
||||
(M_SecretUnlocked(SECRET_RECORDATTACK)) ? IT_CALL|IT_STRING : IT_SECRET;
|
||||
SP_MainMenu[spnightsmode].status =
|
||||
(M_SecretUnlocked(SECRET_NIGHTSMODE)) ? IT_CALL|IT_STRING : IT_SECRET;
|
||||
|
||||
levellistmode = LLM_RECORDATTACK;
|
||||
if (M_GametypeHasLevels(-1))
|
||||
SP_MainMenu[sprecordattack].status = (M_SecretUnlocked(SECRET_RECORDATTACK)) ? IT_CALL|IT_STRING : IT_SECRET;
|
||||
else
|
||||
SP_MainMenu[sprecordattack].status = IT_NOTHING|IT_DISABLED;
|
||||
|
||||
levellistmode = LLM_NIGHTSATTACK;
|
||||
if (M_GametypeHasLevels(-1))
|
||||
SP_MainMenu[spnightsmode].status = (M_SecretUnlocked(SECRET_NIGHTSMODE)) ? IT_CALL|IT_STRING : IT_SECRET;
|
||||
else
|
||||
SP_MainMenu[spnightsmode].status = IT_NOTHING|IT_DISABLED;
|
||||
|
||||
SP_MainMenu[sptutorial].status = tutorialmap ? IT_CALL|IT_STRING : IT_NOTHING|IT_DISABLED;
|
||||
|
||||
M_SetupNextMenu(&SP_MainDef);
|
||||
}
|
||||
|
@ -8214,9 +8271,19 @@ static void M_DrawLoadGameData(void)
|
|||
V_DrawRightAlignedThinString(x + 79, y, V_YELLOWMAP, savegameinfo[savetodraw].levelname);
|
||||
}
|
||||
|
||||
if ((savegameinfo[savetodraw].lives == -42)
|
||||
|| (savegameinfo[savetodraw].lives == -666))
|
||||
if (savegameinfo[savetodraw].lives == -42)
|
||||
{
|
||||
if (!useContinues)
|
||||
V_DrawRightAlignedThinString(x + 80, y+1+60+16, V_GRAYMAP, "00000000");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (savegameinfo[savetodraw].lives == -666)
|
||||
{
|
||||
if (!useContinues)
|
||||
V_DrawRightAlignedThinString(x + 80, y+1+60+16, V_REDMAP, "????????");
|
||||
continue;
|
||||
}
|
||||
|
||||
y += 64;
|
||||
|
||||
|
@ -8233,7 +8300,7 @@ static void M_DrawLoadGameData(void)
|
|||
|
||||
y -= 4;
|
||||
|
||||
// character heads, lives, and continues
|
||||
// character heads, lives, and continues/score
|
||||
{
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
|
@ -8284,10 +8351,14 @@ skipbot:
|
|||
skipsign:
|
||||
y += 16;
|
||||
|
||||
tempx = x + 10;
|
||||
tempx = x;
|
||||
if (useContinues)
|
||||
{
|
||||
tempx += 10;
|
||||
if (savegameinfo[savetodraw].lives != INFLIVES
|
||||
&& savegameinfo[savetodraw].lives > 9)
|
||||
tempx -= 4;
|
||||
}
|
||||
|
||||
if (!charskin) // shut up compiler
|
||||
goto skiplife;
|
||||
|
@ -8317,16 +8388,38 @@ skiplife:
|
|||
else
|
||||
V_DrawString(tempx, y, 0, va("%d", savegameinfo[savetodraw].lives));
|
||||
|
||||
if (!useContinues)
|
||||
{
|
||||
INT32 workingscorenum = savegameinfo[savetodraw].continuescore;
|
||||
char workingscorestr[11] = " 000000000\0";
|
||||
SINT8 j = 9;
|
||||
// Change the above two lines if MAXSCORE ever changes from 8 digits long.
|
||||
workingscorestr[0] = '\x86'; // done here instead of in initialiser 'cuz compiler complains
|
||||
if (!workingscorenum)
|
||||
j--; // just so ONE digit is not greyed out
|
||||
else
|
||||
{
|
||||
while (workingscorenum)
|
||||
{
|
||||
workingscorestr[j--] = '0' + (workingscorenum % 10);
|
||||
workingscorenum /= 10;
|
||||
}
|
||||
}
|
||||
workingscorestr[j] = (savegameinfo[savetodraw].continuescore == MAXSCORE) ? '\x83' : '\x80';
|
||||
V_DrawRightAlignedThinString(x + 80, y+1, 0, workingscorestr);
|
||||
}
|
||||
else
|
||||
{
|
||||
tempx = x + 47;
|
||||
if (savegameinfo[savetodraw].continues > 9)
|
||||
if (savegameinfo[savetodraw].continuescore > 9)
|
||||
tempx -= 4;
|
||||
|
||||
// continues
|
||||
if (savegameinfo[savetodraw].continues > 0)
|
||||
if (savegameinfo[savetodraw].continuescore > 0)
|
||||
{
|
||||
V_DrawSmallScaledPatch(tempx, y, 0, W_CachePatchName("CONTSAVE", PU_PATCH));
|
||||
V_DrawScaledPatch(tempx + 9, y + 2, 0, patch);
|
||||
V_DrawString(tempx + 16, y, 0, va("%d", savegameinfo[savetodraw].continues));
|
||||
V_DrawString(tempx + 16, y, 0, va("%d", savegameinfo[savetodraw].continuescore));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -8337,6 +8430,7 @@ skiplife:
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void M_DrawLoad(void)
|
||||
{
|
||||
|
@ -8465,9 +8559,11 @@ static void M_ReadSavegameInfo(UINT32 slot)
|
|||
CHECKPOS
|
||||
savegameinfo[slot].lives = READSINT8(save_p); // lives
|
||||
CHECKPOS
|
||||
(void)READINT32(save_p); // Score
|
||||
savegameinfo[slot].continuescore = READINT32(save_p); // score
|
||||
CHECKPOS
|
||||
savegameinfo[slot].continues = READINT32(save_p); // continues
|
||||
fake = READINT32(save_p); // continues
|
||||
if (useContinues)
|
||||
savegameinfo[slot].continuescore = fake;
|
||||
|
||||
// File end marker check
|
||||
CHECKPOS
|
||||
|
@ -9949,9 +10045,6 @@ static void M_NightsAttack(INT32 choice)
|
|||
// This is really just to make sure Sonic is the played character, just in case
|
||||
M_PatchSkinNameTable();
|
||||
|
||||
ntssupersonic[0] = W_CachePatchName("NTSSONC1", PU_PATCH);
|
||||
ntssupersonic[1] = W_CachePatchName("NTSSONC2", PU_PATCH);
|
||||
|
||||
G_SetGamestate(GS_TIMEATTACK); // do this before M_SetupNextMenu so that menu meta state knows that we're switching
|
||||
titlemapinaction = TITLEMAP_OFF; // Nope don't give us HOMs please
|
||||
M_SetupNextMenu(&SP_NightsAttackDef);
|
||||
|
@ -10071,13 +10164,13 @@ static void M_ReplayTimeAttack(INT32 choice)
|
|||
static void M_EraseGuest(INT32 choice)
|
||||
{
|
||||
const char *rguest = va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value));
|
||||
(void)choice;
|
||||
|
||||
if (choice == 'y' || choice == KEY_ENTER)
|
||||
{
|
||||
if (FIL_FileExists(rguest))
|
||||
remove(rguest);
|
||||
if (currentMenu == &SP_NightsGuestReplayDef)
|
||||
M_SetupNextMenu(&SP_NightsAttackDef);
|
||||
else
|
||||
M_SetupNextMenu(&SP_TimeAttackDef);
|
||||
}
|
||||
M_SetupNextMenu(currentMenu->prevMenu->prevMenu);
|
||||
Nextmap_OnChange();
|
||||
M_StartMessage(M_GetText("Guest replay data erased.\n"),NULL,MM_NOTHING);
|
||||
}
|
||||
|
@ -10366,7 +10459,7 @@ static void M_DrawConnectMenu(void)
|
|||
for (i = 0; i < min(serverlistcount - serverlistpage * SERVERS_PER_PAGE, SERVERS_PER_PAGE); i++)
|
||||
{
|
||||
INT32 slindex = i + serverlistpage * SERVERS_PER_PAGE;
|
||||
UINT32 globalflags = ((serverlist[slindex].info.numberofplayer >= serverlist[slindex].info.maxplayer) ? V_TRANSLUCENT : 0)
|
||||
UINT32 globalflags = (serverlist[slindex].info.refusereason ? V_TRANSLUCENT : 0)
|
||||
|((itemOn == FIRSTSERVERLINE+i) ? V_YELLOWMAP : 0)|V_ALLOWLOWERCASE;
|
||||
|
||||
V_DrawString(currentMenu->x, S_LINEY(i), globalflags, serverlist[slindex].info.servername);
|
||||
|
@ -10730,7 +10823,8 @@ static void M_ServerOptions(INT32 choice)
|
|||
OP_ServerOptionsMenu[ 3].status = IT_GRAYEDOUT; // Allow add-on downloading
|
||||
OP_ServerOptionsMenu[ 4].status = IT_GRAYEDOUT; // Allow players to join
|
||||
OP_ServerOptionsMenu[35].status = IT_GRAYEDOUT; // Master server
|
||||
OP_ServerOptionsMenu[36].status = IT_GRAYEDOUT; // Attempts to resynchronise
|
||||
OP_ServerOptionsMenu[36].status = IT_GRAYEDOUT; // Minimum delay between joins
|
||||
OP_ServerOptionsMenu[37].status = IT_GRAYEDOUT; // Attempts to resynchronise
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -10742,6 +10836,7 @@ static void M_ServerOptions(INT32 choice)
|
|||
? IT_GRAYEDOUT
|
||||
: (IT_STRING | IT_CVAR | IT_CV_STRING));
|
||||
OP_ServerOptionsMenu[36].status = IT_STRING | IT_CVAR;
|
||||
OP_ServerOptionsMenu[37].status = IT_STRING | IT_CVAR;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -12110,7 +12205,6 @@ static void M_VideoModeMenu(INT32 choice)
|
|||
|
||||
static void M_DrawMainVideoMenu(void)
|
||||
{
|
||||
|
||||
M_DrawGenericScrollMenu();
|
||||
if (itemOn < 8) // where it starts to go offscreen; change this number if you change the layout of the video menu
|
||||
{
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
#ifndef __X_MENU__
|
||||
#define __X_MENU__
|
||||
|
||||
#include "doomstat.h" // for NUMGAMETYPES
|
||||
#include "d_event.h"
|
||||
#include "command.h"
|
||||
#include "r_things.h" // for SKINNAMESIZE
|
||||
#include "r_skins.h" // for SKINNAMESIZE
|
||||
#include "f_finale.h" // for ttmode_enum
|
||||
|
||||
//
|
||||
|
@ -402,7 +403,7 @@ typedef struct
|
|||
UINT8 numemeralds;
|
||||
UINT8 numgameovers;
|
||||
INT32 lives;
|
||||
INT32 continues;
|
||||
INT32 continuescore;
|
||||
INT32 gamemap;
|
||||
} saveinfo_t;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include <time.h>
|
||||
|
||||
#if (defined (NOMD5) || defined (NOMSERV)) && !defined (NONET)
|
||||
#if (defined (NOMSERV)) && !defined (NONET)
|
||||
#define NONET
|
||||
#endif
|
||||
|
||||
|
|
|
@ -47,8 +47,7 @@ void T_MoveCeiling(ceiling_t *ceiling)
|
|||
case 0: // IN STASIS
|
||||
break;
|
||||
case 1: // UP
|
||||
res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->topheight, false,
|
||||
1, ceiling->direction);
|
||||
res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->topheight, false, true, ceiling->direction);
|
||||
|
||||
if (ceiling->type == bounceCeiling)
|
||||
{
|
||||
|
@ -159,8 +158,7 @@ void T_MoveCeiling(ceiling_t *ceiling)
|
|||
break;
|
||||
|
||||
case -1: // DOWN
|
||||
res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight,
|
||||
ceiling->crush, 1, ceiling->direction);
|
||||
res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight, ceiling->crush, true, ceiling->direction);
|
||||
|
||||
if (ceiling->type == bounceCeiling)
|
||||
{
|
||||
|
@ -314,11 +312,10 @@ void T_CrushCeiling(ceiling_t *ceiling)
|
|||
if (ceiling->type == crushBothOnce)
|
||||
{
|
||||
// Move the floor
|
||||
T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight-(ceiling->topheight-ceiling->bottomheight), false, 0, -ceiling->direction);
|
||||
T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight-(ceiling->topheight-ceiling->bottomheight), false, false, -ceiling->direction);
|
||||
}
|
||||
|
||||
res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->topheight,
|
||||
false, 1, ceiling->direction);
|
||||
res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->topheight, false, true, ceiling->direction);
|
||||
|
||||
if (res == pastdest)
|
||||
{
|
||||
|
@ -357,11 +354,10 @@ void T_CrushCeiling(ceiling_t *ceiling)
|
|||
if (ceiling->type == crushBothOnce)
|
||||
{
|
||||
// Move the floor
|
||||
T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight, ceiling->crush, 0, -ceiling->direction);
|
||||
T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight, ceiling->crush, false, -ceiling->direction);
|
||||
}
|
||||
|
||||
res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight,
|
||||
ceiling->crush, 1, ceiling->direction);
|
||||
res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight, ceiling->crush, true, ceiling->direction);
|
||||
|
||||
if (res == pastdest)
|
||||
{
|
||||
|
@ -399,7 +395,7 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type)
|
|||
sector_t *sec;
|
||||
ceiling_t *ceiling;
|
||||
|
||||
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
|
||||
while ((secnum = P_FindSectorFromTag(line->tag,secnum)) >= 0)
|
||||
{
|
||||
sec = §ors[secnum];
|
||||
|
||||
|
@ -619,7 +615,7 @@ INT32 EV_DoCrush(line_t *line, ceiling_e type)
|
|||
sector_t *sec;
|
||||
ceiling_t *ceiling;
|
||||
|
||||
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
|
||||
while ((secnum = P_FindSectorFromTag(line->tag,secnum)) >= 0)
|
||||
{
|
||||
sec = §ors[secnum];
|
||||
|
||||
|
|
911
src/p_enemy.c
911
src/p_enemy.c
File diff suppressed because it is too large
Load diff
2027
src/p_floor.c
2027
src/p_floor.c
File diff suppressed because it is too large
Load diff
|
@ -365,10 +365,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
if (special->flags & (MF_ENEMY|MF_BOSS) && special->flags2 & MF2_FRET)
|
||||
return;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUAh_TouchSpecial(special, toucher) || P_MobjWasRemoved(special))
|
||||
return;
|
||||
#endif
|
||||
|
||||
// 0 = none, 1 = elemental pierce, 2 = bubble bounce
|
||||
elementalpierce = (((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (player->pflags & PF_SHIELDABILITY)
|
||||
|
@ -635,7 +633,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
|
||||
if (ALL7EMERALDS(emeralds)) // Got all 7
|
||||
{
|
||||
if (!(netgame || multiplayer))
|
||||
if (continuesInSession)
|
||||
{
|
||||
player->continues += 1;
|
||||
player->gotcontinue = true;
|
||||
|
@ -645,8 +643,11 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
S_StartSound(toucher, sfx_chchng);
|
||||
}
|
||||
else
|
||||
{
|
||||
P_GiveCoopLives(player, 1, true); // if continues are disabled, a life is a reasonable substitute
|
||||
S_StartSound(toucher, sfx_chchng);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
token++;
|
||||
|
@ -1919,10 +1920,8 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour
|
|||
if (!netgame)
|
||||
return; // Presumably it's obvious what's happening in splitscreen.
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUAh_HurtMsg(player, inflictor, source, damagetype))
|
||||
return;
|
||||
#endif
|
||||
|
||||
deadtarget = (player->mo->health <= 0);
|
||||
|
||||
|
@ -2395,10 +2394,8 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
|
|||
target->flags2 &= ~(MF2_SKULLFLY|MF2_NIGHTSPULL);
|
||||
target->health = 0; // This makes it easy to check if something's dead elsewhere.
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUAh_MobjDeath(target, inflictor, source, damagetype) || P_MobjWasRemoved(target))
|
||||
return;
|
||||
#endif
|
||||
|
||||
// Let EVERYONE know what happened to a player! 01-29-2002 Tails
|
||||
if (target->player && !target->player->spectator)
|
||||
|
@ -3156,7 +3153,7 @@ static boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj_t *sou
|
|||
return false;
|
||||
|
||||
// In COOP/RACE, you can't hurt other players unless cv_friendlyfire is on
|
||||
if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE)) && (G_PlatformGametype()))
|
||||
if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE)) && (gametyperules & GTR_FRIENDLY))
|
||||
{
|
||||
if (gametype == GT_COOP && inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK)) // co-op only
|
||||
{
|
||||
|
@ -3441,7 +3438,7 @@ void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source)
|
|||
if (player->powers[pw_invulnerability] || player->powers[pw_flashing] || player->powers[pw_super])
|
||||
return;
|
||||
|
||||
if (!cv_friendlyfire.value)
|
||||
if (!cv_friendlyfire.value && source && source->player)
|
||||
{
|
||||
if (inflictor->type == MT_LHRT && !(player->powers[pw_shield] & SH_NOSTACK))
|
||||
{
|
||||
|
@ -3456,7 +3453,7 @@ void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source)
|
|||
return;
|
||||
}
|
||||
|
||||
if (inflictor->type == MT_LHRT)
|
||||
if (inflictor && inflictor->type == MT_LHRT)
|
||||
return;
|
||||
|
||||
if (player->powers[pw_shield] || player->bot) //If One-Hit Shield
|
||||
|
@ -3511,11 +3508,7 @@ void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source)
|
|||
boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
|
||||
{
|
||||
player_t *player;
|
||||
#ifdef HAVE_BLUA
|
||||
boolean force = false;
|
||||
#else
|
||||
static const boolean force = false;
|
||||
#endif
|
||||
|
||||
if (objectplacing)
|
||||
return false;
|
||||
|
@ -3533,7 +3526,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// Everything above here can't be forced.
|
||||
if (!metalrecording)
|
||||
{
|
||||
|
@ -3545,7 +3537,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
else if (shouldForce == 2)
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!force)
|
||||
{
|
||||
|
@ -3579,10 +3570,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
if (!force && target->flags2 & MF2_FRET) // Currently flashing from being hit
|
||||
return false;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype) || P_MobjWasRemoved(target))
|
||||
return true;
|
||||
#endif
|
||||
|
||||
if (target->health > 1)
|
||||
target->flags2 |= MF2_FRET;
|
||||
|
@ -3631,10 +3620,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
|| (G_GametypeHasTeams() && player->ctfteam == source->player->ctfteam)))
|
||||
return false; // Don't run eachother over in special stages and team games and such
|
||||
}
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype))
|
||||
return true;
|
||||
#endif
|
||||
P_NiGHTSDamage(target, source); // -5s :(
|
||||
return true;
|
||||
}
|
||||
|
@ -3687,18 +3674,14 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
if (force
|
||||
|| (inflictor && inflictor->flags & MF_MISSILE && inflictor->flags2 & MF2_SUPERFIRE)) // Super Sonic is stunned!
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
if (!LUAh_MobjDamage(target, inflictor, source, damage, damagetype))
|
||||
#endif
|
||||
P_SuperDamage(player, inflictor, source, damage);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#ifdef HAVE_BLUA
|
||||
else if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype))
|
||||
return true;
|
||||
#endif
|
||||
else if (player->powers[pw_shield] || (player->bot && !ultimatemode)) //If One-Hit Shield
|
||||
{
|
||||
P_ShieldDamage(player, inflictor, source, damage, damagetype);
|
||||
|
|
|
@ -66,9 +66,7 @@ typedef enum
|
|||
THINK_POLYOBJ,
|
||||
THINK_MAIN,
|
||||
THINK_MOBJ,
|
||||
#ifdef ESLOPE
|
||||
THINK_DYNSLOPE,
|
||||
#endif
|
||||
THINK_PRECIP,
|
||||
NUM_THINKERLISTS
|
||||
} thinklistnum_t; /**< Thinker lists. */
|
||||
|
@ -250,7 +248,7 @@ extern jingle_t jingleinfo[NUMJINGLES];
|
|||
#define JINGLEPOSTFADE 1000
|
||||
|
||||
void P_PlayJingle(player_t *player, jingletype_t jingletype);
|
||||
boolean P_EvaluateMusicStatus(UINT16 status);
|
||||
boolean P_EvaluateMusicStatus(UINT16 status, const char *musname);
|
||||
void P_PlayJingleMusic(player_t *player, const char *musname, UINT16 musflags, boolean looping, UINT16 status);
|
||||
|
||||
//
|
||||
|
@ -383,9 +381,7 @@ extern mobj_t *tmfloorthing, *tmhitthing, *tmthing;
|
|||
extern camera_t *mapcampointer;
|
||||
extern fixed_t tmx;
|
||||
extern fixed_t tmy;
|
||||
#ifdef ESLOPE
|
||||
extern pslope_t *tmfloorslope, *tmceilingslope;
|
||||
#endif
|
||||
|
||||
/* cphipps 2004/08/30 */
|
||||
extern void P_MapStart(void);
|
||||
|
|
108
src/p_map.c
108
src/p_map.c
|
@ -27,9 +27,7 @@
|
|||
|
||||
#include "r_splats.h"
|
||||
|
||||
#ifdef ESLOPE
|
||||
#include "p_slopes.h"
|
||||
#endif
|
||||
|
||||
#include "z_zone.h"
|
||||
|
||||
|
@ -53,9 +51,7 @@ static fixed_t tmdropoffz, tmdrpoffceilz; // drop-off floor/ceiling heights
|
|||
mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz is from a sector
|
||||
mobj_t *tmhitthing; // the solid thing you bumped into (for collisions)
|
||||
ffloor_t *tmfloorrover, *tmceilingrover;
|
||||
#ifdef ESLOPE
|
||||
pslope_t *tmfloorslope, *tmceilingslope;
|
||||
#endif
|
||||
|
||||
// keep track of the line that lowers the ceiling,
|
||||
// so missiles don't explode against sky hack walls
|
||||
|
@ -262,9 +258,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
|||
if (!vertispeed && !horizspeed)
|
||||
return false;
|
||||
|
||||
#ifdef ESLOPE
|
||||
object->standingslope = NULL; // Okay, now we know it's not going to be relevant - no launching off at silly angles for you.
|
||||
#endif
|
||||
|
||||
if (spring->eflags & MFE_VERTICALFLIP)
|
||||
vertispeed *= -1;
|
||||
|
@ -439,9 +433,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
|||
P_SetPlayerMobjState(object, S_PLAY_FALL);
|
||||
}
|
||||
|
||||
#ifdef ESLOPE
|
||||
object->standingslope = NULL; // And again.
|
||||
#endif
|
||||
|
||||
final = true;
|
||||
|
||||
|
@ -491,9 +483,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
|
|||
zdist = object->z - spring->z;
|
||||
}
|
||||
|
||||
#ifdef ESLOPE
|
||||
object->standingslope = NULL; // No launching off at silly angles for you.
|
||||
#endif
|
||||
|
||||
switch (spring->type)
|
||||
{
|
||||
|
@ -756,11 +746,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
if (tmthing->z + tmthing->height < thing->z)
|
||||
return true; // underneath
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// REX HAS SEEN YOU
|
||||
if (!LUAh_SeenPlayer(tmthing->target->player, thing->player))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
seenplayer = thing->player;
|
||||
return false;
|
||||
|
@ -948,7 +936,6 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
return true; // the line doesn't cross between either pair of opposite corners
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
{
|
||||
UINT8 shouldCollide = LUAh_MobjCollide(thing, tmthing); // checks hook for thing's type
|
||||
if (P_MobjWasRemoved(tmthing) || P_MobjWasRemoved(thing))
|
||||
|
@ -957,9 +944,8 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
return false; // force collide
|
||||
else if (shouldCollide == 2)
|
||||
return true; // force no collide
|
||||
}
|
||||
{
|
||||
UINT8 shouldCollide = LUAh_MobjMoveCollide(tmthing, thing); // checks hook for tmthing's type
|
||||
|
||||
shouldCollide = LUAh_MobjMoveCollide(tmthing, thing); // checks hook for tmthing's type
|
||||
if (P_MobjWasRemoved(tmthing) || P_MobjWasRemoved(thing))
|
||||
return true; // one of them was removed???
|
||||
if (shouldCollide == 1)
|
||||
|
@ -967,7 +953,6 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
else if (shouldCollide == 2)
|
||||
return true; // force no collide
|
||||
}
|
||||
#endif
|
||||
|
||||
if (tmthing->type == MT_LAVAFALL_LAVA && (thing->type == MT_RING || thing->type == MT_REDTEAMRING || thing->type == MT_BLUETEAMRING || thing->type == MT_FLINGRING))
|
||||
{
|
||||
|
@ -1741,9 +1726,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
{
|
||||
tmfloorz = thing->z + thing->height;
|
||||
tmfloorrover = NULL;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = NULL;
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1762,18 +1745,14 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
|
||||
tmfloorz = tmceilingz = topz; // block while in air
|
||||
tmceilingrover = NULL;
|
||||
#ifdef ESLOPE
|
||||
tmceilingslope = NULL;
|
||||
#endif
|
||||
tmfloorthing = thing; // needed for side collision
|
||||
}
|
||||
else if (topz < tmceilingz && tmthing->z <= thing->z+thing->height)
|
||||
{
|
||||
tmceilingz = topz;
|
||||
tmceilingrover = NULL;
|
||||
#ifdef ESLOPE
|
||||
tmceilingslope = NULL;
|
||||
#endif
|
||||
tmfloorthing = thing; // thing we may stand on
|
||||
}
|
||||
}
|
||||
|
@ -1788,9 +1767,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
{
|
||||
tmceilingz = thing->z;
|
||||
tmceilingrover = NULL;
|
||||
#ifdef ESLOPE
|
||||
tmceilingslope = NULL;
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1809,18 +1786,14 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
|
||||
tmfloorz = tmceilingz = topz; // block while in air
|
||||
tmfloorrover = NULL;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = NULL;
|
||||
#endif
|
||||
tmfloorthing = thing; // needed for side collision
|
||||
}
|
||||
else if (topz > tmfloorz && tmthing->z+tmthing->height >= thing->z)
|
||||
{
|
||||
tmfloorz = topz;
|
||||
tmfloorrover = NULL;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = NULL;
|
||||
#endif
|
||||
tmfloorthing = thing; // thing we may stand on
|
||||
}
|
||||
}
|
||||
|
@ -1946,7 +1919,6 @@ static boolean PIT_CheckLine(line_t *ld)
|
|||
// this line is out of the if so upper and lower textures can be hit by a splat
|
||||
blockingline = ld;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
{
|
||||
UINT8 shouldCollide = LUAh_MobjLineCollide(tmthing, blockingline); // checks hook for thing's type
|
||||
if (P_MobjWasRemoved(tmthing))
|
||||
|
@ -1956,7 +1928,6 @@ static boolean PIT_CheckLine(line_t *ld)
|
|||
else if (shouldCollide == 2)
|
||||
return true; // force no collide
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!ld->backsector) // one sided line
|
||||
{
|
||||
|
@ -1983,18 +1954,14 @@ static boolean PIT_CheckLine(line_t *ld)
|
|||
tmceilingz = opentop;
|
||||
ceilingline = ld;
|
||||
tmceilingrover = openceilingrover;
|
||||
#ifdef ESLOPE
|
||||
tmceilingslope = opentopslope;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (openbottom > tmfloorz)
|
||||
{
|
||||
tmfloorz = openbottom;
|
||||
tmfloorrover = openfloorrover;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = openbottomslope;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (highceiling > tmdrpoffceilz)
|
||||
|
@ -2075,10 +2042,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->ceilingheight;
|
||||
tmfloorrover = NULL;
|
||||
tmceilingrover = NULL;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = newsubsec->sector->f_slope;
|
||||
tmceilingslope = newsubsec->sector->c_slope;
|
||||
#endif
|
||||
|
||||
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
|
||||
if (newsubsec->sector->ffloors)
|
||||
|
@ -2119,9 +2084,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
if (tmfloorz < topheight - sinklevel) {
|
||||
tmfloorz = topheight - sinklevel;
|
||||
tmfloorrover = rover;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = *rover->t_slope;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (thing->eflags & MFE_VERTICALFLIP && thingtop <= bottomheight + sinklevel && thing->momz >= 0)
|
||||
|
@ -2129,9 +2092,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
if (tmceilingz > bottomheight + sinklevel) {
|
||||
tmceilingz = bottomheight + sinklevel;
|
||||
tmceilingrover = rover;
|
||||
#ifdef ESLOPE
|
||||
tmceilingslope = *rover->b_slope;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2154,9 +2115,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
if (tmfloorz < thing->z) {
|
||||
tmfloorz = thing->z;
|
||||
tmfloorrover = rover;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = NULL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// Quicksand blocks never change heights otherwise.
|
||||
|
@ -2173,9 +2132,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
{
|
||||
tmfloorz = tmdropoffz = topheight;
|
||||
tmfloorrover = rover;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = *rover->t_slope;
|
||||
#endif
|
||||
}
|
||||
if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2)
|
||||
&& !(rover->flags & FF_PLATFORM)
|
||||
|
@ -2183,9 +2140,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
{
|
||||
tmceilingz = tmdrpoffceilz = bottomheight;
|
||||
tmceilingrover = rover;
|
||||
#ifdef ESLOPE
|
||||
tmceilingslope = *rover->b_slope;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2202,7 +2157,6 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
|
||||
BMBOUNDFIX(xl, xh, yl, yh);
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// Check polyobjects and see if tmfloorz/tmceilingz need to be altered
|
||||
{
|
||||
validcount++;
|
||||
|
@ -2260,17 +2214,13 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
|
||||
if (polytop > tmfloorz && abs(delta1) < abs(delta2)) {
|
||||
tmfloorz = tmdropoffz = polytop;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = NULL;
|
||||
#endif
|
||||
tmfloorrover = NULL;
|
||||
}
|
||||
|
||||
if (polybottom < tmceilingz && abs(delta1) >= abs(delta2)) {
|
||||
tmceilingz = tmdrpoffceilz = polybottom;
|
||||
#ifdef ESLOPE
|
||||
tmceilingslope = NULL;
|
||||
#endif
|
||||
tmceilingrover = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -2278,7 +2228,6 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// tmfloorthing is set when tmfloorz comes from a thing's top
|
||||
tmfloorthing = NULL;
|
||||
|
@ -2436,7 +2385,6 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
|||
|
||||
BMBOUNDFIX(xl, xh, yl, yh);
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// Check polyobjects and see if tmfloorz/tmceilingz need to be altered
|
||||
{
|
||||
validcount++;
|
||||
|
@ -2507,7 +2455,6 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// check lines
|
||||
for (bx = xl; bx <= xh; bx++)
|
||||
|
@ -2671,10 +2618,8 @@ boolean PIT_PushableMoved(mobj_t *thing)
|
|||
line_t *oldblockline = blockingline;
|
||||
ffloor_t *oldflrrover = tmfloorrover;
|
||||
ffloor_t *oldceilrover = tmceilingrover;
|
||||
#ifdef ESLOPE
|
||||
pslope_t *oldfslope = tmfloorslope;
|
||||
pslope_t *oldcslope = tmceilingslope;
|
||||
#endif
|
||||
|
||||
// Move the player
|
||||
P_TryMove(thing, thing->x+stand->momx, thing->y+stand->momy, true);
|
||||
|
@ -2689,10 +2634,8 @@ boolean PIT_PushableMoved(mobj_t *thing)
|
|||
blockingline = oldblockline;
|
||||
tmfloorrover = oldflrrover;
|
||||
tmceilingrover = oldceilrover;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = oldfslope;
|
||||
tmceilingslope = oldcslope;
|
||||
#endif
|
||||
thing->momz = stand->momz;
|
||||
}
|
||||
else
|
||||
|
@ -2714,9 +2657,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
fixed_t tryy = thing->y;
|
||||
fixed_t radius = thing->radius;
|
||||
fixed_t thingtop = thing->z + thing->height;
|
||||
#ifdef ESLOPE
|
||||
fixed_t startingonground = P_IsObjectOnGround(thing);
|
||||
#endif
|
||||
floatok = false;
|
||||
|
||||
if (radius < MAXRADIUS/2)
|
||||
|
@ -2802,14 +2743,12 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
thing->ceilingrover = tmceilingrover;
|
||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
else if (tmceilingz < thingtop && thingtop - tmceilingz <= maxstep)
|
||||
{
|
||||
thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height;
|
||||
thing->ceilingrover = tmceilingrover;
|
||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->z - tmfloorz <= maxstep)
|
||||
{
|
||||
|
@ -2817,14 +2756,12 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
thing->floorrover = tmfloorrover;
|
||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
else if (tmfloorz > thing->z && tmfloorz - thing->z <= maxstep)
|
||||
{
|
||||
thing->z = thing->floorz = tmfloorz;
|
||||
thing->floorrover = tmfloorrover;
|
||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (thing->eflags & MFE_VERTICALFLIP)
|
||||
|
@ -2888,7 +2825,6 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
thing->floorrover = tmfloorrover;
|
||||
thing->ceilingrover = tmceilingrover;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (!(thing->flags & MF_NOCLIPHEIGHT))
|
||||
{
|
||||
// Assign thing's standingslope if needed
|
||||
|
@ -2909,7 +2845,6 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
}
|
||||
else // don't set standingslope if you're not going to clip against it
|
||||
thing->standingslope = NULL;
|
||||
#endif
|
||||
|
||||
thing->x = x;
|
||||
thing->y = y;
|
||||
|
@ -3275,13 +3210,8 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle)
|
|||
|
||||
glidesector = R_PointInSubsector(player->mo->x + platx, player->mo->y + platy);
|
||||
|
||||
#ifdef ESLOPE
|
||||
floorz = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y) : glidesector->sector->floorheight;
|
||||
ceilingz = glidesector->sector->c_slope ? P_GetZAt(glidesector->sector->c_slope, player->mo->x, player->mo->y) : glidesector->sector->ceilingheight;
|
||||
#else
|
||||
floorz = glidesector->sector->floorheight;
|
||||
ceilingz = glidesector->sector->ceilingheight;
|
||||
#endif
|
||||
|
||||
if (glidesector->sector != player->mo->subsector->sector)
|
||||
{
|
||||
|
@ -3299,12 +3229,10 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle)
|
|||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (*rover->t_slope)
|
||||
topheight = P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y);
|
||||
if (*rover->b_slope)
|
||||
bottomheight = P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y);
|
||||
#endif
|
||||
|
||||
floorclimb = true;
|
||||
|
||||
|
@ -3460,12 +3388,10 @@ isblocking:
|
|||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (*rover->t_slope)
|
||||
topheight = P_GetZAt(*rover->t_slope, slidemo->x, slidemo->y);
|
||||
if (*rover->b_slope)
|
||||
bottomheight = P_GetZAt(*rover->b_slope, slidemo->x, slidemo->y);
|
||||
#endif
|
||||
|
||||
if (topheight < slidemo->z)
|
||||
continue;
|
||||
|
@ -3670,10 +3596,8 @@ static void P_CheckLavaWall(mobj_t *mo, sector_t *sec)
|
|||
if (rover->master->flags & ML_BLOCKMONSTERS)
|
||||
continue;
|
||||
|
||||
topheight =
|
||||
#ifdef ESLOPE
|
||||
*rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) :
|
||||
#endif
|
||||
topheight = *rover->t_slope ?
|
||||
P_GetZAt(*rover->t_slope, mo->x, mo->y) :
|
||||
*rover->topheight;
|
||||
|
||||
if (mo->eflags & MFE_VERTICALFLIP)
|
||||
|
@ -3687,10 +3611,8 @@ static void P_CheckLavaWall(mobj_t *mo, sector_t *sec)
|
|||
continue;
|
||||
}
|
||||
|
||||
bottomheight =
|
||||
#ifdef ESLOPE
|
||||
*rover->b_slope ? P_GetZAt(*rover->b_slope, mo->x, mo->y) :
|
||||
#endif
|
||||
bottomheight = *rover->b_slope ?
|
||||
P_GetZAt(*rover->b_slope, mo->x, mo->y) :
|
||||
*rover->bottomheight;
|
||||
|
||||
if (mo->eflags & MFE_VERTICALFLIP)
|
||||
|
@ -4278,12 +4200,10 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
|
|||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
|
||||
/*#ifdef ESLOPE
|
||||
if (rover->t_slope)
|
||||
/*if (rover->t_slope)
|
||||
topheight = P_GetZAt(rover->t_slope, thing->x, thing->y);
|
||||
if (rover->b_slope)
|
||||
bottomheight = P_GetZAt(rover->b_slope, thing->x, thing->y);
|
||||
#endif*/
|
||||
bottomheight = P_GetZAt(rover->b_slope, thing->x, thing->y);*/
|
||||
|
||||
delta1 = thing->z - (bottomheight + topheight)/2;
|
||||
delta2 = thingtop - (bottomheight + topheight)/2;
|
||||
|
@ -4299,21 +4219,19 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
|
|||
{
|
||||
//If the thing was crushed by a crumbling FOF, reward the player who made it crumble!
|
||||
thinker_t *think;
|
||||
elevator_t *crumbler;
|
||||
crumble_t *crumbler;
|
||||
|
||||
for (think = thlist[THINK_MAIN].next; think != &thlist[THINK_MAIN]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)T_StartCrumble)
|
||||
continue;
|
||||
|
||||
crumbler = (elevator_t *)think;
|
||||
crumbler = (crumble_t *)think;
|
||||
|
||||
if (crumbler->player && crumbler->player->mo
|
||||
&& crumbler->player->mo != thing
|
||||
&& crumbler->actionsector == thing->subsector->sector
|
||||
&& crumbler->sector == rover->master->frontsector
|
||||
&& (crumbler->type == elevateBounce
|
||||
|| crumbler->type == elevateContinuous))
|
||||
&& crumbler->sector == rover->master->frontsector)
|
||||
{
|
||||
killer = crumbler->player->mo;
|
||||
}
|
||||
|
@ -5064,10 +4982,8 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
|
|||
sector_t *sec = R_PointInSubsector(x, y)->sector;
|
||||
fixed_t floorz = sec->floorheight;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (sec->f_slope)
|
||||
floorz = P_GetZAt(sec->f_slope, x, y);
|
||||
#endif
|
||||
|
||||
// Intercept the stupid 'fall through 3dfloors' bug Tails 03-17-2002
|
||||
if (sec->ffloors)
|
||||
|
@ -5087,12 +5003,10 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
|
|||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (*rover->t_slope)
|
||||
topheight = P_GetZAt(*rover->t_slope, x, y);
|
||||
if (*rover->b_slope)
|
||||
bottomheight = P_GetZAt(*rover->b_slope, x, y);
|
||||
#endif
|
||||
|
||||
if (rover->flags & FF_QUICKSAND)
|
||||
{
|
||||
|
|
|
@ -277,9 +277,7 @@ fixed_t P_InterceptVector(divline_t *v2, divline_t *v1)
|
|||
// OPTIMIZE: keep this precalculated
|
||||
//
|
||||
fixed_t opentop, openbottom, openrange, lowfloor, highceiling;
|
||||
#ifdef ESLOPE
|
||||
pslope_t *opentopslope, *openbottomslope;
|
||||
#endif
|
||||
ffloor_t *openfloorrover, *openceilingrover;
|
||||
|
||||
// P_CameraLineOpening
|
||||
|
@ -307,24 +305,20 @@ void P_CameraLineOpening(line_t *linedef)
|
|||
{
|
||||
frontfloor = sectors[front->camsec].floorheight;
|
||||
frontceiling = sectors[front->camsec].ceilingheight;
|
||||
#ifdef ESLOPE
|
||||
if (sectors[front->camsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
|
||||
frontfloor = P_GetZAt(sectors[front->camsec].f_slope, camera.x, camera.y);
|
||||
if (sectors[front->camsec].c_slope)
|
||||
frontceiling = P_GetZAt(sectors[front->camsec].c_slope, camera.x, camera.y);
|
||||
#endif
|
||||
|
||||
}
|
||||
else if (front->heightsec >= 0)
|
||||
{
|
||||
frontfloor = sectors[front->heightsec].floorheight;
|
||||
frontceiling = sectors[front->heightsec].ceilingheight;
|
||||
#ifdef ESLOPE
|
||||
if (sectors[front->heightsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
|
||||
frontfloor = P_GetZAt(sectors[front->heightsec].f_slope, camera.x, camera.y);
|
||||
if (sectors[front->heightsec].c_slope)
|
||||
frontceiling = P_GetZAt(sectors[front->heightsec].c_slope, camera.x, camera.y);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -335,23 +329,19 @@ void P_CameraLineOpening(line_t *linedef)
|
|||
{
|
||||
backfloor = sectors[back->camsec].floorheight;
|
||||
backceiling = sectors[back->camsec].ceilingheight;
|
||||
#ifdef ESLOPE
|
||||
if (sectors[back->camsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
|
||||
frontfloor = P_GetZAt(sectors[back->camsec].f_slope, camera.x, camera.y);
|
||||
if (sectors[back->camsec].c_slope)
|
||||
frontceiling = P_GetZAt(sectors[back->camsec].c_slope, camera.x, camera.y);
|
||||
#endif
|
||||
}
|
||||
else if (back->heightsec >= 0)
|
||||
{
|
||||
backfloor = sectors[back->heightsec].floorheight;
|
||||
backceiling = sectors[back->heightsec].ceilingheight;
|
||||
#ifdef ESLOPE
|
||||
if (sectors[back->heightsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
|
||||
frontfloor = P_GetZAt(sectors[back->heightsec].f_slope, camera.x, camera.y);
|
||||
if (sectors[back->heightsec].c_slope)
|
||||
frontceiling = P_GetZAt(sectors[back->heightsec].c_slope, camera.x, camera.y);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -461,7 +451,6 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
I_Assert(back != NULL);
|
||||
|
||||
openfloorrover = openceilingrover = NULL;
|
||||
#ifdef POLYOBJECTS
|
||||
if (linedef->polyobj)
|
||||
{
|
||||
// set these defaults so that polyobjects don't interfere with collision above or below them
|
||||
|
@ -469,12 +458,9 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
openbottom = INT32_MIN;
|
||||
highceiling = INT32_MIN;
|
||||
lowfloor = INT32_MAX;
|
||||
#ifdef ESLOPE
|
||||
opentopslope = openbottomslope = NULL;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{ // Set open and high/low values here
|
||||
fixed_t frontheight, backheight;
|
||||
|
||||
|
@ -485,17 +471,13 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
{
|
||||
opentop = frontheight;
|
||||
highceiling = backheight;
|
||||
#ifdef ESLOPE
|
||||
opentopslope = front->c_slope;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
opentop = backheight;
|
||||
highceiling = frontheight;
|
||||
#ifdef ESLOPE
|
||||
opentopslope = back->c_slope;
|
||||
#endif
|
||||
}
|
||||
|
||||
frontheight = P_GetFloorZ(mobj, front, tmx, tmy, linedef);
|
||||
|
@ -505,17 +487,13 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
{
|
||||
openbottom = frontheight;
|
||||
lowfloor = backheight;
|
||||
#ifdef ESLOPE
|
||||
openbottomslope = front->f_slope;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
openbottom = backheight;
|
||||
lowfloor = frontheight;
|
||||
#ifdef ESLOPE
|
||||
openbottomslope = back->f_slope;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -537,7 +515,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
texheight = textures[texnum]->height << FRACBITS;
|
||||
|
||||
// Set texbottom and textop to the Z coordinates of the texture's boundaries
|
||||
#if 0 // #ifdef POLYOBJECTS
|
||||
#if 0
|
||||
// don't remove this code unless solid midtextures
|
||||
// on non-solid polyobjects should NEVER happen in the future
|
||||
if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) {
|
||||
|
@ -580,7 +558,6 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifdef POLYOBJECTS
|
||||
if (linedef->polyobj)
|
||||
{
|
||||
// Treat polyobj's backsector like a 3D Floor
|
||||
|
@ -617,7 +594,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
// otherwise don't do anything special, pretend there's nothing else there
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// Check for fake floors in the sector.
|
||||
if (front->ffloors || back->ffloors)
|
||||
{
|
||||
|
@ -647,9 +624,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
{
|
||||
if (bottomheight < opentop) {
|
||||
opentop = bottomheight;
|
||||
#ifdef ESLOPE
|
||||
opentopslope = *rover->b_slope;
|
||||
#endif
|
||||
openceilingrover = rover;
|
||||
}
|
||||
else if (bottomheight < highceiling)
|
||||
|
@ -660,9 +635,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
{
|
||||
if (topheight > openbottom) {
|
||||
openbottom = topheight;
|
||||
#ifdef ESLOPE
|
||||
openbottomslope = *rover->t_slope;
|
||||
#endif
|
||||
openfloorrover = rover;
|
||||
}
|
||||
else if (topheight > lowfloor)
|
||||
|
@ -693,9 +666,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
{
|
||||
if (bottomheight < opentop) {
|
||||
opentop = bottomheight;
|
||||
#ifdef ESLOPE
|
||||
opentopslope = *rover->b_slope;
|
||||
#endif
|
||||
openceilingrover = rover;
|
||||
}
|
||||
else if (bottomheight < highceiling)
|
||||
|
@ -706,9 +677,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
{
|
||||
if (topheight > openbottom) {
|
||||
openbottom = topheight;
|
||||
#ifdef ESLOPE
|
||||
openbottomslope = *rover->t_slope;
|
||||
#endif
|
||||
openfloorrover = rover;
|
||||
}
|
||||
else if (topheight > lowfloor)
|
||||
|
@ -717,6 +686,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
openrange = opentop - openbottom;
|
||||
}
|
||||
|
@ -962,9 +932,7 @@ boolean P_BlockLinesIterator(INT32 x, INT32 y, boolean (*func)(line_t *))
|
|||
{
|
||||
INT32 offset;
|
||||
const INT32 *list; // Big blockmap
|
||||
#ifdef POLYOBJECTS
|
||||
polymaplink_t *plink; // haleyjd 02/22/06
|
||||
#endif
|
||||
line_t *ld;
|
||||
|
||||
if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
|
||||
|
@ -972,7 +940,6 @@ boolean P_BlockLinesIterator(INT32 x, INT32 y, boolean (*func)(line_t *))
|
|||
|
||||
offset = y*bmapwidth + x;
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// haleyjd 02/22/06: consider polyobject lines
|
||||
plink = polyblocklinks[offset];
|
||||
|
||||
|
@ -996,7 +963,6 @@ boolean P_BlockLinesIterator(INT32 x, INT32 y, boolean (*func)(line_t *))
|
|||
}
|
||||
plink = (polymaplink_t *)(plink->link.next);
|
||||
}
|
||||
#endif
|
||||
|
||||
offset = *(blockmap + offset); // offset = blockmap[y*bmapwidth+x];
|
||||
|
||||
|
|
|
@ -55,9 +55,7 @@ void P_CreatePrecipSecNodeList(precipmobj_t *thing, fixed_t x,fixed_t y);
|
|||
boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y);
|
||||
|
||||
extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling;
|
||||
#ifdef ESLOPE
|
||||
extern pslope_t *opentopslope, *openbottomslope;
|
||||
#endif
|
||||
extern ffloor_t *openfloorrover, *openceilingrover;
|
||||
|
||||
void P_LineOpening(line_t *plinedef, mobj_t *mobj);
|
||||
|
|
262
src/p_mobj.c
262
src/p_mobj.c
|
@ -19,7 +19,7 @@
|
|||
#include "p_local.h"
|
||||
#include "p_setup.h"
|
||||
#include "r_main.h"
|
||||
#include "r_things.h"
|
||||
#include "r_skins.h"
|
||||
#include "r_sky.h"
|
||||
#include "r_splats.h"
|
||||
#include "s_sound.h"
|
||||
|
@ -31,9 +31,7 @@
|
|||
#include "i_video.h"
|
||||
#include "lua_hook.h"
|
||||
#include "b_bot.h"
|
||||
#ifdef ESLOPE
|
||||
#include "p_slopes.h"
|
||||
#endif
|
||||
#include "f_finale.h"
|
||||
#include "m_cond.h"
|
||||
|
||||
|
@ -62,9 +60,7 @@ void P_RunCachedActions(void)
|
|||
{
|
||||
var1 = states[ac->statenum].var1;
|
||||
var2 = states[ac->statenum].var2;
|
||||
#ifdef HAVE_BLUA
|
||||
astate = &states[ac->statenum];
|
||||
#endif
|
||||
if (ac->mobj && !P_MobjWasRemoved(ac->mobj)) // just in case...
|
||||
states[ac->statenum].action.acp1(ac->mobj);
|
||||
next = ac->next;
|
||||
|
@ -459,9 +455,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
|
|||
{
|
||||
var1 = st->var1;
|
||||
var2 = st->var2;
|
||||
#ifdef HAVE_BLUA
|
||||
astate = st;
|
||||
#endif
|
||||
st->action.acp1(mobj);
|
||||
|
||||
// woah. a player was removed by an action.
|
||||
|
@ -585,9 +579,7 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
|
|||
{
|
||||
var1 = st->var1;
|
||||
var2 = st->var2;
|
||||
#ifdef HAVE_BLUA
|
||||
astate = st;
|
||||
#endif
|
||||
st->action.acp1(mobj);
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
return false;
|
||||
|
@ -937,12 +929,10 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover)
|
|||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (*rover->t_slope)
|
||||
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
|
||||
if (*rover->b_slope)
|
||||
bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y);
|
||||
#endif
|
||||
|
||||
if (mobj->z > topheight)
|
||||
return false;
|
||||
|
@ -953,7 +943,6 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover)
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef ESLOPE
|
||||
// P_GetFloorZ (and its ceiling counterpart)
|
||||
// Gets the floor height (or ceiling height) of the mobj's contact point in sector, assuming object's center if moved to [x, y]
|
||||
// If line is supplied, it's a divider line on the sector. Set it to NULL if you're not checking for collision with a line
|
||||
|
@ -1057,15 +1046,12 @@ static fixed_t HighestOnLine(fixed_t radius, fixed_t x, fixed_t y, line_t *line,
|
|||
P_GetZAt(slope, v2.x, v2.y)
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
I_Assert(mobj != NULL);
|
||||
#endif
|
||||
I_Assert(sector != NULL);
|
||||
#ifdef ESLOPE
|
||||
|
||||
if (sector->f_slope) {
|
||||
fixed_t testx, testy;
|
||||
pslope_t *slope = sector->f_slope;
|
||||
|
@ -1135,25 +1121,14 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t
|
|||
|
||||
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
|
||||
} else // Well, that makes it easy. Just get the floor height
|
||||
#else
|
||||
(void)mobj;
|
||||
(void)boundsec;
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void)line;
|
||||
(void)lowest;
|
||||
(void)perfect;
|
||||
#endif
|
||||
return sector->floorheight;
|
||||
}
|
||||
|
||||
fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
I_Assert(mobj != NULL);
|
||||
#endif
|
||||
I_Assert(sector != NULL);
|
||||
#ifdef ESLOPE
|
||||
|
||||
if (sector->c_slope) {
|
||||
fixed_t testx, testy;
|
||||
pslope_t *slope = sector->c_slope;
|
||||
|
@ -1223,26 +1198,15 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed
|
|||
|
||||
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
|
||||
} else // Well, that makes it easy. Just get the ceiling height
|
||||
#else
|
||||
(void)mobj;
|
||||
(void)boundsec;
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void)line;
|
||||
(void)lowest;
|
||||
(void)perfect;
|
||||
#endif
|
||||
return sector->ceilingheight;
|
||||
}
|
||||
|
||||
// Now do the same as all above, but for cameras because apparently cameras are special?
|
||||
fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
I_Assert(mobj != NULL);
|
||||
#endif
|
||||
I_Assert(sector != NULL);
|
||||
#ifdef ESLOPE
|
||||
|
||||
if (sector->f_slope) {
|
||||
fixed_t testx, testy;
|
||||
pslope_t *slope = sector->f_slope;
|
||||
|
@ -1312,25 +1276,14 @@ fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fix
|
|||
|
||||
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
|
||||
} else // Well, that makes it easy. Just get the floor height
|
||||
#else
|
||||
(void)mobj;
|
||||
(void)boundsec;
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void)line;
|
||||
(void)lowest;
|
||||
(void)perfect;
|
||||
#endif
|
||||
return sector->floorheight;
|
||||
}
|
||||
|
||||
fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
I_Assert(mobj != NULL);
|
||||
#endif
|
||||
I_Assert(sector != NULL);
|
||||
#ifdef ESLOPE
|
||||
|
||||
if (sector->c_slope) {
|
||||
fixed_t testx, testy;
|
||||
pslope_t *slope = sector->c_slope;
|
||||
|
@ -1400,15 +1353,6 @@ fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, f
|
|||
|
||||
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
|
||||
} else // Well, that makes it easy. Just get the ceiling height
|
||||
#else
|
||||
(void)mobj;
|
||||
(void)boundsec;
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void)line;
|
||||
(void)lowest;
|
||||
(void)perfect;
|
||||
#endif
|
||||
return sector->ceilingheight;
|
||||
}
|
||||
static void P_PlayerFlip(mobj_t *mo)
|
||||
|
@ -1680,10 +1624,7 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
|
|||
else if (abs(player->rmomx) < FixedMul(STOPSPEED, mo->scale)
|
||||
&& abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale)
|
||||
&& (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove && !(player->pflags & PF_SPINNING))
|
||||
#ifdef ESLOPE
|
||||
&& !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2))
|
||||
#endif
|
||||
)
|
||||
&& !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2)))
|
||||
{
|
||||
// if in a walking frame, stop moving
|
||||
if (player->panim == PA_WALK)
|
||||
|
@ -1750,7 +1691,7 @@ static void P_PushableCheckBustables(mobj_t *mo)
|
|||
// Needs ML_EFFECT4 flag for pushables to break it
|
||||
if (!(rover->master->flags & ML_EFFECT4)) continue;
|
||||
|
||||
if (!rover->master->frontsector->crumblestate)
|
||||
if (rover->master->frontsector->crumblestate == CRUMBLE_NONE)
|
||||
{
|
||||
topheight = P_GetFOFTopZ(mo, node->m_sector, rover, mo->x, mo->y, NULL);
|
||||
bottomheight = P_GetFOFBottomZ(mo, node->m_sector, rover, mo->x, mo->y, NULL);
|
||||
|
@ -1830,11 +1771,9 @@ void P_XYMovement(mobj_t *mo)
|
|||
fixed_t xmove, ymove;
|
||||
fixed_t oldx, oldy; // reducing bobbing/momentum on ice when up against walls
|
||||
boolean moved;
|
||||
#ifdef ESLOPE
|
||||
pslope_t *oldslope = NULL;
|
||||
vector3_t slopemom;
|
||||
fixed_t predictedz = 0;
|
||||
#endif
|
||||
|
||||
I_Assert(mo != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(mo));
|
||||
|
@ -1864,7 +1803,6 @@ void P_XYMovement(mobj_t *mo)
|
|||
oldx = mo->x;
|
||||
oldy = mo->y;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (mo->flags & MF_NOCLIPHEIGHT)
|
||||
mo->standingslope = NULL;
|
||||
|
||||
|
@ -1889,7 +1827,6 @@ void P_XYMovement(mobj_t *mo)
|
|||
}
|
||||
} else if (P_IsObjectOnGround(mo) && !mo->momz)
|
||||
predictedz = mo->z;
|
||||
#endif
|
||||
|
||||
// Pushables can break some blocks
|
||||
if (CheckForBustableBlocks && ((mo->flags & MF_PUSHABLE) || ((mo->info->flags & MF_PUSHABLE) && mo->fuse)))
|
||||
|
@ -1906,15 +1843,12 @@ void P_XYMovement(mobj_t *mo)
|
|||
B_MoveBlocked(player);
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUAh_MobjMoveBlocked(mo))
|
||||
{
|
||||
if (P_MobjWasRemoved(mo))
|
||||
return;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (P_MobjWasRemoved(mo))
|
||||
else if (P_MobjWasRemoved(mo))
|
||||
return;
|
||||
else if (mo->flags & MF_BOUNCE)
|
||||
{
|
||||
|
@ -1965,7 +1899,6 @@ void P_XYMovement(mobj_t *mo)
|
|||
}
|
||||
else if (player || mo->flags & (MF_SLIDEME|MF_PUSHABLE))
|
||||
{ // try to slide along it
|
||||
#ifdef ESLOPE
|
||||
// Wall transfer part 1.
|
||||
pslope_t *transferslope = NULL;
|
||||
fixed_t transfermomz = 0;
|
||||
|
@ -1975,14 +1908,12 @@ void P_XYMovement(mobj_t *mo)
|
|||
if (((transferslope->zangle < ANGLE_180) ? transferslope->zangle : InvAngle(transferslope->zangle)) >= ANGLE_45) // Prevent some weird stuff going on on shallow slopes.
|
||||
transfermomz = P_GetWallTransferMomZ(mo, transferslope);
|
||||
}
|
||||
#endif
|
||||
|
||||
P_SlideMove(mo);
|
||||
if (player)
|
||||
player->powers[pw_pushing] = 3;
|
||||
xmove = ymove = 0;
|
||||
|
||||
#ifdef ESLOPE
|
||||
// Wall transfer part 2.
|
||||
if (transfermomz && transferslope) // Are we "transferring onto the wall" (really just a disguised vertical launch)?
|
||||
{
|
||||
|
@ -2005,7 +1936,6 @@ void P_XYMovement(mobj_t *mo)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (mo->type == MT_SPINFIRE)
|
||||
{
|
||||
|
@ -2061,7 +1991,6 @@ void P_XYMovement(mobj_t *mo)
|
|||
if (P_MobjWasRemoved(mo)) // MF_SPECIAL touched a player! O_o;;
|
||||
return;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (moved && oldslope && !(mo->flags & MF_NOCLIPHEIGHT)) { // Check to see if we ran off
|
||||
|
||||
if (oldslope != mo->standingslope) { // First, compare different slopes
|
||||
|
@ -2107,7 +2036,6 @@ void P_XYMovement(mobj_t *mo)
|
|||
//CONS_Printf("Launched off of flat surface running into downward slope\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check the gravity status.
|
||||
P_CheckGravity(mo, false);
|
||||
|
@ -2158,11 +2086,9 @@ void P_XYMovement(mobj_t *mo)
|
|||
if (player && player->powers[pw_carry] == CR_NIGHTSMODE)
|
||||
return; // no friction for NiGHTS players
|
||||
|
||||
#ifdef ESLOPE
|
||||
if ((mo->type == MT_BIGTUMBLEWEED || mo->type == MT_LITTLETUMBLEWEED)
|
||||
&& (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8)) // Special exception for tumbleweeds on slopes
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (((!(mo->eflags & MFE_VERTICALFLIP) && mo->z > mo->floorz) || (mo->eflags & MFE_VERTICALFLIP && mo->z+mo->height < mo->ceilingz))
|
||||
&& !(player && player->pflags & PF_SLIDING))
|
||||
|
@ -2430,7 +2356,6 @@ static boolean P_ZMovement(mobj_t *mo)
|
|||
mo->z += mo->momz;
|
||||
onground = P_IsObjectOnGround(mo);
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (mo->standingslope)
|
||||
{
|
||||
if (mo->flags & MF_NOCLIPHEIGHT)
|
||||
|
@ -2438,7 +2363,6 @@ static boolean P_ZMovement(mobj_t *mo)
|
|||
else if (!onground)
|
||||
P_SlopeLaunch(mo);
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (mo->type)
|
||||
{
|
||||
|
@ -2640,7 +2564,6 @@ static boolean P_ZMovement(mobj_t *mo)
|
|||
else
|
||||
mo->z = mo->floorz;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (!(mo->flags & MF_MISSILE) && mo->standingslope) // You're still on the ground; why are we here?
|
||||
{
|
||||
mo->momz = 0;
|
||||
|
@ -2653,7 +2576,6 @@ static boolean P_ZMovement(mobj_t *mo)
|
|||
mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope;
|
||||
P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope);
|
||||
}
|
||||
#endif
|
||||
|
||||
// hit the floor
|
||||
if (mo->type == MT_FIREBALL) // special case for the fireball
|
||||
|
@ -2753,13 +2675,11 @@ static boolean P_ZMovement(mobj_t *mo)
|
|||
else
|
||||
mom.y -= FixedMul(6*FRACUNIT, mo->scale);
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
else if (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8)
|
||||
{
|
||||
// Pop the object up a bit to encourage bounciness
|
||||
//mom.z = P_MobjFlip(mo)*mo->scale;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
mom.x = mom.y = mom.z = 0;
|
||||
|
@ -2799,11 +2719,9 @@ static boolean P_ZMovement(mobj_t *mo)
|
|||
else if (tmfloorthing)
|
||||
mom.z = tmfloorthing->momz;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (mo->standingslope) { // MT_STEAM will never have a standingslope, see above.
|
||||
P_QuantizeMomentumToSlope(&mom, mo->standingslope);
|
||||
}
|
||||
#endif
|
||||
|
||||
mo->momx = mom.x;
|
||||
mo->momy = mom.y;
|
||||
|
@ -2925,7 +2843,6 @@ static void P_PlayerZMovement(mobj_t *mo)
|
|||
|| mo->player->playerstate == PST_REBORN)
|
||||
return;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (mo->standingslope)
|
||||
{
|
||||
if (mo->flags & MF_NOCLIPHEIGHT)
|
||||
|
@ -2933,7 +2850,6 @@ static void P_PlayerZMovement(mobj_t *mo)
|
|||
else if (!onground)
|
||||
P_SlopeLaunch(mo);
|
||||
}
|
||||
#endif
|
||||
|
||||
// clip movement
|
||||
if (onground && !(mo->flags & MF_NOCLIPHEIGHT))
|
||||
|
@ -2961,12 +2877,10 @@ static void P_PlayerZMovement(mobj_t *mo)
|
|||
if (mo->player->panim == PA_PAIN)
|
||||
P_SetPlayerMobjState(mo, S_PLAY_WALK);
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)) {
|
||||
// Handle landing on slope during Z movement
|
||||
P_HandleSlopeLanding(mo, (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (P_MobjFlip(mo)*mo->momz < 0) // falling
|
||||
{
|
||||
|
@ -2981,7 +2895,6 @@ static void P_PlayerZMovement(mobj_t *mo)
|
|||
mo->eflags |= MFE_JUSTHITFLOOR; // Spin Attack
|
||||
|
||||
{
|
||||
#ifdef POLYOBJECTS
|
||||
// Check if we're on a polyobject
|
||||
// that triggers a linedef executor.
|
||||
msecnode_t *node;
|
||||
|
@ -3041,8 +2954,6 @@ static void P_PlayerZMovement(mobj_t *mo)
|
|||
}
|
||||
|
||||
if (!stopmovecut)
|
||||
#endif
|
||||
|
||||
// Cut momentum in half when you hit the ground and
|
||||
// aren't pressing any controls.
|
||||
if (!(mo->player->cmd.forwardmove || mo->player->cmd.sidemove) && !mo->player->cmomx && !mo->player->cmomy && !(mo->player->pflags & PF_SPINNING))
|
||||
|
@ -3299,10 +3210,8 @@ static boolean P_SceneryZMovement(mobj_t *mo)
|
|||
//
|
||||
boolean P_CanRunOnWater(player_t *player, ffloor_t *rover)
|
||||
{
|
||||
fixed_t topheight =
|
||||
#ifdef ESLOPE
|
||||
*rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) :
|
||||
#endif
|
||||
fixed_t topheight = *rover->t_slope ?
|
||||
P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) :
|
||||
*rover->topheight;
|
||||
|
||||
if (!player->powers[pw_carry] && !player->homing
|
||||
|
@ -3349,13 +3258,11 @@ void P_MobjCheckWater(mobj_t *mobj)
|
|||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (*rover->t_slope)
|
||||
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
|
||||
|
||||
if (*rover->b_slope)
|
||||
bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y);
|
||||
#endif
|
||||
|
||||
if (mobj->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
|
@ -3605,13 +3512,11 @@ static void P_SceneryCheckWater(mobj_t *mobj)
|
|||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (*rover->t_slope)
|
||||
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
|
||||
|
||||
if (*rover->b_slope)
|
||||
bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y);
|
||||
#endif
|
||||
|
||||
if (topheight <= mobj->z
|
||||
|| bottomheight > (mobj->z + (mobj->height>>1)))
|
||||
|
@ -3656,14 +3561,12 @@ static boolean P_CameraCheckHeat(camera_t *thiscam)
|
|||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
|
||||
if (halfheight >= (
|
||||
#ifdef ESLOPE
|
||||
*rover->t_slope ? P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) :
|
||||
#endif
|
||||
*rover->topheight) || halfheight <= (
|
||||
#ifdef ESLOPE
|
||||
*rover->b_slope ? P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) :
|
||||
#endif
|
||||
if (halfheight >= (*rover->t_slope ?
|
||||
P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) :
|
||||
*rover->topheight))
|
||||
continue;
|
||||
if (halfheight <= (*rover->b_slope ?
|
||||
P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) :
|
||||
*rover->bottomheight))
|
||||
continue;
|
||||
|
||||
|
@ -3692,14 +3595,12 @@ static boolean P_CameraCheckWater(camera_t *thiscam)
|
|||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKOTHERS)
|
||||
continue;
|
||||
|
||||
if (halfheight >= (
|
||||
#ifdef ESLOPE
|
||||
*rover->t_slope ? P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) :
|
||||
#endif
|
||||
*rover->topheight) || halfheight <= (
|
||||
#ifdef ESLOPE
|
||||
if (halfheight >= (*rover->t_slope ?
|
||||
P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) :
|
||||
*rover->topheight))
|
||||
continue;
|
||||
if (halfheight <= (
|
||||
*rover->b_slope ? P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) :
|
||||
#endif
|
||||
*rover->bottomheight))
|
||||
continue;
|
||||
|
||||
|
@ -3889,9 +3790,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|
|||
|
||||
P_MobjCheckWater(mobj);
|
||||
|
||||
#ifdef ESLOPE
|
||||
P_ButteredSlope(mobj);
|
||||
#endif
|
||||
|
||||
// momentum movement
|
||||
mobj->eflags &= ~MFE_JUSTSTEPPEDDOWN;
|
||||
|
@ -4050,10 +3949,8 @@ static void CalculatePrecipFloor(precipmobj_t *mobj)
|
|||
mobjsecsubsec = mobj->subsector->sector;
|
||||
else
|
||||
return;
|
||||
mobj->floorz =
|
||||
#ifdef ESLOPE
|
||||
mobjsecsubsec->f_slope ? P_GetZAt(mobjsecsubsec->f_slope, mobj->x, mobj->y) :
|
||||
#endif
|
||||
mobj->floorz = mobjsecsubsec->f_slope ?
|
||||
P_GetZAt(mobjsecsubsec->f_slope, mobj->x, mobj->y) :
|
||||
mobjsecsubsec->floorheight;
|
||||
if (mobjsecsubsec->ffloors)
|
||||
{
|
||||
|
@ -4069,11 +3966,9 @@ static void CalculatePrecipFloor(precipmobj_t *mobj)
|
|||
if (!(rover->flags & FF_BLOCKOTHERS) && !(rover->flags & FF_SWIMMABLE))
|
||||
continue;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (*rover->t_slope)
|
||||
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
|
||||
else
|
||||
#endif
|
||||
topheight = *rover->topheight;
|
||||
|
||||
if (topheight > mobj->floorz)
|
||||
|
@ -7161,8 +7056,7 @@ static void P_MobjScaleThink(mobj_t *mobj)
|
|||
fixed_t oldheight = mobj->height;
|
||||
UINT8 correctionType = 0; // Don't correct Z position, just gain height
|
||||
|
||||
if ((mobj->flags & MF_NOCLIPHEIGHT || (mobj->z > mobj->floorz && mobj->z + mobj->height < mobj->ceilingz))
|
||||
&& mobj->type != MT_EGGMOBILE_FIRE)
|
||||
if (mobj->flags & MF_NOCLIPHEIGHT || (mobj->z > mobj->floorz && mobj->z + mobj->height < mobj->ceilingz))
|
||||
correctionType = 1; // Correct Z position by centering
|
||||
else if (mobj->eflags & MFE_VERTICALFLIP)
|
||||
correctionType = 2; // Correct Z position by moving down
|
||||
|
@ -7183,10 +7077,6 @@ static void P_MobjScaleThink(mobj_t *mobj)
|
|||
/// \todo Lua hook for "reached destscale"?
|
||||
switch (mobj->type)
|
||||
{
|
||||
case MT_EGGMOBILE_FIRE:
|
||||
mobj->destscale = FRACUNIT;
|
||||
mobj->scalespeed = FRACUNIT>>4;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -7643,12 +7533,10 @@ static void P_RosySceneryThink(mobj_t *mobj)
|
|||
|
||||
static void P_MobjSceneryThink(mobj_t *mobj)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUAh_MobjThinker(mobj))
|
||||
return;
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if ((mobj->flags2 & MF2_SHIELD) && !P_AddShield(mobj))
|
||||
return;
|
||||
|
@ -7993,16 +7881,15 @@ static void P_MobjSceneryThink(mobj_t *mobj)
|
|||
|
||||
if (!mobj->fuse)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
if (!LUAh_MobjFuse(mobj))
|
||||
#endif
|
||||
P_RemoveMobj(mobj);
|
||||
return;
|
||||
}
|
||||
if (mobj->fuse < 0)
|
||||
return;
|
||||
if ((--mobj->fuse) < 6)
|
||||
if (mobj->fuse < 6)
|
||||
mobj->frame = (mobj->frame & ~FF_TRANSMASK) | ((10 - (mobj->fuse*2)) << (FF_TRANSSHIFT));
|
||||
mobj->fuse--;
|
||||
}
|
||||
break;
|
||||
case MT_FINISHFLAG:
|
||||
|
@ -8053,9 +7940,7 @@ static void P_MobjSceneryThink(mobj_t *mobj)
|
|||
mobj->fuse--;
|
||||
if (!mobj->fuse)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
if (!LUAh_MobjFuse(mobj))
|
||||
#endif
|
||||
P_RemoveMobj(mobj);
|
||||
return;
|
||||
}
|
||||
|
@ -8084,7 +7969,6 @@ static boolean P_MobjPushableThink(mobj_t *mobj)
|
|||
|
||||
static boolean P_MobjBossThink(mobj_t *mobj)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUAh_BossThinker(mobj))
|
||||
{
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
|
@ -8093,7 +7977,6 @@ static boolean P_MobjBossThink(mobj_t *mobj)
|
|||
else if (P_MobjWasRemoved(mobj))
|
||||
return false;
|
||||
else
|
||||
#endif
|
||||
switch (mobj->type)
|
||||
{
|
||||
case MT_EGGMOBILE:
|
||||
|
@ -9392,8 +9275,11 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
|||
if (mobj->tracer && mobj->tracer->player && mobj->tracer->health > 0
|
||||
&& P_AproxDistance(P_AproxDistance(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y), mobj->tracer->z - mobj->z) <= mobj->radius*16)
|
||||
{
|
||||
var1 = mobj->info->speed;
|
||||
var2 = 1;
|
||||
|
||||
// Home in on the target.
|
||||
P_HomingAttack(mobj, mobj->tracer);
|
||||
A_HomingChase(mobj);
|
||||
|
||||
if (mobj->z < mobj->floorz)
|
||||
mobj->z = mobj->floorz;
|
||||
|
@ -10003,12 +9889,9 @@ static boolean P_FuseThink(mobj_t *mobj)
|
|||
if (mobj->fuse)
|
||||
return true;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUAh_MobjFuse(mobj) || P_MobjWasRemoved(mobj))
|
||||
;
|
||||
else
|
||||
#endif
|
||||
if (mobj->info->flags & MF_MONITOR)
|
||||
else if (mobj->info->flags & MF_MONITOR)
|
||||
{
|
||||
P_MonitorFuseThink(mobj);
|
||||
return false;
|
||||
|
@ -10178,7 +10061,6 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// Check for a Lua thinker first
|
||||
if (!mobj->player)
|
||||
{
|
||||
|
@ -10192,7 +10074,7 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
if (P_MobjWasRemoved(mobj))
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// if it's pushable, or if it would be pushable other than temporary disablement, use the
|
||||
// separate thinker
|
||||
if (mobj->flags & MF_PUSHABLE || (mobj->info->flags & MF_PUSHABLE && mobj->fuse))
|
||||
|
@ -10261,7 +10143,7 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
mobj->eflags &= ~MFE_JUSTHITFLOOR;
|
||||
}
|
||||
|
||||
#ifdef ESLOPE // Sliding physics for slidey mobjs!
|
||||
// Sliding physics for slidey mobjs!
|
||||
if (mobj->type == MT_FLINGRING
|
||||
|| mobj->type == MT_FLINGCOIN
|
||||
|| mobj->type == MT_FLINGBLUESPHERE
|
||||
|
@ -10276,7 +10158,6 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
//if (mobj->standingslope) CONS_Printf("slope physics on mobj\n");
|
||||
P_ButteredSlope(mobj);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mobj->flags & (MF_ENEMY|MF_BOSS) && mobj->health
|
||||
&& P_CheckDeathPitCollide(mobj)) // extra pit check in case these didn't have momz
|
||||
|
@ -10610,15 +10491,11 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
|||
// Make sure scale matches destscale immediately when spawned
|
||||
P_SetScale(mobj, mobj->destscale);
|
||||
|
||||
mobj->floorz =
|
||||
#ifdef ESLOPE
|
||||
mobj->subsector->sector->f_slope ? P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
|
||||
#endif
|
||||
mobj->floorz = mobj->subsector->sector->f_slope ?
|
||||
P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
|
||||
mobj->subsector->sector->floorheight;
|
||||
mobj->ceilingz =
|
||||
#ifdef ESLOPE
|
||||
mobj->subsector->sector->c_slope ? P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
|
||||
#endif
|
||||
mobj->ceilingz = mobj->subsector->sector->c_slope ?
|
||||
P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
|
||||
mobj->subsector->sector->ceilingheight;
|
||||
|
||||
mobj->floorrover = NULL;
|
||||
|
@ -10655,7 +10532,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
|||
// Set shadowscale here, before spawn hook so that Lua can change it
|
||||
mobj->shadowscale = P_DefaultMobjShadowScale(mobj);
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// DANGER! This can cause P_SpawnMobj to return NULL!
|
||||
// Avoid using P_RemoveMobj on the newly created mobj in "MobjSpawn" Lua hooks!
|
||||
if (LUAh_MobjSpawn(mobj))
|
||||
|
@ -10666,7 +10542,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
|||
else if (P_MobjWasRemoved(mobj))
|
||||
return NULL;
|
||||
else
|
||||
#endif
|
||||
switch (mobj->type)
|
||||
{
|
||||
case MT_ALTVIEWMAN:
|
||||
|
@ -10936,9 +10811,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
|||
{
|
||||
var1 = st->var1;
|
||||
var2 = st->var2;
|
||||
#ifdef HAVE_BLUA
|
||||
astate = st;
|
||||
#endif
|
||||
st->action.acp1(mobj);
|
||||
// DANGER! This can cause P_SpawnMobj to return NULL!
|
||||
// Avoid using MF_RUNSPAWNFUNC on mobjs whose spawn state expects target or tracer to already be set!
|
||||
|
@ -10976,15 +10849,11 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
|
|||
// set subsector and/or block links
|
||||
P_SetPrecipitationThingPosition(mobj);
|
||||
|
||||
mobj->floorz = starting_floorz =
|
||||
#ifdef ESLOPE
|
||||
mobj->subsector->sector->f_slope ? P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
|
||||
#endif
|
||||
mobj->floorz = starting_floorz = mobj->subsector->sector->f_slope ?
|
||||
P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
|
||||
mobj->subsector->sector->floorheight;
|
||||
mobj->ceilingz =
|
||||
#ifdef ESLOPE
|
||||
mobj->subsector->sector->c_slope ? P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
|
||||
#endif
|
||||
mobj->ceilingz = mobj->subsector->sector->c_slope ?
|
||||
P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
|
||||
mobj->subsector->sector->ceilingheight;
|
||||
|
||||
mobj->floorrover = NULL;
|
||||
|
@ -11036,16 +10905,12 @@ size_t iquehead, iquetail;
|
|||
void P_RemoveMobj(mobj_t *mobj)
|
||||
{
|
||||
I_Assert(mobj != NULL);
|
||||
#ifdef HAVE_BLUA
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
return; // something already removing this mobj.
|
||||
|
||||
mobj->thinker.function.acp1 = (actionf_p1)P_RemoveThinkerDelayed; // shh. no recursing.
|
||||
LUAh_MobjRemoved(mobj);
|
||||
mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker; // needed for P_UnsetThingPosition, etc. to work.
|
||||
#else
|
||||
I_Assert(!P_MobjWasRemoved(mobj));
|
||||
#endif
|
||||
|
||||
// Rings only, please!
|
||||
if (mobj->spawnpoint &&
|
||||
|
@ -11624,15 +11489,11 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
|
|||
// set Z height
|
||||
sector = R_PointInSubsector(x, y)->sector;
|
||||
|
||||
floor =
|
||||
#ifdef ESLOPE
|
||||
sector->f_slope ? P_GetZAt(sector->f_slope, x, y) :
|
||||
#endif
|
||||
floor = sector->f_slope ?
|
||||
P_GetZAt(sector->f_slope, x, y) :
|
||||
sector->floorheight;
|
||||
ceiling =
|
||||
#ifdef ESLOPE
|
||||
sector->c_slope ? P_GetZAt(sector->c_slope, x, y) :
|
||||
#endif
|
||||
ceiling = sector->c_slope ?
|
||||
P_GetZAt(sector->c_slope, x, y) :
|
||||
sector->ceilingheight;
|
||||
ceilingspawn = ceiling - mobjinfo[MT_PLAYER].height;
|
||||
|
||||
|
@ -11703,15 +11564,11 @@ void P_MovePlayerToStarpost(INT32 playernum)
|
|||
P_SetThingPosition(mobj);
|
||||
sector = R_PointInSubsector(mobj->x, mobj->y)->sector;
|
||||
|
||||
floor =
|
||||
#ifdef ESLOPE
|
||||
sector->f_slope ? P_GetZAt(sector->f_slope, mobj->x, mobj->y) :
|
||||
#endif
|
||||
floor = sector->f_slope ?
|
||||
P_GetZAt(sector->f_slope, mobj->x, mobj->y) :
|
||||
sector->floorheight;
|
||||
ceiling =
|
||||
#ifdef ESLOPE
|
||||
sector->c_slope ? P_GetZAt(sector->c_slope, mobj->x, mobj->y) :
|
||||
#endif
|
||||
ceiling = sector->c_slope ?
|
||||
P_GetZAt(sector->c_slope, mobj->x, mobj->y) :
|
||||
sector->ceilingheight;
|
||||
|
||||
z = p->starpostz << FRACBITS;
|
||||
|
@ -11751,7 +11608,7 @@ void P_MovePlayerToStarpost(INT32 playernum)
|
|||
mapthing_t *huntemeralds[MAXHUNTEMERALDS];
|
||||
INT32 numhuntemeralds;
|
||||
|
||||
static fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x, const fixed_t y, const fixed_t offset, const boolean flip)
|
||||
fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x, const fixed_t y, const fixed_t offset, const boolean flip)
|
||||
{
|
||||
const subsector_t *ss = R_PointInSubsector(x, y);
|
||||
|
||||
|
@ -11761,20 +11618,14 @@ static fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x,
|
|||
|
||||
// Establish height.
|
||||
if (flip)
|
||||
return (
|
||||
#ifdef ESLOPE
|
||||
ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) :
|
||||
#endif
|
||||
ss->sector->ceilingheight) - offset - mobjinfo[mobjtype].height;
|
||||
return (ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) : ss->sector->ceilingheight)
|
||||
- offset - mobjinfo[mobjtype].height;
|
||||
else
|
||||
return (
|
||||
#ifdef ESLOPE
|
||||
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) :
|
||||
#endif
|
||||
ss->sector->floorheight) + offset;
|
||||
return (ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) : ss->sector->floorheight)
|
||||
+ offset;
|
||||
}
|
||||
|
||||
static fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mthing, const fixed_t x, const fixed_t y)
|
||||
fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mthing, const fixed_t x, const fixed_t y)
|
||||
{
|
||||
fixed_t offset = mthing->z << FRACBITS;
|
||||
boolean flip = (!!(mobjinfo[mobjtype].flags & MF_SPAWNCEILING) ^ !!(mthing->options & MTF_OBJECTFLIP));
|
||||
|
@ -11814,6 +11665,7 @@ static fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthin
|
|||
|
||||
// Ring-like items, may float additional units with MTF_AMBUSH.
|
||||
case MT_SPIKEBALL:
|
||||
case MT_EMERHUNT:
|
||||
case MT_EMERALDSPAWN:
|
||||
case MT_TOKEN:
|
||||
case MT_EMBLEM:
|
||||
|
@ -12709,7 +12561,6 @@ static boolean P_SetupBooster(mapthing_t* mthing, mobj_t* mobj, boolean strong)
|
|||
|
||||
static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean *doangle)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
boolean override = LUAh_MapThingSpawn(mobj, mthing);
|
||||
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
|
@ -12717,7 +12568,6 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
|
|||
|
||||
if (override)
|
||||
return true;
|
||||
#endif
|
||||
|
||||
switch (mobj->type)
|
||||
{
|
||||
|
|
|
@ -370,9 +370,7 @@ typedef struct mobj_s
|
|||
INT32 cusval;
|
||||
INT32 cvmem;
|
||||
|
||||
#ifdef ESLOPE
|
||||
struct pslope_s *standingslope; // The slope that the object is standing on (shouldn't need synced in savegames, right?)
|
||||
#endif
|
||||
|
||||
boolean colorized; // Whether the mobj uses the rainbow colormap
|
||||
fixed_t shadowscale; // If this object casts a shadow, and the size relative to radius
|
||||
|
@ -453,6 +451,9 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing);
|
|||
void P_MovePlayerToStarpost(INT32 playernum);
|
||||
void P_AfterPlayerSpawn(INT32 playernum);
|
||||
|
||||
fixed_t P_GetMobjSpawnHeight(const mobjtype_t mobjtype, const fixed_t x, const fixed_t y, const fixed_t offset, const boolean flip);
|
||||
fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mthing, const fixed_t x, const fixed_t y);
|
||||
|
||||
mobj_t *P_SpawnMapThing(mapthing_t *mthing);
|
||||
void P_SpawnHoop(mapthing_t *mthing);
|
||||
void P_SetBonusTime(mobj_t *mobj);
|
||||
|
|
433
src/p_polyobj.c
433
src/p_polyobj.c
File diff suppressed because it is too large
Load diff
|
@ -18,8 +18,6 @@
|
|||
#include "p_mobj.h"
|
||||
#include "r_defs.h"
|
||||
|
||||
// haleyjd: temporary define
|
||||
#ifdef POLYOBJECTS
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
|
@ -31,7 +29,6 @@
|
|||
#define POLYOBJ_SPAWNCRUSH_DOOMEDNUM 762 // todo: REMOVE
|
||||
|
||||
#define POLYOBJ_START_LINE 20
|
||||
#define POLYOBJ_EXPLICIT_LINE 21
|
||||
#define POLYINFO_SPECIALNUM 22
|
||||
|
||||
typedef enum
|
||||
|
@ -301,6 +298,14 @@ typedef struct polyrotdisplacedata_s
|
|||
UINT8 turnobjs;
|
||||
} polyrotdisplacedata_t;
|
||||
|
||||
typedef struct polyflagdata_s
|
||||
{
|
||||
INT32 polyObjNum;
|
||||
INT32 speed;
|
||||
UINT32 angle;
|
||||
fixed_t momx;
|
||||
} polyflagdata_t;
|
||||
|
||||
typedef struct polyfadedata_s
|
||||
{
|
||||
INT32 polyObjNum;
|
||||
|
@ -322,7 +327,6 @@ boolean P_PointInsidePolyobj(polyobj_t *po, fixed_t x, fixed_t y);
|
|||
boolean P_MobjTouchingPolyobj(polyobj_t *po, mobj_t *mo);
|
||||
boolean P_MobjInsidePolyobj(polyobj_t *po, mobj_t *mo);
|
||||
boolean P_BBoxInsidePolyobj(polyobj_t *po, fixed_t *bbox);
|
||||
void Polyobj_GetInfo(INT16 poid, INT32 *poflags, INT32 *parentID, INT32 *potrans);
|
||||
|
||||
// thinkers (needed in p_saveg.c)
|
||||
void T_PolyObjRotate(polyrotate_t *);
|
||||
|
@ -335,14 +339,14 @@ void T_PolyObjRotDisplace (polyrotdisplace_t *);
|
|||
void T_PolyObjFlag (polymove_t *);
|
||||
void T_PolyObjFade (polyfade_t *);
|
||||
|
||||
INT32 EV_DoPolyDoor(polydoordata_t *);
|
||||
INT32 EV_DoPolyObjMove(polymovedata_t *);
|
||||
INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *);
|
||||
INT32 EV_DoPolyObjRotate(polyrotdata_t *);
|
||||
INT32 EV_DoPolyObjDisplace(polydisplacedata_t *);
|
||||
INT32 EV_DoPolyObjRotDisplace(polyrotdisplacedata_t *);
|
||||
INT32 EV_DoPolyObjFlag(struct line_s *);
|
||||
INT32 EV_DoPolyObjFade(polyfadedata_t *);
|
||||
boolean EV_DoPolyDoor(polydoordata_t *);
|
||||
boolean EV_DoPolyObjMove(polymovedata_t *);
|
||||
boolean EV_DoPolyObjWaypoint(polywaypointdata_t *);
|
||||
boolean EV_DoPolyObjRotate(polyrotdata_t *);
|
||||
boolean EV_DoPolyObjDisplace(polydisplacedata_t *);
|
||||
boolean EV_DoPolyObjRotDisplace(polyrotdisplacedata_t *);
|
||||
boolean EV_DoPolyObjFlag(polyflagdata_t *);
|
||||
boolean EV_DoPolyObjFade(polyfadedata_t *);
|
||||
|
||||
|
||||
//
|
||||
|
@ -353,8 +357,6 @@ extern polyobj_t *PolyObjects;
|
|||
extern INT32 numPolyObjects;
|
||||
extern polymaplink_t **polyblocklinks; // polyobject blockmap
|
||||
|
||||
#endif // ifdef POLYOBJECTS
|
||||
|
||||
#endif
|
||||
|
||||
// EOF
|
||||
|
|
1335
src/p_saveg.c
1335
src/p_saveg.c
File diff suppressed because it is too large
Load diff
|
@ -27,7 +27,7 @@
|
|||
#include "i_system.h"
|
||||
|
||||
#include "r_data.h"
|
||||
#include "r_things.h"
|
||||
#include "r_things.h" // for R_AddSpriteDefs
|
||||
#include "r_patch.h"
|
||||
#include "r_sky.h"
|
||||
#include "r_draw.h"
|
||||
|
@ -57,9 +57,7 @@
|
|||
|
||||
#include "filesrch.h" // refreshdirmenu
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
#include "lua_hud.h" // level title
|
||||
#endif
|
||||
|
||||
#include "f_finale.h" // wipes
|
||||
|
||||
|
@ -79,9 +77,7 @@
|
|||
#include "hardware/hw_model.h"
|
||||
#endif
|
||||
|
||||
#ifdef ESLOPE
|
||||
#include "p_slopes.h"
|
||||
#endif
|
||||
|
||||
#include "fastcmp.h" // textmap parsing
|
||||
|
||||
|
@ -222,6 +218,9 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
|
|||
mapheaderinfo[num]->typeoflevel = 0;
|
||||
mapheaderinfo[num]->nextlevel = (INT16)(i + 1);
|
||||
mapheaderinfo[num]->startrings = 0;
|
||||
mapheaderinfo[num]->sstimer = 90;
|
||||
mapheaderinfo[num]->ssspheres = 1;
|
||||
mapheaderinfo[num]->gravity = FRACUNIT/2;
|
||||
mapheaderinfo[num]->keywords[0] = '\0';
|
||||
snprintf(mapheaderinfo[num]->musname, 7, "%sM", G_BuildMapName(i));
|
||||
mapheaderinfo[num]->musname[6] = 0;
|
||||
|
@ -697,47 +696,27 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum)
|
|||
|
||||
static void P_SpawnEmeraldHunt(void)
|
||||
{
|
||||
INT32 emer1, emer2, emer3;
|
||||
INT32 timeout = 0; // keeps from getting stuck
|
||||
INT32 emer[3], num[MAXHUNTEMERALDS], i, randomkey;
|
||||
fixed_t x, y, z;
|
||||
|
||||
emer1 = emer2 = emer3 = 0;
|
||||
for (i = 0; i < numhuntemeralds; i++)
|
||||
num[i] = i;
|
||||
|
||||
//increment spawn numbers because zero is valid.
|
||||
emer1 = (P_RandomKey(numhuntemeralds)) + 1;
|
||||
while (timeout++ < 100)
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
emer2 = (P_RandomKey(numhuntemeralds)) + 1;
|
||||
// generate random index, shuffle afterwards
|
||||
randomkey = P_RandomKey(numhuntemeralds--);
|
||||
emer[i] = num[randomkey];
|
||||
num[randomkey] = num[numhuntemeralds];
|
||||
num[numhuntemeralds] = emer[i];
|
||||
|
||||
if (emer2 != emer1)
|
||||
break;
|
||||
// spawn emerald
|
||||
x = huntemeralds[emer[i]]->x<<FRACBITS;
|
||||
y = huntemeralds[emer[i]]->y<<FRACBITS;
|
||||
z = P_GetMapThingSpawnHeight(MT_EMERHUNT, huntemeralds[emer[i]], x, y);
|
||||
P_SetMobjStateNF(P_SpawnMobj(x, y, z, MT_EMERHUNT),
|
||||
mobjinfo[MT_EMERHUNT].spawnstate+i);
|
||||
}
|
||||
|
||||
timeout = 0;
|
||||
while (timeout++ < 100)
|
||||
{
|
||||
emer3 = (P_RandomKey(numhuntemeralds)) + 1;
|
||||
|
||||
if (emer3 != emer2 && emer3 != emer1)
|
||||
break;
|
||||
}
|
||||
|
||||
//decrement spawn values to the actual number because zero is valid.
|
||||
if (emer1--)
|
||||
P_SpawnMobj(huntemeralds[emer1]->x<<FRACBITS,
|
||||
huntemeralds[emer1]->y<<FRACBITS,
|
||||
huntemeralds[emer1]->z<<FRACBITS, MT_EMERHUNT);
|
||||
|
||||
if (emer2--)
|
||||
P_SetMobjStateNF(P_SpawnMobj(huntemeralds[emer2]->x<<FRACBITS,
|
||||
huntemeralds[emer2]->y<<FRACBITS,
|
||||
huntemeralds[emer2]->z<<FRACBITS, MT_EMERHUNT),
|
||||
mobjinfo[MT_EMERHUNT].spawnstate+1);
|
||||
|
||||
if (emer3--)
|
||||
P_SetMobjStateNF(P_SpawnMobj(huntemeralds[emer3]->x<<FRACBITS,
|
||||
huntemeralds[emer3]->y<<FRACBITS,
|
||||
huntemeralds[emer3]->z<<FRACBITS, MT_EMERHUNT),
|
||||
mobjinfo[MT_EMERHUNT].spawnstate+2);
|
||||
}
|
||||
|
||||
static void P_SpawnMapThings(boolean spawnemblems)
|
||||
|
@ -870,13 +849,12 @@ static void P_InitializeSector(sector_t *ss)
|
|||
ss->camsec = -1;
|
||||
|
||||
ss->floorlightsec = ss->ceilinglightsec = -1;
|
||||
ss->crumblestate = 0;
|
||||
ss->crumblestate = CRUMBLE_NONE;
|
||||
|
||||
ss->touching_thinglist = NULL;
|
||||
|
||||
ss->linecount = 0;
|
||||
ss->lines = NULL;
|
||||
ss->tagline = NULL;
|
||||
|
||||
ss->ffloors = NULL;
|
||||
ss->attached = NULL;
|
||||
|
@ -911,11 +889,9 @@ static void P_InitializeSector(sector_t *ss)
|
|||
ss->preciplist = NULL;
|
||||
ss->touching_preciplist = NULL;
|
||||
|
||||
#ifdef ESLOPE
|
||||
ss->f_slope = NULL;
|
||||
ss->c_slope = NULL;
|
||||
ss->hasslope = false;
|
||||
#endif
|
||||
|
||||
ss->spawn_lightlevel = ss->lightlevel;
|
||||
|
||||
|
@ -980,9 +956,7 @@ static void P_InitializeLinedef(line_t *ld)
|
|||
ld->splats = NULL;
|
||||
#endif
|
||||
ld->firsttag = ld->nexttag = -1;
|
||||
#ifdef POLYOBJECTS
|
||||
ld->polyobj = NULL;
|
||||
#endif
|
||||
|
||||
ld->text = NULL;
|
||||
ld->callcount = 0;
|
||||
|
@ -1187,10 +1161,14 @@ static void P_LoadSidedefs(UINT8 *data)
|
|||
case 9: // Mace parameters
|
||||
case 14: // Bustable block parameters
|
||||
case 15: // Fan particle spawner parameters
|
||||
case 334: // Trigger linedef executor: Object dye - Continuous
|
||||
case 335: // Trigger linedef executor: Object dye - Each time
|
||||
case 336: // Trigger linedef executor: Object dye - Once
|
||||
case 425: // Calls P_SetMobjState on calling mobj
|
||||
case 434: // Custom Power
|
||||
case 442: // Calls P_SetMobjState on mobjs of a given type in the tagged sectors
|
||||
case 461: // Spawns an object on the map based on texture offsets
|
||||
case 463: // Colorizes an object
|
||||
{
|
||||
char process[8*3+1];
|
||||
memset(process,0,8*3+1);
|
||||
|
@ -1892,10 +1870,8 @@ static void P_InitializeSeg(seg_t *seg)
|
|||
|
||||
seg->numlights = 0;
|
||||
seg->rlights = NULL;
|
||||
#ifdef POLYOBJECTS
|
||||
seg->polyseg = NULL;
|
||||
seg->dontrenderme = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void P_LoadSegs(UINT8 *data)
|
||||
|
@ -2258,11 +2234,9 @@ static boolean P_LoadBlockMap(UINT8 *data, size_t count)
|
|||
blocklinks = Z_Calloc(count, PU_LEVEL, NULL);
|
||||
blockmap = blockmaplump+4;
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// haleyjd 2/22/06: setup polyobject blockmap
|
||||
count = sizeof(*polyblocklinks) * bmapwidth * bmapheight;
|
||||
polyblocklinks = Z_Calloc(count, PU_LEVEL, NULL);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2513,11 +2487,9 @@ static void P_CreateBlockMap(void)
|
|||
blocklinks = Z_Calloc(count, PU_LEVEL, NULL);
|
||||
blockmap = blockmaplump + 4;
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// haleyjd 2/22/06: setup polyobject blockmap
|
||||
count = sizeof(*polyblocklinks) * bmapwidth * bmapheight;
|
||||
polyblocklinks = Z_Calloc(count, PU_LEVEL, NULL);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3096,7 +3068,7 @@ static void P_InitTagGametype(void)
|
|||
//Also, you'd never have to loop through all 32 players slots to find anything ever again.
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && !(players[i].spectator && players[i].quittime))
|
||||
if (playeringame[i] && !(players[i].spectator || players[i].quittime))
|
||||
{
|
||||
playersactive[realnumplayers] = i; //stores the player's node in the array.
|
||||
realnumplayers++;
|
||||
|
@ -3526,9 +3498,7 @@ boolean P_LoadLevel(boolean fromnetsave)
|
|||
// Close text prompt before freeing the old level
|
||||
F_EndTextPrompt(false, true);
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_InvalidateLevel();
|
||||
#endif
|
||||
|
||||
for (ss = sectors; sectors+numsectors != ss; ss++)
|
||||
{
|
||||
|
@ -3584,9 +3554,7 @@ boolean P_LoadLevel(boolean fromnetsave)
|
|||
// anything that P_SpawnSlopes/P_LoadThings needs to know
|
||||
P_InitSpecials();
|
||||
|
||||
#ifdef ESLOPE
|
||||
P_SpawnSlopes(fromnetsave);
|
||||
#endif
|
||||
|
||||
P_SpawnMapThings(!fromnetsave);
|
||||
skyboxmo[0] = skyboxviewpnts[0];
|
||||
|
@ -3665,9 +3633,7 @@ boolean P_LoadLevel(boolean fromnetsave)
|
|||
G_CopyTiccmd(&players[i].cmd, &netcmds[buf][i], 1);
|
||||
}
|
||||
P_PreTicker(2);
|
||||
#ifdef HAVE_BLUA
|
||||
LUAh_MapLoad();
|
||||
#endif
|
||||
}
|
||||
|
||||
// No render mode, stop here.
|
||||
|
@ -3786,12 +3752,12 @@ static lumpinfo_t* FindFolder(const char *folName, UINT16 *start, UINT16 *end, l
|
|||
{
|
||||
UINT16 numlumps = *pnumlumps;
|
||||
size_t i = *pi;
|
||||
if (!stricmp(lumpinfo->name2, folName))
|
||||
if (!stricmp(lumpinfo->fullname, folName))
|
||||
{
|
||||
lumpinfo++;
|
||||
*start = ++i;
|
||||
for (; i < numlumps; i++, lumpinfo++)
|
||||
if (strnicmp(lumpinfo->name2, folName, strlen(folName)))
|
||||
if (strnicmp(lumpinfo->fullname, folName, strlen(folName)))
|
||||
break;
|
||||
lumpinfo--;
|
||||
*end = i-- - *start;
|
||||
|
@ -3859,10 +3825,8 @@ boolean P_AddWadFile(const char *wadfilename)
|
|||
|
||||
// Update the detected resources.
|
||||
// Note: ALWAYS load Lua scripts first, SOCs right after, and the remaining resources afterwards.
|
||||
#ifdef HAVE_BLUA
|
||||
// if (luaNum) // Lua scripts.
|
||||
// P_LoadLuaScrRange(wadnum, luaPos, luaNum);
|
||||
#endif
|
||||
// if (socNum) // SOCs.
|
||||
// P_LoadDehackRange(wadnum, socPos, socNum);
|
||||
if (sfxNum) // Sounds. TODO: Function currently only updates already existing sounds, the rest is handled somewhere else.
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue