Merge branch 'next' into knuxtweaks
This commit is contained in:
commit
3ebc17ac3a
|
@ -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.1
|
||||
VERSION 2.2.4
|
||||
LANGUAGES C)
|
||||
|
||||
if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
version: 2.2.1.{branch}-{build}
|
||||
version: 2.2.4.{branch}-{build}
|
||||
os: MinGW
|
||||
|
||||
environment:
|
||||
|
|
|
@ -19,7 +19,8 @@ set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/installer"
|
|||
set(SRB2_ASSET_HASHED
|
||||
"srb2.pk3;\
|
||||
player.dta;\
|
||||
zones.pk3"
|
||||
zones.pk3;\
|
||||
patch.pk3"
|
||||
CACHE STRING "Asset filenames to apply MD5 checks. No spaces between entries!"
|
||||
)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -756,20 +750,17 @@ linedeftypes
|
|||
prefix = "(20)";
|
||||
}
|
||||
|
||||
21
|
||||
{
|
||||
title = "Explicitly Include Line <disabled>";
|
||||
prefix = "(21)";
|
||||
}
|
||||
|
||||
22
|
||||
{
|
||||
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";
|
||||
flags512text = "[9] Render flats";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
}
|
||||
|
||||
30
|
||||
|
@ -788,7 +779,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";
|
||||
}
|
||||
|
@ -925,6 +915,7 @@ linedeftypes
|
|||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Render insides";
|
||||
flags128text = "[7] Only block non-players";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "195F";
|
||||
flags643dfloorflagsadd = "7C80";
|
||||
|
@ -984,6 +975,7 @@ linedeftypes
|
|||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Don't cast shadow";
|
||||
flags128text = "[7] Render insides/block non-plr";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "200191F";
|
||||
flags1283dfloorflagsadd = "7C80";
|
||||
|
@ -997,6 +989,7 @@ linedeftypes
|
|||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Don't cast shadow";
|
||||
flags128text = "[7] Render insides/block non-plr";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "2001917";
|
||||
flags1283dfloorflagsadd = "7C80";
|
||||
|
@ -1024,6 +1017,7 @@ linedeftypes
|
|||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Don't cast shadow";
|
||||
flags128text = "[7] Render insides/block non-plr";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "400191F";
|
||||
flags1283dfloorflagsadd = "7C80";
|
||||
|
@ -1037,6 +1031,7 @@ linedeftypes
|
|||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Don't cast shadow";
|
||||
flags128text = "[7] Render insides/block non-plr";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "4001917";
|
||||
flags1283dfloorflagsadd = "7C80";
|
||||
|
@ -1082,6 +1077,7 @@ linedeftypes
|
|||
flags64text = "[6] Use two light levels";
|
||||
flags512text = "[9] Use target light level";
|
||||
flags1024text = "[10] Ripple effect";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "9F39";
|
||||
flags643dfloorflagsadd = "20000";
|
||||
|
@ -1110,6 +1106,7 @@ linedeftypes
|
|||
flags64text = "[6] Use two light levels";
|
||||
flags512text = "[9] Use target light level";
|
||||
flags1024text = "[10] Ripple effect";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "1F31";
|
||||
flags643dfloorflagsadd = "20000";
|
||||
|
@ -1125,6 +1122,7 @@ linedeftypes
|
|||
flags64text = "[6] Use two light levels";
|
||||
flags512text = "[9] Use target light level";
|
||||
flags1024text = "[10] Ripple effect";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "209F39";
|
||||
flags643dfloorflagsadd = "20000";
|
||||
|
@ -1136,10 +1134,10 @@ 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";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "201F31";
|
||||
flags643dfloorflagsadd = "20000";
|
||||
|
@ -1162,6 +1160,7 @@ linedeftypes
|
|||
prefix = "(221)";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags64text = "[6] Cast shadow";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "1B59";
|
||||
flags643dfloorflagsremove = "40";
|
||||
|
@ -1227,6 +1226,18 @@ linedeftypes
|
|||
3dfloorflags = "19F";
|
||||
}
|
||||
|
||||
153
|
||||
{
|
||||
title = "Dynamically Sinking Platform";
|
||||
prefix = "(153)";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Spindash to move";
|
||||
flags128text = "[7] Only block non-players";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "19F";
|
||||
}
|
||||
|
||||
160
|
||||
{
|
||||
title = "Floating, Bobbing";
|
||||
|
@ -1273,6 +1284,7 @@ linedeftypes
|
|||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Spindash to move";
|
||||
flags128text = "[7] Only block non-players";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "195F";
|
||||
}
|
||||
|
@ -1282,7 +1294,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";
|
||||
|
@ -1313,6 +1324,7 @@ linedeftypes
|
|||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Spindash, no shadow";
|
||||
flags128text = "[7] Only block non-players";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "2009D1F";
|
||||
flags643dfloorflagsadd = "40";
|
||||
|
@ -1379,6 +1391,7 @@ linedeftypes
|
|||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Don't cast shadow";
|
||||
flags128text = "[7] Only block non-players";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "210959F";
|
||||
flags643dfloorflagsadd = "40";
|
||||
|
@ -1392,6 +1405,7 @@ linedeftypes
|
|||
flags32text = "[5] Only block player";
|
||||
flags64text = "[6] Don't cast shadow";
|
||||
flags128text = "[7] Only block non-players";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "218959F";
|
||||
flags643dfloorflagsadd = "40";
|
||||
|
@ -1488,16 +1502,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 +1533,8 @@ linedeftypes
|
|||
flags512text = "[9] Shattered by pushables";
|
||||
flags1024text = "[10] Trigger linedef executor";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "8800019";
|
||||
flags643dfloorflagsadd = "200006";
|
||||
3dfloorflags = "880001D";
|
||||
flags643dfloorflagsadd = "200002";
|
||||
}
|
||||
|
||||
253
|
||||
|
@ -1524,8 +1544,9 @@ linedeftypes
|
|||
flags8text = "[3] Slope skew sides";
|
||||
flags512text = "[9] Shattered by pushables";
|
||||
flags1024text = "[10] Trigger linedef executor";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "8801019";
|
||||
3dfloorflags = "880101D";
|
||||
}
|
||||
|
||||
254
|
||||
|
@ -1533,6 +1554,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";
|
||||
|
@ -1564,6 +1586,7 @@ linedeftypes
|
|||
flags128text = "[7] Only block non-players";
|
||||
flags512text = "[9] Shattered by pushables";
|
||||
flags1024text = "[10] Trigger linedef executor";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "1080101F";
|
||||
}
|
||||
|
@ -1585,6 +1608,7 @@ linedeftypes
|
|||
prefix = "(258)";
|
||||
flags8text = "[3] Slope skew sides";
|
||||
flags32text = "[5] Don't damage bosses";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorflags = "959";
|
||||
}
|
||||
|
@ -1593,10 +1617,12 @@ 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";
|
||||
flags1024text = "[10] Trigger linedef executor";
|
||||
flags8192text = "[13] Cut cyan flat pixels";
|
||||
3dfloor = true;
|
||||
3dfloorcustom = true;
|
||||
}
|
||||
|
@ -1896,6 +1922,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 +2208,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 +2235,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 +2251,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 +2278,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 +2292,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 +2370,6 @@ linedeftypes
|
|||
flags8text = "[3] Set delay by backside sector";
|
||||
}
|
||||
|
||||
|
||||
445
|
||||
{
|
||||
title = "Make FOF Disappear/Reappear";
|
||||
|
@ -2325,8 +2396,8 @@ linedeftypes
|
|||
flags32text = "[5] Subtract Red value";
|
||||
flags64text = "[6] Subtract Green value";
|
||||
flags128text = "[7] Subtract Blue value";
|
||||
flags256text = "[8] Calc relative values";
|
||||
flags32768text = "[15] Use back side colormap";
|
||||
flags256text = "[8] Set relative to current";
|
||||
flags32768text = "[15] Use backside colormap";
|
||||
}
|
||||
|
||||
448
|
||||
|
@ -2359,7 +2430,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 +2442,7 @@ linedeftypes
|
|||
flags32text = "[5] No collision during fade";
|
||||
flags64text = "[6] Do not handle FF_TRANS";
|
||||
flags128text = "[7] Do not handle lighting";
|
||||
flags256text = "[8] Set relative to current val";
|
||||
flags256text = "[8] Set relative to current";
|
||||
flags512text = "[9] Speed = Tic Duration";
|
||||
flags1024text = "[10] Override existing fade";
|
||||
flags16384text = "[14] Do not handle collision";
|
||||
|
@ -2395,11 +2466,11 @@ linedeftypes
|
|||
flags32text = "[5] Subtract Red value";
|
||||
flags64text = "[6] Subtract Green value";
|
||||
flags128text = "[7] Subtract Blue value";
|
||||
flags256text = "[8] Calc relative values";
|
||||
flags256text = "[8] Set relative to current";
|
||||
flags512text = "[9] Speed = Tic Duration";
|
||||
flags1024text = "[10] Override existing fade";
|
||||
flags16384text = "[14] Fade from invisible black";
|
||||
flags32768text = "[15] Use back side colormap";
|
||||
flags32768text = "[15] Use backside colormap";
|
||||
}
|
||||
|
||||
456
|
||||
|
@ -2416,9 +2487,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 +2593,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 +2603,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";
|
||||
|
@ -2547,45 +2616,63 @@ linedeftypes
|
|||
|
||||
500
|
||||
{
|
||||
title = "Scroll Wall Front Side Left";
|
||||
title = "Scroll Front Wall Left";
|
||||
prefix = "(500)";
|
||||
}
|
||||
|
||||
501
|
||||
{
|
||||
title = "Scroll Wall Front Side Right";
|
||||
title = "Scroll Front Wall Right";
|
||||
prefix = "(501)";
|
||||
}
|
||||
|
||||
502
|
||||
{
|
||||
title = "Scroll Wall According to Linedef";
|
||||
title = "Scroll Tagged Wall";
|
||||
prefix = "(502)";
|
||||
flags128text = "[7] Use texture offsets";
|
||||
flags256text = "[8] Scroll back side";
|
||||
}
|
||||
|
||||
503
|
||||
{
|
||||
title = "Scroll Wall According to Linedef (Accelerative)";
|
||||
title = "Scroll Tagged Wall (Accelerative)";
|
||||
prefix = "(503)";
|
||||
flags128text = "[7] Use texture offsets";
|
||||
flags256text = "[8] Scroll back side";
|
||||
}
|
||||
|
||||
504
|
||||
{
|
||||
title = "Scroll Wall According to Linedef (Displacement)";
|
||||
title = "Scroll Tagged Wall (Displacement)";
|
||||
prefix = "(504)";
|
||||
flags128text = "[7] Use texture offsets";
|
||||
flags256text = "[8] Scroll back side";
|
||||
}
|
||||
|
||||
505
|
||||
{
|
||||
title = "Scroll Texture by Front Side Offsets";
|
||||
title = "Scroll Front Wall by Front Side Offsets";
|
||||
prefix = "(505)";
|
||||
}
|
||||
|
||||
506
|
||||
{
|
||||
title = "Scroll Texture by Back Side Offsets";
|
||||
title = "Scroll Front Wall by Back Side Offsets";
|
||||
prefix = "(506)";
|
||||
}
|
||||
|
||||
507
|
||||
{
|
||||
title = "Scroll Back Wall by Front Side Offsets";
|
||||
prefix = "(507)";
|
||||
}
|
||||
|
||||
508
|
||||
{
|
||||
title = "Scroll Back Wall by Back Side Offsets";
|
||||
prefix = "(508)";
|
||||
}
|
||||
}
|
||||
|
||||
planescroll
|
||||
|
@ -2632,76 +2719,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 +2809,7 @@ linedeftypes
|
|||
title = "Wind";
|
||||
prefix = "(541)";
|
||||
flags512text = "[9] Player slides";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
542
|
||||
|
@ -2722,7 +2817,7 @@ linedeftypes
|
|||
title = "Upwards Wind";
|
||||
prefix = "(542)";
|
||||
flags512text = "[9] Player slides";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
543
|
||||
|
@ -2730,7 +2825,7 @@ linedeftypes
|
|||
title = "Downwards Wind";
|
||||
prefix = "(543)";
|
||||
flags512text = "[9] Player slides";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
544
|
||||
|
@ -2738,7 +2833,7 @@ linedeftypes
|
|||
title = "Current";
|
||||
prefix = "(544)";
|
||||
flags512text = "[9] Player slides";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
545
|
||||
|
@ -2746,7 +2841,7 @@ linedeftypes
|
|||
title = "Upwards Current";
|
||||
prefix = "(545)";
|
||||
flags512text = "[9] Player slides";
|
||||
flags64text = "[6] Even across edges";
|
||||
flags64text = "[6] Exclusive";
|
||||
}
|
||||
|
||||
546
|
||||
|
@ -2754,13 +2849,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 +3503,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 +3770,7 @@ thingtypes
|
|||
width = 8;
|
||||
height = 16;
|
||||
sprite = "internal:capsule";
|
||||
angletext = "Tag";
|
||||
}
|
||||
292
|
||||
{
|
||||
|
@ -3870,6 +3967,8 @@ thingtypes
|
|||
{
|
||||
title = "Emerald Hunt Location";
|
||||
sprite = "SHRDA0";
|
||||
flags8height = 24;
|
||||
flags8text = "[8] Float";
|
||||
}
|
||||
321
|
||||
{
|
||||
|
@ -3897,9 +3996,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 +4129,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 +4226,9 @@ thingtypes
|
|||
sprite = "STPTA0M0";
|
||||
width = 64;
|
||||
height = 128;
|
||||
flags4text = "[4] Respawn at center";
|
||||
angletext = "Angle/Order";
|
||||
parametertext = "Order";
|
||||
}
|
||||
520
|
||||
{
|
||||
|
@ -4152,6 +4255,7 @@ thingtypes
|
|||
sprite = "WSPKALAR";
|
||||
width = 16;
|
||||
height = 14;
|
||||
arrow = 1;
|
||||
flags1text = "[1] Start retracted";
|
||||
flags4text = "[4] Retractable";
|
||||
flags8text = "[8] Intangible";
|
||||
|
@ -4558,6 +4662,7 @@ thingtypes
|
|||
sprite = "TOADA0";
|
||||
width = 32;
|
||||
height = 16;
|
||||
angletext = "Tag";
|
||||
}
|
||||
757
|
||||
{
|
||||
|
@ -5832,7 +5937,7 @@ thingtypes
|
|||
sprite = "CAPSA0";
|
||||
width = 72;
|
||||
height = 144;
|
||||
angletext = "Rings";
|
||||
angletext = "Spheres";
|
||||
parametertext = "Mare";
|
||||
}
|
||||
}
|
||||
|
@ -6273,7 +6378,7 @@ thingtypes
|
|||
sprite = "PUMKA0";
|
||||
width = 16;
|
||||
height = 40;
|
||||
flags1text = "Don't flicker";
|
||||
flags1text = "[1] Don't flicker";
|
||||
}
|
||||
2007
|
||||
{
|
||||
|
@ -6281,7 +6386,7 @@ thingtypes
|
|||
sprite = "PUMKB0";
|
||||
width = 16;
|
||||
height = 40;
|
||||
flags1text = "Don't flicker";
|
||||
flags1text = "[1] Don't flicker";
|
||||
}
|
||||
2008
|
||||
{
|
||||
|
@ -6289,7 +6394,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,92 +241,90 @@ if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only
|
|||
"Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME, OpenMPT).")
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_BLUA})
|
||||
add_definitions(-DHAVE_BLUA)
|
||||
set(SRB2_LUA_SOURCES
|
||||
lua_baselib.c
|
||||
lua_blockmaplib.c
|
||||
lua_consolelib.c
|
||||
lua_hooklib.c
|
||||
lua_hudlib.c
|
||||
lua_infolib.c
|
||||
lua_maplib.c
|
||||
lua_mathlib.c
|
||||
lua_mobjlib.c
|
||||
lua_playerlib.c
|
||||
lua_script.c
|
||||
lua_skinlib.c
|
||||
lua_thinkerlib.c
|
||||
)
|
||||
set(SRB2_LUA_HEADERS
|
||||
lua_hook.h
|
||||
lua_hud.h
|
||||
lua_libs.h
|
||||
lua_script.h
|
||||
)
|
||||
set(SRB2_LUA_SOURCES
|
||||
lua_baselib.c
|
||||
lua_blockmaplib.c
|
||||
lua_consolelib.c
|
||||
lua_hooklib.c
|
||||
lua_hudlib.c
|
||||
lua_infolib.c
|
||||
lua_maplib.c
|
||||
lua_mathlib.c
|
||||
lua_mobjlib.c
|
||||
lua_playerlib.c
|
||||
lua_script.c
|
||||
lua_skinlib.c
|
||||
lua_thinkerlib.c
|
||||
)
|
||||
set(SRB2_LUA_HEADERS
|
||||
lua_hook.h
|
||||
lua_hud.h
|
||||
lua_libs.h
|
||||
lua_script.h
|
||||
)
|
||||
|
||||
prepend_sources(SRB2_LUA_SOURCES)
|
||||
prepend_sources(SRB2_LUA_HEADERS)
|
||||
prepend_sources(SRB2_LUA_SOURCES)
|
||||
prepend_sources(SRB2_LUA_HEADERS)
|
||||
|
||||
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
|
||||
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
|
||||
|
||||
set(SRB2_BLUA_SOURCES
|
||||
blua/lapi.c
|
||||
blua/lauxlib.c
|
||||
blua/lbaselib.c
|
||||
blua/lcode.c
|
||||
blua/ldebug.c
|
||||
blua/ldo.c
|
||||
blua/ldump.c
|
||||
blua/lfunc.c
|
||||
blua/lgc.c
|
||||
blua/linit.c
|
||||
blua/llex.c
|
||||
blua/lmem.c
|
||||
blua/lobject.c
|
||||
blua/lopcodes.c
|
||||
blua/lparser.c
|
||||
blua/lstate.c
|
||||
blua/lstring.c
|
||||
blua/lstrlib.c
|
||||
blua/ltable.c
|
||||
blua/ltablib.c
|
||||
blua/ltm.c
|
||||
blua/lundump.c
|
||||
blua/lvm.c
|
||||
blua/lzio.c
|
||||
)
|
||||
set(SRB2_BLUA_HEADERS
|
||||
blua/lapi.h
|
||||
blua/lauxlib.h
|
||||
blua/lcode.h
|
||||
blua/ldebug.h
|
||||
blua/ldo.h
|
||||
blua/lfunc.h
|
||||
blua/lgc.h
|
||||
blua/llex.h
|
||||
blua/llimits.h
|
||||
blua/lmem.h
|
||||
blua/lobject.h
|
||||
blua/lopcodes.h
|
||||
blua/lparser.h
|
||||
blua/lstate.h
|
||||
blua/lstring.h
|
||||
blua/ltable.h
|
||||
blua/ltm.h
|
||||
blua/lua.h
|
||||
blua/luaconf.h
|
||||
blua/lualib.h
|
||||
blua/lundump.h
|
||||
blua/lvm.h
|
||||
blua/lzio.h
|
||||
)
|
||||
set(SRB2_BLUA_SOURCES
|
||||
blua/lapi.c
|
||||
blua/lauxlib.c
|
||||
blua/lbaselib.c
|
||||
blua/lcode.c
|
||||
blua/ldebug.c
|
||||
blua/ldo.c
|
||||
blua/ldump.c
|
||||
blua/lfunc.c
|
||||
blua/lgc.c
|
||||
blua/linit.c
|
||||
blua/liolib.c
|
||||
blua/llex.c
|
||||
blua/lmem.c
|
||||
blua/lobject.c
|
||||
blua/lopcodes.c
|
||||
blua/lparser.c
|
||||
blua/lstate.c
|
||||
blua/lstring.c
|
||||
blua/lstrlib.c
|
||||
blua/ltable.c
|
||||
blua/ltablib.c
|
||||
blua/ltm.c
|
||||
blua/lundump.c
|
||||
blua/lvm.c
|
||||
blua/lzio.c
|
||||
)
|
||||
set(SRB2_BLUA_HEADERS
|
||||
blua/lapi.h
|
||||
blua/lauxlib.h
|
||||
blua/lcode.h
|
||||
blua/ldebug.h
|
||||
blua/ldo.h
|
||||
blua/lfunc.h
|
||||
blua/lgc.h
|
||||
blua/llex.h
|
||||
blua/llimits.h
|
||||
blua/lmem.h
|
||||
blua/lobject.h
|
||||
blua/lopcodes.h
|
||||
blua/lparser.h
|
||||
blua/lstate.h
|
||||
blua/lstring.h
|
||||
blua/ltable.h
|
||||
blua/ltm.h
|
||||
blua/lua.h
|
||||
blua/luaconf.h
|
||||
blua/lualib.h
|
||||
blua/lundump.h
|
||||
blua/lvm.h
|
||||
blua/lzio.h
|
||||
)
|
||||
|
||||
prepend_sources(SRB2_BLUA_SOURCES)
|
||||
prepend_sources(SRB2_BLUA_HEADERS)
|
||||
prepend_sources(SRB2_BLUA_SOURCES)
|
||||
prepend_sources(SRB2_BLUA_HEADERS)
|
||||
|
||||
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
|
||||
endif()
|
||||
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_GME})
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
|
@ -418,6 +418,7 @@ endif()
|
|||
if(${SRB2_CONFIG_HWRENDER})
|
||||
add_definitions(-DHWRENDER)
|
||||
set(SRB2_HWRENDER_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_batching.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_bsp.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_cache.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.c
|
||||
|
@ -433,6 +434,7 @@ if(${SRB2_CONFIG_HWRENDER})
|
|||
)
|
||||
|
||||
set (SRB2_HWRENDER_HEADERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_batching.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
|
||||
|
|
14
src/Makefile
14
src/Makefile
|
@ -2,7 +2,7 @@
|
|||
# GNU Make makefile for SRB2
|
||||
#############################################################################
|
||||
# Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
# Copyright (C) 2003-2019 by Sonic Team Junior.
|
||||
# Copyright (C) 2003-2020 by Sonic Team Junior.
|
||||
#
|
||||
# This program is free software distributed under the
|
||||
# terms of the GNU General Public License, version 2.
|
||||
|
@ -222,12 +222,10 @@ endif
|
|||
ifdef NOHW
|
||||
OPTS+=-DNOHW
|
||||
else
|
||||
#Hurdler: not really supported and not tested recently
|
||||
#OPTS+=-DUSE_PALETTED_TEXTURE
|
||||
OPTS+=-DHWRENDER
|
||||
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o $(OBJDIR)/hw_light.o \
|
||||
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_trick.o \
|
||||
$(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o
|
||||
$(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o $(OBJDIR)/hw_batching.o
|
||||
endif
|
||||
|
||||
ifdef NOHS
|
||||
|
@ -340,9 +338,7 @@ CFLAGS+=-DHAVE_MINIUPNPC
|
|||
endif
|
||||
endif
|
||||
|
||||
ifndef NO_LUA
|
||||
include blua/Makefile.cfg
|
||||
endif
|
||||
include blua/Makefile.cfg
|
||||
|
||||
ifdef NOMD5
|
||||
OPTS+=-DNOMD5
|
||||
|
@ -424,6 +420,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 +465,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 +680,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"
|
||||
|
|
42
src/am_map.c
42
src/am_map.c
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -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,13 +929,10 @@ 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); \
|
||||
end2 = P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y); \
|
||||
} else \
|
||||
end1 = end2 = normalheight;
|
||||
end1 = P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y, normalheight); \
|
||||
end2 = P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y, normalheight);
|
||||
|
||||
SLOPEPARAMS(lines[i].frontsector->f_slope, frontf1, frontf2, lines[i].frontsector->floorheight)
|
||||
SLOPEPARAMS(lines[i].frontsector->c_slope, frontc1, frontc2, lines[i].frontsector->ceilingheight)
|
||||
|
@ -946,7 +941,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 +949,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 +971,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 +982,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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2019, James R.
|
||||
Copyright 2019-2020, James R.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2019, James R.
|
||||
Copyright 2019-2020, James R.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
|
19
src/b_bot.c
19
src/b_bot.c
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2007-2016 by John "JTE" Muniz.
|
||||
// Copyright (C) 2011-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 2011-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
@ -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,19 @@ boolean B_CheckRespawn(player_t *player)
|
|||
if (!sonic || sonic->health <= 0)
|
||||
return false;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2007-2016 by John "JTE" Muniz.
|
||||
// Copyright (C) 2012-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 2012-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../doomdef.h"
|
||||
#include "../lua_script.h"
|
||||
#include "../w_wad.h"
|
||||
|
||||
#define lbaselib_c
|
||||
#define LUA_LIB
|
||||
|
||||
|
@ -263,6 +267,27 @@ static int luaB_ipairs (lua_State *L) {
|
|||
}
|
||||
|
||||
|
||||
// Edited to load PK3 entries instead
|
||||
static int luaB_dofile (lua_State *L) {
|
||||
const char *filename = luaL_checkstring(L, 1);
|
||||
char fullfilename[256];
|
||||
UINT16 lumpnum;
|
||||
int n = lua_gettop(L);
|
||||
|
||||
if (wadfiles[numwadfiles - 1]->type != RET_PK3)
|
||||
luaL_error(L, "dofile() only works with PK3 files");
|
||||
|
||||
snprintf(fullfilename, sizeof(fullfilename), "Lua/%s", filename);
|
||||
lumpnum = W_CheckNumForFullNamePK3(fullfilename, numwadfiles - 1, 0);
|
||||
if (lumpnum == INT16_MAX)
|
||||
luaL_error(L, "can't find script " LUA_QS, fullfilename);
|
||||
|
||||
LUA_LoadLump(numwadfiles - 1, lumpnum, false);
|
||||
|
||||
return lua_gettop(L) - n;
|
||||
}
|
||||
|
||||
|
||||
static int luaB_assert (lua_State *L) {
|
||||
luaL_checkany(L, 1);
|
||||
if (!lua_toboolean(L, 1))
|
||||
|
@ -380,6 +405,7 @@ static const luaL_Reg base_funcs[] = {
|
|||
{"assert", luaB_assert},
|
||||
{"collectgarbage", luaB_collectgarbage},
|
||||
{"error", luaB_error},
|
||||
{"dofile", luaB_dofile},
|
||||
{"gcinfo", luaB_gcinfo},
|
||||
{"getfenv", luaB_getfenv},
|
||||
{"getmetatable", luaB_getmetatable},
|
||||
|
|
|
@ -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}
|
||||
};
|
||||
|
|
|
@ -0,0 +1,640 @@
|
|||
/*
|
||||
** $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)
|
||||
{
|
||||
char mode[4];
|
||||
|
||||
// Ensure we are opening in binary mode
|
||||
// (if it's a text file, newlines have been converted already)
|
||||
strcpy(mode, luafiletransfers->mode);
|
||||
if (!strchr(mode, 'b'))
|
||||
strcat(mode, "b");
|
||||
|
||||
pf = newfile(gL); // Create and push the file handle
|
||||
*pf = fopen(luafiletransfers->realfilename, 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 (waitingforluafilecommand)
|
||||
{
|
||||
waitingforluafilecommand = false;
|
||||
CL_PrepareDownloadLuaFile();
|
||||
}
|
||||
|
||||
if (server && luafiletransfers)
|
||||
SV_PrepareSendLuaFile();
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -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();
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
|
|
@ -27,13 +27,15 @@
|
|||
|
||||
/* Manually defined asset hashes for non-CMake builds
|
||||
* Last updated 2020 / 02 / 15 - v2.2.1 - main assets
|
||||
* Last updated 20?? / ?? / ?? - v2.2.? - patch.pk3
|
||||
* Last updated 2020 / 02 / 22 - v2.2.2 - patch.pk3
|
||||
* Last updated 2020 / 05 / 10 - v2.2.3 - player.dta & patch.pk3
|
||||
* Last updated 2020 / 05 / 11 - v2.2.4 - 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 "there is no patch.pk3, only zuul"
|
||||
#define ASSET_HASH_PATCH_PK3 "bbbf6af3b20349612ee06e0b55979a76"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -778,7 +770,7 @@ boolean CON_Responder(event_t *ev)
|
|||
// check for console toggle key
|
||||
if (ev->type != ev_console)
|
||||
{
|
||||
if (modeattacking || metalrecording)
|
||||
if (modeattacking || metalrecording || marathonmode)
|
||||
return false;
|
||||
|
||||
if (key == gamecontrol[gc_console][0] || key == gamecontrol[gc_console][1])
|
||||
|
@ -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)
|
||||
|
@ -1624,10 +1649,7 @@ void CON_Drawer(void)
|
|||
return;
|
||||
|
||||
if (needpatchrecache)
|
||||
{
|
||||
W_FlushCachedPatches();
|
||||
HU_LoadGraphics();
|
||||
}
|
||||
|
||||
if (con_recalc)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
|
942
src/d_clisrv.c
942
src/d_clisrv.c
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -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,8 @@ basic fields of the packet, and change infrequently.
|
|||
// be transmitted.
|
||||
|
||||
// Networking and tick handling related.
|
||||
#define BACKUPTICS 32
|
||||
#define BACKUPTICS 1024
|
||||
#define CLIENTBACKUPTICS 32
|
||||
#define MAXTEXTCMD 256
|
||||
//
|
||||
// Packet structure
|
||||
|
@ -67,6 +65,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
|
||||
|
@ -74,6 +76,8 @@ typedef enum
|
|||
// In addition, this packet can't occupy all the available slots.
|
||||
|
||||
PT_FILEFRAGMENT = PT_CANFAIL, // A part of a file.
|
||||
PT_FILEACK,
|
||||
PT_FILERECEIVED,
|
||||
|
||||
PT_TEXTCMD, // Extra text commands from the client.
|
||||
PT_TEXTCMD2, // Splitscreen text commands.
|
||||
|
@ -127,7 +131,7 @@ typedef struct
|
|||
// this packet is too large
|
||||
typedef struct
|
||||
{
|
||||
UINT8 starttic;
|
||||
tic_t starttic;
|
||||
UINT8 numtics;
|
||||
UINT8 numslots; // "Slots filled": Highest player number in use plus one.
|
||||
ticcmd_t cmds[45]; // Normally [BACKUPTIC][MAXPLAYERS] but too large
|
||||
|
@ -170,6 +174,9 @@ typedef struct
|
|||
UINT32 pflags; // pflags_t
|
||||
UINT8 panim; // panim_t
|
||||
|
||||
INT16 angleturn;
|
||||
INT16 oldrelangleturn;
|
||||
|
||||
angle_t aiming;
|
||||
INT32 currentweapon;
|
||||
INT32 ringweapons;
|
||||
|
@ -187,7 +194,7 @@ typedef struct
|
|||
SINT8 xtralife;
|
||||
SINT8 pity;
|
||||
|
||||
UINT8 skincolor;
|
||||
UINT16 skincolor;
|
||||
INT32 skin;
|
||||
UINT32 availabilities;
|
||||
// Just in case Lua does something like
|
||||
|
@ -307,7 +314,7 @@ typedef struct
|
|||
|
||||
// 0xFF == not in game; else player skin num
|
||||
UINT8 playerskins[MAXPLAYERS];
|
||||
UINT8 playercolor[MAXPLAYERS];
|
||||
UINT16 playercolor[MAXPLAYERS];
|
||||
UINT32 playeravailabilities[MAXPLAYERS];
|
||||
|
||||
UINT8 gametype;
|
||||
|
@ -319,13 +326,30 @@ typedef struct
|
|||
UINT8 varlengthinputs[0]; // Playernames and netvars
|
||||
} ATTRPACK serverconfig_pak;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
UINT8 fileid;
|
||||
UINT32 filesize;
|
||||
UINT8 iteration;
|
||||
UINT32 position;
|
||||
UINT16 size;
|
||||
UINT8 data[0]; // Size is variable using hardware_MAXPACKETLENGTH
|
||||
} ATTRPACK filetx_pak;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT32 start;
|
||||
UINT32 acks;
|
||||
} ATTRPACK fileacksegment_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT8 fileid;
|
||||
UINT8 iteration;
|
||||
UINT8 numsegments;
|
||||
fileacksegment_t segments[0];
|
||||
} ATTRPACK fileack_pak;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(default : 4200)
|
||||
#endif
|
||||
|
@ -361,6 +385,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;
|
||||
|
@ -412,7 +437,7 @@ typedef struct
|
|||
{
|
||||
char name[MAXPLAYERNAME+1];
|
||||
UINT8 skin;
|
||||
UINT8 color;
|
||||
UINT16 color;
|
||||
UINT32 pflags;
|
||||
UINT32 score;
|
||||
UINT8 ctfteam;
|
||||
|
@ -440,6 +465,8 @@ typedef struct
|
|||
UINT8 resynchgot; //
|
||||
UINT8 textcmd[MAXTEXTCMD+1]; // 66049 bytes (wut??? 64k??? More like 257 bytes...)
|
||||
filetx_pak filetxpak; // 139 bytes
|
||||
fileack_pak fileack;
|
||||
UINT8 filereceived;
|
||||
clientconfig_pak clientcfg; // 136 bytes
|
||||
UINT8 md5sum[16];
|
||||
serverinfo_pak serverinfo; // 1024 bytes
|
||||
|
@ -513,12 +540,12 @@ 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;
|
||||
|
||||
// Used in d_net, the only dependence
|
||||
tic_t ExpandTics(INT32 low);
|
||||
tic_t ExpandTics(INT32 low, INT32 node);
|
||||
void D_ClientServerInit(void);
|
||||
|
||||
// Initialise the other field
|
||||
|
@ -532,7 +559,6 @@ void NetUpdate(void);
|
|||
|
||||
void SV_StartSinglePlayerServer(void);
|
||||
boolean SV_SpawnServer(void);
|
||||
void SV_SpawnPlayer(INT32 playernum, INT32 x, INT32 y, angle_t angle);
|
||||
void SV_StopServer(void);
|
||||
void SV_ResetServer(void);
|
||||
void CL_AddSplitscreenPlayer(void);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
|
225
src/d_main.c
225
src/d_main.c
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -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;
|
||||
|
@ -127,6 +125,12 @@ boolean advancedemo;
|
|||
INT32 debugload = 0;
|
||||
#endif
|
||||
|
||||
UINT16 numskincolors;
|
||||
menucolor_t *menucolorhead, *menucolortail;
|
||||
|
||||
char savegamename[256];
|
||||
char liveeventbackup[256];
|
||||
|
||||
char srb2home[256] = ".";
|
||||
char srb2path[256] = ".";
|
||||
boolean usehome = true;
|
||||
|
@ -312,7 +316,9 @@ static void D_Display(void)
|
|||
F_WipeStartScreen();
|
||||
// Check for Mega Genesis fade
|
||||
wipestyleflags = WSF_FADEOUT;
|
||||
if (F_TryColormapFade(31))
|
||||
if (wipegamestate == (gamestate_t)FORCEWIPE)
|
||||
F_WipeColorFill(31);
|
||||
else if (F_TryColormapFade(31))
|
||||
wipetypepost = -1; // Don't run the fade below this one
|
||||
F_WipeEndScreen();
|
||||
F_RunWipe(wipetypepre, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
|
||||
|
@ -411,6 +417,7 @@ static void D_Display(void)
|
|||
|
||||
if (!automapactive && !dedicated && cv_renderview.value)
|
||||
{
|
||||
rs_rendercalltime = I_GetTimeMicros();
|
||||
if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD)
|
||||
{
|
||||
topleft = screens[0] + viewwindowy*vid.width + viewwindowx;
|
||||
|
@ -457,6 +464,7 @@ static void D_Display(void)
|
|||
if (postimgtype2)
|
||||
V_DoPostProcessor(1, postimgtype2, postimgparam2);
|
||||
}
|
||||
rs_rendercalltime = I_GetTimeMicros() - rs_rendercalltime;
|
||||
}
|
||||
|
||||
if (lastdraw)
|
||||
|
@ -508,13 +516,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
|
||||
//
|
||||
|
@ -594,22 +600,96 @@ static void D_Display(void)
|
|||
V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-10, V_YELLOWMAP, s);
|
||||
}
|
||||
|
||||
if (cv_renderstats.value)
|
||||
{
|
||||
char s[50];
|
||||
int frametime = I_GetTimeMicros() - rs_prevframetime;
|
||||
int divisor = 1;
|
||||
rs_prevframetime = I_GetTimeMicros();
|
||||
|
||||
if (rs_rendercalltime > 10000) divisor = 1000;
|
||||
|
||||
snprintf(s, sizeof s - 1, "ft %d", frametime / divisor);
|
||||
V_DrawThinString(30, 10, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "rtot %d", rs_rendercalltime / divisor);
|
||||
V_DrawThinString(30, 20, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "bsp %d", rs_bsptime / divisor);
|
||||
V_DrawThinString(30, 30, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "nbsp %d", rs_numbspcalls);
|
||||
V_DrawThinString(80, 10, V_MONOSPACE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "nspr %d", rs_numsprites);
|
||||
V_DrawThinString(80, 20, V_MONOSPACE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "nnod %d", rs_numdrawnodes);
|
||||
V_DrawThinString(80, 30, V_MONOSPACE | V_BLUEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "npob %d", rs_numpolyobjects);
|
||||
V_DrawThinString(80, 40, V_MONOSPACE | V_BLUEMAP, s);
|
||||
if (rendermode == render_opengl) // OpenGL specific stats
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "nsrt %d", rs_hw_nodesorttime / divisor);
|
||||
V_DrawThinString(30, 40, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "ndrw %d", rs_hw_nodedrawtime / divisor);
|
||||
V_DrawThinString(30, 50, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "ssrt %d", rs_hw_spritesorttime / divisor);
|
||||
V_DrawThinString(30, 60, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "sdrw %d", rs_hw_spritedrawtime / divisor);
|
||||
V_DrawThinString(30, 70, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "fin %d", rs_swaptime / divisor);
|
||||
V_DrawThinString(30, 80, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
if (cv_grbatching.value)
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "bsrt %d", rs_hw_batchsorttime / divisor);
|
||||
V_DrawThinString(80, 55, V_MONOSPACE | V_REDMAP, s);
|
||||
snprintf(s, sizeof s - 1, "bdrw %d", rs_hw_batchdrawtime / divisor);
|
||||
V_DrawThinString(80, 65, V_MONOSPACE | V_REDMAP, s);
|
||||
|
||||
snprintf(s, sizeof s - 1, "npol %d", rs_hw_numpolys);
|
||||
V_DrawThinString(130, 10, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "ndc %d", rs_hw_numcalls);
|
||||
V_DrawThinString(130, 20, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "nshd %d", rs_hw_numshaders);
|
||||
V_DrawThinString(130, 30, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "nvrt %d", rs_hw_numverts);
|
||||
V_DrawThinString(130, 40, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "ntex %d", rs_hw_numtextures);
|
||||
V_DrawThinString(185, 10, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "npf %d", rs_hw_numpolyflags);
|
||||
V_DrawThinString(185, 20, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
snprintf(s, sizeof s - 1, "ncol %d", rs_hw_numcolors);
|
||||
V_DrawThinString(185, 30, V_MONOSPACE | V_PURPLEMAP, s);
|
||||
}
|
||||
}
|
||||
else // software specific stats
|
||||
{
|
||||
snprintf(s, sizeof s - 1, "prtl %d", rs_sw_portaltime / divisor);
|
||||
V_DrawThinString(30, 40, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "plns %d", rs_sw_planetime / divisor);
|
||||
V_DrawThinString(30, 50, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "mskd %d", rs_sw_maskedtime / divisor);
|
||||
V_DrawThinString(30, 60, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
snprintf(s, sizeof s - 1, "fin %d", rs_swaptime / divisor);
|
||||
V_DrawThinString(30, 70, V_MONOSPACE | V_YELLOWMAP, s);
|
||||
}
|
||||
}
|
||||
|
||||
rs_swaptime = I_GetTimeMicros();
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
rs_swaptime = I_GetTimeMicros() - rs_swaptime;
|
||||
}
|
||||
|
||||
needpatchflush = false;
|
||||
needpatchrecache = false;
|
||||
}
|
||||
|
||||
// Lactozilla: Check the renderer's state
|
||||
// Check the renderer's state
|
||||
// after a possible renderer switch.
|
||||
void D_CheckRendererState(void)
|
||||
{
|
||||
// flush all patches from memory
|
||||
// (also frees memory tagged with PU_CACHE)
|
||||
// (which are not necessarily patches but I don't care)
|
||||
if (needpatchflush)
|
||||
{
|
||||
Z_FlushCachedPatches();
|
||||
needpatchflush = false;
|
||||
}
|
||||
|
||||
// some patches have been freed,
|
||||
// so cache them again
|
||||
|
@ -665,7 +745,7 @@ void D_SRB2Loop(void)
|
|||
*/
|
||||
/* Smells like a hack... Don't fade Sonic's ass into the title screen. */
|
||||
if (gamestate != GS_TITLESCREEN)
|
||||
V_DrawScaledPatch(0, 0, 0, W_CachePatchNum(W_GetNumForName("CONSBACK"), PU_CACHE));
|
||||
V_DrawScaledPatch(0, 0, 0, W_CachePatchNum(W_GetNumForName("CONSBACK"), PU_PATCH));
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
@ -748,9 +828,7 @@ void D_SRB2Loop(void)
|
|||
HW3S_EndFrameUpdate();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_Step();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -819,6 +897,7 @@ void D_StartTitle(void)
|
|||
// In case someone exits out at the same time they start a time attack run,
|
||||
// reset modeattacking
|
||||
modeattacking = ATTACKING_NONE;
|
||||
marathonmode = 0;
|
||||
|
||||
// empty maptol so mario/etc sounds don't play in sound test when they shouldn't
|
||||
maptol = 0;
|
||||
|
@ -882,6 +961,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.
|
||||
// ==========================================================================
|
||||
|
@ -963,6 +1076,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
|
||||
|
@ -1041,7 +1155,7 @@ void D_SRB2Main(void)
|
|||
// Print GPL notice for our console users (Linux)
|
||||
CONS_Printf(
|
||||
"\n\nSonic Robo Blast 2\n"
|
||||
"Copyright (C) 1998-2019 by Sonic Team Junior\n\n"
|
||||
"Copyright (C) 1998-2020 by Sonic Team Junior\n\n"
|
||||
"This program comes with ABSOLUTELY NO WARRANTY.\n\n"
|
||||
"This is free software, and you are welcome to redistribute it\n"
|
||||
"and/or modify it under the terms of the GNU General Public License\n"
|
||||
|
@ -1070,6 +1184,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();
|
||||
|
||||
|
@ -1097,6 +1214,7 @@ void D_SRB2Main(void)
|
|||
|
||||
// default savegame
|
||||
strcpy(savegamename, SAVEGAMENAME"%u.ssg");
|
||||
strcpy(liveeventbackup, "live"SAVEGAMENAME".bkp"); // intentionally not ending with .ssg
|
||||
|
||||
{
|
||||
const char *userhome = D_Home(); //Alam: path to home
|
||||
|
@ -1125,8 +1243,10 @@ void D_SRB2Main(void)
|
|||
|
||||
// can't use sprintf since there is %u in savegamename
|
||||
strcatbf(savegamename, srb2home, PATHSEP);
|
||||
strcatbf(liveeventbackup, 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)
|
||||
|
@ -1136,7 +1256,10 @@ void D_SRB2Main(void)
|
|||
|
||||
// can't use sprintf since there is %u in savegamename
|
||||
strcatbf(savegamename, userhome, PATHSEP);
|
||||
#endif
|
||||
strcatbf(liveeventbackup, userhome, PATHSEP);
|
||||
|
||||
snprintf(luafiledir, sizeof luafiledir, "%s" PATHSEP "luafiles", userhome);
|
||||
#endif // DEFAULTDIR
|
||||
}
|
||||
|
||||
configfile[sizeof configfile - 1] = '\0';
|
||||
|
@ -1148,13 +1271,26 @@ void D_SRB2Main(void)
|
|||
|
||||
// rand() needs seeded regardless of password
|
||||
srand((unsigned int)time(NULL));
|
||||
rand();
|
||||
rand();
|
||||
rand();
|
||||
|
||||
if (M_CheckParm("-password") && M_IsNextParm())
|
||||
D_SetPassword(M_GetNextParm());
|
||||
|
||||
// player setup menu colors must be initialized before
|
||||
// any wad file is added, as they may contain colors themselves
|
||||
M_InitPlayerSetupColors();
|
||||
|
||||
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"))
|
||||
{
|
||||
|
@ -1179,9 +1315,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();
|
||||
|
||||
|
@ -1189,7 +1322,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
|
||||
|
@ -1215,14 +1348,14 @@ void D_SRB2Main(void)
|
|||
W_InitMultipleFiles(startupwadfiles, mainwads);
|
||||
D_CleanFile();
|
||||
|
||||
#ifndef DEVELOP // md5s last updated 16/02/20 (ddmmyy)
|
||||
#ifndef DEVELOP // md5s last updated 22/02/20 (ddmmyy)
|
||||
|
||||
// Check MD5s of autoloaded files
|
||||
W_VerifyFileMD5(0, ASSET_HASH_SRB2_PK3); // srb2.pk3
|
||||
W_VerifyFileMD5(1, ASSET_HASH_ZONES_PK3); // zones.pk3
|
||||
W_VerifyFileMD5(2, ASSET_HASH_PLAYER_DTA); // player.dta
|
||||
#ifdef USE_PATCH_DTA
|
||||
W_VerifyFileMD5(3, ASSET_HASH_PATCH_DTA); // patch.pk3
|
||||
W_VerifyFileMD5(3, ASSET_HASH_PATCH_PK3); // patch.pk3
|
||||
#endif
|
||||
// don't check music.dta because people like to modify it, and it doesn't matter if they do
|
||||
// ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for.
|
||||
|
@ -1230,20 +1363,6 @@ void D_SRB2Main(void)
|
|||
|
||||
mainwadstally = packetsizetally; // technically not accurate atm, remember to port the two-stage -file process from kart in 2.2.x
|
||||
|
||||
if (M_CheckParm("-warp") && M_IsNextParm())
|
||||
{
|
||||
const char *word = M_GetNextParm();
|
||||
pstartmap = G_FindMapByNameOrCode(word, 0);
|
||||
if (! pstartmap)
|
||||
I_Error("Cannot find a map remotely named '%s'\n", word);
|
||||
else
|
||||
{
|
||||
if (!M_CheckParm("-server"))
|
||||
G_SetGameModified(true);
|
||||
autostart = true;
|
||||
}
|
||||
}
|
||||
|
||||
cht_Init();
|
||||
|
||||
//---------------------------------------------------- READY SCREEN
|
||||
|
@ -1267,7 +1386,6 @@ void D_SRB2Main(void)
|
|||
CONS_Printf("HU_Init(): Setting up heads up display.\n");
|
||||
HU_Init();
|
||||
|
||||
COM_Init();
|
||||
CON_Init();
|
||||
|
||||
D_RegisterServerCommands();
|
||||
|
@ -1292,13 +1410,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;
|
||||
|
@ -1307,6 +1431,23 @@ void D_SRB2Main(void)
|
|||
|
||||
//------------------------------------------------ COMMAND LINE PARAMS
|
||||
|
||||
// this must be done after loading gamedata,
|
||||
// to avoid setting off the corrupted gamedata code in G_LoadGameData if a SOC with custom gamedata is added
|
||||
// -- Monster Iestyn 20/02/20
|
||||
if (M_CheckParm("-warp") && M_IsNextParm())
|
||||
{
|
||||
const char *word = M_GetNextParm();
|
||||
pstartmap = G_FindMapByNameOrCode(word, 0);
|
||||
if (! pstartmap)
|
||||
I_Error("Cannot find a map remotely named '%s'\n", word);
|
||||
else
|
||||
{
|
||||
if (!M_CheckParm("-server"))
|
||||
G_SetGameModified(true);
|
||||
autostart = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize CD-Audio
|
||||
if (M_CheckParm("-usecd") && !dedicated)
|
||||
I_InitCD();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
|
18
src/d_net.c
18
src/d_net.c
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -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,12 +801,20 @@ static const char *packettypename[NUMPACKETTYPE] =
|
|||
"RESYNCHEND",
|
||||
"RESYNCHGET",
|
||||
|
||||
"SENDINGLUAFILE",
|
||||
"ASKLUAFILE",
|
||||
"HASLUAFILE",
|
||||
|
||||
"FILEFRAGMENT",
|
||||
"FILEACK",
|
||||
"FILERECEIVED",
|
||||
|
||||
"TEXTCMD",
|
||||
"TEXTCMD2",
|
||||
"CLIENTJOIN",
|
||||
"NODETIMEOUT",
|
||||
"RESYNCHING",
|
||||
"LOGIN",
|
||||
"PING"
|
||||
};
|
||||
|
||||
|
@ -831,7 +841,7 @@ static void DebugPrintpacket(const char *header)
|
|||
size_t ntxtcmd = &((UINT8 *)netbuffer)[doomcom->datalength] - cmd;
|
||||
|
||||
fprintf(debugfile, " firsttic %u ply %d tics %d ntxtcmd %s\n ",
|
||||
(UINT32)ExpandTics(serverpak->starttic), serverpak->numslots, serverpak->numtics, sizeu1(ntxtcmd));
|
||||
(UINT32)serverpak->starttic, serverpak->numslots, serverpak->numtics, sizeu1(ntxtcmd));
|
||||
/// \todo Display more readable information about net commands
|
||||
fprintfstringnewline((char *)cmd, ntxtcmd);
|
||||
/*fprintfstring((char *)cmd, 3);
|
||||
|
@ -850,8 +860,8 @@ static void DebugPrintpacket(const char *header)
|
|||
case PT_NODEKEEPALIVE:
|
||||
case PT_NODEKEEPALIVEMIS:
|
||||
fprintf(debugfile, " tic %4u resendfrom %u\n",
|
||||
(UINT32)ExpandTics(netbuffer->u.clientpak.client_tic),
|
||||
(UINT32)ExpandTics (netbuffer->u.clientpak.resendfrom));
|
||||
(UINT32)ExpandTics(netbuffer->u.clientpak.client_tic, doomcom->remotenode),
|
||||
(UINT32)ExpandTics (netbuffer->u.clientpak.resendfrom, doomcom->remotenode));
|
||||
break;
|
||||
case PT_TEXTCMD:
|
||||
case PT_TEXTCMD2:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
|
176
src/d_netcmd.c
176
src/d_netcmd.c
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -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
|
||||
|
@ -227,6 +225,7 @@ consvar_t cv_allowseenames = {"allowseenames", "Yes", CV_NETVAR, CV_YesNo, NULL,
|
|||
consvar_t cv_playername = {"name", "Sonic", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_playername2 = {"name2", "Tails", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
// player colors
|
||||
UINT16 lastgoodcolor = SKINCOLOR_BLUE, lastgoodcolor2 = SKINCOLOR_BLUE;
|
||||
consvar_t cv_playercolor = {"color", "Blue", CV_CALL|CV_NOINIT, Color_cons_t, Color_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_playercolor2 = {"color2", "Orange", CV_CALL|CV_NOINIT, Color_cons_t, Color2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
// player's skin, saved for commodity, when using a favorite skins wad..
|
||||
|
@ -415,10 +414,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 +449,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,10 +499,10 @@ 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
|
||||
|
||||
COM_AddCommand("downloads", Command_Downloads_f);
|
||||
|
||||
// for master server connection
|
||||
AddMServCommands();
|
||||
|
@ -579,6 +576,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);
|
||||
|
@ -624,7 +622,7 @@ void D_RegisterClientCommands(void)
|
|||
for (i = 0; i < MAXSKINCOLORS; i++)
|
||||
{
|
||||
Color_cons_t[i].value = i;
|
||||
Color_cons_t[i].strvalue = Color_Names[i];
|
||||
Color_cons_t[i].strvalue = skincolors[i].name;
|
||||
}
|
||||
Color_cons_t[MAXSKINCOLORS].value = 0;
|
||||
Color_cons_t[MAXSKINCOLORS].strvalue = NULL;
|
||||
|
@ -913,7 +911,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
|
||||
}
|
||||
|
@ -1158,7 +1156,7 @@ UINT8 CanChangeSkin(INT32 playernum)
|
|||
// Server has skin change restrictions.
|
||||
if (cv_restrictskinchange.value)
|
||||
{
|
||||
if (gametype == GT_COOP)
|
||||
if (gametyperules & GTR_FRIENDLY)
|
||||
return true;
|
||||
|
||||
// Can change skin during initial countdown.
|
||||
|
@ -1226,15 +1224,20 @@ static void SendNameAndColor(void)
|
|||
CV_StealthSetValue(&cv_playercolor, skincolor_blueteam);
|
||||
}
|
||||
|
||||
// never allow the color "none"
|
||||
if (!cv_playercolor.value)
|
||||
// don't allow inaccessible colors
|
||||
if (!skincolors[cv_playercolor.value].accessible)
|
||||
{
|
||||
if (players[consoleplayer].skincolor)
|
||||
if (players[consoleplayer].skincolor && skincolors[players[consoleplayer].skincolor].accessible)
|
||||
CV_StealthSetValue(&cv_playercolor, players[consoleplayer].skincolor);
|
||||
else if (skins[players[consoleplayer].skin].prefcolor)
|
||||
CV_StealthSetValue(&cv_playercolor, skins[players[consoleplayer].skin].prefcolor);
|
||||
else
|
||||
else if (skincolors[atoi(cv_playercolor.defaultvalue)].accessible)
|
||||
CV_StealthSet(&cv_playercolor, cv_playercolor.defaultvalue);
|
||||
else if (skins[players[consoleplayer].skin].prefcolor && skincolors[skins[players[consoleplayer].skin].prefcolor].accessible)
|
||||
CV_StealthSetValue(&cv_playercolor, skins[players[consoleplayer].skin].prefcolor);
|
||||
else {
|
||||
UINT16 i = 0;
|
||||
while (i<numskincolors && !skincolors[i].accessible) i++;
|
||||
CV_StealthSetValue(&cv_playercolor, (i != numskincolors) ? i : SKINCOLOR_BLUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcmp(cv_playername.string, player_names[consoleplayer])
|
||||
|
@ -1258,7 +1261,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)
|
||||
|
@ -1281,10 +1284,10 @@ static void SendNameAndColor(void)
|
|||
{
|
||||
CV_StealthSetValue(&cv_playercolor, skins[cv_skin.value].prefcolor);
|
||||
|
||||
players[consoleplayer].skincolor = cv_playercolor.value % MAXSKINCOLORS;
|
||||
players[consoleplayer].skincolor = cv_playercolor.value % numskincolors;
|
||||
|
||||
if (players[consoleplayer].mo)
|
||||
players[consoleplayer].mo->color = (UINT8)players[consoleplayer].skincolor;
|
||||
players[consoleplayer].mo->color = (UINT16)players[consoleplayer].skincolor;
|
||||
}*/
|
||||
}
|
||||
else
|
||||
|
@ -1322,7 +1325,7 @@ static void SendNameAndColor(void)
|
|||
// Finally write out the complete packet and send it off.
|
||||
WRITESTRINGN(p, cv_playername.zstring, MAXPLAYERNAME);
|
||||
WRITEUINT32(p, (UINT32)players[consoleplayer].availabilities);
|
||||
WRITEUINT8(p, (UINT8)cv_playercolor.value);
|
||||
WRITEUINT16(p, (UINT16)cv_playercolor.value);
|
||||
WRITEUINT8(p, (UINT8)cv_skin.value);
|
||||
SendNetXCmd(XD_NAMEANDCOLOR, buf, p - buf);
|
||||
}
|
||||
|
@ -1349,15 +1352,20 @@ static void SendNameAndColor2(void)
|
|||
CV_StealthSetValue(&cv_playercolor2, skincolor_blueteam);
|
||||
}
|
||||
|
||||
// never allow the color "none"
|
||||
if (!cv_playercolor2.value)
|
||||
// don't allow inaccessible colors
|
||||
if (!skincolors[cv_playercolor2.value].accessible)
|
||||
{
|
||||
if (players[secondplaya].skincolor)
|
||||
if (players[secondplaya].skincolor && skincolors[players[secondplaya].skincolor].accessible)
|
||||
CV_StealthSetValue(&cv_playercolor2, players[secondplaya].skincolor);
|
||||
else if (skins[players[secondplaya].skin].prefcolor)
|
||||
else if (skincolors[atoi(cv_playercolor2.defaultvalue)].accessible)
|
||||
CV_StealthSet(&cv_playercolor, cv_playercolor2.defaultvalue);
|
||||
else if (skins[players[secondplaya].skin].prefcolor && skincolors[skins[players[secondplaya].skin].prefcolor].accessible)
|
||||
CV_StealthSetValue(&cv_playercolor2, skins[players[secondplaya].skin].prefcolor);
|
||||
else
|
||||
CV_StealthSet(&cv_playercolor2, cv_playercolor2.defaultvalue);
|
||||
else {
|
||||
UINT16 i = 0;
|
||||
while (i<numskincolors && !skincolors[i].accessible) i++;
|
||||
CV_StealthSetValue(&cv_playercolor2, (i != numskincolors) ? i : SKINCOLOR_BLUE);
|
||||
}
|
||||
}
|
||||
|
||||
players[secondplaya].availabilities = R_GetSkinAvailabilities();
|
||||
|
@ -1370,8 +1378,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 +1393,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
|
||||
|
@ -1409,7 +1418,7 @@ static void SendNameAndColor2(void)
|
|||
{
|
||||
CV_StealthSetValue(&cv_playercolor2, skins[players[secondplaya].skin].prefcolor);
|
||||
|
||||
players[secondplaya].skincolor = cv_playercolor2.value % MAXSKINCOLORS;
|
||||
players[secondplaya].skincolor = cv_playercolor2.value % numskincolors;
|
||||
|
||||
if (players[secondplaya].mo)
|
||||
players[secondplaya].mo->color = players[secondplaya].skincolor;
|
||||
|
@ -1432,7 +1441,8 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
|||
{
|
||||
player_t *p = &players[playernum];
|
||||
char name[MAXPLAYERNAME+1];
|
||||
UINT8 color, skin;
|
||||
UINT16 color;
|
||||
UINT8 skin;
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (playernum < 0 || playernum > MAXPLAYERS)
|
||||
|
@ -1451,7 +1461,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
|||
|
||||
READSTRINGN(*cp, name, MAXPLAYERNAME);
|
||||
p->availabilities = READUINT32(*cp);
|
||||
color = READUINT8(*cp);
|
||||
color = READUINT16(*cp);
|
||||
skin = READUINT8(*cp);
|
||||
|
||||
// set name
|
||||
|
@ -1459,9 +1469,9 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
|||
SetPlayerName(playernum, name);
|
||||
|
||||
// set color
|
||||
p->skincolor = color % MAXSKINCOLORS;
|
||||
p->skincolor = color % numskincolors;
|
||||
if (p->mo)
|
||||
p->mo->color = (UINT8)p->skincolor;
|
||||
p->mo->color = (UINT16)p->skincolor;
|
||||
|
||||
// normal player colors
|
||||
if (server && (p != &players[consoleplayer] && p != &players[secondarydisplayplayer]))
|
||||
|
@ -1478,8 +1488,8 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
|||
kick = true;
|
||||
}
|
||||
|
||||
// don't allow color "none"
|
||||
if (!p->skincolor)
|
||||
// don't allow inaccessible colors
|
||||
if (skincolors[p->skincolor].accessible == false)
|
||||
kick = true;
|
||||
|
||||
// availabilities
|
||||
|
@ -1737,7 +1747,7 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pultmode, boolean rese
|
|||
}
|
||||
CONS_Debug(DBG_GAMELOGIC, "Map change: mapnum=%d gametype=%d ultmode=%d resetplayers=%d delay=%d skipprecutscene=%d\n",
|
||||
mapnum, newgametype, pultmode, resetplayers, delay, skipprecutscene);
|
||||
if ((netgame || multiplayer) && !((gametype == newgametype) && (newgametype == GT_COOP)))
|
||||
if ((netgame || multiplayer) && !((gametype == newgametype) && (gametypedefaultrules[newgametype] & GTR_CAMPAIGN)))
|
||||
FLS = false;
|
||||
|
||||
if (delay != 2)
|
||||
|
@ -1979,7 +1989,7 @@ static void Command_Map_f(void)
|
|||
fromlevelselect =
|
||||
( netgame || multiplayer ) &&
|
||||
newgametype == gametype &&
|
||||
newgametype == GT_COOP;
|
||||
gametypedefaultrules[newgametype] & GTR_CAMPAIGN;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2027,9 +2037,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 +2099,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 +2684,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)))
|
||||
|
@ -2775,7 +2779,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
|||
players[playernum].spectator = false;
|
||||
|
||||
//If joining after hidetime in normal tag, default to being IT.
|
||||
if (gametype == GT_TAG && (leveltime > (hidetime * TICRATE)))
|
||||
if (((gametyperules & (GTR_TAG|GTR_HIDEFROZEN)) == GTR_TAG) && (leveltime > (hidetime * TICRATE)))
|
||||
{
|
||||
NetPacket.packet.newteam = 1; //minor hack, causes the "is it" message to be printed later.
|
||||
players[playernum].pflags |= PF_TAGIT; //make the player IT.
|
||||
|
@ -2839,12 +2843,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 +3344,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);
|
||||
|
@ -3572,6 +3570,8 @@ static void Command_Playintro_f(void)
|
|||
*/
|
||||
FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void)
|
||||
{
|
||||
if (Playing())
|
||||
LUAh_GameQuit();
|
||||
I_Quit();
|
||||
}
|
||||
|
||||
|
@ -3629,7 +3629,7 @@ static void PointLimit_OnChange(void)
|
|||
static void NumLaps_OnChange(void)
|
||||
{
|
||||
// Just don't be verbose
|
||||
if (gametype == GT_RACE)
|
||||
if ((gametyperules & (GTR_RACE|GTR_LIVES)) == GTR_RACE)
|
||||
CONS_Printf(M_GetText("Number of laps set to %d\n"), cv_numlaps.value);
|
||||
}
|
||||
|
||||
|
@ -3743,7 +3743,7 @@ static void ExitMove_OnChange(void)
|
|||
{
|
||||
UINT8 i;
|
||||
|
||||
if (!(netgame || multiplayer) || gametype != GT_COOP)
|
||||
if (!(netgame || multiplayer) || !(gametyperules & GTR_FRIENDLY))
|
||||
return;
|
||||
|
||||
if (cv_exitmove.value)
|
||||
|
@ -4233,6 +4233,9 @@ void Command_ExitGame_f(void)
|
|||
{
|
||||
INT32 i;
|
||||
|
||||
if (Playing())
|
||||
LUAh_GameQuit();
|
||||
|
||||
D_QuitNetGame();
|
||||
CL_Reset();
|
||||
CV_ClearChangedFlags();
|
||||
|
@ -4334,7 +4337,6 @@ static void Command_Togglemodified_f(void)
|
|||
modifiedgame = !modifiedgame;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
extern UINT8 *save_p;
|
||||
static void Command_Archivetest_f(void)
|
||||
{
|
||||
|
@ -4379,7 +4381,6 @@ static void Command_Archivetest_f(void)
|
|||
CONS_Printf("Done. No crash.\n");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Makes a change to ::cv_forceskin take effect immediately.
|
||||
*
|
||||
|
@ -4491,25 +4492,30 @@ static void Skin2_OnChange(void)
|
|||
*/
|
||||
static void Color_OnChange(void)
|
||||
{
|
||||
if (!Playing())
|
||||
return; // do whatever you want
|
||||
|
||||
if (!(cv_debug || devparm) && !(multiplayer || netgame)) // In single player.
|
||||
{
|
||||
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!P_PlayerMoving(consoleplayer))
|
||||
{
|
||||
// Color change menu scrolling fix is no longer necessary
|
||||
SendNameAndColor();
|
||||
if (!Playing()) {
|
||||
if (!cv_playercolor.value || !skincolors[cv_playercolor.value].accessible)
|
||||
CV_StealthSetValue(&cv_playercolor, lastgoodcolor);
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_StealthSetValue(&cv_playercolor,
|
||||
players[consoleplayer].skincolor);
|
||||
if (!(cv_debug || devparm) && !(multiplayer || netgame)) // In single player.
|
||||
{
|
||||
CV_StealthSet(&cv_skin, skins[players[consoleplayer].skin].name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!P_PlayerMoving(consoleplayer) && skincolors[players[consoleplayer].skincolor].accessible == true)
|
||||
{
|
||||
// Color change menu scrolling fix is no longer necessary
|
||||
SendNameAndColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_StealthSetValue(&cv_playercolor,
|
||||
players[consoleplayer].skincolor);
|
||||
}
|
||||
}
|
||||
lastgoodcolor = cv_playercolor.value;
|
||||
}
|
||||
|
||||
/** Sends a color change for the secondary splitscreen player, unless that
|
||||
|
@ -4520,18 +4526,24 @@ static void Color_OnChange(void)
|
|||
static void Color2_OnChange(void)
|
||||
{
|
||||
if (!Playing() || !splitscreen)
|
||||
return; // do whatever you want
|
||||
|
||||
if (!P_PlayerMoving(secondarydisplayplayer))
|
||||
{
|
||||
// Color change menu scrolling fix is no longer necessary
|
||||
SendNameAndColor2();
|
||||
if (!cv_playercolor2.value || !skincolors[cv_playercolor2.value].accessible)
|
||||
CV_StealthSetValue(&cv_playercolor2, lastgoodcolor2);
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_StealthSetValue(&cv_playercolor2,
|
||||
players[secondarydisplayplayer].skincolor);
|
||||
if (!P_PlayerMoving(secondarydisplayplayer) && skincolors[players[secondarydisplayplayer].skincolor].accessible == true)
|
||||
{
|
||||
// Color change menu scrolling fix is no longer necessary
|
||||
SendNameAndColor2();
|
||||
}
|
||||
else
|
||||
{
|
||||
CV_StealthSetValue(&cv_playercolor2,
|
||||
players[secondarydisplayplayer].skincolor);
|
||||
}
|
||||
}
|
||||
lastgoodcolor2 = cv_playercolor2.value;
|
||||
}
|
||||
|
||||
/** Displays the result of the chat being muted or unmuted.
|
||||
|
@ -4608,7 +4620,7 @@ static void Command_ShowTime_f(void)
|
|||
|
||||
static void BaseNumLaps_OnChange(void)
|
||||
{
|
||||
if (gametype == GT_RACE)
|
||||
if ((gametyperules & (GTR_RACE|GTR_LIVES)) == GTR_RACE)
|
||||
{
|
||||
if (cv_basenumlaps.value)
|
||||
CONS_Printf(M_GetText("Number of laps will be changed to map defaults next round.\n"));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -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;
|
||||
|
||||
|
|
765
src/d_netfil.c
765
src/d_netfil.c
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -56,7 +56,7 @@
|
|||
#include <errno.h>
|
||||
|
||||
// Prototypes
|
||||
static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid);
|
||||
static boolean AddFileToSendQueue(INT32 node, const char *filename, UINT8 fileid);
|
||||
|
||||
// Sender structure
|
||||
typedef struct filetx_s
|
||||
|
@ -76,8 +76,13 @@ typedef struct filetx_s
|
|||
typedef struct filetran_s
|
||||
{
|
||||
filetx_t *txlist; // Linked list of all files for the node
|
||||
UINT8 iteration;
|
||||
UINT8 ackediteration;
|
||||
UINT32 position; // The current position in the file
|
||||
boolean *ackedfragments;
|
||||
UINT32 ackedsize;
|
||||
FILE *currentfile; // The file currently being sent/received
|
||||
tic_t dontsenduntil;
|
||||
} filetran_t;
|
||||
static filetran_t transfer[MAXNETNODES];
|
||||
|
||||
|
@ -87,13 +92,31 @@ static filetran_t transfer[MAXNETNODES];
|
|||
// Receiver structure
|
||||
INT32 fileneedednum; // Number of files needed to join the server
|
||||
fileneeded_t fileneeded[MAX_WADFILES]; // List of needed files
|
||||
static tic_t lasttimeackpacketsent = 0;
|
||||
char downloaddir[512] = "DOWNLOAD";
|
||||
|
||||
#ifdef CLIENT_LOADINGSCREEN
|
||||
// For resuming failed downloads
|
||||
typedef struct
|
||||
{
|
||||
char filename[MAX_WADPATH];
|
||||
UINT8 md5sum[16];
|
||||
boolean *receivedfragments;
|
||||
UINT32 fragmentsize;
|
||||
UINT32 currentsize;
|
||||
} pauseddownload_t;
|
||||
static pauseddownload_t *pauseddownload = NULL;
|
||||
|
||||
#ifndef NONET
|
||||
// for cl loading screen
|
||||
INT32 lastfilenum = -1;
|
||||
#endif
|
||||
|
||||
luafiletransfer_t *luafiletransfers = NULL;
|
||||
boolean waitingforluafiletransfer = false;
|
||||
boolean waitingforluafilecommand = 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.
|
||||
|
@ -153,6 +176,7 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr)
|
|||
for (i = 0; i < fileneedednum; i++)
|
||||
{
|
||||
fileneeded[i].status = FS_NOTFOUND; // We haven't even started looking for the file yet
|
||||
fileneeded[i].justdownloaded = false;
|
||||
filestatus = READUINT8(p); // The first byte is the file status
|
||||
fileneeded[i].willsend = (UINT8)(filestatus >> 4);
|
||||
fileneeded[i].totalsize = READUINT32(p); // The four next bytes are the file size
|
||||
|
@ -164,8 +188,13 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr)
|
|||
|
||||
void CL_PrepareDownloadSaveGame(const char *tmpsave)
|
||||
{
|
||||
#ifndef NONET
|
||||
lastfilenum = -1;
|
||||
#endif
|
||||
|
||||
fileneedednum = 1;
|
||||
fileneeded[0].status = FS_REQUESTED;
|
||||
fileneeded[0].justdownloaded = false;
|
||||
fileneeded[0].totalsize = UINT32_MAX;
|
||||
fileneeded[0].file = NULL;
|
||||
memset(fileneeded[0].md5sum, 0, 16);
|
||||
|
@ -238,6 +267,31 @@ boolean CL_CheckDownloadable(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
/** Returns true if a needed file transfer can be resumed
|
||||
*
|
||||
* \param file The needed file to resume the transfer for
|
||||
* \return True if the transfer can be resumed
|
||||
*
|
||||
*/
|
||||
static boolean CL_CanResumeDownload(fileneeded_t *file)
|
||||
{
|
||||
return pauseddownload
|
||||
&& !strcmp(pauseddownload->filename, file->filename) // Same name
|
||||
&& !memcmp(pauseddownload->md5sum, file->md5sum, 16) // Same checksum
|
||||
&& pauseddownload->fragmentsize == file->fragmentsize; // Same fragment size
|
||||
}
|
||||
|
||||
void CL_AbortDownloadResume(void)
|
||||
{
|
||||
if (!pauseddownload)
|
||||
return;
|
||||
|
||||
free(pauseddownload->receivedfragments);
|
||||
remove(pauseddownload->filename);
|
||||
free(pauseddownload);
|
||||
pauseddownload = NULL;
|
||||
}
|
||||
|
||||
/** Sends requests for files in the ::fileneeded table with a status of
|
||||
* ::FS_NOTFOUND.
|
||||
*
|
||||
|
@ -245,7 +299,7 @@ boolean CL_CheckDownloadable(void)
|
|||
* \note Sends a PT_REQUESTFILE packet
|
||||
*
|
||||
*/
|
||||
boolean CL_SendRequestFile(void)
|
||||
boolean CL_SendFileRequest(void)
|
||||
{
|
||||
char *p;
|
||||
INT32 i;
|
||||
|
@ -290,7 +344,7 @@ boolean CL_SendRequestFile(void)
|
|||
|
||||
// get request filepak and put it on the send queue
|
||||
// returns false if a requested file was not found or cannot be sent
|
||||
boolean Got_RequestFilePak(INT32 node)
|
||||
boolean PT_RequestFile(INT32 node)
|
||||
{
|
||||
char wad[MAX_WADPATH+1];
|
||||
UINT8 *p = netbuffer->u.textcmd;
|
||||
|
@ -301,7 +355,7 @@ boolean Got_RequestFilePak(INT32 node)
|
|||
if (id == 0xFF)
|
||||
break;
|
||||
READSTRINGN(p, wad, MAX_WADPATH);
|
||||
if (!SV_SendFile(node, wad, id))
|
||||
if (!AddFileToSendQueue(node, wad, id))
|
||||
{
|
||||
SV_AbortSendFiles(node);
|
||||
return false; // don't read the rest of the files
|
||||
|
@ -448,6 +502,196 @@ 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;
|
||||
|
||||
// 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));
|
||||
|
||||
// Only if there is no transfer already going on
|
||||
if (server && filetransfer == luafiletransfers)
|
||||
SV_PrepareSendLuaFile();
|
||||
else
|
||||
filetransfer->ongoing = false;
|
||||
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
||||
static 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_PrepareSendLuaFile(void)
|
||||
{
|
||||
char *binfilename;
|
||||
INT32 i;
|
||||
|
||||
luafiletransfers->ongoing = true;
|
||||
|
||||
// Set status to "waiting" for everyone
|
||||
for (i = 0; i < MAXNETNODES; i++)
|
||||
luafiletransfers->nodestatus[i] = LFTNS_WAITING;
|
||||
|
||||
if (FIL_ReadFileOK(luafiletransfers->realfilename))
|
||||
{
|
||||
// If opening in text mode, convert all newlines to LF
|
||||
if (!strchr(luafiletransfers->mode, 'b'))
|
||||
{
|
||||
binfilename = strdup(va("%s" PATHSEP "$$$%d%d.tmp",
|
||||
luafiledir, rand(), rand()));
|
||||
if (!binfilename)
|
||||
I_Error("SV_PrepareSendLuaFile: Out of memory\n");
|
||||
|
||||
if (!FIL_ConvertTextFileToBinary(luafiletransfers->realfilename, binfilename))
|
||||
I_Error("SV_PrepareSendLuaFile: Failed to convert file newlines\n");
|
||||
|
||||
// Use the temporary file instead
|
||||
free(luafiletransfers->realfilename);
|
||||
luafiletransfers->realfilename = binfilename;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void SV_HandleLuaFileSent(UINT8 node)
|
||||
{
|
||||
luafiletransfers->nodestatus[node] = LFTNS_SENT;
|
||||
SV_PrepareSendLuaFileToNextNode();
|
||||
}
|
||||
|
||||
void RemoveLuaFileTransfer(void)
|
||||
{
|
||||
luafiletransfer_t *filetransfer = luafiletransfers;
|
||||
|
||||
// If it was a temporary file, delete it
|
||||
if (server && !strchr(filetransfer->mode, 'b'))
|
||||
remove(filetransfer->realfilename);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (luafiletransfers->ongoing)
|
||||
{
|
||||
waitingforluafilecommand = 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].justdownloaded = false;
|
||||
fileneeded[0].totalsize = UINT32_MAX;
|
||||
fileneeded[0].file = NULL;
|
||||
memset(fileneeded[0].md5sum, 0, 16);
|
||||
strcpy(fileneeded[0].filename, luafiletransfers->realfilename);
|
||||
|
||||
// Make sure all directories in the file path exist
|
||||
MakePathDirs(fileneeded[0].filename);
|
||||
|
||||
luafiletransfers->ongoing = true;
|
||||
}
|
||||
|
||||
// Number of files to send
|
||||
// Little optimization to quickly test if there is a file in the queue
|
||||
static INT32 filestosend = 0;
|
||||
|
@ -456,11 +700,12 @@ static INT32 filestosend = 0;
|
|||
*
|
||||
* \param node The node to send the file to
|
||||
* \param filename The file to send
|
||||
* \param fileid ???
|
||||
* \sa SV_SendRam
|
||||
* \param fileid The index of the file in the list of added files
|
||||
* \sa AddRamToSendQueue
|
||||
* \sa AddLuaFileToSendQueue
|
||||
*
|
||||
*/
|
||||
static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
|
||||
static boolean AddFileToSendQueue(INT32 node, const char *filename, UINT8 fileid)
|
||||
{
|
||||
filetx_t **q; // A pointer to the "next" field of the last file in the list
|
||||
filetx_t *p; // The new file request
|
||||
|
@ -478,7 +723,7 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
|
|||
// Allocate a file request and append it to the file list
|
||||
p = *q = (filetx_t *)malloc(sizeof (filetx_t));
|
||||
if (!p)
|
||||
I_Error("SV_SendFile: No more memory\n");
|
||||
I_Error("AddFileToSendQueue: No more memory\n");
|
||||
|
||||
// Initialise with zeros
|
||||
memset(p, 0, sizeof (filetx_t));
|
||||
|
@ -486,7 +731,7 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
|
|||
// Allocate the file name
|
||||
p->id.filename = (char *)malloc(MAX_WADPATH);
|
||||
if (!p->id.filename)
|
||||
I_Error("SV_SendFile: No more memory\n");
|
||||
I_Error("AddFileToSendQueue: No more memory\n");
|
||||
|
||||
// Set the file name and get rid of the path
|
||||
strlcpy(p->id.filename, filename, MAX_WADPATH);
|
||||
|
@ -546,11 +791,12 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
|
|||
* \param data The memory block to send
|
||||
* \param size The size of the block in bytes
|
||||
* \param freemethod How to free the block after it has been sent
|
||||
* \param fileid ???
|
||||
* \sa SV_SendFile
|
||||
* \param fileid The index of the file in the list of added files
|
||||
* \sa AddFileToSendQueue
|
||||
* \sa AddLuaFileToSendQueue
|
||||
*
|
||||
*/
|
||||
void SV_SendRam(INT32 node, void *data, size_t size, freemethod_t freemethod, UINT8 fileid)
|
||||
void AddRamToSendQueue(INT32 node, void *data, size_t size, freemethod_t freemethod, UINT8 fileid)
|
||||
{
|
||||
filetx_t **q; // A pointer to the "next" field of the last file in the list
|
||||
filetx_t *p; // The new file request
|
||||
|
@ -563,7 +809,7 @@ void SV_SendRam(INT32 node, void *data, size_t size, freemethod_t freemethod, UI
|
|||
// Allocate a file request and append it to the file list
|
||||
p = *q = (filetx_t *)malloc(sizeof (filetx_t));
|
||||
if (!p)
|
||||
I_Error("SV_SendRam: No more memory\n");
|
||||
I_Error("AddRamToSendQueue: No more memory\n");
|
||||
|
||||
// Initialise with zeros
|
||||
memset(p, 0, sizeof (filetx_t));
|
||||
|
@ -579,6 +825,52 @@ 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 AddFileToSendQueue
|
||||
* \sa AddRamToSendQueue
|
||||
*
|
||||
*/
|
||||
boolean AddLuaFileToSendQueue(INT32 node, const char *filename)
|
||||
{
|
||||
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("AddLuaFileToSendQueue: 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("AddLuaFileToSendQueue: 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);
|
||||
|
||||
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
|
||||
*
|
||||
|
@ -589,7 +881,8 @@ static void SV_EndFileSend(INT32 node)
|
|||
{
|
||||
filetx_t *p = transfer[node].txlist;
|
||||
|
||||
// Free the file request according to the freemethod parameter used with SV_SendFile/Ram
|
||||
// Free the file request according to the freemethod
|
||||
// parameter used with AddFileToSendQueue/AddRamToSendQueue
|
||||
switch (p->ram)
|
||||
{
|
||||
case SF_FILE: // It's a file, close it and free its filename
|
||||
|
@ -614,43 +907,32 @@ static void SV_EndFileSend(INT32 node)
|
|||
|
||||
// Indicate that the transmission is over
|
||||
transfer[node].currentfile = NULL;
|
||||
if (transfer[node].ackedfragments)
|
||||
free(transfer[node].ackedfragments);
|
||||
transfer[node].ackedfragments = NULL;
|
||||
|
||||
filestosend--;
|
||||
}
|
||||
|
||||
#define PACKETPERTIC net_bandwidth/(TICRATE*software_MAXPACKETLENGTH)
|
||||
#define FILEFRAGMENTSIZE (software_MAXPACKETLENGTH - (FILETXHEADER + BASEPACKETSIZE))
|
||||
|
||||
/** Handles file transmission
|
||||
*
|
||||
* \todo Use an acknowledging method more adapted to file transmission
|
||||
* The current download speed suffers from lack of ack packets,
|
||||
* especially when the one downloading has high latency
|
||||
*
|
||||
*/
|
||||
void SV_FileSendTicker(void)
|
||||
void FileSendTicker(void)
|
||||
{
|
||||
static INT32 currentnode = 0;
|
||||
filetx_pak *p;
|
||||
size_t size;
|
||||
size_t fragmentsize;
|
||||
filetx_t *f;
|
||||
INT32 packetsent, ram, i, j;
|
||||
INT32 maxpacketsent;
|
||||
|
||||
if (!filestosend) // No file to send
|
||||
return;
|
||||
|
||||
if (cv_downloadspeed.value) // New (and experimental) behavior
|
||||
{
|
||||
if (cv_downloadspeed.value) // New behavior
|
||||
packetsent = cv_downloadspeed.value;
|
||||
// Don't send more packets than we have free acks
|
||||
#ifndef NONET
|
||||
maxpacketsent = Net_GetFreeAcks(false) - 5; // Let 5 extra acks just in case
|
||||
#else
|
||||
maxpacketsent = 1;
|
||||
#endif
|
||||
if (packetsent > maxpacketsent && maxpacketsent > 0) // Send at least one packet
|
||||
packetsent = maxpacketsent;
|
||||
}
|
||||
else // Old behavior
|
||||
{
|
||||
packetsent = PACKETPERTIC;
|
||||
|
@ -667,11 +949,12 @@ void SV_FileSendTicker(void)
|
|||
i = (i+1) % MAXNETNODES, j++)
|
||||
{
|
||||
if (transfer[i].txlist)
|
||||
goto found;
|
||||
break;
|
||||
}
|
||||
// no transfer to do
|
||||
I_Error("filestosend=%d but no file to send found\n", filestosend);
|
||||
found:
|
||||
if (j >= MAXNETNODES)
|
||||
I_Error("filestosend=%d but no file to send found\n", filestosend);
|
||||
|
||||
currentnode = (i+1) % MAXNETNODES;
|
||||
f = transfer[i].txlist;
|
||||
ram = f->ram;
|
||||
|
@ -705,48 +988,232 @@ void SV_FileSendTicker(void)
|
|||
}
|
||||
else // Sending RAM
|
||||
transfer[i].currentfile = (FILE *)1; // Set currentfile to a non-null value to indicate that it is open
|
||||
|
||||
transfer[i].iteration = 1;
|
||||
transfer[i].ackediteration = 0;
|
||||
transfer[i].position = 0;
|
||||
transfer[i].ackedsize = 0;
|
||||
|
||||
transfer[i].ackedfragments = calloc(f->size / FILEFRAGMENTSIZE + 1, sizeof(*transfer[i].ackedfragments));
|
||||
if (!transfer[i].ackedfragments)
|
||||
I_Error("FileSendTicker: No more memory\n");
|
||||
|
||||
transfer[i].dontsenduntil = 0;
|
||||
}
|
||||
|
||||
// If the client hasn't acknowledged any fragment from the previous iteration,
|
||||
// it is most likely because their acks haven't had enough time to reach the server
|
||||
// yet, due to latency. In that case, we wait a little to avoid useless resend.
|
||||
if (I_GetTime() < transfer[i].dontsenduntil)
|
||||
continue;
|
||||
|
||||
// Find the first non-acknowledged fragment
|
||||
while (transfer[i].ackedfragments[transfer[i].position / FILEFRAGMENTSIZE])
|
||||
{
|
||||
transfer[i].position += FILEFRAGMENTSIZE;
|
||||
if (transfer[i].position >= f->size)
|
||||
{
|
||||
if (transfer[i].ackediteration < transfer[i].iteration)
|
||||
transfer[i].dontsenduntil = I_GetTime() + TICRATE / 2;
|
||||
|
||||
transfer[i].position = 0;
|
||||
transfer[i].iteration++;
|
||||
}
|
||||
}
|
||||
|
||||
// Build a packet containing a file fragment
|
||||
p = &netbuffer->u.filetxpak;
|
||||
size = software_MAXPACKETLENGTH - (FILETXHEADER + BASEPACKETSIZE);
|
||||
if (f->size-transfer[i].position < size)
|
||||
size = f->size-transfer[i].position;
|
||||
fragmentsize = FILEFRAGMENTSIZE;
|
||||
if (f->size-transfer[i].position < fragmentsize)
|
||||
fragmentsize = f->size-transfer[i].position;
|
||||
if (ram)
|
||||
M_Memcpy(p->data, &f->id.ram[transfer[i].position], size);
|
||||
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));
|
||||
M_Memcpy(p->data, &f->id.ram[transfer[i].position], fragmentsize);
|
||||
else
|
||||
{
|
||||
fseek(transfer[i].currentfile, transfer[i].position, SEEK_SET);
|
||||
|
||||
if (fread(p->data, 1, fragmentsize, transfer[i].currentfile) != fragmentsize)
|
||||
I_Error("FileSendTicker: can't read %s byte on %s at %d because %s", sizeu1(fragmentsize), f->id.filename, transfer[i].position, M_FileError(transfer[i].currentfile));
|
||||
}
|
||||
p->iteration = transfer[i].iteration;
|
||||
p->position = LONG(transfer[i].position);
|
||||
// Put flag so receiver knows the total size
|
||||
if (transfer[i].position + size == f->size)
|
||||
p->position |= LONG(0x80000000);
|
||||
p->fileid = f->fileid;
|
||||
p->size = SHORT((UINT16)size);
|
||||
p->filesize = LONG(f->size);
|
||||
p->size = SHORT((UINT16)FILEFRAGMENTSIZE);
|
||||
|
||||
// Send the packet
|
||||
if (HSendPacket(i, true, 0, FILETXHEADER + size)) // Reliable SEND
|
||||
if (HSendPacket(i, false, 0, FILETXHEADER + fragmentsize)) // Don't use the default acknowledgement system
|
||||
{ // Success
|
||||
transfer[i].position = (UINT32)(transfer[i].position + size);
|
||||
if (transfer[i].position == f->size) // Finish?
|
||||
SV_EndFileSend(i);
|
||||
transfer[i].position = (UINT32)(transfer[i].position + fragmentsize);
|
||||
if (transfer[i].position >= f->size)
|
||||
{
|
||||
if (transfer[i].ackediteration < transfer[i].iteration)
|
||||
transfer[i].dontsenduntil = I_GetTime() + TICRATE / 2;
|
||||
|
||||
transfer[i].position = 0;
|
||||
transfer[i].iteration++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Not sent for some odd reason, retry at next call
|
||||
if (!ram)
|
||||
fseek(transfer[i].currentfile,transfer[i].position, SEEK_SET);
|
||||
// Exit the while (can't send this one so why should i send the next?)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Got_Filetxpak(void)
|
||||
void PT_FileAck(void)
|
||||
{
|
||||
fileack_pak *packet = &netbuffer->u.fileack;
|
||||
INT32 node = doomcom->remotenode;
|
||||
filetran_t *trans = &transfer[node];
|
||||
INT32 i, j;
|
||||
|
||||
// Wrong file id? Ignore it, it's probably a late packet
|
||||
if (!(trans->txlist && packet->fileid == trans->txlist->fileid))
|
||||
return;
|
||||
|
||||
if (packet->numsegments * sizeof(*packet->segments) != doomcom->datalength - BASEPACKETSIZE - sizeof(*packet))
|
||||
{
|
||||
Net_CloseConnection(node);
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet->iteration > trans->ackediteration)
|
||||
{
|
||||
trans->ackediteration = packet->iteration;
|
||||
if (trans->ackediteration >= trans->iteration - 1)
|
||||
trans->dontsenduntil = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < packet->numsegments; i++)
|
||||
{
|
||||
fileacksegment_t *segment = &packet->segments[i];
|
||||
|
||||
for (j = 0; j < 32; j++)
|
||||
if (LONG(segment->acks) & (1 << j))
|
||||
{
|
||||
if (LONG(segment->start) * FILEFRAGMENTSIZE >= trans->txlist->size)
|
||||
{
|
||||
Net_CloseConnection(node);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!trans->ackedfragments[LONG(segment->start) + j])
|
||||
{
|
||||
trans->ackedfragments[LONG(segment->start) + j] = true;
|
||||
trans->ackedsize += FILEFRAGMENTSIZE;
|
||||
|
||||
// If the last missing fragment was acked, finish!
|
||||
if (trans->ackedsize == trans->txlist->size)
|
||||
{
|
||||
SV_EndFileSend(node);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PT_FileReceived(void)
|
||||
{
|
||||
filetx_t *trans = transfer[doomcom->remotenode].txlist;
|
||||
|
||||
if (trans && netbuffer->u.filereceived == trans->fileid)
|
||||
SV_EndFileSend(doomcom->remotenode);
|
||||
}
|
||||
|
||||
static void SendAckPacket(fileack_pak *packet, UINT8 fileid)
|
||||
{
|
||||
size_t packetsize;
|
||||
INT32 i;
|
||||
|
||||
packetsize = sizeof(*packet) + packet->numsegments * sizeof(*packet->segments);
|
||||
|
||||
// Finalise the packet
|
||||
packet->fileid = fileid;
|
||||
for (i = 0; i < packet->numsegments; i++)
|
||||
{
|
||||
packet->segments[i].start = LONG(packet->segments[i].start);
|
||||
packet->segments[i].acks = LONG(packet->segments[i].acks);
|
||||
}
|
||||
|
||||
// Send the packet
|
||||
netbuffer->packettype = PT_FILEACK;
|
||||
M_Memcpy(&netbuffer->u.fileack, packet, packetsize);
|
||||
HSendPacket(servernode, false, 0, packetsize);
|
||||
|
||||
// Clear the packet
|
||||
memset(packet, 0, sizeof(*packet) + 512);
|
||||
}
|
||||
|
||||
static void AddFragmentToAckPacket(fileack_pak *packet, UINT8 iteration, UINT32 fragmentpos, UINT8 fileid)
|
||||
{
|
||||
fileacksegment_t *segment = &packet->segments[packet->numsegments - 1];
|
||||
|
||||
packet->iteration = max(packet->iteration, iteration);
|
||||
|
||||
if (packet->numsegments == 0
|
||||
|| fragmentpos < segment->start
|
||||
|| fragmentpos - segment->start >= 32)
|
||||
{
|
||||
// If the packet becomes too big, send it
|
||||
if ((packet->numsegments + 1) * sizeof(*segment) > 512)
|
||||
SendAckPacket(packet, fileid);
|
||||
|
||||
packet->numsegments++;
|
||||
segment = &packet->segments[packet->numsegments - 1];
|
||||
segment->start = fragmentpos;
|
||||
}
|
||||
|
||||
// Set the bit that represents the fragment
|
||||
segment->acks |= 1 << (fragmentpos - segment->start);
|
||||
}
|
||||
|
||||
void FileReceiveTicker(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < fileneedednum; i++)
|
||||
{
|
||||
fileneeded_t *file = &fileneeded[i];
|
||||
|
||||
if (file->status == FS_DOWNLOADING)
|
||||
{
|
||||
if (lasttimeackpacketsent - I_GetTime() > TICRATE / 2)
|
||||
SendAckPacket(file->ackpacket, i);
|
||||
|
||||
// When resuming a tranfer, start with telling
|
||||
// the server what parts we already received
|
||||
if (file->ackresendposition != UINT32_MAX && file->status == FS_DOWNLOADING)
|
||||
{
|
||||
// Acknowledge ~70 MB/s, whichs means the client sends ~18 KB/s
|
||||
INT32 j;
|
||||
for (j = 0; j < 2048; j++)
|
||||
{
|
||||
if (file->receivedfragments[file->ackresendposition])
|
||||
AddFragmentToAckPacket(file->ackpacket, file->iteration, file->ackresendposition, i);
|
||||
|
||||
file->ackresendposition++;
|
||||
if (file->ackresendposition * file->fragmentsize >= file->totalsize)
|
||||
{
|
||||
file->ackresendposition = UINT32_MAX;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PT_FileFragment(void)
|
||||
{
|
||||
INT32 filenum = netbuffer->u.filetxpak.fileid;
|
||||
fileneeded_t *file = &fileneeded[filenum];
|
||||
UINT32 fragmentpos = LONG(netbuffer->u.filetxpak.position);
|
||||
UINT16 fragmentsize = SHORT(netbuffer->u.filetxpak.size);
|
||||
UINT16 boundedfragmentsize = doomcom->datalength - BASEPACKETSIZE - sizeof(netbuffer->u.filetxpak);
|
||||
char *filename;
|
||||
static INT32 filetime = 0;
|
||||
|
||||
filename = va("%s", file->filename);
|
||||
nameonly(filename);
|
||||
|
@ -771,43 +1238,105 @@ void Got_Filetxpak(void)
|
|||
if (file->status == FS_REQUESTED)
|
||||
{
|
||||
if (file->file)
|
||||
I_Error("Got_Filetxpak: already open file\n");
|
||||
file->file = fopen(filename, "wb");
|
||||
if (!file->file)
|
||||
I_Error("Can't create file %s: %s", filename, strerror(errno));
|
||||
CONS_Printf("\r%s...\n",filename);
|
||||
file->currentsize = 0;
|
||||
I_Error("PT_FileFragment: already open file\n");
|
||||
|
||||
file->status = FS_DOWNLOADING;
|
||||
file->fragmentsize = fragmentsize;
|
||||
file->iteration = 0;
|
||||
|
||||
file->ackpacket = calloc(1, sizeof(*file->ackpacket) + 512);
|
||||
if (!file->ackpacket)
|
||||
I_Error("FileSendTicker: No more memory\n");
|
||||
|
||||
if (CL_CanResumeDownload(file))
|
||||
{
|
||||
file->file = fopen(filename, "r+b");
|
||||
if (!file->file)
|
||||
I_Error("Can't reopen file %s: %s", filename, strerror(errno));
|
||||
CONS_Printf("\r%s...\n", filename);
|
||||
|
||||
CONS_Printf("Resuming download...\n");
|
||||
file->currentsize = pauseddownload->currentsize;
|
||||
file->receivedfragments = pauseddownload->receivedfragments;
|
||||
file->ackresendposition = 0;
|
||||
|
||||
free(pauseddownload);
|
||||
pauseddownload = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
CL_AbortDownloadResume();
|
||||
|
||||
file->file = fopen(filename, "wb");
|
||||
if (!file->file)
|
||||
I_Error("Can't create file %s: %s", filename, strerror(errno));
|
||||
|
||||
CONS_Printf("\r%s...\n",filename);
|
||||
|
||||
file->currentsize = 0;
|
||||
file->totalsize = LONG(netbuffer->u.filetxpak.filesize);
|
||||
file->ackresendposition = UINT32_MAX; // Only used for resumed downloads
|
||||
|
||||
file->receivedfragments = calloc(file->totalsize / fragmentsize + 1, sizeof(*file->receivedfragments));
|
||||
if (!file->receivedfragments)
|
||||
I_Error("FileSendTicker: No more memory\n");
|
||||
}
|
||||
|
||||
lasttimeackpacketsent = I_GetTime();
|
||||
}
|
||||
|
||||
if (file->status == FS_DOWNLOADING)
|
||||
{
|
||||
UINT32 pos = LONG(netbuffer->u.filetxpak.position);
|
||||
UINT16 size = SHORT(netbuffer->u.filetxpak.size);
|
||||
// Use a special trick to know when the file is complete (not always used)
|
||||
// WARNING: file fragments can arrive out of order so don't stop yet!
|
||||
if (pos & 0x80000000)
|
||||
{
|
||||
pos &= ~0x80000000;
|
||||
file->totalsize = pos + size;
|
||||
}
|
||||
// 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)
|
||||
I_Error("Can't write to %s: %s\n",filename, M_FileError(file->file));
|
||||
file->currentsize += size;
|
||||
if (fragmentpos >= file->totalsize)
|
||||
I_Error("Invalid file fragment\n");
|
||||
|
||||
// Finished?
|
||||
if (file->currentsize == file->totalsize)
|
||||
file->iteration = max(file->iteration, netbuffer->u.filetxpak.iteration);
|
||||
|
||||
if (!file->receivedfragments[fragmentpos / fragmentsize]) // Not received yet
|
||||
{
|
||||
fclose(file->file);
|
||||
file->file = NULL;
|
||||
file->status = FS_FOUND;
|
||||
CONS_Printf(M_GetText("Downloading %s...(done)\n"),
|
||||
filename);
|
||||
file->receivedfragments[fragmentpos / fragmentsize] = true;
|
||||
|
||||
// We can receive packets in the wrong order, anyway all OSes support gaped files
|
||||
fseek(file->file, fragmentpos, SEEK_SET);
|
||||
if (fragmentsize && fwrite(netbuffer->u.filetxpak.data, boundedfragmentsize, 1, file->file) != 1)
|
||||
I_Error("Can't write to %s: %s\n",filename, M_FileError(file->file));
|
||||
file->currentsize += boundedfragmentsize;
|
||||
|
||||
AddFragmentToAckPacket(file->ackpacket, file->iteration, fragmentpos / fragmentsize, filenum);
|
||||
|
||||
// Finished?
|
||||
if (file->currentsize == file->totalsize)
|
||||
{
|
||||
fclose(file->file);
|
||||
file->file = NULL;
|
||||
free(file->receivedfragments);
|
||||
free(file->ackpacket);
|
||||
file->status = FS_FOUND;
|
||||
file->justdownloaded = true;
|
||||
CONS_Printf(M_GetText("Downloading %s...(done)\n"),
|
||||
filename);
|
||||
|
||||
// Tell the server we have received the file
|
||||
netbuffer->packettype = PT_FILERECEIVED;
|
||||
netbuffer->u.filereceived = filenum;
|
||||
HSendPacket(servernode, true, 0, 1);
|
||||
|
||||
if (luafiletransfers)
|
||||
{
|
||||
// Tell the server we have received the file
|
||||
netbuffer->packettype = PT_HASLUAFILE;
|
||||
HSendPacket(servernode, true, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Already received
|
||||
{
|
||||
// If they are sending us the fragment again, it's probably because
|
||||
// they missed our previous ack, so we must re-acknowledge it
|
||||
AddFragmentToAckPacket(file->ackpacket, file->iteration, fragmentpos / fragmentsize, filenum);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (!file->justdownloaded)
|
||||
{
|
||||
const char *s;
|
||||
switch(file->status)
|
||||
|
@ -830,14 +1359,8 @@ void Got_Filetxpak(void)
|
|||
}
|
||||
I_Error("Received a file not requested (file id: %d, file status: %s)\n", filenum, s);
|
||||
}
|
||||
// Send ack back quickly
|
||||
if (++filetime == 3)
|
||||
{
|
||||
Net_SendAcks(servernode);
|
||||
filetime = 0;
|
||||
}
|
||||
|
||||
#ifdef CLIENT_LOADINGSCREEN
|
||||
#ifndef NONET
|
||||
lastfilenum = filenum;
|
||||
#endif
|
||||
}
|
||||
|
@ -848,7 +1371,7 @@ void Got_Filetxpak(void)
|
|||
* \return True if the node is downloading a file
|
||||
*
|
||||
*/
|
||||
boolean SV_SendingFile(INT32 node)
|
||||
boolean SendingFile(INT32 node)
|
||||
{
|
||||
return transfer[node].txlist != NULL;
|
||||
}
|
||||
|
@ -877,12 +1400,62 @@ void CloseNetFile(void)
|
|||
if (fileneeded[i].status == FS_DOWNLOADING && fileneeded[i].file)
|
||||
{
|
||||
fclose(fileneeded[i].file);
|
||||
// File is not complete delete it
|
||||
remove(fileneeded[i].filename);
|
||||
}
|
||||
free(fileneeded[i].ackpacket);
|
||||
|
||||
// Remove PT_FILEFRAGMENT from acknowledge list
|
||||
Net_AbortPacketType(PT_FILEFRAGMENT);
|
||||
if (!pauseddownload && i != 0) // 0 is either srb2.srb or the gamestate...
|
||||
{
|
||||
// Don't remove the file, save it for later in case we resume the download
|
||||
pauseddownload = malloc(sizeof(*pauseddownload));
|
||||
if (!pauseddownload)
|
||||
I_Error("CloseNetFile: No more memory\n");
|
||||
|
||||
strcpy(pauseddownload->filename, fileneeded[i].filename);
|
||||
memcpy(pauseddownload->md5sum, fileneeded[i].md5sum, 16);
|
||||
pauseddownload->currentsize = fileneeded[i].currentsize;
|
||||
pauseddownload->receivedfragments = fileneeded[i].receivedfragments;
|
||||
pauseddownload->fragmentsize = fileneeded[i].fragmentsize;
|
||||
}
|
||||
else
|
||||
{
|
||||
free(fileneeded[i].receivedfragments);
|
||||
// File is not complete delete it
|
||||
remove(fileneeded[i].filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Command_Downloads_f(void)
|
||||
{
|
||||
INT32 node;
|
||||
|
||||
for (node = 0; node < MAXNETNODES; node++)
|
||||
if (transfer[node].txlist
|
||||
&& transfer[node].txlist->ram == SF_FILE) // Node is downloading a file?
|
||||
{
|
||||
const char *name = transfer[node].txlist->id.filename;
|
||||
UINT32 position = transfer[node].ackedsize;
|
||||
UINT32 size = transfer[node].txlist->size;
|
||||
char ratecolor;
|
||||
|
||||
// Avoid division by zero errors
|
||||
if (!size)
|
||||
size = 1;
|
||||
|
||||
name = &name[strlen(name) - nameonlylength(name)];
|
||||
switch (4 * (position - 1) / size)
|
||||
{
|
||||
case 0: ratecolor = '\x85'; break;
|
||||
case 1: ratecolor = '\x87'; break;
|
||||
case 2: ratecolor = '\x82'; break;
|
||||
case 3: ratecolor = '\x83'; break;
|
||||
default: ratecolor = '\x80';
|
||||
}
|
||||
|
||||
CONS_Printf("%2d %c%s ", node, ratecolor, name); // Node and file name
|
||||
CONS_Printf("\x80%uK\x84/\x80%uK ", position / 1024, size / 1024); // Progress in kB
|
||||
CONS_Printf("\x80(%c%u%%\x80) ", ratecolor, (UINT32)(100.0 * position / size)); // Progress in %
|
||||
CONS_Printf("%s\n", I_GetNodeAddress(node)); // Address and newline
|
||||
}
|
||||
}
|
||||
|
||||
// Functions cut and pasted from Doomatic :)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -13,6 +13,8 @@
|
|||
#ifndef __D_NETFIL__
|
||||
#define __D_NETFIL__
|
||||
|
||||
#include "d_net.h"
|
||||
#include "d_clisrv.h"
|
||||
#include "w_wad.h"
|
||||
|
||||
typedef enum
|
||||
|
@ -38,18 +40,25 @@ typedef struct
|
|||
UINT8 willsend; // Is the server willing to send it?
|
||||
char filename[MAX_WADPATH];
|
||||
UINT8 md5sum[16];
|
||||
filestatus_t status; // The value returned by recsearch
|
||||
boolean justdownloaded; // To prevent late fragments from causing an I_Error
|
||||
|
||||
// Used only for download
|
||||
FILE *file;
|
||||
boolean *receivedfragments;
|
||||
UINT32 fragmentsize;
|
||||
UINT8 iteration;
|
||||
fileack_pak *ackpacket;
|
||||
UINT32 currentsize;
|
||||
UINT32 totalsize;
|
||||
filestatus_t status; // The value returned by recsearch
|
||||
UINT32 ackresendposition; // Used when resuming downloads
|
||||
} fileneeded_t;
|
||||
|
||||
extern INT32 fileneedednum;
|
||||
extern fileneeded_t fileneeded[MAX_WADFILES];
|
||||
extern char downloaddir[512];
|
||||
|
||||
#ifdef CLIENT_LOADINGSCREEN
|
||||
#ifndef NONET
|
||||
extern INT32 lastfilenum;
|
||||
#endif
|
||||
|
||||
|
@ -59,19 +68,63 @@ void CL_PrepareDownloadSaveGame(const char *tmpsave);
|
|||
|
||||
INT32 CL_CheckFiles(void);
|
||||
void CL_LoadServerFiles(void);
|
||||
void SV_SendRam(INT32 node, void *data, size_t size, freemethod_t freemethod,
|
||||
void AddRamToSendQueue(INT32 node, void *data, size_t size, freemethod_t freemethod,
|
||||
UINT8 fileid);
|
||||
|
||||
void SV_FileSendTicker(void);
|
||||
void Got_Filetxpak(void);
|
||||
boolean SV_SendingFile(INT32 node);
|
||||
void FileSendTicker(void);
|
||||
void PT_FileAck(void);
|
||||
void PT_FileReceived(void);
|
||||
boolean SendingFile(INT32 node);
|
||||
|
||||
void FileReceiveTicker(void);
|
||||
void PT_FileFragment(void);
|
||||
|
||||
boolean CL_CheckDownloadable(void);
|
||||
boolean CL_SendRequestFile(void);
|
||||
boolean Got_RequestFilePak(INT32 node);
|
||||
boolean CL_SendFileRequest(void);
|
||||
boolean PT_RequestFile(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
|
||||
boolean ongoing;
|
||||
luafiletransfernodestatus_t nodestatus[MAXNETNODES];
|
||||
struct luafiletransfer_s *next;
|
||||
} luafiletransfer_t;
|
||||
|
||||
extern luafiletransfer_t *luafiletransfers;
|
||||
extern boolean waitingforluafiletransfer;
|
||||
extern boolean waitingforluafilecommand;
|
||||
extern char luafiledir[256 + 16];
|
||||
|
||||
void AddLuaFileTransfer(const char *filename, const char *mode);
|
||||
void SV_PrepareSendLuaFile(void);
|
||||
boolean AddLuaFileToSendQueue(INT32 node, 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);
|
||||
void CL_AbortDownloadResume(void);
|
||||
|
||||
void Command_Downloads_f(void);
|
||||
|
||||
boolean fileexist(char *filename, time_t ptime);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -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;
|
||||
|
||||
|
@ -238,7 +239,8 @@ typedef enum
|
|||
CR_MACESPIN,
|
||||
CR_MINECART,
|
||||
CR_ROLLOUT,
|
||||
CR_PTERABYTE
|
||||
CR_PTERABYTE,
|
||||
CR_DUSTDEVIL
|
||||
} carrytype_t; // pw_carry
|
||||
|
||||
// Player powers. (don't edit this comment)
|
||||
|
@ -278,6 +280,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
|
||||
|
@ -327,6 +332,9 @@ typedef struct player_s
|
|||
|
||||
angle_t viewrollangle;
|
||||
|
||||
INT16 angleturn;
|
||||
INT16 oldrelangleturn;
|
||||
|
||||
// Mouse aiming, where the guy is looking at!
|
||||
// It is updated with cmd->aiming.
|
||||
angle_t aiming;
|
||||
|
@ -361,7 +369,7 @@ typedef struct player_s
|
|||
UINT16 flashpal;
|
||||
|
||||
// Player skin colorshift, 0-15 for which color to draw player.
|
||||
UINT8 skincolor;
|
||||
UINT16 skincolor;
|
||||
|
||||
INT32 skin;
|
||||
UINT32 availabilities;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
|
396
src/dehacked.c
396
src/dehacked.c
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -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"
|
||||
|
@ -57,10 +56,12 @@ int vsnprintf(char *str, size_t n, const char *fmt, va_list ap);
|
|||
// The crazy word-reading stuff uses these.
|
||||
static char *FREE_STATES[NUMSTATEFREESLOTS];
|
||||
static char *FREE_MOBJS[NUMMOBJFREESLOTS];
|
||||
static char *FREE_SKINCOLORS[NUMCOLORFREESLOTS];
|
||||
static UINT8 used_spr[(NUMSPRITEFREESLOTS / 8) + 1]; // Bitwise flag for sprite freeslot in use! I would use ceil() here if I could, but it only saves 1 byte of memory anyway.
|
||||
#define initfreeslots() {\
|
||||
memset(FREE_STATES,0,sizeof(char *) * NUMSTATEFREESLOTS);\
|
||||
memset(FREE_MOBJS,0,sizeof(char *) * NUMMOBJFREESLOTS);\
|
||||
memset(FREE_SKINCOLORS,0,sizeof(char *) * NUMCOLORFREESLOTS);\
|
||||
memset(used_spr,0,sizeof(UINT8) * ((NUMSPRITEFREESLOTS / 8) + 1));\
|
||||
}
|
||||
|
||||
|
@ -76,10 +77,9 @@ 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);
|
||||
skincolornum_t get_skincolor(const char *word);
|
||||
|
||||
boolean deh_loaded = false;
|
||||
static int dbg_line;
|
||||
|
@ -395,7 +395,7 @@ static void readPlayer(MYFILE *f, INT32 num)
|
|||
// It works down here, though.
|
||||
{
|
||||
INT32 numline = 0;
|
||||
for (i = 0; i < MAXLINELEN-1; i++)
|
||||
for (i = 0; (size_t)i < sizeof(description[num].notes)-1; i++)
|
||||
{
|
||||
if (numline < 20 && description[num].notes[i] == '\n')
|
||||
numline++;
|
||||
|
@ -452,7 +452,7 @@ static void readPlayer(MYFILE *f, INT32 num)
|
|||
else if (fastcmp(word, "OPPOSITECOLOR") || fastcmp(word, "OPPOSITECOLOUR"))
|
||||
{
|
||||
SLOTFOUND
|
||||
description[num].oppositecolor = (UINT8)get_number(word2);
|
||||
description[num].oppositecolor = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "NAMETAG") || fastcmp(word, "TAGNAME"))
|
||||
{
|
||||
|
@ -462,12 +462,12 @@ static void readPlayer(MYFILE *f, INT32 num)
|
|||
else if (fastcmp(word, "TAGTEXTCOLOR") || fastcmp(word, "TAGTEXTCOLOUR"))
|
||||
{
|
||||
SLOTFOUND
|
||||
description[num].tagtextcolor = (UINT8)get_number(word2);
|
||||
description[num].tagtextcolor = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "TAGOUTLINECOLOR") || fastcmp(word, "TAGOUTLINECOLOUR"))
|
||||
{
|
||||
SLOTFOUND
|
||||
description[num].tagoutlinecolor = (UINT8)get_number(word2);
|
||||
description[num].tagoutlinecolor = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "STATUS"))
|
||||
{
|
||||
|
@ -574,6 +574,16 @@ static void readfreeslots(MYFILE *f)
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if (fastcmp(type, "SKINCOLOR"))
|
||||
{
|
||||
for (i = 0; i < NUMCOLORFREESLOTS; i++)
|
||||
if (!FREE_SKINCOLORS[i]) {
|
||||
FREE_SKINCOLORS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
|
||||
strcpy(FREE_SKINCOLORS[i],word);
|
||||
M_AddMenuColor(numskincolors++);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (fastcmp(type, "SPR2"))
|
||||
{
|
||||
// Search if we already have an SPR2 by that name...
|
||||
|
@ -756,6 +766,84 @@ static void readthing(MYFILE *f, INT32 num)
|
|||
Z_Free(s);
|
||||
}
|
||||
|
||||
static void readskincolor(MYFILE *f, INT32 num)
|
||||
{
|
||||
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||
char *word = s;
|
||||
char *word2;
|
||||
char *tmp;
|
||||
|
||||
Color_cons_t[num].value = num;
|
||||
|
||||
do
|
||||
{
|
||||
if (myfgets(s, MAXLINELEN, f))
|
||||
{
|
||||
if (s[0] == '\n')
|
||||
break;
|
||||
|
||||
// First remove trailing newline, if there is one
|
||||
tmp = strchr(s, '\n');
|
||||
if (tmp)
|
||||
*tmp = '\0';
|
||||
|
||||
tmp = strchr(s, '#');
|
||||
if (tmp)
|
||||
*tmp = '\0';
|
||||
if (s == tmp)
|
||||
continue; // Skip comment lines, but don't break.
|
||||
|
||||
// Get the part before the " = "
|
||||
tmp = strchr(s, '=');
|
||||
if (tmp)
|
||||
*(tmp-1) = '\0';
|
||||
else
|
||||
break;
|
||||
strupr(word);
|
||||
|
||||
// Now get the part after
|
||||
word2 = tmp += 2;
|
||||
|
||||
if (fastcmp(word, "NAME"))
|
||||
{
|
||||
deh_strlcpy(skincolors[num].name, word2,
|
||||
sizeof (skincolors[num].name), va("Skincolor %d: name", num));
|
||||
}
|
||||
else if (fastcmp(word, "RAMP"))
|
||||
{
|
||||
UINT8 i;
|
||||
tmp = strtok(word2,",");
|
||||
for (i = 0; i < COLORRAMPSIZE; i++) {
|
||||
skincolors[num].ramp[i] = (UINT8)get_number(tmp);
|
||||
if ((tmp = strtok(NULL,",")) == NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (fastcmp(word, "INVCOLOR"))
|
||||
{
|
||||
skincolors[num].invcolor = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "INVSHADE"))
|
||||
{
|
||||
skincolors[num].invshade = get_number(word2)%COLORRAMPSIZE;
|
||||
}
|
||||
else if (fastcmp(word, "CHATCOLOR"))
|
||||
{
|
||||
skincolors[num].chatcolor = get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "ACCESSIBLE"))
|
||||
{
|
||||
if (num > FIRSTSUPERCOLOR)
|
||||
skincolors[num].accessible = (boolean)(atoi(word2) || word2[0] == 'T' || word2[0] == 'Y');
|
||||
}
|
||||
else
|
||||
deh_warning("Skincolor %d: unknown word '%s'", num, word);
|
||||
}
|
||||
} while (!myfeof(f)); // finish when the line is empty
|
||||
|
||||
Z_Free(s);
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
static void readlight(MYFILE *f, INT32 num)
|
||||
{
|
||||
|
@ -1177,7 +1265,7 @@ static void readgametype(MYFILE *f, char *gtname)
|
|||
// It works down here, though.
|
||||
{
|
||||
INT32 numline = 0;
|
||||
for (i = 0; i < MAXLINELEN-1; i++)
|
||||
for (i = 0; (size_t)i < sizeof(gtdescription)-1; i++)
|
||||
{
|
||||
if (numline < 20 && gtdescription[i] == '\n')
|
||||
numline++;
|
||||
|
@ -1249,7 +1337,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 +1503,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 +1536,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;
|
||||
}
|
||||
|
||||
|
@ -1564,7 +1648,7 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
}
|
||||
else if (fastcmp(word, "ACT"))
|
||||
{
|
||||
if (i >= 0 && i < 20) // 0 for no act number, TTL1 through TTL19
|
||||
if (i >= 0 && i <= 99) // 0 for no act number
|
||||
mapheaderinfo[num-1]->actnum = (UINT8)i;
|
||||
else
|
||||
deh_warning("Level header %d: invalid act number %d", num, i);
|
||||
|
@ -1585,13 +1669,29 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
|
||||
mapheaderinfo[num-1]->nextlevel = (INT16)i;
|
||||
}
|
||||
else if (fastcmp(word, "MARATHONNEXT"))
|
||||
{
|
||||
if (fastcmp(word2, "TITLE")) i = 1100;
|
||||
else if (fastcmp(word2, "EVALUATION")) i = 1101;
|
||||
else if (fastcmp(word2, "CREDITS")) i = 1102;
|
||||
else if (fastcmp(word2, "ENDING")) i = 1103;
|
||||
else
|
||||
// Support using the actual map name,
|
||||
// i.e., MarathonNext = AB, MarathonNext = FZ, etc.
|
||||
|
||||
// Convert to map number
|
||||
if (word2[0] >= 'A' && word2[0] <= 'Z' && word2[2] == '\0')
|
||||
i = M_MapNumber(word2[0], word2[1]);
|
||||
|
||||
mapheaderinfo[num-1]->marathonnext = (INT16)i;
|
||||
}
|
||||
else if (fastcmp(word, "TYPEOFLEVEL"))
|
||||
{
|
||||
if (i) // it's just a number
|
||||
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 +1970,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);
|
||||
}
|
||||
|
@ -2814,7 +2920,7 @@ static actionpointer_t actionpointers[] =
|
|||
{{A_ThrownRing}, "A_THROWNRING"},
|
||||
{{A_SetSolidSteam}, "A_SETSOLIDSTEAM"},
|
||||
{{A_UnsetSolidSteam}, "A_UNSETSOLIDSTEAM"},
|
||||
{{A_SignSpin}, "S_SIGNSPIN"},
|
||||
{{A_SignSpin}, "A_SIGNSPIN"},
|
||||
{{A_SignPlayer}, "A_SIGNPLAYER"},
|
||||
{{A_OverlayThink}, "A_OVERLAYTHINK"},
|
||||
{{A_JetChase}, "A_JETCHASE"},
|
||||
|
@ -2916,6 +3022,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 +3140,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,22 +3231,20 @@ static void readframe(MYFILE *f, INT32 num)
|
|||
}
|
||||
|
||||
z = 0;
|
||||
#ifdef HAVE_BLUA
|
||||
found = LUA_SetLuaAction(&states[num], actiontocompare);
|
||||
if (!found)
|
||||
#endif
|
||||
while (actionpointers[z].name)
|
||||
{
|
||||
if (fastcmp(actiontocompare, actionpointers[z].name))
|
||||
while (actionpointers[z].name)
|
||||
{
|
||||
states[num].action = actionpointers[z].action;
|
||||
states[num].action.acv = actionpointers[z].action.acv; // assign
|
||||
states[num].action.acp1 = actionpointers[z].action.acp1;
|
||||
found = true;
|
||||
break;
|
||||
if (fastcmp(actiontocompare, actionpointers[z].name))
|
||||
{
|
||||
states[num].action = actionpointers[z].action;
|
||||
states[num].action.acv = actionpointers[z].action.acv; // assign
|
||||
states[num].action.acp1 = actionpointers[z].action.acp1;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
z++;
|
||||
}
|
||||
z++;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
deh_warning("Unknown action %s", actiontocompare);
|
||||
|
@ -3889,7 +3995,26 @@ static void readmaincfg(MYFILE *f)
|
|||
value = atoi(word2); // used for numerical settings
|
||||
|
||||
if (fastcmp(word, "EXECCFG"))
|
||||
COM_BufAddText(va("exec %s\n", word2));
|
||||
{
|
||||
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"))
|
||||
{
|
||||
|
@ -3902,7 +4027,20 @@ static void readmaincfg(MYFILE *f)
|
|||
else
|
||||
value = get_number(word2);
|
||||
|
||||
spstage_start = (INT16)value;
|
||||
spstage_start = spmarathon_start = (INT16)value;
|
||||
}
|
||||
else if (fastcmp(word, "SPMARATHON_START"))
|
||||
{
|
||||
// Support using the actual map name,
|
||||
// i.e., Level AB, Level FZ, etc.
|
||||
|
||||
// Convert to map number
|
||||
if (word2[0] >= 'A' && word2[0] <= 'Z')
|
||||
value = M_MapNumber(word2[0], word2[1]);
|
||||
else
|
||||
value = get_number(word2);
|
||||
|
||||
spmarathon_start = (INT16)value;
|
||||
}
|
||||
else if (fastcmp(word, "SSTAGE_START"))
|
||||
{
|
||||
|
@ -3934,19 +4072,19 @@ static void readmaincfg(MYFILE *f)
|
|||
}
|
||||
else if (fastcmp(word, "REDTEAM"))
|
||||
{
|
||||
skincolor_redteam = (UINT8)get_number(word2);
|
||||
skincolor_redteam = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "BLUETEAM"))
|
||||
{
|
||||
skincolor_blueteam = (UINT8)get_number(word2);
|
||||
skincolor_blueteam = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "REDRING"))
|
||||
{
|
||||
skincolor_redring = (UINT8)get_number(word2);
|
||||
skincolor_redring = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "BLUERING"))
|
||||
{
|
||||
skincolor_bluering = (UINT8)get_number(word2);
|
||||
skincolor_bluering = (UINT16)get_number(word2);
|
||||
}
|
||||
else if (fastcmp(word, "INVULNTICS"))
|
||||
{
|
||||
|
@ -3996,6 +4134,17 @@ static void readmaincfg(MYFILE *f)
|
|||
introtoplay = 128;
|
||||
introchanged = true;
|
||||
}
|
||||
else if (fastcmp(word, "CREDITSCUTSCENE"))
|
||||
{
|
||||
creditscutscene = (UINT8)get_number(word2);
|
||||
// range check, you morons.
|
||||
if (creditscutscene > 128)
|
||||
creditscutscene = 128;
|
||||
}
|
||||
else if (fastcmp(word, "USEBLACKROCK"))
|
||||
{
|
||||
useBlackRock = (UINT8)(value || word2[0] == 'T' || word2[0] == 'Y');
|
||||
}
|
||||
else if (fastcmp(word, "LOOPTITLE"))
|
||||
{
|
||||
looptitle = (value || word2[0] == 'T' || word2[0] == 'Y');
|
||||
|
@ -4097,13 +4246,6 @@ static void readmaincfg(MYFILE *f)
|
|||
titlescrollyspeed = get_number(word2);
|
||||
titlechanged = true;
|
||||
}
|
||||
else if (fastcmp(word, "CREDITSCUTSCENE"))
|
||||
{
|
||||
creditscutscene = (UINT8)get_number(word2);
|
||||
// range check, you morons.
|
||||
if (creditscutscene > 128)
|
||||
creditscutscene = 128;
|
||||
}
|
||||
else if (fastcmp(word, "DISABLESPEEDADJUST"))
|
||||
{
|
||||
disableSpeedAdjust = (value || word2[0] == 'T' || word2[0] == 'Y');
|
||||
|
@ -4131,6 +4273,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"))
|
||||
{
|
||||
|
@ -4156,6 +4302,9 @@ static void readmaincfg(MYFILE *f)
|
|||
// can't use sprintf since there is %u in savegamename
|
||||
strcatbf(savegamename, srb2home, PATHSEP);
|
||||
|
||||
strcpy(liveeventbackup, va("live%s.bkp", timeattackfolder));
|
||||
strcatbf(liveeventbackup, srb2home, PATHSEP);
|
||||
|
||||
gamedataadded = true;
|
||||
titlechanged = true;
|
||||
}
|
||||
|
@ -4534,6 +4683,18 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
|
|||
ignorelines(f);
|
||||
}
|
||||
}
|
||||
else if (fastcmp(word, "SKINCOLOR") || fastcmp(word, "COLOR"))
|
||||
{
|
||||
if (i == 0 && word2[0] != '0') // If word2 isn't a number
|
||||
i = get_skincolor(word2); // find a skincolor by name
|
||||
if (i < numskincolors && i >= (INT32)SKINCOLOR_FIRSTFREESLOT)
|
||||
readskincolor(f, i);
|
||||
else
|
||||
{
|
||||
deh_warning("Skincolor %d out of range (%d - %d)", i, SKINCOLOR_FIRSTFREESLOT, numskincolors-1);
|
||||
ignorelines(f);
|
||||
}
|
||||
}
|
||||
else if (fastcmp(word, "SPRITE2"))
|
||||
{
|
||||
if (i == 0 && word2[0] != '0') // If word2 isn't a number
|
||||
|
@ -5595,10 +5756,12 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
|
|||
"S_FANG_PINCHPATHINGSTART1",
|
||||
"S_FANG_PINCHPATHINGSTART2",
|
||||
"S_FANG_PINCHPATHING",
|
||||
"S_FANG_PINCHBOUNCE0",
|
||||
"S_FANG_PINCHBOUNCE1",
|
||||
"S_FANG_PINCHBOUNCE2",
|
||||
"S_FANG_PINCHBOUNCE3",
|
||||
"S_FANG_PINCHBOUNCE4",
|
||||
"S_FANG_PINCHFALL0",
|
||||
"S_FANG_PINCHFALL1",
|
||||
"S_FANG_PINCHFALL2",
|
||||
"S_FANG_PINCHSKID1",
|
||||
|
@ -6210,6 +6373,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 +9019,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 +9121,6 @@ static const char *const GAMETYPERULE_LIST[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// Linedef flags
|
||||
static const char *const ML_LIST[16] = {
|
||||
"IMPASSIBLE",
|
||||
|
@ -8972,10 +9140,7 @@ static const char *const ML_LIST[16] = {
|
|||
"BOUNCY",
|
||||
"TFERLINE"
|
||||
};
|
||||
#endif
|
||||
|
||||
// This DOES differ from r_draw's Color_Names, unfortunately.
|
||||
// Also includes Super colors
|
||||
static const char *COLOR_ENUMS[] = {
|
||||
"NONE", // SKINCOLOR_NONE,
|
||||
|
||||
|
@ -9145,7 +9310,11 @@ static const char *const POWERS_LIST[] = {
|
|||
|
||||
//for linedef exec 427
|
||||
"NOCONTROL",
|
||||
"JUSTLAUNCHED",
|
||||
|
||||
//for dyes
|
||||
"DYE",
|
||||
|
||||
"JUSTLAUNCHED"
|
||||
};
|
||||
|
||||
static const char *const HUDITEMS_LIST[] = {
|
||||
|
@ -9209,6 +9378,7 @@ static const char *const MENUTYPES_LIST[] = {
|
|||
"MP_CONNECT",
|
||||
"MP_ROOM",
|
||||
"MP_PLAYERSETUP", // MP_PlayerSetupDef shared with SPLITSCREEN if #defined NONET
|
||||
"MP_SERVER_OPTIONS",
|
||||
|
||||
// Options
|
||||
"OP_MAIN",
|
||||
|
@ -9218,18 +9388,20 @@ static const char *const MENUTYPES_LIST[] = {
|
|||
"OP_P1MOUSE",
|
||||
"OP_P1JOYSTICK",
|
||||
"OP_JOYSTICKSET", // OP_JoystickSetDef shared with P2
|
||||
"OP_P1CAMERA",
|
||||
|
||||
"OP_P2CONTROLS",
|
||||
"OP_P2MOUSE",
|
||||
"OP_P2JOYSTICK",
|
||||
"OP_P2CAMERA",
|
||||
|
||||
"OP_PLAYSTYLE",
|
||||
|
||||
"OP_VIDEO",
|
||||
"OP_VIDEOMODE",
|
||||
"OP_COLOR",
|
||||
"OP_OPENGL",
|
||||
"OP_OPENGL_LIGHTING",
|
||||
"OP_OPENGL_FOG",
|
||||
"OP_OPENGL_COLOR",
|
||||
|
||||
"OP_SOUND",
|
||||
|
||||
|
@ -9271,11 +9443,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
|
||||
|
@ -9406,7 +9574,8 @@ struct {
|
|||
|
||||
// SKINCOLOR_ doesn't include these..!
|
||||
{"MAXSKINCOLORS",MAXSKINCOLORS},
|
||||
{"MAXTRANSLATIONS",MAXTRANSLATIONS},
|
||||
{"FIRSTSUPERCOLOR",FIRSTSUPERCOLOR},
|
||||
{"NUMSUPERCOLORS",NUMSUPERCOLORS},
|
||||
|
||||
// Precipitation
|
||||
{"PRECIP_NONE",PRECIP_NONE},
|
||||
|
@ -9457,6 +9626,7 @@ struct {
|
|||
{"CR_MINECART",CR_MINECART},
|
||||
{"CR_ROLLOUT",CR_ROLLOUT},
|
||||
{"CR_PTERABYTE",CR_PTERABYTE},
|
||||
{"CR_DUSTDEVIL",CR_DUSTDEVIL},
|
||||
|
||||
// Ring weapons (ringweapons_t)
|
||||
// Useful for A_GiveWeapon
|
||||
|
@ -9484,6 +9654,7 @@ struct {
|
|||
{"SF_FASTEDGE",SF_FASTEDGE},
|
||||
{"SF_MULTIABILITY",SF_MULTIABILITY},
|
||||
{"SF_NONIGHTSROTATION",SF_NONIGHTSROTATION},
|
||||
{"SF_NONIGHTSSUPER",SF_NONIGHTSSUPER},
|
||||
|
||||
// Dashmode constants
|
||||
{"DASHMODE_THRESHOLD",DASHMODE_THRESHOLD},
|
||||
|
@ -9531,7 +9702,6 @@ struct {
|
|||
{"ME_ULTIMATE",ME_ULTIMATE},
|
||||
{"ME_PERFECT",ME_PERFECT},
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
// p_local.h constants
|
||||
{"FLOATSPEED",FLOATSPEED},
|
||||
{"MAXSTEPMOVE",MAXSTEPMOVE},
|
||||
|
@ -9666,11 +9836,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?
|
||||
|
@ -9696,11 +9866,10 @@ struct {
|
|||
// Node flags
|
||||
{"NF_SUBSECTOR",NF_SUBSECTOR}, // Indicate a leaf.
|
||||
#endif
|
||||
#ifdef ESLOPE
|
||||
|
||||
// Slope flags
|
||||
{"SL_NOPHYSICS",SL_NOPHYSICS},
|
||||
{"SL_DYNAMIC",SL_DYNAMIC},
|
||||
#endif
|
||||
|
||||
// Angles
|
||||
{"ANG1",ANG1},
|
||||
|
@ -9864,7 +10033,12 @@ struct {
|
|||
{"TC_RAINBOW",TC_RAINBOW},
|
||||
{"TC_BLINK",TC_BLINK},
|
||||
{"TC_DASHMODE",TC_DASHMODE},
|
||||
#endif
|
||||
|
||||
// marathonmode flags
|
||||
{"MA_INIT",MA_INIT},
|
||||
{"MA_RUNNING",MA_RUNNING},
|
||||
{"MA_NOCUTSCENES",MA_NOCUTSCENES},
|
||||
{"MA_INGAME",MA_INGAME},
|
||||
|
||||
{NULL,0}
|
||||
};
|
||||
|
@ -9909,6 +10083,26 @@ static statenum_t get_state(const char *word)
|
|||
return S_NULL;
|
||||
}
|
||||
|
||||
skincolornum_t get_skincolor(const char *word)
|
||||
{ // Returns the value of SKINCOLOR_ enumerations
|
||||
skincolornum_t i;
|
||||
if (*word >= '0' && *word <= '9')
|
||||
return atoi(word);
|
||||
if (fastncmp("SKINCOLOR_",word,10))
|
||||
word += 10; // take off the SKINCOLOR_
|
||||
for (i = 0; i < NUMCOLORFREESLOTS; i++) {
|
||||
if (!FREE_SKINCOLORS[i])
|
||||
break;
|
||||
if (fastcmp(word, FREE_SKINCOLORS[i]))
|
||||
return SKINCOLOR_FIRSTFREESLOT+i;
|
||||
}
|
||||
for (i = 0; i < SKINCOLOR_FIRSTFREESLOT; i++)
|
||||
if (fastcmp(word, COLOR_ENUMS[i]))
|
||||
return i;
|
||||
deh_warning("Couldn't find skincolor named 'SKINCOLOR_%s'",word);
|
||||
return SKINCOLOR_GREEN;
|
||||
}
|
||||
|
||||
static spritenum_t get_sprite(const char *word)
|
||||
{ // Returns the value of SPR_ enumerations
|
||||
spritenum_t i;
|
||||
|
@ -10021,8 +10215,7 @@ static menutype_t get_menutype(const char *word)
|
|||
return MN_NONE;
|
||||
}
|
||||
|
||||
#ifndef HAVE_BLUA
|
||||
static INT16 get_gametype(const char *word)
|
||||
/*static INT16 get_gametype(const char *word)
|
||||
{ // Returns the value of GT_ enumerations
|
||||
INT16 i;
|
||||
if (*word >= '0' && *word <= '9')
|
||||
|
@ -10048,7 +10241,7 @@ static powertype_t get_power(const char *word)
|
|||
return i;
|
||||
deh_warning("Couldn't find power named 'pw_%s'",word);
|
||||
return pw_invulnerability;
|
||||
}
|
||||
}*/
|
||||
|
||||
/// \todo Make ANY of this completely over-the-top math craziness obey the order of operations.
|
||||
static fixed_t op_mul(fixed_t a, fixed_t b) { return a*b; }
|
||||
|
@ -10076,7 +10269,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;
|
||||
|
@ -10204,6 +10397,11 @@ static fixed_t find_const(const char **rword)
|
|||
free(word);
|
||||
return r;
|
||||
}
|
||||
else if (fastncmp("SKINCOLOR_",word,10)) {
|
||||
r = get_skincolor(word);
|
||||
free(word);
|
||||
return r;
|
||||
}
|
||||
else if (fastncmp("MT_",word,3)) {
|
||||
r = get_mobjtype(word);
|
||||
free(word);
|
||||
|
@ -10236,7 +10434,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;
|
||||
|
@ -10272,17 +10470,6 @@ static fixed_t find_const(const char **rword)
|
|||
free(word);
|
||||
return r;
|
||||
}
|
||||
else if (fastncmp("SKINCOLOR_",word,10)) {
|
||||
char *p = word+10;
|
||||
for (i = 0; i < MAXTRANSLATIONS; i++)
|
||||
if (fastcmp(p, COLOR_ENUMS[i])) {
|
||||
free(word);
|
||||
return i;
|
||||
}
|
||||
const_warning("color",word);
|
||||
free(word);
|
||||
return 0;
|
||||
}
|
||||
else if (fastncmp("GRADE_",word,6))
|
||||
{
|
||||
char *p = word+6;
|
||||
|
@ -10306,16 +10493,14 @@ static fixed_t find_const(const char **rword)
|
|||
const_warning("constant",word);
|
||||
free(word);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}*/
|
||||
|
||||
// Loops through every constant and operation in word and performs its calculations, returning the final value.
|
||||
fixed_t get_number(const char *word)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
return LUA_EvalMath(word);
|
||||
#else
|
||||
// DESPERATELY NEEDED: Order of operations support! :x
|
||||
|
||||
/*// DESPERATELY NEEDED: Order of operations support! :x
|
||||
fixed_t i = find_const(&word);
|
||||
INT32 o;
|
||||
while(*word) {
|
||||
|
@ -10325,8 +10510,7 @@ fixed_t get_number(const char *word)
|
|||
else
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
#endif
|
||||
return i;*/
|
||||
}
|
||||
|
||||
void DEH_Check(void)
|
||||
|
@ -10346,12 +10530,11 @@ void DEH_Check(void)
|
|||
if (dehpowers != NUMPOWERS)
|
||||
I_Error("You forgot to update the Dehacked powers list, you dolt!\n(%d powers defined, versus %s in the Dehacked list)\n", NUMPOWERS, sizeu1(dehpowers));
|
||||
|
||||
if (dehcolors != MAXTRANSLATIONS)
|
||||
I_Error("You forgot to update the Dehacked colors list, you dolt!\n(%d colors defined, versus %s in the Dehacked list)\n", MAXTRANSLATIONS, sizeu1(dehcolors));
|
||||
if (dehcolors != SKINCOLOR_FIRSTFREESLOT)
|
||||
I_Error("You forgot to update the Dehacked colors list, you dolt!\n(%d colors defined, versus %s in the Dehacked list)\n", SKINCOLOR_FIRSTFREESLOT, sizeu1(dehcolors));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
|
||||
|
@ -10456,6 +10639,22 @@ static inline int lib_freeslot(lua_State *L)
|
|||
if (i == NUMMOBJFREESLOTS)
|
||||
CONS_Alert(CONS_WARNING, "Ran out of free MobjType slots!\n");
|
||||
}
|
||||
else if (fastcmp(type, "SKINCOLOR"))
|
||||
{
|
||||
skincolornum_t i;
|
||||
for (i = 0; i < NUMCOLORFREESLOTS; i++)
|
||||
if (!FREE_SKINCOLORS[i]) {
|
||||
CONS_Printf("Skincolor SKINCOLOR_%s allocated.\n",word);
|
||||
FREE_SKINCOLORS[i] = Z_Malloc(strlen(word)+1, PU_STATIC, NULL);
|
||||
strcpy(FREE_SKINCOLORS[i],word);
|
||||
M_AddMenuColor(numskincolors++);
|
||||
lua_pushinteger(L, i);
|
||||
r++;
|
||||
break;
|
||||
}
|
||||
if (i == NUMCOLORFREESLOTS)
|
||||
CONS_Alert(CONS_WARNING, "Ran out of free skincolor slots!\n");
|
||||
}
|
||||
else if (fastcmp(type, "SPR2"))
|
||||
{
|
||||
// Search if we already have an SPR2 by that name...
|
||||
|
@ -10787,13 +10986,20 @@ static inline int lib_getenum(lua_State *L)
|
|||
}
|
||||
else if (fastncmp("SKINCOLOR_",word,10)) {
|
||||
p = word+10;
|
||||
for (i = 0; i < MAXTRANSLATIONS; i++)
|
||||
for (i = 0; i < NUMCOLORFREESLOTS; i++) {
|
||||
if (!FREE_SKINCOLORS[i])
|
||||
break;
|
||||
if (fastcmp(p, FREE_SKINCOLORS[i])) {
|
||||
lua_pushinteger(L, SKINCOLOR_FIRSTFREESLOT+i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < SKINCOLOR_FIRSTFREESLOT; i++)
|
||||
if (fastcmp(p, COLOR_ENUMS[i])) {
|
||||
lua_pushinteger(L, i);
|
||||
return 1;
|
||||
}
|
||||
if (mathlib) return luaL_error(L, "skincolor '%s' could not be found.\n", word);
|
||||
return 0;
|
||||
return luaL_error(L, "skincolor '%s' could not be found.\n", word);
|
||||
}
|
||||
else if (fastncmp("GRADE_",word,6))
|
||||
{
|
||||
|
@ -10977,5 +11183,3 @@ void LUA_SetActionByName(void *state, const char *actiontocompare)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HAVE_BLUA
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -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;
|
||||
|
||||
|
|
|
@ -61,6 +61,8 @@
|
|||
|
||||
#include "../console.h"
|
||||
|
||||
#include "../m_menu.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "../i_system.h"
|
||||
#endif
|
||||
|
@ -555,6 +557,7 @@ void I_Error (const char *error, ...)
|
|||
if (demorecording)
|
||||
G_CheckDemoStatus();
|
||||
D_QuitNetGame ();
|
||||
M_FreePlayerSetupColors();
|
||||
|
||||
if (shutdowning)
|
||||
{
|
||||
|
@ -622,6 +625,7 @@ void I_Quit (void)
|
|||
if (demorecording)
|
||||
G_CheckDemoStatus();
|
||||
D_QuitNetGame ();
|
||||
M_FreePlayerSetupColors();
|
||||
I_ShutdownMusic();
|
||||
I_ShutdownSound();
|
||||
I_ShutdownCD();
|
||||
|
|
|
@ -90,6 +90,9 @@ static unsigned long nombre = NEWTICRATE*10;
|
|||
static void I_BlitScreenVesa1(void); //see later
|
||||
void I_FinishUpdate (void)
|
||||
{
|
||||
if (marathonmode)
|
||||
SCR_DisplayMarathonInfo();
|
||||
|
||||
// draw captions if enabled
|
||||
if (cv_closedcaptioning.value)
|
||||
SCR_ClosedCaptions();
|
||||
|
@ -339,7 +342,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) {}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 2005-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 2005-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -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) {}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -208,10 +208,6 @@ typedef struct
|
|||
|
||||
#define ZSHIFT 4
|
||||
|
||||
extern const UINT8 Color_Index[MAXTRANSLATIONS-1][16];
|
||||
extern const char *Color_Names[MAXSKINCOLORS + NUMSUPERCOLORS];
|
||||
extern const UINT8 Color_Opposite[MAXSKINCOLORS - 1][2];
|
||||
|
||||
#define NUMMAPS 1035
|
||||
|
||||
#endif // __DOOMDATA__
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -143,16 +143,19 @@ extern char logfilename[1024];
|
|||
// we use comprevision and compbranch instead.
|
||||
#else
|
||||
#define VERSION 202 // Game version
|
||||
#define SUBVERSION 1 // more precise version number
|
||||
#define VERSIONSTRING "v2.2.1"
|
||||
#define VERSIONSTRINGW L"v2.2.1"
|
||||
#define SUBVERSION 4 // more precise version number
|
||||
#define VERSIONSTRING "v2.2.4"
|
||||
#define VERSIONSTRINGW L"v2.2.4"
|
||||
// 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
|
||||
#define USE_PATCH_DTA
|
||||
|
||||
// Use .kart extension addons
|
||||
//#define USE_KART
|
||||
|
@ -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 41
|
||||
#define MODVERSION 44
|
||||
|
||||
// To version config.cfg, MAJOREXECVERSION is set equal to MODVERSION automatically.
|
||||
// Increment MINOREXECVERSION whenever a config change is needed that does not correspond
|
||||
|
@ -236,6 +239,20 @@ extern char logfilename[1024];
|
|||
#define PLAYERSMASK (MAXPLAYERS-1)
|
||||
#define MAXPLAYERNAME 21
|
||||
|
||||
#define COLORRAMPSIZE 16
|
||||
#define MAXCOLORNAME 32
|
||||
#define NUMCOLORFREESLOTS 1024
|
||||
|
||||
typedef struct skincolor_s
|
||||
{
|
||||
char name[MAXCOLORNAME+1]; // Skincolor name
|
||||
UINT8 ramp[COLORRAMPSIZE]; // Colormap ramp
|
||||
UINT16 invcolor; // Signpost color
|
||||
UINT8 invshade; // Signpost color shade
|
||||
UINT16 chatcolor; // Chat color
|
||||
boolean accessible; // Accessible by the color command + setup menu
|
||||
} skincolor_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SKINCOLOR_NONE = 0,
|
||||
|
@ -314,12 +331,10 @@ typedef enum
|
|||
SKINCOLOR_RASPBERRY,
|
||||
SKINCOLOR_ROSY,
|
||||
|
||||
// SKINCOLOR_? - one left before we bump up against 0x39, which isn't a HARD limit anymore but would be excessive
|
||||
|
||||
MAXSKINCOLORS,
|
||||
FIRSTSUPERCOLOR,
|
||||
|
||||
// Super special awesome Super flashing colors!
|
||||
SKINCOLOR_SUPERSILVER1 = MAXSKINCOLORS,
|
||||
SKINCOLOR_SUPERSILVER1 = FIRSTSUPERCOLOR,
|
||||
SKINCOLOR_SUPERSILVER2,
|
||||
SKINCOLOR_SUPERSILVER3,
|
||||
SKINCOLOR_SUPERSILVER4,
|
||||
|
@ -373,9 +388,17 @@ typedef enum
|
|||
SKINCOLOR_SUPERTAN4,
|
||||
SKINCOLOR_SUPERTAN5,
|
||||
|
||||
MAXTRANSLATIONS,
|
||||
NUMSUPERCOLORS = ((MAXTRANSLATIONS - MAXSKINCOLORS)/5)
|
||||
} skincolors_t;
|
||||
SKINCOLOR_FIRSTFREESLOT,
|
||||
SKINCOLOR_LASTFREESLOT = SKINCOLOR_FIRSTFREESLOT + NUMCOLORFREESLOTS - 1,
|
||||
|
||||
MAXSKINCOLORS,
|
||||
|
||||
NUMSUPERCOLORS = ((SKINCOLOR_FIRSTFREESLOT - FIRSTSUPERCOLOR)/5)
|
||||
} skincolornum_t;
|
||||
|
||||
extern UINT16 numskincolors;
|
||||
|
||||
extern skincolor_t skincolors[MAXSKINCOLORS];
|
||||
|
||||
// State updates, number of tics / second.
|
||||
// NOTE: used to setup the timer rate, see I_StartupTimer().
|
||||
|
@ -455,7 +478,8 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...) FUNCDEBUG;
|
|||
|
||||
// Things that used to be in dstrings.h
|
||||
#define SAVEGAMENAME "srb2sav"
|
||||
char savegamename[256];
|
||||
extern char savegamename[256];
|
||||
extern char liveeventbackup[256];
|
||||
|
||||
// m_misc.h
|
||||
#ifdef GETTEXT
|
||||
|
@ -562,15 +586,6 @@ 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 +595,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
|
||||
|
||||
|
@ -605,11 +617,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
/// memory that never gets touched.
|
||||
#define ALLOW_RESETDATA
|
||||
|
||||
#ifndef NONET
|
||||
/// Display a connection screen on join attempts.
|
||||
#define CLIENT_LOADINGSCREEN
|
||||
#endif
|
||||
|
||||
/// Experimental tweaks to analog mode. (Needs a lot of work before it's ready for primetime.)
|
||||
//#define REDSANALOG
|
||||
|
||||
|
@ -627,17 +634,13 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
/// SRB2CB itself ported this from PrBoom+
|
||||
#define NEWCLIP
|
||||
|
||||
/// OpenGL shaders
|
||||
#define GL_SHADERS
|
||||
|
||||
/// Handle touching sector specials in P_PlayerAfterThink instead of P_PlayerThink.
|
||||
/// \note Required for proper collision with moving sloped surfaces that have sector specials on them.
|
||||
#define SECTORSPECIALSAFTERTHINK
|
||||
|
||||
/// FINALLY some real clipping that doesn't make walls dissappear AND speeds the game up
|
||||
/// (that was the original comment from SRB2CB, sadly it is a lie and actually slows game down)
|
||||
/// on the bright side it fixes some weird issues with translucent walls
|
||||
/// \note SRB2CB port.
|
||||
/// SRB2CB itself ported this from PrBoom+
|
||||
#define NEWCLIP
|
||||
|
||||
/// Cache patches in Lua in a way that renderer switching will work flawlessly.
|
||||
//#define LUA_PATCH_SAFETY
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -45,7 +45,19 @@ extern INT32 curWeather;
|
|||
extern INT32 cursaveslot;
|
||||
//extern INT16 lastmapsaved;
|
||||
extern INT16 lastmaploaded;
|
||||
extern boolean gamecomplete;
|
||||
extern UINT8 gamecomplete;
|
||||
|
||||
// Extra abilities/settings for skins (combinable stuff)
|
||||
typedef enum
|
||||
{
|
||||
MA_RUNNING = 1, // In action
|
||||
MA_INIT = 1<<1, // Initialisation
|
||||
MA_NOCUTSCENES = 1<<2, // No cutscenes
|
||||
MA_INGAME = 1<<3 // Timer ignores loads
|
||||
} marathonmode_t;
|
||||
|
||||
extern marathonmode_t marathonmode;
|
||||
extern tic_t marathontime;
|
||||
|
||||
#define maxgameovers 13
|
||||
extern UINT8 numgameovers;
|
||||
|
@ -127,7 +139,7 @@ extern INT32 displayplayer;
|
|||
extern INT32 secondarydisplayplayer; // for splitscreen
|
||||
|
||||
// Maps of special importance
|
||||
extern INT16 spstage_start;
|
||||
extern INT16 spstage_start, spmarathon_start;
|
||||
extern INT16 sstage_start, sstage_end, smpstage_start, smpstage_end;
|
||||
|
||||
extern INT16 titlemap;
|
||||
|
@ -145,7 +157,7 @@ extern INT32 tutorialanalog; // store cv_analog[0] user value
|
|||
extern boolean looptitle;
|
||||
|
||||
// CTF colors.
|
||||
extern UINT8 skincolor_redteam, skincolor_blueteam, skincolor_redring, skincolor_bluering;
|
||||
extern UINT16 skincolor_redteam, skincolor_blueteam, skincolor_redring, skincolor_bluering;
|
||||
|
||||
extern tic_t countdowntimer;
|
||||
extern boolean countdowntimeup;
|
||||
|
@ -289,6 +301,7 @@ typedef struct
|
|||
UINT8 actnum; ///< Act number or 0 for none.
|
||||
UINT32 typeoflevel; ///< Combination of typeoflevel flags.
|
||||
INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end.
|
||||
INT16 marathonnext; ///< See nextlevel, but for Marathon mode. Necessary to support hub worlds ala SUGOI.
|
||||
char keywords[33]; ///< Keywords separated by space to search for. 32 characters.
|
||||
char musname[7]; ///< Music track to play. "" for no music.
|
||||
UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore.
|
||||
|
@ -319,6 +332,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 +509,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];
|
||||
|
||||
|
@ -543,7 +558,7 @@ extern recorddata_t *mainrecords[NUMMAPS];
|
|||
extern UINT8 mapvisited[NUMMAPS];
|
||||
|
||||
// Temporary holding place for nights data for the current map
|
||||
nightsdata_t ntemprecords;
|
||||
extern nightsdata_t ntemprecords;
|
||||
|
||||
extern UINT32 token; ///< Number of tokens collected in a level
|
||||
extern UINT32 tokenlist; ///< List of tokens collected
|
||||
|
@ -573,9 +588,12 @@ extern UINT16 nightslinktics;
|
|||
|
||||
extern UINT8 introtoplay;
|
||||
extern UINT8 creditscutscene;
|
||||
extern UINT8 useBlackRock;
|
||||
|
||||
extern UINT8 use1upSound;
|
||||
extern UINT8 maxXtraLife; // Max extra lives from rings
|
||||
extern UINT8 useContinues;
|
||||
#define continuesInSession (!multiplayer && (ultimatemode || (useContinues && !marathonmode) || (!modeattacking && !(cursaveslot > 0))))
|
||||
|
||||
extern mobj_t *hunt1, *hunt2, *hunt3; // Emerald hunt locations
|
||||
|
||||
|
@ -616,6 +634,19 @@ extern mapthing_t *playerstarts[MAXPLAYERS]; // Cooperative
|
|||
extern mapthing_t *bluectfstarts[MAXPLAYERS]; // CTF
|
||||
extern mapthing_t *redctfstarts[MAXPLAYERS]; // CTF
|
||||
|
||||
#define WAYPOINTSEQUENCESIZE 256
|
||||
#define NUMWAYPOINTSEQUENCES 256
|
||||
extern mobj_t *waypoints[NUMWAYPOINTSEQUENCES][WAYPOINTSEQUENCESIZE];
|
||||
extern UINT16 numwaypoints[NUMWAYPOINTSEQUENCES];
|
||||
|
||||
void P_AddWaypoint(UINT8 sequence, UINT8 id, mobj_t *waypoint);
|
||||
mobj_t *P_GetFirstWaypoint(UINT8 sequence);
|
||||
mobj_t *P_GetLastWaypoint(UINT8 sequence);
|
||||
mobj_t *P_GetPreviousWaypoint(mobj_t *current, boolean wrap);
|
||||
mobj_t *P_GetNextWaypoint(mobj_t *current, boolean wrap);
|
||||
mobj_t *P_GetClosestWaypoint(UINT8 sequence, mobj_t *mo);
|
||||
boolean P_IsDegeneratedWaypointSequence(UINT8 sequence);
|
||||
|
||||
// =====================================
|
||||
// Internal parameters, used for engine.
|
||||
// =====================================
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
|
|
@ -16,6 +16,11 @@ tic_t I_GetTime(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int I_GetTimeMicros(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void I_Sleep(void){}
|
||||
|
||||
void I_GetEvent(void){}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2014-2019 by Sonic Team Junior.
|
||||
// Copyright (C) 2014-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -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
|
||||
|
@ -1120,9 +1118,6 @@ static const char *credits[] = {
|
|||
"\1Sonic Robo Blast II",
|
||||
"\1Credits",
|
||||
"",
|
||||
"\1Producer",
|
||||
"Rob Tisdell",
|
||||
"",
|
||||
"\1Game Design",
|
||||
"Ben \"Mystic\" Geyer",
|
||||
"\"SSNTails\"",
|
||||
|
@ -1153,11 +1148,13 @@ static const char *credits[] = {
|
|||
"",
|
||||
"\1Programming",
|
||||
"\1Assistance",
|
||||
"Colette \"fickleheart\" Bordelon",
|
||||
"\"chi.miru\"", // helped port slope drawing code from ZDoom
|
||||
"Andrew \"orospakr\" Clunis",
|
||||
"Sally \"TehRealSalt\" Cochenour",
|
||||
"Gregor \"Oogaland\" Dick",
|
||||
"Julio \"Chaos Zero 64\" Guir",
|
||||
"\"Hannu_Hanhi\"", // For many OpenGL performance improvements!
|
||||
"\"Kalaron\"", // Coded some of Sryder13's collection of OpenGL fixes, especially fog
|
||||
"\"Lat'\"", // SRB2-CHAT, the chat window from Kart
|
||||
"Matthew \"Shuffle\" Marsalko",
|
||||
|
@ -1176,6 +1173,7 @@ static const char *credits[] = {
|
|||
"\1Art",
|
||||
"Victor \"VAdaPEGA\" Ara\x1Fjo", // Araújo -- sorry for our limited font! D:
|
||||
"Ryan \"Blaze Hedgehog\" Bloom",
|
||||
"\"ChrispyPixels\"",
|
||||
"Paul \"Boinciel\" Clempson",
|
||||
"Sally \"TehRealSalt\" Cochenour",
|
||||
"\"Dave Lite\"",
|
||||
|
@ -1222,6 +1220,7 @@ static const char *credits[] = {
|
|||
"\"SSNTails\"",
|
||||
"",
|
||||
"\1Level Design",
|
||||
"Colette \"fickleheart\" Bordelon",
|
||||
"Hank \"FuriousFox\" Brannock",
|
||||
"Matthew \"Fawfulfan\" Chapman",
|
||||
"Paul \"Boinciel\" Clempson",
|
||||
|
@ -1257,6 +1256,7 @@ static const char *credits[] = {
|
|||
"Johnny \"Sonikku\" Wallbank",
|
||||
"",
|
||||
"\1Testing",
|
||||
"Discord Community Testers",
|
||||
"Hank \"FuriousFox\" Brannock",
|
||||
"Cody \"SRB2 Playah\" Koester",
|
||||
"Skye \"OmegaVelocity\" Meredith",
|
||||
|
@ -1332,10 +1332,6 @@ void F_StartCredits(void)
|
|||
// Just in case they're open ... somehow
|
||||
M_ClearMenus(true);
|
||||
|
||||
// Save the second we enter the credits
|
||||
if ((!modifiedgame || savemoddata) && !(netgame || multiplayer) && cursaveslot > 0)
|
||||
G_SaveGame((UINT32)cursaveslot);
|
||||
|
||||
if (creditscutscene)
|
||||
{
|
||||
F_StartCustomCutscene(creditscutscene - 1, false, false);
|
||||
|
@ -1531,12 +1527,6 @@ void F_StartGameEvaluation(void)
|
|||
// Just in case they're open ... somehow
|
||||
M_ClearMenus(true);
|
||||
|
||||
// Save the second we enter the evaluation
|
||||
// We need to do this again! Remember, it's possible a mod designed skipped
|
||||
// the credits sequence!
|
||||
if ((!modifiedgame || savemoddata) && !(netgame || multiplayer) && cursaveslot > 0)
|
||||
G_SaveGame((UINT32)cursaveslot);
|
||||
|
||||
goodending = (ALL7EMERALDS(emeralds));
|
||||
|
||||
gameaction = ga_nothing;
|
||||
|
@ -1553,13 +1543,20 @@ void F_GameEvaluationDrawer(void)
|
|||
angle_t fa;
|
||||
INT32 eemeralds_cur;
|
||||
char patchname[7] = "CEMGx0";
|
||||
const char* endingtext = (goodending ? "CONGRATULATIONS!" : "TRY AGAIN...");
|
||||
const char* endingtext;
|
||||
|
||||
if (marathonmode)
|
||||
endingtext = "THANKS FOR THE RUN!";
|
||||
else if (goodending)
|
||||
endingtext = "CONGRATULATIONS!";
|
||||
else
|
||||
endingtext = "TRY AGAIN...";
|
||||
|
||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
|
||||
|
||||
// Draw all the good crap here.
|
||||
|
||||
if (finalecount > 0)
|
||||
if (finalecount > 0 && useBlackRock)
|
||||
{
|
||||
INT32 scale = FRACUNIT;
|
||||
patch_t *rockpat;
|
||||
|
@ -1686,7 +1683,9 @@ void F_GameEvaluationTicker(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!goodending)
|
||||
if (!useBlackRock)
|
||||
;
|
||||
else if (!goodending)
|
||||
{
|
||||
if (sparklloop)
|
||||
sparklloop--;
|
||||
|
@ -1843,10 +1842,6 @@ void F_StartEnding(void)
|
|||
// Just in case they're open ... somehow
|
||||
M_ClearMenus(true);
|
||||
|
||||
// Save before the credits sequence.
|
||||
if ((!modifiedgame || savemoddata) && !(netgame || multiplayer) && cursaveslot > 0)
|
||||
G_SaveGame((UINT32)cursaveslot);
|
||||
|
||||
gameaction = ga_nothing;
|
||||
paused = false;
|
||||
CON_ToggleOff();
|
||||
|
@ -2187,7 +2182,7 @@ void F_EndingDrawer(void)
|
|||
for (i = 0; i < 7; ++i)
|
||||
{
|
||||
UINT8* colormap;
|
||||
skincolors_t col = SKINCOLOR_GREEN;
|
||||
skincolornum_t col = SKINCOLOR_GREEN;
|
||||
switch (i)
|
||||
{
|
||||
case 1:
|
||||
|
@ -2762,11 +2757,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 +3479,8 @@ void F_TitleScreenDrawer(void)
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
luahook:
|
||||
LUAh_TitleHUD();
|
||||
#endif
|
||||
}
|
||||
|
||||
// separate animation timer for backgrounds, since we also count
|
||||
|
@ -3626,7 +3615,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 +3722,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);
|
||||
|
@ -3965,6 +3956,7 @@ static void F_AdvanceToNextScene(void)
|
|||
animtimer = pictime = cutscenes[cutnum]->scene[scenenum].picduration[picnum];
|
||||
}
|
||||
|
||||
// See also G_AfterIntermission, the only other place which handles intra-map/ending transitions
|
||||
void F_EndCutScene(void)
|
||||
{
|
||||
cutsceneover = true; // do this first, just in case G_EndGame or something wants to turn it back false later
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -162,7 +162,9 @@ extern wipestyleflags_t wipestyleflags;
|
|||
// Even my function names are borderline
|
||||
boolean F_ShouldColormapFade(void);
|
||||
boolean F_TryColormapFade(UINT8 wipecolor);
|
||||
#ifndef NOWIPE
|
||||
void F_DecideWipeStyle(void);
|
||||
#endif
|
||||
|
||||
#define FADECOLORMAPDIV 8
|
||||
#define FADECOLORMAPROWS (256/FADECOLORMAPDIV)
|
||||
|
|
13
src/f_wipe.c
13
src/f_wipe.c
|
@ -3,7 +3,7 @@
|
|||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 2013-2016 by Matthew "Kaito Sinclaire" Walsh.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -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"
|
||||
|
@ -465,6 +464,7 @@ void F_WipeEndScreen(void)
|
|||
*/
|
||||
boolean F_ShouldColormapFade(void)
|
||||
{
|
||||
#ifndef NOWIPE
|
||||
if ((wipestyleflags & (WSF_FADEIN|WSF_FADEOUT)) // only if one of those wipestyleflags are actually set
|
||||
&& !(wipestyleflags & WSF_CROSSFADE)) // and if not crossfading
|
||||
{
|
||||
|
@ -480,11 +480,13 @@ boolean F_ShouldColormapFade(void)
|
|||
// Menus
|
||||
|| gamestate == GS_TIMEATTACK);
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Decides what wipe style to use.
|
||||
*/
|
||||
#ifndef NOWIPE
|
||||
void F_DecideWipeStyle(void)
|
||||
{
|
||||
// Set default wipe style
|
||||
|
@ -494,6 +496,7 @@ void F_DecideWipeStyle(void)
|
|||
if (F_ShouldColormapFade())
|
||||
wipestyle = WIPESTYLE_COLORMAP;
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Attempt to run a colormap fade,
|
||||
provided all the conditionals were properly met.
|
||||
|
@ -502,6 +505,7 @@ void F_DecideWipeStyle(void)
|
|||
*/
|
||||
boolean F_TryColormapFade(UINT8 wipecolor)
|
||||
{
|
||||
#ifndef NOWIPE
|
||||
if (F_ShouldColormapFade())
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
|
@ -511,6 +515,7 @@ boolean F_TryColormapFade(UINT8 wipecolor)
|
|||
return true;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
F_WipeColorFill(wipecolor);
|
||||
return false;
|
||||
|
@ -609,6 +614,7 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
|
|||
tic_t F_GetWipeLength(UINT8 wipetype)
|
||||
{
|
||||
#ifdef NOWIPE
|
||||
(void)wipetype;
|
||||
return 0;
|
||||
#else
|
||||
static char lumpname[10] = "FADEmmss";
|
||||
|
@ -635,6 +641,7 @@ tic_t F_GetWipeLength(UINT8 wipetype)
|
|||
boolean F_WipeExists(UINT8 wipetype)
|
||||
{
|
||||
#ifdef NOWIPE
|
||||
(void)wipetype;
|
||||
return false;
|
||||
#else
|
||||
static char lumpname[10] = "FADEmm00";
|
||||
|
|
|
@ -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
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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__
|
2906
src/g_game.c
2906
src/g_game.c
File diff suppressed because it is too large
Load Diff
73
src/g_game.h
73
src/g_game.h
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -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;
|
||||
|
||||
|
@ -107,6 +93,7 @@ typedef enum
|
|||
// build an internal map name MAPxx from map number
|
||||
const char *G_BuildMapName(INT32 map);
|
||||
|
||||
extern INT16 ticcmd_oldangleturn[2];
|
||||
extern boolean ticcmd_centerviewdown[2]; // For simple controls, lock the camera behind the player
|
||||
extern mobj_t *ticcmd_ztargetfocus[2]; // Locking onto an object?
|
||||
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer);
|
||||
|
@ -173,65 +160,16 @@ 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);
|
||||
|
||||
void G_SaveGameData(void);
|
||||
|
||||
void G_SaveGame(UINT32 slot);
|
||||
void G_SaveGame(UINT32 slot, INT16 mapnum);
|
||||
|
||||
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];
|
||||
|
@ -253,6 +191,7 @@ boolean G_GametypeHasTeams(void);
|
|||
boolean G_GametypeHasSpectators(void);
|
||||
boolean G_RingSlingerGametype(void);
|
||||
boolean G_PlatformGametype(void);
|
||||
boolean G_CoopGametype(void);
|
||||
boolean G_TagGametype(void);
|
||||
boolean G_CompetitionGametype(void);
|
||||
boolean G_EnoughPlayersFinished(void);
|
||||
|
@ -309,6 +248,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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -57,6 +57,7 @@ extern UINT8 ultimatemode; // was sk_insane
|
|||
extern gameaction_t gameaction;
|
||||
|
||||
extern boolean botingame;
|
||||
extern UINT8 botskin, botcolor;
|
||||
extern UINT8 botskin;
|
||||
extern UINT16 botcolor;
|
||||
|
||||
#endif //__G_STATE__
|
||||
|
|
|
@ -1,20 +1,12 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 2001 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// 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
|
||||
/// \file hw3dsdrv.h
|
||||
/// \brief 3D sound import/export prototypes for low-level hardware interface
|
||||
|
||||
#ifndef __HW_3DS_DRV_H__
|
||||
|
|
|
@ -1,19 +1,12 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 2001 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// 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
|
||||
/// \file hw3sound.c
|
||||
/// \brief Hardware 3D sound general code
|
||||
|
||||
#include "../doomdef.h"
|
||||
|
@ -28,7 +21,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"
|
||||
|
|
|
@ -1,20 +1,12 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 2001 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// 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
|
||||
/// \file hw3sound.h
|
||||
/// \brief High-level functions of hardware 3D sound
|
||||
|
||||
#ifndef __HW3_SOUND_H__
|
||||
|
|
|
@ -0,0 +1,454 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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 hw_batching.c
|
||||
/// \brief Draw call batching and related things.
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hw_glob.h"
|
||||
#include "hw_batching.h"
|
||||
#include "../i_system.h"
|
||||
|
||||
// The texture for the next polygon given to HWR_ProcessPolygon.
|
||||
// Set with HWR_SetCurrentTexture.
|
||||
GLMipmap_t *current_texture = NULL;
|
||||
|
||||
boolean currently_batching = false;
|
||||
|
||||
FOutVector* finalVertexArray = NULL;// contains subset of sorted vertices and texture coordinates to be sent to gpu
|
||||
UINT32* finalVertexIndexArray = NULL;// contains indexes for glDrawElements, taking into account fan->triangles conversion
|
||||
// NOTE have this alloced as 3x finalVertexArray size
|
||||
int finalVertexArrayAllocSize = 65536;
|
||||
//GLubyte* colorArray = NULL;// contains color data to be sent to gpu, if needed
|
||||
//int colorArrayAllocSize = 65536;
|
||||
// not gonna use this for now, just sort by color and change state when it changes
|
||||
// later maybe when using vertex attributes if it's needed
|
||||
|
||||
PolygonArrayEntry* polygonArray = NULL;// contains the polygon data from DrawPolygon, waiting to be processed
|
||||
int polygonArraySize = 0;
|
||||
UINT32* polygonIndexArray = NULL;// contains sorting pointers for polygonArray
|
||||
int polygonArrayAllocSize = 65536;
|
||||
|
||||
FOutVector* unsortedVertexArray = NULL;// contains unsorted vertices and texture coordinates from DrawPolygon
|
||||
int unsortedVertexArraySize = 0;
|
||||
int unsortedVertexArrayAllocSize = 65536;
|
||||
|
||||
// Enables batching mode. HWR_ProcessPolygon will collect polygons instead of passing them directly to the rendering backend.
|
||||
// Call HWR_RenderBatches to render all the collected geometry.
|
||||
void HWR_StartBatching(void)
|
||||
{
|
||||
if (currently_batching)
|
||||
I_Error("Repeat call to HWR_StartBatching without HWR_RenderBatches");
|
||||
|
||||
// init arrays if that has not been done yet
|
||||
if (!finalVertexArray)
|
||||
{
|
||||
finalVertexArray = malloc(finalVertexArrayAllocSize * sizeof(FOutVector));
|
||||
finalVertexIndexArray = malloc(finalVertexArrayAllocSize * 3 * sizeof(UINT32));
|
||||
polygonArray = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry));
|
||||
polygonIndexArray = malloc(polygonArrayAllocSize * sizeof(UINT32));
|
||||
unsortedVertexArray = malloc(unsortedVertexArrayAllocSize * sizeof(FOutVector));
|
||||
}
|
||||
|
||||
currently_batching = true;
|
||||
}
|
||||
|
||||
// This replaces the direct calls to pfnSetTexture in cases where batching is available.
|
||||
// The texture selection is saved for the next HWR_ProcessPolygon call.
|
||||
// Doing this was easier than getting a texture pointer to HWR_ProcessPolygon.
|
||||
void HWR_SetCurrentTexture(GLMipmap_t *texture)
|
||||
{
|
||||
if (currently_batching)
|
||||
{
|
||||
current_texture = texture;
|
||||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetTexture(texture);
|
||||
}
|
||||
}
|
||||
|
||||
// If batching is enabled, this function collects the polygon data and the chosen texture
|
||||
// for later use in HWR_RenderBatches. Otherwise the rendering backend is used to
|
||||
// render the polygon immediately.
|
||||
void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader, boolean horizonSpecial)
|
||||
{
|
||||
if (currently_batching)
|
||||
{
|
||||
if (!pSurf)
|
||||
I_Error("Got a null FSurfaceInfo in batching");// nulls should not come in the stuff that batching currently applies to
|
||||
if (polygonArraySize == polygonArrayAllocSize)
|
||||
{
|
||||
PolygonArrayEntry* new_array;
|
||||
// ran out of space, make new array double the size
|
||||
polygonArrayAllocSize *= 2;
|
||||
new_array = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry));
|
||||
memcpy(new_array, polygonArray, polygonArraySize * sizeof(PolygonArrayEntry));
|
||||
free(polygonArray);
|
||||
polygonArray = new_array;
|
||||
// also need to redo the index array, dont need to copy it though
|
||||
free(polygonIndexArray);
|
||||
polygonIndexArray = malloc(polygonArrayAllocSize * sizeof(UINT32));
|
||||
}
|
||||
|
||||
while (unsortedVertexArraySize + (int)iNumPts > unsortedVertexArrayAllocSize)
|
||||
{
|
||||
FOutVector* new_array;
|
||||
// need more space for vertices in unsortedVertexArray
|
||||
unsortedVertexArrayAllocSize *= 2;
|
||||
new_array = malloc(unsortedVertexArrayAllocSize * sizeof(FOutVector));
|
||||
memcpy(new_array, unsortedVertexArray, unsortedVertexArraySize * sizeof(FOutVector));
|
||||
free(unsortedVertexArray);
|
||||
unsortedVertexArray = new_array;
|
||||
}
|
||||
|
||||
// add the polygon data to the arrays
|
||||
|
||||
polygonArray[polygonArraySize].surf = *pSurf;
|
||||
polygonArray[polygonArraySize].vertsIndex = unsortedVertexArraySize;
|
||||
polygonArray[polygonArraySize].numVerts = iNumPts;
|
||||
polygonArray[polygonArraySize].polyFlags = PolyFlags;
|
||||
polygonArray[polygonArraySize].texture = current_texture;
|
||||
polygonArray[polygonArraySize].shader = shader;
|
||||
polygonArray[polygonArraySize].horizonSpecial = horizonSpecial;
|
||||
polygonArraySize++;
|
||||
|
||||
memcpy(&unsortedVertexArray[unsortedVertexArraySize], pOutVerts, iNumPts * sizeof(FOutVector));
|
||||
unsortedVertexArraySize += iNumPts;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (shader)
|
||||
HWD.pfnSetShader(shader);
|
||||
HWD.pfnDrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
|
||||
}
|
||||
}
|
||||
|
||||
static int comparePolygons(const void *p1, const void *p2)
|
||||
{
|
||||
unsigned int index1 = *(const unsigned int*)p1;
|
||||
unsigned int index2 = *(const unsigned int*)p2;
|
||||
PolygonArrayEntry* poly1 = &polygonArray[index1];
|
||||
PolygonArrayEntry* poly2 = &polygonArray[index2];
|
||||
int diff;
|
||||
INT64 diff64;
|
||||
|
||||
int shader1 = poly1->shader;
|
||||
int shader2 = poly2->shader;
|
||||
// make skywalls and horizon lines first in order
|
||||
if (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial)
|
||||
shader1 = -1;
|
||||
if (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial)
|
||||
shader2 = -1;
|
||||
diff = shader1 - shader2;
|
||||
if (diff != 0) return diff;
|
||||
|
||||
// skywalls and horizon lines must retain their order for horizon lines to work
|
||||
if (shader1 == -1 && shader2 == -1)
|
||||
return index1 - index2;
|
||||
|
||||
diff64 = poly1->texture - poly2->texture;
|
||||
if (diff64 != 0) return diff64;
|
||||
|
||||
diff = poly1->polyFlags - poly2->polyFlags;
|
||||
if (diff != 0) return diff;
|
||||
|
||||
diff64 = poly1->surf.PolyColor.rgba - poly2->surf.PolyColor.rgba;
|
||||
if (diff64 < 0) return -1; else if (diff64 > 0) return 1;
|
||||
diff64 = poly1->surf.TintColor.rgba - poly2->surf.TintColor.rgba;
|
||||
if (diff64 < 0) return -1; else if (diff64 > 0) return 1;
|
||||
diff64 = poly1->surf.FadeColor.rgba - poly2->surf.FadeColor.rgba;
|
||||
if (diff64 < 0) return -1; else if (diff64 > 0) return 1;
|
||||
|
||||
diff = poly1->surf.LightInfo.light_level - poly2->surf.LightInfo.light_level;
|
||||
if (diff != 0) return diff;
|
||||
diff = poly1->surf.LightInfo.fade_start - poly2->surf.LightInfo.fade_start;
|
||||
if (diff != 0) return diff;
|
||||
diff = poly1->surf.LightInfo.fade_end - poly2->surf.LightInfo.fade_end;
|
||||
return diff;
|
||||
}
|
||||
|
||||
static int comparePolygonsNoShaders(const void *p1, const void *p2)
|
||||
{
|
||||
unsigned int index1 = *(const unsigned int*)p1;
|
||||
unsigned int index2 = *(const unsigned int*)p2;
|
||||
PolygonArrayEntry* poly1 = &polygonArray[index1];
|
||||
PolygonArrayEntry* poly2 = &polygonArray[index2];
|
||||
int diff;
|
||||
INT64 diff64;
|
||||
|
||||
GLMipmap_t *texture1 = poly1->texture;
|
||||
GLMipmap_t *texture2 = poly2->texture;
|
||||
if (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial)
|
||||
texture1 = NULL;
|
||||
if (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial)
|
||||
texture2 = NULL;
|
||||
diff64 = texture1 - texture2;
|
||||
if (diff64 != 0) return diff64;
|
||||
|
||||
// skywalls and horizon lines must retain their order for horizon lines to work
|
||||
if (texture1 == NULL && texture2 == NULL)
|
||||
return index1 - index2;
|
||||
|
||||
diff = poly1->polyFlags - poly2->polyFlags;
|
||||
if (diff != 0) return diff;
|
||||
|
||||
diff64 = poly1->surf.PolyColor.rgba - poly2->surf.PolyColor.rgba;
|
||||
if (diff64 < 0) return -1; else if (diff64 > 0) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// This function organizes the geometry collected by HWR_ProcessPolygon calls into batches and uses
|
||||
// the rendering backend to draw them.
|
||||
void HWR_RenderBatches(void)
|
||||
{
|
||||
int finalVertexWritePos = 0;// position in finalVertexArray
|
||||
int finalIndexWritePos = 0;// position in finalVertexIndexArray
|
||||
|
||||
int polygonReadPos = 0;// position in polygonIndexArray
|
||||
|
||||
int currentShader;
|
||||
int nextShader = 0;
|
||||
GLMipmap_t *currentTexture;
|
||||
GLMipmap_t *nextTexture = NULL;
|
||||
FBITFIELD currentPolyFlags = 0;
|
||||
FBITFIELD nextPolyFlags = 0;
|
||||
FSurfaceInfo currentSurfaceInfo;
|
||||
FSurfaceInfo nextSurfaceInfo;
|
||||
|
||||
int i;
|
||||
|
||||
if (!currently_batching)
|
||||
I_Error("HWR_RenderBatches called without starting batching");
|
||||
|
||||
nextSurfaceInfo.LightInfo.fade_end = 0;
|
||||
nextSurfaceInfo.LightInfo.fade_start = 0;
|
||||
nextSurfaceInfo.LightInfo.light_level = 0;
|
||||
|
||||
currently_batching = false;// no longer collecting batches
|
||||
if (!polygonArraySize)
|
||||
{
|
||||
rs_hw_numpolys = rs_hw_numcalls = rs_hw_numshaders = rs_hw_numtextures = rs_hw_numpolyflags = rs_hw_numcolors = 0;
|
||||
return;// nothing to draw
|
||||
}
|
||||
// init stats vars
|
||||
rs_hw_numpolys = polygonArraySize;
|
||||
rs_hw_numcalls = rs_hw_numverts = 0;
|
||||
rs_hw_numshaders = rs_hw_numtextures = rs_hw_numpolyflags = rs_hw_numcolors = 1;
|
||||
// init polygonIndexArray
|
||||
for (i = 0; i < polygonArraySize; i++)
|
||||
{
|
||||
polygonIndexArray[i] = i;
|
||||
}
|
||||
|
||||
// sort polygons
|
||||
rs_hw_batchsorttime = I_GetTimeMicros();
|
||||
if (cv_grshaders.value && gr_shadersavailable)
|
||||
qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygons);
|
||||
else
|
||||
qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygonsNoShaders);
|
||||
rs_hw_batchsorttime = I_GetTimeMicros() - rs_hw_batchsorttime;
|
||||
// sort order
|
||||
// 1. shader
|
||||
// 2. texture
|
||||
// 3. polyflags
|
||||
// 4. colors + light level
|
||||
// not sure about what order of the last 2 should be, or if it even matters
|
||||
|
||||
rs_hw_batchdrawtime = I_GetTimeMicros();
|
||||
|
||||
currentShader = polygonArray[polygonIndexArray[0]].shader;
|
||||
currentTexture = polygonArray[polygonIndexArray[0]].texture;
|
||||
currentPolyFlags = polygonArray[polygonIndexArray[0]].polyFlags;
|
||||
currentSurfaceInfo = polygonArray[polygonIndexArray[0]].surf;
|
||||
// For now, will sort and track the colors. Vertex attributes could be used instead of uniforms
|
||||
// and a color array could replace the color calls.
|
||||
|
||||
// set state for first batch
|
||||
|
||||
if (cv_grshaders.value && gr_shadersavailable)
|
||||
{
|
||||
HWD.pfnSetShader(currentShader);
|
||||
}
|
||||
|
||||
if (currentPolyFlags & PF_NoTexture)
|
||||
currentTexture = NULL;
|
||||
else
|
||||
HWD.pfnSetTexture(currentTexture);
|
||||
|
||||
while (1)// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
|
||||
{
|
||||
int firstIndex;
|
||||
int lastIndex;
|
||||
|
||||
boolean stopFlag = false;
|
||||
boolean changeState = false;
|
||||
boolean changeShader = false;
|
||||
boolean changeTexture = false;
|
||||
boolean changePolyFlags = false;
|
||||
boolean changeSurfaceInfo = false;
|
||||
|
||||
// steps:
|
||||
// write vertices
|
||||
// check for changes or end, otherwise go back to writing
|
||||
// changes will affect the next vars and the change bools
|
||||
// end could set flag for stopping
|
||||
// execute draw call
|
||||
// could check ending flag here
|
||||
// change states according to next vars and change bools, updating the current vars and reseting the bools
|
||||
// reset write pos
|
||||
// repeat loop
|
||||
|
||||
int index = polygonIndexArray[polygonReadPos++];
|
||||
int numVerts = polygonArray[index].numVerts;
|
||||
// before writing, check if there is enough room
|
||||
// using 'while' instead of 'if' here makes sure that there will *always* be enough room.
|
||||
// probably never will this loop run more than once though
|
||||
while (finalVertexWritePos + numVerts > finalVertexArrayAllocSize)
|
||||
{
|
||||
FOutVector* new_array;
|
||||
unsigned int* new_index_array;
|
||||
finalVertexArrayAllocSize *= 2;
|
||||
new_array = malloc(finalVertexArrayAllocSize * sizeof(FOutVector));
|
||||
memcpy(new_array, finalVertexArray, finalVertexWritePos * sizeof(FOutVector));
|
||||
free(finalVertexArray);
|
||||
finalVertexArray = new_array;
|
||||
// also increase size of index array, 3x of vertex array since
|
||||
// going from fans to triangles increases vertex count to 3x
|
||||
new_index_array = malloc(finalVertexArrayAllocSize * 3 * sizeof(UINT32));
|
||||
memcpy(new_index_array, finalVertexIndexArray, finalIndexWritePos * sizeof(UINT32));
|
||||
free(finalVertexIndexArray);
|
||||
finalVertexIndexArray = new_index_array;
|
||||
}
|
||||
// write the vertices of the polygon
|
||||
memcpy(&finalVertexArray[finalVertexWritePos], &unsortedVertexArray[polygonArray[index].vertsIndex],
|
||||
numVerts * sizeof(FOutVector));
|
||||
// write the indexes, pointing to the fan vertexes but in triangles format
|
||||
firstIndex = finalVertexWritePos;
|
||||
lastIndex = finalVertexWritePos + numVerts;
|
||||
finalVertexWritePos += 2;
|
||||
while (finalVertexWritePos < lastIndex)
|
||||
{
|
||||
finalVertexIndexArray[finalIndexWritePos++] = firstIndex;
|
||||
finalVertexIndexArray[finalIndexWritePos++] = finalVertexWritePos - 1;
|
||||
finalVertexIndexArray[finalIndexWritePos++] = finalVertexWritePos++;
|
||||
}
|
||||
|
||||
if (polygonReadPos >= polygonArraySize)
|
||||
{
|
||||
stopFlag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// check if a state change is required, set the change bools and next vars
|
||||
int nextIndex = polygonIndexArray[polygonReadPos];
|
||||
nextShader = polygonArray[nextIndex].shader;
|
||||
nextTexture = polygonArray[nextIndex].texture;
|
||||
nextPolyFlags = polygonArray[nextIndex].polyFlags;
|
||||
nextSurfaceInfo = polygonArray[nextIndex].surf;
|
||||
if (nextPolyFlags & PF_NoTexture)
|
||||
nextTexture = 0;
|
||||
if (currentShader != nextShader && cv_grshaders.value && gr_shadersavailable)
|
||||
{
|
||||
changeState = true;
|
||||
changeShader = true;
|
||||
}
|
||||
if (currentTexture != nextTexture)
|
||||
{
|
||||
changeState = true;
|
||||
changeTexture = true;
|
||||
}
|
||||
if (currentPolyFlags != nextPolyFlags)
|
||||
{
|
||||
changeState = true;
|
||||
changePolyFlags = true;
|
||||
}
|
||||
if (cv_grshaders.value && gr_shadersavailable)
|
||||
{
|
||||
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
|
||||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
|
||||
currentSurfaceInfo.FadeColor.rgba != nextSurfaceInfo.FadeColor.rgba ||
|
||||
currentSurfaceInfo.LightInfo.light_level != nextSurfaceInfo.LightInfo.light_level ||
|
||||
currentSurfaceInfo.LightInfo.fade_start != nextSurfaceInfo.LightInfo.fade_start ||
|
||||
currentSurfaceInfo.LightInfo.fade_end != nextSurfaceInfo.LightInfo.fade_end)
|
||||
{
|
||||
changeState = true;
|
||||
changeSurfaceInfo = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba)
|
||||
{
|
||||
changeState = true;
|
||||
changeSurfaceInfo = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (changeState || stopFlag)
|
||||
{
|
||||
// execute draw call
|
||||
HWD.pfnDrawIndexedTriangles(¤tSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
|
||||
// update stats
|
||||
rs_hw_numcalls++;
|
||||
rs_hw_numverts += finalIndexWritePos;
|
||||
// reset write positions
|
||||
finalVertexWritePos = 0;
|
||||
finalIndexWritePos = 0;
|
||||
}
|
||||
else continue;
|
||||
|
||||
// if we're here then either its time to stop or time to change state
|
||||
if (stopFlag) break;
|
||||
|
||||
// change state according to change bools and next vars, update current vars and reset bools
|
||||
if (changeShader)
|
||||
{
|
||||
HWD.pfnSetShader(nextShader);
|
||||
currentShader = nextShader;
|
||||
changeShader = false;
|
||||
|
||||
rs_hw_numshaders++;
|
||||
}
|
||||
if (changeTexture)
|
||||
{
|
||||
// texture should be already ready for use from calls to SetTexture during batch collection
|
||||
HWD.pfnSetTexture(nextTexture);
|
||||
currentTexture = nextTexture;
|
||||
changeTexture = false;
|
||||
|
||||
rs_hw_numtextures++;
|
||||
}
|
||||
if (changePolyFlags)
|
||||
{
|
||||
currentPolyFlags = nextPolyFlags;
|
||||
changePolyFlags = false;
|
||||
|
||||
rs_hw_numpolyflags++;
|
||||
}
|
||||
if (changeSurfaceInfo)
|
||||
{
|
||||
currentSurfaceInfo = nextSurfaceInfo;
|
||||
changeSurfaceInfo = false;
|
||||
|
||||
rs_hw_numcolors++;
|
||||
}
|
||||
// and that should be it?
|
||||
}
|
||||
// reset the arrays (set sizes to 0)
|
||||
polygonArraySize = 0;
|
||||
unsortedVertexArraySize = 0;
|
||||
|
||||
rs_hw_batchdrawtime = I_GetTimeMicros() - rs_hw_batchdrawtime;
|
||||
}
|
||||
|
||||
|
||||
#endif // HWRENDER
|
|
@ -0,0 +1,37 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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 hw_batching.h
|
||||
/// \brief Draw call batching and related things.
|
||||
|
||||
#ifndef __HWR_BATCHING_H__
|
||||
#define __HWR_BATCHING_H__
|
||||
|
||||
#include "hw_defs.h"
|
||||
#include "hw_data.h"
|
||||
#include "hw_drv.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FSurfaceInfo surf;// surf also has its own polyflags for some reason, but it seems unused
|
||||
unsigned int vertsIndex;// location of verts in unsortedVertexArray
|
||||
FUINT numVerts;
|
||||
FBITFIELD polyFlags;
|
||||
GLMipmap_t *texture;
|
||||
int shader;
|
||||
// this tells batching that the plane belongs to a horizon line and must be drawn in correct order with the skywalls
|
||||
boolean horizonSpecial;
|
||||
} PolygonArrayEntry;
|
||||
|
||||
void HWR_StartBatching(void);
|
||||
void HWR_SetCurrentTexture(GLMipmap_t *texture);
|
||||
void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader, boolean horizonSpecial);
|
||||
void HWR_RenderBatches(void);
|
||||
|
||||
#endif
|
|
@ -1,19 +1,12 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// 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
|
||||
/// \file hw_bsp.c
|
||||
/// \brief convert SRB2 map
|
||||
|
||||
#include "../doomdef.h"
|
||||
|
@ -887,12 +880,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++)
|
||||
|
|
|
@ -1,20 +1,13 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// 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
|
||||
/// \file hw_cache.c
|
||||
/// \brief load and convert graphics to the hardware format
|
||||
|
||||
#include "../doomdef.h"
|
||||
|
@ -22,6 +15,7 @@
|
|||
#ifdef HWRENDER
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_batching.h"
|
||||
|
||||
#include "../doomstat.h" //gamemode
|
||||
#include "../i_video.h" //rendermode
|
||||
|
@ -33,9 +27,6 @@
|
|||
#include "../r_patch.h"
|
||||
#include "../p_setup.h"
|
||||
|
||||
// Values set after a call to HWR_ResizeBlock()
|
||||
static INT32 blocksize, blockwidth, blockheight;
|
||||
|
||||
INT32 patchformat = GR_TEXFMT_AP_88; // use alpha for holes
|
||||
INT32 textureformat = GR_TEXFMT_P_8; // use chromakey for hole
|
||||
|
||||
|
@ -234,11 +225,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)
|
||||
// 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;
|
||||
else
|
||||
alpha = 0xff;
|
||||
|
||||
// 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 ?)
|
||||
|
@ -308,13 +299,13 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
|
|||
if (pwidth <= 0 || pheight <= 0)
|
||||
return;
|
||||
|
||||
ncols = (pwidth * pblockwidth) / pwidth;
|
||||
ncols = pwidth;
|
||||
|
||||
// source advance
|
||||
xfrac = 0;
|
||||
xfracstep = (pwidth << FRACBITS) / pblockwidth;
|
||||
yfracstep = (pheight << FRACBITS) / pblockheight;
|
||||
scale_y = (pblockheight << FRACBITS) / pheight;
|
||||
xfracstep = FRACUNIT;
|
||||
yfracstep = FRACUNIT;
|
||||
scale_y = FRACUNIT;
|
||||
|
||||
bpp = format2bpp[mipmap->grInfo.format];
|
||||
|
||||
|
@ -322,7 +313,7 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
|
|||
I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp);
|
||||
|
||||
// NOTE: should this actually be pblockwidth*bpp?
|
||||
blockmodulo = blockwidth*bpp;
|
||||
blockmodulo = pblockwidth*bpp;
|
||||
|
||||
// Draw each column to the block cache
|
||||
for (; ncols--; block += bpp, xfrac += xfracstep)
|
||||
|
@ -415,7 +406,7 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
|||
I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp);
|
||||
|
||||
// NOTE: should this actually be pblockwidth*bpp?
|
||||
blockmodulo = blockwidth*bpp;
|
||||
blockmodulo = pblockwidth*bpp;
|
||||
|
||||
// Draw each column to the block cache
|
||||
for (block += col*bpp; ncols--; block += bpp, xfrac += xfracstep)
|
||||
|
@ -433,142 +424,12 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// resize the patch to be 3dfx compliant
|
||||
// set : blocksize = blockwidth * blockheight (no bpp used)
|
||||
// blockwidth
|
||||
// blockheight
|
||||
//note : 8bit (1 byte per pixel) palettized format
|
||||
static void HWR_ResizeBlock(INT32 originalwidth, INT32 originalheight,
|
||||
GrTexInfo *grInfo)
|
||||
{
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
// Build the full textures from patches.
|
||||
static const GrLOD_t gr_lods[9] =
|
||||
{
|
||||
GR_LOD_LOG2_256,
|
||||
GR_LOD_LOG2_128,
|
||||
GR_LOD_LOG2_64,
|
||||
GR_LOD_LOG2_32,
|
||||
GR_LOD_LOG2_16,
|
||||
GR_LOD_LOG2_8,
|
||||
GR_LOD_LOG2_4,
|
||||
GR_LOD_LOG2_2,
|
||||
GR_LOD_LOG2_1
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GrAspectRatio_t aspect;
|
||||
float max_s;
|
||||
float max_t;
|
||||
} booring_aspect_t;
|
||||
|
||||
static const booring_aspect_t gr_aspects[8] =
|
||||
{
|
||||
{GR_ASPECT_LOG2_1x1, 255, 255},
|
||||
{GR_ASPECT_LOG2_2x1, 255, 127},
|
||||
{GR_ASPECT_LOG2_4x1, 255, 63},
|
||||
{GR_ASPECT_LOG2_8x1, 255, 31},
|
||||
|
||||
{GR_ASPECT_LOG2_1x1, 255, 255},
|
||||
{GR_ASPECT_LOG2_1x2, 127, 255},
|
||||
{GR_ASPECT_LOG2_1x4, 63, 255},
|
||||
{GR_ASPECT_LOG2_1x8, 31, 255}
|
||||
};
|
||||
|
||||
INT32 j,k;
|
||||
INT32 max,min;
|
||||
#else
|
||||
(void)grInfo;
|
||||
#endif
|
||||
|
||||
// find a power of 2 width/height
|
||||
if (cv_grrounddown.value)
|
||||
{
|
||||
blockwidth = 256;
|
||||
while (originalwidth < blockwidth)
|
||||
blockwidth >>= 1;
|
||||
if (blockwidth < 1)
|
||||
I_Error("3D GenerateTexture : too small");
|
||||
|
||||
blockheight = 256;
|
||||
while (originalheight < blockheight)
|
||||
blockheight >>= 1;
|
||||
if (blockheight < 1)
|
||||
I_Error("3D GenerateTexture : too small");
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
//size up to nearest power of 2
|
||||
blockwidth = 1;
|
||||
while (blockwidth < originalwidth)
|
||||
blockwidth <<= 1;
|
||||
// scale down the original graphics to fit in 256
|
||||
if (blockwidth > 2048)
|
||||
blockwidth = 2048;
|
||||
//I_Error("3D GenerateTexture : too big");
|
||||
|
||||
//size up to nearest power of 2
|
||||
blockheight = 1;
|
||||
while (blockheight < originalheight)
|
||||
blockheight <<= 1;
|
||||
// scale down the original graphics to fit in 256
|
||||
if (blockheight > 2048)
|
||||
blockheight = 2048;
|
||||
//I_Error("3D GenerateTexture : too big");
|
||||
#else
|
||||
blockwidth = originalwidth;
|
||||
blockheight = originalheight;
|
||||
#endif
|
||||
}
|
||||
|
||||
// do the boring LOD stuff.. blech!
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
if (blockwidth >= blockheight)
|
||||
{
|
||||
max = blockwidth;
|
||||
min = blockheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
max = blockheight;
|
||||
min = blockwidth;
|
||||
}
|
||||
|
||||
for (k = 2048, j = 0; k > max; j++)
|
||||
k>>=1;
|
||||
grInfo->smallLodLog2 = gr_lods[j];
|
||||
grInfo->largeLodLog2 = gr_lods[j];
|
||||
|
||||
for (k = max, j = 0; k > min && j < 4; j++)
|
||||
k>>=1;
|
||||
// aspect ratio too small for 3Dfx (eg: 8x128 is 1x16 : use 1x8)
|
||||
if (j == 4)
|
||||
{
|
||||
j = 3;
|
||||
//CONS_Debug(DBG_RENDER, "HWR_ResizeBlock : bad aspect ratio %dx%d\n", blockwidth,blockheight);
|
||||
if (blockwidth < blockheight)
|
||||
blockwidth = max>>3;
|
||||
else
|
||||
blockheight = max>>3;
|
||||
}
|
||||
if (blockwidth < blockheight)
|
||||
j += 4;
|
||||
grInfo->aspectRatioLog2 = gr_aspects[j].aspect;
|
||||
#endif
|
||||
|
||||
blocksize = blockwidth * blockheight;
|
||||
|
||||
//CONS_Debug(DBG_RENDER, "Width is %d, Height is %d\n", blockwidth, blockheight);
|
||||
}
|
||||
|
||||
static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
|
||||
{
|
||||
UINT8 *block;
|
||||
INT32 bpp, i;
|
||||
UINT16 bu16 = ((0x00 <<8) | HWR_PATCHES_CHROMAKEY_COLORINDEX);
|
||||
INT32 blocksize = (grMipmap->width * grMipmap->height);
|
||||
|
||||
bpp = format2bpp[grMipmap->grInfo.format];
|
||||
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->grInfo.data));
|
||||
|
@ -599,6 +460,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
|
|||
texpatch_t *patch;
|
||||
patch_t *realpatch;
|
||||
UINT8 *pdata;
|
||||
INT32 blockwidth, blockheight, blocksize;
|
||||
|
||||
INT32 i;
|
||||
boolean skyspecial = false; //poor hack for Legacy large skies..
|
||||
|
@ -619,11 +481,13 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
|
|||
else
|
||||
grtex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
|
||||
|
||||
HWR_ResizeBlock (texture->width, texture->height, &grtex->mipmap.grInfo);
|
||||
grtex->mipmap.width = (UINT16)blockwidth;
|
||||
grtex->mipmap.height = (UINT16)blockheight;
|
||||
grtex->mipmap.width = (UINT16)texture->width;
|
||||
grtex->mipmap.height = (UINT16)texture->height;
|
||||
grtex->mipmap.grInfo.format = textureformat;
|
||||
|
||||
blockwidth = texture->width;
|
||||
blockheight = texture->height;
|
||||
blocksize = (blockwidth * blockheight);
|
||||
block = MakeBlock(&grtex->mipmap);
|
||||
|
||||
if (skyspecial) //Hurdler: not efficient, but better than holes in the sky (and it's done only at level loading)
|
||||
|
@ -692,8 +556,6 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
|
|||
// patch may be NULL if grMipmap has been initialised already and makebitmap is false
|
||||
void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap)
|
||||
{
|
||||
INT32 newwidth, newheight;
|
||||
|
||||
#ifndef NO_PNG_LUMPS
|
||||
// lump is a png so convert it
|
||||
size_t len = W_LumpLengthPwad(grPatch->wadnum, grPatch->lumpnum);
|
||||
|
@ -712,51 +574,32 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm
|
|||
grPatch->leftoffset = SHORT(patch->leftoffset);
|
||||
grPatch->topoffset = SHORT(patch->topoffset);
|
||||
|
||||
// find the good 3dfx size (boring spec)
|
||||
HWR_ResizeBlock (SHORT(patch->width), SHORT(patch->height), &grMipmap->grInfo);
|
||||
grMipmap->width = (UINT16)blockwidth;
|
||||
grMipmap->height = (UINT16)blockheight;
|
||||
grMipmap->width = grMipmap->height = 1;
|
||||
while (grMipmap->width < grPatch->width) grMipmap->width <<= 1;
|
||||
while (grMipmap->height < grPatch->height) grMipmap->height <<= 1;
|
||||
|
||||
// no wrap around, no chroma key
|
||||
grMipmap->flags = 0;
|
||||
// setup the texture info
|
||||
grMipmap->grInfo.format = patchformat;
|
||||
}
|
||||
else
|
||||
{
|
||||
blockwidth = grMipmap->width;
|
||||
blockheight = grMipmap->height;
|
||||
blocksize = blockwidth * blockheight;
|
||||
|
||||
//grPatch->max_s = grPatch->max_t = 1.0f;
|
||||
grPatch->max_s = (float)grPatch->width / (float)grMipmap->width;
|
||||
grPatch->max_t = (float)grPatch->height / (float)grMipmap->height;
|
||||
}
|
||||
|
||||
Z_Free(grMipmap->grInfo.data);
|
||||
grMipmap->grInfo.data = NULL;
|
||||
|
||||
// if rounddown, rounddown patches as well as textures
|
||||
if (cv_grrounddown.value)
|
||||
{
|
||||
newwidth = blockwidth;
|
||||
newheight = blockheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
// no rounddown, do not size up patches, so they don't look 'scaled'
|
||||
newwidth = min(grPatch->width, blockwidth);
|
||||
newheight = min(grPatch->height, blockheight);
|
||||
}
|
||||
|
||||
if (makebitmap)
|
||||
{
|
||||
MakeBlock(grMipmap);
|
||||
|
||||
HWR_DrawPatchInCache(grMipmap,
|
||||
newwidth, newheight,
|
||||
grMipmap->width, grMipmap->height,
|
||||
grPatch->width, grPatch->height,
|
||||
patch);
|
||||
}
|
||||
|
||||
grPatch->max_s = (float)newwidth / (float)blockwidth;
|
||||
grPatch->max_t = (float)newheight / (float)blockheight;
|
||||
}
|
||||
|
||||
|
||||
|
@ -896,8 +739,11 @@ GLTexture_t *HWR_GetTexture(INT32 tex)
|
|||
if (!grtex->mipmap.grInfo.data && !grtex->mipmap.downloaded)
|
||||
HWR_GenerateTexture(tex, grtex);
|
||||
|
||||
// Tell the hardware driver to bind the current texture to the flat's mipmap
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grtex->mipmap.downloaded)
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
|
||||
HWR_SetCurrentTexture(&grtex->mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(grtex->mipmap.grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
|
@ -910,11 +756,6 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
|||
size_t size, pflatsize;
|
||||
|
||||
// setup the texture info
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
grMipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_64;
|
||||
grMipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_64;
|
||||
grMipmap->grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
|
||||
#endif
|
||||
grMipmap->grInfo.format = GR_TEXFMT_P_8;
|
||||
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
|
||||
|
||||
|
@ -957,15 +798,7 @@ static void HWR_CacheTextureAsFlat(GLMipmap_t *grMipmap, INT32 texturenum)
|
|||
{
|
||||
UINT8 *flat;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
// setup the texture info
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
grMipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_64;
|
||||
grMipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_64;
|
||||
grMipmap->grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
|
||||
#endif
|
||||
grMipmap->grInfo.format = GR_TEXFMT_P_8;
|
||||
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
|
||||
|
||||
|
@ -985,14 +818,15 @@ void HWR_LiterallyGetFlat(lumpnum_t flatlumpnum)
|
|||
if (flatlumpnum == LUMPERROR)
|
||||
return;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
if (!grmip->downloaded && !grmip->grInfo.data)
|
||||
HWR_CacheFlat(grmip, flatlumpnum);
|
||||
|
||||
HWD.pfnSetTexture(grmip);
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grmip->downloaded)
|
||||
HWD.pfnSetTexture(grmip);
|
||||
|
||||
HWR_SetCurrentTexture(grmip);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
|
@ -1026,14 +860,17 @@ void HWR_GetLevelFlat(levelflat_t *levelflat)
|
|||
if (!grtex->mipmap.grInfo.data && !grtex->mipmap.downloaded)
|
||||
HWR_CacheTextureAsFlat(&grtex->mipmap, texturenum);
|
||||
|
||||
// Tell the hardware driver to bind the current texture to the flat's mipmap
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grtex->mipmap.downloaded)
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
|
||||
HWR_SetCurrentTexture(&grtex->mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(grtex->mipmap.grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
else // set no texture
|
||||
HWD.pfnSetTexture(NULL);
|
||||
HWR_SetCurrentTexture(NULL);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1055,7 +892,11 @@ static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
|
|||
Z_Free(patch);
|
||||
}
|
||||
|
||||
HWD.pfnSetTexture(grmip);
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grmip->downloaded)
|
||||
HWD.pfnSetTexture(grmip);
|
||||
|
||||
HWR_SetCurrentTexture(grmip);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(grmip->grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
|
@ -1066,9 +907,6 @@ static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
|
|||
// -----------------+
|
||||
void HWR_GetPatch(GLPatch_t *gpatch)
|
||||
{
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
// is it in hardware cache
|
||||
if (!gpatch->mipmap->downloaded && !gpatch->mipmap->grInfo.data)
|
||||
{
|
||||
|
@ -1085,7 +923,11 @@ void HWR_GetPatch(GLPatch_t *gpatch)
|
|||
Z_Free(ptr);
|
||||
}
|
||||
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!gpatch->mipmap->downloaded)
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
|
||||
HWR_SetCurrentTexture(gpatch->mipmap);
|
||||
|
||||
// The system-memory patch data can be purged now.
|
||||
Z_ChangeTag(gpatch->mipmap->grInfo.data, PU_HWRCACHE_UNLOCKED);
|
||||
|
@ -1099,9 +941,6 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
|
|||
{
|
||||
GLMipmap_t *grmip, *newmip;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
if (colormap == colormaps || colormap == NULL)
|
||||
{
|
||||
// Load the default (green) color in doom cache (temporary?) AND hardware cache
|
||||
|
@ -1225,19 +1064,12 @@ static void HWR_DrawPicInCache(UINT8 *block, INT32 pblockwidth, INT32 pblockheig
|
|||
// -----------------+
|
||||
GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
|
||||
{
|
||||
GLPatch_t *grpatch;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
grpatch = HWR_GetCachedGLPatch(lumpnum);
|
||||
|
||||
GLPatch_t *grpatch = HWR_GetCachedGLPatch(lumpnum);
|
||||
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->grInfo.data)
|
||||
{
|
||||
pic_t *pic;
|
||||
UINT8 *block;
|
||||
size_t len;
|
||||
INT32 newwidth, newheight;
|
||||
|
||||
pic = W_CacheLumpNum(lumpnum, PU_CACHE);
|
||||
grpatch->width = SHORT(pic->width);
|
||||
|
@ -1247,10 +1079,8 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
|
|||
grpatch->leftoffset = 0;
|
||||
grpatch->topoffset = 0;
|
||||
|
||||
// find the good 3dfx size (boring spec)
|
||||
HWR_ResizeBlock (grpatch->width, grpatch->height, &grpatch->mipmap->grInfo);
|
||||
grpatch->mipmap->width = (UINT16)blockwidth;
|
||||
grpatch->mipmap->height = (UINT16)blockheight;
|
||||
grpatch->mipmap->width = (UINT16)grpatch->width;
|
||||
grpatch->mipmap->height = (UINT16)grpatch->height;
|
||||
|
||||
if (pic->mode == PALETTE)
|
||||
grpatch->mipmap->grInfo.format = textureformat; // can be set by driver
|
||||
|
@ -1262,30 +1092,16 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
|
|||
// allocate block
|
||||
block = MakeBlock(grpatch->mipmap);
|
||||
|
||||
// if rounddown, rounddown patches as well as textures
|
||||
if (cv_grrounddown.value)
|
||||
{
|
||||
newwidth = blockwidth;
|
||||
newheight = blockheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
// no rounddown, do not size up patches, so they don't look 'scaled'
|
||||
newwidth = min(SHORT(pic->width),blockwidth);
|
||||
newheight = min(SHORT(pic->height),blockheight);
|
||||
}
|
||||
|
||||
|
||||
if (grpatch->width == blockwidth &&
|
||||
grpatch->height == blockheight &&
|
||||
if (grpatch->width == SHORT(pic->width) &&
|
||||
grpatch->height == SHORT(pic->height) &&
|
||||
format2bpp[grpatch->mipmap->grInfo.format] == format2bpp[picmode2GR[pic->mode]])
|
||||
{
|
||||
// no conversion needed
|
||||
M_Memcpy(grpatch->mipmap->grInfo.data, pic->data,len);
|
||||
}
|
||||
else
|
||||
HWR_DrawPicInCache(block, newwidth, newheight,
|
||||
blockwidth*format2bpp[grpatch->mipmap->grInfo.format],
|
||||
HWR_DrawPicInCache(block, SHORT(pic->width), SHORT(pic->height),
|
||||
SHORT(pic->width)*format2bpp[grpatch->mipmap->grInfo.format],
|
||||
pic,
|
||||
format2bpp[grpatch->mipmap->grInfo.format]);
|
||||
|
||||
|
@ -1293,8 +1109,7 @@ GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
|
|||
Z_ChangeTag(block, PU_HWRCACHE_UNLOCKED);
|
||||
|
||||
grpatch->mipmap->flags = 0;
|
||||
grpatch->max_s = (float)newwidth / (float)blockwidth;
|
||||
grpatch->max_t = (float)newheight / (float)blockheight;
|
||||
grpatch->max_s = grpatch->max_t = 1.0f;
|
||||
}
|
||||
HWD.pfnSetTexture(grpatch->mipmap);
|
||||
//CONS_Debug(DBG_RENDER, "picloaded at %x as texture %d\n",grpatch->mipmap.grInfo.data, grpatch->mipmap.downloaded);
|
||||
|
@ -1330,7 +1145,7 @@ static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32
|
|||
{
|
||||
INT32 i,j;
|
||||
fixed_t posx, posy, stepx, stepy;
|
||||
UINT8 *block = mipmap->grInfo.data; // places the data directly into here, it already has the space allocated from HWR_ResizeBlock
|
||||
UINT8 *block = mipmap->grInfo.data; // places the data directly into here
|
||||
UINT8 *flat;
|
||||
UINT8 *dest, *src, texel;
|
||||
RGBA_t col;
|
||||
|
@ -1345,7 +1160,7 @@ static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32
|
|||
for (j = 0; j < pblockheight; j++)
|
||||
{
|
||||
posx = 0;
|
||||
dest = &block[j*blockwidth]; // 1bpp
|
||||
dest = &block[j*(mipmap->width)]; // 1bpp
|
||||
src = &flat[(posy>>FRACBITS)*SHORT(fmwidth)];
|
||||
for (i = 0; i < pblockwidth;i++)
|
||||
{
|
||||
|
@ -1399,14 +1214,12 @@ static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
|
|||
}
|
||||
|
||||
// Thankfully, this will still work for this scenario
|
||||
HWR_ResizeBlock(fmwidth, fmheight, &grMipmap->grInfo);
|
||||
|
||||
grMipmap->width = blockwidth;
|
||||
grMipmap->height = blockheight;
|
||||
grMipmap->width = fmwidth;
|
||||
grMipmap->height = fmheight;
|
||||
|
||||
MakeBlock(grMipmap);
|
||||
|
||||
HWR_DrawFadeMaskInCache(grMipmap, blockwidth, blockheight, fademasklumpnum, fmwidth, fmheight);
|
||||
HWR_DrawFadeMaskInCache(grMipmap, fmwidth, fmheight, fademasklumpnum, fmwidth, fmheight);
|
||||
|
||||
// I DO need to convert this because it isn't power of 2 and we need the alpha
|
||||
}
|
||||
|
@ -1414,13 +1227,7 @@ static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
|
|||
|
||||
void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
|
||||
{
|
||||
GLMipmap_t *grmip;
|
||||
|
||||
if (needpatchflush)
|
||||
W_FlushCachedPatches();
|
||||
|
||||
grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
|
||||
GLMipmap_t *grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
if (!grmip->downloaded && !grmip->grInfo.data)
|
||||
HWR_CacheFadeMask(grmip, fademasklumpnum);
|
||||
|
||||
|
|
|
@ -78,8 +78,8 @@
|
|||
#include "r_opengl/r_opengl.h"
|
||||
|
||||
#ifdef HAVE_SPHEREFRUSTRUM
|
||||
static GLfloat viewMatrix[16];
|
||||
static GLfloat projMatrix[16];
|
||||
static GLdouble viewMatrix[16];
|
||||
static GLdouble projMatrix[16];
|
||||
float frustum[6][4];
|
||||
#endif
|
||||
|
||||
|
@ -320,12 +320,12 @@ void gld_clipper_Clear(void)
|
|||
|
||||
#define RMUL (1.6f/1.333333f)
|
||||
|
||||
angle_t gld_FrustumAngle(void)
|
||||
angle_t gld_FrustumAngle(angle_t tiltangle)
|
||||
{
|
||||
double floatangle;
|
||||
angle_t a1;
|
||||
|
||||
float tilt = (float)fabs(((double)(int)aimingangle) / ANG1);
|
||||
float tilt = (float)fabs(((double)(int)tiltangle) / ANG1);
|
||||
|
||||
// NEWCLIP TODO: SRB2CBTODO: make a global render_fov for this function
|
||||
|
||||
|
@ -339,7 +339,7 @@ angle_t gld_FrustumAngle(void)
|
|||
}
|
||||
|
||||
// If the pitch is larger than this you can look all around at a FOV of 90
|
||||
if (abs((signed)aimingangle) > 46 * ANG1)
|
||||
if (abs((signed)tiltangle) > 46 * ANG1)
|
||||
return 0xffffffff;
|
||||
|
||||
// ok, this is a gross hack that barely works...
|
||||
|
@ -352,7 +352,7 @@ angle_t gld_FrustumAngle(void)
|
|||
}
|
||||
|
||||
// SRB2CB I don't think used any of this stuff, let's disable for now since SRB2 probably doesn't want it either
|
||||
// compiler complains about (p)glGetDoublev anyway, in case anyone wants this
|
||||
// compiler complains about (p)glGetFloatv anyway, in case anyone wants this
|
||||
// only r_opengl.c can use the base gl funcs as it turns out, that's a problem for whoever wants sphere frustum checks
|
||||
// btw to renable define HAVE_SPHEREFRUSTRUM in hw_clip.h
|
||||
#ifdef HAVE_SPHEREFRUSTRUM
|
||||
|
@ -381,7 +381,7 @@ void gld_FrustrumSetup(void)
|
|||
float t;
|
||||
float clip[16];
|
||||
|
||||
pglGeFloatv(GL_PROJECTION_MATRIX, projMatrix);
|
||||
pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix);
|
||||
pglGetFloatv(GL_MODELVIEW_MATRIX, viewMatrix);
|
||||
|
||||
clip[0] = CALCMATRIX(0, 0, 1, 4, 2, 8, 3, 12);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
boolean gld_clipper_SafeCheckRange(angle_t startAngle, angle_t endAngle);
|
||||
void gld_clipper_SafeAddClipRange(angle_t startangle, angle_t endangle);
|
||||
void gld_clipper_Clear(void);
|
||||
angle_t gld_FrustumAngle(void);
|
||||
angle_t gld_FrustumAngle(angle_t tiltangle);
|
||||
#ifdef HAVE_SPHEREFRUSTRUM
|
||||
void gld_FrustrumSetup(void);
|
||||
boolean gld_SphereInFrustum(float x, float y, float z, float radius);
|
||||
|
|
|
@ -1,21 +1,14 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// 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
|
||||
/// \brief defines structures and exports for the standard 3D driver DLL used by Doom Legacy
|
||||
/// \file hw_data.h
|
||||
/// \brief defines structures and exports for the hardware interface used by Sonic Robo Blast 2
|
||||
|
||||
#ifndef _HWR_DATA_
|
||||
#define _HWR_DATA_
|
||||
|
|
|
@ -1,24 +1,19 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// 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
|
||||
/// \file hw_defs.h
|
||||
/// \brief 3D hardware renderer definitions
|
||||
|
||||
#ifndef _HWR_DEFS_
|
||||
#define _HWR_DEFS_
|
||||
#include "../doomtype.h"
|
||||
#include "../r_defs.h"
|
||||
|
||||
#define ZCLIP_PLANE 4.0f // Used for the actual game drawing
|
||||
#define NZCLIP_PLANE 0.9f // Seems to be only used for the HUD and screen textures
|
||||
|
@ -82,16 +77,18 @@ typedef struct
|
|||
// Simple 3D vector
|
||||
typedef struct FVector
|
||||
{
|
||||
FLOAT x,y,z;
|
||||
FLOAT x,y,z;
|
||||
} FVector;
|
||||
|
||||
// 3D model vector (coords + texture coords)
|
||||
typedef struct
|
||||
{
|
||||
//FVector Point;
|
||||
FLOAT x,y,z;
|
||||
FLOAT s,t,w; // texture coordinates
|
||||
} v3d_t, wallVert3D;
|
||||
// ======================
|
||||
// wallVert3D
|
||||
// ----------------------
|
||||
// :crab: IS GONE! :crab:
|
||||
// ======================
|
||||
|
||||
// -----------
|
||||
// structures
|
||||
// -----------
|
||||
|
||||
//Hurdler: Transform (coords + angles)
|
||||
//BP: transform order : scale(rotation_x(rotation_y(translation(v))))
|
||||
|
@ -123,15 +120,16 @@ typedef struct
|
|||
#ifdef USE_FTRANSFORM_MIRROR
|
||||
boolean mirror; // SRB2Kart: Encore Mode
|
||||
#endif
|
||||
boolean shearing; // 14042019
|
||||
float viewaiming; // 17052019
|
||||
} FTransform;
|
||||
|
||||
// Transformed vector, as passed to HWR API
|
||||
typedef struct
|
||||
{
|
||||
FLOAT x,y,z;
|
||||
FUINT argb; // flat-shaded color
|
||||
FLOAT sow; // s texture ordinate (s over w)
|
||||
FLOAT tow; // t texture ordinate (t over w)
|
||||
FLOAT s; // s texture ordinate (s over w)
|
||||
FLOAT t; // t texture ordinate (t over w)
|
||||
} FOutVector;
|
||||
|
||||
|
||||
|
@ -162,10 +160,10 @@ enum EPolyFlags
|
|||
PF_Invisible = 0x00000400, // Disable write to color buffer
|
||||
PF_Decal = 0x00000800, // Enable polygon offset
|
||||
PF_Modulated = 0x00001000, // Modulation (multiply output with constant ARGB)
|
||||
// When set, pass the color constant into the FSurfaceInfo -> FlatColor
|
||||
// When set, pass the color constant into the FSurfaceInfo -> PolyColor
|
||||
PF_NoTexture = 0x00002000, // Use the small white texture
|
||||
PF_Corona = 0x00004000, // Tell the rendrer we are drawing a corona
|
||||
PF_Unused = 0x00008000, // Unused
|
||||
PF_Ripple = 0x00008000, // Water shader effect
|
||||
PF_RemoveYWrap = 0x00010000, // Force clamp texture on Y
|
||||
PF_ForceWrapX = 0x00020000, // Force repeat texture on X
|
||||
PF_ForceWrapY = 0x00040000, // Force repeat texture on Y
|
||||
|
@ -178,7 +176,6 @@ enum EPolyFlags
|
|||
enum ESurfFlags
|
||||
{
|
||||
SF_DYNLIGHT = 0x00000001,
|
||||
|
||||
};
|
||||
|
||||
enum ETextureFlags
|
||||
|
@ -190,38 +187,36 @@ enum ETextureFlags
|
|||
TF_TRANSPARENT = 0x00000040, // texture with some alpha == 0
|
||||
};
|
||||
|
||||
#ifdef TODO
|
||||
struct FTextureInfo
|
||||
{
|
||||
FUINT Width; // Pixels
|
||||
FUINT Height; // Pixels
|
||||
FUBYTE *TextureData; // Image data
|
||||
FUINT Format; // FORMAT_RGB, ALPHA ...
|
||||
FBITFIELD Flags; // Flags to tell driver about texture (see ETextureFlags)
|
||||
void DriverExtra; // (OpenGL texture object nr, ...)
|
||||
// chromakey enabled,...
|
||||
|
||||
struct FTextureInfo *Next; // Manage list of downloaded textures.
|
||||
};
|
||||
#else
|
||||
typedef struct GLMipmap_s FTextureInfo;
|
||||
#endif
|
||||
|
||||
// jimita 14032019
|
||||
struct FLightInfo
|
||||
{
|
||||
FUINT light_level;
|
||||
FUINT fade_start;
|
||||
FUINT fade_end;
|
||||
};
|
||||
typedef struct FLightInfo FLightInfo;
|
||||
|
||||
// Description of a renderable surface
|
||||
struct FSurfaceInfo
|
||||
{
|
||||
FUINT PolyFlags; // Surface flags -- UNUSED YET --
|
||||
RGBA_t FlatColor; // Flat-shaded color used with PF_Modulated mode
|
||||
FUINT PolyFlags;
|
||||
RGBA_t PolyColor;
|
||||
RGBA_t TintColor;
|
||||
RGBA_t FadeColor;
|
||||
FLightInfo LightInfo; // jimita 14032019
|
||||
};
|
||||
typedef struct FSurfaceInfo FSurfaceInfo;
|
||||
|
||||
#define GL_DEFAULTMIX 0x00000000
|
||||
#define GL_DEFAULTFOG 0xFF000000
|
||||
|
||||
//Hurdler: added for backward compatibility
|
||||
enum hwdsetspecialstate
|
||||
{
|
||||
HWD_SET_MODEL_LIGHTING = 1,
|
||||
HWD_SET_FOG_MODE,
|
||||
HWD_SET_FOG_COLOR,
|
||||
HWD_SET_FOG_DENSITY,
|
||||
HWD_SET_SHADERS,
|
||||
HWD_SET_TEXTUREFILTERMODE,
|
||||
HWD_SET_TEXTUREANISOTROPICMODE,
|
||||
HWD_NUMSTATE
|
||||
|
@ -229,6 +224,15 @@ enum hwdsetspecialstate
|
|||
|
||||
typedef enum hwdsetspecialstate hwdspecialstate_t;
|
||||
|
||||
// Lactozilla: Shader info
|
||||
// Generally set at the start of the frame.
|
||||
enum hwdshaderinfo
|
||||
{
|
||||
HWD_SHADERINFO_LEVELTIME = 1,
|
||||
};
|
||||
|
||||
typedef enum hwdshaderinfo hwdshaderinfo_t;
|
||||
|
||||
enum hwdfiltermode
|
||||
{
|
||||
HWD_SET_TEXTUREFILTER_POINTSAMPLED,
|
||||
|
|
|
@ -1,19 +1,12 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2005 by Sonic Team Junior.
|
||||
//
|
||||
// Copyright (C) 2005 by SRB2 Jr. Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// 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
|
||||
/// \file hw_dll.h
|
||||
/// \brief Win32 DLL and Shared Objects API definitions
|
||||
|
||||
#ifndef __HWR_DLL_H__
|
||||
|
@ -54,8 +47,6 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
typedef void (*I_Error_t) (const char *error, ...) FUNCIERROR;
|
||||
|
||||
// ==========================================================================
|
||||
// MATHS
|
||||
// ==========================================================================
|
||||
|
@ -63,7 +54,7 @@ typedef void (*I_Error_t) (const char *error, ...) FUNCIERROR;
|
|||
// Constants
|
||||
#define DEGREE (0.017453292519943295769236907684883l) // 2*PI/360
|
||||
|
||||
void DBG_Printf(const char *lpFmt, ...) /*FUNCPRINTF*/;
|
||||
void GL_DBG_Printf(const char *format, ...) /*FUNCPRINTF*/;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// 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
|
||||
/// \file hw_draw.c
|
||||
/// \brief miscellaneous drawing (mainly 2d)
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
@ -23,6 +17,7 @@
|
|||
#include "../doomdef.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
|
||||
|
@ -43,9 +38,6 @@
|
|||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
float gr_patch_scalex;
|
||||
float gr_patch_scaley;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
|
@ -65,9 +57,6 @@ typedef struct
|
|||
#if defined(_MSC_VER)
|
||||
#pragma pack()
|
||||
#endif
|
||||
typedef UINT8 GLRGB[3];
|
||||
|
||||
#define BLENDMODE PF_Translucent
|
||||
|
||||
static UINT8 softwaretranstogl[11] = { 0, 25, 51, 76,102,127,153,178,204,229,255};
|
||||
static UINT8 softwaretranstogl_hi[11] = { 0, 51,102,153,204,255,255,255,255,255,255};
|
||||
|
@ -121,12 +110,12 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
|
|||
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = gpatch->max_s;
|
||||
v[0].tow = v[1].tow = 0.0f;
|
||||
v[2].tow = v[3].tow = gpatch->max_t;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = gpatch->max_s;
|
||||
v[0].t = v[1].t = 0.0f;
|
||||
v[2].t = v[3].t = gpatch->max_t;
|
||||
|
||||
flags = BLENDMODE|PF_Clip|PF_NoZClip|PF_NoDepthTest;
|
||||
flags = PF_Translucent|PF_NoDepthTest;
|
||||
|
||||
if (option & V_WRAPX)
|
||||
flags |= PF_ForceWrapX;
|
||||
|
@ -291,7 +280,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)
|
||||
{
|
||||
|
@ -356,19 +345,19 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
|||
|
||||
if (option & V_FLIP)
|
||||
{
|
||||
v[0].sow = v[3].sow = gpatch->max_s;
|
||||
v[2].sow = v[1].sow = 0.0f;
|
||||
v[0].s = v[3].s = gpatch->max_s;
|
||||
v[2].s = v[1].s = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = gpatch->max_s;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = gpatch->max_s;
|
||||
}
|
||||
|
||||
v[0].tow = v[1].tow = 0.0f;
|
||||
v[2].tow = v[3].tow = gpatch->max_t;
|
||||
v[0].t = v[1].t = 0.0f;
|
||||
v[2].t = v[3].t = gpatch->max_t;
|
||||
|
||||
flags = BLENDMODE|PF_Clip|PF_NoZClip|PF_NoDepthTest;
|
||||
flags = PF_Translucent|PF_NoDepthTest;
|
||||
|
||||
if (option & V_WRAPX)
|
||||
flags |= PF_ForceWrapX;
|
||||
|
@ -379,11 +368,11 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
|||
if (alphalevel)
|
||||
{
|
||||
FSurfaceInfo Surf;
|
||||
Surf.FlatColor.s.red = Surf.FlatColor.s.green = Surf.FlatColor.s.blue = 0xff;
|
||||
if (alphalevel == 13) Surf.FlatColor.s.alpha = softwaretranstogl_lo[st_translucency];
|
||||
else if (alphalevel == 14) Surf.FlatColor.s.alpha = softwaretranstogl[st_translucency];
|
||||
else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[st_translucency];
|
||||
else Surf.FlatColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff;
|
||||
if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[st_translucency];
|
||||
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[st_translucency];
|
||||
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[st_translucency];
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
flags |= PF_Modulated;
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
|
||||
}
|
||||
|
@ -450,7 +439,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)
|
||||
{
|
||||
|
@ -514,19 +503,19 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
|||
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = ((sx )/(float)SHORT(gpatch->width) )*gpatch->max_s;
|
||||
v[0].s = v[3].s = ((sx )/(float)SHORT(gpatch->width) )*gpatch->max_s;
|
||||
if (sx + w > SHORT(gpatch->width))
|
||||
v[2].sow = v[1].sow = gpatch->max_s;
|
||||
v[2].s = v[1].s = gpatch->max_s;
|
||||
else
|
||||
v[2].sow = v[1].sow = ((sx+w)/(float)SHORT(gpatch->width) )*gpatch->max_s;
|
||||
v[2].s = v[1].s = ((sx+w)/(float)SHORT(gpatch->width) )*gpatch->max_s;
|
||||
|
||||
v[0].tow = v[1].tow = ((sy )/(float)SHORT(gpatch->height))*gpatch->max_t;
|
||||
v[0].t = v[1].t = ((sy )/(float)SHORT(gpatch->height))*gpatch->max_t;
|
||||
if (sy + h > SHORT(gpatch->height))
|
||||
v[2].tow = v[3].tow = gpatch->max_t;
|
||||
v[2].t = v[3].t = gpatch->max_t;
|
||||
else
|
||||
v[2].tow = v[3].tow = ((sy+h)/(float)SHORT(gpatch->height))*gpatch->max_t;
|
||||
v[2].t = v[3].t = ((sy+h)/(float)SHORT(gpatch->height))*gpatch->max_t;
|
||||
|
||||
flags = BLENDMODE|PF_Clip|PF_NoZClip|PF_NoDepthTest;
|
||||
flags = PF_Translucent|PF_NoDepthTest;
|
||||
|
||||
if (option & V_WRAPX)
|
||||
flags |= PF_ForceWrapX;
|
||||
|
@ -537,11 +526,11 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
|||
if (alphalevel)
|
||||
{
|
||||
FSurfaceInfo Surf;
|
||||
Surf.FlatColor.s.red = Surf.FlatColor.s.green = Surf.FlatColor.s.blue = 0xff;
|
||||
if (alphalevel == 13) Surf.FlatColor.s.alpha = softwaretranstogl_lo[st_translucency];
|
||||
else if (alphalevel == 14) Surf.FlatColor.s.alpha = softwaretranstogl[st_translucency];
|
||||
else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[st_translucency];
|
||||
else Surf.FlatColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff;
|
||||
if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[st_translucency];
|
||||
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[st_translucency];
|
||||
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[st_translucency];
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
flags |= PF_Modulated;
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
|
||||
}
|
||||
|
@ -569,10 +558,10 @@ void HWR_DrawPic(INT32 x, INT32 y, lumpnum_t lumpnum)
|
|||
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = 0;
|
||||
v[2].sow = v[1].sow = patch->max_s;
|
||||
v[0].tow = v[1].tow = 0;
|
||||
v[2].tow = v[3].tow = patch->max_t;
|
||||
v[0].s = v[3].s = 0;
|
||||
v[2].s = v[1].s = patch->max_s;
|
||||
v[0].t = v[1].t = 0;
|
||||
v[2].t = v[3].t = patch->max_t;
|
||||
|
||||
|
||||
//Hurdler: Boris, the same comment as above... but maybe for pics
|
||||
|
@ -581,7 +570,7 @@ void HWR_DrawPic(INT32 x, INT32 y, lumpnum_t lumpnum)
|
|||
// But then, the question is: why not 0 instead of PF_Masked ?
|
||||
// or maybe PF_Environment ??? (like what I said above)
|
||||
// BP: PF_Environment don't change anything ! and 0 is undifined
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, BLENDMODE | PF_NoDepthTest | PF_Clip | PF_NoZClip);
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, PF_Translucent | PF_NoDepthTest | PF_Clip | PF_NoZClip);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
@ -644,10 +633,10 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
|
|||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
// flat is 64x64 lod and texture offsets are [0.0, 1.0]
|
||||
v[0].sow = v[3].sow = (float)((x & flatflag)/dflatsize);
|
||||
v[2].sow = v[1].sow = (float)(v[0].sow + w/dflatsize);
|
||||
v[0].tow = v[1].tow = (float)((y & flatflag)/dflatsize);
|
||||
v[2].tow = v[3].tow = (float)(v[0].tow + h/dflatsize);
|
||||
v[0].s = v[3].s = (float)((x & flatflag)/dflatsize);
|
||||
v[2].s = v[1].s = (float)(v[0].s + w/dflatsize);
|
||||
v[0].t = v[1].t = (float)((y & flatflag)/dflatsize);
|
||||
v[2].t = v[3].t = (float)(v[0].t + h/dflatsize);
|
||||
|
||||
HWR_LiterallyGetFlat(flatlumpnum);
|
||||
|
||||
|
@ -679,20 +668,20 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
|||
v[2].y = v[3].y = 1.0f;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = 1.0f;
|
||||
v[0].tow = v[1].tow = 1.0f;
|
||||
v[2].tow = v[3].tow = 0.0f;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 1.0f;
|
||||
v[2].t = v[3].t = 0.0f;
|
||||
|
||||
if (color & 0xFF00) // Do COLORMAP fade.
|
||||
{
|
||||
Surf.FlatColor.rgba = UINT2RGBA(0x01010160);
|
||||
Surf.FlatColor.s.alpha = (strength*8);
|
||||
Surf.PolyColor.rgba = UINT2RGBA(0x01010160);
|
||||
Surf.PolyColor.s.alpha = (strength*8);
|
||||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
Surf.FlatColor.rgba = V_GetColor(color).rgba;
|
||||
Surf.FlatColor.s.alpha = softwaretranstogl[strength];
|
||||
Surf.PolyColor.rgba = V_GetColor(color).rgba;
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl[strength];
|
||||
}
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
@ -850,24 +839,22 @@ void HWR_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT16 ac
|
|||
v[0].y = v[1].y = fy;
|
||||
v[2].y = v[3].y = fy - fh;
|
||||
|
||||
//Hurdler: do we still use this argb color? if not, we should remove it
|
||||
v[0].argb = v[1].argb = v[2].argb = v[3].argb = 0xff00ff00; //;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = 1.0f;
|
||||
v[0].tow = v[1].tow = 0.0f;
|
||||
v[2].tow = v[3].tow = 1.0f;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 0.0f;
|
||||
v[2].t = v[3].t = 1.0f;
|
||||
|
||||
if (actualcolor & 0xFF00) // Do COLORMAP fade.
|
||||
{
|
||||
Surf.FlatColor.rgba = UINT2RGBA(0x01010160);
|
||||
Surf.FlatColor.s.alpha = (strength*8);
|
||||
Surf.PolyColor.rgba = UINT2RGBA(0x01010160);
|
||||
Surf.PolyColor.s.alpha = (strength*8);
|
||||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
Surf.FlatColor.rgba = V_GetColor(actualcolor).rgba;
|
||||
Surf.FlatColor.s.alpha = softwaretranstogl[strength];
|
||||
Surf.PolyColor.rgba = V_GetColor(actualcolor).rgba;
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl[strength];
|
||||
}
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
@ -888,13 +875,13 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height)
|
|||
v[2].y = v[3].y = 1.0f;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = 1.0f;
|
||||
v[0].tow = v[1].tow = 1.0f;
|
||||
v[2].tow = v[3].tow = 0.0f;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 1.0f;
|
||||
v[2].t = v[3].t = 0.0f;
|
||||
|
||||
Surf.FlatColor.rgba = UINT2RGBA(color);
|
||||
Surf.FlatColor.s.alpha = 0x80;
|
||||
Surf.PolyColor.rgba = UINT2RGBA(color);
|
||||
Surf.PolyColor.s.alpha = 0x80;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
@ -904,7 +891,11 @@ void HWR_DrawTutorialBack(UINT32 color, INT32 boxheight)
|
|||
{
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
INT32 height = (boxheight * 4) + (boxheight/2)*5; // 4 lines of space plus gaps between and some leeway
|
||||
INT32 height;
|
||||
if (boxheight < 0)
|
||||
height = -boxheight;
|
||||
else
|
||||
height = (boxheight * 4) + (boxheight/2)*5; // 4 lines of space plus gaps between and some leeway
|
||||
|
||||
// setup some neat-o translucency effect
|
||||
|
||||
|
@ -914,13 +905,13 @@ void HWR_DrawTutorialBack(UINT32 color, INT32 boxheight)
|
|||
v[2].y = v[3].y = -1.0f+((height<<1)/(float)vid.height);
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = 1.0f;
|
||||
v[0].tow = v[1].tow = 1.0f;
|
||||
v[2].tow = v[3].tow = 0.0f;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 1.0f;
|
||||
v[2].t = v[3].t = 0.0f;
|
||||
|
||||
Surf.FlatColor.rgba = UINT2RGBA(color);
|
||||
Surf.FlatColor.s.alpha = (color == 0 ? 0xC0 : 0x80); // make black darker, like software
|
||||
Surf.PolyColor.rgba = UINT2RGBA(color);
|
||||
Surf.PolyColor.s.alpha = (color == 0 ? 0xC0 : 0x80); // make black darker, like software
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
@ -1232,17 +1223,15 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT32
|
|||
v[0].y = v[1].y = fy;
|
||||
v[2].y = v[3].y = fy - fh;
|
||||
|
||||
//Hurdler: do we still use this argb color? if not, we should remove it
|
||||
v[0].argb = v[1].argb = v[2].argb = v[3].argb = 0xff00ff00; //;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = 1.0f;
|
||||
v[0].tow = v[1].tow = 0.0f;
|
||||
v[2].tow = v[3].tow = 1.0f;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 0.0f;
|
||||
v[2].t = v[3].t = 1.0f;
|
||||
|
||||
Surf.FlatColor.rgba = UINT2RGBA(actualcolor);
|
||||
Surf.FlatColor.s.alpha = 0x80;
|
||||
Surf.PolyColor.rgba = UINT2RGBA(actualcolor);
|
||||
Surf.PolyColor.s.alpha = 0x80;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
@ -1412,16 +1401,14 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
|||
v[0].y = v[1].y = fy;
|
||||
v[2].y = v[3].y = fy - fh;
|
||||
|
||||
//Hurdler: do we still use this argb color? if not, we should remove it
|
||||
v[0].argb = v[1].argb = v[2].argb = v[3].argb = 0xff00ff00; //;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].sow = v[3].sow = 0.0f;
|
||||
v[2].sow = v[1].sow = 1.0f;
|
||||
v[0].tow = v[1].tow = 0.0f;
|
||||
v[2].tow = v[3].tow = 1.0f;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 0.0f;
|
||||
v[2].t = v[3].t = 1.0f;
|
||||
|
||||
Surf.FlatColor = V_GetColor(color);
|
||||
Surf.PolyColor = V_GetColor(color);
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4,
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
||||
|
|
|
@ -1,20 +1,13 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// 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
|
||||
/// \file hw_drv.h
|
||||
/// \brief imports/exports for the 3D hardware low-level interface API
|
||||
|
||||
#ifndef __HWR_DRV_H__
|
||||
|
@ -32,7 +25,7 @@
|
|||
// STANDARD DLL EXPORTS
|
||||
// ==========================================================================
|
||||
|
||||
EXPORT boolean HWRAPI(Init) (I_Error_t ErrorFunction);
|
||||
EXPORT boolean HWRAPI(Init) (void);
|
||||
#ifndef HAVE_SDL
|
||||
EXPORT void HWRAPI(Shutdown) (void);
|
||||
#endif
|
||||
|
@ -43,10 +36,12 @@ EXPORT void HWRAPI(SetPalette) (RGBA_t *ppal);
|
|||
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl);
|
||||
EXPORT void HWRAPI(Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
|
||||
EXPORT void HWRAPI(DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, UINT32 *IndexArray);
|
||||
EXPORT void HWRAPI(RenderSkyDome) (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform);
|
||||
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags);
|
||||
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FRGBAFloat *ClearColor);
|
||||
EXPORT void HWRAPI(SetTexture) (FTextureInfo *TexInfo);
|
||||
EXPORT void HWRAPI(UpdateTexture) (FTextureInfo *TexInfo);
|
||||
EXPORT void HWRAPI(ReadRect) (INT32 x, INT32 y, INT32 width, INT32 height, INT32 dst_stride, UINT16 *dst_data);
|
||||
EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip);
|
||||
EXPORT void HWRAPI(ClearMipMapCache) (void);
|
||||
|
@ -55,14 +50,11 @@ EXPORT void HWRAPI(ClearMipMapCache) (void);
|
|||
EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
|
||||
|
||||
//Hurdler: added for new development
|
||||
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, INT32 duration, INT32 tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, UINT8 *color);
|
||||
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, INT32 duration, INT32 tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, FSurfaceInfo *Surface);
|
||||
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model);
|
||||
EXPORT void HWRAPI(SetTransform) (FTransform *ptransform);
|
||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
|
||||
EXPORT INT32 HWRAPI(GetRenderVersion) (void);
|
||||
|
||||
#define SCREENVERTS 10
|
||||
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
|
||||
EXPORT void HWRAPI(FlushScreenTextures) (void);
|
||||
EXPORT void HWRAPI(StartScreenWipe) (void);
|
||||
EXPORT void HWRAPI(EndScreenWipe) (void);
|
||||
|
@ -71,6 +63,20 @@ EXPORT void HWRAPI(DrawIntermissionBG) (void);
|
|||
EXPORT void HWRAPI(MakeScreenTexture) (void);
|
||||
EXPORT void HWRAPI(MakeScreenFinalTexture) (void);
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture) (int width, int height);
|
||||
|
||||
#define SCREENVERTS 10
|
||||
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
|
||||
|
||||
// jimita
|
||||
EXPORT boolean HWRAPI(LoadShaders) (void);
|
||||
EXPORT void HWRAPI(KillShaders) (void);
|
||||
EXPORT void HWRAPI(SetShader) (int shader);
|
||||
EXPORT void HWRAPI(UnSetShader) (void);
|
||||
|
||||
EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value);
|
||||
EXPORT void HWRAPI(LoadCustomShader) (int number, char *shader, size_t size, boolean fragment);
|
||||
EXPORT boolean HWRAPI(InitCustomShaders) (void);
|
||||
|
||||
// ==========================================================================
|
||||
// HWR DRIVER OBJECT, FOR CLIENT PROGRAM
|
||||
// ==========================================================================
|
||||
|
@ -84,10 +90,12 @@ struct hwdriver_s
|
|||
FinishUpdate pfnFinishUpdate;
|
||||
Draw2DLine pfnDraw2DLine;
|
||||
DrawPolygon pfnDrawPolygon;
|
||||
DrawIndexedTriangles pfnDrawIndexedTriangles;
|
||||
RenderSkyDome pfnRenderSkyDome;
|
||||
SetBlend pfnSetBlend;
|
||||
ClearBuffer pfnClearBuffer;
|
||||
SetTexture pfnSetTexture;
|
||||
UpdateTexture pfnUpdateTexture;
|
||||
ReadRect pfnReadRect;
|
||||
GClipRect pfnGClipRect;
|
||||
ClearMipMapCache pfnClearMipMapCache;
|
||||
|
@ -96,7 +104,6 @@ struct hwdriver_s
|
|||
CreateModelVBOs pfnCreateModelVBOs;
|
||||
SetTransform pfnSetTransform;
|
||||
GetTextureUsed pfnGetTextureUsed;
|
||||
GetRenderVersion pfnGetRenderVersion;
|
||||
#ifdef _WINDOWS
|
||||
GetModeList pfnGetModeList;
|
||||
#endif
|
||||
|
@ -112,13 +119,19 @@ struct hwdriver_s
|
|||
MakeScreenTexture pfnMakeScreenTexture;
|
||||
MakeScreenFinalTexture pfnMakeScreenFinalTexture;
|
||||
DrawScreenFinalTexture pfnDrawScreenFinalTexture;
|
||||
|
||||
LoadShaders pfnLoadShaders;
|
||||
KillShaders pfnKillShaders;
|
||||
SetShader pfnSetShader;
|
||||
UnSetShader pfnUnSetShader;
|
||||
|
||||
SetShaderInfo pfnSetShaderInfo;
|
||||
LoadCustomShader pfnLoadCustomShader;
|
||||
InitCustomShaders pfnInitCustomShaders;
|
||||
};
|
||||
|
||||
extern struct hwdriver_s hwdriver;
|
||||
|
||||
//Hurdler: 16/10/99: added for OpenGL gamma correction
|
||||
//extern RGBA_t gamma_correction;
|
||||
|
||||
#define HWD hwdriver
|
||||
|
||||
#endif //not defined _CREATE_DLL_
|
||||
|
|
|
@ -1,19 +1,12 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// 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
|
||||
/// \file hw_glide.h
|
||||
/// \brief Declaration needed by Glide renderer
|
||||
/// !!! To be replaced by our own def in the future !!!
|
||||
|
||||
|
@ -25,26 +18,6 @@
|
|||
typedef unsigned long FxU32;
|
||||
typedef long FxI32;
|
||||
|
||||
typedef FxI32 GrAspectRatio_t;
|
||||
#define GR_ASPECT_LOG2_8x1 3 /* 8W x 1H */
|
||||
#define GR_ASPECT_LOG2_4x1 2 /* 4W x 1H */
|
||||
#define GR_ASPECT_LOG2_2x1 1 /* 2W x 1H */
|
||||
#define GR_ASPECT_LOG2_1x1 0 /* 1W x 1H */
|
||||
#define GR_ASPECT_LOG2_1x2 -1 /* 1W x 2H */
|
||||
#define GR_ASPECT_LOG2_1x4 -2 /* 1W x 4H */
|
||||
#define GR_ASPECT_LOG2_1x8 -3 /* 1W x 8H */
|
||||
|
||||
typedef FxI32 GrLOD_t;
|
||||
#define GR_LOD_LOG2_256 0x8
|
||||
#define GR_LOD_LOG2_128 0x7
|
||||
#define GR_LOD_LOG2_64 0x6
|
||||
#define GR_LOD_LOG2_32 0x5
|
||||
#define GR_LOD_LOG2_16 0x4
|
||||
#define GR_LOD_LOG2_8 0x3
|
||||
#define GR_LOD_LOG2_4 0x2
|
||||
#define GR_LOD_LOG2_2 0x1
|
||||
#define GR_LOD_LOG2_1 0x0
|
||||
|
||||
typedef FxI32 GrTextureFormat_t;
|
||||
#define GR_TEXFMT_ALPHA_8 0x2 /* (0..0xFF) alpha */
|
||||
#define GR_TEXFMT_INTENSITY_8 0x3 /* (0..0xFF) intensity */
|
||||
|
@ -59,11 +32,6 @@ typedef FxI32 GrTextureFormat_t;
|
|||
|
||||
typedef struct
|
||||
{
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
GrLOD_t smallLodLog2;
|
||||
GrLOD_t largeLodLog2;
|
||||
GrAspectRatio_t aspectRatioLog2;
|
||||
#endif
|
||||
GrTextureFormat_t format;
|
||||
void *data;
|
||||
} GrTexInfo;
|
||||
|
|
|
@ -1,20 +1,13 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// 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
|
||||
/// \file hw_glob.h
|
||||
/// \brief globals (shared data & code) for hw_ modules
|
||||
|
||||
#ifndef _HWR_GLOB_H_
|
||||
|
@ -68,9 +61,6 @@ typedef struct
|
|||
// equivalent of the software renderer's vissprites
|
||||
typedef struct gr_vissprite_s
|
||||
{
|
||||
// Doubly linked list
|
||||
struct gr_vissprite_s *prev;
|
||||
struct gr_vissprite_s *next;
|
||||
float x1, x2;
|
||||
float tz, ty;
|
||||
//lumpnum_t patchlumpnum;
|
||||
|
@ -118,11 +108,6 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum);
|
|||
// --------
|
||||
// hw_draw.c
|
||||
// --------
|
||||
extern float gr_patch_scalex;
|
||||
extern float gr_patch_scaley;
|
||||
|
||||
extern consvar_t cv_grrounddown; // on/off
|
||||
|
||||
extern INT32 patchformat;
|
||||
extern INT32 textureformat;
|
||||
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// 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
|
||||
/// \file hw_light.c
|
||||
/// \brief Corona/Dynamic/Static lighting add on by Hurdler
|
||||
/// !!! Under construction !!!
|
||||
|
||||
|
@ -298,6 +292,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
|
||||
|
@ -877,19 +873,19 @@ void HWR_WallLighting(FOutVector *wlVerts)
|
|||
#endif
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
wlVerts[i].sow = (float)(0.5f + d[i]*s);
|
||||
wlVerts[i].tow = (float)(0.5f + (wlVerts[i].y-LIGHT_POS(j).y)*s*1.2f);
|
||||
wlVerts[i].s = (float)(0.5f + d[i]*s);
|
||||
wlVerts[i].t = (float)(0.5f + (wlVerts[i].y-LIGHT_POS(j).y)*s*1.2f);
|
||||
}
|
||||
|
||||
HWR_SetLight();
|
||||
|
||||
Surf.FlatColor.rgba = LONG(dynlights->p_lspr[j]->dynamic_color);
|
||||
Surf.PolyColor.rgba = LONG(dynlights->p_lspr[j]->dynamic_color);
|
||||
#ifdef DL_HIGH_QUALITY
|
||||
Surf.FlatColor.s.alpha = (UINT8)((1-dist_p2d/DL_SQRRADIUS(j))*Surf.FlatColor.s.alpha);
|
||||
Surf.PolyColor.s.alpha = (UINT8)((1-dist_p2d/DL_SQRRADIUS(j))*Surf.PolyColor.s.alpha);
|
||||
#endif
|
||||
// next state is null so fade out with alpha
|
||||
if (dynlights->mo[j]->state->nextstate == S_NULL)
|
||||
Surf.FlatColor.s.alpha = (UINT8)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.FlatColor.s.alpha);
|
||||
Surf.PolyColor.s.alpha = (UINT8)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.PolyColor.s.alpha);
|
||||
|
||||
HWD.pfnDrawPolygon (&Surf, wlVerts, 4, LIGHTMAPFLAGS);
|
||||
|
||||
|
@ -946,19 +942,19 @@ void HWR_PlaneLighting(FOutVector *clVerts, int nrClipVerts)
|
|||
#endif
|
||||
for (i = 0; i < nrClipVerts; i++)
|
||||
{
|
||||
clVerts[i].sow = 0.5f + (clVerts[i].x-LIGHT_POS(j).x)*s;
|
||||
clVerts[i].tow = 0.5f + (clVerts[i].z-LIGHT_POS(j).z)*s*1.2f;
|
||||
clVerts[i].s = 0.5f + (clVerts[i].x-LIGHT_POS(j).x)*s;
|
||||
clVerts[i].t = 0.5f + (clVerts[i].z-LIGHT_POS(j).z)*s*1.2f;
|
||||
}
|
||||
|
||||
HWR_SetLight();
|
||||
|
||||
Surf.FlatColor.rgba = LONG(dynlights->p_lspr[j]->dynamic_color);
|
||||
Surf.PolyColor.rgba = LONG(dynlights->p_lspr[j]->dynamic_color);
|
||||
#ifdef DL_HIGH_QUALITY
|
||||
Surf.FlatColor.s.alpha = (unsigned char)((1 - dist_p2d/DL_SQRRADIUS(j))*Surf.FlatColor.s.alpha);
|
||||
Surf.PolyColor.s.alpha = (unsigned char)((1 - dist_p2d/DL_SQRRADIUS(j))*Surf.PolyColor.s.alpha);
|
||||
#endif
|
||||
// next state is null so fade out with alpha
|
||||
if ((dynlights->mo[j]->state->nextstate == S_NULL))
|
||||
Surf.FlatColor.s.alpha = (unsigned char)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.FlatColor.s.alpha);
|
||||
Surf.PolyColor.s.alpha = (unsigned char)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.PolyColor.s.alpha);
|
||||
|
||||
HWD.pfnDrawPolygon (&Surf, clVerts, nrClipVerts, LIGHTMAPFLAGS);
|
||||
|
||||
|
@ -1025,11 +1021,11 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr)
|
|||
// more realistique corona !
|
||||
if (cz >= 255*8+250)
|
||||
return;
|
||||
Surf.FlatColor.rgba = p_lspr->corona_color;
|
||||
Surf.PolyColor.rgba = p_lspr->corona_color;
|
||||
if (cz > 250.0f)
|
||||
Surf.FlatColor.s.alpha = 0xff-((int)cz-250)/8;
|
||||
Surf.PolyColor.s.alpha = 0xff-((int)cz-250)/8;
|
||||
else
|
||||
Surf.FlatColor.s.alpha = 0xff;
|
||||
Surf.PolyColor.s.alpha = 0xff;
|
||||
|
||||
// do not be hide by sprite of the light itself !
|
||||
cz = cz - 2.0f;
|
||||
|
@ -1041,19 +1037,19 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr)
|
|||
// car comme l'offset est minime sa ce voit pas !
|
||||
light[0].x = cx-size; light[0].z = cz;
|
||||
light[0].y = cy-size*1.33f+p_lspr->light_yoffset;
|
||||
light[0].sow = 0.0f; light[0].tow = 0.0f;
|
||||
light[0].s = 0.0f; light[0].t = 0.0f;
|
||||
|
||||
light[1].x = cx+size; light[1].z = cz;
|
||||
light[1].y = cy-size*1.33f+p_lspr->light_yoffset;
|
||||
light[1].sow = 1.0f; light[1].tow = 0.0f;
|
||||
light[1].s = 1.0f; light[1].t = 0.0f;
|
||||
|
||||
light[2].x = cx+size; light[2].z = cz;
|
||||
light[2].y = cy+size*1.33f+p_lspr->light_yoffset;
|
||||
light[2].sow = 1.0f; light[2].tow = 1.0f;
|
||||
light[2].s = 1.0f; light[2].t = 1.0f;
|
||||
|
||||
light[3].x = cx-size; light[3].z = cz;
|
||||
light[3].y = cy+size*1.33f+p_lspr->light_yoffset;
|
||||
light[3].sow = 0.0f; light[3].tow = 1.0f;
|
||||
light[3].s = 0.0f; light[3].t = 1.0f;
|
||||
|
||||
HWR_GetPic(coronalumpnum); /// \todo use different coronas
|
||||
|
||||
|
@ -1099,11 +1095,11 @@ void HWR_DrawCoronas(void)
|
|||
// more realistique corona !
|
||||
if (cz >= 255*8+250)
|
||||
continue;
|
||||
Surf.FlatColor.rgba = p_lspr->corona_color;
|
||||
Surf.PolyColor.rgba = p_lspr->corona_color;
|
||||
if (cz > 250.0f)
|
||||
Surf.FlatColor.s.alpha = (UINT8)(0xff-(UINT8)(((int)cz-250)/8));
|
||||
Surf.PolyColor.s.alpha = (UINT8)(0xff-(UINT8)(((int)cz-250)/8));
|
||||
else
|
||||
Surf.FlatColor.s.alpha = 0xff;
|
||||
Surf.PolyColor.s.alpha = 0xff;
|
||||
|
||||
switch (p_lspr->type)
|
||||
{
|
||||
|
@ -1111,7 +1107,7 @@ void HWR_DrawCoronas(void)
|
|||
size = p_lspr->corona_radius * ((cz+120.0f)/950.0f); // d'ou vienne ces constante ?
|
||||
break;
|
||||
case ROCKET_SPR:
|
||||
Surf.FlatColor.s.alpha = (UINT8)((M_RandomByte()>>1)&0xff);
|
||||
Surf.PolyColor.s.alpha = (UINT8)((M_RandomByte()>>1)&0xff);
|
||||
// don't need a break
|
||||
case CORONA_SPR:
|
||||
size = p_lspr->corona_radius * ((cz+60.0f)/100.0f); // d'ou vienne ces constante ?
|
||||
|
@ -1131,19 +1127,19 @@ void HWR_DrawCoronas(void)
|
|||
|
||||
light[0].x = cx-size; light[0].z = cz;
|
||||
light[0].y = cy-size*1.33f;
|
||||
light[0].sow = 0.0f; light[0].tow = 0.0f;
|
||||
light[0].s = 0.0f; light[0].t = 0.0f;
|
||||
|
||||
light[1].x = cx+size; light[1].z = cz;
|
||||
light[1].y = cy-size*1.33f;
|
||||
light[1].sow = 1.0f; light[1].tow = 0.0f;
|
||||
light[1].s = 1.0f; light[1].t = 0.0f;
|
||||
|
||||
light[2].x = cx+size; light[2].z = cz;
|
||||
light[2].y = cy+size*1.33f;
|
||||
light[2].sow = 1.0f; light[2].tow = 1.0f;
|
||||
light[2].s = 1.0f; light[2].t = 1.0f;
|
||||
|
||||
light[3].x = cx-size; light[3].z = cz;
|
||||
light[3].y = cy+size*1.33f;
|
||||
light[3].sow = 0.0f; light[3].tow = 1.0f;
|
||||
light[3].s = 0.0f; light[3].t = 1.0f;
|
||||
|
||||
HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_Additive | PF_Clip | PF_NoDepthTest | PF_Corona);
|
||||
}
|
||||
|
@ -1252,11 +1248,6 @@ static void HWR_SetLight(void)
|
|||
lightmappatch.height = 128;
|
||||
lightmappatch.mipmap->width = 128;
|
||||
lightmappatch.mipmap->height = 128;
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
lightmappatch.mipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_128;
|
||||
lightmappatch.mipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_128;
|
||||
lightmappatch.mipmap->grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
|
||||
#endif
|
||||
lightmappatch.mipmap->flags = 0; //TF_WRAPXY; // DEBUG: view the overdraw !
|
||||
}
|
||||
HWD.pfnSetTexture(lightmappatch.mipmap);
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// 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
|
||||
/// \file hw_light.h
|
||||
/// \brief Dynamic lighting & coronas add on by Hurdler
|
||||
|
||||
#ifndef _HW_LIGHTS_
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,20 +1,13 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// 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
|
||||
/// \file hw_main.h
|
||||
/// \brief 3D render mode functions
|
||||
|
||||
#ifndef __HWR_MAIN_H__
|
||||
|
@ -73,8 +66,11 @@ void HWR_MakeScreenFinalTexture(void);
|
|||
void HWR_DrawScreenFinalTexture(int width, int height);
|
||||
|
||||
// This stuff is put here so MD2's can use them
|
||||
UINT32 HWR_Lighting(INT32 light, UINT32 color, UINT32 fadecolor, boolean fogblockpoly, boolean plane);
|
||||
FUNCMATH UINT8 LightLevelToLum(INT32 l);
|
||||
void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap);
|
||||
UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap); // Let's see if this can work
|
||||
|
||||
void HWR_ReadShaders(UINT16 wadnum, boolean PK3);
|
||||
boolean HWR_LoadShaders(void);
|
||||
|
||||
extern CV_PossibleValue_t granisotropicmode_cons_t[];
|
||||
|
||||
|
@ -84,21 +80,23 @@ extern consvar_t cv_grstaticlighting;
|
|||
extern consvar_t cv_grcoronas;
|
||||
extern consvar_t cv_grcoronasize;
|
||||
#endif
|
||||
|
||||
extern consvar_t cv_grshaders;
|
||||
extern consvar_t cv_grmodels;
|
||||
extern consvar_t cv_grmodelinterpolation;
|
||||
extern consvar_t cv_grmodellighting;
|
||||
extern consvar_t cv_grfog;
|
||||
extern consvar_t cv_grfogcolor;
|
||||
extern consvar_t cv_grfogdensity;
|
||||
extern consvar_t cv_grsoftwarefog;
|
||||
extern consvar_t cv_grfiltermode;
|
||||
extern consvar_t cv_granisotropicmode;
|
||||
extern consvar_t cv_grcorrecttricks;
|
||||
extern consvar_t cv_fovchange;
|
||||
extern consvar_t cv_grsolvetjoin;
|
||||
extern consvar_t cv_grshearing;
|
||||
extern consvar_t cv_grspritebillboarding;
|
||||
extern consvar_t cv_grskydome;
|
||||
extern consvar_t cv_grfakecontrast;
|
||||
extern consvar_t cv_grslopecontrast;
|
||||
|
||||
extern consvar_t cv_grbatching;
|
||||
|
||||
extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowy;
|
||||
|
||||
|
@ -108,4 +106,24 @@ extern float gr_viewwindowx, gr_basewindowcentery;
|
|||
extern fixed_t *hwbbox;
|
||||
extern FTransform atransform;
|
||||
|
||||
|
||||
// Render stats
|
||||
extern int rs_hw_nodesorttime;
|
||||
extern int rs_hw_nodedrawtime;
|
||||
extern int rs_hw_spritesorttime;
|
||||
extern int rs_hw_spritedrawtime;
|
||||
|
||||
// Render stats for batching
|
||||
extern int rs_hw_numpolys;
|
||||
extern int rs_hw_numverts;
|
||||
extern int rs_hw_numcalls;
|
||||
extern int rs_hw_numshaders;
|
||||
extern int rs_hw_numtextures;
|
||||
extern int rs_hw_numpolyflags;
|
||||
extern int rs_hw_numcolors;
|
||||
extern int rs_hw_batchsorttime;
|
||||
extern int rs_hw_batchdrawtime;
|
||||
|
||||
extern boolean gr_shadersavailable;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,23 +1,16 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// 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
|
||||
/// \brief MD2 Handling
|
||||
/// \file hw_md2.c
|
||||
/// \brief 3D Model Handling
|
||||
/// Inspired from md2.c by Mete Ciragan (mete@swissquake.ch)
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
@ -382,7 +375,10 @@ static void md2_loadTexture(md2_t *model)
|
|||
#endif
|
||||
grpatch->mipmap->grInfo.format = PCX_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->grInfo.format == 0)
|
||||
{
|
||||
model->notexturefile = true; // mark it so its not searched for again repeatedly
|
||||
return;
|
||||
}
|
||||
|
||||
grpatch->mipmap->downloaded = 0;
|
||||
grpatch->mipmap->flags = 0;
|
||||
|
@ -400,13 +396,6 @@ static void md2_loadTexture(md2_t *model)
|
|||
V_CubeApply(&image->s.red, &image->s.green, &image->s.blue);
|
||||
image++;
|
||||
}
|
||||
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
// not correct!
|
||||
grpatch->mipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_256;
|
||||
grpatch->mipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_256;
|
||||
grpatch->mipmap->grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
|
||||
#endif
|
||||
}
|
||||
HWD.pfnSetTexture(grpatch->mipmap);
|
||||
}
|
||||
|
@ -444,6 +433,7 @@ static void md2_loadBlendTexture(md2_t *model)
|
|||
grpatch->mipmap->grInfo.format = PCX_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->grInfo.format == 0)
|
||||
{
|
||||
model->noblendfile = true; // mark it so its not searched for again repeatedly
|
||||
Z_Free(filename);
|
||||
return;
|
||||
}
|
||||
|
@ -455,13 +445,6 @@ static void md2_loadBlendTexture(md2_t *model)
|
|||
grpatch->height = (INT16)h;
|
||||
grpatch->mipmap->width = (UINT16)w;
|
||||
grpatch->mipmap->height = (UINT16)h;
|
||||
|
||||
#ifdef GLIDE_API_COMPATIBILITY
|
||||
// not correct!
|
||||
grpatch->mipmap->grInfo.smallLodLog2 = GR_LOD_LOG2_256;
|
||||
grpatch->mipmap->grInfo.largeLodLog2 = GR_LOD_LOG2_256;
|
||||
grpatch->mipmap->grInfo.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
|
||||
#endif
|
||||
}
|
||||
HWD.pfnSetTexture(grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
|
||||
|
@ -486,6 +469,8 @@ void HWR_InitModels(void)
|
|||
md2_playermodels[s].scale = -1.0f;
|
||||
md2_playermodels[s].model = NULL;
|
||||
md2_playermodels[s].grpatch = NULL;
|
||||
md2_playermodels[s].notexturefile = false;
|
||||
md2_playermodels[s].noblendfile = false;
|
||||
md2_playermodels[s].skin = -1;
|
||||
md2_playermodels[s].notfound = true;
|
||||
md2_playermodels[s].error = false;
|
||||
|
@ -495,6 +480,8 @@ void HWR_InitModels(void)
|
|||
md2_models[i].scale = -1.0f;
|
||||
md2_models[i].model = NULL;
|
||||
md2_models[i].grpatch = NULL;
|
||||
md2_models[i].notexturefile = false;
|
||||
md2_models[i].noblendfile = false;
|
||||
md2_models[i].skin = -1;
|
||||
md2_models[i].notfound = true;
|
||||
md2_models[i].error = false;
|
||||
|
@ -677,12 +664,12 @@ spritemodelfound:
|
|||
#define SETBRIGHTNESS(brightness,r,g,b) \
|
||||
brightness = (UINT8)(((1063*(UINT16)(r))/5000) + ((3576*(UINT16)(g))/5000) + ((361*(UINT16)(b))/5000))
|
||||
|
||||
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, INT32 skinnum, skincolors_t color)
|
||||
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, INT32 skinnum, skincolornum_t color)
|
||||
{
|
||||
UINT16 w = gpatch->width, h = gpatch->height;
|
||||
UINT32 size = w*h;
|
||||
RGBA_t *image, *blendimage, *cur, blendcolor;
|
||||
UINT8 translation[16]; // First the color index
|
||||
UINT16 translation[16]; // First the color index
|
||||
UINT8 cutoff[16]; // Brightness cutoff before using the next color
|
||||
UINT8 translen = 0;
|
||||
UINT8 i;
|
||||
|
@ -718,16 +705,16 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
|||
if (skinnum == TC_METALSONIC)
|
||||
color = SKINCOLOR_COBALT;
|
||||
|
||||
if (color != SKINCOLOR_NONE)
|
||||
if (color != SKINCOLOR_NONE && color < numskincolors)
|
||||
{
|
||||
UINT8 numdupes = 1;
|
||||
|
||||
translation[translen] = Color_Index[color-1][0];
|
||||
translation[translen] = skincolors[color].ramp[0];
|
||||
cutoff[translen] = 255;
|
||||
|
||||
for (i = 1; i < 16; i++)
|
||||
{
|
||||
if (translation[translen] == Color_Index[color-1][i])
|
||||
if (translation[translen] == skincolors[color].ramp[i])
|
||||
{
|
||||
numdupes++;
|
||||
continue;
|
||||
|
@ -741,7 +728,7 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
|||
numdupes = 1;
|
||||
translen++;
|
||||
|
||||
translation[translen] = (UINT8)Color_Index[color-1][i];
|
||||
translation[translen] = (UINT16)skincolors[color].ramp[i];
|
||||
}
|
||||
|
||||
translen++;
|
||||
|
@ -949,11 +936,19 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
|||
|
||||
blendcolor = V_GetColor(translation[firsti]);
|
||||
|
||||
if (secondi >= translen)
|
||||
mul = 0;
|
||||
|
||||
if (mul > 0) // If it's 0, then we only need the first color.
|
||||
{
|
||||
if (secondi >= translen) // blend to black
|
||||
#if 0
|
||||
if (secondi >= translen)
|
||||
{
|
||||
// blend to black
|
||||
nextcolor = V_GetColor(31);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
nextcolor = V_GetColor(translation[secondi]);
|
||||
|
||||
// Find difference between points
|
||||
|
@ -1043,7 +1038,7 @@ skippixel:
|
|||
|
||||
#undef SETBRIGHTNESS
|
||||
|
||||
static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT32 skinnum, const UINT8 *colormap, skincolors_t color)
|
||||
static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT32 skinnum, const UINT8 *colormap, skincolornum_t color)
|
||||
{
|
||||
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
|
||||
GLMipmap_t *grmip, *newmip;
|
||||
|
@ -1188,15 +1183,14 @@ static UINT8 HWR_GetModelSprite2(md2_t *md2, skin_t *skin, UINT8 spr2, player_t
|
|||
|
||||
boolean HWR_DrawModel(gr_vissprite_t *spr)
|
||||
{
|
||||
FSurfaceInfo Surf;
|
||||
md2_t *md2;
|
||||
|
||||
char filename[64];
|
||||
INT32 frame = 0;
|
||||
INT32 nextFrame = -1;
|
||||
UINT8 spr2 = 0;
|
||||
FTransform p;
|
||||
md2_t *md2;
|
||||
UINT8 color[4];
|
||||
FSurfaceInfo Surf;
|
||||
|
||||
if (!cv_grmodels.value)
|
||||
return false;
|
||||
|
@ -1221,7 +1215,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,19 +1223,16 @@ 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;
|
||||
}
|
||||
|
||||
if (colormap)
|
||||
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, colormap->rgba, colormap->fadergba, false, false);
|
||||
else
|
||||
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, false);
|
||||
HWR_Lighting(&Surf, lightlevel, colormap);
|
||||
}
|
||||
else
|
||||
Surf.FlatColor.rgba = 0xFFFFFFFF;
|
||||
Surf.PolyColor.rgba = 0xFFFFFFFF;
|
||||
|
||||
// Look at HWR_ProjectSprite for more
|
||||
{
|
||||
|
@ -1263,11 +1254,11 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
//durs = tics;
|
||||
|
||||
if (spr->mobj->flags2 & MF2_SHADOW)
|
||||
Surf.FlatColor.s.alpha = 0x40;
|
||||
Surf.PolyColor.s.alpha = 0x40;
|
||||
else if (spr->mobj->frame & FF_TRANSMASK)
|
||||
HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
|
||||
else
|
||||
Surf.FlatColor.s.alpha = 0xFF;
|
||||
Surf.PolyColor.s.alpha = 0xFF;
|
||||
|
||||
// dont forget to enabled the depth test because we can't do this like
|
||||
// before: polygons models are not sorted
|
||||
|
@ -1315,12 +1306,14 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
finalscale = md2->scale;
|
||||
//Hurdler: arf, I don't like that implementation at all... too much crappy
|
||||
gpatch = md2->grpatch;
|
||||
if (!gpatch || !gpatch->mipmap->grInfo.format || !gpatch->mipmap->downloaded)
|
||||
if (!gpatch || ((!gpatch->mipmap->grInfo.format || !gpatch->mipmap->downloaded) && !md2->notexturefile))
|
||||
md2_loadTexture(md2);
|
||||
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
|
||||
|
||||
if ((gpatch && gpatch->mipmap->grInfo.format) // don't load the blend texture if the base texture isn't available
|
||||
&& (!md2->blendgrpatch || !((GLPatch_t *)md2->blendgrpatch)->mipmap->grInfo.format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded))
|
||||
&& (!md2->blendgrpatch
|
||||
|| ((!((GLPatch_t *)md2->blendgrpatch)->mipmap->grInfo.format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded)
|
||||
&& !md2->noblendfile)))
|
||||
md2_loadBlendTexture(md2);
|
||||
|
||||
if (gpatch && gpatch->mipmap->grInfo.format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
|
||||
|
@ -1336,7 +1329,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
else
|
||||
skinnum = TC_BOSS;
|
||||
}
|
||||
else if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE)
|
||||
else if ((skincolornum_t)spr->mobj->color != SKINCOLOR_NONE)
|
||||
{
|
||||
if (spr->mobj->colorized)
|
||||
skinnum = TC_RAINBOW;
|
||||
|
@ -1356,7 +1349,7 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
}
|
||||
|
||||
// Translation or skin number found
|
||||
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, skinnum, spr->colormap, (skincolors_t)spr->mobj->color);
|
||||
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, skinnum, spr->colormap, (skincolornum_t)spr->mobj->color);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1478,7 +1471,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 +1483,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;
|
||||
|
@ -1509,11 +1505,6 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
}
|
||||
#endif
|
||||
|
||||
color[0] = Surf.FlatColor.s.red;
|
||||
color[1] = Surf.FlatColor.s.green;
|
||||
color[2] = Surf.FlatColor.s.blue;
|
||||
color[3] = Surf.FlatColor.s.alpha;
|
||||
|
||||
// SRB2CBTODO: MD2 scaling support
|
||||
finalscale *= FIXED_TO_FLOAT(spr->mobj->scale);
|
||||
|
||||
|
@ -1522,7 +1513,8 @@ boolean HWR_DrawModel(gr_vissprite_t *spr)
|
|||
p.mirror = atransform.mirror; // from Kart
|
||||
#endif
|
||||
|
||||
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, finalscale, flip, color);
|
||||
HWD.pfnSetShader(4); // model shader
|
||||
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, finalscale, flip, &Surf);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1,21 +1,14 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// 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
|
||||
/// \brief MD2 Handling
|
||||
/// \file hw_md2.h
|
||||
/// \brief 3D Model Handling
|
||||
/// Inspired from md2.h by Mete Ciragan (mete@swissquake.ch)
|
||||
|
||||
#ifndef _HW_MD2_H_
|
||||
|
@ -35,7 +28,9 @@ typedef struct
|
|||
float offset;
|
||||
model_t *model;
|
||||
void *grpatch;
|
||||
boolean notexturefile; // true if texture file was not found
|
||||
void *blendgrpatch;
|
||||
boolean noblendfile; // true if blend texture file was not found
|
||||
boolean notfound;
|
||||
INT32 skin;
|
||||
boolean error;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -1,19 +1,12 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2005 by Sonic Team Junior.
|
||||
//
|
||||
// Copyright (C) 2005 by SRB2 Jr. Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// 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
|
||||
/// \file hws_data.h
|
||||
/// \brief 3D sound definitions
|
||||
|
||||
#ifndef __HWS_DATA_H__
|
||||
|
|
|
@ -206,7 +206,7 @@ int SetupPixelFormat(INT32 WantColorBits, INT32 WantStencilBits, INT32 WantDepth
|
|||
|
||||
if (iLastPFD)
|
||||
{
|
||||
DBG_Printf("WARNING : SetPixelFormat() called twise not supported by all drivers !\n");
|
||||
GL_DBG_Printf("WARNING : SetPixelFormat() called twise not supported by all drivers !\n");
|
||||
}
|
||||
|
||||
// set the pixel format only if different than the current
|
||||
|
@ -215,17 +215,17 @@ int SetupPixelFormat(INT32 WantColorBits, INT32 WantStencilBits, INT32 WantDepth
|
|||
else
|
||||
iLastPFD = iPFD;
|
||||
|
||||
DBG_Printf("SetupPixelFormat() - %d ColorBits - %d StencilBits - %d DepthBits\n",
|
||||
GL_DBG_Printf("SetupPixelFormat() - %d ColorBits - %d StencilBits - %d DepthBits\n",
|
||||
WantColorBits, WantStencilBits, WantDepthBits);
|
||||
|
||||
nPixelFormat = ChoosePixelFormat(hDC, &pfd);
|
||||
|
||||
if (nPixelFormat == 0)
|
||||
DBG_Printf("ChoosePixelFormat() FAILED\n");
|
||||
GL_DBG_Printf("ChoosePixelFormat() FAILED\n");
|
||||
|
||||
if (SetPixelFormat(hDC, nPixelFormat, &pfd) == 0)
|
||||
{
|
||||
DBG_Printf("SetPixelFormat() FAILED\n");
|
||||
GL_DBG_Printf("SetPixelFormat() FAILED\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode)
|
|||
BOOL WantFullScreen = !(lvid->u.windowed); //(lvid->u.windowed ? 0 : CDS_FULLSCREEN);
|
||||
|
||||
UNREFERENCED_PARAMETER(pcurrentmode);
|
||||
DBG_Printf ("SetMode(): %dx%d %d bits (%s)\n",
|
||||
GL_DBG_Printf ("SetMode(): %dx%d %d bits (%s)\n",
|
||||
lvid->width, lvid->height, lvid->bpp*8,
|
||||
WantFullScreen ? "fullscreen" : "windowed");
|
||||
|
||||
|
@ -301,7 +301,7 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode)
|
|||
hDC = GetDC(hWnd);
|
||||
if (!hDC)
|
||||
{
|
||||
DBG_Printf("GetDC() FAILED\n");
|
||||
GL_DBG_Printf("GetDC() FAILED\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -321,12 +321,12 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode)
|
|||
hGLRC = pwglCreateContext(hDC);
|
||||
if (!hGLRC)
|
||||
{
|
||||
DBG_Printf("pwglCreateContext() FAILED\n");
|
||||
GL_DBG_Printf("pwglCreateContext() FAILED\n");
|
||||
return 0;
|
||||
}
|
||||
if (!pwglMakeCurrent(hDC, hGLRC))
|
||||
{
|
||||
DBG_Printf("wglMakeCurrent() FAILED\n");
|
||||
GL_DBG_Printf("wglMakeCurrent() FAILED\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -337,15 +337,15 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode)
|
|||
//BP: why don't we make it earlier ?
|
||||
//Hurdler: we cannot do that before intialising gl context
|
||||
renderer = (LPCSTR)pglGetString(GL_RENDERER);
|
||||
DBG_Printf("Vendor : %s\n", pglGetString(GL_VENDOR));
|
||||
DBG_Printf("Renderer : %s\n", renderer);
|
||||
DBG_Printf("Version : %s\n", pglGetString(GL_VERSION));
|
||||
DBG_Printf("Extensions : %s\n", gl_extensions);
|
||||
GL_DBG_Printf("Vendor : %s\n", pglGetString(GL_VENDOR));
|
||||
GL_DBG_Printf("Renderer : %s\n", renderer);
|
||||
GL_DBG_Printf("Version : %s\n", pglGetString(GL_VERSION));
|
||||
GL_DBG_Printf("Extensions : %s\n", gl_extensions);
|
||||
|
||||
// BP: disable advenced feature that don't work on somes hardware
|
||||
// Hurdler: Now works on G400 with bios 1.6 and certified drivers 6.04
|
||||
if (strstr(renderer, "810")) oglflags |= GLF_NOZBUFREAD;
|
||||
DBG_Printf("oglflags : 0x%X\n", oglflags);
|
||||
GL_DBG_Printf("oglflags : 0x%X\n", oglflags);
|
||||
|
||||
#ifdef USE_WGL_SWAP
|
||||
if (isExtAvailable("WGL_EXT_swap_control",gl_extensions))
|
||||
|
@ -386,7 +386,7 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode)
|
|||
// -----------------+
|
||||
static void UnSetRes(void)
|
||||
{
|
||||
DBG_Printf("UnSetRes()\n");
|
||||
GL_DBG_Printf("UnSetRes()\n");
|
||||
|
||||
pwglMakeCurrent(hDC, NULL);
|
||||
pwglDeleteContext(hGLRC);
|
||||
|
@ -437,7 +437,7 @@ EXPORT void HWRAPI(GetModeList) (vmode_t** pvidmodes, INT32 *numvidmodes)
|
|||
video_modes[iMode].misc = 0;
|
||||
video_modes[iMode].name = malloc(12 * sizeof (CHAR));
|
||||
sprintf(video_modes[iMode].name, "%dx%d", (INT32)Tmp.dmPelsWidth, (INT32)Tmp.dmPelsHeight);
|
||||
DBG_Printf ("Mode: %s\n", video_modes[iMode].name);
|
||||
GL_DBG_Printf ("Mode: %s\n", video_modes[iMode].name);
|
||||
video_modes[iMode].width = Tmp.dmPelsWidth;
|
||||
video_modes[iMode].height = Tmp.dmPelsHeight;
|
||||
video_modes[iMode].bytesperpixel = Tmp.dmBitsPerPel/8;
|
||||
|
@ -474,7 +474,7 @@ EXPORT void HWRAPI(GetModeList) (vmode_t** pvidmodes, INT32 *numvidmodes)
|
|||
HDC bpphdc;
|
||||
INT32 iBitsPerPel;
|
||||
|
||||
DBG_Printf ("HWRAPI GetModeList()\n");
|
||||
GL_DBG_Printf ("HWRAPI GetModeList()\n");
|
||||
|
||||
bpphdc = GetDC(NULL); // on obtient le bpp actuel
|
||||
iBitsPerPel = GetDeviceCaps(bpphdc, BITSPIXEL);
|
||||
|
@ -490,7 +490,7 @@ EXPORT void HWRAPI(GetModeList) (vmode_t** pvidmodes, INT32 *numvidmodes)
|
|||
video_modes[i].misc = 0;
|
||||
video_modes[i].name = malloc(12 * sizeof (CHAR));
|
||||
sprintf(video_modes[i].name, "%dx%d", res[i][0], res[i][1]);
|
||||
DBG_Printf ("Mode: %s\n", video_modes[i].name);
|
||||
GL_DBG_Printf ("Mode: %s\n", video_modes[i].name);
|
||||
video_modes[i].width = res[i][0];
|
||||
video_modes[i].height = res[i][1];
|
||||
video_modes[i].bytesperpixel = iBitsPerPel/8;
|
||||
|
@ -511,9 +511,9 @@ EXPORT void HWRAPI(Shutdown) (void)
|
|||
#ifdef DEBUG_TO_FILE
|
||||
long nb_centiemes;
|
||||
|
||||
DBG_Printf ("HWRAPI Shutdown()\n");
|
||||
GL_DBG_Printf ("HWRAPI Shutdown()\n");
|
||||
nb_centiemes = ((clock()-my_clock)*100)/CLOCKS_PER_SEC;
|
||||
DBG_Printf("Nb frames: %li; Nb sec: %2.2f -> %2.1f fps\n",
|
||||
GL_DBG_Printf("Nb frames: %li; Nb sec: %2.2f -> %2.1f fps\n",
|
||||
nb_frames, nb_centiemes/100.0f, (100*nb_frames)/(double)nb_centiemes);
|
||||
#endif
|
||||
|
||||
|
@ -530,7 +530,7 @@ EXPORT void HWRAPI(Shutdown) (void)
|
|||
}
|
||||
FreeLibrary(GLU32);
|
||||
FreeLibrary(OGL32);
|
||||
DBG_Printf ("HWRAPI Shutdown(DONE)\n");
|
||||
GL_DBG_Printf ("HWRAPI Shutdown(DONE)\n");
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
|
@ -543,7 +543,7 @@ EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
|
|||
#else
|
||||
UNREFERENCED_PARAMETER(waitvbl);
|
||||
#endif
|
||||
// DBG_Printf ("FinishUpdate()\n");
|
||||
// GL_DBG_Printf ("FinishUpdate()\n");
|
||||
#ifdef DEBUG_TO_FILE
|
||||
if ((++nb_frames)==2) // on ne commence pas <20> la premi<6D>re frame
|
||||
my_clock = clock();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -70,10 +70,6 @@
|
|||
extern FILE *gllogstream;
|
||||
#endif
|
||||
|
||||
#ifndef DRIVER_STRING
|
||||
#define DRIVER_STRING "HWRAPI Init(): SRB2 OpenGL renderer" // Tails
|
||||
#endif
|
||||
|
||||
// ==========================================================================
|
||||
// PROTOS
|
||||
// ==========================================================================
|
||||
|
@ -81,13 +77,11 @@ extern FILE *gllogstream;
|
|||
boolean LoadGL(void);
|
||||
void *GetGLFunc(const char *proc);
|
||||
boolean SetupGLfunc(void);
|
||||
boolean SetupGLFunc13(void);
|
||||
void SetupGLFunc4(void);
|
||||
void Flush(void);
|
||||
INT32 isExtAvailable(const char *extension, const GLubyte *start);
|
||||
int SetupPixelFormat(INT32 WantColorBits, INT32 WantStencilBits, INT32 WantDepthBits);
|
||||
void SetModelView(GLint w, GLint h);
|
||||
void SetStates(void);
|
||||
FUNCMATH float byteasfloat(UINT8 fbyte);
|
||||
|
||||
#ifndef GL_EXT_texture_filter_anisotropic
|
||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
|
@ -123,12 +117,15 @@ static PFNglEnableClientState pglEnableClientState;
|
|||
// GLOBAL
|
||||
// ==========================================================================
|
||||
|
||||
extern const GLubyte *gl_extensions;
|
||||
extern RGBA_t myPaletteData[];
|
||||
extern GLint screen_width;
|
||||
extern GLint screen_height;
|
||||
extern GLbyte screen_depth;
|
||||
extern GLint maximumAnisotropy;
|
||||
extern const GLubyte *gl_version;
|
||||
extern const GLubyte *gl_renderer;
|
||||
extern const GLubyte *gl_extensions;
|
||||
|
||||
extern RGBA_t myPaletteData[];
|
||||
extern GLint screen_width;
|
||||
extern GLint screen_height;
|
||||
extern GLbyte screen_depth;
|
||||
extern GLint maximumAnisotropy;
|
||||
|
||||
/** \brief OpenGL flags for video driver
|
||||
*/
|
||||
|
|
172
src/hu_stuff.c
172
src/hu_stuff.c
|
@ -2,7 +2,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
// 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.
|
||||
|
@ -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
|
||||
|
@ -70,7 +68,7 @@ patch_t *nightsnum[10]; // 0-9
|
|||
// Level title and credits fonts
|
||||
patch_t *lt_font[LT_FONTSIZE];
|
||||
patch_t *cred_font[CRED_FONTSIZE];
|
||||
patch_t *ttlnum[20]; // act numbers (0-19)
|
||||
patch_t *ttlnum[10]; // act numbers (0-9)
|
||||
|
||||
// Name tag fonts
|
||||
patch_t *ntb_font[NT_FONTSIZE];
|
||||
|
@ -245,7 +243,7 @@ void HU_LoadGraphics(void)
|
|||
tallinfin = (patch_t *)W_CachePatchName("STTINFIN", PU_HUDGFX);
|
||||
|
||||
// cache act numbers for level titles
|
||||
for (i = 0; i < 20; i++)
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
sprintf(buffer, "TTL%.2d", i);
|
||||
ttlnum[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
||||
|
@ -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.
|
||||
|
@ -759,107 +755,40 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
|||
}
|
||||
else
|
||||
{
|
||||
const UINT8 color = players[playernum].skincolor;
|
||||
UINT16 chatcolor = skincolors[players[playernum].skincolor].chatcolor;
|
||||
|
||||
cstart = "\x83";
|
||||
|
||||
// Follow palette order at r_draw.c Color_Names
|
||||
switch (color)
|
||||
{
|
||||
default:
|
||||
case SKINCOLOR_WHITE:
|
||||
case SKINCOLOR_BONE:
|
||||
case SKINCOLOR_CLOUDY:
|
||||
case SKINCOLOR_GREY:
|
||||
case SKINCOLOR_SILVER:
|
||||
case SKINCOLOR_AETHER:
|
||||
case SKINCOLOR_SLATE:
|
||||
cstart = "\x80"; // white
|
||||
break;
|
||||
case SKINCOLOR_CARBON:
|
||||
case SKINCOLOR_JET:
|
||||
case SKINCOLOR_BLACK:
|
||||
cstart = "\x86"; // V_GRAYMAP
|
||||
break;
|
||||
case SKINCOLOR_PINK:
|
||||
case SKINCOLOR_RUBY:
|
||||
case SKINCOLOR_SALMON:
|
||||
case SKINCOLOR_RED:
|
||||
case SKINCOLOR_CRIMSON:
|
||||
case SKINCOLOR_FLAME:
|
||||
cstart = "\x85"; // V_REDMAP
|
||||
break;
|
||||
case SKINCOLOR_YOGURT:
|
||||
case SKINCOLOR_BROWN:
|
||||
case SKINCOLOR_TAN:
|
||||
case SKINCOLOR_BEIGE:
|
||||
case SKINCOLOR_QUAIL:
|
||||
cstart = "\x8d"; // V_BROWNMAP
|
||||
break;
|
||||
case SKINCOLOR_MOSS:
|
||||
case SKINCOLOR_GREEN:
|
||||
case SKINCOLOR_FOREST:
|
||||
case SKINCOLOR_EMERALD:
|
||||
case SKINCOLOR_MINT:
|
||||
cstart = "\x83"; // V_GREENMAP
|
||||
break;
|
||||
case SKINCOLOR_AZURE:
|
||||
cstart = "\x8c"; // V_AZUREMAP
|
||||
break;
|
||||
case SKINCOLOR_LAVENDER:
|
||||
case SKINCOLOR_PASTEL:
|
||||
case SKINCOLOR_PURPLE:
|
||||
cstart = "\x89"; // V_PURPLEMAP
|
||||
break;
|
||||
case SKINCOLOR_PEACHY:
|
||||
case SKINCOLOR_LILAC:
|
||||
case SKINCOLOR_PLUM:
|
||||
case SKINCOLOR_ROSY:
|
||||
cstart = "\x8e"; // V_ROSYMAP
|
||||
break;
|
||||
case SKINCOLOR_SUNSET:
|
||||
case SKINCOLOR_APRICOT:
|
||||
case SKINCOLOR_ORANGE:
|
||||
case SKINCOLOR_RUST:
|
||||
cstart = "\x87"; // V_ORANGEMAP
|
||||
break;
|
||||
case SKINCOLOR_GOLD:
|
||||
case SKINCOLOR_SANDY:
|
||||
case SKINCOLOR_YELLOW:
|
||||
case SKINCOLOR_OLIVE:
|
||||
cstart = "\x82"; // V_YELLOWMAP
|
||||
break;
|
||||
case SKINCOLOR_LIME:
|
||||
case SKINCOLOR_PERIDOT:
|
||||
cstart = "\x8b"; // V_PERIDOTMAP
|
||||
break;
|
||||
case SKINCOLOR_SEAFOAM:
|
||||
case SKINCOLOR_AQUA:
|
||||
cstart = "\x8a"; // V_AQUAMAP
|
||||
break;
|
||||
case SKINCOLOR_TEAL:
|
||||
case SKINCOLOR_WAVE:
|
||||
case SKINCOLOR_CYAN:
|
||||
case SKINCOLOR_SKY:
|
||||
case SKINCOLOR_CERULEAN:
|
||||
case SKINCOLOR_ICY:
|
||||
case SKINCOLOR_SAPPHIRE:
|
||||
case SKINCOLOR_VAPOR:
|
||||
cstart = "\x88"; // V_SKYMAP
|
||||
break;
|
||||
case SKINCOLOR_CORNFLOWER:
|
||||
case SKINCOLOR_BLUE:
|
||||
case SKINCOLOR_COBALT:
|
||||
case SKINCOLOR_DUSK:
|
||||
cstart = "\x84"; // V_BLUEMAP
|
||||
break;
|
||||
case SKINCOLOR_BUBBLEGUM:
|
||||
case SKINCOLOR_MAGENTA:
|
||||
case SKINCOLOR_NEON:
|
||||
case SKINCOLOR_VIOLET:
|
||||
cstart = "\x81"; // V_MAGENTAMAP
|
||||
break;
|
||||
}
|
||||
if (!chatcolor || chatcolor%0x1000 || chatcolor>V_INVERTMAP)
|
||||
cstart = "\x80";
|
||||
else if (chatcolor == V_MAGENTAMAP)
|
||||
cstart = "\x81";
|
||||
else if (chatcolor == V_YELLOWMAP)
|
||||
cstart = "\x82";
|
||||
else if (chatcolor == V_GREENMAP)
|
||||
cstart = "\x83";
|
||||
else if (chatcolor == V_BLUEMAP)
|
||||
cstart = "\x84";
|
||||
else if (chatcolor == V_REDMAP)
|
||||
cstart = "\x85";
|
||||
else if (chatcolor == V_GRAYMAP)
|
||||
cstart = "\x86";
|
||||
else if (chatcolor == V_ORANGEMAP)
|
||||
cstart = "\x87";
|
||||
else if (chatcolor == V_SKYMAP)
|
||||
cstart = "\x88";
|
||||
else if (chatcolor == V_PURPLEMAP)
|
||||
cstart = "\x89";
|
||||
else if (chatcolor == V_AQUAMAP)
|
||||
cstart = "\x8a";
|
||||
else if (chatcolor == V_PERIDOTMAP)
|
||||
cstart = "\x8b";
|
||||
else if (chatcolor == V_AZUREMAP)
|
||||
cstart = "\x8c";
|
||||
else if (chatcolor == V_BROWNMAP)
|
||||
cstart = "\x8d";
|
||||
else if (chatcolor == V_ROSYMAP)
|
||||
cstart = "\x8e";
|
||||
else if (chatcolor == V_INVERTMAP)
|
||||
cstart = "\x8f";
|
||||
}
|
||||
prefix = cstart;
|
||||
|
||||
|
@ -2171,18 +2100,14 @@ void HU_Drawer(void)
|
|||
{
|
||||
if (netgame || multiplayer)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_HudEnabled(hud_rankings))
|
||||
#endif
|
||||
HU_DrawRankings();
|
||||
if (gametype == GT_COOP)
|
||||
HU_DrawRankings();
|
||||
if (gametyperules & GTR_CAMPAIGN)
|
||||
HU_DrawNetplayCoopOverlay();
|
||||
}
|
||||
else
|
||||
HU_DrawCoopOverlay();
|
||||
#ifdef HAVE_BLUA
|
||||
LUAh_ScoresHUD();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (gamestate != GS_LEVEL)
|
||||
|
@ -3165,29 +3090,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 +3125,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)
|
||||
{
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue