diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg index 558014073..969f645f3 100644 --- a/extras/conf/SRB2-22.cfg +++ b/extras/conf/SRB2-22.cfg @@ -425,20 +425,18 @@ sectortypes 12 = "Space Countdown"; 13 = "Ramp Sector (double step-up/down)"; 14 = "Non-Ramp Sector (no step-down)"; - 15 = "Bouncy FOF"; + 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)"; + 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/Spheres Parameters"; - 176 = "Custom Global Gravity"; - 512 = "Wind/Current"; - 1024 = "Conveyor Belt"; + 160 = "Special Stage Time/Spheres Parameters "; + 176 = "Custom Global Gravity "; 1280 = "Speed Pad"; 4096 = "Star Post Activator"; 8192 = "Exit/Special Stage Pit/Return Flag"; @@ -475,7 +473,7 @@ gen_sectortypes 12 = "Space Countdown"; 13 = "Ramp Sector (double step-up/down)"; 14 = "Non-Ramp Sector (no step-down)"; - 15 = "Bouncy FOF"; + 15 = "Bouncy FOF "; } second @@ -486,19 +484,17 @@ gen_sectortypes 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)"; + 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/Spheres Parameters"; - 176 = "Custom Global Gravity"; + 160 = "Special Stage Time/Spheres Parameters "; + 176 = "Custom Global Gravity "; } third { 0 = "Normal"; - 512 = "Wind/Current"; - 1024 = "Conveyor Belt"; 1280 = "Speed Pad"; } @@ -771,6 +767,12 @@ linedeftypes flags2text = "[1] Use control sector tag"; flags64text = "[6] No sound effect"; } + + 76 + { + title = "Make FOF Bouncy"; + prefix = "(76)"; + } } polyobject @@ -1279,7 +1281,7 @@ linedeftypes 160 { - title = "Floating, Bobbing"; + title = "Water Bobbing"; prefix = "(160)"; flags8text = "[3] Slope skew sides"; flags32text = "[5] Only block player"; @@ -2018,6 +2020,48 @@ linedeftypes flags1024text = "[10] Use faster, unordered execution"; } + 337 + { + title = "Emerald Check - Continuous"; + prefix = "(337)"; + } + + 338 + { + title = "Emerald Check - Each Time"; + prefix = "(338)"; + } + + 339 + { + title = "Emerald Check - Once"; + prefix = "(339)"; + } + + 340 + { + title = "NiGHTS Mare - Continuous"; + flags2text = "[1] Mare greater or equal"; + flags64text = "[6] Mare less or equal"; + prefix = "(340)"; + } + + 341 + { + title = "NiGHTS Mare - Each Time"; + flags2text = "[1] Mare greater or equal"; + flags64text = "[6] Mare less or equal"; + prefix = "(341)"; + } + + 342 + { + title = "NiGHTS Mare - Once"; + flags2text = "[1] Mare greater or equal"; + flags64text = "[6] Mare less or equal"; + prefix = "(342)"; + } + 399 { title = "Level Load"; @@ -2048,23 +2092,35 @@ linedeftypes 402 { - title = "Set Tagged Sector's Light Level"; + title = "Copy Light Level to Tagged Sectors"; prefix = "(402)"; flags8text = "[3] Set delay by backside sector"; } + 408 + { + title = "Set Tagged Sector's Flats"; + prefix = "(408)"; + flags64text = "[6] Don't set floor flat"; + flags512text = "[9] Don't set ceiling flat"; + } + 409 { title = "Change Tagged Sector's Tag"; prefix = "(409)"; + flags2text = "[1] Remove tag"; flags8text = "[3] Set delay by backside sector"; + flags64text = "[6] Add tag"; } 410 { title = "Change Front Sector's Tag"; prefix = "(410)"; + flags2text = "[1] Remove tag"; flags8text = "[3] Set delay by backside sector"; + flags64text = "[6] Add tag"; } 416 @@ -2122,6 +2178,14 @@ linedeftypes prefix = "(435)"; flags8text = "[3] Set delay by backside sector"; } + + 467 + { + title = "Set Tagged Sector's Light Level"; + prefix = "(467)"; + flags8text = "[3] Set delay by backside sector"; + flags256text = "[8] Set relative to current"; + } } linedefexecplane @@ -3228,6 +3292,7 @@ linedeftypes { title = "Set Tagged Dynamic Slope Vertex to Front Sector Height"; prefix = "(799)"; + flags64text = "[6] Use relative heights"; } } diff --git a/extras/conf/udb/Includes/SRB222_common.cfg b/extras/conf/udb/Includes/SRB222_common.cfg index b752e3654..0ff044a6d 100644 --- a/extras/conf/udb/Includes/SRB222_common.cfg +++ b/extras/conf/udb/Includes/SRB222_common.cfg @@ -191,6 +191,12 @@ mapformat_doom // that make the same thing appear in the same modes thingflagsmask1 = 7; // 1 + 2 + 4 thingflagsmask2 = 0; + + // THING TYPES + thingtypes + { + include("SRB222_things.cfg", "doom"); + } } mapformat_udmf @@ -240,17 +246,7 @@ mapformat_udmf include("SRB222_misc.cfg", "sectorbrightness"); } - // SECTOR TYPES - sectortypes - { - include("SRB222_sectors.cfg", "sectortypes"); - } - - // GENERALISED SECTOR TYPES - gen_sectortypes - { - include("SRB222_sectors.cfg", "gen_sectortypes"); - } + damagetypes = "Generic Water Fire Lava Electric Spike DeathPitTilt DeathPitNoTilt Instakill SpecialStage"; // LINEDEF FLAGS linedefflags @@ -289,6 +285,12 @@ mapformat_udmf include("UDMF_misc.cfg", "thingflagscompare"); } + // THING TYPES + thingtypes + { + include("SRB222_things.cfg", "udmf"); + } + // LINEDEF TYPES linedeftypes { diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index c6b0cb1c8..fff9edf10 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -16,7 +16,7 @@ doom } 5 { - title = "Camera Scanner"; + title = "Camera Scanner "; prefix = "(5)"; } 7 @@ -125,10 +125,10 @@ doom title = "Continuously Appearing/Disappearing FOF"; prefix = "(64)"; } - 65 + 76 { - title = "Bridge Thinker "; - prefix = "(65)"; + title = "Make FOF Bouncy"; + prefix = "(76)"; } } @@ -397,7 +397,7 @@ doom } 160 { - title = "Floating, Bobbing"; + title = "Water Bobbing"; prefix = "(160)"; } 190 @@ -734,6 +734,51 @@ doom title = "Player Skin - Once"; prefix = "(333)"; } + 334 + { + title = "Object Dye - Continuous"; + prefix = "(334)"; + } + 335 + { + title = "Object Dye - Each Time"; + prefix = "(335)"; + } + 336 + { + title = "Object Dye - Once"; + prefix = "(336)"; + } + 337 + { + title = "Emerald Check - Continuous"; + prefix = "(337)"; + } + 338 + { + title = "Emerald Check - Each Time"; + prefix = "(338)"; + } + 339 + { + title = "Emerald Check - Once"; + prefix = "(339)"; + } + 340 + { + title = "NiGHTS Mare - Continuous"; + prefix = "(340)"; + } + 341 + { + title = "NiGHTS Mare - Each Time"; + prefix = "(341)"; + } + 342 + { + title = "NiGHTS Mare - Once"; + prefix = "(342)"; + } 399 { title = "Level Load"; @@ -757,9 +802,14 @@ doom } 402 { - title = "Set Tagged Sector's Light Level"; + title = "Copy Light Level to Tagged Sectors"; prefix = "(402)"; } + 408 + { + title = "Set Tagged Sector's Flats"; + prefix = "(408)"; + } 409 { title = "Change Tagged Sector's Tag"; @@ -805,6 +855,11 @@ doom title = "Change Plane Scroller Direction"; prefix = "(435)"; } + 467 + { + title = "Set Tagged Sector's Light Level"; + prefix = "(467)"; + } } linedefexecplane @@ -937,6 +992,21 @@ doom title = "Stop Timer/Exit Stage in Record Attack"; prefix = "(462)"; } + 463 + { + title = "Dye Object"; + prefix = "(463)"; + } + 464 + { + title = "Trigger Egg Capsule"; + prefix = "(464)"; + } + 466 + { + title = "Set Level Failure State"; + prefix = "(466)"; + } } linedefexecmisc @@ -1669,6 +1739,248 @@ udmf title = "None"; prefix = "(0)"; } + + 7 + { + title = "Sector Flat Alignment"; + prefix = "(7)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Affected planes"; + type = 11; + enum = "floorceiling"; + default = 2; + } + } + + 10 + { + title = "Culling Plane"; + prefix = "(10)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Culling behavior"; + type = 11; + enum + { + 0 = "Always"; + 1 = "Only while in sector"; + } + } + } + + 40 + { + title = "Visual Portal Between Tagged Linedefs"; + prefix = "(40)"; + } + + 41 + { + title = "Horizon Effect"; + prefix = "(41)"; + } + + 63 + { + title = "Fake Floor/Ceiling Planes"; + prefix = "(63)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + } + } + + parameters + { + title = "Parameters"; + + 2 + { + title = "Custom Exit"; + prefix = "(2)"; + arg0 + { + title = "Next map"; + } + arg1 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Skip score tally"; + 2 = "Check emeralds"; + } + } + arg2 + { + title = "Next map (all emeralds)"; + } + } + + 3 + { + title = "Zoom Tube Parameters"; + prefix = "(3)"; + arg0 + { + title = "Speed"; + } + arg1 + { + title = "Sequence"; + } + arg2 + { + title = "Check player direction?"; + type = 11; + enum = "yesno"; + } + } + + 4 + { + title = "Speed Pad Parameters"; + prefix = "(4)"; + arg0 + { + title = "Speed"; + } + arg1 + { + title = "Flags"; + type = 12; + enum + { + 1 = "No teleport to center"; + 2 = "Force spinning frames"; + } + } + stringarg0 + { + title = "Sound"; + type = 2; + } + } + + 8 + { + title = "Set Camera Collision Planes"; + prefix = "(8)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + } + + 11 + { + title = "Rope Hang Parameters"; + prefix = "(11)"; + arg0 + { + title = "Speed"; + } + arg1 + { + title = "Sequence"; + } + arg2 + { + title = "Loop?"; + type = 11; + enum = "yesno"; + } + } + + 14 + { + title = "Bustable Block Parameters"; + prefix = "(14)"; + arg0 + { + title = "Debris spacing"; + } + arg1 + { + title = "Debris lifetime"; + } + arg2 + { + title = "Launch from center?"; + type = 11; + enum = "noyes"; + } + stringarg0 + { + title = "Debris object type"; + type = 2; + } + } + + 15 + { + title = "Fan Particle Generator Heights"; + prefix = "(15)"; + } + + 16 + { + title = "Minecart Parameters"; + prefix = "(16)"; + arg0 + { + title = "Order"; + } + } + + 64 + { + title = "Continuously Appearing/Disappearing FOF"; + prefix = "(64)"; + arg0 + { + title = "Control linedef tag"; + type = 15; + } + arg1 + { + title = "Control sector tag"; + type = 13; + } + arg2 + { + title = "On time"; + } + arg3 + { + title = "Off time"; + } + arg4 + { + title = "Initial delay"; + } + arg5 + { + title = "Play sound?"; + type = 11; + enum = "yesno"; + } + } } polyobject @@ -1714,6 +2026,412 @@ udmf type = 15; } } + + 30 + { + title = "Waving Flag"; + prefix = "(30)"; + arg0 + { + title = "PolyObject ID"; + type = 14; + } + arg1 + { + title = "Speed"; + } + arg2 + { + title = "Distance"; + } + } + + 31 + { + title = "Displacement by Front Sector"; + prefix = "(31)"; + arg0 + { + title = "PolyObject ID"; + type = 14; + } + arg1 + { + title = "Base speed"; + } + } + + 32 + { + title = "Angular Displacement by Front Sector"; + prefix = "(32)"; + arg0 + { + title = "PolyObject ID"; + type = 14; + } + arg1 + { + title = "Plane factor"; + default = 128; + } + arg2 + { + title = "Rotation factor"; + default = 90; + } + arg3 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Don't turn others"; + 2 = "Turn players"; + } + } + } + } + + planemove + { + title = "Plane Movement"; + + 52 + { + title = "Continuously Falling Sector"; + prefix = "(52)"; + arg0 + { + title = "Speed"; + } + arg1 + { + title = "Direction"; + type = 11; + enum + { + 0 = "Fall"; + 1 = "Rise"; + } + } + } + + 53 + { + title = "Continuous Plane Mover (Slowdown)"; + prefix = "(53)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Affected planes"; + type = 11; + enum = "floorceiling"; + } + arg2 + { + title = "Forward speed"; + } + arg3 + { + title = "Return speed"; + } + arg4 + { + title = "Starting delay"; + } + arg5 + { + title = "Delay before flip"; + } + } + + 56 + { + title = "Continuous Plane Mover (Constant)"; + prefix = "(56)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Affected planes"; + type = 11; + enum = "floorceiling"; + } + arg2 + { + title = "Forward speed"; + } + arg3 + { + title = "Return speed"; + } + arg4 + { + title = "Starting delay"; + } + arg5 + { + title = "Delay before flip"; + } + } + + 60 + { + title = "Activate Moving Platform"; + prefix = "(60)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Speed"; + } + arg2 + { + title = "Starting delay"; + } + arg3 + { + title = "Delay before flip"; + } + arg4 + { + title = "Starting direction"; + type = 11; + enum = "downup"; + } + } + + 61 + { + title = "Ceiling Crusher"; + prefix = "(61)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Starting direction"; + type = 11; + enum + { + 0 = "Crush"; + 1 = "Retract"; + } + } + arg2 + { + title = "Crush speed"; + } + arg3 + { + title = "Retract speed"; + } + } + + 66 + { + title = "Move Planes by Displacement"; + prefix = "(66)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Affected planes"; + type = 11; + enum = "floorceiling"; + } + arg2 + { + title = "Translation factor"; + default = 256; + } + } + } + + fofmodifiers + { + title = "FOF Modifiers"; + + 70 + { + title = "Add Raise Thinker"; + prefix = "(70)"; + arg0 + { + title = "Control linedef tag"; + type = 15; + } + arg1 + { + title = "Speed"; + } + arg2 + { + title = "Destination height"; + } + arg3 + { + title = "Require spindash?"; + type = 11; + enum = "noyes"; + } + } + + 71 + { + title = "Add Air Bobbing Thinker"; + prefix = "(71)"; + arg0 + { + title = "Control linedef tag"; + type = 15; + } + arg1 + { + title = "Bobbing distance"; + } + arg2 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Raise"; + 2 = "Require spindash"; + 4 = "Dynamic"; + } + } + } + + 72 + { + title = "Add Thwomp Thinker"; + prefix = "(72)"; + arg0 + { + title = "Control linedef tag"; + type = 15; + } + arg1 + { + title = "Falling speed"; + } + arg2 + { + title = "Rising speed"; + } + stringarg0 + { + title = "Crushing sound"; + type = 2; + } + } + + 73 + { + title = "Add Laser Thinker"; + prefix = "(73)"; + arg0 + { + title = "Control linedef tag"; + type = 15; + } + arg1 + { + title = "Damage bosses?"; + type = 11; + enum = "yesno"; + } + } + + 74 + { + title = "Make FOF Bustable"; + prefix = "(74)"; + arg0 + { + title = "Control linedef tag"; + type = 15; + } + arg1 + { + title = "Bustable type"; + type = 11; + enum + { + 0 = "Touch"; + 1 = "Spin"; + 2 = "Regular"; + 3 = "Strong"; + } + } + arg2 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Bustable by pushables"; + 2 = "Trigger linedef executor"; + 4 = "Only bustable from below"; + } + } + arg3 + { + title = "Linedef executor tag"; + type = 15; + } + } + + 75 + { + title = "Make FOF Quicksand"; + prefix = "(75)"; + arg0 + { + title = "Control linedef tag"; + type = 15; + } + arg1 + { + title = "Sinking speed"; + } + arg2 + { + title = "Friction"; + } + } + + 76 + { + title = "Make FOF Bouncy"; + prefix = "(76)"; + arg0 + { + title = "Control linedef tag"; + type = 15; + } + arg1 + { + title = "Bounce strength"; + } + } } fof @@ -1731,37 +2449,35 @@ udmf } arg1 { - title = "Visibility"; + title = "Alpha"; + default = 255; + } + arg2 + { + title = "Blending mode"; + type = 11; + enum = "blendmodes"; + } + arg3 + { + title = "Appearance"; type = 12; enum { 1 = "Don't render planes"; 2 = "Don't render sides"; + 4 = "Render insides"; + 8 = "Render only insides"; + 16 = "No shadow"; + 32 = "Cut cyan flat pixels"; } } - arg2 - { - title = "Translucency"; - type = 11; - enum - { - 0 = "Opaque"; - 1 = "Translucent, no insides"; - 2 = "Translucent, render insides"; - } - } - arg3 + arg4 { title = "Tangibility"; type = 12; enum = "tangibility"; } - arg4 - { - title = "Cast shadow?"; - type = 11; - enum = "yesno"; - } } 120 @@ -1774,17 +2490,1900 @@ udmf type = 13; } arg1 + { + title = "Alpha"; + default = 128; + } + arg2 + { + title = "Blending mode"; + type = 11; + enum = "blendmodes"; + } + arg3 { title = "Flags"; type = 12; enum { - 1 = "Opaque"; + 1 = "Don't render sides"; + 2 = "Render separate light level"; + 4 = "Use target light level"; + 8 = "No ripple effect"; + 16 = "Goo physics"; + 32 = "Cut cyan flat pixels"; + } + } + } + + 150 + { + title = "Air Bobbing"; + prefix = "(150)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Bobbing distance"; + } + arg2 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Raise"; + 2 = "Require spindash"; + 4 = "Dynamic"; + } + } + } + + 160 + { + title = "Water Bobbing"; + prefix = "(160)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + } + + 170 + { + title = "Crumbling"; + prefix = "(170)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Alpha"; + default = 255; + } + arg2 + { + title = "Blending mode"; + type = 11; + enum = "blendmodes"; + } + arg3 + { + title = "Tangibility"; + type = 12; + enum = "tangibility"; + } + arg4 + { + title = "Flags"; + type = 12; + enum + { + 1 = "No shadow"; + 2 = "No respawn"; + 4 = "Air bobbing"; + 8 = "Float on water"; + 16 = "Cut cyan flat pixels"; + } + } + } + + 190 + { + title = "Rising"; + prefix = "(190)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Alpha"; + default = 255; + } + arg2 + { + title = "Blending mode"; + type = 11; + enum = "blendmodes"; + } + arg3 + { + title = "Appearance"; + type = 12; + enum + { + 1 = "Don't render planes"; 2 = "Don't render sides"; - 4 = "Render separate light level"; - 8 = "Use target light level"; - 16 = "No ripple effect"; - 32 = "Goo physics"; + 4 = "Render insides"; + 8 = "Render only insides"; + 16 = "No shadow"; + 32 = "Cut cyan flat pixels"; + } + } + arg4 + { + title = "Tangibility"; + type = 12; + enum = "tangibility"; + } + arg5 + { + title = "Speed"; + } + arg6 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Lower"; + 2 = "Require spindash"; + } + } + } + + 200 + { + title = "Light Block"; + prefix = "(200)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Expand to bottom?"; + type = 11; + enum = "noyes"; + } + } + + 202 + { + title = "Fog Block"; + prefix = "(202)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + } + + 220 + { + title = "Intangible"; + prefix = "(220)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Alpha"; + default = 255; + } + arg2 + { + title = "Blending mode"; + type = 11; + enum = "blendmodes"; + } + arg3 + { + title = "Appearance"; + type = 12; + enum + { + 1 = "Don't render planes"; + 2 = "Don't render sides"; + 4 = "Don't render insides"; + 8 = "Render only insides"; + 16 = "No shadow"; + 32 = "Cut cyan flat pixels"; + } + } + } + + 223 + { + title = "Intangible, Invisible"; + prefix = "(223)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + } + + 250 + { + title = "Mario Block"; + prefix = "(250)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Block type"; + type = 12; + enum + { + 1 = "Brick"; + 2 = "Invisible"; + } + } + } + + 251 + { + title = "Thwomp Block"; + prefix = "(251)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Falling speed"; + } + arg2 + { + title = "Rising speed"; + } + stringarg0 + { + title = "Crushing sound"; + type = 2; + } + } + + 254 + { + title = "Bustable Block"; + prefix = "(254)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Alpha"; + default = 255; + } + arg2 + { + title = "Blending mode"; + type = 11; + enum = "blendmodes"; + } + arg3 + { + title = "Bustable type"; + type = 11; + enum + { + 0 = "Touch"; + 1 = "Spin"; + 2 = "Regular"; + 3 = "Strong"; + } + } + arg4 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Bustable by pushables"; + 2 = "Trigger linedef executor"; + 4 = "Only bustable from below"; + 8 = "Cut cyan flat pixels"; + } + } + arg5 + { + title = "Linedef executor tag"; + type = 15; + } + } + + 257 + { + title = "Quicksand"; + prefix = "(257)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Ripple effect?"; + type = 11; + enum = "yesno"; + } + arg2 + { + title = "Sinking speed"; + } + arg3 + { + title = "Friction"; + } + } + + 258 + { + title = "Laser"; + prefix = "(258)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Alpha"; + default = 128; + } + arg2 + { + title = "Blending mode"; + type = 11; + enum = "blendmodes"; + } + arg3 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Don't damage bosses"; + 2 = "Cut cyan flat pixels"; + } + } + } + + 259 + { + title = "Custom"; + prefix = "(259)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Alpha"; + default = 255; + } + arg2 + { + title = "Blending mode"; + type = 11; + enum = "blendmodes"; + } + arg3 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Exists"; + 2 = "Block player"; + 4 = "Block others"; + 8 = "Render sides"; + 16 = "Render planes"; + 32 = "Water"; + 64 = "No shadow"; + 128 = "Cut solid walls"; + 256 = "Cut extra walls"; + 512 = "Split sprites"; + 1024 = "Render inside planes"; + 2048 = "Extra"; + 8192 = "Fog"; + 16384 = "Only render inside planes"; + 32768 = "Render inside walls"; + 65536 = "Only render inside walls"; + 131072 = "Double shadow"; + 262144 = "Water bobbing"; + 524288 = "Don't respawn"; + 1048576 = "Crumbling"; + 2097152 = "Goo water"; + 4194304 = "Mario block"; + 33554432 = "Intangible from below"; + 67108864 = "Intangible from above"; + 134217728 = "Ripple effect"; + 268435456 = "Don't copy light level"; + 536870912 = "Bouncy"; + 1073741824 = "Cut cyan flat pixels"; + } + } + } + 260 + { + title = "Generalized 3D Floor"; + prefix = "(260)"; + id = "Sector_Set3dFloor"; + requiresactivation = false; + + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Type"; + type = 26; + default = 1; + enum + { + 1 = "Solid"; + 2 = "Water"; + 3 = "Intangible"; + } + flags + { + 4 = "Render insides"; + 16 = "Only render insides"; + } + } + arg2 + { + title = "Flags"; + type = 12; + enum + { + 1 = "No shadow"; + 2 = "Double shadow"; + 4 = "Fog"; + } + } + arg3 + { + title = "Alpha"; + default = 255; + } + } + } + + linedeftrigger + { + title = "Linedef Executor Trigger"; + + 300 + { + title = "Basic"; + prefix = "(300)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum = "triggertype"; + } + } + + 303 + { + title = "Ring Count"; + prefix = "(303)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum = "triggertype"; + } + arg1 + { + title = "Rings"; + } + arg2 + { + title = "Comparison"; + type = 11; + enum = "comparison"; + } + arg3 + { + title = "Count all players?"; + type = 11; + enum = "noyes"; + } + } + + 305 + { + title = "Character Ability"; + prefix = "(305)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum = "triggertype"; + } + arg1 + { + title = "Ability"; + type = 11; + enum + { + 0 = "None"; + 1 = "Thok"; + 2 = "Fly"; + 3 = "Glide and climb"; + 4 = "Homing attack"; + 5 = "Swim"; + 6 = "Double jump"; + 7 = "Float"; + 8 = "Float with slow descent"; + 9 = "Telekinesis"; + 10 = "Fall switch"; + 11 = "Jump boost"; + 12 = "Air drill"; + 13 = "Jump-thok"; + 14 = "Pogo bounce"; + 15 = "Twin spin"; + } + } + } + + 308 + { + title = "Gametype"; + prefix = "(308)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum = "triggertype"; + } + arg1 + { + title = "Rules"; + type = 12; + enum + { + 1 = "Campaign"; + 2 = "Ringslinger"; + 4 = "Spectators"; + 8 = "Lives"; + 16 = "Teams"; + 32 = "First person"; + 64 = "Match emeralds"; + 128 = "Team flags"; + 256 = "Coop"; + 512 = "Allow special stages"; + 1024 = "Spawn emerald tokens"; + 2048 = "Emerald hunt"; + 4096 = "Race"; + 8192 = "Tag"; + 16384 = "Point limit"; + 32768 = "Time limit"; + 65536 = "Overtime"; + 131072 = "Hurt messages"; + 262144 = "Friendly fire"; + 524288 = "Hide time countdown"; + 1048576 = "Frozen after hide time"; + 2097152 = "Blindfolded view"; + 4194304 = "Respawn delay"; + 8388608 = "Award pity shield"; + 16777216 = "Death score penalty"; + 33554432 = "No spectator spawn"; + 67108864 = "Use match starts"; + 134217728 = "Spawn invincibility"; + 268435456 = "Allow enemies"; + 536870912 = "Allow exit sectors"; + 1073741824 = "No title card"; + 2147483648 = "Allow cutscenes"; + } + } + arg2 + { + title = "Check if"; + type = 11; + enum = "flagcheck"; + } + } + + 309 + { + title = "CTF Team"; + prefix = "(309)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum = "triggertype"; + } + arg1 + { + title = "Team"; + type = 11; + enum = "team"; + } + } + + 313 + { + title = "No More Enemies"; + prefix = "(313)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + } + + 314 + { + title = "Number of Pushables"; + prefix = "(314)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum = "triggertype"; + } + arg1 + { + title = "Pushables"; + } + arg2 + { + title = "Comparison"; + type = 11; + enum = "comparison"; + } + } + + 317 + { + title = "Condition Set Trigger"; + prefix = "(317)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum = "triggertype"; + } + arg1 + { + title = "Trigger ID"; + } + } + + 319 + { + title = "Unlockable"; + prefix = "(319)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum = "triggertype"; + } + arg1 + { + title = "Unlockable ID"; + } + } + + 321 + { + title = "Trigger After X Calls"; + prefix = "(321)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum = "xtriggertype"; + } + arg1 + { + title = "Calls"; + } + arg2 + { + title = "Can retrigger?"; + type = 11; + enum = "noyes"; + } + arg3 + { + title = "Starting calls"; + } + } + + 323 + { + title = "NiGHTSerize"; + prefix = "(323)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum + { + 0 = "Each time"; + 1 = "Once"; + } + } + arg1 + { + title = "Mare number"; + } + arg2 + { + title = "Lap number"; + } + arg3 + { + title = "Mare comparison"; + type = 11; + enum = "comparison"; + } + arg4 + { + title = "Lap comparison"; + type = 11; + enum = "comparison"; + } + arg5 + { + title = "Compared player"; + type = 11; + enum + { + 0 = "Fastest"; + 1 = "Slowest"; + 2 = "Triggerer"; + } + } + arg6 + { + title = "NiGHTS check"; + type = 11; + enum + { + 0 = "No check"; + 1 = "Trigger if player was not NiGHTS"; + 2 = "Trigger if player was already NiGHTS"; + } + } + arg7 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Only count bonus time laps"; + 2 = "Only trigger if final mare completed"; + } + } + } + 325 + { + title = "De-NiGHTSerize"; + prefix = "(325)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum + { + 0 = "Each time"; + 1 = "Once"; + } + } + arg1 + { + title = "Mare number"; + } + arg2 + { + title = "Lap number"; + } + arg3 + { + title = "Mare comparison"; + type = 11; + enum = "comparison"; + } + arg4 + { + title = "Lap comparison"; + type = 11; + enum = "comparison"; + } + arg5 + { + title = "Compared player"; + type = 11; + enum + { + 0 = "Fastest"; + 1 = "Slowest"; + 2 = "Triggerer"; + } + } + arg6 + { + title = "NiGHTS check"; + type = 11; + enum + { + 0 = "No check"; + 1 = "Trigger if nobody is now NiGHTS"; + 2 = "Trigger if somebody is still NiGHTS"; + } + } + arg7 + { + title = "Only bonus laps?"; + type = 11; + enum = "noyes"; + } + } + 327 + { + title = "NiGHTS Lap"; + prefix = "(327)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum + { + 0 = "Each time"; + 1 = "Once"; + } + } + arg1 + { + title = "Mare number"; + } + arg2 + { + title = "Lap number"; + } + arg3 + { + title = "Mare comparison"; + type = 11; + enum = "comparison"; + } + arg4 + { + title = "Lap comparison"; + type = 11; + enum = "comparison"; + } + arg5 + { + title = "Compared player"; + type = 11; + enum + { + 0 = "Fastest"; + 1 = "Slowest"; + 2 = "Triggerer"; + } + } + arg6 + { + title = "Only bonus laps?"; + type = 11; + enum = "noyes"; + } + } + 329 + { + title = "Ideya Capture Touch"; + prefix = "(329)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum + { + 0 = "Each time"; + 1 = "Once"; + } + } + arg1 + { + title = "Mare number"; + } + arg2 + { + title = "Lap number"; + } + arg3 + { + title = "Mare comparison"; + type = 11; + enum = "comparison"; + } + arg4 + { + title = "Lap comparison"; + type = 11; + enum = "comparison"; + } + arg5 + { + title = "Compared player"; + type = 11; + enum + { + 0 = "Fastest"; + 1 = "Slowest"; + 2 = "Triggerer"; + } + } + arg6 + { + title = "Spheres check"; + type = 11; + enum + { + 0 = "Trigger if enough spheres"; + 1 = "Trigger if not enough spheres"; + 2 = "Trigger regardless of spheres"; + } + } + arg7 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Only count bonus time laps"; + 2 = "Trigger upon entering Ideya Capture"; + } + } + } + + 331 + { + title = "Player Skin"; + prefix = "(331)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum = "triggertype"; + } + arg1 + { + title = "Invert choice?"; + type = 11; + enum = "noyes"; + } + stringarg0 + { + title = "Skin name"; + type = 2; + } + } + + 334 + { + title = "Object Dye"; + prefix = "(334)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum = "triggertype"; + } + arg1 + { + title = "Invert choice?"; + type = 11; + enum = "noyes"; + } + stringarg0 + { + title = "Color"; + type = 2; + } + } + + 337 + { + title = "Emerald Check"; + prefix = "(337)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum = "triggertype"; + } + arg1 + { + title = "Emeralds"; + type = 12; + enum + { + 1 = "Emerald 1"; + 2 = "Emerald 2"; + 4 = "Emerald 3"; + 8 = "Emerald 4"; + 16 = "Emerald 5"; + 32 = "Emerald 6"; + 64 = "Emerald 7"; + } + } + arg2 + { + title = "Check if"; + type = 11; + enum = "flagcheck"; + } + } + + 340 + { + title = "NiGHTS Mare"; + prefix = "(340)"; + arg0 + { + title = "Trigger type"; + type = 11; + enum = "triggertype"; + } + arg1 + { + title = "Mare"; + } + arg2 + { + title = "Comparison"; + type = 11; + enum = "comparison"; + } + } + + 399 + { + title = "Level Load"; + prefix = "(399)"; + } + } + + linedefexecsector + { + title = "Linedef Executor (sector)"; + + 400 + { + title = "Set Tagged Sector's Heights/Textures"; + prefix = "(400)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Affected planes"; + type = 11; + enum = "floorceiling"; + } + arg2 + { + title = "Set flats?"; + type = 11; + enum = "noyes"; + } + } + + 402 + { + title = "Copy Light Level to Tagged Sectors"; + prefix = "(402)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Don't copy main light level"; + 2 = "Don't copy floor light level"; + 4 = "Don't copy ceiling light level"; + } + } + } + + 408 + { + title = "Set Tagged Sector's Flats"; + prefix = "(408)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Affected planes"; + type = 11; + enum = "floorceiling"; + } + } + + 409 + { + title = "Change Tagged Sector's Tag"; + prefix = "(409)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Tag"; + type = 13; + } + arg2 + { + title = "Behavior"; + type = 11; + enum + { + 0 = "Add tag"; + 1 = "Remove tag"; + 2 = "Replace first tag"; + 3 = "Change trigger tag"; + } + } + } + + 410 + { + title = "Change Front Sector's Tag"; + prefix = "(410)"; + arg0 + { + title = "Tag"; + type = 13; + } + arg1 + { + title = "Behavior"; + type = 11; + enum + { + 0 = "Add tag"; + 1 = "Remove tag"; + 2 = "Replace first tag"; + 3 = "Change trigger tag"; + } + } + } + + 416 + { + title = "Start Adjustable Flickering Light"; + prefix = "(416)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Speed"; + } + arg2 + { + title = "Brightness 1"; + } + arg3 + { + title = "Use target brightness?"; + type = 11; + enum = "noyes"; + } + arg4 + { + title = "Brightness 2"; + } + } + + 417 + { + title = "Start Adjustable Pulsating Light"; + prefix = "(417)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Speed"; + } + arg2 + { + title = "Brightness 1"; + } + arg3 + { + title = "Use target brightness?"; + type = 11; + enum = "noyes"; + } + arg4 + { + title = "Brightness 2"; + } + } + + 418 + { + title = "Start Adjustable Blinking Light"; + prefix = "(418)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Brightness 1 tics"; + } + arg2 + { + title = "Brightness 2 tics"; + } + arg3 + { + title = "Brightness 1"; + } + arg4 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Use target brightness"; + 2 = "Synchronized"; + } + } + arg5 + { + title = "Brightness 2"; + } + } + + 420 + { + title = "Fade Light Level"; + prefix = "(420)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Destination light level"; + } + arg2 + { + title = "Fading speed"; + } + arg3 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Add to current light level"; + 2 = "Interrupt ongoing fades"; + 4 = "Speed is duration"; + } + } + } + + 421 + { + title = "Stop Lighting Effect"; + prefix = "(421)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + } + + 435 + { + title = "Change Plane Scroller Direction"; + prefix = "(435)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Speed"; + } + } + + 467 + { + title = "Set Tagged Sector's Light Level"; + prefix = "(467)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Light level"; + } + arg2 + { + title = "Affected area"; + type = 11; + enum + { + 0 = "Sector"; + 1 = "Floor"; + 2 = "Ceiling"; + } + } + arg3 + { + title = "Set/Add?"; + type = 11; + enum = "setadd"; + } + } + + 469 + { + title = "Change Tagged Sector's Gravity"; + prefix = "(469)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Set/Multiply?"; + type = 11; + enum + { + 0 = "Set"; + 1 = "Multiply"; + } + } + arg2 + { + title = "Flip flag"; + type = 11; + enum + { + 0 = "Don't change"; + 1 = "Set"; + 2 = "Remove"; + } + } + stringarg0 + { + title = "Gravity value"; + type = 2; + } + } + } + + linedefexecplane + { + title = "Linedef Executor (plane movement)"; + + 403 + { + title = "Move Tagged Sector's Planes"; + prefix = "(403)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Affected planes"; + type = 11; + enum = "floorceiling"; + } + arg2 + { + title = "Speed"; + } + arg3 + { + title = "Linedef executor tag"; + type = 15; + } + arg4 + { + title = "Set flats?"; + type = 11; + enum = "noyes"; + } + } + + 405 + { + title = "Move Planes by Distance"; + prefix = "(405)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Affected planes"; + type = 11; + enum = "floorceiling"; + } + arg2 + { + title = "Distance"; + } + arg3 + { + title = "Speed"; + } + arg4 + { + title = "Instant?"; + type = 11; + enum = "noyes"; + } + } + + 411 + { + title = "Stop Plane Movement"; + prefix = "(411)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + } + + 428 + { + title = "Start Platform Movement"; + prefix = "(428)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Speed"; + } + arg2 + { + title = "Starting delay"; + } + arg3 + { + title = "Delay before flip"; + } + arg4 + { + title = "Starting direction"; + type = 11; + enum + { + 0 = "Down"; + 1 = "Up"; + } + } + } + + 429 + { + title = "Crush Planes Once"; + prefix = "(429)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Affected planes"; + type = 11; + enum = "floorceiling"; + } + arg2 + { + title = "Crush speed"; + } + arg3 + { + title = "Retract speed"; + } + } + } + + linedefexecplayer + { + title = "Linedef Executor (player/object)"; + + 412 + { + title = "Teleporter"; + prefix = "(412)"; + arg0 + { + title = "Destination tag"; + type = 14; + } + arg1 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Silent"; + 2 = "Keep angle"; + 4 = "Keep momentum"; + 8 = "Relative silent"; + } + } + arg2 + { + title = "X offset"; + } + arg3 + { + title = "Y offset"; + } + arg4 + { + title = "Z offset"; + } + } + + 425 + { + title = "Change Object State"; + prefix = "(425)"; + stringarg0 + { + title = "State"; + type = 2; + } + } + + 426 + { + title = "Stop Object"; + prefix = "(426)"; + arg0 + { + title = "Move to center?"; + type = 11; + enum = "noyes"; + } + } + + 427 + { + title = "Award Score"; + prefix = "(427)"; + arg0 + { + title = "Score"; + } + } + + 432 + { + title = "Enable/Disable 2D Mode"; + prefix = "(432)"; + arg0 + { + title = "Mode"; + type = 11; + enum + { + 0 = "2D"; + 1 = "3D"; + } + } + } + + 433 + { + title = "Enable/Disable Gravity Flip"; + prefix = "(433)"; + arg0 + { + title = "Gravity"; + type = 11; + enum + { + 0 = "Reverse"; + 1 = "Normal"; + } + } + } + + 434 + { + title = "Award Power-Up"; + prefix = "(434)"; + stringarg0 + { + title = "Power"; + type = 2; + } + stringarg1 + { + title = "Duration/Amount"; + type = 2; + } + } + + 437 + { + title = "Disable Player Control"; + prefix = "(437)"; + arg0 + { + title = "Time"; + } + arg1 + { + title = "Allow jumping?"; + type = 11; + enum = "noyes"; + } + } + + 438 + { + title = "Change Object Size"; + prefix = "(438)"; + arg0 + { + title = "Size (%)"; + default = 100; + } + } + + 442 + { + title = "Change Object Type State"; + prefix = "(442)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Change to"; + type = 11; + enum + { + 0 = "Specified state"; + 1 = "Next state"; + } + } + stringarg0 + { + title = "Object type"; + type = 2; + } + stringarg1 + { + title = "State"; + type = 2; + } + } + + 457 + { + title = "Track Object's Angle"; + prefix = "(457)"; + arg0 + { + title = "Anchor tag"; + type = 14; + } + arg1 + { + title = "Angle tolerance"; + type = 8; + } + arg2 + { + title = "Time tolerance"; + } + arg3 + { + title = "Trigger linedef tag"; + type = 15; + } + arg4 + { + title = "Track after failure?"; + type = 11; + enum = "noyes"; + } + } + + 458 + { + title = "Stop Tracking Object's Angle"; + prefix = "(458)"; + } + + 460 + { + title = "Award Rings"; + prefix = "(460)"; + arg0 + { + title = "Rings"; + } + arg1 + { + title = "Periodicity"; + } + } + + 461 + { + title = "Spawn Object"; + prefix = "(461)"; + arg0 + { + title = "X position"; + } + arg1 + { + title = "Y position"; + } + arg2 + { + title = "Z position"; + } + arg3 + { + title = "Angle"; + type = 8; + } + arg4 + { + title = "Randomize position?"; + type = 11; + enum = "noyes"; + } + arg5 + { + title = "Max X position"; + } + arg6 + { + title = "Max Y position"; + } + arg7 + { + title = "Max Z position"; + } + stringarg0 + { + title = "Object type"; + type = 2; + } + } + + 462 + { + title = "Stop Timer/Exit Stage in Record Attack"; + prefix = "(462)"; + } + + 463 + { + title = "Dye Object"; + prefix = "(463)"; + stringarg0 + { + title = "Skin color"; + type = 2; + } + } + + 464 + { + title = "Trigger Egg Capsule"; + prefix = "(464)"; + arg0 + { + title = "Egg Capsule tag"; + type = 14; + } + arg1 + { + title = "End level?"; + type = 11; + enum = "yesno"; + } + } + + 466 + { + title = "Set Level Failure State"; + prefix = "(466)"; + arg0 + { + title = "State"; + type = 11; + enum + { + 0 = "Failure"; + 1 = "Success"; } } } @@ -1794,6 +4393,219 @@ udmf { title = "Linedef Executor (misc.)"; + 413 + { + title = "Change Music"; + prefix = "(413)"; + arg0 + { + title = "Flags"; + type = 12; + enum + { + 1 = "For all players"; + 2 = "Seek offset from current position"; + 4 = "Fade to custom volume"; + 8 = "Don't reload after death"; + 16 = "Force music reload"; + 32 = "Don't loop"; + } + } + arg1 + { + title = "Position"; + } + arg2 + { + title = "Fade out time"; + } + arg3 + { + title = "Fade in time"; + } + arg4 + { + title = "Fade destination volume"; + } + arg5 + { + title = "Fade start volume"; + default = -1; + } + arg6 + { + title = "Track number"; + } + stringarg0 + { + title = "Music name"; + type = 2; + } + } + + 414 + { + title = "Play Sound Effect"; + prefix = "(414)"; + arg0 + { + title = "Source"; + type = 11; + enum + { + 0 = "Triggering object"; + 1 = "Trigger sector"; + 2 = "Nowhere"; + 3 = "Tagged sectors"; + } + } + arg1 + { + title = "Listener"; + type = 11; + enum + { + 0 = "Triggering player"; + 1 = "Everyone"; + 2 = "Everyone touching tagged sectors"; + } + } + arg2 + { + title = "Target sector tag"; + type = 13; + } + stringarg0 + { + title = "Sound name"; + type = 2; + } + } + + 415 + { + title = "Run Script"; + prefix = "(415)"; + stringarg0 + { + title = "Lump name"; + type = 2; + } + } + + 422 + { + title = "Switch to Cut-Away View"; + prefix = "(422)"; + arg0 + { + title = "Viewpoint tag"; + type = 14; + } + arg1 + { + title = "Time"; + } + } + + 423 + { + title = "Change Sky"; + prefix = "(423)"; + arg0 + { + title = "Sky number"; + } + arg1 + { + title = "For all players?"; + type = 11; + enum = "noyes"; + } + } + + 424 + { + title = "Change Weather"; + prefix = "(424)"; + arg0 + { + title = "Weather"; + type = 11; + enum + { + 0 = "None"; + 1 = "Storm (thunder, lightning and rain)"; + 2 = "Snow"; + 3 = "Rain"; + 4 = "Preloaded"; + 5 = "Storm (no rain)"; + 6 = "Storm (no lightning)"; + } + } + arg1 + { + title = "For all players?"; + type = 11; + enum = "noyes"; + } + } + + 436 + { + title = "Shatter FOF"; + prefix = "(436)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Control sector tag"; + type = 13; + } + } + + 439 + { + title = "Change Tagged Linedef's Textures"; + prefix = "(439)"; + arg0 + { + title = "Target linedef tag"; + type = 15; + } + arg1 + { + title = "Affected sides"; + type = 11; + enum = "frontbackboth"; + } + arg2 + { + title = "Change unset textures?"; + type = 11; + enum = "yesno"; + } + } + + 440 + { + title = "Start Metal Sonic Race"; + prefix = "(440)"; + } + + 441 + { + title = "Condition Set Trigger"; + prefix = "(441)"; + arg0 + { + title = "Trigger number"; + } + } + 443 { title = "Call Lua Function"; @@ -1805,6 +4617,74 @@ udmf } } + 444 + { + title = "Earthquake"; + prefix = "(444)"; + arg0 + { + title = "Duration"; + } + arg1 + { + title = "Intensity"; + } + } + + 445 + { + title = "Make FOF Disappear/Reappear"; + prefix = "(445)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Control sector tag"; + type = 13; + } + arg2 + { + title = "Effect"; + type = 11; + enum + { + 0 = "Disappear"; + 1 = "Reappear"; + } + } + } + + 446 + { + title = "Make FOF Crumble"; + prefix = "(446)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Control sector tag"; + type = 13; + } + arg2 + { + title = "Respawn?"; + type = 11; + enum + { + 0 = "Yes"; + 1 = "No"; + 2 = "Unless FF_NORETURN"; + 3 = "Only if FF_NORETURN"; + } + } + } + 447 { title = "Change Tagged Sector's Colormap"; @@ -1841,6 +4721,178 @@ udmf } } + 448 + { + title = "Change Skybox"; + prefix = "(448)"; + arg0 + { + title = "Viewpoint ID"; + } + arg1 + { + title = "Centerpoint ID"; + } + arg2 + { + title = "Change?"; + type = 11; + enum + { + 0 = "Viewpoint"; + 1 = "Centerpoint"; + 2 = "Both"; + } + } + arg3 + { + title = "For all players?"; + type = 11; + enum = "noyes"; + } + } + + 449 + { + title = "Enable Bosses with Parameter"; + prefix = "(449)"; + arg0 + { + title = "Boss ID"; + } + arg1 + { + title = "Effect"; + type = 11; + enum + { + 0 = "Enable"; + 1 = "Disable"; + } + } + } + + 450 + { + title = "Execute Linedef Executor (specific tag)"; + prefix = "(450)"; + arg0 + { + title = "Trigger linedef tag"; + type = 15; + } + } + + 451 + { + title = "Execute Linedef Executor (random tag in range)"; + prefix = "(451)"; + arg0 + { + title = "Start of tag range"; + type = 15; + } + arg1 + { + title = "End of tag range"; + type = 15; + } + } + + 452 + { + title = "Set FOF Translucency"; + prefix = "(452)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Control sector tag"; + type = 13; + } + arg2 + { + title = "Alpha"; + } + arg3 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Add to current translucency"; + 2 = "Don't handle FF_TRANSLUCENT"; + } + } + } + + 453 + { + title = "Fade FOF"; + prefix = "(453)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Control sector tag"; + type = 13; + } + arg2 + { + title = "Alpha"; + } + arg3 + { + title = "Fading speed"; + } + arg4 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Add to current translucency"; + 2 = "Interrupt ongoing fades"; + 4 = "Speed is duration"; + 8 = "Don't change collision"; + 16 = "No collision during fade"; + 32 = "Don't handle FF_TRANSLUCENT"; + 64 = "Don't handle FF_EXISTS"; + 128 = "Don't fade lighting"; + 256 = "Don't fade colormap"; + 512 = "Use exact alpha in OpenGL"; + } + } + } + + 454 + { + title = "Stop Fading FOF"; + prefix = "(454)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Control sector tag"; + type = 13; + } + arg2 + { + title = "Finalize collision?"; + type = 11; + enum = "yesno"; + } + } + 455 { title = "Fade Tagged Sector's Colormap"; @@ -1894,6 +4946,42 @@ udmf } } + 459 + { + title = "Control Text Prompt"; + prefix = "(459)"; + arg0 + { + title = "Prompt number"; + } + arg1 + { + title = "Page number"; + } + arg2 + { + title = "Flags"; + type = 11; + enum + { + 1 = "Close current text prompt"; + 2 = "Trigger linedef executor on close"; + 4 = "Find prompt by name"; + 8 = "Don't disable controls"; + } + } + arg3 + { + title = "Trigger linedef tag"; + type = 15; + } + stringarg0 + { + title = "Prompt name"; + type = 2; + } + } + 465 { title = "Set Linedef Executor Delay"; @@ -1909,12 +4997,400 @@ udmf } arg2 { - title = "Set/add?"; + title = "Set/Add?"; + type = 11; + enum = "setadd"; + } + } + + 468 + { + title = "Change Linedef Argument"; + prefix = "(468)"; + arg0 + { + title = "Linedef tag"; + type = 15; + } + arg1 + { + title = "Argument"; + } + arg2 + { + title = "Value"; + } + arg3 + { + title = "Set/Add?"; + type = 11; + enum = "setadd"; + } + } + } + + linedefexecpoly + { + title = "Linedef Executor (polyobject)"; + + 480 + { + title = "Door Slide"; + prefix = "(480)"; + arg0 + { + title = "PolyObject ID"; + type = 14; + } + arg1 + { + title = "Speed"; + } + arg2 + { + title = "Distance"; + } + arg3 + { + title = "Return delay"; + } + } + + 481 + { + title = "Door Swing"; + prefix = "(481)"; + arg0 + { + title = "PolyObject ID"; + type = 14; + } + arg1 + { + title = "Speed"; + } + arg2 + { + title = "Rotation"; + type = 8; + } + arg3 + { + title = "Return delay"; + } + } + + 482 + { + title = "Move"; + prefix = "(482)"; + arg0 + { + title = "PolyObject ID"; + type = 14; + } + arg1 + { + title = "Speed"; + } + arg2 + { + title = "Distance"; + } + arg3 + { + title = "Override?"; + type = 11; + enum = "noyes"; + } + } + + 484 + { + title = "Rotate"; + prefix = "(484)"; + arg0 + { + title = "PolyObject ID"; + type = 14; + } + arg1 + { + title = "Speed"; + } + arg2 + { + title = "Rotation"; + type = 8; + } + arg3 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Don't turn others"; + 2 = "Turn players"; + 4 = "Continuous rotation"; + 8 = "Override"; + } + } + } + + 488 + { + title = "Move by Waypoints"; + prefix = "(488)"; + arg0 + { + title = "PolyObject ID"; + type = 14; + } + arg1 + { + title = "Speed"; + } + arg2 + { + title = "Waypoint sequence"; + } + arg3 + { + title = "Return behavior"; type = 11; enum { - 0 = "Set"; - 1 = "Add"; + 0 = "Don't return"; + 1 = "Return to first waypoint"; + 2 = "Repeat sequence in reverse"; + } + } + arg4 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Move in reverse"; + 2 = "Loop movement"; + } + } + } + + 489 + { + title = "Set Visibility, Tangibility"; + prefix = "(489)"; + arg0 + { + title = "PolyObject ID"; + type = 14; + } + arg1 + { + title = "Visibility"; + type = 11; + enum + { + 0 = "No change"; + 1 = "Visible"; + 2 = "Invisible"; + } + } + arg2 + { + title = "Tangibility"; + type = 11; + enum + { + 0 = "No change"; + 1 = "Tangible"; + 2 = "Intangible"; + } + } + } + + 491 + { + title = "Set Translucency"; + prefix = "(491)"; + arg0 + { + title = "PolyObject ID"; + type = 14; + } + arg1 + { + title = "Translucency level"; + } + arg2 + { + title = "Set/Add?"; + type = 11; + enum = "setadd"; + } + } + + 492 + { + title = "Fade Translucency"; + prefix = "(492)"; + arg0 + { + title = "PolyObject ID"; + type = 14; + } + arg1 + { + title = "Translucency level"; + } + arg2 + { + title = "Fading speed"; + } + arg3 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Add to current translucency"; + 2 = "Interrupt ongoing fades"; + 4 = "Speed is duration"; + 8 = "Don't change collision"; + 16 = "No collision during fade"; + } + } + } + } + + scrollpush + { + title = "Scrollers and Pushers"; + + 500 + { + title = "Scroll Walls"; + prefix = "(500)"; + arg0 + { + title = "Side"; + type = 11; + enum = "frontbackboth"; + } + arg1 + { + title = "Horizontal speed"; + } + arg2 + { + title = "Vertical speed"; + } + } + + 502 + { + title = "Scroll Walls Remotely"; + prefix = "(502)"; + arg0 + { + title = "Linedef tag"; + type = 15; + } + arg1 + { + title = "Side"; + type = 11; + enum = "frontbackboth"; + } + arg2 + { + title = "Horizontal speed"; + } + arg3 + { + title = "Vertical speed"; + } + arg4 + { + title = "Type"; + type = 11; + enum = "scrolltype"; + } + } + + 510 + { + title = "Scroll Planes"; + prefix = "(510)"; + arg0 + { + title = "Sector tag"; + type = 13; + } + arg1 + { + title = "Affected planes"; + type = 11; + enum = "floorceiling"; + } + arg2 + { + title = "Scroll/Carry?"; + type = 11; + enum = "scrollcarry"; + } + arg3 + { + title = "Base speed"; + } + arg4 + { + title = "Type"; + type = 26; + enum = "scrolltype"; + flags + { + 4 = "Non-exclusive"; + } + } + } + + 541 + { + title = "Wind/Current"; + prefix = "(541)"; + arg0 + { + title = "Sector tag"; + type = 13; + } + arg1 + { + title = "Horizontal speed"; + } + arg2 + { + title = "Vertical speed"; + } + arg3 + { + title = "Type"; + type = 11; + enum + { + 0 = "Wind"; + 1 = "Current"; + } + } + arg4 + { + title = "Flags"; + type = 12; + flags + { + 1 = "Slide"; + 2 = "Non-exclusive"; } } } @@ -1922,6 +5398,120 @@ udmf light { + title = "Lighting"; + + 600 + { + title = "Copy Light Level to Tagged Sector's Planes"; + prefix = "(600)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Affected planes"; + type = 11; + enum = "floorceiling"; + } + } + + 602 + { + title = "Adjustable Pulsating Light"; + prefix = "(602)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Speed"; + } + arg2 + { + title = "Brightness 1"; + } + arg3 + { + title = "Use target brightness?"; + type = 11; + enum = "noyes"; + } + arg4 + { + title = "Brightness 2"; + } + } + + 603 + { + title = "Adjustable Flickering Light"; + prefix = "(603)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Speed"; + } + arg2 + { + title = "Brightness 1"; + } + arg3 + { + title = "Use target brightness?"; + type = 11; + enum = "noyes"; + } + arg4 + { + title = "Brightness 2"; + } + } + + 604 + { + title = "Adjustable Blinking Light"; + prefix = "(604)"; + arg0 + { + title = "Target sector tag"; + type = 13; + } + arg1 + { + title = "Brightness 1 tics"; + } + arg2 + { + title = "Brightness 2 tics"; + } + arg3 + { + title = "Brightness 1"; + } + arg4 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Use target brightness"; + 2 = "Synchronized"; + } + } + arg5 + { + title = "Brightness 2"; + } + } + 606 { title = "Copy Colormap"; @@ -1968,6 +5558,7 @@ udmf { 1 = "No physics"; 2 = "Dynamic"; + 4 = "Copy to other side"; } } } @@ -2052,5 +5643,21 @@ udmf } } } + + 799 + { + title = "Set Tagged Dynamic Slope Vertex to Front Sector Height"; + prefix = "(799)"; + arg0 + { + title = "Apply height"; + type = 11; + enum + { + 0 = "Absolute"; + 1 = "Relative"; + } + } + } } -} \ No newline at end of file +} diff --git a/extras/conf/udb/Includes/SRB222_misc.cfg b/extras/conf/udb/Includes/SRB222_misc.cfg index 50c83e456..fcc24741e 100644 --- a/extras/conf/udb/Includes/SRB222_misc.cfg +++ b/extras/conf/udb/Includes/SRB222_misc.cfg @@ -58,7 +58,6 @@ linedefflags_udmf wrapmidtex = "Repeat Midtexture"; netonly = "Netgame Only"; nonet = "No Netgame"; - effect6 = "Effect 6"; bouncy = "Bouncy Wall"; transfer = "Transfer Line"; } @@ -78,6 +77,33 @@ sectorflags colormapfog = "Fog Planes in Colormap"; colormapfadesprites = "Fade Fullbright in Colormap"; colormapprotected = "Protected Colormap"; + flipspecial_nofloor = "No Trigger on Floor Touch"; + flipspecial_ceiling = "Trigger on Ceiling Touch"; + triggerspecial_touch = "Trigger on Edge Touch"; + triggerspecial_headbump = "Trigger on Headbump"; + triggerline_plane = "Linedef Trigger Requires Plane Touch"; + triggerline_mobj = "Non-Pushables Can Trigger Linedef"; + invertprecip = "Invert Precipitation"; + gravityflip = "Flip Objects in Reverse Gravity"; + heatwave = "Heat Wave"; + noclipcamera = "Intangible to the Camera"; + outerspace = "Space Countdown"; + doublestepup = "Ramp Sector (double step-up/down)"; + nostepdown = "Non-Ramp Sector (No step-down)"; + speedpad = "Speed Pad"; + starpostactivator = "Star Post Activator"; + exit = "Exit"; + specialstagepit = "Special Stage Pit"; + returnflag = "Return Flag"; + redteambase = "Red Team Base"; + blueteambase = "Blue Team Base"; + fan = "Fan Sector"; + supertransform = "Super Sonic Transform"; + forcespin = "Force Spin"; + zoomtubestart = "Zoom Tube Start"; + zoomtubeend = "Zoom Tube End"; + finishline = "Circuit Finish Line"; + ropehang = "Rope Hang"; } thingflags @@ -91,10 +117,7 @@ thingflags // THING FLAGS thingflags_udmf { - extra = "Extra"; flip = "Flip"; - special = "Special"; - ambush = "Ambush"; } @@ -227,6 +250,30 @@ universalfields type = 3; default = false; } + + friction + { + type = 1; + default = 0.90625; + } + + triggertag + { + type = 15; + default = 0; + } + + triggerer + { + type = 0; + default = 0; + enum + { + 0 = "Player"; + 1 = "All players"; + 2 = "Object"; + } + } } linedef @@ -236,6 +283,26 @@ universalfields type = 0; default = 0; } + arg6 + { + type = 0; + default = 0; + } + arg7 + { + type = 0; + default = 0; + } + arg8 + { + type = 0; + default = 0; + } + arg9 + { + type = 0; + default = 0; + } stringarg0 { type = 2; @@ -264,6 +331,41 @@ universalfields thing { + arg5 + { + type = 0; + default = 0; + } + arg6 + { + type = 0; + default = 0; + } + arg7 + { + type = 0; + default = 0; + } + arg8 + { + type = 0; + default = 0; + } + arg9 + { + type = 0; + default = 0; + } + stringarg0 + { + type = 2; + default = ""; + } + stringarg1 + { + type = 2; + default = ""; + } } } @@ -410,6 +512,12 @@ enums 1 = "Yes"; } + setadd + { + 0 = "Set"; + 1 = "Add"; + } + onoff { 0 = "On"; @@ -441,6 +549,13 @@ enums 2 = "Back"; } + frontbackboth + { + 0 = "Front"; + 1 = "Back"; + 2 = "Front and back"; + } + tangibility { 1 = "Intangible from top"; @@ -448,6 +563,100 @@ enums 4 = "Don't block players"; 8 = "Don't block non-players"; } + + floorceiling + { + 0 = "Floor"; + 1 = "Ceiling"; + 2 = "Both"; + } + + scrollcarry + { + 0 = "Scroll and carry"; + 1 = "Scroll"; + 2 = "Carry"; + } + + scrolltype + { + 0 = "Regular"; + 1 = "Accelerative"; + 2 = "Displacement"; + } + + comparison + { + 0 = "Equal"; + 1 = "Less than or equal"; + 2 = "Greater than or equal"; + } + + triggertype + { + 0 = "Continuous"; + 1 = "Once"; + 2 = "Each time on entry"; + 3 = "Each time on entry/exit"; + } + + xtriggertype + { + 0 = "Continuous"; + 1 = "Each time on entry"; + 2 = "Each time on entry/exit"; + } + + team + { + 0 = "Red"; + 1 = "Blue"; + } + + flagcheck + { + 0 = "Has all"; + 1 = "Has any"; + 2 = "Has exactly"; + 3 = "Doesn't have all"; + 4 = "Doesn't have any"; + } + + maceflags + { + 1 = "Double size"; + 2 = "No sounds"; + 4 = "Player-turnable chain"; + 8 = "Swing instead of spin"; + 16 = "Make chain from end item"; + 32 = "Spawn link at origin"; + 64 = "Clip inside ground"; + 128 = "No distance check"; + } + + pushablebehavior + { + 0 = "Normal"; + 1 = "Slide"; + 2 = "Immovable"; + 3 = "Classic"; + } + + monitorrespawn + { + 0 = "Same item"; + 1 = "Random (Weak)"; + 2 = "Random (Strong)"; + } + + blendmodes + { + 0 = "Translucent"; + 1 = "Add"; + 2 = "Subtract"; + 3 = "Reverse subtract"; + 4 = "Modulate"; + } } //Default things filters @@ -626,4 +835,4 @@ flats start = "F_START"; end = "FF_END"; } -} \ No newline at end of file +} diff --git a/extras/conf/udb/Includes/SRB222_sectors.cfg b/extras/conf/udb/Includes/SRB222_sectors.cfg index 5cc14ad0f..f9df297e7 100644 --- a/extras/conf/udb/Includes/SRB222_sectors.cfg +++ b/extras/conf/udb/Includes/SRB222_sectors.cfg @@ -15,20 +15,18 @@ sectortypes 12 = "Space Countdown"; 13 = "Ramp Sector (double step-up/down)"; 14 = "Non-Ramp Sector (no step-down)"; - 15 = "Bouncy FOF"; + 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)"; + 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/Spheres Parameters"; - 176 = "Custom Global Gravity"; - 512 = "Wind/Current"; - 1024 = "Conveyor Belt"; + 160 = "Special Stage Time/Spheres Parameters "; + 176 = "Custom Global Gravity "; 1280 = "Speed Pad"; 4096 = "Star Post Activator"; 8192 = "Exit/Special Stage Pit/Return Flag"; @@ -63,7 +61,7 @@ gen_sectortypes 12 = "Space Countdown"; 13 = "Ramp Sector (double step-up/down)"; 14 = "Non-Ramp Sector (no step-down)"; - 15 = "Bouncy FOF"; + 15 = "Bouncy FOF "; } second @@ -74,19 +72,17 @@ gen_sectortypes 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)"; + 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/Spheres Parameters"; - 176 = "Custom Global Gravity"; + 160 = "Special Stage Time/Spheres Parameters "; + 176 = "Custom Global Gravity "; } third { 0 = "Normal"; - 512 = "Wind/Current"; - 1024 = "Conveyor Belt"; 1280 = "Speed Pad"; } diff --git a/extras/conf/udb/Includes/SRB222_things.cfg b/extras/conf/udb/Includes/SRB222_things.cfg index 0407741fc..1de661e29 100644 --- a/extras/conf/udb/Includes/SRB222_things.cfg +++ b/extras/conf/udb/Includes/SRB222_things.cfg @@ -3,3140 +3,8037 @@ // 8-Dark_Gray 9-Blue 10-Green 11-Cyan 12-Red 13-Magenta // 14-Yellow 15-White 16-Pink 17-Orange 18-Gold 19-Cream -editor +doom { - color = 15; // White - arrow = 1; - title = ""; - error = -1; - width = 8; - height = 16; - sort = 1; - - 3328 = "3D Mode Start"; -} - -starts -{ - color = 1; // Blue - arrow = 1; - title = "Player Starts"; - width = 16; - height = 48; - sprite = "PLAYA0"; - - 1 + editor { - title = "Player 01 Start"; - sprite = "PLAYA0"; - } - 2 - { - title = "Player 02 Start"; - sprite = "PLAYA0"; - } - 3 - { - title = "Player 03 Start"; - sprite = "PLAYA0"; - } - 4 - { - title = "Player 04 Start"; - sprite = "PLAYA0"; - } - 5 - { - title = "Player 05 Start"; - sprite = "PLAYA0"; - } - 6 - { - title = "Player 06 Start"; - sprite = "PLAYA0"; - } - 7 - { - title = "Player 07 Start"; - sprite = "PLAYA0"; - } - 8 - { - title = "Player 08 Start"; - sprite = "PLAYA0"; - } - 9 - { - title = "Player 09 Start"; - sprite = "PLAYA0"; - } - 10 - { - title = "Player 10 Start"; - sprite = "PLAYA0"; - } - 11 - { - title = "Player 11 Start"; - sprite = "PLAYA0"; - } - 12 - { - title = "Player 12 Start"; - sprite = "PLAYA0"; - } - 13 - { - title = "Player 13 Start"; - sprite = "PLAYA0"; - } - 14 - { - title = "Player 14 Start"; - sprite = "PLAYA0"; - } - 15 - { - title = "Player 15 Start"; - sprite = "PLAYA0"; - } - 16 - { - title = "Player 16 Start"; - sprite = "PLAYA0"; - } - 17 - { - title = "Player 17 Start"; - sprite = "PLAYA0"; - } - 18 - { - title = "Player 18 Start"; - sprite = "PLAYA0"; - } - 19 - { - title = "Player 19 Start"; - sprite = "PLAYA0"; - } - 20 - { - title = "Player 20 Start"; - sprite = "PLAYA0"; - } - 21 - { - title = "Player 21 Start"; - sprite = "PLAYA0"; - } - 22 - { - title = "Player 22 Start"; - sprite = "PLAYA0"; - } - 23 - { - title = "Player 23 Start"; - sprite = "PLAYA0"; - } - 24 - { - title = "Player 24 Start"; - sprite = "PLAYA0"; - } - 25 - { - title = "Player 25 Start"; - sprite = "PLAYA0"; - } - 26 - { - title = "Player 26 Start"; - sprite = "PLAYA0"; - } - 27 - { - title = "Player 27 Start"; - sprite = "PLAYA0"; - } - 28 - { - title = "Player 28 Start"; - sprite = "PLAYA0"; - } - 29 - { - title = "Player 29 Start"; - sprite = "PLAYA0"; - } - 30 - { - title = "Player 30 Start"; - sprite = "PLAYA0"; - } - 31 - { - title = "Player 31 Start"; - sprite = "PLAYA0"; - } - 32 - { - title = "Player 32 Start"; - sprite = "PLAYA0"; - } - 33 - { - title = "Match Start"; - sprite = "NDRNA2A8"; - } - 34 - { - title = "CTF Red Team Start"; - sprite = "SIGNG0"; - } - 35 - { - title = "CTF Blue Team Start"; - sprite = "SIGNE0"; - } -} - -enemies -{ - color = 9; // Light_Blue - arrow = 1; - title = "Enemies"; - - 100 - { - title = "Crawla (Blue)"; - sprite = "POSSA1"; - width = 24; - height = 32; - } - 101 - { - title = "Crawla (Red)"; - sprite = "SPOSA1"; - width = 24; - height = 32; - } - 102 - { - title = "Stupid Dumb Unnamed RoboFish"; - sprite = "FISHA0"; + color = 15; // White + arrow = 1; + title = ""; + error = -1; width = 8; - height = 28; + height = 16; + sort = 1; + + 3328 = "3D Mode Start"; } - 103 + + starts { - title = "Buzz (Gold)"; - sprite = "BUZZA1"; - width = 28; - height = 40; - } - 104 - { - title = "Buzz (Red)"; - sprite = "RBUZA1"; - width = 28; - height = 40; - } - 108 - { - title = "Deton"; - sprite = "DETNA1"; - width = 20; - height = 32; - } - 110 - { - title = "Turret"; - sprite = "TRETA1"; - width = 16; - height = 32; - } - 111 - { - title = "Pop-up Turret"; - sprite = "TURRI1"; - width = 12; - height = 64; - } - 122 - { - title = "Spring Shell (Green)"; - sprite = "SSHLA1"; - width = 24; - height = 40; - } - 125 - { - title = "Spring Shell (Yellow)"; - sprite = "SSHLI1"; - width = 24; - height = 40; - } - 109 - { - title = "Skim"; - sprite = "SKIMA1"; - width = 16; - height = 24; - } - 113 - { - title = "Jet Jaw"; - sprite = "JJAWA3A7"; - width = 12; - height = 20; - } - 126 - { - title = "Crushstacean"; - sprite = "CRABA0"; - width = 24; - height = 32; - } - 138 - { - title = "Banpyura"; - sprite = "CR2BA0"; - width = 24; - height = 32; - } - 117 - { - title = "Robo-Hood"; - sprite = "ARCHA1"; - width = 24; - height = 32; - } - 118 - { - title = "Lance-a-Bot"; - sprite = "CBFSA1"; - width = 32; - height = 72; - } - 1113 - { - title = "Suspicious Lance-a-Bot Statue"; - sprite = "CBBSA1"; - width = 32; - height = 72; - } - 119 - { - title = "Egg Guard"; - sprite = "ESHIA1"; + color = 1; // Blue + arrow = 1; + title = "Player Starts"; width = 16; height = 48; - } - 115 - { - title = "Bird Aircraft Strike Hazard"; - sprite = "VLTRF1"; - width = 12; - height = 24; - } - 120 - { - title = "Green Snapper"; - sprite = "GSNPA1"; - width = 24; - height = 24; - } - 121 - { - title = "Minus"; - sprite = "MNUSA0"; - width = 24; - height = 32; - } - 134 - { - title = "Canarivore"; - sprite = "CANAA0"; - width = 12; - height = 80; - hangs = 1; - } - 123 - { - title = "Unidus"; - sprite = "UNIDA1"; - width = 18; - height = 36; - } - 135 - { - title = "Pterabyte Spawner"; - sprite = "PTERA2A8"; - width = 16; - height = 16; - } - 136 - { - title = "Pyre Fly"; - sprite = "PYREA0"; - width = 24; - height = 34; - } - 137 - { - title = "Dragonbomber"; - sprite = "DRABA1"; - width = 28; - height = 48; - } - 105 - { - title = "Jetty-Syn Bomber"; - sprite = "JETBB1"; - width = 20; - height = 50; - } - 106 - { - title = "Jetty-Syn Gunner"; - sprite = "JETGB1"; - width = 20; - height = 48; - } - 112 - { - title = "Spincushion"; - sprite = "SHRPA1"; - width = 16; - height = 24; - } - 114 - { - title = "Snailer"; - sprite = "SNLRA3A7"; - width = 24; - height = 48; - } - 129 - { - title = "Penguinator"; - sprite = "PENGA1"; - width = 24; - height = 32; - } - 130 - { - title = "Pophat"; - sprite = "POPHA1"; - width = 24; - height = 32; - } - 107 - { - title = "Crawla Commander"; - sprite = "CCOMA1"; - width = 16; - height = 32; - } - 131 - { - title = "Spinbobert"; - sprite = "SBOBB0"; - width = 32; - height = 32; - } - 132 - { - title = "Cacolantern"; - sprite = "CACOA0"; - width = 32; - height = 32; - } - 133 - { - title = "Hangster"; - sprite = "HBATC1"; - width = 24; - height = 24; - hangs = 1; - } - 127 - { - title = "Hive Elemental"; - sprite = "HIVEA0"; - width = 32; - height = 80; - } - 128 - { - title = "Bumblebore"; - sprite = "BUMBA1"; - width = 16; - height = 32; - } - 124 - { - title = "Buggle"; - sprite = "BBUZA1"; - width = 20; - height = 24; - } - 116 - { - title = "Pointy"; - sprite = "PNTYA1"; - width = 8; - height = 16; - } -} + sprite = "PLAYA0"; -bosses -{ - color = 8; // Dark_Gray - arrow = 1; - title = "Bosses"; + 1 + { + title = "Player 01 Start"; + sprite = "PLAYA0"; + } + 2 + { + title = "Player 02 Start"; + sprite = "PLAYA0"; + } + 3 + { + title = "Player 03 Start"; + sprite = "PLAYA0"; + } + 4 + { + title = "Player 04 Start"; + sprite = "PLAYA0"; + } + 5 + { + title = "Player 05 Start"; + sprite = "PLAYA0"; + } + 6 + { + title = "Player 06 Start"; + sprite = "PLAYA0"; + } + 7 + { + title = "Player 07 Start"; + sprite = "PLAYA0"; + } + 8 + { + title = "Player 08 Start"; + sprite = "PLAYA0"; + } + 9 + { + title = "Player 09 Start"; + sprite = "PLAYA0"; + } + 10 + { + title = "Player 10 Start"; + sprite = "PLAYA0"; + } + 11 + { + title = "Player 11 Start"; + sprite = "PLAYA0"; + } + 12 + { + title = "Player 12 Start"; + sprite = "PLAYA0"; + } + 13 + { + title = "Player 13 Start"; + sprite = "PLAYA0"; + } + 14 + { + title = "Player 14 Start"; + sprite = "PLAYA0"; + } + 15 + { + title = "Player 15 Start"; + sprite = "PLAYA0"; + } + 16 + { + title = "Player 16 Start"; + sprite = "PLAYA0"; + } + 17 + { + title = "Player 17 Start"; + sprite = "PLAYA0"; + } + 18 + { + title = "Player 18 Start"; + sprite = "PLAYA0"; + } + 19 + { + title = "Player 19 Start"; + sprite = "PLAYA0"; + } + 20 + { + title = "Player 20 Start"; + sprite = "PLAYA0"; + } + 21 + { + title = "Player 21 Start"; + sprite = "PLAYA0"; + } + 22 + { + title = "Player 22 Start"; + sprite = "PLAYA0"; + } + 23 + { + title = "Player 23 Start"; + sprite = "PLAYA0"; + } + 24 + { + title = "Player 24 Start"; + sprite = "PLAYA0"; + } + 25 + { + title = "Player 25 Start"; + sprite = "PLAYA0"; + } + 26 + { + title = "Player 26 Start"; + sprite = "PLAYA0"; + } + 27 + { + title = "Player 27 Start"; + sprite = "PLAYA0"; + } + 28 + { + title = "Player 28 Start"; + sprite = "PLAYA0"; + } + 29 + { + title = "Player 29 Start"; + sprite = "PLAYA0"; + } + 30 + { + title = "Player 30 Start"; + sprite = "PLAYA0"; + } + 31 + { + title = "Player 31 Start"; + sprite = "PLAYA0"; + } + 32 + { + title = "Player 32 Start"; + sprite = "PLAYA0"; + } + 33 + { + title = "Match Start"; + sprite = "NDRNA2A8"; + } + 34 + { + title = "CTF Red Team Start"; + sprite = "SIGNG0"; + } + 35 + { + title = "CTF Blue Team Start"; + sprite = "SIGNE0"; + } + } - 200 + enemies { - title = "Egg Mobile"; - sprite = "EGGMA1"; - width = 24; - height = 76; - } - 201 - { - title = "Egg Slimer"; - sprite = "EGGNA1"; - width = 24; - height = 76; - } - 202 - { - title = "Sea Egg"; - sprite = "EGGOA1"; - width = 32; - height = 116; - } - 203 - { - title = "Egg Colosseum"; - sprite = "EGGPA1"; - width = 24; - height = 76; - } - 204 - { - title = "Fang"; - sprite = "FANGA1"; - width = 24; - height = 60; - } - 206 - { - title = "Brak Eggman (Old)"; - sprite = "BRAKB1"; - width = 48; - height = 160; - } - 207 - { - title = "Metal Sonic (Race)"; - sprite = "METLI1"; - width = 16; - height = 48; - } - 208 - { - title = "Metal Sonic (Battle)"; - sprite = "METLC1"; - width = 16; - height = 48; - } - 209 - { - title = "Brak Eggman"; - sprite = "BRAK01"; - width = 48; - height = 160; - } - 290 - { - arrow = 0; - title = "Boss Escape Point"; - width = 8; - height = 16; - sprite = "internal:eggmanend"; - } - 291 - { - arrow = 0; - title = "Egg Capsule Center"; - width = 8; - height = 16; - sprite = "internal:capsule"; - } - 292 - { - arrow = 0; - title = "Boss Waypoint"; - width = 8; - height = 16; - sprite = "internal:eggmanway"; - } - 293 - { - title = "Metal Sonic Gather Point"; - sprite = "internal:metal"; - width = 8; - height = 16; - } - 294 - { - title = "Fang Waypoint"; - sprite = "internal:eggmanway"; - width = 8; - height = 16; - } -} + color = 9; // Light_Blue + arrow = 1; + title = "Enemies"; -rings -{ - color = 14; // Yellow - title = "Rings and Weapon Panels"; - width = 24; - height = 24; - sprite = "RINGA0"; + 100 + { + title = "Crawla (Blue)"; + sprite = "POSSA1"; + width = 24; + height = 32; + } + 101 + { + title = "Crawla (Red)"; + sprite = "SPOSA1"; + width = 24; + height = 32; + } + 102 + { + title = "Stupid Dumb Unnamed RoboFish"; + sprite = "FISHA0"; + width = 8; + height = 28; + } + 103 + { + title = "Buzz (Gold)"; + sprite = "BUZZA1"; + width = 28; + height = 40; + } + 104 + { + title = "Buzz (Red)"; + sprite = "RBUZA1"; + width = 28; + height = 40; + } + 108 + { + title = "Deton"; + sprite = "DETNA1"; + width = 20; + height = 32; + } + 110 + { + title = "Turret"; + sprite = "TRETA1"; + width = 16; + height = 32; + } + 111 + { + title = "Pop-up Turret"; + sprite = "TURRI1"; + width = 12; + height = 64; + } + 122 + { + title = "Spring Shell (Green)"; + sprite = "SSHLA1"; + width = 24; + height = 40; + } + 125 + { + title = "Spring Shell (Yellow)"; + sprite = "SSHLI1"; + width = 24; + height = 40; + } + 109 + { + title = "Skim"; + sprite = "SKIMA1"; + width = 16; + height = 24; + } + 113 + { + title = "Jet Jaw"; + sprite = "JJAWA3A7"; + width = 12; + height = 20; + } + 126 + { + title = "Crushstacean"; + sprite = "CRABA0"; + width = 24; + height = 32; + } + 138 + { + title = "Banpyura"; + sprite = "CR2BA0"; + width = 24; + height = 32; + } + 117 + { + title = "Robo-Hood"; + sprite = "ARCHA1"; + width = 24; + height = 32; + } + 118 + { + title = "Lance-a-Bot"; + sprite = "CBFSA1"; + width = 32; + height = 72; + } + 1113 + { + title = "Suspicious Lance-a-Bot Statue"; + sprite = "CBBSA1"; + width = 32; + height = 72; + } + 119 + { + title = "Egg Guard"; + sprite = "ESHIA1"; + width = 16; + height = 48; + } + 115 + { + title = "Bird Aircraft Strike Hazard"; + sprite = "VLTRF1"; + width = 12; + height = 24; + } + 120 + { + title = "Green Snapper"; + sprite = "GSNPA1"; + width = 24; + height = 24; + } + 121 + { + title = "Minus"; + sprite = "MNUSA0"; + width = 24; + height = 32; + } + 134 + { + title = "Canarivore"; + sprite = "CANAA0"; + width = 12; + height = 80; + hangs = 1; + } + 123 + { + title = "Unidus"; + sprite = "UNIDA1"; + width = 18; + height = 36; + } + 135 + { + title = "Pterabyte Spawner"; + sprite = "PTERA2A8"; + width = 16; + height = 16; + } + 136 + { + title = "Pyre Fly"; + sprite = "PYREA0"; + width = 24; + height = 34; + } + 137 + { + title = "Dragonbomber"; + sprite = "DRABA1"; + width = 28; + height = 48; + } + 105 + { + title = "Jetty-Syn Bomber"; + sprite = "JETBB1"; + width = 20; + height = 50; + } + 106 + { + title = "Jetty-Syn Gunner"; + sprite = "JETGB1"; + width = 20; + height = 48; + } + 112 + { + title = "Spincushion"; + sprite = "SHRPA1"; + width = 16; + height = 24; + } + 114 + { + title = "Snailer"; + sprite = "SNLRA3A7"; + width = 24; + height = 48; + } + 129 + { + title = "Penguinator"; + sprite = "PENGA1"; + width = 24; + height = 32; + } + 130 + { + title = "Pophat"; + sprite = "POPHA1"; + width = 24; + height = 32; + } + 107 + { + title = "Crawla Commander"; + sprite = "CCOMA1"; + width = 16; + height = 32; + } + 131 + { + title = "Spinbobert"; + sprite = "SBOBB0"; + width = 32; + height = 32; + } + 132 + { + title = "Cacolantern"; + sprite = "CACOA0"; + width = 32; + height = 32; + } + 133 + { + title = "Hangster"; + sprite = "HBATC1"; + width = 24; + height = 24; + hangs = 1; + } + 127 + { + title = "Hive Elemental"; + sprite = "HIVEA0"; + width = 32; + height = 80; + } + 128 + { + title = "Bumblebore"; + sprite = "BUMBA1"; + width = 16; + height = 32; + } + 124 + { + title = "Buggle"; + sprite = "BBUZA1"; + width = 20; + height = 24; + } + 116 + { + title = "Pointy"; + sprite = "PNTYA1"; + width = 8; + height = 16; + } + } - 300 + bosses { - title = "Ring"; + color = 8; // Dark_Gray + arrow = 1; + title = "Bosses"; + + 200 + { + title = "Egg Mobile"; + sprite = "EGGMA1"; + width = 24; + height = 76; + } + 201 + { + title = "Egg Slimer"; + sprite = "EGGNA1"; + width = 24; + height = 76; + } + 202 + { + title = "Sea Egg"; + sprite = "EGGOA1"; + width = 32; + height = 116; + } + 203 + { + title = "Egg Colosseum"; + sprite = "EGGPA1"; + width = 24; + height = 76; + } + 204 + { + title = "Fang"; + sprite = "FANGA1"; + width = 24; + height = 60; + } + 206 + { + title = "Brak Eggman (Old)"; + sprite = "BRAKB1"; + width = 48; + height = 160; + } + 207 + { + title = "Metal Sonic (Race)"; + sprite = "METLI1"; + width = 16; + height = 48; + } + 208 + { + title = "Metal Sonic (Battle)"; + sprite = "METLC1"; + width = 16; + height = 48; + } + 209 + { + title = "Brak Eggman"; + sprite = "BRAK01"; + width = 48; + height = 160; + } + 290 + { + arrow = 0; + title = "Boss Escape Point"; + width = 8; + height = 16; + sprite = "internal:eggmanend"; + } + 291 + { + arrow = 0; + title = "Egg Capsule Center"; + width = 8; + height = 16; + sprite = "internal:capsule"; + } + 292 + { + arrow = 0; + title = "Boss Waypoint"; + width = 8; + height = 16; + sprite = "internal:eggmanway"; + } + 293 + { + title = "Metal Sonic Gather Point"; + sprite = "internal:metal"; + width = 8; + height = 16; + } + 294 + { + title = "Fang Waypoint"; + sprite = "internal:eggmanway"; + width = 8; + height = 16; + } + } + + rings + { + color = 14; // Yellow + title = "Rings and Weapon Panels"; + width = 24; + height = 24; sprite = "RINGA0"; - width = 16; - } - 301 - { - title = "Bounce Ring"; - sprite = "internal:RNGBA0"; - } - 302 - { - title = "Rail Ring"; - sprite = "internal:RNGRA0"; - } - 303 - { - title = "Infinity Ring"; - sprite = "internal:RNGIA0"; - } - 304 - { - title = "Automatic Ring"; - sprite = "internal:RNGAA0"; - } - 305 - { - title = "Explosion Ring"; - sprite = "internal:RNGEA0"; - } - 306 - { - title = "Scatter Ring"; - sprite = "internal:RNGSA0"; - } - 307 - { - title = "Grenade Ring"; - sprite = "internal:RNGGA0"; - } - 308 - { - title = "CTF Team Ring (Red)"; - sprite = "internal:RRNGA0"; - width = 16; - } - 309 - { - title = "CTF Team Ring (Blue)"; - sprite = "internal:BRNGA0"; - width = 16; - } - 330 - { - title = "Bounce Ring Panel"; - sprite = "internal:PIKBA0"; - } - 331 - { - title = "Rail Ring Panel"; - sprite = "internal:PIKRA0"; - } - 332 - { - title = "Automatic Ring Panel"; - sprite = "internal:PIKAA0"; - } - 333 - { - title = "Explosion Ring Panel"; - sprite = "internal:PIKEA0"; - } - 334 - { - title = "Scatter Ring Panel"; - sprite = "internal:PIKSA0"; - } - 335 - { - title = "Grenade Ring Panel"; - sprite = "internal:PIKGA0"; - } -} -collectibles -{ - color = 10; // Light_Green - title = "Other Collectibles"; - width = 16; - height = 32; - sort = 1; - sprite = "CEMGA0"; + 300 + { + title = "Ring"; + sprite = "RINGA0"; + width = 16; + } + 301 + { + title = "Bounce Ring"; + sprite = "internal:RNGBA0"; + } + 302 + { + title = "Rail Ring"; + sprite = "internal:RNGRA0"; + } + 303 + { + title = "Infinity Ring"; + sprite = "internal:RNGIA0"; + } + 304 + { + title = "Automatic Ring"; + sprite = "internal:RNGAA0"; + } + 305 + { + title = "Explosion Ring"; + sprite = "internal:RNGEA0"; + } + 306 + { + title = "Scatter Ring"; + sprite = "internal:RNGSA0"; + } + 307 + { + title = "Grenade Ring"; + sprite = "internal:RNGGA0"; + } + 308 + { + title = "CTF Team Ring (Red)"; + sprite = "internal:RRNGA0"; + width = 16; + } + 309 + { + title = "CTF Team Ring (Blue)"; + sprite = "internal:BRNGA0"; + width = 16; + } + 330 + { + title = "Bounce Ring Panel"; + sprite = "internal:PIKBA0"; + } + 331 + { + title = "Rail Ring Panel"; + sprite = "internal:PIKRA0"; + } + 332 + { + title = "Automatic Ring Panel"; + sprite = "internal:PIKAA0"; + } + 333 + { + title = "Explosion Ring Panel"; + sprite = "internal:PIKEA0"; + } + 334 + { + title = "Scatter Ring Panel"; + sprite = "internal:PIKSA0"; + } + 335 + { + title = "Grenade Ring Panel"; + sprite = "internal:PIKGA0"; + } + } - 310 + collectibles { - title = "CTF Red Flag"; - sprite = "RFLGA0"; - width = 24; - height = 64; - } - 311 - { - title = "CTF Blue Flag"; - sprite = "BFLGA0"; - width = 24; - height = 64; - } - 312 - { - title = "Emerald Token"; - sprite = "TOKEA0"; + color = 10; // Light_Green + title = "Other Collectibles"; width = 16; height = 32; - } - 313 - { - title = "Chaos Emerald 1 (Green)"; + sort = 1; sprite = "CEMGA0"; - } - 314 - { - title = "Chaos Emerald 2 (Purple)"; - sprite = "CEMGB0"; - } - 315 - { - title = "Chaos Emerald 3 (Blue)"; - sprite = "CEMGC0"; - } - 316 - { - title = "Chaos Emerald 4 (Cyan)"; - sprite = "CEMGD0"; - } - 317 - { - title = "Chaos Emerald 5 (Orange)"; - sprite = "CEMGE0"; - } - 318 - { - title = "Chaos Emerald 6 (Red)"; - sprite = "CEMGF0"; - } - 319 - { - title = "Chaos Emerald 7 (Gray)"; - sprite = "CEMGG0"; - } - 320 - { - title = "Emerald Hunt Location"; - sprite = "SHRDA0"; - } - 321 - { - title = "Match Chaos Emerald Spawn"; - sprite = "CEMGA0"; - } - 322 - { - title = "Emblem"; - sprite = "EMBMA0"; - width = 16; - height = 30; - } -} -boxes -{ - color = 7; // Gray - blocking = 2; - title = "Monitors"; - width = 18; - height = 40; + 310 + { + title = "CTF Red Flag"; + sprite = "RFLGA0"; + width = 24; + height = 64; + } + 311 + { + title = "CTF Blue Flag"; + sprite = "BFLGA0"; + width = 24; + height = 64; + } + 312 + { + title = "Emerald Token"; + sprite = "TOKEA0"; + width = 16; + height = 32; + } + 313 + { + title = "Chaos Emerald 1 (Green)"; + sprite = "CEMGA0"; + } + 314 + { + title = "Chaos Emerald 2 (Purple)"; + sprite = "CEMGB0"; + } + 315 + { + title = "Chaos Emerald 3 (Blue)"; + sprite = "CEMGC0"; + } + 316 + { + title = "Chaos Emerald 4 (Cyan)"; + sprite = "CEMGD0"; + } + 317 + { + title = "Chaos Emerald 5 (Orange)"; + sprite = "CEMGE0"; + } + 318 + { + title = "Chaos Emerald 6 (Red)"; + sprite = "CEMGF0"; + } + 319 + { + title = "Chaos Emerald 7 (Gray)"; + sprite = "CEMGG0"; + } + 320 + { + title = "Emerald Hunt Location"; + sprite = "SHRDA0"; + } + 321 + { + title = "Match Chaos Emerald Spawn"; + sprite = "CEMGA0"; + } + 322 + { + title = "Emblem"; + sprite = "EMBMA0"; + width = 16; + height = 30; + } + } - 400 + boxes { - title = "Super Ring (10 Rings)"; - sprite = "TVRIA0"; - } - 401 - { - title = "Pity Shield"; - sprite = "TVPIA0"; - } - 402 - { - title = "Attraction Shield"; - sprite = "TVATA0"; - } - 403 - { - title = "Force Shield"; - sprite = "TVFOA0"; - } - 404 - { - title = "Armageddon Shield"; - sprite = "TVARA0"; - } - 405 - { - title = "Whirlwind Shield"; - sprite = "TVWWA0"; - } - 406 - { - title = "Elemental Shield"; - sprite = "TVELA0"; - } - 407 - { - title = "Super Sneakers"; - sprite = "TVSSA0"; - } - 408 - { - title = "Invincibility"; - sprite = "TVIVA0"; - } - 409 - { - title = "Extra Life"; - sprite = "TV1UA0"; - } - 410 - { - title = "Eggman"; - sprite = "TVEGA0"; - } - 411 - { - title = "Teleporter"; - sprite = "TVMXA0"; - } - 413 - { - title = "Gravity Boots"; - sprite = "TVGVA0"; - } - 414 - { - title = "CTF Team Ring Monitor (Red)"; - sprite = "TRRIA0"; - } - 415 - { - title = "CTF Team Ring Monitor (Blue)"; - sprite = "TBRIA0"; - } - 416 - { - title = "Recycler"; - sprite = "TVRCA0"; - } - 418 - { - title = "Score (1,000 Points)"; - sprite = "TV1KA0"; - } - 419 - { - title = "Score (10,000 Points)"; - sprite = "TVTKA0"; - } - 420 - { - title = "Flame Shield"; - sprite = "TVFLA0"; - } - 421 - { - title = "Water Shield"; - sprite = "TVBBA0"; - } - 422 - { - title = "Lightning Shield"; - sprite = "TVZPA0"; - } -} + color = 7; // Gray + blocking = 2; + title = "Monitors"; + width = 18; + height = 40; -boxes2 -{ - color = 18; // Gold - blocking = 2; - title = "Monitors (Respawning)"; - width = 20; - height = 44; + 400 + { + title = "Super Ring (10 Rings)"; + sprite = "TVRIA0"; + } + 401 + { + title = "Pity Shield"; + sprite = "TVPIA0"; + } + 402 + { + title = "Attraction Shield"; + sprite = "TVATA0"; + } + 403 + { + title = "Force Shield"; + sprite = "TVFOA0"; + } + 404 + { + title = "Armageddon Shield"; + sprite = "TVARA0"; + } + 405 + { + title = "Whirlwind Shield"; + sprite = "TVWWA0"; + } + 406 + { + title = "Elemental Shield"; + sprite = "TVELA0"; + } + 407 + { + title = "Super Sneakers"; + sprite = "TVSSA0"; + } + 408 + { + title = "Invincibility"; + sprite = "TVIVA0"; + } + 409 + { + title = "Extra Life"; + sprite = "TV1UA0"; + } + 410 + { + title = "Eggman"; + sprite = "TVEGA0"; + } + 411 + { + title = "Teleporter"; + sprite = "TVMXA0"; + } + 413 + { + title = "Gravity Boots"; + sprite = "TVGVA0"; + } + 414 + { + title = "CTF Team Ring Monitor (Red)"; + sprite = "TRRIA0"; + } + 415 + { + title = "CTF Team Ring Monitor (Blue)"; + sprite = "TBRIA0"; + } + 416 + { + title = "Recycler"; + sprite = "TVRCA0"; + } + 418 + { + title = "Score (1,000 Points)"; + sprite = "TV1KA0"; + } + 419 + { + title = "Score (10,000 Points)"; + sprite = "TVTKA0"; + } + 420 + { + title = "Flame Shield"; + sprite = "TVFLA0"; + } + 421 + { + title = "Water Shield"; + sprite = "TVBBA0"; + } + 422 + { + title = "Lightning Shield"; + sprite = "TVZPA0"; + } + } - 431 + boxes2 { - title = "Pity Shield (Respawn)"; - sprite = "TVPIB0"; - } - 432 - { - title = "Attraction Shield (Respawn)"; - sprite = "TVATB0"; - } - 433 - { - title = "Force Shield (Respawn)"; - sprite = "TVFOB0"; - } - 434 - { - title = "Armageddon Shield (Respawn)"; - sprite = "TVARB0"; - } - 435 - { - title = "Whirlwind Shield (Respawn)"; - sprite = "TVWWB0"; - } - 436 - { - title = "Elemental Shield (Respawn)"; - sprite = "TVELB0"; - } - 437 - { - title = "Super Sneakers (Respawn)"; - sprite = "TVSSB0"; - } - 438 - { - title = "Invincibility (Respawn)"; - sprite = "TVIVB0"; - } - 440 - { - title = "Eggman (Respawn)"; - sprite = "TVEGB0"; - } - 443 - { - title = "Gravity Boots (Respawn)"; - sprite = "TVGVB0"; - } - 450 - { - title = "Flame Shield (Respawn)"; - sprite = "TVFLB0"; - } - 451 - { - title = "Water Shield (Respawn)"; - sprite = "TVBBB0"; - } - 452 - { - title = "Lightning Shield (Respawn)"; - sprite = "TVZPB0"; - } -} + color = 18; // Gold + blocking = 2; + title = "Monitors (Respawning)"; + width = 20; + height = 44; -generic -{ - color = 11; // Light_Cyan - title = "Generic Items & Hazards"; + 431 + { + title = "Pity Shield (Respawn)"; + sprite = "TVPIB0"; + } + 432 + { + title = "Attraction Shield (Respawn)"; + sprite = "TVATB0"; + } + 433 + { + title = "Force Shield (Respawn)"; + sprite = "TVFOB0"; + } + 434 + { + title = "Armageddon Shield (Respawn)"; + sprite = "TVARB0"; + } + 435 + { + title = "Whirlwind Shield (Respawn)"; + sprite = "TVWWB0"; + } + 436 + { + title = "Elemental Shield (Respawn)"; + sprite = "TVELB0"; + } + 437 + { + title = "Super Sneakers (Respawn)"; + sprite = "TVSSB0"; + } + 438 + { + title = "Invincibility (Respawn)"; + sprite = "TVIVB0"; + } + 440 + { + title = "Eggman (Respawn)"; + sprite = "TVEGB0"; + } + 443 + { + title = "Gravity Boots (Respawn)"; + sprite = "TVGVB0"; + } + 450 + { + title = "Flame Shield (Respawn)"; + sprite = "TVFLB0"; + } + 451 + { + title = "Water Shield (Respawn)"; + sprite = "TVBBB0"; + } + 452 + { + title = "Lightning Shield (Respawn)"; + sprite = "TVZPB0"; + } + } - 500 + generic { - title = "Air Bubble Patch"; - sprite = "BUBLE0"; - width = 8; + color = 11; // Light_Cyan + title = "Generic Items & Hazards"; + + 500 + { + title = "Air Bubble Patch"; + sprite = "BUBLE0"; + width = 8; + height = 16; + } + 501 + { + title = "Signpost"; + sprite = "SIGND0"; + width = 8; + height = 32; + } + 502 + { + arrow = 1; + title = "Star Post"; + sprite = "STPTA0M0"; + width = 64; + height = 128; + } + 520 + { + title = "Bomb Sphere"; + sprite = "SPHRD0"; + width = 16; + height = 24; + } + 521 + { + title = "Spikeball"; + sprite = "SPIKA0"; + width = 12; + height = 8; + } + 522 + { + title = "Wall Spike"; + sprite = "WSPKALAR"; + width = 16; + height = 14; + arrow = 1; + } + 523 + { + title = "Spike"; + sprite = "USPKA0"; + width = 8; + height = 32; + } + 1130 + { + title = "Small Mace"; + sprite = "SMCEA0"; + width = 17; + height = 34; + } + 1131 + { + title = "Big Mace"; + sprite = "BMCEA0"; + width = 34; + height = 68; + } + 1136 + { + title = "Small Fireball"; + sprite = "SFBRA0"; + width = 17; + height = 34; + } + 1137 + { + title = "Large Fireball"; + sprite = "BFBRA0"; + width = 34; + height = 68; + } + } + + springs + { + color = 12; // Light_Red + title = "Springs and Fans"; + width = 20; height = 16; - } - 501 - { - title = "Signpost"; - sprite = "SIGND0"; - width = 8; - height = 32; - } - 502 - { - arrow = 1; - title = "Star Post"; - sprite = "STPTA0M0"; - width = 64; - height = 128; - } - 520 - { - title = "Bomb Sphere"; - sprite = "SPHRD0"; - width = 16; - height = 24; - } - 521 - { - title = "Spikeball"; - sprite = "SPIKA0"; - width = 12; - height = 8; - } - 522 - { - title = "Wall Spike"; - sprite = "WSPKALAR"; - width = 16; - height = 14; - arrow = 1; - } - 523 - { - title = "Spike"; - sprite = "USPKA0"; - width = 8; - height = 32; - } - 1130 - { - title = "Small Mace"; - sprite = "SMCEA0"; - width = 17; - height = 34; - } - 1131 - { - title = "Big Mace"; - sprite = "BMCEA0"; - width = 34; - height = 68; - } - 1136 - { - title = "Small Fireball"; - sprite = "SFBRA0"; - width = 17; - height = 34; - } - 1137 - { - title = "Large Fireball"; - sprite = "BFBRA0"; - width = 34; - height = 68; - } -} - -springs -{ - color = 12; // Light_Red - title = "Springs and Fans"; - width = 20; - height = 16; - sprite = "RSPRD2"; - - 540 - { - title = "Fan"; - sprite = "FANSA0D0"; - width = 16; - height = 8; - } - 541 - { - title = "Gas Jet"; - sprite = "STEMD0"; - width = 32; - } - 542 - { - title = "Bumper"; - sprite = "BUMPA0"; - width = 32; - height = 64; - } - 543 - { - title = "Balloon"; - sprite = "BLONA0"; - width = 32; - height = 64; - } - 550 - { - title = "Yellow Spring"; - sprite = "SPRYA0"; - } - 551 - { - title = "Red Spring"; - sprite = "SPRRA0"; - } - 552 - { - title = "Blue Spring"; - sprite = "SPRBA0"; - } - 555 - { - arrow = 1; - title = "Diagonal Yellow Spring"; - sprite = "YSPRD2"; - width = 16; - } - 556 - { - arrow = 1; - title = "Diagonal Red Spring"; sprite = "RSPRD2"; - width = 16; - } - 557 - { - arrow = 1; - title = "Diagonal Blue Spring"; - sprite = "BSPRD2"; - width = 16; - } - 558 - { - arrow = 1; - title = "Horizontal Yellow Spring"; - sprite = "SSWYD2D8"; - width = 16; - height = 32; - } - 559 - { - arrow = 1; - title = "Horizontal Red Spring"; - sprite = "SSWRD2D8"; - width = 16; - height = 32; - } - 560 - { - arrow = 1; - title = "Horizontal Blue Spring"; - sprite = "SSWBD2D8"; - width = 16; - height = 32; - } - 1134 - { - title = "Yellow Spring Ball"; - sprite = "YSPBA0"; - width = 17; - height = 34; - } - 1135 - { - title = "Red Spring Ball"; - sprite = "RSPBA0"; - width = 17; - height = 34; - } - 544 - { - arrow = 1; - title = "Yellow Boost Panel"; - sprite = "BSTYA0"; - width = 28; - height = 2; - } - 545 - { - arrow = 1; - title = "Red Boost Panel"; - sprite = "BSTRA0"; - width = 28; - height = 2; - } -} -patterns -{ - color = 5; // Magenta - arrow = 1; - title = "Special Placement Patterns"; - width = 16; - height = 384; - sprite = "RINGA0"; + 540 + { + title = "Fan"; + sprite = "FANSA0D0"; + width = 16; + height = 8; + } + 541 + { + title = "Gas Jet"; + sprite = "STEMD0"; + width = 32; + } + 542 + { + title = "Bumper"; + sprite = "BUMPA0"; + width = 32; + height = 64; + } + 543 + { + title = "Balloon"; + sprite = "BLONA0"; + width = 32; + height = 64; + } + 550 + { + title = "Yellow Spring"; + sprite = "SPRYA0"; + } + 551 + { + title = "Red Spring"; + sprite = "SPRRA0"; + } + 552 + { + title = "Blue Spring"; + sprite = "SPRBA0"; + } + 555 + { + arrow = 1; + title = "Diagonal Yellow Spring"; + sprite = "YSPRD2"; + width = 16; + } + 556 + { + arrow = 1; + title = "Diagonal Red Spring"; + sprite = "RSPRD2"; + width = 16; + } + 557 + { + arrow = 1; + title = "Diagonal Blue Spring"; + sprite = "BSPRD2"; + width = 16; + } + 558 + { + arrow = 1; + title = "Horizontal Yellow Spring"; + sprite = "SSWYD2D8"; + width = 16; + height = 32; + } + 559 + { + arrow = 1; + title = "Horizontal Red Spring"; + sprite = "SSWRD2D8"; + width = 16; + height = 32; + } + 560 + { + arrow = 1; + title = "Horizontal Blue Spring"; + sprite = "SSWBD2D8"; + width = 16; + height = 32; + } + 1134 + { + title = "Yellow Spring Ball"; + sprite = "YSPBA0"; + width = 17; + height = 34; + } + 1135 + { + title = "Red Spring Ball"; + sprite = "RSPBA0"; + width = 17; + height = 34; + } + 544 + { + arrow = 1; + title = "Yellow Boost Panel"; + sprite = "BSTYA0"; + width = 28; + height = 2; + } + 545 + { + arrow = 1; + title = "Red Boost Panel"; + sprite = "BSTRA0"; + width = 28; + height = 2; + } + } - 600 + patterns { - arrow = 0; - title = "5 Vertical Rings (Yellow Spring)"; + color = 5; // Magenta + arrow = 1; + title = "Special Placement Patterns"; + width = 16; + height = 384; sprite = "RINGA0"; - } - 601 - { - arrow = 0; - title = "5 Vertical Rings (Red Spring)"; - sprite = "RINGA0"; - height = 1024; - } - 602 - { - title = "5 Diagonal Rings (Yellow Spring)"; - sprite = "RINGA0"; - height = 32; - } - 603 - { - title = "10 Diagonal Rings (Red Spring)"; - sprite = "RINGA0"; - height = 32; - } - 604 - { - title = "Circle of Rings"; - sprite = "RINGA0"; - width = 96; - height = 192; - } - 605 - { - title = "Circle of Rings (Big)"; - sprite = "RINGA0"; - width = 192; - } - 606 - { - title = "Circle of Blue Spheres"; - sprite = "SPHRA0"; - width = 96; - height = 192; - } - 607 - { - title = "Circle of Blue Spheres (Big)"; - sprite = "SPHRA0"; - width = 192; - } - 608 - { - title = "Circle of Rings and Spheres"; - sprite = "SPHRA0"; - width = 96; - height = 192; - } - 609 - { - title = "Circle of Rings and Spheres (Big)"; - sprite = "SPHRA0"; - width = 192; - } -} -invisible -{ - color = 15; // White - title = "Misc. Invisible"; - width = 0; - height = 0; - sprite = "UNKNA0"; - sort = 1; - fixedsize = true; - blocking = 0; - - 700 - { - title = "Water Ambience A (Large)"; - sprite = "internal:ambiance"; + 600 + { + arrow = 0; + title = "5 Vertical Rings (Yellow Spring)"; + sprite = "RINGA0"; + } + 601 + { + arrow = 0; + title = "5 Vertical Rings (Red Spring)"; + sprite = "RINGA0"; + height = 1024; + } + 602 + { + title = "5 Diagonal Rings (Yellow Spring)"; + sprite = "RINGA0"; + height = 32; + } + 603 + { + title = "10 Diagonal Rings (Red Spring)"; + sprite = "RINGA0"; + height = 32; + } + 604 + { + title = "Circle of Rings"; + sprite = "RINGA0"; + width = 96; + height = 192; + } + 605 + { + title = "Circle of Rings (Big)"; + sprite = "RINGA0"; + width = 192; + } + 606 + { + title = "Circle of Blue Spheres"; + sprite = "SPHRA0"; + width = 96; + height = 192; + } + 607 + { + title = "Circle of Blue Spheres (Big)"; + sprite = "SPHRA0"; + width = 192; + } + 608 + { + title = "Circle of Rings and Spheres"; + sprite = "SPHRA0"; + width = 96; + height = 192; + } + 609 + { + title = "Circle of Rings and Spheres (Big)"; + sprite = "SPHRA0"; + width = 192; + } } - 701 + invisible { - title = "Water Ambience B (Large)"; - sprite = "internal:ambiance"; + color = 15; // White + title = "Misc. Invisible"; + width = 0; + height = 0; + sprite = "UNKNA0"; + sort = 1; + fixedsize = true; + blocking = 0; + + 700 + { + title = "Water Ambience A (Large)"; + sprite = "internal:ambiance"; + } + + 701 + { + title = "Water Ambience B (Large)"; + sprite = "internal:ambiance"; + } + + 702 + { + title = "Water Ambience C (Medium)"; + sprite = "internal:ambiance"; + } + + 703 + { + title = "Water Ambience D (Medium)"; + sprite = "internal:ambiance"; + } + + 704 + { + title = "Water Ambience E (Small)"; + sprite = "internal:ambiance"; + } + + 705 + { + title = "Water Ambience F (Small)"; + sprite = "internal:ambiance"; + } + + 706 + { + title = "Water Ambience G (Extra Large)"; + sprite = "internal:ambiance"; + } + + 707 + { + title = "Water Ambience H (Extra Large)"; + sprite = "internal:ambiance"; + } + + 708 + { + title = "Disco Ambience"; + sprite = "internal:ambiance"; + } + + 709 + { + title = "Volcano Ambience"; + sprite = "internal:ambiance"; + } + + 710 + { + title = "Machine Ambience"; + sprite = "internal:ambiance"; + } + + 750 + { + title = "Slope Vertex"; + sprite = "internal:vertexslope"; + } + + 751 + { + arrow = 1; + title = "Teleport Destination"; + sprite = "internal:tele"; + } + + 752 + { + arrow = 1; + title = "Alternate View Point"; + sprite = "internal:view"; + } + + 753 + { + title = "Zoom Tube Waypoint"; + sprite = "internal:zoom"; + } + + 754 + { + title = "Push Point"; + sprite = "GWLGA0"; + } + 755 + { + title = "Pull Point"; + sprite = "GWLRA0"; + } + 756 + { + title = "Blast Linedef Executor"; + sprite = "TOADA0"; + width = 32; + height = 16; + } + 757 + { + title = "Fan Particle Generator"; + sprite = "PRTLA0"; + width = 8; + height = 16; + } + 758 + { + title = "Object Angle Anchor"; + sprite = "internal:view"; + } + 760 + { + title = "PolyObject Anchor"; + sprite = "internal:polyanchor"; + } + 761 + { + title = "PolyObject Spawn Point"; + sprite = "internal:polycenter"; + } + 762 + { + title = "PolyObject Spawn Point (Crush)"; + sprite = "internal:polycentercrush"; + } + 780 + { + title = "Skybox View Point"; + sprite = "internal:skyb"; + } } - 702 + greenflower { - title = "Water Ambience C (Medium)"; - sprite = "internal:ambiance"; + color = 10; // Green + title = "Greenflower"; + + 800 + { + title = "GFZ Flower"; + sprite = "FWR1A0"; + width = 16; + height = 40; + } + 801 + { + title = "Sunflower"; + sprite = "FWR2A0"; + width = 16; + height = 96; + } + 802 + { + title = "Budding Flower"; + sprite = "FWR3A0"; + width = 8; + height = 32; + } + 803 + { + title = "Blueberry Bush"; + sprite = "BUS3A0"; + width = 16; + height = 32; + } + 804 + { + title = "Berry Bush"; + sprite = "BUS1A0"; + width = 16; + height = 32; + } + 805 + { + title = "Bush"; + sprite = "BUS2A0"; + width = 16; + height = 32; + } + 806 + { + title = "GFZ Tree"; + sprite = "TRE1A0"; + width = 20; + height = 128; + } + 807 + { + title = "GFZ Berry Tree"; + sprite = "TRE1B0"; + width = 20; + height = 128; + } + 808 + { + title = "GFZ Cherry Tree"; + sprite = "TRE1C0"; + width = 20; + height = 128; + } + 809 + { + title = "Checkered Tree"; + sprite = "TRE2A0"; + width = 20; + height = 200; + } + 810 + { + title = "Checkered Tree (Sunset)"; + sprite = "TRE2B0"; + width = 20; + height = 200; + } + 811 + { + title = "Polygon Tree"; + sprite = "TRE4A0"; + width = 20; + height = 200; + } + 812 + { + title = "Bush Tree"; + sprite = "TRE5A0"; + width = 20; + height = 200; + } + 813 + { + title = "Red Bush Tree"; + sprite = "TRE5B0"; + width = 20; + height = 200; + } } - 703 + technohill { - title = "Water Ambience D (Medium)"; - sprite = "internal:ambiance"; + color = 10; // Green + title = "Techno Hill"; + + 900 + { + title = "THZ Steam Flower"; + sprite = "THZPA0"; + width = 8; + height = 32; + } + 901 + { + title = "Alarm"; + sprite = "ALRMA0"; + width = 8; + height = 16; + hangs = 1; + } + 902 + { + title = "THZ Spin Flower (Red)"; + sprite = "FWR5A0"; + width = 16; + height = 64; + } + 903 + { + title = "THZ Spin Flower (Yellow)"; + sprite = "FWR6A0"; + width = 16; + height = 64; + } + 904 + { + arrow = 1; + title = "Whistlebush"; + sprite = "THZTA0"; + width = 16; + height = 64; + } } - 704 + deepsea { - title = "Water Ambience E (Small)"; - sprite = "internal:ambiance"; + color = 10; // Green + title = "Deep Sea"; + + 1000 + { + arrow = 1; + blocking = 2; + title = "Gargoyle"; + sprite = "GARGA1"; + width = 16; + height = 40; + } + 1009 + { + arrow = 1; + blocking = 2; + title = "Gargoyle (Big)"; + sprite = "GARGB1"; + width = 32; + height = 80; + } + 1001 + { + title = "Seaweed"; + sprite = "SEWEA0"; + width = 24; + height = 56; + } + 1002 + { + title = "Dripping Water"; + sprite = "DRIPD0"; + width = 8; + height = 16; + hangs = 1; + } + 1003 + { + title = "Coral (Green)"; + sprite = "CORLA0"; + width = 29; + height = 40; + } + 1004 + { + title = "Coral (Red)"; + sprite = "CORLB0"; + width = 30; + height = 53; + } + 1005 + { + title = "Coral (Orange)"; + sprite = "CORLC0"; + width = 28; + height = 41; + } + 1006 + { + title = "Blue Crystal"; + sprite = "BCRYA1"; + width = 8; + height = 16; + } + 1007 + { + title = "Kelp"; + sprite = "KELPA0"; + width = 16; + height = 292; + } + 1008 + { + title = "Stalagmite (DSZ1)"; + sprite = "DSTGA0"; + width = 8; + height = 116; + } + 1010 + { + arrow = 1; + title = "Light Beam"; + sprite = "LIBEARAL"; + width = 16; + height = 16; + } + 1011 + { + title = "Stalagmite (DSZ2)"; + sprite = "DSTGA0"; + width = 8; + height = 116; + } + 1012 + { + arrow = 1; + title = "Big Floating Mine"; + width = 28; + height = 56; + sprite = "BMNEA1"; + } + 1013 + { + title = "Animated Kelp"; + sprite = "ALGAA0"; + width = 48; + height = 120; + } + 1014 + { + title = "Large Coral (Brown)"; + sprite = "CORLD0"; + width = 56; + height = 112; + } + 1015 + { + title = "Large Coral (Beige)"; + sprite = "CORLE0"; + width = 56; + height = 112; + } } - 705 + castleeggman { - title = "Water Ambience F (Small)"; - sprite = "internal:ambiance"; + color = 10; // Green + title = "Castle Eggman"; + + 1100 + { + title = "Chain (Decorative)"; + sprite = "CHANA0"; + width = 4; + height = 128; + hangs = 1; + } + 1101 + { + title = "Torch"; + sprite = "FLAMA0E0"; + width = 8; + height = 32; + } + 1102 + { + arrow = 1; + blocking = 2; + title = "Eggman Statue"; + sprite = "ESTAA1"; + width = 32; + height = 240; + } + 1103 + { + title = "CEZ Flower"; + sprite = "FWR4A0"; + width = 16; + height = 40; + } + 1104 + { + title = "Mace Spawnpoint"; + sprite = "SMCEA0"; + width = 17; + height = 34; + } + 1105 + { + title = "Chain with Maces Spawnpoint"; + sprite = "SMCEA0"; + width = 17; + height = 34; + } + 1106 + { + title = "Chained Spring Spawnpoint"; + sprite = "YSPBA0"; + width = 17; + height = 34; + } + 1107 + { + title = "Chain Spawnpoint"; + sprite = "BMCHA0"; + width = 17; + height = 34; + } + 1108 + { + arrow = 1; + title = "Hidden Chain Spawnpoint"; + sprite = "internal:chain3"; + width = 17; + height = 34; + } + 1109 + { + title = "Firebar Spawnpoint"; + sprite = "BFBRA0"; + width = 17; + height = 34; + } + 1110 + { + title = "Custom Mace Spawnpoint"; + sprite = "SMCEA0"; + width = 17; + height = 34; + } + 1111 + { + arrow = 1; + blocking = 2; + title = "Crawla Statue"; + sprite = "CSTAA1"; + width = 16; + height = 40; + } + 1112 + { + arrow = 1; + blocking = 2; + title = "Lance-a-Bot Statue"; + sprite = "CBBSA1"; + width = 32; + height = 72; + } + 1114 + { + title = "Pine Tree"; + sprite = "PINEA0"; + width = 16; + height = 628; + } + 1115 + { + title = "CEZ Shrub (Small)"; + sprite = "CEZBA0"; + width = 16; + height = 24; + } + 1116 + { + title = "CEZ Shrub (Large)"; + sprite = "CEZBB0"; + width = 32; + height = 48; + } + 1117 + { + arrow = 1; + title = "Pole Banner (Red)"; + sprite = "BANRA0"; + width = 40; + height = 224; + } + 1118 + { + arrow = 1; + title = "Pole Banner (Blue)"; + sprite = "BANRA0"; + width = 40; + height = 224; + } + 1119 + { + title = "Candle"; + sprite = "CNDLA0"; + width = 8; + height = 48; + } + 1120 + { + title = "Candle Pricket"; + sprite = "CNDLB0"; + width = 8; + height = 176; + } + 1121 + { + title = "Flame Holder"; + sprite = "FLMHA0"; + width = 24; + height = 80; + } + 1122 + { + title = "Fire Torch"; + sprite = "CTRCA0"; + width = 16; + height = 80; + } + 1123 + { + title = "Cannonball Launcher"; + sprite = "internal:cannonball"; + width = 8; + height = 16; + } + 1124 + { + blocking = 2; + title = "Cannonball"; + sprite = "CBLLA0"; + width = 20; + height = 40; + } + 1125 + { + title = "Brambles"; + sprite = "CABRALAR"; + width = 48; + height = 32; + } + 1126 + { + title = "Invisible Lockon Object"; + sprite = "LCKNC0"; + width = 16; + height = 32; + } + 1127 + { + title = "Spectator Eggrobo"; + sprite = "EGR1A1"; + width = 20; + height = 72; + } + 1128 + { + arrow = 1; + title = "Waving Flag (Red)"; + sprite = "CFLGA0"; + width = 8; + height = 208; + } + 1129 + { + arrow = 1; + title = "Waving Flag (Blue)"; + sprite = "CFLGA0"; + width = 8; + height = 208; + } } - 706 + aridcanyon { - title = "Water Ambience G (Extra Large)"; - sprite = "internal:ambiance"; + color = 10; // Green + title = "Arid Canyon"; + + 1200 + { + title = "Tumbleweed (Big)"; + sprite = "BTBLA0"; + width = 24; + height = 48; + } + 1201 + { + title = "Tumbleweed (Small)"; + sprite = "STBLA0"; + width = 12; + height = 24; + } + 1202 + { + arrow = 1; + title = "Rock Spawner"; + sprite = "ROIAA0"; + width = 8; + height = 16; + } + 1203 + { + title = "Tiny Red Flower Cactus"; + sprite = "CACTA0"; + width = 13; + height = 24; + } + 1204 + { + title = "Small Red Flower Cactus"; + sprite = "CACTB0"; + width = 15; + height = 52; + } + 1205 + { + title = "Tiny Blue Flower Cactus"; + sprite = "CACTC0"; + width = 13; + height = 24; + } + 1206 + { + title = "Small Blue Flower Cactus"; + sprite = "CACTD0"; + width = 15; + height = 52; + } + 1207 + { + title = "Prickly Pear"; + sprite = "CACTE0"; + width = 32; + height = 96; + } + 1208 + { + title = "Barrel Cactus"; + sprite = "CACTF0"; + width = 20; + height = 128; + } + 1209 + { + title = "Tall Barrel Cactus"; + sprite = "CACTG0"; + width = 24; + height = 224; + } + 1210 + { + title = "Armed Cactus"; + sprite = "CACTH0"; + width = 24; + height = 256; + } + 1211 + { + title = "Ball Cactus"; + sprite = "CACTI0"; + width = 48; + height = 96; + } + 1212 + { + title = "Caution Sign"; + sprite = "WWSGAR"; + width = 22; + height = 64; + } + 1213 + { + title = "Cacti Sign"; + sprite = "WWS2AR"; + width = 22; + height = 64; + } + 1214 + { + title = "Sharp Turn Sign"; + sprite = "WWS3ALAR"; + width = 16; + height = 192; + } + 1215 + { + title = "Mine Oil Lamp"; + sprite = "OILLA0"; + width = 22; + height = 64; + hangs = 1; + } + 1216 + { + title = "TNT Barrel"; + sprite = "BARRA1"; + width = 24; + height = 63; + } + 1217 + { + title = "TNT Proximity Shell"; + sprite = "REMTA0"; + width = 64; + height = 40; + } + 1218 + { + title = "Dust Devil"; + sprite = "TAZDCR"; + width = 80; + height = 416; + } + 1219 + { + title = "Minecart Spawner"; + sprite = "MCRTCLFR"; + width = 22; + height = 32; + } + 1220 + { + title = "Minecart Stopper"; + sprite = "MCRTIR"; + width = 32; + height = 32; + } + 1221 + { + title = "Minecart Saloon Door"; + sprite = "SALDARAL"; + width = 96; + height = 160; + } + 1222 + { + title = "Train Cameo Spawner"; + sprite = "TRAEBRBL"; + width = 28; + height = 32; + } + 1223 + { + title = "Train Dust Spawner"; + sprite = "ADSTA0"; + width = 4; + height = 4; + } + 1224 + { + title = "Train Steam Spawner"; + sprite = "STEAA0"; + width = 4; + height = 4; + } + 1229 + { + title = "Minecart Switch Point"; + sprite = "internal:zoom"; + width = 8; + height = 16; + } + 1230 + { + title = "Tiny Cactus"; + sprite = "CACTJ0"; + width = 13; + height = 28; + } + 1231 + { + title = "Small Cactus"; + sprite = "CACTK0"; + width = 15; + height = 60; + } } - 707 + redvolcano { - title = "Water Ambience H (Extra Large)"; - sprite = "internal:ambiance"; + color = 10; // Green + title = "Red Volcano"; + + 1300 + { + arrow = 1; + title = "Flame Jet (Horizontal)"; + sprite = "internal:flameh"; + width = 16; + height = 40; + } + 1301 + { + title = "Flame Jet (Vertical)"; + sprite = "internal:flamev"; + width = 16; + height = 40; + } + 1302 + { + title = "Spinning Flame Jet (Counter-Clockwise)"; + sprite = "internal:flame2"; + width = 16; + height = 24; + } + 1303 + { + title = "Spinning Flame Jet (Clockwise)"; + sprite = "internal:flame1"; + width = 16; + height = 24; + } + 1304 + { + title = "Lavafall"; + sprite = "LFALF0"; + width = 30; + height = 32; + } + 1305 + { + title = "Rollout Rock"; + sprite = "PUMIA1A5"; + width = 30; + height = 60; + } + 1306 + { + title = "Big Fern"; + sprite = "JPLAB0"; + width = 32; + height = 48; + } + 1307 + { + title = "Jungle Palm"; + sprite = "JPLAC0"; + width = 32; + height = 48; + } + 1308 + { + title = "Torch Flower"; + sprite = "TFLOA0"; + width = 14; + height = 110; + } + 1309 + { + title = "RVZ1 Wall Vine (Long)"; + sprite = "WVINALAR"; + width = 1; + height = 288; + } + 1310 + { + title = "RVZ1 Wall Vine (Short)"; + sprite = "WVINBLBR"; + width = 1; + height = 288; + } } - 708 + botanicserenity { - title = "Disco Ambience"; - sprite = "internal:ambiance"; - } - - 709 - { - title = "Volcano Ambience"; - sprite = "internal:ambiance"; - } - - 710 - { - title = "Machine Ambience"; - sprite = "internal:ambiance"; - } - - 750 - { - title = "Slope Vertex"; - sprite = "internal:vertexslope"; - } - - 751 - { - arrow = 1; - title = "Teleport Destination"; - sprite = "internal:tele"; - } - - 752 - { - arrow = 1; - title = "Alternate View Point"; - sprite = "internal:view"; - } - - 753 - { - title = "Zoom Tube Waypoint"; - sprite = "internal:zoom"; - } - - 754 - { - title = "Push Point"; - sprite = "GWLGA0"; - } - 755 - { - title = "Pull Point"; - sprite = "GWLRA0"; - } - 756 - { - title = "Blast Linedef Executor"; - sprite = "TOADA0"; - width = 32; - height = 16; - } - 757 - { - title = "Fan Particle Generator"; - sprite = "PRTLA0"; - width = 8; - height = 16; - } - 758 - { - title = "Object Angle Anchor"; - sprite = "internal:view"; - } - 760 - { - title = "PolyObject Anchor"; - sprite = "internal:polyanchor"; - } - 761 - { - title = "PolyObject Spawn Point"; - sprite = "internal:polycenter"; - } - 762 - { - title = "PolyObject Spawn Point (Crush)"; - sprite = "internal:polycentercrush"; - } - 780 - { - title = "Skybox View Point"; - sprite = "internal:skyb"; - } -} - -greenflower -{ - color = 10; // Green - title = "Greenflower"; - - 800 - { - title = "GFZ Flower"; - sprite = "FWR1A0"; - width = 16; - height = 40; - } - 801 - { - title = "Sunflower"; - sprite = "FWR2A0"; - width = 16; - height = 96; - } - 802 - { - title = "Budding Flower"; - sprite = "FWR3A0"; - width = 8; - height = 32; - } - 803 - { - title = "Blueberry Bush"; - sprite = "BUS3A0"; + color = 10; // Green + title = "Botanic Serenity"; width = 16; height = 32; - } - 804 - { - title = "Berry Bush"; - sprite = "BUS1A0"; - width = 16; - height = 32; - } - 805 - { - title = "Bush"; - sprite = "BUS2A0"; - width = 16; - height = 32; - } - 806 - { - title = "GFZ Tree"; - sprite = "TRE1A0"; - width = 20; - height = 128; - } - 807 - { - title = "GFZ Berry Tree"; - sprite = "TRE1B0"; - width = 20; - height = 128; - } - 808 - { - title = "GFZ Cherry Tree"; - sprite = "TRE1C0"; - width = 20; - height = 128; - } - 809 - { - title = "Checkered Tree"; - sprite = "TRE2A0"; - width = 20; - height = 200; - } - 810 - { - title = "Checkered Tree (Sunset)"; - sprite = "TRE2B0"; - width = 20; - height = 200; - } - 811 - { - title = "Polygon Tree"; - sprite = "TRE4A0"; - width = 20; - height = 200; - } - 812 - { - title = "Bush Tree"; - sprite = "TRE5A0"; - width = 20; - height = 200; - } - 813 - { - title = "Red Bush Tree"; - sprite = "TRE5B0"; - width = 20; - height = 200; - } -} - -technohill -{ - color = 10; // Green - title = "Techno Hill"; - - 900 - { - title = "THZ Steam Flower"; - sprite = "THZPA0"; - width = 8; - height = 32; - } - 901 - { - title = "Alarm"; - sprite = "ALRMA0"; - width = 8; - height = 16; - hangs = 1; - } - 902 - { - title = "THZ Spin Flower (Red)"; - sprite = "FWR5A0"; - width = 16; - height = 64; - } - 903 - { - title = "THZ Spin Flower (Yellow)"; - sprite = "FWR6A0"; - width = 16; - height = 64; - } - 904 - { - arrow = 1; - title = "Whistlebush"; - sprite = "THZTA0"; - width = 16; - height = 64; - } -} - -deepsea -{ - color = 10; // Green - title = "Deep Sea"; - - 1000 - { - arrow = 1; - blocking = 2; - title = "Gargoyle"; - sprite = "GARGA1"; - width = 16; - height = 40; - } - 1009 - { - arrow = 1; - blocking = 2; - title = "Gargoyle (Big)"; - sprite = "GARGB1"; - width = 32; - height = 80; - } - 1001 - { - title = "Seaweed"; - sprite = "SEWEA0"; - width = 24; - height = 56; - } - 1002 - { - title = "Dripping Water"; - sprite = "DRIPD0"; - width = 8; - height = 16; - hangs = 1; - } - 1003 - { - title = "Coral (Green)"; - sprite = "CORLA0"; - width = 29; - height = 40; - } - 1004 - { - title = "Coral (Red)"; - sprite = "CORLB0"; - width = 30; - height = 53; - } - 1005 - { - title = "Coral (Orange)"; - sprite = "CORLC0"; - width = 28; - height = 41; - } - 1006 - { - title = "Blue Crystal"; - sprite = "BCRYA1"; - width = 8; - height = 16; - } - 1007 - { - title = "Kelp"; - sprite = "KELPA0"; - width = 16; - height = 292; - } - 1008 - { - title = "Stalagmite (DSZ1)"; - sprite = "DSTGA0"; - width = 8; - height = 116; - } - 1010 - { - arrow = 1; - title = "Light Beam"; - sprite = "LIBEARAL"; - width = 16; - height = 16; - } - 1011 - { - title = "Stalagmite (DSZ2)"; - sprite = "DSTGA0"; - width = 8; - height = 116; - } - 1012 - { - arrow = 1; - title = "Big Floating Mine"; - width = 28; - height = 56; - sprite = "BMNEA1"; - } - 1013 - { - title = "Animated Kelp"; - sprite = "ALGAA0"; - width = 48; - height = 120; - } - 1014 - { - title = "Large Coral (Brown)"; - sprite = "CORLD0"; - width = 56; - height = 112; - } - 1015 - { - title = "Large Coral (Beige)"; - sprite = "CORLE0"; - width = 56; - height = 112; - } -} - -castleeggman -{ - color = 10; // Green - title = "Castle Eggman"; - - 1100 - { - title = "Chain (Decorative)"; - sprite = "CHANA0"; - width = 4; - height = 128; - hangs = 1; - } - 1101 - { - title = "Torch"; - sprite = "FLAMA0E0"; - width = 8; - height = 32; - } - 1102 - { - arrow = 1; - blocking = 2; - title = "Eggman Statue"; - sprite = "ESTAA1"; - width = 32; - height = 240; - } - 1103 - { - title = "CEZ Flower"; - sprite = "FWR4A0"; - width = 16; - height = 40; - } - 1104 - { - title = "Mace Spawnpoint"; - sprite = "SMCEA0"; - width = 17; - height = 34; - } - 1105 - { - title = "Chain with Maces Spawnpoint"; - sprite = "SMCEA0"; - width = 17; - height = 34; - } - 1106 - { - title = "Chained Spring Spawnpoint"; - sprite = "YSPBA0"; - width = 17; - height = 34; - } - 1107 - { - title = "Chain Spawnpoint"; - sprite = "BMCHA0"; - width = 17; - height = 34; - } - 1108 - { - arrow = 1; - title = "Hidden Chain Spawnpoint"; - sprite = "internal:chain3"; - width = 17; - height = 34; - } - 1109 - { - title = "Firebar Spawnpoint"; - sprite = "BFBRA0"; - width = 17; - height = 34; - } - 1110 - { - title = "Custom Mace Spawnpoint"; - sprite = "SMCEA0"; - width = 17; - height = 34; - } - 1111 - { - arrow = 1; - blocking = 2; - title = "Crawla Statue"; - sprite = "CSTAA1"; - width = 16; - height = 40; - } - 1112 - { - arrow = 1; - blocking = 2; - title = "Lance-a-Bot Statue"; - sprite = "CBBSA1"; - width = 32; - height = 72; - } - 1114 - { - title = "Pine Tree"; - sprite = "PINEA0"; - width = 16; - height = 628; - } - 1115 - { - title = "CEZ Shrub (Small)"; - sprite = "CEZBA0"; - width = 16; - height = 24; - } - 1116 - { - title = "CEZ Shrub (Large)"; - sprite = "CEZBB0"; - width = 32; - height = 48; - } - 1117 - { - arrow = 1; - title = "Pole Banner (Red)"; - sprite = "BANRA0"; - width = 40; - height = 224; - } - 1118 - { - arrow = 1; - title = "Pole Banner (Blue)"; - sprite = "BANRA0"; - width = 40; - height = 224; - } - 1119 - { - title = "Candle"; - sprite = "CNDLA0"; - width = 8; - height = 48; - } - 1120 - { - title = "Candle Pricket"; - sprite = "CNDLB0"; - width = 8; - height = 176; - } - 1121 - { - title = "Flame Holder"; - sprite = "FLMHA0"; - width = 24; - height = 80; - } - 1122 - { - title = "Fire Torch"; - sprite = "CTRCA0"; - width = 16; - height = 80; - } - 1123 - { - title = "Cannonball Launcher"; - sprite = "internal:cannonball"; - width = 8; - height = 16; - } - 1124 - { - blocking = 2; - title = "Cannonball"; - sprite = "CBLLA0"; - width = 20; - height = 40; - } - 1125 - { - title = "Brambles"; - sprite = "CABRALAR"; - width = 48; - height = 32; - } - 1126 - { - title = "Invisible Lockon Object"; - sprite = "LCKNC0"; - width = 16; - height = 32; - } - 1127 - { - title = "Spectator Eggrobo"; - sprite = "EGR1A1"; - width = 20; - height = 72; - } - 1128 - { - arrow = 1; - title = "Waving Flag (Red)"; - sprite = "CFLGA0"; - width = 8; - height = 208; - } - 1129 - { - arrow = 1; - title = "Waving Flag (Blue)"; - sprite = "CFLGA0"; - width = 8; - height = 208; - } -} - -aridcanyon -{ - color = 10; // Green - title = "Arid Canyon"; - - 1200 - { - title = "Tumbleweed (Big)"; - sprite = "BTBLA0"; - width = 24; - height = 48; - } - 1201 - { - title = "Tumbleweed (Small)"; - sprite = "STBLA0"; - width = 12; - height = 24; - } - 1202 - { - arrow = 1; - title = "Rock Spawner"; - sprite = "ROIAA0"; - width = 8; - height = 16; - } - 1203 - { - title = "Tiny Red Flower Cactus"; - sprite = "CACTA0"; - width = 13; - height = 24; - } - 1204 - { - title = "Small Red Flower Cactus"; - sprite = "CACTB0"; - width = 15; - height = 52; - } - 1205 - { - title = "Tiny Blue Flower Cactus"; - sprite = "CACTC0"; - width = 13; - height = 24; - } - 1206 - { - title = "Small Blue Flower Cactus"; - sprite = "CACTD0"; - width = 15; - height = 52; - } - 1207 - { - title = "Prickly Pear"; - sprite = "CACTE0"; - width = 32; - height = 96; - } - 1208 - { - title = "Barrel Cactus"; - sprite = "CACTF0"; - width = 20; - height = 128; - } - 1209 - { - title = "Tall Barrel Cactus"; - sprite = "CACTG0"; - width = 24; - height = 224; - } - 1210 - { - title = "Armed Cactus"; - sprite = "CACTH0"; - width = 24; - height = 256; - } - 1211 - { - title = "Ball Cactus"; - sprite = "CACTI0"; - width = 48; - height = 96; - } - 1212 - { - title = "Caution Sign"; - sprite = "WWSGAR"; - width = 22; - height = 64; - } - 1213 - { - title = "Cacti Sign"; - sprite = "WWS2AR"; - width = 22; - height = 64; - } - 1214 - { - title = "Sharp Turn Sign"; - sprite = "WWS3ALAR"; - width = 16; - height = 192; - } - 1215 - { - title = "Mine Oil Lamp"; - sprite = "OILLA0"; - width = 22; - height = 64; - hangs = 1; - } - 1216 - { - title = "TNT Barrel"; - sprite = "BARRA1"; - width = 24; - height = 63; - } - 1217 - { - title = "TNT Proximity Shell"; - sprite = "REMTA0"; - width = 64; - height = 40; - } - 1218 - { - title = "Dust Devil"; - sprite = "TAZDCR"; - width = 80; - height = 416; - } - 1219 - { - title = "Minecart Spawner"; - sprite = "MCRTCLFR"; - width = 22; - height = 32; - } - 1220 - { - title = "Minecart Stopper"; - sprite = "MCRTIR"; - width = 32; - height = 32; - } - 1221 - { - title = "Minecart Saloon Door"; - sprite = "SALDARAL"; - width = 96; - height = 160; - } - 1222 - { - title = "Train Cameo Spawner"; - sprite = "TRAEBRBL"; - width = 28; - height = 32; - } - 1223 - { - title = "Train Dust Spawner"; - sprite = "ADSTA0"; - width = 4; - height = 4; - } - 1224 - { - title = "Train Steam Spawner"; - sprite = "STEAA0"; - width = 4; - height = 4; - } - 1229 - { - title = "Minecart Switch Point"; - sprite = "internal:zoom"; - width = 8; - height = 16; - } - 1230 - { - title = "Tiny Cactus"; - sprite = "CACTJ0"; - width = 13; - height = 28; - } - 1231 - { - title = "Small Cactus"; - sprite = "CACTK0"; - width = 15; - height = 60; - } -} - -redvolcano -{ - color = 10; // Green - title = "Red Volcano"; - - 1300 - { - arrow = 1; - title = "Flame Jet (Horizontal)"; - sprite = "internal:flameh"; - width = 16; - height = 40; - } - 1301 - { - title = "Flame Jet (Vertical)"; - sprite = "internal:flamev"; - width = 16; - height = 40; - } - 1302 - { - title = "Spinning Flame Jet (Counter-Clockwise)"; - sprite = "internal:flame2"; - width = 16; - height = 24; - } - 1303 - { - title = "Spinning Flame Jet (Clockwise)"; - sprite = "internal:flame1"; - width = 16; - height = 24; - } - 1304 - { - title = "Lavafall"; - sprite = "LFALF0"; - width = 30; - height = 32; - } - 1305 - { - title = "Rollout Rock"; - sprite = "PUMIA1A5"; - width = 30; - height = 60; - } - 1306 - { - title = "Big Fern"; - sprite = "JPLAB0"; - width = 32; - height = 48; - } - 1307 - { - title = "Jungle Palm"; - sprite = "JPLAC0"; - width = 32; - height = 48; - } - 1308 - { - title = "Torch Flower"; - sprite = "TFLOA0"; - width = 14; - height = 110; - } - 1309 - { - title = "RVZ1 Wall Vine (Long)"; - sprite = "WVINALAR"; - width = 1; - height = 288; - } - 1310 - { - title = "RVZ1 Wall Vine (Short)"; - sprite = "WVINBLBR"; - width = 1; - height = 288; - } -} - -botanicserenity -{ - color = 10; // Green - title = "Botanic Serenity"; - width = 16; - height = 32; - sprite = "BSZ1A0"; - 1400 - { - title = "Tall Flower (Red)"; sprite = "BSZ1A0"; + 1400 + { + title = "Tall Flower (Red)"; + sprite = "BSZ1A0"; + } + 1401 + { + title = "Tall Flower (Purple)"; + sprite = "BSZ1B0"; + } + 1402 + { + title = "Tall Flower (Blue)"; + sprite = "BSZ1C0"; + } + 1403 + { + title = "Tall Flower (Cyan)"; + sprite = "BSZ1D0"; + } + 1404 + { + title = "Tall Flower (Yellow)"; + sprite = "BSZ1E0"; + } + 1405 + { + title = "Tall Flower (Orange)"; + sprite = "BSZ1F0"; + } + 1410 + { + title = "Medium Flower (Red)"; + sprite = "BSZ2A0"; + } + 1411 + { + title = "Medium Flower (Purple)"; + sprite = "BSZ2B0"; + } + 1412 + { + title = "Medium Flower (Blue)"; + sprite = "BSZ2C0"; + } + 1413 + { + title = "Medium Flower (Cyan)"; + sprite = "BSZ2D0"; + } + 1414 + { + title = "Medium Flower (Yellow)"; + sprite = "BSZ2E0"; + } + 1415 + { + title = "Medium Flower (Orange)"; + sprite = "BSZ2F0"; + } + 1420 + { + title = "Short Flower (Red)"; + sprite = "BSZ3A0"; + } + 1421 + { + title = "Short Flower (Purple)"; + sprite = "BSZ3B0"; + } + 1422 + { + title = "Short Flower (Blue)"; + sprite = "BSZ3C0"; + } + 1423 + { + title = "Short Flower (Cyan)"; + sprite = "BSZ3D0"; + } + 1424 + { + title = "Short Flower (Yellow)"; + sprite = "BSZ3E0"; + } + 1425 + { + title = "Short Flower (Orange)"; + sprite = "BSZ3F0"; + } + 1430 + { + title = "Tulip (Red)"; + sprite = "BST1A0"; + } + 1431 + { + title = "Tulip (Purple)"; + sprite = "BST2A0"; + } + 1432 + { + title = "Tulip (Blue)"; + sprite = "BST3A0"; + } + 1433 + { + title = "Tulip (Cyan)"; + sprite = "BST4A0"; + } + 1434 + { + title = "Tulip (Yellow)"; + sprite = "BST5A0"; + } + 1435 + { + title = "Tulip (Orange)"; + sprite = "BST6A0"; + } + 1440 + { + title = "Cluster (Red)"; + sprite = "BSZ5A0"; + } + 1441 + { + title = "Cluster (Purple)"; + sprite = "BSZ5B0"; + } + 1442 + { + title = "Cluster (Blue)"; + sprite = "BSZ5C0"; + } + 1443 + { + title = "Cluster (Cyan)"; + sprite = "BSZ5D0"; + } + 1444 + { + title = "Cluster (Yellow)"; + sprite = "BSZ5E0"; + } + 1445 + { + title = "Cluster (Orange)"; + sprite = "BSZ5F0"; + } + 1450 + { + title = "Bush (Red)"; + sprite = "BSZ6A0"; + } + 1451 + { + title = "Bush (Purple)"; + sprite = "BSZ6B0"; + } + 1452 + { + title = "Bush (Blue)"; + sprite = "BSZ6C0"; + } + 1453 + { + title = "Bush (Cyan)"; + sprite = "BSZ6D0"; + } + 1454 + { + title = "Bush (Yellow)"; + sprite = "BSZ6E0"; + } + 1455 + { + title = "Bush (Orange)"; + sprite = "BSZ6F0"; + } + 1460 + { + title = "Vine (Red)"; + sprite = "BSZ7A0"; + } + 1461 + { + title = "Vine (Purple)"; + sprite = "BSZ7B0"; + } + 1462 + { + title = "Vine (Blue)"; + sprite = "BSZ7C0"; + } + 1463 + { + title = "Vine (Cyan)"; + sprite = "BSZ7D0"; + } + 1464 + { + title = "Vine (Yellow)"; + sprite = "BSZ7E0"; + } + 1465 + { + title = "Vine (Orange)"; + sprite = "BSZ7F0"; + } + 1470 + { + title = "BSZ Shrub"; + sprite = "BSZ8A0"; + } + 1471 + { + title = "BSZ Clover"; + sprite = "BSZ8B0"; + } + 1473 + { + title = "Palm Tree (Big)"; + width = 16; + height = 160; + sprite = "BSZ8D0"; + } + 1475 + { + title = "Palm Tree (Small)"; + width = 16; + height = 80; + sprite = "BSZ8F0"; + } } - 1401 - { - title = "Tall Flower (Purple)"; - sprite = "BSZ1B0"; - } - 1402 - { - title = "Tall Flower (Blue)"; - sprite = "BSZ1C0"; - } - 1403 - { - title = "Tall Flower (Cyan)"; - sprite = "BSZ1D0"; - } - 1404 - { - title = "Tall Flower (Yellow)"; - sprite = "BSZ1E0"; - } - 1405 - { - title = "Tall Flower (Orange)"; - sprite = "BSZ1F0"; - } - 1410 - { - title = "Medium Flower (Red)"; - sprite = "BSZ2A0"; - } - 1411 - { - title = "Medium Flower (Purple)"; - sprite = "BSZ2B0"; - } - 1412 - { - title = "Medium Flower (Blue)"; - sprite = "BSZ2C0"; - } - 1413 - { - title = "Medium Flower (Cyan)"; - sprite = "BSZ2D0"; - } - 1414 - { - title = "Medium Flower (Yellow)"; - sprite = "BSZ2E0"; - } - 1415 - { - title = "Medium Flower (Orange)"; - sprite = "BSZ2F0"; - } - 1420 - { - title = "Short Flower (Red)"; - sprite = "BSZ3A0"; - } - 1421 - { - title = "Short Flower (Purple)"; - sprite = "BSZ3B0"; - } - 1422 - { - title = "Short Flower (Blue)"; - sprite = "BSZ3C0"; - } - 1423 - { - title = "Short Flower (Cyan)"; - sprite = "BSZ3D0"; - } - 1424 - { - title = "Short Flower (Yellow)"; - sprite = "BSZ3E0"; - } - 1425 - { - title = "Short Flower (Orange)"; - sprite = "BSZ3F0"; - } - 1430 - { - title = "Tulip (Red)"; - sprite = "BST1A0"; - } - 1431 - { - title = "Tulip (Purple)"; - sprite = "BST2A0"; - } - 1432 - { - title = "Tulip (Blue)"; - sprite = "BST3A0"; - } - 1433 - { - title = "Tulip (Cyan)"; - sprite = "BST4A0"; - } - 1434 - { - title = "Tulip (Yellow)"; - sprite = "BST5A0"; - } - 1435 - { - title = "Tulip (Orange)"; - sprite = "BST6A0"; - } - 1440 - { - title = "Cluster (Red)"; - sprite = "BSZ5A0"; - } - 1441 - { - title = "Cluster (Purple)"; - sprite = "BSZ5B0"; - } - 1442 - { - title = "Cluster (Blue)"; - sprite = "BSZ5C0"; - } - 1443 - { - title = "Cluster (Cyan)"; - sprite = "BSZ5D0"; - } - 1444 - { - title = "Cluster (Yellow)"; - sprite = "BSZ5E0"; - } - 1445 - { - title = "Cluster (Orange)"; - sprite = "BSZ5F0"; - } - 1450 - { - title = "Bush (Red)"; - sprite = "BSZ6A0"; - } - 1451 - { - title = "Bush (Purple)"; - sprite = "BSZ6B0"; - } - 1452 - { - title = "Bush (Blue)"; - sprite = "BSZ6C0"; - } - 1453 - { - title = "Bush (Cyan)"; - sprite = "BSZ6D0"; - } - 1454 - { - title = "Bush (Yellow)"; - sprite = "BSZ6E0"; - } - 1455 - { - title = "Bush (Orange)"; - sprite = "BSZ6F0"; - } - 1460 - { - title = "Vine (Red)"; - sprite = "BSZ7A0"; - } - 1461 - { - title = "Vine (Purple)"; - sprite = "BSZ7B0"; - } - 1462 - { - title = "Vine (Blue)"; - sprite = "BSZ7C0"; - } - 1463 - { - title = "Vine (Cyan)"; - sprite = "BSZ7D0"; - } - 1464 - { - title = "Vine (Yellow)"; - sprite = "BSZ7E0"; - } - 1465 - { - title = "Vine (Orange)"; - sprite = "BSZ7F0"; - } - 1470 - { - title = "BSZ Shrub"; - sprite = "BSZ8A0"; - } - 1471 - { - title = "BSZ Clover"; - sprite = "BSZ8B0"; - } - 1473 - { - title = "Palm Tree (Big)"; - width = 16; - height = 160; - sprite = "BSZ8D0"; - } - 1475 - { - title = "Palm Tree (Small)"; - width = 16; - height = 80; - sprite = "BSZ8F0"; - } -} -azuretemple -{ - color = 10; // Green - title = "Azure Temple"; + azuretemple + { + color = 10; // Green + title = "Azure Temple"; - 1500 - { - arrow = 1; - blocking = 2; - title = "Glaregoyle"; - sprite = "BGARA1"; - width = 16; - height = 40; + 1500 + { + arrow = 1; + blocking = 2; + title = "Glaregoyle"; + sprite = "BGARA1"; + width = 16; + height = 40; + } + 1501 + { + arrow = 1; + blocking = 2; + title = "Glaregoyle (Up)"; + sprite = "BGARA1"; + width = 16; + height = 40; + } + 1502 + { + arrow = 1; + blocking = 2; + title = "Glaregoyle (Down)"; + sprite = "BGARA1"; + width = 16; + height = 40; + } + 1503 + { + arrow = 1; + blocking = 2; + title = "Glaregoyle (Long)"; + sprite = "BGARA1"; + width = 16; + height = 40; + } + 1504 + { + title = "ATZ Target"; + sprite = "RCRYB0"; + width = 24; + height = 32; + } + 1505 + { + title = "Green Flame"; + sprite = "CFLMA0E0"; + width = 8; + height = 32; + } + 1506 + { + arrow = 1; + blocking = 2; + title = "Blue Gargoyle"; + sprite = "BGARD1"; + width = 16; + height = 40; + } } - 1501 + + dreamhill { - arrow = 1; - blocking = 2; - title = "Glaregoyle (Up)"; - sprite = "BGARA1"; - width = 16; - height = 40; + color = 10; // Green + title = "Dream Hill"; + + 1600 + { + title = "Spring Tree"; + sprite = "TRE6A0"; + width = 16; + height = 32; + } + 1601 + { + title = "Shleep"; + sprite = "SHLPA0"; + width = 24; + height = 32; + } + 1602 + { + title = "Nightopian"; + sprite = "NTPNA1"; + width = 16; + height = 40; + } } - 1502 + + nightstrk { - arrow = 1; - blocking = 2; - title = "Glaregoyle (Down)"; - sprite = "BGARA1"; - width = 16; - height = 40; - } - 1503 - { - arrow = 1; - blocking = 2; - title = "Glaregoyle (Long)"; - sprite = "BGARA1"; - width = 16; - height = 40; - } - 1504 - { - title = "ATZ Target"; - sprite = "RCRYB0"; - width = 24; - height = 32; - } - 1505 - { - title = "Green Flame"; - sprite = "CFLMA0E0"; + color = 13; // Pink + title = "NiGHTS Track"; width = 8; - height = 32; + height = 4096; + sprite = "UNKNA0"; + + 1700 + { + title = "Axis"; + sprite = "internal:axis1"; + circle = 1; + } + 1701 + { + title = "Axis Transfer"; + sprite = "internal:axis2"; + } + 1702 + { + title = "Axis Transfer Line"; + sprite = "internal:axis3"; + } + 1710 + { + title = "Ideya Capture"; + sprite = "CAPSA0"; + width = 72; + height = 144; + } } - 1506 + + nights { - arrow = 1; - blocking = 2; - title = "Blue Gargoyle"; - sprite = "BGARD1"; + color = 13; // Pink + title = "NiGHTS Items"; + width = 16; + height = 32; + + 1703 + { + title = "Ideya Drone"; + sprite = "NDRNA1"; + width = 16; + height = 56; + } + 1704 + { + arrow = 1; + title = "NiGHTS Bumper"; + sprite = "NBMPG3G7"; + width = 32; + height = 64; + } + 1705 + { + arrow = 1; + title = "Hoop (Generic)"; + sprite = "HOOPA0"; + width = 80; + height = 160; + } + 1706 + { + title = "Blue Sphere"; + sprite = "SPHRA0"; + width = 16; + height = 24; + } + 1707 + { + title = "Super Paraloop"; + sprite = "NPRUA0"; + } + 1708 + { + title = "Drill Refill"; + sprite = "NPRUB0"; + } + 1709 + { + title = "Nightopian Helper"; + sprite = "NPRUC0"; + } + 1711 + { + title = "Extra Time"; + sprite = "NPRUD0"; + } + 1712 + { + title = "Link Freeze"; + sprite = "NPRUE0"; + } + 1713 + { + arrow = 1; + title = "Hoop (Customizable)"; + sprite = "HOOPA0"; + width = 80; + height = 160; + } + 1714 + { + title = "Ideya Anchor Point"; + sprite = "internal:axis1"; + width = 8; + height = 16; + } + } + + mario + { + color = 6; // Brown + title = "Mario"; + + 1800 + { + title = "Coin"; + sprite = "COINA0"; + width = 16; + height = 24; + } + 1801 + { + arrow = 1; + title = "Goomba"; + sprite = "GOOMA0"; + width = 24; + height = 32; + } + 1802 + { + arrow = 1; + title = "Goomba (Blue)"; + sprite = "BGOMA0"; + width = 24; + height = 32; + } + 1803 + { + title = "Fire Flower"; + sprite = "FFWRB0"; + width = 16; + height = 32; + } + 1804 + { + title = "Koopa Shell"; + sprite = "SHLLA1"; + width = 16; + height = 20; + } + 1805 + { + title = "Puma (Jumping Fireball)"; + sprite = "PUMAA0"; + width = 8; + height = 16; + } + 1806 + { + title = "King Bowser"; + sprite = "KOOPA0"; + width = 16; + height = 48; + } + 1807 + { + title = "Axe"; + sprite = "MAXEA0"; + width = 8; + height = 16; + } + 1808 + { + title = "Bush (Short)"; + sprite = "MUS1A0"; + width = 16; + height = 32; + } + 1809 + { + title = "Bush (Tall)"; + sprite = "MUS2A0"; + width = 16; + height = 32; + } + 1810 + { + title = "Toad"; + sprite = "TOADA0"; + width = 8; + height = 32; + } + } + + christmasdisco + { + color = 10; // Green + title = "Christmas & Disco"; + + 1850 + { + title = "Christmas Pole"; + sprite = "XMS1A0"; + width = 16; + height = 40; + } + 1851 + { + title = "Candy Cane"; + sprite = "XMS2A0"; + width = 8; + height = 32; + } + 1852 + { + blocking = 2; + title = "Snowman"; + sprite = "XMS3A0"; + width = 16; + height = 64; + } + 1853 + { + blocking = 2; + title = "Snowman (With Hat)"; + sprite = "XMS3B0"; + width = 16; + height = 80; + } + 1854 + { + title = "Lamp Post"; + sprite = "XMS4A0"; + width = 8; + height = 120; + } + 1855 + { + title = "Lamp Post (Snow)"; + sprite = "XMS4B0"; + width = 8; + height = 120; + } + 1856 + { + title = "Hanging Star"; + sprite = "XMS5A0"; + width = 4; + height = 80; + hangs = 1; + } + 1857 + { + title = "Berry Bush (Snow)"; + sprite = "BUS1B0"; + width = 16; + height = 32; + } + 1858 + { + title = "Bush (Snow)"; + sprite = "BUS2B0"; + width = 16; + height = 32; + } + 1859 + { + title = "Blueberry Bush (Snow)"; + sprite = "BUS3B0"; + width = 16; + height = 32; + } + 1875 + { + title = "Disco Ball"; + sprite = "DBALA0"; + width = 16; + height = 54; + hangs = 1; + } + 1876 + { + arrow = 1; + blocking = 2; + title = "Eggman Disco Statue"; + sprite = "ESTAB1"; + width = 20; + height = 96; + } + } + + stalagmites + { + color = 10; // Green + title = "Stalagmites"; width = 16; height = 40; - } -} -dreamhill -{ - color = 10; // Green - title = "Dream Hill"; + 1900 + { + title = "Brown Stalagmite (Tall)"; + sprite = "STLGA0"; + width = 16; + height = 40; + } + 1901 + { + title = "Brown Stalagmite"; + sprite = "STLGB0"; + width = 16; + height = 40; + } + 1902 + { + title = "Orange Stalagmite (Tall)"; + sprite = "STLGC0"; + width = 16; + height = 40; + } + 1903 + { + title = "Orange Stalagmite"; + sprite = "STLGD0"; + width = 16; + height = 40; + } + 1904 + { + title = "Red Stalagmite (Tall)"; + sprite = "STLGE0"; + width = 16; + height = 40; + } + 1905 + { + title = "Red Stalagmite"; + sprite = "STLGF0"; + width = 16; + height = 40; + } + 1906 + { + title = "Gray Stalagmite (Tall)"; + sprite = "STLGG0"; + width = 24; + height = 96; + } + 1907 + { + title = "Gray Stalagmite"; + sprite = "STLGH0"; + width = 16; + height = 40; + } + 1908 + { + title = "Blue Stalagmite (Tall)"; + sprite = "STLGI0"; + width = 16; + height = 40; + } + 1909 + { + title = "Blue Stalagmite"; + sprite = "STLGJ0"; + width = 16; + height = 40; + } + } - 1600 + hauntedheights { - title = "Spring Tree"; - sprite = "TRE6A0"; - width = 16; - height = 32; - } - 1601 - { - title = "Shleep"; - sprite = "SHLPA0"; - width = 24; - height = 32; - } - 1602 - { - title = "Nightopian"; - sprite = "NTPNA1"; - width = 16; - height = 40; - } -} + color = 10; // Green + title = "Haunted Heights"; -nightstrk -{ - color = 13; // Pink - title = "NiGHTS Track"; - width = 8; - height = 4096; - sprite = "UNKNA0"; + 2000 + { + title = "Smashing Spikeball"; + sprite = "FMCEA0"; + width = 18; + height = 28; + } + 2001 + { + title = "HHZ Grass"; + sprite = "HHZMA0"; + width = 16; + height = 40; + } + 2002 + { + title = "HHZ Tentacle 1"; + sprite = "HHZMB0"; + width = 16; + height = 40; + } + 2003 + { + title = "HHZ Tentacle 2"; + sprite = "HHZMC0"; + width = 16; + height = 40; + } + 2004 + { + title = "HHZ Stalagmite (Tall)"; + sprite = "HHZME0"; + width = 16; + height = 40; + } + 2005 + { + title = "HHZ Stalagmite (Short)"; + sprite = "HHZMF0"; + width = 16; + height = 40; + } + 2006 + { + title = "Jack-o'-lantern 1"; + sprite = "PUMKA0"; + width = 16; + height = 40; + } + 2007 + { + title = "Jack-o'-lantern 2"; + sprite = "PUMKB0"; + width = 16; + height = 40; + } + 2008 + { + title = "Jack-o'-lantern 3"; + sprite = "PUMKC0"; + width = 16; + height = 40; + } + 2009 + { + title = "Purple Mushroom"; + sprite = "SHRMD0"; + width = 16; + height = 48; + } + 2010 + { + title = "HHZ Tree"; + sprite = "HHPLC0"; + width = 12; + height = 40; + } + } - 1700 + frozenhillside { - title = "Axis"; - sprite = "internal:axis1"; - circle = 1; - } - 1701 - { - title = "Axis Transfer"; - sprite = "internal:axis2"; - } - 1702 - { - title = "Axis Transfer Line"; - sprite = "internal:axis3"; - } - 1710 - { - title = "Ideya Capture"; - sprite = "CAPSA0"; - width = 72; - height = 144; - } -} + color = 10; // Green + title = "Frozen Hillside"; -nights -{ - color = 13; // Pink - title = "NiGHTS Items"; - width = 16; - height = 32; + 2100 + { + title = "Ice Shard (Small)"; + sprite = "FHZIA0"; + width = 8; + height = 32; + } + 2101 + { + title = "Ice Shard (Large)"; + sprite = "FHZIB0"; + width = 8; + height = 32; + } + 2102 + { + title = "Crystal Tree (Aqua)"; + sprite = "TRE3A0"; + width = 20; + height = 200; + } + 2103 + { + title = "Crystal Tree (Pink)"; + sprite = "TRE3B0"; + width = 20; + height = 200; + } + 2104 + { + title = "Amy Cameo"; + sprite = "ROSYA1"; + width = 16; + height = 48; + } + 2105 + { + title = "Mistletoe"; + sprite = "XMS6A0"; + width = 52; + height = 106; + } + } - 1703 + tutorial { - title = "Ideya Drone"; - sprite = "NDRNA1"; - width = 16; - height = 56; + color = 10; // Green + title = "Tutorial"; + + 799 + { + title = "Tutorial Plant"; + sprite = "TUPFH0"; + width = 40; + height = 144; + } } - 1704 + + flickies { - arrow = 1; - title = "NiGHTS Bumper"; - sprite = "NBMPG3G7"; - width = 32; - height = 64; - } - 1705 - { - arrow = 1; - title = "Hoop (Generic)"; - sprite = "HOOPA0"; - width = 80; - height = 160; - } - 1706 - { - title = "Blue Sphere"; - sprite = "SPHRA0"; - width = 16; - height = 24; - } - 1707 - { - title = "Super Paraloop"; - sprite = "NPRUA0"; - } - 1708 - { - title = "Drill Refill"; - sprite = "NPRUB0"; - } - 1709 - { - title = "Nightopian Helper"; - sprite = "NPRUC0"; - } - 1711 - { - title = "Extra Time"; - sprite = "NPRUD0"; - } - 1712 - { - title = "Link Freeze"; - sprite = "NPRUE0"; - } - 1713 - { - arrow = 1; - title = "Hoop (Customizable)"; - sprite = "HOOPA0"; - width = 80; - height = 160; - } - 1714 - { - title = "Ideya Anchor Point"; - sprite = "internal:axis1"; + color = 10; // Green + title = "Flickies"; width = 8; - height = 16; - } -} - -mario -{ - color = 6; // Brown - title = "Mario"; - - 1800 - { - title = "Coin"; - sprite = "COINA0"; - width = 16; - height = 24; - } - 1801 - { - arrow = 1; - title = "Goomba"; - sprite = "GOOMA0"; - width = 24; - height = 32; - } - 1802 - { - arrow = 1; - title = "Goomba (Blue)"; - sprite = "BGOMA0"; - width = 24; - height = 32; - } - 1803 - { - title = "Fire Flower"; - sprite = "FFWRB0"; - width = 16; - height = 32; - } - 1804 - { - title = "Koopa Shell"; - sprite = "SHLLA1"; - width = 16; height = 20; - } - 1805 - { - title = "Puma (Jumping Fireball)"; - sprite = "PUMAA0"; - width = 8; - height = 16; - } - 1806 - { - title = "King Bowser"; - sprite = "KOOPA0"; - width = 16; - height = 48; - } - 1807 - { - title = "Axe"; - sprite = "MAXEA0"; - width = 8; - height = 16; - } - 1808 - { - title = "Bush (Short)"; - sprite = "MUS1A0"; - width = 16; - height = 32; - } - 1809 - { - title = "Bush (Tall)"; - sprite = "MUS2A0"; - width = 16; - height = 32; - } - 1810 - { - title = "Toad"; - sprite = "TOADA0"; - width = 8; - height = 32; + + 2200 + { + title = "Bluebird"; + sprite = "FL01A1"; + } + 2201 + { + title = "Rabbit"; + sprite = "FL02A1"; + } + 2202 + { + title = "Chicken"; + sprite = "FL03A1"; + } + 2203 + { + title = "Seal"; + sprite = "FL04A1"; + } + 2204 + { + title = "Pig"; + sprite = "FL05A1"; + } + 2205 + { + title = "Chipmunk"; + sprite = "FL06A1"; + } + 2206 + { + title = "Penguin"; + sprite = "FL07A1"; + } + 2207 + { + title = "Fish"; + sprite = "FL08A1"; + } + 2208 + { + title = "Ram"; + sprite = "FL09A1"; + } + 2209 + { + title = "Puffin"; + sprite = "FL10A1"; + } + 2210 + { + title = "Cow"; + sprite = "FL11A1"; + } + 2211 + { + title = "Rat"; + sprite = "FL12A1"; + } + 2212 + { + title = "Bear"; + sprite = "FL13A1"; + } + 2213 + { + title = "Dove"; + sprite = "FL14A1"; + } + 2214 + { + title = "Cat"; + sprite = "FL15A1"; + } + 2215 + { + title = "Canary"; + sprite = "FL16A1"; + } + 2216 + { + title = "Spider"; + sprite = "FS01A1"; + } + 2217 + { + title = "Bat"; + sprite = "FS02A0"; + } } } -christmasdisco +udmf { - color = 10; // Green - title = "Christmas & Disco"; - - 1850 - { - title = "Christmas Pole"; - sprite = "XMS1A0"; - width = 16; - height = 40; - } - 1851 - { - title = "Candy Cane"; - sprite = "XMS2A0"; - width = 8; - height = 32; - } - 1852 - { - blocking = 2; - title = "Snowman"; - sprite = "XMS3A0"; - width = 16; - height = 64; - } - 1853 - { - blocking = 2; - title = "Snowman (With Hat)"; - sprite = "XMS3B0"; - width = 16; - height = 80; - } - 1854 - { - title = "Lamp Post"; - sprite = "XMS4A0"; - width = 8; - height = 120; - } - 1855 - { - title = "Lamp Post (Snow)"; - sprite = "XMS4B0"; - width = 8; - height = 120; - } - 1856 - { - title = "Hanging Star"; - sprite = "XMS5A0"; - width = 4; - height = 80; - hangs = 1; - } - 1857 - { - title = "Berry Bush (Snow)"; - sprite = "BUS1B0"; - width = 16; - height = 32; - } - 1858 - { - title = "Bush (Snow)"; - sprite = "BUS2B0"; - width = 16; - height = 32; - } - 1859 - { - title = "Blueberry Bush (Snow)"; - sprite = "BUS3B0"; - width = 16; - height = 32; - } - 1875 - { - title = "Disco Ball"; - sprite = "DBALA0"; - width = 16; - height = 54; - hangs = 1; - } - 1876 + editor { + color = 15; // White arrow = 1; - blocking = 2; - title = "Eggman Disco Statue"; - sprite = "ESTAB1"; - width = 20; - height = 96; - } -} + title = ""; + error = -1; + width = 8; + height = 16; + sort = 1; -stalagmites -{ - color = 10; // Green - title = "Stalagmites"; - width = 16; - height = 40; + 3328 = "3D Mode Start"; + } - 1900 + starts { - title = "Brown Stalagmite (Tall)"; - sprite = "STLGA0"; + color = 1; // Blue + arrow = 1; + title = "Player Starts"; width = 16; - height = 40; + height = 48; + sprite = "PLAYA0"; + + 1 + { + title = "Player 01 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 2 + { + title = "Player 02 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 3 + { + title = "Player 03 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 4 + { + title = "Player 04 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 5 + { + title = "Player 05 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 6 + { + title = "Player 06 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 7 + { + title = "Player 07 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 8 + { + title = "Player 08 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 9 + { + title = "Player 09 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 10 + { + title = "Player 10 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 11 + { + title = "Player 11 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 12 + { + title = "Player 12 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 13 + { + title = "Player 13 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 14 + { + title = "Player 14 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 15 + { + title = "Player 15 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 16 + { + title = "Player 16 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 17 + { + title = "Player 17 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 18 + { + title = "Player 18 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 19 + { + title = "Player 19 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 20 + { + title = "Player 20 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 21 + { + title = "Player 21 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 22 + { + title = "Player 22 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 23 + { + title = "Player 23 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 24 + { + title = "Player 24 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 25 + { + title = "Player 25 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 26 + { + title = "Player 26 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 27 + { + title = "Player 27 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 28 + { + title = "Player 28 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 29 + { + title = "Player 29 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 30 + { + title = "Player 30 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 31 + { + title = "Player 31 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 32 + { + title = "Player 32 Start"; + sprite = "PLAYA0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 33 + { + title = "Match Start"; + sprite = "NDRNA2A8"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 34 + { + title = "CTF Red Team Start"; + sprite = "SIGNG0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } + 35 + { + title = "CTF Blue Team Start"; + sprite = "SIGNE0"; + arg0 + { + title = "Spawn on ceiling?"; + type = 11; + enum = "noyes"; + } + } } - 1901 + + enemies { - title = "Brown Stalagmite"; - sprite = "STLGB0"; - width = 16; - height = 40; + color = 9; // Light_Blue + arrow = 1; + title = "Enemies"; + + 100 + { + title = "Crawla (Blue)"; + sprite = "POSSA1"; + width = 24; + height = 32; + } + 101 + { + title = "Crawla (Red)"; + sprite = "SPOSA1"; + width = 24; + height = 32; + } + 102 + { + title = "Stupid Dumb Unnamed RoboFish"; + sprite = "FISHA0"; + width = 8; + height = 28; + arg0 + { + title = "Jump strength"; + } + } + 103 + { + title = "Buzz (Gold)"; + sprite = "BUZZA1"; + width = 28; + height = 40; + arg0 + { + title = "Can move?"; + type = 11; + enum = "yesno"; + } + } + 104 + { + title = "Buzz (Red)"; + sprite = "RBUZA1"; + width = 28; + height = 40; + arg0 + { + title = "Can move?"; + type = 11; + enum = "yesno"; + } + } + 108 + { + title = "Deton"; + sprite = "DETNA1"; + width = 20; + height = 32; + } + 110 + { + title = "Turret"; + sprite = "TRETA1"; + width = 16; + height = 32; + arg0 + { + title = "Death trigger tag"; + type = 15; + } + } + 111 + { + title = "Pop-up Turret"; + sprite = "TURRI1"; + width = 12; + height = 64; + arg0 + { + title = "Firing delay"; + } + } + 122 + { + title = "Spring Shell (Green)"; + sprite = "SSHLA1"; + width = 24; + height = 40; + } + 125 + { + title = "Spring Shell (Yellow)"; + sprite = "SSHLI1"; + width = 24; + height = 40; + } + 109 + { + title = "Skim"; + sprite = "SKIMA1"; + width = 16; + height = 24; + } + 113 + { + title = "Jet Jaw"; + sprite = "JJAWA3A7"; + width = 12; + height = 20; + } + 126 + { + title = "Crushstacean"; + sprite = "CRABA0"; + width = 24; + height = 32; + arg0 + { + title = "Spawn direction"; + type = 11; + enum + { + 0 = "Right"; + 1 = "Left"; + } + } + } + 138 + { + title = "Banpyura"; + sprite = "CR2BA0"; + width = 24; + height = 32; + arg0 + { + title = "Spawn direction"; + type = 11; + enum + { + 0 = "Right"; + 1 = "Left"; + } + } + } + 117 + { + title = "Robo-Hood"; + sprite = "ARCHA1"; + width = 24; + height = 32; + arg0 + { + title = "Can jump?"; + type = 11; + enum = "yesno"; + } + } + 118 + { + title = "Lance-a-Bot"; + sprite = "CBFSA1"; + width = 32; + height = 72; + } + 1113 + { + title = "Suspicious Lance-a-Bot Statue"; + sprite = "CBBSA1"; + width = 32; + height = 72; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } + } + 119 + { + title = "Egg Guard"; + sprite = "ESHIA1"; + width = 16; + height = 48; + arg0 + { + title = "Turn direction"; + type = 11; + enum + { + 0 = "Back"; + 1 = "Right"; + 2 = "Left"; + } + } + arg1 + { + title = "Double speed?"; + type = 11; + enum = "noyes"; + } + } + 115 + { + title = "Bird Aircraft Strike Hazard"; + sprite = "VLTRF1"; + width = 12; + height = 24; + } + 120 + { + title = "Green Snapper"; + sprite = "GSNPA1"; + width = 24; + height = 24; + } + 121 + { + title = "Minus"; + sprite = "MNUSA0"; + width = 24; + height = 32; + } + 134 + { + title = "Canarivore"; + sprite = "CANAA0"; + width = 12; + height = 80; + hangs = 1; + } + 123 + { + title = "Unidus"; + sprite = "UNIDA1"; + width = 18; + height = 36; + } + 135 + { + title = "Pterabyte Spawner"; + sprite = "PTERA2A8"; + width = 16; + height = 16; + arg0 + { + title = "Number of Pterabytes"; + default = 1; + } + } + 136 + { + title = "Pyre Fly"; + sprite = "PYREA0"; + width = 24; + height = 34; + arg0 + { + title = "Start on fire?"; + type = 11; + enum = "noyes"; + } + } + 137 + { + title = "Dragonbomber"; + sprite = "DRABA1"; + width = 28; + height = 48; + } + 105 + { + title = "Jetty-Syn Bomber"; + sprite = "JETBB1"; + width = 20; + height = 50; + arg0 + { + title = "Can move?"; + type = 11; + enum = "yesno"; + } + } + 106 + { + title = "Jetty-Syn Gunner"; + sprite = "JETGB1"; + width = 20; + height = 48; + arg0 + { + title = "Can move?"; + type = 11; + enum = "yesno"; + } + } + 112 + { + title = "Spincushion"; + sprite = "SHRPA1"; + width = 16; + height = 24; + } + 114 + { + title = "Snailer"; + sprite = "SNLRA3A7"; + width = 24; + height = 48; + } + 129 + { + title = "Penguinator"; + sprite = "PENGA1"; + width = 24; + height = 32; + } + 130 + { + title = "Pophat"; + sprite = "POPHA1"; + width = 24; + height = 32; + } + 107 + { + title = "Crawla Commander"; + sprite = "CCOMA1"; + width = 16; + height = 32; + } + 131 + { + title = "Spinbobert"; + sprite = "SBOBB0"; + width = 32; + height = 32; + } + 132 + { + title = "Cacolantern"; + sprite = "CACOA0"; + width = 32; + height = 32; + arg0 + { + title = "Can move?"; + type = 11; + enum = "yesno"; + } + } + 133 + { + title = "Hangster"; + sprite = "HBATC1"; + width = 24; + height = 24; + hangs = 1; + } + 127 + { + title = "Hive Elemental"; + sprite = "HIVEA0"; + width = 32; + height = 80; + arg0 + { + title = "Number of bees"; + } + } + 128 + { + title = "Bumblebore"; + sprite = "BUMBA1"; + width = 16; + height = 32; + arg0 + { + title = "Can move?"; + type = 11; + enum = "yesno"; + } + } + 124 + { + title = "Buggle"; + sprite = "BBUZA1"; + width = 20; + height = 24; + } + 116 + { + title = "Pointy"; + sprite = "PNTYA1"; + width = 8; + height = 16; + } } - 1902 + + bosses { - title = "Orange Stalagmite (Tall)"; - sprite = "STLGC0"; - width = 16; - height = 40; + color = 8; // Dark_Gray + arrow = 1; + title = "Bosses"; + + 200 + { + title = "Egg Mobile"; + sprite = "EGGMA1"; + width = 24; + height = 76; + arg0 + { + title = "Boss ID"; + } + arg1 + { + title = "End level on death?"; + type = 11; + enum = "noyes"; + } + arg2 + { + title = "Death trigger tag"; + type = 15; + } + arg3 + { + title = "Victory trigger tag"; + type = 15; + } + arg4 + { + title = "Pinch trigger tag"; + type = 15; + } + } + 201 + { + title = "Egg Slimer"; + sprite = "EGGNA1"; + width = 24; + height = 76; + arg0 + { + title = "Boss ID"; + } + arg1 + { + title = "End level on death?"; + type = 11; + enum = "noyes"; + } + arg2 + { + title = "Death trigger tag"; + type = 15; + } + arg3 + { + title = "Victory trigger tag"; + type = 15; + } + arg4 + { + title = "Pinch trigger tag"; + type = 15; + } + arg5 + { + title = "Speed up when hit?"; + type = 11; + enum = "yesno"; + } + } + 202 + { + title = "Sea Egg"; + sprite = "EGGOA1"; + width = 32; + height = 116; + arg0 + { + title = "Boss ID"; + } + arg1 + { + title = "End level on death?"; + type = 11; + enum = "noyes"; + } + arg2 + { + title = "Death trigger tag"; + type = 15; + } + arg3 + { + title = "Victory trigger tag"; + type = 15; + } + arg4 + { + title = "Pinch trigger tag"; + type = 15; + } + } + 203 + { + title = "Egg Colosseum"; + sprite = "EGGPA1"; + width = 24; + height = 76; + arg0 + { + title = "Boss ID"; + } + arg1 + { + title = "End level on death?"; + type = 11; + enum = "noyes"; + } + arg2 + { + title = "Death trigger tag"; + type = 15; + } + arg3 + { + title = "Victory trigger tag"; + type = 15; + } + arg4 + { + title = "Pinch trigger tag"; + type = 15; + } + arg5 + { + title = "Cage drop trigger tag"; + type = 15; + } + } + 204 + { + title = "Fang"; + sprite = "FANGA1"; + width = 24; + height = 60; + arg0 + { + title = "Boss ID"; + } + arg1 + { + title = "End level on death?"; + type = 11; + enum = "noyes"; + } + arg2 + { + title = "Death trigger tag"; + type = 15; + } + arg3 + { + title = "Victory trigger tag"; + type = 15; + } + arg4 + { + title = "Pinch trigger tag"; + type = 15; + } + arg5 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Grayscale"; + 2 = "Skip intro"; + } + } + } + 206 + { + title = "Brak Eggman (Old)"; + sprite = "BRAKB1"; + width = 48; + height = 160; + arg0 + { + title = "Boss ID"; + } + arg1 + { + title = "End level on death?"; + type = 11; + enum = "noyes"; + } + arg2 + { + title = "Death trigger tag"; + type = 15; + } + arg3 + { + title = "Victory trigger tag"; + type = 15; + } + arg4 + { + title = "Pinch trigger tag"; + type = 15; + } + arg5 + { + title = "Platform trigger tag"; + type = 15; + } + } + 207 + { + title = "Metal Sonic (Race)"; + sprite = "METLI1"; + width = 16; + height = 48; + arg0 + { + title = "Grayscale?"; + type = 11; + enum = "noyes"; + } + } + 208 + { + title = "Metal Sonic (Battle)"; + sprite = "METLC1"; + width = 16; + height = 48; + arg0 + { + title = "Boss ID"; + } + arg1 + { + title = "End level on death?"; + type = 11; + enum = "noyes"; + } + arg2 + { + title = "Death trigger tag"; + type = 15; + } + arg3 + { + title = "Victory trigger tag"; + type = 15; + } + arg4 + { + title = "Pinch trigger tag"; + type = 15; + } + arg5 + { + title = "Grayscale?"; + type = 11; + enum = "noyes"; + } + } + 209 + { + title = "Brak Eggman"; + sprite = "BRAK01"; + width = 48; + height = 160; + arg0 + { + title = "Boss ID"; + } + arg1 + { + title = "End level on death?"; + type = 11; + enum = "noyes"; + } + arg2 + { + title = "Death trigger tag"; + type = 15; + } + arg3 + { + title = "Victory trigger tag"; + type = 15; + } + arg4 + { + title = "Pinch trigger tag"; + type = 15; + } + arg5 + { + title = "Attack trigger tag"; + type = 15; + } + arg6 + { + title = "Flags"; + type = 12; + enum + { + 1 = "No origin-fling death"; + 2 = "Electric barrier"; + } + } + } + 290 + { + arrow = 0; + title = "Boss Escape Point"; + width = 8; + height = 16; + sprite = "internal:eggmanend"; + } + 291 + { + arrow = 0; + title = "Egg Capsule Center"; + width = 8; + height = 16; + sprite = "internal:capsule"; + } + 292 + { + arrow = 0; + title = "Boss Waypoint"; + width = 8; + height = 16; + sprite = "internal:eggmanway"; + arg0 + { + title = "Sea Egg sequence"; + } + arg1 + { + title = "Brak Eggman sequence"; + } + } + 293 + { + title = "Metal Sonic Gather Point"; + sprite = "internal:metal"; + width = 8; + height = 16; + } + 294 + { + title = "Fang Waypoint"; + sprite = "internal:eggmanway"; + width = 8; + height = 16; + arg0 + { + title = "Center waypoint?"; + type = 11; + enum = "noyes"; + } + } } - 1903 + + rings { - title = "Orange Stalagmite"; - sprite = "STLGD0"; - width = 16; - height = 40; - } - 1904 - { - title = "Red Stalagmite (Tall)"; - sprite = "STLGE0"; - width = 16; - height = 40; - } - 1905 - { - title = "Red Stalagmite"; - sprite = "STLGF0"; - width = 16; - height = 40; - } - 1906 - { - title = "Gray Stalagmite (Tall)"; - sprite = "STLGG0"; + color = 14; // Yellow + title = "Rings and Weapon Panels"; width = 24; - height = 96; - } - 1907 - { - title = "Gray Stalagmite"; - sprite = "STLGH0"; - width = 16; - height = 40; - } - 1908 - { - title = "Blue Stalagmite (Tall)"; - sprite = "STLGI0"; - width = 16; - height = 40; - } - 1909 - { - title = "Blue Stalagmite"; - sprite = "STLGJ0"; - width = 16; - height = 40; - } -} + height = 24; + sprite = "RINGA0"; + arg0 + { + title = "Float?"; + type = 11; + enum = "yesno"; + } -hauntedheights -{ - color = 10; // Green - title = "Haunted Heights"; + 300 + { + title = "Ring"; + sprite = "RINGA0"; + width = 16; + } + 301 + { + title = "Bounce Ring"; + sprite = "internal:RNGBA0"; + } + 302 + { + title = "Rail Ring"; + sprite = "internal:RNGRA0"; + } + 303 + { + title = "Infinity Ring"; + sprite = "internal:RNGIA0"; + } + 304 + { + title = "Automatic Ring"; + sprite = "internal:RNGAA0"; + } + 305 + { + title = "Explosion Ring"; + sprite = "internal:RNGEA0"; + } + 306 + { + title = "Scatter Ring"; + sprite = "internal:RNGSA0"; + } + 307 + { + title = "Grenade Ring"; + sprite = "internal:RNGGA0"; + } + 308 + { + title = "CTF Team Ring (Red)"; + sprite = "internal:RRNGA0"; + width = 16; + } + 309 + { + title = "CTF Team Ring (Blue)"; + sprite = "internal:BRNGA0"; + width = 16; + } + 330 + { + title = "Bounce Ring Panel"; + sprite = "internal:PIKBA0"; + } + 331 + { + title = "Rail Ring Panel"; + sprite = "internal:PIKRA0"; + } + 332 + { + title = "Automatic Ring Panel"; + sprite = "internal:PIKAA0"; + } + 333 + { + title = "Explosion Ring Panel"; + sprite = "internal:PIKEA0"; + } + 334 + { + title = "Scatter Ring Panel"; + sprite = "internal:PIKSA0"; + } + 335 + { + title = "Grenade Ring Panel"; + sprite = "internal:PIKGA0"; + } + } - 2000 + collectibles { - title = "Smashing Spikeball"; - sprite = "FMCEA0"; + color = 10; // Light_Green + title = "Other Collectibles"; + width = 16; + height = 32; + sort = 1; + sprite = "CEMGA0"; + + 310 + { + title = "CTF Red Flag"; + sprite = "RFLGA0"; + width = 24; + height = 64; + } + 311 + { + title = "CTF Blue Flag"; + sprite = "BFLGA0"; + width = 24; + height = 64; + } + 312 + { + title = "Emerald Token"; + sprite = "TOKEA0"; + width = 16; + height = 32; + arg0 + { + title = "Float?"; + type = 11; + enum = "yesno"; + } + } + 313 + { + title = "Chaos Emerald 1 (Green)"; + sprite = "CEMGA0"; + } + 314 + { + title = "Chaos Emerald 2 (Purple)"; + sprite = "CEMGB0"; + } + 315 + { + title = "Chaos Emerald 3 (Blue)"; + sprite = "CEMGC0"; + } + 316 + { + title = "Chaos Emerald 4 (Cyan)"; + sprite = "CEMGD0"; + } + 317 + { + title = "Chaos Emerald 5 (Orange)"; + sprite = "CEMGE0"; + } + 318 + { + title = "Chaos Emerald 6 (Red)"; + sprite = "CEMGF0"; + } + 319 + { + title = "Chaos Emerald 7 (Gray)"; + sprite = "CEMGG0"; + } + 320 + { + title = "Emerald Hunt Location"; + sprite = "SHRDA0"; + arg0 + { + title = "Float?"; + type = 11; + enum = "yesno"; + } + } + 321 + { + title = "Match Chaos Emerald Spawn"; + sprite = "CEMGA0"; + arg0 + { + title = "Float?"; + type = 11; + enum = "yesno"; + } + } + 322 + { + title = "Emblem"; + sprite = "EMBMA0"; + width = 16; + height = 30; + arg0 + { + title = "Float?"; + type = 11; + enum = "yesno"; + } + } + } + + boxes + { + color = 7; // Gray + blocking = 2; + title = "Monitors"; width = 18; - height = 28; + height = 40; + arg0 + { + title = "Death trigger tag"; + type = 15; + } + + 400 + { + title = "Super Ring (10 Rings)"; + sprite = "TVRIA0"; + arg1 + { + title = "Respawn behavior"; + type = 11; + enum = "monitorrespawn"; + } + } + 401 + { + title = "Pity Shield"; + sprite = "TVPIA0"; + arg1 + { + title = "Respawn behavior"; + type = 11; + enum = "monitorrespawn"; + } + } + 402 + { + title = "Attraction Shield"; + sprite = "TVATA0"; + arg1 + { + title = "Respawn behavior"; + type = 11; + enum = "monitorrespawn"; + } + } + 403 + { + title = "Force Shield"; + sprite = "TVFOA0"; + arg1 + { + title = "Respawn behavior"; + type = 11; + enum = "monitorrespawn"; + } + } + 404 + { + title = "Armageddon Shield"; + sprite = "TVARA0"; + arg1 + { + title = "Respawn behavior"; + type = 11; + enum = "monitorrespawn"; + } + } + 405 + { + title = "Whirlwind Shield"; + sprite = "TVWWA0"; + arg1 + { + title = "Respawn behavior"; + type = 11; + enum = "monitorrespawn"; + } + } + 406 + { + title = "Elemental Shield"; + sprite = "TVELA0"; + arg1 + { + title = "Respawn behavior"; + type = 11; + enum = "monitorrespawn"; + } + } + 407 + { + title = "Super Sneakers"; + sprite = "TVSSA0"; + arg1 + { + title = "Respawn behavior"; + type = 11; + enum = "monitorrespawn"; + } + } + 408 + { + title = "Invincibility"; + sprite = "TVIVA0"; + arg1 + { + title = "Respawn behavior"; + type = 11; + enum = "monitorrespawn"; + } + } + 409 + { + title = "Extra Life"; + sprite = "TV1UA0"; + arg1 + { + title = "Respawn behavior"; + type = 11; + enum = "monitorrespawn"; + } + arg2 + { + title = "Points"; + type = 11; + enum + { + 0 = "1,000"; + 1 = "10,000"; + } + } + } + 410 + { + title = "Eggman"; + sprite = "TVEGA0"; + } + 411 + { + title = "Teleporter"; + sprite = "TVMXA0"; + arg1 + { + title = "Respawn behavior"; + type = 11; + enum = "monitorrespawn"; + } + } + 413 + { + title = "Gravity Boots"; + sprite = "TVGVA0"; + } + 414 + { + title = "CTF Team Ring Monitor (Red)"; + sprite = "TRRIA0"; + } + 415 + { + title = "CTF Team Ring Monitor (Blue)"; + sprite = "TBRIA0"; + } + 416 + { + title = "Recycler"; + sprite = "TVRCA0"; + arg1 + { + title = "Respawn behavior"; + type = 11; + enum = "monitorrespawn"; + } + } + 418 + { + title = "Score (1,000 Points)"; + sprite = "TV1KA0"; + } + 419 + { + title = "Score (10,000 Points)"; + sprite = "TVTKA0"; + } + 420 + { + title = "Flame Shield"; + sprite = "TVFLA0"; + arg1 + { + title = "Respawn behavior"; + type = 11; + enum = "monitorrespawn"; + } + } + 421 + { + title = "Water Shield"; + sprite = "TVBBA0"; + arg1 + { + title = "Respawn behavior"; + type = 11; + enum = "monitorrespawn"; + } + } + 422 + { + title = "Lightning Shield"; + sprite = "TVZPA0"; + arg1 + { + title = "Respawn behavior"; + type = 11; + enum = "monitorrespawn"; + } + } } - 2001 + + boxes2 { - title = "HHZ Grass"; - sprite = "HHZMA0"; + color = 18; // Gold + blocking = 2; + title = "Monitors (Respawning)"; + width = 20; + height = 44; + arg0 + { + title = "Death trigger tag"; + type = 15; + } + + 431 + { + title = "Pity Shield (Respawn)"; + sprite = "TVPIB0"; + } + 432 + { + title = "Attraction Shield (Respawn)"; + sprite = "TVATB0"; + } + 433 + { + title = "Force Shield (Respawn)"; + sprite = "TVFOB0"; + } + 434 + { + title = "Armageddon Shield (Respawn)"; + sprite = "TVARB0"; + } + 435 + { + title = "Whirlwind Shield (Respawn)"; + sprite = "TVWWB0"; + } + 436 + { + title = "Elemental Shield (Respawn)"; + sprite = "TVELB0"; + } + 437 + { + title = "Super Sneakers (Respawn)"; + sprite = "TVSSB0"; + } + 438 + { + title = "Invincibility (Respawn)"; + sprite = "TVIVB0"; + } + 440 + { + title = "Eggman (Respawn)"; + sprite = "TVEGB0"; + } + 443 + { + title = "Gravity Boots (Respawn)"; + sprite = "TVGVB0"; + } + 450 + { + title = "Flame Shield (Respawn)"; + sprite = "TVFLB0"; + } + 451 + { + title = "Water Shield (Respawn)"; + sprite = "TVBBB0"; + } + 452 + { + title = "Lightning Shield (Respawn)"; + sprite = "TVZPB0"; + } + } + + generic + { + color = 11; // Light_Cyan + title = "Generic Items & Hazards"; + + 500 + { + title = "Air Bubble Patch"; + sprite = "BUBLE0"; + width = 8; + height = 16; + arg0 + { + title = "Distance check?"; + type = 11; + enum = "yesno"; + } + } + 501 + { + title = "Signpost"; + sprite = "SIGND0"; + width = 8; + height = 32; + } + 502 + { + arrow = 1; + title = "Star Post"; + sprite = "STPTA0M0"; + width = 64; + height = 128; + arg0 + { + title = "Order"; + } + arg1 + { + title = "Respawn at center?"; + type = 11; + enum = "noyes"; + } + } + 520 + { + title = "Bomb Sphere"; + sprite = "SPHRD0"; + width = 16; + height = 24; + arg0 + { + title = "Float?"; + type = 11; + enum = "yesno"; + } + } + 521 + { + title = "Spikeball"; + sprite = "SPIKA0"; + width = 12; + height = 8; + arg0 + { + title = "Float?"; + type = 11; + enum = "yesno"; + } + } + 522 + { + title = "Wall Spike"; + sprite = "WSPKALAR"; + width = 16; + height = 14; + arrow = 1; + arg0 + { + title = "Retraction interval"; + } + arg1 + { + title = "Start interval"; + } + arg2 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Start retracted"; + 2 = "Intangible"; + } + } + } + 523 + { + title = "Spike"; + sprite = "USPKA0"; + width = 8; + height = 32; + arg0 + { + title = "Retraction interval"; + } + arg1 + { + title = "Start interval"; + } + arg2 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Start retracted"; + 2 = "Intangible"; + } + } + } + 1130 + { + title = "Small Mace"; + sprite = "SMCEA0"; + width = 17; + height = 34; + } + 1131 + { + title = "Big Mace"; + sprite = "BMCEA0"; + width = 34; + height = 68; + } + 1136 + { + title = "Small Fireball"; + sprite = "SFBRA0"; + width = 17; + height = 34; + } + 1137 + { + title = "Large Fireball"; + sprite = "BFBRA0"; + width = 34; + height = 68; + } + } + + springs + { + color = 12; // Light_Red + title = "Springs and Fans"; + width = 20; + height = 16; + sprite = "RSPRD2"; + + 540 + { + title = "Fan"; + sprite = "FANSA0D0"; + width = 16; + height = 8; + arg0 + { + title = "Lift height"; + } + arg1 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Invisible"; + 2 = "No distance check"; + } + } + } + 541 + { + title = "Gas Jet"; + sprite = "STEMD0"; + width = 32; + arg0 + { + title = "Play sound?"; + type = 11; + enum = "yesno"; + } + } + 542 + { + title = "Bumper"; + sprite = "BUMPA0"; + width = 32; + height = 64; + } + 543 + { + title = "Balloon"; + sprite = "BLONA0"; + width = 32; + height = 64; + arg0 + { + title = "Respawn?"; + type = 11; + enum = "noyes"; + } + stringarg0 + { + title = "Color"; + } + } + 550 + { + title = "Yellow Spring"; + sprite = "SPRYA0"; + } + 551 + { + title = "Red Spring"; + sprite = "SPRRA0"; + } + 552 + { + title = "Blue Spring"; + sprite = "SPRBA0"; + } + 555 + { + arrow = 1; + title = "Diagonal Yellow Spring"; + sprite = "YSPRD2"; + width = 16; + arg0 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Ignore gravity"; + 2 = "Rotate 22.5° CCW"; + } + } + } + 556 + { + arrow = 1; + title = "Diagonal Red Spring"; + sprite = "RSPRD2"; + width = 16; + arg0 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Ignore gravity"; + 2 = "Rotate 22.5° CCW"; + } + } + } + 557 + { + arrow = 1; + title = "Diagonal Blue Spring"; + sprite = "BSPRD2"; + width = 16; + arg0 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Ignore gravity"; + 2 = "Rotate 22.5° CCW"; + } + } + } + 558 + { + arrow = 1; + title = "Horizontal Yellow Spring"; + sprite = "SSWYD2D8"; + width = 16; + height = 32; + arg0 + { + title = "Float?"; + type = 11; + enum = "yesno"; + } + } + 559 + { + arrow = 1; + title = "Horizontal Red Spring"; + sprite = "SSWRD2D8"; + width = 16; + height = 32; + arg0 + { + title = "Float?"; + type = 11; + enum = "yesno"; + } + } + 560 + { + arrow = 1; + title = "Horizontal Blue Spring"; + sprite = "SSWBD2D8"; + width = 16; + height = 32; + arg0 + { + title = "Float?"; + type = 11; + enum = "yesno"; + } + } + 1134 + { + title = "Yellow Spring Ball"; + sprite = "YSPBA0"; + width = 17; + height = 34; + } + 1135 + { + title = "Red Spring Ball"; + sprite = "RSPBA0"; + width = 17; + height = 34; + } + 544 + { + arrow = 1; + title = "Yellow Boost Panel"; + sprite = "BSTYA0"; + width = 28; + height = 2; + arg0 + { + title = "Force spin?"; + type = 11; + enum = "noyes"; + } + } + 545 + { + arrow = 1; + title = "Red Boost Panel"; + sprite = "BSTRA0"; + width = 28; + height = 2; + arg0 + { + title = "Force spin?"; + type = 11; + enum = "noyes"; + } + } + } + + patterns + { + color = 5; // Magenta + arrow = 1; + title = "Special Placement Patterns"; + width = 16; + height = 384; + sprite = "RINGA0"; + + 600 + { + arrow = 0; + title = "5 Vertical Rings (Yellow Spring)"; + sprite = "RINGA0"; + } + 601 + { + arrow = 0; + title = "5 Vertical Rings (Red Spring)"; + sprite = "RINGA0"; + height = 1024; + } + 602 + { + title = "5 Diagonal Rings (Yellow Spring)"; + sprite = "RINGA0"; + height = 32; + } + 603 + { + title = "10 Diagonal Rings (Red Spring)"; + sprite = "RINGA0"; + height = 32; + } + 604 + { + title = "Circle of Rings"; + sprite = "RINGA0"; + width = 96; + height = 192; + } + 605 + { + title = "Circle of Rings (Big)"; + sprite = "RINGA0"; + width = 192; + } + 606 + { + title = "Circle of Blue Spheres"; + sprite = "SPHRA0"; + width = 96; + height = 192; + } + 607 + { + title = "Circle of Blue Spheres (Big)"; + sprite = "SPHRA0"; + width = 192; + } + 608 + { + title = "Circle of Rings and Spheres"; + sprite = "SPHRA0"; + width = 96; + height = 192; + } + 609 + { + title = "Circle of Rings and Spheres (Big)"; + sprite = "SPHRA0"; + width = 192; + } + 610 + { + title = "Row of Items"; + sprite = "RINGA0"; + arg0 + { + title = "Number of items"; + } + arg1 + { + title = "Horizontal spacing"; + } + arg2 + { + title = "Vertical spacing"; + } + stringarg0 + { + title = "Object types"; + } + } + 611 + { + title = "Circle of Items"; + sprite = "RINGA0"; + width = 96; + height = 192; + arg0 + { + title = "Number of items"; + } + arg1 + { + title = "Radius"; + } + stringarg0 + { + title = "Object types"; + } + } + } + + invisible + { + color = 15; // White + title = "Misc. Invisible"; + width = 0; + height = 0; + sprite = "UNKNA0"; + sort = 1; + fixedsize = true; + blocking = 0; + + 700 + { + title = "Ambient Sound Effect"; + sprite = "internal:ambiance"; + arg0 + { + title = "Repeat speed"; + } + stringarg0 + { + title = "Sound"; + } + } + + 750 + { + title = "Slope Vertex"; + sprite = "internal:vertexslope"; + arg0 + { + title = "Absolute height?"; + type = 11; + enum = "noyes"; + } + } + + 751 + { + arrow = 1; + title = "Teleport Destination"; + sprite = "internal:tele"; + } + + 752 + { + arrow = 1; + title = "Alternate View Point"; + sprite = "internal:view"; + } + + 753 + { + title = "Zoom Tube Waypoint"; + sprite = "internal:zoom"; + arg0 + { + title = "Sequence"; + } + arg1 + { + title = "Order"; + } + } + + 754 + { + title = "Push/Pull Point"; + sprite = "GWLGA0"; + arg0 + { + title = "Radius"; + } + arg1 + { + title = "Strength"; + } + arg2 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Fade using XY"; + 2 = "Push using XYZ"; + 4 = "Non-exclusive"; + } + } + } + 756 + { + title = "Blast Linedef Executor"; + sprite = "TOADA0"; + width = 32; + height = 16; + arg0 + { + title = "Linedef tag"; + type = 15; + } + } + 757 + { + title = "Fan Particle Generator"; + sprite = "PRTLA0"; + width = 8; + height = 16; + arg0 + { + title = "Particles"; + } + arg1 + { + title = "Radius"; + } + arg2 + { + title = "Rising speed"; + } + arg3 + { + title = "Rotation speed"; + type = 8; + } + arg4 + { + title = "Spawn interval"; + } + arg5 + { + title = "Rising distance"; + } + arg6 + { + title = "Heights control linedef"; + type = 15; + } + } + 758 + { + title = "Object Angle Anchor"; + sprite = "internal:view"; + } + 760 + { + title = "PolyObject Anchor"; + sprite = "internal:polyanchor"; + } + 761 + { + title = "PolyObject Spawn Point"; + sprite = "internal:polycenter"; + } + 762 + { + title = "PolyObject Spawn Point (Crush)"; + sprite = "internal:polycentercrush"; + } + 780 + { + title = "Skybox View Point"; + sprite = "internal:skyb"; + arg0 + { + title = "Type"; + type = 11; + enum + { + 0 = "Viewpoint"; + 1 = "Centerpoint"; + } + } + } + } + + greenflower + { + color = 10; // Green + title = "Greenflower"; + + 800 + { + title = "GFZ Flower"; + sprite = "FWR1A0"; + width = 16; + height = 40; + } + 801 + { + title = "Sunflower"; + sprite = "FWR2A0"; + width = 16; + height = 96; + } + 802 + { + title = "Budding Flower"; + sprite = "FWR3A0"; + width = 8; + height = 32; + } + 803 + { + title = "Blueberry Bush"; + sprite = "BUS3A0"; + width = 16; + height = 32; + } + 804 + { + title = "Berry Bush"; + sprite = "BUS1A0"; + width = 16; + height = 32; + } + 805 + { + title = "Bush"; + sprite = "BUS2A0"; + width = 16; + height = 32; + } + 806 + { + title = "GFZ Tree"; + sprite = "TRE1A0"; + width = 20; + height = 128; + } + 807 + { + title = "GFZ Berry Tree"; + sprite = "TRE1B0"; + width = 20; + height = 128; + } + 808 + { + title = "GFZ Cherry Tree"; + sprite = "TRE1C0"; + width = 20; + height = 128; + } + 809 + { + title = "Checkered Tree"; + sprite = "TRE2A0"; + width = 20; + height = 200; + } + 810 + { + title = "Checkered Tree (Sunset)"; + sprite = "TRE2B0"; + width = 20; + height = 200; + } + 811 + { + title = "Polygon Tree"; + sprite = "TRE4A0"; + width = 20; + height = 200; + } + 812 + { + title = "Bush Tree"; + sprite = "TRE5A0"; + width = 20; + height = 200; + } + 813 + { + title = "Red Bush Tree"; + sprite = "TRE5B0"; + width = 20; + height = 200; + } + } + + technohill + { + color = 10; // Green + title = "Techno Hill"; + + 900 + { + title = "THZ Steam Flower"; + sprite = "THZPA0"; + width = 8; + height = 32; + } + 901 + { + title = "Alarm"; + sprite = "ALRMA0"; + width = 8; + height = 16; + hangs = 1; + } + 902 + { + title = "THZ Spin Flower (Red)"; + sprite = "FWR5A0"; + width = 16; + height = 64; + } + 903 + { + title = "THZ Spin Flower (Yellow)"; + sprite = "FWR6A0"; + width = 16; + height = 64; + } + 904 + { + arrow = 1; + title = "Whistlebush"; + sprite = "THZTA0"; + width = 16; + height = 64; + } + } + + deepsea + { + color = 10; // Green + title = "Deep Sea"; + + 1000 + { + arrow = 1; + blocking = 2; + title = "Gargoyle"; + sprite = "GARGA1"; + width = 16; + height = 40; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } + } + 1009 + { + arrow = 1; + blocking = 2; + title = "Gargoyle (Big)"; + sprite = "GARGB1"; + width = 32; + height = 80; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } + } + 1001 + { + title = "Seaweed"; + sprite = "SEWEA0"; + width = 24; + height = 56; + } + 1002 + { + title = "Dripping Water"; + sprite = "DRIPD0"; + width = 8; + height = 16; + hangs = 1; + arg0 + { + title = "Dripping delay"; + } + } + 1003 + { + title = "Coral (Green)"; + sprite = "CORLA0"; + width = 29; + height = 40; + } + 1004 + { + title = "Coral (Red)"; + sprite = "CORLB0"; + width = 30; + height = 53; + } + 1005 + { + title = "Coral (Orange)"; + sprite = "CORLC0"; + width = 28; + height = 41; + } + 1006 + { + title = "Blue Crystal"; + sprite = "BCRYA1"; + width = 8; + height = 16; + } + 1007 + { + title = "Kelp"; + sprite = "KELPA0"; + width = 16; + height = 292; + arg0 + { + title = "Double size?"; + type = 11; + enum = "noyes"; + } + } + 1008 + { + title = "Stalagmite (DSZ1)"; + sprite = "DSTGA0"; + width = 8; + height = 116; + arg0 + { + title = "Double size?"; + type = 11; + enum = "noyes"; + } + } + 1010 + { + arrow = 1; + title = "Light Beam"; + sprite = "LIBEARAL"; + width = 16; + height = 16; + } + 1011 + { + title = "Stalagmite (DSZ2)"; + sprite = "DSTGA0"; + width = 8; + height = 116; + arg0 + { + title = "Double size?"; + type = 11; + enum = "noyes"; + } + } + 1012 + { + arrow = 1; + title = "Big Floating Mine"; + width = 28; + height = 56; + sprite = "BMNEA1"; + } + 1013 + { + title = "Animated Kelp"; + sprite = "ALGAA0"; + width = 48; + height = 120; + } + 1014 + { + title = "Large Coral (Brown)"; + sprite = "CORLD0"; + width = 56; + height = 112; + } + 1015 + { + title = "Large Coral (Beige)"; + sprite = "CORLE0"; + width = 56; + height = 112; + } + } + + castleeggman + { + color = 10; // Green + title = "Castle Eggman"; + + 1100 + { + title = "Chain (Decorative)"; + sprite = "CHANA0"; + width = 4; + height = 128; + hangs = 1; + } + 1101 + { + title = "Torch"; + sprite = "FLAMA0E0"; + width = 8; + height = 32; + arg0 + { + title = "Corona?"; + type = 11; + enum = "noyes"; + } + } + 1102 + { + arrow = 1; + blocking = 2; + title = "Eggman Statue"; + sprite = "ESTAA1"; + width = 32; + height = 240; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } + arg1 + { + title = "Solid gold?"; + type = 11; + enum = "noyes"; + } + } + 1103 + { + title = "CEZ Flower"; + sprite = "FWR4A0"; + width = 16; + height = 40; + } + 1104 + { + title = "Mace Spawnpoint"; + sprite = "SMCEA0"; + width = 17; + height = 34; + arg0 + { + title = "Number of links"; + } + arg1 + { + title = "Number of spokes"; + } + arg2 + { + title = "Width"; + } + arg3 + { + title = "Speed"; + } + arg4 + { + title = "Phase"; + type = 8; + } + arg5 + { + title = "Pinch"; + type = 8; + } + arg6 + { + title = "Omitted spokes"; + } + arg7 + { + title = "Omitted links"; + } + arg8 + { + title = "Flags"; + type = 12; + enum = "maceflags"; + } + } + 1105 + { + title = "Chain with Maces Spawnpoint"; + sprite = "SMCEA0"; + width = 17; + height = 34; + arg0 + { + title = "Number of links"; + } + arg1 + { + title = "Number of spokes"; + } + arg2 + { + title = "Width"; + } + arg3 + { + title = "Speed"; + } + arg4 + { + title = "Phase"; + type = 8; + } + arg5 + { + title = "Pinch"; + type = 8; + } + arg6 + { + title = "Omitted spokes"; + } + arg7 + { + title = "Omitted links"; + } + arg8 + { + title = "Flags"; + type = 12; + enum = "maceflags"; + } + } + 1106 + { + title = "Chained Spring Spawnpoint"; + sprite = "YSPBA0"; + width = 17; + height = 34; + arg0 + { + title = "Number of links"; + } + arg1 + { + title = "Number of spokes"; + } + arg2 + { + title = "Width"; + } + arg3 + { + title = "Speed"; + } + arg4 + { + title = "Phase"; + type = 8; + } + arg5 + { + title = "Pinch"; + type = 8; + } + arg6 + { + title = "Omitted spokes"; + } + arg7 + { + title = "Omitted links"; + } + arg8 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Red spring"; + 2 = "No sounds"; + 4 = "Player-turnable chain"; + 8 = "Swing instead of spin"; + 16 = "Make chain from end item"; + 32 = "Spawn link at origin"; + 64 = "Clip inside ground"; + 128 = "No distance check"; + } + } + } + 1107 + { + title = "Chain Spawnpoint"; + sprite = "BMCHA0"; + width = 17; + height = 34; + arg0 + { + title = "Number of links"; + } + arg1 + { + title = "Number of spokes"; + } + arg2 + { + title = "Width"; + } + arg3 + { + title = "Speed"; + } + arg4 + { + title = "Phase"; + type = 8; + } + arg5 + { + title = "Pinch"; + type = 8; + } + arg6 + { + title = "Omitted spokes"; + } + arg7 + { + title = "Omitted links"; + } + arg8 + { + title = "Flags"; + type = 12; + enum = "maceflags"; + + } + } + 1108 + { + arrow = 1; + title = "Hidden Chain Spawnpoint"; + sprite = "internal:chain3"; + width = 17; + height = 34; + } + 1109 + { + title = "Firebar Spawnpoint"; + sprite = "BFBRA0"; + width = 17; + height = 34; + arg0 + { + title = "Number of links"; + } + arg1 + { + title = "Number of spokes"; + } + arg2 + { + title = "Width"; + } + arg3 + { + title = "Speed"; + } + arg4 + { + title = "Phase"; + type = 8; + } + arg5 + { + title = "Pinch"; + type = 8; + } + arg6 + { + title = "Omitted spokes"; + } + arg7 + { + title = "Omitted links"; + } + arg8 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Double size"; + 2 = "No sounds"; + 4 = "Player-turnable chain"; + 8 = "Swing instead of spin"; + 16 = "Omit chain links"; + 32 = "Spawn link at origin"; + 64 = "Clip inside ground"; + 128 = "No distance check"; + } + } + } + 1110 + { + title = "Custom Mace Spawnpoint"; + sprite = "SMCEA0"; + width = 17; + height = 34; + arg0 + { + title = "Number of links"; + } + arg1 + { + title = "Number of spokes"; + } + arg2 + { + title = "Width"; + } + arg3 + { + title = "Speed"; + } + arg4 + { + title = "Phase"; + type = 8; + } + arg5 + { + title = "Pinch"; + type = 8; + } + arg6 + { + title = "Omitted spokes"; + } + arg7 + { + title = "Omitted links"; + } + arg8 + { + title = "Flags"; + type = 12; + enum = "maceflags"; + } + stringarg0 + { + title = "Mace object type"; + type = 2; + } + stringarg1 + { + title = "Link object type"; + type = 2; + } + } + 1111 + { + arrow = 1; + blocking = 2; + title = "Crawla Statue"; + sprite = "CSTAA1"; + width = 16; + height = 40; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } + } + 1112 + { + arrow = 1; + blocking = 2; + title = "Lance-a-Bot Statue"; + sprite = "CBBSA1"; + width = 32; + height = 72; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } + } + 1114 + { + title = "Pine Tree"; + sprite = "PINEA0"; + width = 16; + height = 628; + } + 1115 + { + title = "CEZ Shrub (Small)"; + sprite = "CEZBA0"; + width = 16; + height = 24; + } + 1116 + { + title = "CEZ Shrub (Large)"; + sprite = "CEZBB0"; + width = 32; + height = 48; + } + 1117 + { + arrow = 1; + title = "Pole Banner (Red)"; + sprite = "BANRA0"; + width = 40; + height = 224; + } + 1118 + { + arrow = 1; + title = "Pole Banner (Blue)"; + sprite = "BANRA0"; + width = 40; + height = 224; + } + 1119 + { + title = "Candle"; + sprite = "CNDLA0"; + width = 8; + height = 48; + arg0 + { + title = "Corona?"; + type = 11; + enum = "noyes"; + } + } + 1120 + { + title = "Candle Pricket"; + sprite = "CNDLB0"; + width = 8; + height = 176; + arg0 + { + title = "Corona?"; + type = 11; + enum = "noyes"; + } + } + 1121 + { + title = "Flame Holder"; + sprite = "FLMHA0"; + width = 24; + height = 80; + arg0 + { + title = "Flags"; + type = 12; + enum + { + 1 = "No flame"; + 2 = "Add corona"; + } + } + } + 1122 + { + title = "Fire Torch"; + sprite = "CTRCA0"; + width = 16; + height = 80; + } + 1123 + { + title = "Cannonball Launcher"; + sprite = "internal:cannonball"; + width = 8; + height = 16; + } + 1124 + { + blocking = 2; + title = "Cannonball"; + sprite = "CBLLA0"; + width = 20; + height = 40; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } + } + 1125 + { + title = "Brambles"; + sprite = "CABRALAR"; + width = 48; + height = 32; + } + 1126 + { + title = "Invisible Lockon Object"; + sprite = "LCKNC0"; + width = 16; + height = 32; + } + 1127 + { + title = "Spectator Eggrobo"; + sprite = "EGR1A1"; + width = 20; + height = 72; + arg0 + { + title = "Movement"; + type = 11; + enum + { + 0 = "None"; + 1 = "Right"; + 2 = "Left"; + } + } + } + 1128 + { + arrow = 1; + title = "Waving Flag (Red)"; + sprite = "CFLGA0"; + width = 8; + height = 208; + } + 1129 + { + arrow = 1; + title = "Waving Flag (Blue)"; + sprite = "CFLGA0"; + width = 8; + height = 208; + } + } + + aridcanyon + { + color = 10; // Green + title = "Arid Canyon"; + + 1200 + { + title = "Tumbleweed (Big)"; + sprite = "BTBLA0"; + width = 24; + height = 48; + arg0 + { + title = "Move perpetually?"; + type = 11; + enum = "noyes"; + } + } + 1201 + { + title = "Tumbleweed (Small)"; + sprite = "STBLA0"; + width = 12; + height = 24; + arg0 + { + title = "Move perpetually?"; + type = 11; + enum = "noyes"; + } + } + 1202 + { + arrow = 1; + title = "Rock Spawner"; + sprite = "ROIAA0"; + width = 8; + height = 16; + arg0 + { + title = "Speed"; + } + arg1 + { + title = "Spawn interval"; + } + arg2 + { + title = "Randomize speed?"; + type = 11; + enum = "noyes"; + } + stringarg0 + { + title = "Object type"; + type = 2; + } + } + 1203 + { + title = "Tiny Red Flower Cactus"; + sprite = "CACTA0"; + width = 13; + height = 24; + } + 1204 + { + title = "Small Red Flower Cactus"; + sprite = "CACTB0"; + width = 15; + height = 52; + } + 1205 + { + title = "Tiny Blue Flower Cactus"; + sprite = "CACTC0"; + width = 13; + height = 24; + } + 1206 + { + title = "Small Blue Flower Cactus"; + sprite = "CACTD0"; + width = 15; + height = 52; + } + 1207 + { + title = "Prickly Pear"; + sprite = "CACTE0"; + width = 32; + height = 96; + } + 1208 + { + title = "Barrel Cactus"; + sprite = "CACTF0"; + width = 20; + height = 128; + } + 1209 + { + title = "Tall Barrel Cactus"; + sprite = "CACTG0"; + width = 24; + height = 224; + } + 1210 + { + title = "Armed Cactus"; + sprite = "CACTH0"; + width = 24; + height = 256; + } + 1211 + { + title = "Ball Cactus"; + sprite = "CACTI0"; + width = 48; + height = 96; + } + 1212 + { + title = "Caution Sign"; + sprite = "WWSGAR"; + width = 22; + height = 64; + } + 1213 + { + title = "Cacti Sign"; + sprite = "WWS2AR"; + width = 22; + height = 64; + } + 1214 + { + title = "Sharp Turn Sign"; + sprite = "WWS3ALAR"; + width = 16; + height = 192; + } + 1215 + { + title = "Mine Oil Lamp"; + sprite = "OILLA0"; + width = 22; + height = 64; + hangs = 1; + } + 1216 + { + title = "TNT Barrel"; + sprite = "BARRA1"; + width = 24; + height = 63; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } + } + 1217 + { + title = "TNT Proximity Shell"; + sprite = "REMTA0"; + width = 64; + height = 40; + } + 1218 + { + title = "Dust Devil"; + sprite = "TAZDCR"; + width = 80; + height = 416; + } + 1219 + { + title = "Minecart Spawner"; + sprite = "MCRTCLFR"; + width = 22; + height = 32; + } + 1220 + { + title = "Minecart Stopper"; + sprite = "MCRTIR"; + width = 32; + height = 32; + } + 1221 + { + title = "Minecart Saloon Door"; + sprite = "SALDARAL"; + width = 96; + height = 160; + arg0 + { + title = "Allow non-minecart players?"; + type = 11; + enum = "noyes"; + } + } + 1222 + { + title = "Train Cameo Spawner"; + sprite = "TRAEBRBL"; + width = 28; + height = 32; + } + 1223 + { + title = "Train Dust Spawner"; + sprite = "ADSTA0"; + width = 4; + height = 4; + } + 1224 + { + title = "Train Steam Spawner"; + sprite = "STEAA0"; + width = 4; + height = 4; + } + 1229 + { + title = "Minecart Switch Point"; + sprite = "internal:zoom"; + width = 8; + height = 16; + arg0 + { + title = "Type"; + type = 11; + enum + { + 0 = "Disable"; + 1 = "Enable"; + } + } + } + 1230 + { + title = "Tiny Cactus"; + sprite = "CACTJ0"; + width = 13; + height = 28; + } + 1231 + { + title = "Small Cactus"; + sprite = "CACTK0"; + width = 15; + height = 60; + } + } + + redvolcano + { + color = 10; // Green + title = "Red Volcano"; + + 1300 + { + arrow = 1; + title = "Flame Jet (Horizontal)"; + sprite = "internal:flameh"; + width = 16; + height = 40; + arg0 + { + title = "On time"; + } + arg1 + { + title = "Off time"; + } + arg2 + { + title = "Strength"; + } + arg3 + { + title = "Waving direction"; + type = 11; + enum + { + 0 = "Horizontal"; + 1 = "Vertical"; + } + } + } + 1301 + { + title = "Flame Jet (Vertical)"; + sprite = "internal:flamev"; + width = 16; + height = 40; + arg0 + { + title = "On time"; + } + arg1 + { + title = "Off time"; + } + arg2 + { + title = "Strength"; + } + arg3 + { + title = "Shooting direction"; + type = 11; + enum + { + 0 = "Upwards"; + 1 = "Downwards"; + } + } + } + 1302 + { + title = "Spinning Flame Jet (Counter-Clockwise)"; + sprite = "internal:flame2"; + width = 16; + height = 24; + } + 1303 + { + title = "Spinning Flame Jet (Clockwise)"; + sprite = "internal:flame1"; + width = 16; + height = 24; + } + 1304 + { + title = "Lavafall"; + sprite = "LFALF0"; + width = 30; + height = 32; + arg0 + { + title = "Initial delay"; + } + arg1 + { + title = "Double size?"; + type = 11; + enum = "noyes"; + } + } + 1305 + { + title = "Rollout Rock"; + sprite = "PUMIA1A5"; + width = 30; + height = 60; + arg0 + { + title = "Buoyant?"; + type = 11; + enum = "yesno"; + } + } + 1306 + { + title = "Big Fern"; + sprite = "JPLAB0"; + width = 32; + height = 48; + } + 1307 + { + title = "Jungle Palm"; + sprite = "JPLAC0"; + width = 32; + height = 48; + } + 1308 + { + title = "Torch Flower"; + sprite = "TFLOA0"; + width = 14; + height = 110; + } + 1309 + { + title = "RVZ1 Wall Vine (Long)"; + sprite = "WVINALAR"; + width = 1; + height = 288; + } + 1310 + { + title = "RVZ1 Wall Vine (Short)"; + sprite = "WVINBLBR"; + width = 1; + height = 288; + } + } + + botanicserenity + { + color = 10; // Green + title = "Botanic Serenity"; + width = 16; + height = 32; + sprite = "BSZ1A0"; + 1400 + { + title = "Tall Flower (Red)"; + sprite = "BSZ1A0"; + } + 1401 + { + title = "Tall Flower (Purple)"; + sprite = "BSZ1B0"; + } + 1402 + { + title = "Tall Flower (Blue)"; + sprite = "BSZ1C0"; + } + 1403 + { + title = "Tall Flower (Cyan)"; + sprite = "BSZ1D0"; + } + 1404 + { + title = "Tall Flower (Yellow)"; + sprite = "BSZ1E0"; + } + 1405 + { + title = "Tall Flower (Orange)"; + sprite = "BSZ1F0"; + } + 1410 + { + title = "Medium Flower (Red)"; + sprite = "BSZ2A0"; + } + 1411 + { + title = "Medium Flower (Purple)"; + sprite = "BSZ2B0"; + } + 1412 + { + title = "Medium Flower (Blue)"; + sprite = "BSZ2C0"; + } + 1413 + { + title = "Medium Flower (Cyan)"; + sprite = "BSZ2D0"; + } + 1414 + { + title = "Medium Flower (Yellow)"; + sprite = "BSZ2E0"; + } + 1415 + { + title = "Medium Flower (Orange)"; + sprite = "BSZ2F0"; + } + 1420 + { + title = "Short Flower (Red)"; + sprite = "BSZ3A0"; + } + 1421 + { + title = "Short Flower (Purple)"; + sprite = "BSZ3B0"; + } + 1422 + { + title = "Short Flower (Blue)"; + sprite = "BSZ3C0"; + } + 1423 + { + title = "Short Flower (Cyan)"; + sprite = "BSZ3D0"; + } + 1424 + { + title = "Short Flower (Yellow)"; + sprite = "BSZ3E0"; + } + 1425 + { + title = "Short Flower (Orange)"; + sprite = "BSZ3F0"; + } + 1430 + { + title = "Tulip (Red)"; + sprite = "BST1A0"; + } + 1431 + { + title = "Tulip (Purple)"; + sprite = "BST2A0"; + } + 1432 + { + title = "Tulip (Blue)"; + sprite = "BST3A0"; + } + 1433 + { + title = "Tulip (Cyan)"; + sprite = "BST4A0"; + } + 1434 + { + title = "Tulip (Yellow)"; + sprite = "BST5A0"; + } + 1435 + { + title = "Tulip (Orange)"; + sprite = "BST6A0"; + } + 1440 + { + title = "Cluster (Red)"; + sprite = "BSZ5A0"; + } + 1441 + { + title = "Cluster (Purple)"; + sprite = "BSZ5B0"; + } + 1442 + { + title = "Cluster (Blue)"; + sprite = "BSZ5C0"; + } + 1443 + { + title = "Cluster (Cyan)"; + sprite = "BSZ5D0"; + } + 1444 + { + title = "Cluster (Yellow)"; + sprite = "BSZ5E0"; + } + 1445 + { + title = "Cluster (Orange)"; + sprite = "BSZ5F0"; + } + 1450 + { + title = "Bush (Red)"; + sprite = "BSZ6A0"; + } + 1451 + { + title = "Bush (Purple)"; + sprite = "BSZ6B0"; + } + 1452 + { + title = "Bush (Blue)"; + sprite = "BSZ6C0"; + } + 1453 + { + title = "Bush (Cyan)"; + sprite = "BSZ6D0"; + } + 1454 + { + title = "Bush (Yellow)"; + sprite = "BSZ6E0"; + } + 1455 + { + title = "Bush (Orange)"; + sprite = "BSZ6F0"; + } + 1460 + { + title = "Vine (Red)"; + sprite = "BSZ7A0"; + } + 1461 + { + title = "Vine (Purple)"; + sprite = "BSZ7B0"; + } + 1462 + { + title = "Vine (Blue)"; + sprite = "BSZ7C0"; + } + 1463 + { + title = "Vine (Cyan)"; + sprite = "BSZ7D0"; + } + 1464 + { + title = "Vine (Yellow)"; + sprite = "BSZ7E0"; + } + 1465 + { + title = "Vine (Orange)"; + sprite = "BSZ7F0"; + } + 1470 + { + title = "BSZ Shrub"; + sprite = "BSZ8A0"; + } + 1471 + { + title = "BSZ Clover"; + sprite = "BSZ8B0"; + } + 1473 + { + title = "Palm Tree (Big)"; + width = 16; + height = 160; + sprite = "BSZ8D0"; + } + 1475 + { + title = "Palm Tree (Small)"; + width = 16; + height = 80; + sprite = "BSZ8F0"; + } + } + + azuretemple + { + color = 10; // Green + title = "Azure Temple"; + + 1500 + { + arrow = 1; + blocking = 2; + title = "Glaregoyle"; + sprite = "BGARA1"; + width = 16; + height = 40; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } + arg1 + { + title = "Starting delay"; + } + } + 1501 + { + arrow = 1; + blocking = 2; + title = "Glaregoyle (Up)"; + sprite = "BGARA1"; + width = 16; + height = 40; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } + arg1 + { + title = "Starting delay"; + } + } + 1502 + { + arrow = 1; + blocking = 2; + title = "Glaregoyle (Down)"; + sprite = "BGARA1"; + width = 16; + height = 40; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } + arg1 + { + title = "Starting delay"; + } + } + 1503 + { + arrow = 1; + blocking = 2; + title = "Glaregoyle (Long)"; + sprite = "BGARA1"; + width = 16; + height = 40; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } + arg1 + { + title = "Starting delay"; + } + } + 1504 + { + title = "ATZ Target"; + sprite = "RCRYB0"; + width = 24; + height = 32; + } + 1505 + { + title = "Green Flame"; + sprite = "CFLMA0E0"; + width = 8; + height = 32; + } + 1506 + { + arrow = 1; + blocking = 2; + title = "Blue Gargoyle"; + sprite = "BGARD1"; + width = 16; + height = 40; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } + } + } + + dreamhill + { + color = 10; // Green + title = "Dream Hill"; + + 1600 + { + title = "Spring Tree"; + sprite = "TRE6A0"; + width = 16; + height = 32; + } + 1601 + { + title = "Shleep"; + sprite = "SHLPA0"; + width = 24; + height = 32; + } + 1602 + { + title = "Nightopian"; + sprite = "NTPNA1"; + width = 16; + height = 40; + arg0 + { + title = "Can move?"; + type = 11; + enum = "yesno"; + } + } + } + + nightstrk + { + color = 13; // Pink + title = "NiGHTS Track"; + width = 8; + height = 4096; + sprite = "UNKNA0"; + + 1700 + { + title = "Axis"; + sprite = "internal:axis1"; + circle = 1; + arg0 + { + title = "Mare"; + } + arg1 + { + title = "Order"; + } + arg2 + { + title = "Radius"; + } + arg3 + { + title = "Direction"; + type = 11; + enum + { + 0 = "Clockwise"; + 1 = "Counterclockwise"; + } + } + } + 1701 + { + title = "Axis Transfer"; + sprite = "internal:axis2"; + arg0 + { + title = "Mare"; + } + arg1 + { + title = "Order"; + } + } + 1702 + { + title = "Axis Transfer Line"; + sprite = "internal:axis3"; + arg0 + { + title = "Mare"; + } + arg1 + { + title = "Order"; + } + } + 1710 + { + title = "Ideya Capture"; + sprite = "CAPSA0"; + width = 72; + height = 144; + arg0 + { + title = "Mare"; + } + arg1 + { + title = "Required spheres"; + } + } + } + + nights + { + color = 13; // Pink + title = "NiGHTS Items"; + width = 16; + height = 32; + + 1703 + { + title = "Ideya Drone"; + sprite = "NDRNA1"; + width = 16; + height = 56; + arg0 + { + title = "Time limit"; + } + arg1 + { + title = "Height"; + } + arg2 + { + title = "Radius"; + } + arg3 + { + title = "Alignment"; + type = 11; + enum + { + 0 = "Bottom with offset"; + 1 = "Bottom"; + 2 = "Middle"; + 3 = "Top"; + } + } + arg4 + { + title = "Die upon time up?"; + type = 11; + enum = "noyes"; + } + } + 1704 + { + arrow = 1; + title = "NiGHTS Bumper"; + sprite = "NBMPG3G7"; + width = 32; + height = 64; + } + 1706 + { + title = "Blue Sphere"; + sprite = "SPHRA0"; + width = 16; + height = 24; + arg0 + { + title = "Float?"; + type = 11; + enum = "yesno"; + } + } + 1707 + { + title = "Super Paraloop"; + sprite = "NPRUA0"; + arg0 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Bonus time only"; + 2 = "Spawn immediately"; + } + } + } + 1708 + { + title = "Drill Refill"; + sprite = "NPRUB0"; + arg0 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Bonus time only"; + 2 = "Spawn immediately"; + } + } + } + 1709 + { + title = "Nightopian Helper"; + sprite = "NPRUC0"; + arg0 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Bonus time only"; + 2 = "Spawn immediately"; + } + } + } + 1711 + { + title = "Extra Time"; + sprite = "NPRUD0"; + arg0 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Bonus time only"; + 2 = "Spawn immediately"; + } + } + } + 1712 + { + title = "Link Freeze"; + sprite = "NPRUE0"; + arg0 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Bonus time only"; + 2 = "Spawn immediately"; + } + } + } + 1713 + { + arrow = 1; + title = "Hoop"; + sprite = "HOOPA0"; + width = 80; + height = 160; + arg0 + { + title = "Radius"; + } + } + 1714 + { + title = "Ideya Anchor Point"; + sprite = "internal:axis1"; + width = 8; + height = 16; + arg0 + { + title = "Mare"; + } + } + } + + mario + { + color = 6; // Brown + title = "Mario"; + + 1800 + { + title = "Coin"; + sprite = "COINA0"; + width = 16; + height = 24; + arg0 + { + title = "Float?"; + type = 11; + enum = "yesno"; + } + } + 1801 + { + arrow = 1; + title = "Goomba"; + sprite = "GOOMA0"; + width = 24; + height = 32; + } + 1802 + { + arrow = 1; + title = "Goomba (Blue)"; + sprite = "BGOMA0"; + width = 24; + height = 32; + } + 1803 + { + title = "Fire Flower"; + sprite = "FFWRB0"; + width = 16; + height = 32; + } + 1804 + { + title = "Koopa Shell"; + sprite = "SHLLA1"; + width = 16; + height = 20; + } + 1805 + { + title = "Puma (Jumping Fireball)"; + sprite = "PUMAA0"; + width = 8; + height = 16; + arg0 + { + title = "Jump strength"; + } + } + 1806 + { + title = "King Bowser"; + sprite = "KOOPA0"; + width = 16; + height = 48; + arg0 + { + title = "Death trigger tag"; + type = 15; + } + } + 1807 + { + title = "Axe"; + sprite = "MAXEA0"; + width = 8; + height = 16; + arg0 + { + title = "Death trigger tag"; + type = 15; + } + } + 1808 + { + title = "Bush (Short)"; + sprite = "MUS1A0"; + width = 16; + height = 32; + } + 1809 + { + title = "Bush (Tall)"; + sprite = "MUS2A0"; + width = 16; + height = 32; + } + 1810 + { + title = "Toad"; + sprite = "TOADA0"; + width = 8; + height = 32; + } + } + + christmasdisco + { + color = 10; // Green + title = "Christmas & Disco"; + + 1850 + { + title = "Christmas Pole"; + sprite = "XMS1A0"; + width = 16; + height = 40; + } + 1851 + { + title = "Candy Cane"; + sprite = "XMS2A0"; + width = 8; + height = 32; + } + 1852 + { + blocking = 2; + title = "Snowman"; + sprite = "XMS3A0"; + width = 16; + height = 64; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } + } + 1853 + { + blocking = 2; + title = "Snowman (With Hat)"; + sprite = "XMS3B0"; + width = 16; + height = 80; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } + } + 1854 + { + title = "Lamp Post"; + sprite = "XMS4A0"; + width = 8; + height = 120; + } + 1855 + { + title = "Lamp Post (Snow)"; + sprite = "XMS4B0"; + width = 8; + height = 120; + } + 1856 + { + title = "Hanging Star"; + sprite = "XMS5A0"; + width = 4; + height = 80; + hangs = 1; + } + 1857 + { + title = "Berry Bush (Snow)"; + sprite = "BUS1B0"; + width = 16; + height = 32; + } + 1858 + { + title = "Bush (Snow)"; + sprite = "BUS2B0"; + width = 16; + height = 32; + } + 1859 + { + title = "Blueberry Bush (Snow)"; + sprite = "BUS3B0"; + width = 16; + height = 32; + } + 1875 + { + title = "Disco Ball"; + sprite = "DBALA0"; + width = 16; + height = 54; + hangs = 1; + } + 1876 + { + arrow = 1; + blocking = 2; + title = "Eggman Disco Statue"; + sprite = "ESTAB1"; + width = 20; + height = 96; + arg0 + { + title = "Push behavior"; + type = 11; + enum = "pushablebehavior"; + } + } + } + + stalagmites + { + color = 10; // Green + title = "Stalagmites"; width = 16; height = 40; + + 1900 + { + title = "Brown Stalagmite (Tall)"; + sprite = "STLGA0"; + width = 16; + height = 40; + } + 1901 + { + title = "Brown Stalagmite"; + sprite = "STLGB0"; + width = 16; + height = 40; + } + 1902 + { + title = "Orange Stalagmite (Tall)"; + sprite = "STLGC0"; + width = 16; + height = 40; + } + 1903 + { + title = "Orange Stalagmite"; + sprite = "STLGD0"; + width = 16; + height = 40; + } + 1904 + { + title = "Red Stalagmite (Tall)"; + sprite = "STLGE0"; + width = 16; + height = 40; + } + 1905 + { + title = "Red Stalagmite"; + sprite = "STLGF0"; + width = 16; + height = 40; + } + 1906 + { + title = "Gray Stalagmite (Tall)"; + sprite = "STLGG0"; + width = 24; + height = 96; + } + 1907 + { + title = "Gray Stalagmite"; + sprite = "STLGH0"; + width = 16; + height = 40; + } + 1908 + { + title = "Blue Stalagmite (Tall)"; + sprite = "STLGI0"; + width = 16; + height = 40; + } + 1909 + { + title = "Blue Stalagmite"; + sprite = "STLGJ0"; + width = 16; + height = 40; + } } - 2002 + + hauntedheights { - title = "HHZ Tentacle 1"; - sprite = "HHZMB0"; - width = 16; - height = 40; + color = 10; // Green + title = "Haunted Heights"; + + 2000 + { + title = "Smashing Spikeball"; + sprite = "FMCEA0"; + width = 18; + height = 28; + arg0 + { + title = "Initial delay"; + } + } + 2001 + { + title = "HHZ Grass"; + sprite = "HHZMA0"; + width = 16; + height = 40; + } + 2002 + { + title = "HHZ Tentacle 1"; + sprite = "HHZMB0"; + width = 16; + height = 40; + } + 2003 + { + title = "HHZ Tentacle 2"; + sprite = "HHZMC0"; + width = 16; + height = 40; + } + 2004 + { + title = "HHZ Stalagmite (Tall)"; + sprite = "HHZME0"; + width = 16; + height = 40; + } + 2005 + { + title = "HHZ Stalagmite (Short)"; + sprite = "HHZMF0"; + width = 16; + height = 40; + } + 2006 + { + title = "Jack-o'-lantern 1"; + sprite = "PUMKA0"; + width = 16; + height = 40; + arg0 + { + title = "Flicker"; + type = 11; + enum = "yesno"; + } + } + 2007 + { + title = "Jack-o'-lantern 2"; + sprite = "PUMKB0"; + width = 16; + height = 40; + arg0 + { + title = "Flicker"; + type = 11; + enum = "yesno"; + } + } + 2008 + { + title = "Jack-o'-lantern 3"; + sprite = "PUMKC0"; + width = 16; + height = 40; + arg0 + { + title = "Flicker"; + type = 11; + enum = "yesno"; + } + } + 2009 + { + title = "Purple Mushroom"; + sprite = "SHRMD0"; + width = 16; + height = 48; + } + 2010 + { + title = "HHZ Tree"; + sprite = "HHPLC0"; + width = 12; + height = 40; + } } - 2003 + + frozenhillside { - title = "HHZ Tentacle 2"; - sprite = "HHZMC0"; - width = 16; - height = 40; + color = 10; // Green + title = "Frozen Hillside"; + + 2100 + { + title = "Ice Shard (Small)"; + sprite = "FHZIA0"; + width = 8; + height = 32; + } + 2101 + { + title = "Ice Shard (Large)"; + sprite = "FHZIB0"; + width = 8; + height = 32; + } + 2102 + { + title = "Crystal Tree (Aqua)"; + sprite = "TRE3A0"; + width = 20; + height = 200; + } + 2103 + { + title = "Crystal Tree (Pink)"; + sprite = "TRE3B0"; + width = 20; + height = 200; + } + 2104 + { + title = "Amy Cameo"; + sprite = "ROSYA1"; + width = 16; + height = 48; + arg0 + { + title = "Grayscale?"; + type = 11; + enum = "noyes"; + } + } + 2105 + { + title = "Mistletoe"; + sprite = "XMS6A0"; + width = 52; + height = 106; + } } - 2004 + + tutorial { - title = "HHZ Stalagmite (Tall)"; - sprite = "HHZME0"; - width = 16; - height = 40; + color = 10; // Green + title = "Tutorial"; + + 799 + { + title = "Tutorial Plant"; + sprite = "TUPFH0"; + width = 40; + height = 144; + arg0 + { + title = "Start frame"; + } + } } - 2005 + + flickies { - title = "HHZ Stalagmite (Short)"; - sprite = "HHZMF0"; - width = 16; - height = 40; - } - 2006 - { - title = "Jack-o'-lantern 1"; - sprite = "PUMKA0"; - width = 16; - height = 40; - } - 2007 - { - title = "Jack-o'-lantern 2"; - sprite = "PUMKB0"; - width = 16; - height = 40; - } - 2008 - { - title = "Jack-o'-lantern 3"; - sprite = "PUMKC0"; - width = 16; - height = 40; - } - 2009 - { - title = "Purple Mushroom"; - sprite = "SHRMD0"; - width = 16; - height = 48; - } - 2010 - { - title = "HHZ Tree"; - sprite = "HHPLC0"; - width = 12; - height = 40; + color = 10; // Green + title = "Flickies"; + width = 8; + height = 20; + arg0 + { + title = "Radius"; + } + arg1 + { + title = "Flags"; + type = 12; + enum + { + 1 = "Move aimlessly"; + 2 = "No movement"; + 4 = "Hop"; + } + } + + 2200 + { + title = "Bluebird"; + sprite = "FL01A1"; + } + 2201 + { + title = "Rabbit"; + sprite = "FL02A1"; + } + 2202 + { + title = "Chicken"; + sprite = "FL03A1"; + } + 2203 + { + title = "Seal"; + sprite = "FL04A1"; + } + 2204 + { + title = "Pig"; + sprite = "FL05A1"; + } + 2205 + { + title = "Chipmunk"; + sprite = "FL06A1"; + } + 2206 + { + title = "Penguin"; + sprite = "FL07A1"; + } + 2207 + { + title = "Fish"; + sprite = "FL08A1"; + arg2 + { + title = "Color"; + type = 11; + enum + { + 0 = "Random"; + 1 = "Red"; + 2 = "Cyan"; + 3 = "Blue"; + 4 = "Vapor"; + 5 = "Purple"; + 6 = "Bubblegum"; + 7 = "Neon"; + 8 = "Black"; + 9 = "Beige"; + 10 = "Lavender"; + 11 = "Ruby"; + 12 = "Salmon"; + 13 = "Sunset"; + 14 = "Orange"; + 15 = "Yellow"; + } + } + } + 2208 + { + title = "Ram"; + sprite = "FL09A1"; + } + 2209 + { + title = "Puffin"; + sprite = "FL10A1"; + } + 2210 + { + title = "Cow"; + sprite = "FL11A1"; + } + 2211 + { + title = "Rat"; + sprite = "FL12A1"; + } + 2212 + { + title = "Bear"; + sprite = "FL13A1"; + } + 2213 + { + title = "Dove"; + sprite = "FL14A1"; + } + 2214 + { + title = "Cat"; + sprite = "FL15A1"; + } + 2215 + { + title = "Canary"; + sprite = "FL16A1"; + } + 2216 + { + title = "Spider"; + sprite = "FS01A1"; + } + 2217 + { + title = "Bat"; + sprite = "FS02A0"; + } } } - -frozenhillside -{ - color = 10; // Green - title = "Frozen Hillside"; - - 2100 - { - title = "Ice Shard (Small)"; - sprite = "FHZIA0"; - width = 8; - height = 32; - } - 2101 - { - title = "Ice Shard (Large)"; - sprite = "FHZIB0"; - width = 8; - height = 32; - } - 2102 - { - title = "Crystal Tree (Aqua)"; - sprite = "TRE3A0"; - width = 20; - height = 200; - } - 2103 - { - title = "Crystal Tree (Pink)"; - sprite = "TRE3B0"; - width = 20; - height = 200; - } - 2104 - { - title = "Amy Cameo"; - sprite = "ROSYA1"; - width = 16; - height = 48; - } - 2105 - { - title = "Mistletoe"; - sprite = "XMS6A0"; - width = 52; - height = 106; - } -} - -flickies -{ - color = 10; // Green - title = "Flickies"; - width = 8; - height = 20; - - 2200 - { - title = "Bluebird"; - sprite = "FL01A1"; - } - 2201 - { - title = "Rabbit"; - sprite = "FL02A1"; - } - 2202 - { - title = "Chicken"; - sprite = "FL03A1"; - } - 2203 - { - title = "Seal"; - sprite = "FL04A1"; - } - 2204 - { - title = "Pig"; - sprite = "FL05A1"; - } - 2205 - { - title = "Chipmunk"; - sprite = "FL06A1"; - } - 2206 - { - title = "Penguin"; - sprite = "FL07A1"; - } - 2207 - { - title = "Fish"; - sprite = "FL08A1"; - } - 2208 - { - title = "Ram"; - sprite = "FL09A1"; - } - 2209 - { - title = "Puffin"; - sprite = "FL10A1"; - } - 2210 - { - title = "Cow"; - sprite = "FL11A1"; - } - 2211 - { - title = "Rat"; - sprite = "FL12A1"; - } - 2212 - { - title = "Bear"; - sprite = "FL13A1"; - } - 2213 - { - title = "Dove"; - sprite = "FL14A1"; - } - 2214 - { - title = "Cat"; - sprite = "FL15A1"; - } - 2215 - { - title = "Canary"; - sprite = "FL16A1"; - } - 2216 - { - title = "Spider"; - sprite = "FS01A1"; - } - 2217 - { - title = "Bat"; - sprite = "FS02A0"; - } -} \ No newline at end of file diff --git a/extras/conf/udb/SRB2_22Doom.cfg b/extras/conf/udb/SRB2_22Doom.cfg index 891b9d507..9e733aa39 100644 --- a/extras/conf/udb/SRB2_22Doom.cfg +++ b/extras/conf/udb/SRB2_22Doom.cfg @@ -25,12 +25,6 @@ scriptlumpnames include("Includes\\SRB222_misc.cfg", "scriptlumpnames"); } -// THING TYPES -thingtypes -{ - include("Includes\\SRB222_things.cfg"); -} - //Default things filters thingsfilters { diff --git a/extras/conf/udb/SRB2_22UDMF.cfg b/extras/conf/udb/SRB2_22UDMF.cfg index 749cf499a..b6bd22478 100644 --- a/extras/conf/udb/SRB2_22UDMF.cfg +++ b/extras/conf/udb/SRB2_22UDMF.cfg @@ -25,12 +25,6 @@ scriptlumpnames include("Includes\\SRB222_misc.cfg", "scriptlumpnames"); } -// THING TYPES -thingtypes -{ - include("Includes\\SRB222_things.cfg"); -} - //Default things filters thingsfilters { diff --git a/libs/FMOD.props b/libs/FMOD.props deleted file mode 100644 index 785f11ce1..000000000 --- a/libs/FMOD.props +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - $(SolutionDir)libs\fmodex\inc;$(IncludePath) - $(SolutionDir)libs\fmodex\lib;$(LibraryPath) - - - - - fmodexL64_vc.lib;%(AdditionalDependencies) - - - - - fmodexL_vc.lib;%(AdditionalDependencies) - - - - \ No newline at end of file diff --git a/libs/dll-binaries/i686/Old/fmod.dll b/libs/dll-binaries/i686/Old/fmod.dll deleted file mode 100644 index 6b0e379d3..000000000 Binary files a/libs/dll-binaries/i686/Old/fmod.dll and /dev/null differ diff --git a/libs/dll-binaries/i686/Old/fmodexL.dll b/libs/dll-binaries/i686/Old/fmodexL.dll deleted file mode 100644 index 1ac9e21c9..000000000 Binary files a/libs/dll-binaries/i686/Old/fmodexL.dll and /dev/null differ diff --git a/libs/dll-binaries/i686/fmodex.dll b/libs/dll-binaries/i686/fmodex.dll deleted file mode 100644 index 875f8a267..000000000 Binary files a/libs/dll-binaries/i686/fmodex.dll and /dev/null differ diff --git a/libs/dll-binaries/x86_64/Old/fmod64.dll b/libs/dll-binaries/x86_64/Old/fmod64.dll deleted file mode 100644 index 2a8bab284..000000000 Binary files a/libs/dll-binaries/x86_64/Old/fmod64.dll and /dev/null differ diff --git a/libs/dll-binaries/x86_64/Old/fmodexL64.dll b/libs/dll-binaries/x86_64/Old/fmodexL64.dll deleted file mode 100644 index 463628c6e..000000000 Binary files a/libs/dll-binaries/x86_64/Old/fmodexL64.dll and /dev/null differ diff --git a/libs/dll-binaries/x86_64/fmodex64.dll b/libs/dll-binaries/x86_64/fmodex64.dll deleted file mode 100644 index f08c0033b..000000000 Binary files a/libs/dll-binaries/x86_64/fmodex64.dll and /dev/null differ diff --git a/libs/fmodex/inc/fmod.h b/libs/fmodex/inc/fmod.h deleted file mode 100644 index f3fbd853e..000000000 --- a/libs/fmodex/inc/fmod.h +++ /dev/null @@ -1,2462 +0,0 @@ - -/* ============================================================================================ */ -/* FMOD Ex - Main C/C++ header file. Copyright (c), Firelight Technologies Pty, Ltd. 2004-2011. */ -/* */ -/* This header is the base header for all other FMOD headers. If you are programming in C */ -/* use this exclusively, or if you are programming C++ use this in conjunction with FMOD.HPP */ -/* */ -/* ============================================================================================ */ - -#ifndef _FMOD_H -#define _FMOD_H - -/* - FMOD version number. Check this against FMOD::System::getVersion. - 0xaaaabbcc -> aaaa = major version number. bb = minor version number. cc = development version number. -*/ - -#define FMOD_VERSION 0x00044412 - -/* - Compiler specific settings. -*/ - -#if defined(__CYGWIN32__) - #define F_CDECL __cdecl - #define F_STDCALL __stdcall - #define F_DECLSPEC __declspec - #define F_DLLEXPORT ( dllexport ) -#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) - #define F_CDECL _cdecl - #define F_STDCALL _stdcall - #define F_DECLSPEC __declspec - #define F_DLLEXPORT ( dllexport ) -#elif defined(__MACH__) || defined(__ANDROID__) || defined(__linux__) || defined(__QNX__) - #define F_CDECL - #define F_STDCALL - #define F_DECLSPEC - #define F_DLLEXPORT __attribute__ ((visibility("default"))) -#else - #define F_CDECL - #define F_STDCALL - #define F_DECLSPEC - #define F_DLLEXPORT -#endif - -#ifdef DLL_EXPORTS - #if defined(__MACH__) || defined(__ANDROID__) || defined(__linux__) || defined(__QNX__) - #define F_API __attribute__ ((visibility("default"))) - #else - #define F_API __declspec(dllexport) F_STDCALL - #endif -#else - #define F_API F_STDCALL -#endif - -#define F_CALLBACK F_STDCALL - -/* - FMOD types. -*/ - -typedef int FMOD_BOOL; -typedef struct FMOD_SYSTEM FMOD_SYSTEM; -typedef struct FMOD_SOUND FMOD_SOUND; -typedef struct FMOD_CHANNEL FMOD_CHANNEL; -typedef struct FMOD_CHANNELGROUP FMOD_CHANNELGROUP; -typedef struct FMOD_SOUNDGROUP FMOD_SOUNDGROUP; -typedef struct FMOD_REVERB FMOD_REVERB; -typedef struct FMOD_DSP FMOD_DSP; -typedef struct FMOD_DSPCONNECTION FMOD_DSPCONNECTION; -typedef struct FMOD_POLYGON FMOD_POLYGON; -typedef struct FMOD_GEOMETRY FMOD_GEOMETRY; -typedef struct FMOD_SYNCPOINT FMOD_SYNCPOINT; -typedef unsigned int FMOD_MODE; -typedef unsigned int FMOD_TIMEUNIT; -typedef unsigned int FMOD_INITFLAGS; -typedef unsigned int FMOD_CAPS; -typedef unsigned int FMOD_DEBUGLEVEL; -typedef unsigned int FMOD_MEMORY_TYPE; - -/* -[ENUM] -[ - [DESCRIPTION] - error codes. Returned from every function. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] -] -*/ -typedef enum -{ - FMOD_OK, /* No errors. */ - FMOD_ERR_ALREADYLOCKED, /* Tried to call lock a second time before unlock was called. */ - FMOD_ERR_BADCOMMAND, /* Tried to call a function on a data type that does not allow this type of functionality (ie calling Sound::lock on a streaming sound). */ - FMOD_ERR_CDDA_DRIVERS, /* Neither NTSCSI nor ASPI could be initialised. */ - FMOD_ERR_CDDA_INIT, /* An error occurred while initialising the CDDA subsystem. */ - FMOD_ERR_CDDA_INVALID_DEVICE, /* Couldn't find the specified device. */ - FMOD_ERR_CDDA_NOAUDIO, /* No audio tracks on the specified disc. */ - FMOD_ERR_CDDA_NODEVICES, /* No CD/DVD devices were found. */ - FMOD_ERR_CDDA_NODISC, /* No disc present in the specified drive. */ - FMOD_ERR_CDDA_READ, /* A CDDA read error occurred. */ - FMOD_ERR_CHANNEL_ALLOC, /* Error trying to allocate a channel. */ - FMOD_ERR_CHANNEL_STOLEN, /* The specified channel has been reused to play another sound. */ - FMOD_ERR_COM, /* A Win32 COM related error occured. COM failed to initialize or a QueryInterface failed meaning a Windows codec or driver was not installed properly. */ - FMOD_ERR_DMA, /* DMA Failure. See debug output for more information. */ - FMOD_ERR_DSP_CONNECTION, /* DSP connection error. Connection possibly caused a cyclic dependancy. Or tried to connect a tree too many units deep (more than 128). */ - FMOD_ERR_DSP_FORMAT, /* DSP Format error. A DSP unit may have attempted to connect to this network with the wrong format. */ - FMOD_ERR_DSP_NOTFOUND, /* DSP connection error. Couldn't find the DSP unit specified. */ - FMOD_ERR_DSP_RUNNING, /* DSP error. Cannot perform this operation while the network is in the middle of running. This will most likely happen if a connection or disconnection is attempted in a DSP callback. */ - FMOD_ERR_DSP_TOOMANYCONNECTIONS,/* DSP connection error. The unit being connected to or disconnected should only have 1 input or output. */ - FMOD_ERR_FILE_BAD, /* Error loading file. */ - FMOD_ERR_FILE_COULDNOTSEEK, /* Couldn't perform seek operation. This is a limitation of the medium (ie netstreams) or the file format. */ - FMOD_ERR_FILE_DISKEJECTED, /* Media was ejected while reading. */ - FMOD_ERR_FILE_EOF, /* End of file unexpectedly reached while trying to read essential data (truncated data?). */ - FMOD_ERR_FILE_NOTFOUND, /* File not found. */ - FMOD_ERR_FILE_UNWANTED, /* Unwanted file access occured. */ - FMOD_ERR_FORMAT, /* Unsupported file or audio format. */ - FMOD_ERR_HTTP, /* A HTTP error occurred. This is a catch-all for HTTP errors not listed elsewhere. */ - FMOD_ERR_HTTP_ACCESS, /* The specified resource requires authentication or is forbidden. */ - FMOD_ERR_HTTP_PROXY_AUTH, /* Proxy authentication is required to access the specified resource. */ - FMOD_ERR_HTTP_SERVER_ERROR, /* A HTTP server error occurred. */ - FMOD_ERR_HTTP_TIMEOUT, /* The HTTP request timed out. */ - FMOD_ERR_INITIALIZATION, /* FMOD was not initialized correctly to support this function. */ - FMOD_ERR_INITIALIZED, /* Cannot call this command after System::init. */ - FMOD_ERR_INTERNAL, /* An error occured that wasn't supposed to. Contact support. */ - FMOD_ERR_INVALID_ADDRESS, /* On Xbox 360, this memory address passed to FMOD must be physical, (ie allocated with XPhysicalAlloc.) */ - FMOD_ERR_INVALID_FLOAT, /* Value passed in was a NaN, Inf or denormalized float. */ - FMOD_ERR_INVALID_HANDLE, /* An invalid object handle was used. */ - FMOD_ERR_INVALID_PARAM, /* An invalid parameter was passed to this function. */ - FMOD_ERR_INVALID_POSITION, /* An invalid seek position was passed to this function. */ - FMOD_ERR_INVALID_SPEAKER, /* An invalid speaker was passed to this function based on the current speaker mode. */ - FMOD_ERR_INVALID_SYNCPOINT, /* The syncpoint did not come from this sound handle. */ - FMOD_ERR_INVALID_VECTOR, /* The vectors passed in are not unit length, or perpendicular. */ - FMOD_ERR_MAXAUDIBLE, /* Reached maximum audible playback count for this sound's soundgroup. */ - FMOD_ERR_MEMORY, /* Not enough memory or resources. */ - FMOD_ERR_MEMORY_CANTPOINT, /* Can't use FMOD_OPENMEMORY_POINT on non PCM source data, or non mp3/xma/adpcm data if FMOD_CREATECOMPRESSEDSAMPLE was used. */ - FMOD_ERR_MEMORY_SRAM, /* Not enough memory or resources on console sound ram. */ - FMOD_ERR_NEEDS2D, /* Tried to call a command on a 3d sound when the command was meant for 2d sound. */ - FMOD_ERR_NEEDS3D, /* Tried to call a command on a 2d sound when the command was meant for 3d sound. */ - FMOD_ERR_NEEDSHARDWARE, /* Tried to use a feature that requires hardware support. (ie trying to play a GCADPCM compressed sound in software on Wii). */ - FMOD_ERR_NEEDSSOFTWARE, /* Tried to use a feature that requires the software engine. Software engine has either been turned off, or command was executed on a hardware channel which does not support this feature. */ - FMOD_ERR_NET_CONNECT, /* Couldn't connect to the specified host. */ - FMOD_ERR_NET_SOCKET_ERROR, /* A socket error occurred. This is a catch-all for socket-related errors not listed elsewhere. */ - FMOD_ERR_NET_URL, /* The specified URL couldn't be resolved. */ - FMOD_ERR_NET_WOULD_BLOCK, /* Operation on a non-blocking socket could not complete immediately. */ - FMOD_ERR_NOTREADY, /* Operation could not be performed because specified sound/DSP connection is not ready. */ - FMOD_ERR_OUTPUT_ALLOCATED, /* Error initializing output device, but more specifically, the output device is already in use and cannot be reused. */ - FMOD_ERR_OUTPUT_CREATEBUFFER, /* Error creating hardware sound buffer. */ - FMOD_ERR_OUTPUT_DRIVERCALL, /* A call to a standard soundcard driver failed, which could possibly mean a bug in the driver or resources were missing or exhausted. */ - FMOD_ERR_OUTPUT_ENUMERATION, /* Error enumerating the available driver list. List may be inconsistent due to a recent device addition or removal. */ - FMOD_ERR_OUTPUT_FORMAT, /* Soundcard does not support the minimum features needed for this soundsystem (16bit stereo output). */ - FMOD_ERR_OUTPUT_INIT, /* Error initializing output device. */ - FMOD_ERR_OUTPUT_NOHARDWARE, /* FMOD_HARDWARE was specified but the sound card does not have the resources necessary to play it. */ - FMOD_ERR_OUTPUT_NOSOFTWARE, /* Attempted to create a software sound but no software channels were specified in System::init. */ - FMOD_ERR_PAN, /* Panning only works with mono or stereo sound sources. */ - FMOD_ERR_PLUGIN, /* An unspecified error has been returned from a 3rd party plugin. */ - FMOD_ERR_PLUGIN_INSTANCES, /* The number of allowed instances of a plugin has been exceeded. */ - FMOD_ERR_PLUGIN_MISSING, /* A requested output, dsp unit type or codec was not available. */ - FMOD_ERR_PLUGIN_RESOURCE, /* A resource that the plugin requires cannot be found. (ie the DLS file for MIDI playback or other DLLs that it needs to load) */ - FMOD_ERR_PRELOADED, /* The specified sound is still in use by the event system, call EventSystem::unloadFSB before trying to release it. */ - FMOD_ERR_PROGRAMMERSOUND, /* The specified sound is still in use by the event system, wait for the event which is using it finish with it. */ - FMOD_ERR_RECORD, /* An error occured trying to initialize the recording device. */ - FMOD_ERR_REVERB_INSTANCE, /* Specified instance in FMOD_REVERB_PROPERTIES couldn't be set. Most likely because it is an invalid instance number or the reverb doesnt exist. */ - FMOD_ERR_SUBSOUND_ALLOCATED, /* This subsound is already being used by another sound, you cannot have more than one parent to a sound. Null out the other parent's entry first. */ - FMOD_ERR_SUBSOUND_CANTMOVE, /* Shared subsounds cannot be replaced or moved from their parent stream, such as when the parent stream is an FSB file. */ - FMOD_ERR_SUBSOUND_MODE, /* The subsound's mode bits do not match with the parent sound's mode bits. See documentation for function that it was called with. */ - FMOD_ERR_SUBSOUNDS, /* The error occured because the sound referenced contains subsounds when it shouldn't have, or it doesn't contain subsounds when it should have. The operation may also not be able to be performed on a parent sound, or a parent sound was played without setting up a sentence first. */ - FMOD_ERR_TAGNOTFOUND, /* The specified tag could not be found or there are no tags. */ - FMOD_ERR_TOOMANYCHANNELS, /* The sound created exceeds the allowable input channel count. This can be increased using the maxinputchannels parameter in System::setSoftwareFormat. */ - FMOD_ERR_UNIMPLEMENTED, /* Something in FMOD hasn't been implemented when it should be! contact support! */ - FMOD_ERR_UNINITIALIZED, /* This command failed because System::init or System::setDriver was not called. */ - FMOD_ERR_UNSUPPORTED, /* A command issued was not supported by this object. Possibly a plugin without certain callbacks specified. */ - FMOD_ERR_UPDATE, /* An error caused by System::update occured. */ - FMOD_ERR_VERSION, /* The version number of this file format is not supported. */ - - FMOD_ERR_EVENT_FAILED, /* An Event failed to be retrieved, most likely due to 'just fail' being specified as the max playbacks behavior. */ - FMOD_ERR_EVENT_INFOONLY, /* Can't execute this command on an EVENT_INFOONLY event. */ - FMOD_ERR_EVENT_INTERNAL, /* An error occured that wasn't supposed to. See debug log for reason. */ - FMOD_ERR_EVENT_MAXSTREAMS, /* Event failed because 'Max streams' was hit when FMOD_EVENT_INIT_FAIL_ON_MAXSTREAMS was specified. */ - FMOD_ERR_EVENT_MISMATCH, /* FSB mismatches the FEV it was compiled with, the stream/sample mode it was meant to be created with was different, or the FEV was built for a different platform. */ - FMOD_ERR_EVENT_NAMECONFLICT, /* A category with the same name already exists. */ - FMOD_ERR_EVENT_NOTFOUND, /* The requested event, event group, event category or event property could not be found. */ - FMOD_ERR_EVENT_NEEDSSIMPLE, /* Tried to call a function on a complex event that's only supported by simple events. */ - FMOD_ERR_EVENT_GUIDCONFLICT, /* An event with the same GUID already exists. */ - FMOD_ERR_EVENT_ALREADY_LOADED, /* The specified project or bank has already been loaded. Having multiple copies of the same project loaded simultaneously is forbidden. */ - - FMOD_ERR_MUSIC_UNINITIALIZED, /* Music system is not initialized probably because no music data is loaded. */ - FMOD_ERR_MUSIC_NOTFOUND, /* The requested music entity could not be found. */ - FMOD_ERR_MUSIC_NOCALLBACK, /* The music callback is required, but it has not been set. */ - - FMOD_RESULT_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_RESULT; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure describing a point in 3D space. - - [REMARKS] - FMOD uses a left handed co-ordinate system by default. - To use a right handed co-ordinate system specify FMOD_INIT_3D_RIGHTHANDED from FMOD_INITFLAGS in System::init. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::set3DListenerAttributes - System::get3DListenerAttributes - Channel::set3DAttributes - Channel::get3DAttributes - Channel::set3DCustomRolloff - Channel::get3DCustomRolloff - Sound::set3DCustomRolloff - Sound::get3DCustomRolloff - Geometry::addPolygon - Geometry::setPolygonVertex - Geometry::getPolygonVertex - Geometry::setRotation - Geometry::getRotation - Geometry::setPosition - Geometry::getPosition - Geometry::setScale - Geometry::getScale - FMOD_INITFLAGS -] -*/ -typedef struct -{ - float x; /* X co-ordinate in 3D space. */ - float y; /* Y co-ordinate in 3D space. */ - float z; /* Z co-ordinate in 3D space. */ -} FMOD_VECTOR; - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure describing a globally unique identifier. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::getDriverInfo -] -*/ -typedef struct -{ - unsigned int Data1; /* Specifies the first 8 hexadecimal digits of the GUID */ - unsigned short Data2; /* Specifies the first group of 4 hexadecimal digits. */ - unsigned short Data3; /* Specifies the second group of 4 hexadecimal digits. */ - unsigned char Data4[8]; /* Array of 8 bytes. The first 2 bytes contain the third group of 4 hexadecimal digits. The remaining 6 bytes contain the final 12 hexadecimal digits. */ -} FMOD_GUID; - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure that is passed into FMOD_FILE_ASYNCREADCALLBACK. Use the information in this structure to perform - - [REMARKS] - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - - Instructions: write to 'buffer', and 'bytesread' BEFORE setting 'result'. - As soon as result is set, FMOD will asynchronously continue internally using the data provided in this structure. - - Set 'result' to the result expected from a normal file read callback. - If the read was successful, set it to FMOD_OK. - If it read some data but hit the end of the file, set it to FMOD_ERR_FILE_EOF. - If a bad error occurred, return FMOD_ERR_FILE_BAD - If a disk was ejected, return FMOD_ERR_FILE_DISKEJECTED. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_FILE_ASYNCREADCALLBACK - FMOD_FILE_ASYNCCANCELCALLBACK -] -*/ -typedef struct -{ - void *handle; /* [r] The file handle that was filled out in the open callback. */ - unsigned int offset; /* [r] Seek position, make sure you read from this file offset. */ - unsigned int sizebytes; /* [r] how many bytes requested for read. */ - int priority; /* [r] 0 = low importance. 100 = extremely important (ie 'must read now or stuttering may occur') */ - - void *buffer; /* [w] Buffer to read file data into. */ - unsigned int bytesread; /* [w] Fill this in before setting result code to tell FMOD how many bytes were read. */ - FMOD_RESULT result; /* [r/w] Result code, FMOD_OK tells the system it is ready to consume the data. Set this last! Default value = FMOD_ERR_NOTREADY. */ - - void *userdata; /* [r] User data pointer. */ -} FMOD_ASYNCREADINFO; - - -/* -[ENUM] -[ - [DESCRIPTION] - These output types are used with System::setOutput / System::getOutput, to choose which output method to use. - - [REMARKS] - To pass information to the driver when initializing fmod use the extradriverdata parameter in System::init for the following reasons. - - FMOD_OUTPUTTYPE_WAVWRITER - extradriverdata is a pointer to a char * filename that the wav writer will output to. - - FMOD_OUTPUTTYPE_WAVWRITER_NRT - extradriverdata is a pointer to a char * filename that the wav writer will output to. - - FMOD_OUTPUTTYPE_DSOUND - extradriverdata is a pointer to a HWND so that FMOD can set the focus on the audio for a particular window. - - FMOD_OUTPUTTYPE_PS3 - extradriverdata is a pointer to a FMOD_PS3_EXTRADRIVERDATA struct. This can be found in fmodps3.h. - - FMOD_OUTPUTTYPE_GC - extradriverdata is a pointer to a FMOD_GC_INFO struct. This can be found in fmodgc.h. - - FMOD_OUTPUTTYPE_WII - extradriverdata is a pointer to a FMOD_WII_INFO struct. This can be found in fmodwii.h. - - FMOD_OUTPUTTYPE_ALSA - extradriverdata is a pointer to a FMOD_LINUX_EXTRADRIVERDATA struct. This can be found in fmodlinux.h. - - Currently these are the only FMOD drivers that take extra information. Other unknown plugins may have different requirements. - - Note! If FMOD_OUTPUTTYPE_WAVWRITER_NRT or FMOD_OUTPUTTYPE_NOSOUND_NRT are used, and if the System::update function is being called - very quickly (ie for a non realtime decode) it may be being called too quickly for the FMOD streamer thread to respond to. - The result will be a skipping/stuttering output in the captured audio. - - To remedy this, disable the FMOD Ex streamer thread, and use FMOD_INIT_STREAM_FROM_UPDATE to avoid skipping in the output stream, - as it will lock the mixer and the streamer together in the same thread. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::setOutput - System::getOutput - System::setSoftwareFormat - System::getSoftwareFormat - System::init - System::update - FMOD_INITFLAGS -] -*/ -typedef enum -{ - FMOD_OUTPUTTYPE_AUTODETECT, /* Picks the best output mode for the platform. This is the default. */ - - FMOD_OUTPUTTYPE_UNKNOWN, /* All - 3rd party plugin, unknown. This is for use with System::getOutput only. */ - FMOD_OUTPUTTYPE_NOSOUND, /* All - All calls in this mode succeed but make no sound. */ - FMOD_OUTPUTTYPE_WAVWRITER, /* All - Writes output to fmodoutput.wav by default. Use the 'extradriverdata' parameter in System::init, by simply passing the filename as a string, to set the wav filename. */ - FMOD_OUTPUTTYPE_NOSOUND_NRT, /* All - Non-realtime version of FMOD_OUTPUTTYPE_NOSOUND. User can drive mixer with System::update at whatever rate they want. */ - FMOD_OUTPUTTYPE_WAVWRITER_NRT, /* All - Non-realtime version of FMOD_OUTPUTTYPE_WAVWRITER. User can drive mixer with System::update at whatever rate they want. */ - - FMOD_OUTPUTTYPE_DSOUND, /* Win32/Win64 - DirectSound output. (Default on Windows XP and below) */ - FMOD_OUTPUTTYPE_WINMM, /* Win32/Win64 - Windows Multimedia output. */ - FMOD_OUTPUTTYPE_WASAPI, /* Win32 - Windows Audio Session API. (Default on Windows Vista and above) */ - FMOD_OUTPUTTYPE_ASIO, /* Win32 - Low latency ASIO 2.0 driver. */ - FMOD_OUTPUTTYPE_OSS, /* Linux/Linux64 - Open Sound System output. (Default on Linux, third preference) */ - FMOD_OUTPUTTYPE_ALSA, /* Linux/Linux64 - Advanced Linux Sound Architecture output. (Default on Linux, second preference if available) */ - FMOD_OUTPUTTYPE_ESD, /* Linux/Linux64 - Enlightment Sound Daemon output. */ - FMOD_OUTPUTTYPE_PULSEAUDIO, /* Linux/Linux64 - PulseAudio output. (Default on Linux, first preference if available) */ - FMOD_OUTPUTTYPE_COREAUDIO, /* Mac - Macintosh CoreAudio output. (Default on Mac) */ - FMOD_OUTPUTTYPE_XBOX360, /* Xbox 360 - Native Xbox360 output. (Default on Xbox 360) */ - FMOD_OUTPUTTYPE_PSP, /* PSP - Native PSP output. (Default on PSP) */ - FMOD_OUTPUTTYPE_PS3, /* PS3 - Native PS3 output. (Default on PS3) */ - FMOD_OUTPUTTYPE_NGP, /* NGP - Native NGP output. (Default on NGP) */ - FMOD_OUTPUTTYPE_WII, /* Wii - Native Wii output. (Default on Wii) */ - FMOD_OUTPUTTYPE_3DS, /* 3DS - Native 3DS output (Default on 3DS) */ - FMOD_OUTPUTTYPE_AUDIOTRACK, /* Android - Java Audio Track output. (Default on Android 2.2 and below) */ - FMOD_OUTPUTTYPE_OPENSL, /* Android - OpenSL ES output. (Default on Android 2.3 and above) */ - FMOD_OUTPUTTYPE_NACL, /* Native Client - Native Client output. (Default on Native Client) */ - FMOD_OUTPUTTYPE_WIIU, /* Wii U - Native Wii U output. (Default on Wii U) */ - FMOD_OUTPUTTYPE_ASOUND, /* BlackBerry - Native BlackBerry asound output. (Default on BlackBerry) */ - - FMOD_OUTPUTTYPE_MAX, /* Maximum number of output types supported. */ - FMOD_OUTPUTTYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_OUTPUTTYPE; - - -/* -[DEFINE] -[ - [NAME] - FMOD_CAPS - - [DESCRIPTION] - Bit fields to use with System::getDriverCaps to determine the capabilities of a card / output device. - - [REMARKS] - It is important to check FMOD_CAPS_HARDWARE_EMULATED on windows machines, to then adjust System::setDSPBufferSize to (1024, 10) to compensate for the higher latency. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::getDriverCaps - System::setDSPBufferSize -] -*/ -#define FMOD_CAPS_NONE 0x00000000 /* Device has no special capabilities. */ -#define FMOD_CAPS_HARDWARE 0x00000001 /* Device supports hardware mixing. */ -#define FMOD_CAPS_HARDWARE_EMULATED 0x00000002 /* User has device set to 'Hardware acceleration = off' in control panel, and now extra 200ms latency is incurred. */ -#define FMOD_CAPS_OUTPUT_MULTICHANNEL 0x00000004 /* Device can do multichannel output, ie greater than 2 channels. */ -#define FMOD_CAPS_OUTPUT_FORMAT_PCM8 0x00000008 /* Device can output to 8bit integer PCM. */ -#define FMOD_CAPS_OUTPUT_FORMAT_PCM16 0x00000010 /* Device can output to 16bit integer PCM. */ -#define FMOD_CAPS_OUTPUT_FORMAT_PCM24 0x00000020 /* Device can output to 24bit integer PCM. */ -#define FMOD_CAPS_OUTPUT_FORMAT_PCM32 0x00000040 /* Device can output to 32bit integer PCM. */ -#define FMOD_CAPS_OUTPUT_FORMAT_PCMFLOAT 0x00000080 /* Device can output to 32bit floating point PCM. */ -#define FMOD_CAPS_REVERB_LIMITED 0x00002000 /* Device supports some form of limited hardware reverb, maybe parameterless and only selectable by environment. */ -#define FMOD_CAPS_LOOPBACK 0x00004000 /* Device is a loopback recording device */ -/* [DEFINE_END] */ - -/* -[DEFINE] -[ - [NAME] - FMOD_DEBUGLEVEL - - [DESCRIPTION] - Bit fields to use with FMOD::Debug_SetLevel / FMOD::Debug_GetLevel to control the level of tty debug output with logging versions of FMOD (fmodL). - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Debug_SetLevel - Debug_GetLevel -] -*/ -#define FMOD_DEBUG_LEVEL_NONE 0x00000000 -#define FMOD_DEBUG_LEVEL_LOG 0x00000001 /* Will display generic logging messages. */ -#define FMOD_DEBUG_LEVEL_ERROR 0x00000002 /* Will display errors. */ -#define FMOD_DEBUG_LEVEL_WARNING 0x00000004 /* Will display warnings that are not fatal. */ -#define FMOD_DEBUG_LEVEL_HINT 0x00000008 /* Will hint to you if there is something possibly better you could be doing. */ -#define FMOD_DEBUG_LEVEL_ALL 0x000000FF -#define FMOD_DEBUG_TYPE_MEMORY 0x00000100 /* Show FMOD memory related logging messages. */ -#define FMOD_DEBUG_TYPE_THREAD 0x00000200 /* Show FMOD thread related logging messages. */ -#define FMOD_DEBUG_TYPE_FILE 0x00000400 /* Show FMOD file system related logging messages. */ -#define FMOD_DEBUG_TYPE_NET 0x00000800 /* Show FMOD network related logging messages. */ -#define FMOD_DEBUG_TYPE_EVENT 0x00001000 /* Show FMOD Event related logging messages. */ -#define FMOD_DEBUG_TYPE_ALL 0x0000FFFF -#define FMOD_DEBUG_DISPLAY_TIMESTAMPS 0x01000000 /* Display the timestamp of the log entry in milliseconds. */ -#define FMOD_DEBUG_DISPLAY_LINENUMBERS 0x02000000 /* Display the FMOD Ex source code line numbers, for debugging purposes. */ -#define FMOD_DEBUG_DISPLAY_COMPRESS 0x04000000 /* If a message is repeated more than 5 times it will stop displaying it and instead display the number of times the message was logged. */ -#define FMOD_DEBUG_DISPLAY_THREAD 0x08000000 /* Display the thread ID of the calling function that caused this log entry to appear. */ -#define FMOD_DEBUG_DISPLAY_ALL 0x0F000000 -#define FMOD_DEBUG_ALL 0xFFFFFFFF -/* [DEFINE_END] */ - - -/* -[DEFINE] -[ - [NAME] - FMOD_MEMORY_TYPE - - [DESCRIPTION] - Bit fields for memory allocation type being passed into FMOD memory callbacks. - - [REMARKS] - Remember this is a bitfield. You may get more than 1 bit set (ie physical + persistent) so do not simply switch on the types! You must check each bit individually or clear out the bits that you do not want within the callback. - Bits can be excluded if you want during Memory_Initialize so that you never get them. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_MEMORY_ALLOCCALLBACK - FMOD_MEMORY_REALLOCCALLBACK - FMOD_MEMORY_FREECALLBACK - Memory_Initialize - -] -*/ -#define FMOD_MEMORY_NORMAL 0x00000000 /* Standard memory. */ -#define FMOD_MEMORY_STREAM_FILE 0x00000001 /* Stream file buffer, size controllable with System::setStreamBufferSize. */ -#define FMOD_MEMORY_STREAM_DECODE 0x00000002 /* Stream decode buffer, size controllable with FMOD_CREATESOUNDEXINFO::decodebuffersize. */ -#define FMOD_MEMORY_SAMPLEDATA 0x00000004 /* Sample data buffer. Raw audio data, usually PCM/MPEG/ADPCM/XMA data. */ -#define FMOD_MEMORY_DSP_OUTPUTBUFFER 0x00000008 /* DSP memory block allocated when more than 1 output exists on a DSP node. */ -#define FMOD_MEMORY_XBOX360_PHYSICAL 0x00100000 /* Requires XPhysicalAlloc / XPhysicalFree. */ -#define FMOD_MEMORY_PERSISTENT 0x00200000 /* Persistent memory. Memory will be freed when System::release is called. */ -#define FMOD_MEMORY_SECONDARY 0x00400000 /* Secondary memory. Allocation should be in secondary memory. For example RSX on the PS3. */ -#define FMOD_MEMORY_ALL 0xFFFFFFFF -/* [DEFINE_END] */ - - -/* -[ENUM] -[ - [DESCRIPTION] - These are speaker types defined for use with the System::setSpeakerMode or System::getSpeakerMode command. - - [REMARKS] - These are important notes on speaker modes in regards to sounds created with FMOD_SOFTWARE. - Note below the phrase 'sound channels' is used. These are the subchannels inside a sound, they are not related and - have nothing to do with the FMOD class "Channel". - For example a mono sound has 1 sound channel, a stereo sound has 2 sound channels, and an AC3 or 6 channel wav file have 6 "sound channels". - - FMOD_SPEAKERMODE_RAW - --------------------- - This mode is for output devices that are not specifically mono/stereo/quad/surround/5.1 or 7.1, but are multichannel. - Use System::setSoftwareFormat to specify the number of speakers you want to address, otherwise it will default to 2 (stereo). - Sound channels map to speakers sequentially, so a mono sound maps to output speaker 0, stereo sound maps to output speaker 0 & 1. - The user assumes knowledge of the speaker order. FMOD_SPEAKER enumerations may not apply, so raw channel indices should be used. - Multichannel sounds map input channels to output channels 1:1. - Channel::setPan and Channel::setSpeakerMix do not work. - Speaker levels must be manually set with Channel::setSpeakerLevels. - - FMOD_SPEAKERMODE_MONO - --------------------- - This mode is for a 1 speaker arrangement. - Panning does not work in this speaker mode. - Mono, stereo and multichannel sounds have each sound channel played on the one speaker unity. - Mix behavior for multichannel sounds can be set with Channel::setSpeakerLevels. - Channel::setSpeakerMix does not work. - - FMOD_SPEAKERMODE_STEREO - ----------------------- - This mode is for 2 speaker arrangements that have a left and right speaker. - - Mono sounds default to an even distribution between left and right. They can be panned with Channel::setPan. - - Stereo sounds default to the middle, or full left in the left speaker and full right in the right speaker. - - They can be cross faded with Channel::setPan. - - Multichannel sounds have each sound channel played on each speaker at unity. - - Mix behavior for multichannel sounds can be set with Channel::setSpeakerLevels. - - Channel::setSpeakerMix works but only front left and right parameters are used, the rest are ignored. - - FMOD_SPEAKERMODE_QUAD - ------------------------ - This mode is for 4 speaker arrangements that have a front left, front right, rear left and a rear right speaker. - - Mono sounds default to an even distribution between front left and front right. They can be panned with Channel::setPan. - - Stereo sounds default to the left sound channel played on the front left, and the right sound channel played on the front right. - - They can be cross faded with Channel::setPan. - - Multichannel sounds default to all of their sound channels being played on each speaker in order of input. - - Mix behavior for multichannel sounds can be set with Channel::setSpeakerLevels. - - Channel::setSpeakerMix works but side left, side right, center and lfe are ignored. - - FMOD_SPEAKERMODE_SURROUND - ------------------------ - This mode is for 5 speaker arrangements that have a left/right/center/rear left/rear right. - - Mono sounds default to the center speaker. They can be panned with Channel::setPan. - - Stereo sounds default to the left sound channel played on the front left, and the right sound channel played on the front right. - - They can be cross faded with Channel::setPan. - - Multichannel sounds default to all of their sound channels being played on each speaker in order of input. - - Mix behavior for multichannel sounds can be set with Channel::setSpeakerLevels. - - Channel::setSpeakerMix works but side left / side right are ignored. - - FMOD_SPEAKERMODE_5POINT1 - ------------------------ - This mode is for 5.1 speaker arrangements that have a left/right/center/rear left/rear right and a subwoofer speaker. - - Mono sounds default to the center speaker. They can be panned with Channel::setPan. - - Stereo sounds default to the left sound channel played on the front left, and the right sound channel played on the front right. - - They can be cross faded with Channel::setPan. - - Multichannel sounds default to all of their sound channels being played on each speaker in order of input. - - Mix behavior for multichannel sounds can be set with Channel::setSpeakerLevels. - - Channel::setSpeakerMix works but side left / side right are ignored. - - FMOD_SPEAKERMODE_7POINT1 - ------------------------ - This mode is for 7.1 speaker arrangements that have a left/right/center/rear left/rear right/side left/side right - and a subwoofer speaker. - - Mono sounds default to the center speaker. They can be panned with Channel::setPan. - - Stereo sounds default to the left sound channel played on the front left, and the right sound channel played on the front right. - - They can be cross faded with Channel::setPan. - - Multichannel sounds default to all of their sound channels being played on each speaker in order of input. - - Mix behavior for multichannel sounds can be set with Channel::setSpeakerLevels. - - Channel::setSpeakerMix works and every parameter is used to set the balance of a sound in any speaker. - - FMOD_SPEAKERMODE_SRS5_1_MATRIX - ------------------------------------------------------ - This mode is for mono, stereo, 5.1 and 6.1 speaker arrangements, as it is backwards and forwards compatible with - stereo, but to get a surround effect a SRS 5.1, Prologic or Prologic 2 hardware decoder / amplifier is needed or - a compatible SRS equipped device (e.g., laptop, TV, etc.) or accessory (e.g., headphone). - Pan behavior is the same as FMOD_SPEAKERMODE_5POINT1. - - If this function is called the numoutputchannels setting in System::setSoftwareFormat is overwritten. - - Output rate must be 44100, 48000 or 96000 for this to work otherwise FMOD_ERR_OUTPUT_INIT will be returned. - - FMOD_SPEAKERMODE_DOLBY5_1_MATRIX - ------------------------------------------------------ - This mode is for 5.1 speaker arrangements using a stereo signal, to get a surround effect a Dolby Pro Logic II - hardware decoder / amplifier is needed. - Pan behavior is the same as FMOD_SPEAKERMODE_5POINT1. - - If this function is called the numoutputchannels setting in System::setSoftwareFormat is overwritten. - - Output rate must be 32000, 44100 or 48000 for this to work otherwise FMOD_ERR_OUTPUT_INIT will be returned. - - FMOD_SPEAKERMODE_MYEARS - ------------------------------------------------------ - This mode is for headphones. This will attempt to load a MyEars profile (see myears.net.au) and use it to generate - surround sound on headphones using a personalized HRTF algorithm, for realistic 3d sound. - Pan behavior is the same as FMOD_SPEAKERMODE_7POINT1. - MyEars speaker mode will automatically be set if the speakermode is FMOD_SPEAKERMODE_STEREO and the MyEars profile exists. - If this mode is set explicitly, FMOD_INIT_DISABLE_MYEARS_AUTODETECT has no effect. - If this mode is set explicitly and the MyEars profile does not exist, FMOD_ERR_OUTPUT_DRIVERCALL will be returned. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::setSpeakerMode - System::getSpeakerMode - System::getDriverCaps - System::setSoftwareFormat - Channel::setSpeakerLevels -] -*/ -typedef enum -{ - FMOD_SPEAKERMODE_RAW, /* There is no specific speakermode. Sound channels are mapped in order of input to output. Use System::setSoftwareFormat to specify speaker count. See remarks for more information. */ - FMOD_SPEAKERMODE_MONO, /* The speakers are monaural. */ - FMOD_SPEAKERMODE_STEREO, /* The speakers are stereo (DEFAULT). */ - FMOD_SPEAKERMODE_QUAD, /* 4 speaker setup. This includes front left, front right, rear left, rear right. */ - FMOD_SPEAKERMODE_SURROUND, /* 5 speaker setup. This includes front left, front right, center, rear left, rear right. */ - FMOD_SPEAKERMODE_5POINT1, /* 5.1 speaker setup. This includes front left, front right, center, rear left, rear right and a subwoofer. */ - FMOD_SPEAKERMODE_7POINT1, /* 7.1 speaker setup. This includes front left, front right, center, rear left, rear right, side left, side right and a subwoofer. */ - - FMOD_SPEAKERMODE_SRS5_1_MATRIX, /* Stereo compatible output, embedded with surround information. SRS 5.1/Prologic/Prologic2 decoders will split the signal into a 5.1 speaker set-up or SRS virtual surround will decode into a 2-speaker/headphone setup. See remarks about limitations.*/ - FMOD_SPEAKERMODE_DOLBY5_1_MATRIX, /* Stereo compatible output, embedded with surround information. Dolby Pro Logic II decoders will split the signal into a 5.1 speaker set-up. */ - FMOD_SPEAKERMODE_MYEARS, /* Stereo output, but data is encoded using personalized HRTF algorithms. See myears.net.au */ - - FMOD_SPEAKERMODE_MAX, /* Maximum number of speaker modes supported. */ - FMOD_SPEAKERMODE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_SPEAKERMODE; - - -/* -[ENUM] -[ - [DESCRIPTION] - These are speaker types defined for use with the Channel::setSpeakerLevels command. - It can also be used for speaker placement in the System::set3DSpeakerPosition command. - - [REMARKS] - If you are using FMOD_SPEAKERMODE_RAW and speaker assignments are meaningless, just cast a raw integer value to this type. - For example (FMOD_SPEAKER)7 would use the 7th speaker (also the same as FMOD_SPEAKER_SIDE_RIGHT). - Values higher than this can be used if an output system has more than 8 speaker types / output channels. 15 is the current maximum. - - NOTE: On Playstation 3 in 7.1, the extra 2 speakers are not side left/side right, they are 'surround back left'/'surround back right' which - locate the speakers behind the listener instead of to the sides like on PC. FMOD_SPEAKER_SBL/FMOD_SPEAKER_SBR are provided to make it - clearer what speaker is being addressed on that platform. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_SPEAKERMODE - Channel::setSpeakerLevels - Channel::getSpeakerLevels - System::set3DSpeakerPosition - System::get3DSpeakerPosition -] -*/ -typedef enum -{ - FMOD_SPEAKER_FRONT_LEFT, - FMOD_SPEAKER_FRONT_RIGHT, - FMOD_SPEAKER_FRONT_CENTER, - FMOD_SPEAKER_LOW_FREQUENCY, - FMOD_SPEAKER_BACK_LEFT, - FMOD_SPEAKER_BACK_RIGHT, - FMOD_SPEAKER_SIDE_LEFT, - FMOD_SPEAKER_SIDE_RIGHT, - - FMOD_SPEAKER_MAX, /* Maximum number of speaker types supported. */ - FMOD_SPEAKER_MONO = FMOD_SPEAKER_FRONT_LEFT, /* For use with FMOD_SPEAKERMODE_MONO and Channel::SetSpeakerLevels. Mapped to same value as FMOD_SPEAKER_FRONT_LEFT. */ - FMOD_SPEAKER_NULL = 65535, /* A non speaker. Use this with ASIO mapping to ignore a speaker. */ - FMOD_SPEAKER_SBL = FMOD_SPEAKER_SIDE_LEFT, /* For use with FMOD_SPEAKERMODE_7POINT1 on PS3 where the extra speakers are surround back inside of side speakers. */ - FMOD_SPEAKER_SBR = FMOD_SPEAKER_SIDE_RIGHT, /* For use with FMOD_SPEAKERMODE_7POINT1 on PS3 where the extra speakers are surround back inside of side speakers. */ - FMOD_SPEAKER_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_SPEAKER; - - -/* -[ENUM] -[ - [DESCRIPTION] - These are plugin types defined for use with the System::getNumPlugins, - System::getPluginInfo and System::unloadPlugin functions. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::getNumPlugins - System::getPluginInfo - System::unloadPlugin -] -*/ -typedef enum -{ - FMOD_PLUGINTYPE_OUTPUT, /* The plugin type is an output module. FMOD mixed audio will play through one of these devices */ - FMOD_PLUGINTYPE_CODEC, /* The plugin type is a file format codec. FMOD will use these codecs to load file formats for playback. */ - FMOD_PLUGINTYPE_DSP, /* The plugin type is a DSP unit. FMOD will use these plugins as part of its DSP network to apply effects to output or generate sound in realtime. */ - - FMOD_PLUGINTYPE_MAX, /* Maximum number of plugin types supported. */ - FMOD_PLUGINTYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_PLUGINTYPE; - - -/* -[DEFINE] -[ - [NAME] - FMOD_INITFLAGS - - [DESCRIPTION] - Initialization flags. Use them with System::init in the flags parameter to change various behavior. - - [REMARKS] - Use System::setAdvancedSettings to adjust settings for some of the features that are enabled by these flags. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::init - System::update - System::setAdvancedSettings - Channel::set3DOcclusion -] -*/ -#define FMOD_INIT_NORMAL 0x00000000 /* All platforms - Initialize normally */ -#define FMOD_INIT_STREAM_FROM_UPDATE 0x00000001 /* All platforms - No stream thread is created internally. Streams are driven from System::update. Mainly used with non-realtime outputs. */ -#define FMOD_INIT_3D_RIGHTHANDED 0x00000002 /* All platforms - FMOD will treat +X as right, +Y as up and +Z as backwards (towards you). */ -#define FMOD_INIT_SOFTWARE_DISABLE 0x00000004 /* All platforms - Disable software mixer to save memory. Anything created with FMOD_SOFTWARE will fail and DSP will not work. */ -#define FMOD_INIT_OCCLUSION_LOWPASS 0x00000008 /* All platforms - All FMOD_SOFTWARE (and FMOD_HARDWARE on 3DS and NGP) with FMOD_3D based voices will add a software lowpass filter effect into the DSP chain which is automatically used when Channel::set3DOcclusion is used or the geometry API. */ -#define FMOD_INIT_HRTF_LOWPASS 0x00000010 /* All platforms - All FMOD_SOFTWARE (and FMOD_HARDWARE on 3DS and NGP) with FMOD_3D based voices will add a software lowpass filter effect into the DSP chain which causes sounds to sound duller when the sound goes behind the listener. Use System::setAdvancedSettings to adjust cutoff frequency. */ -#define FMOD_INIT_DISTANCE_FILTERING 0x00000200 /* All platforms - All FMOD_SOFTWARE with FMOD_3D based voices will add a software lowpass and highpass filter effect into the DSP chain which will act as a distance-automated bandpass filter. Use System::setAdvancedSettings to adjust the center frequency. */ -#define FMOD_INIT_REVERB_PREALLOCBUFFERS 0x00000040 /* All platforms - FMOD Software reverb will preallocate enough buffers for reverb per channel, rather than allocating them and freeing them at runtime. */ -#define FMOD_INIT_ENABLE_PROFILE 0x00000020 /* All platforms - Enable TCP/IP based host which allows FMOD Designer or FMOD Profiler to connect to it, and view memory, CPU and the DSP network graph in real-time. */ -#define FMOD_INIT_VOL0_BECOMES_VIRTUAL 0x00000080 /* All platforms - Any sounds that are 0 volume will go virtual and not be processed except for having their positions updated virtually. Use System::setAdvancedSettings to adjust what volume besides zero to switch to virtual at. */ -#define FMOD_INIT_WASAPI_EXCLUSIVE 0x00000100 /* Win32 Vista only - for WASAPI output - Enable exclusive access to hardware, lower latency at the expense of excluding other applications from accessing the audio hardware. */ -#define FMOD_INIT_PS3_PREFERDTS 0x00800000 /* PS3 only - Prefer DTS over Dolby Digital if both are supported. Note: 8 and 6 channel LPCM is always preferred over both DTS and Dolby Digital. */ -#define FMOD_INIT_PS3_FORCE2CHLPCM 0x01000000 /* PS3 only - Force PS3 system output mode to 2 channel LPCM. */ -#define FMOD_INIT_DISABLEDOLBY 0x00100000 /* Wii / 3DS - Disable Dolby Pro Logic surround. Speakermode will be set to STEREO even if user has selected surround in the system settings. */ -#define FMOD_INIT_SYSTEM_MUSICMUTENOTPAUSE 0x00200000 /* Xbox 360 / PS3 - The "music" channelgroup which by default pauses when custom 360 dashboard / PS3 BGM music is played, can be changed to mute (therefore continues playing) instead of pausing, by using this flag. */ -#define FMOD_INIT_SYNCMIXERWITHUPDATE 0x00400000 /* Win32/Wii/PS3/Xbox/Xbox 360 - FMOD Mixer thread is woken up to do a mix when System::update is called rather than waking periodically on its own timer. */ -#define FMOD_INIT_GEOMETRY_USECLOSEST 0x04000000 /* All platforms - With the geometry engine, only process the closest polygon rather than accumulating all polygons the sound to listener line intersects. */ -#define FMOD_INIT_DISABLE_MYEARS_AUTODETECT 0x08000000 /* Win32 - Disables automatic setting of FMOD_SPEAKERMODE_STEREO to FMOD_SPEAKERMODE_MYEARS if the MyEars profile exists on the PC. MyEars is HRTF 7.1 downmixing through headphones. */ -#define FMOD_INIT_PS3_DISABLEDTS 0x10000000 /* PS3 only - Disable DTS output mode selection */ -#define FMOD_INIT_PS3_DISABLEDOLBYDIGITAL 0x20000000 /* PS3 only - Disable Dolby Digital output mode selection */ -/* [DEFINE_END] */ - - -/* -[ENUM] -[ - [DESCRIPTION] - These definitions describe the type of song being played. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Sound::getFormat -] -*/ -typedef enum -{ - FMOD_SOUND_TYPE_UNKNOWN, /* 3rd party / unknown plugin format. */ - FMOD_SOUND_TYPE_AIFF, /* AIFF. */ - FMOD_SOUND_TYPE_ASF, /* Microsoft Advanced Systems Format (ie WMA/ASF/WMV). */ - FMOD_SOUND_TYPE_AT3, /* Sony ATRAC 3 format */ - FMOD_SOUND_TYPE_CDDA, /* Digital CD audio. */ - FMOD_SOUND_TYPE_DLS, /* Sound font / downloadable sound bank. */ - FMOD_SOUND_TYPE_FLAC, /* FLAC lossless codec. */ - FMOD_SOUND_TYPE_FSB, /* FMOD Sample Bank. */ - FMOD_SOUND_TYPE_GCADPCM, /* Nintendo GameCube/Wii ADPCM */ - FMOD_SOUND_TYPE_IT, /* Impulse Tracker. */ - FMOD_SOUND_TYPE_MIDI, /* MIDI. extracodecdata is a pointer to an FMOD_MIDI_EXTRACODECDATA structure. */ - FMOD_SOUND_TYPE_MOD, /* Protracker / Fasttracker MOD. */ - FMOD_SOUND_TYPE_MPEG, /* MP2/MP3 MPEG. */ - FMOD_SOUND_TYPE_OGGVORBIS, /* Ogg vorbis. */ - FMOD_SOUND_TYPE_PLAYLIST, /* Information only from ASX/PLS/M3U/WAX playlists */ - FMOD_SOUND_TYPE_RAW, /* Raw PCM data. */ - FMOD_SOUND_TYPE_S3M, /* ScreamTracker 3. */ - FMOD_SOUND_TYPE_SF2, /* Sound font 2 format. */ - FMOD_SOUND_TYPE_USER, /* User created sound. */ - FMOD_SOUND_TYPE_WAV, /* Microsoft WAV. */ - FMOD_SOUND_TYPE_XM, /* FastTracker 2 XM. */ - FMOD_SOUND_TYPE_XMA, /* Xbox360 XMA */ - FMOD_SOUND_TYPE_VAG, /* PlayStation Portable ADPCM VAG format. */ - FMOD_SOUND_TYPE_AUDIOQUEUE, /* iPhone hardware decoder, supports AAC, ALAC and MP3. extracodecdata is a pointer to an FMOD_AUDIOQUEUE_EXTRACODECDATA structure. */ - FMOD_SOUND_TYPE_XWMA, /* Xbox360 XWMA */ - FMOD_SOUND_TYPE_BCWAV, /* 3DS BCWAV container format for DSP ADPCM and PCM */ - FMOD_SOUND_TYPE_AT9, /* NGP ATRAC 9 format */ - FMOD_SOUND_TYPE_VORBIS, /* Raw vorbis */ - FMOD_SOUND_TYPE_MEDIA_FOUNDATION,/* Microsoft Media Foundation wrappers, supports ASF/WMA */ - - FMOD_SOUND_TYPE_MAX, /* Maximum number of sound types supported. */ - FMOD_SOUND_TYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_SOUND_TYPE; - - -/* -[ENUM] -[ - [DESCRIPTION] - These definitions describe the native format of the hardware or software buffer that will be used. - - [REMARKS] - This is the format the native hardware or software buffer will be or is created in. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::createSound - Sound::getFormat -] -*/ -typedef enum -{ - FMOD_SOUND_FORMAT_NONE, /* Unitialized / unknown. */ - FMOD_SOUND_FORMAT_PCM8, /* 8bit integer PCM data. */ - FMOD_SOUND_FORMAT_PCM16, /* 16bit integer PCM data. */ - FMOD_SOUND_FORMAT_PCM24, /* 24bit integer PCM data. */ - FMOD_SOUND_FORMAT_PCM32, /* 32bit integer PCM data. */ - FMOD_SOUND_FORMAT_PCMFLOAT, /* 32bit floating point PCM data. */ - FMOD_SOUND_FORMAT_GCADPCM, /* Compressed Nintendo 3DS/Wii DSP data. */ - FMOD_SOUND_FORMAT_IMAADPCM, /* Compressed IMA ADPCM data. */ - FMOD_SOUND_FORMAT_VAG, /* Compressed PlayStation Portable ADPCM data. */ - FMOD_SOUND_FORMAT_HEVAG, /* Compressed PSVita ADPCM data. */ - FMOD_SOUND_FORMAT_XMA, /* Compressed Xbox360 XMA data. */ - FMOD_SOUND_FORMAT_MPEG, /* Compressed MPEG layer 2 or 3 data. */ - FMOD_SOUND_FORMAT_CELT, /* Compressed CELT data. */ - FMOD_SOUND_FORMAT_AT9, /* Compressed PSVita ATRAC9 data. */ - FMOD_SOUND_FORMAT_XWMA, /* Compressed Xbox360 xWMA data. */ - FMOD_SOUND_FORMAT_VORBIS, /* Compressed Vorbis data. */ - - FMOD_SOUND_FORMAT_MAX, /* Maximum number of sound formats supported. */ - FMOD_SOUND_FORMAT_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_SOUND_FORMAT; - - -/* -[DEFINE] -[ - [NAME] - FMOD_MODE - - [DESCRIPTION] - Sound description bitfields, bitwise OR them together for loading and describing sounds. - - [REMARKS] - By default a sound will open as a static sound that is decompressed fully into memory to PCM. (ie equivalent of FMOD_CREATESAMPLE) - To have a sound stream instead, use FMOD_CREATESTREAM, or use the wrapper function System::createStream. - Some opening modes (ie FMOD_OPENUSER, FMOD_OPENMEMORY, FMOD_OPENMEMORY_POINT, FMOD_OPENRAW) will need extra information. - This can be provided using the FMOD_CREATESOUNDEXINFO structure. - - Specifying FMOD_OPENMEMORY_POINT will POINT to your memory rather allocating its own sound buffers and duplicating it internally. - This means you cannot free the memory while FMOD is using it, until after Sound::release is called. - With FMOD_OPENMEMORY_POINT, for PCM formats, only WAV, FSB, and RAW are supported. For compressed formats, only those formats supported by FMOD_CREATECOMPRESSEDSAMPLE are supported. - With FMOD_OPENMEMORY_POINT and FMOD_OPENRAW or PCM, if using them together, note that you must pad the data on each side by 16 bytes. This is so fmod can modify the ends of the data for looping/interpolation/mixing purposes. If a wav file, you will need to insert silence, and then reset loop points to stop the playback from playing that silence. - With FMOD_OPENMEMORY_POINT, For Wii/PSP FMOD_HARDWARE supports this flag for the GCADPCM/VAG formats. On other platforms FMOD_SOFTWARE must be used. - - Xbox 360 memory On Xbox 360 Specifying FMOD_OPENMEMORY_POINT to a virtual memory address will cause FMOD_ERR_INVALID_ADDRESS - to be returned. Use physical memory only for this functionality. - - FMOD_LOWMEM is used on a sound if you want to minimize the memory overhead, by having FMOD not allocate memory for certain - features that are not likely to be used in a game environment. These are : - 1. Sound::getName functionality is removed. 256 bytes per sound is saved. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::createSound - System::createStream - Sound::setMode - Sound::getMode - Channel::setMode - Channel::getMode - Sound::set3DCustomRolloff - Channel::set3DCustomRolloff - Sound::getOpenState -] -*/ -#define FMOD_DEFAULT 0x00000000 /* Default for all modes listed below. FMOD_LOOP_OFF, FMOD_2D, FMOD_HARDWARE */ -#define FMOD_LOOP_OFF 0x00000001 /* For non looping sounds. (DEFAULT). Overrides FMOD_LOOP_NORMAL / FMOD_LOOP_BIDI. */ -#define FMOD_LOOP_NORMAL 0x00000002 /* For forward looping sounds. */ -#define FMOD_LOOP_BIDI 0x00000004 /* For bidirectional looping sounds. (only works on software mixed static sounds). */ -#define FMOD_2D 0x00000008 /* Ignores any 3d processing. (DEFAULT). */ -#define FMOD_3D 0x00000010 /* Makes the sound positionable in 3D. Overrides FMOD_2D. */ -#define FMOD_HARDWARE 0x00000020 /* Attempts to make sounds use hardware acceleration. (DEFAULT). Note on platforms that don't support FMOD_HARDWARE (only 3DS, PS Vita, PSP, Wii and Wii U support FMOD_HARDWARE), this will be internally treated as FMOD_SOFTWARE. */ -#define FMOD_SOFTWARE 0x00000040 /* Makes the sound be mixed by the FMOD CPU based software mixer. Overrides FMOD_HARDWARE. Use this for FFT, DSP, compressed sample support, 2D multi-speaker support and other software related features. */ -#define FMOD_CREATESTREAM 0x00000080 /* Decompress at runtime, streaming from the source provided (ie from disk). Overrides FMOD_CREATESAMPLE and FMOD_CREATECOMPRESSEDSAMPLE. Note a stream can only be played once at a time due to a stream only having 1 stream buffer and file handle. Open multiple streams to have them play concurrently. */ -#define FMOD_CREATESAMPLE 0x00000100 /* Decompress at loadtime, decompressing or decoding whole file into memory as the target sample format (ie PCM). Fastest for FMOD_SOFTWARE based playback and most flexible. */ -#define FMOD_CREATECOMPRESSEDSAMPLE 0x00000200 /* Load MP2, MP3, IMAADPCM or XMA into memory and leave it compressed. During playback the FMOD software mixer will decode it in realtime as a 'compressed sample'. Can only be used in combination with FMOD_SOFTWARE. Overrides FMOD_CREATESAMPLE. If the sound data is not ADPCM, MPEG or XMA it will behave as if it was created with FMOD_CREATESAMPLE and decode the sound into PCM. */ -#define FMOD_OPENUSER 0x00000400 /* Opens a user created static sample or stream. Use FMOD_CREATESOUNDEXINFO to specify format and/or read callbacks. If a user created 'sample' is created with no read callback, the sample will be empty. Use Sound::lock and Sound::unlock to place sound data into the sound if this is the case. */ -#define FMOD_OPENMEMORY 0x00000800 /* "name_or_data" will be interpreted as a pointer to memory instead of filename for creating sounds. Use FMOD_CREATESOUNDEXINFO to specify length. If used with FMOD_CREATESAMPLE or FMOD_CREATECOMPRESSEDSAMPLE, FMOD duplicates the memory into its own buffers. Your own buffer can be freed after open. If used with FMOD_CREATESTREAM, FMOD will stream out of the buffer whose pointer you passed in. In this case, your own buffer should not be freed until you have finished with and released the stream.*/ -#define FMOD_OPENMEMORY_POINT 0x10000000 /* "name_or_data" will be interpreted as a pointer to memory instead of filename for creating sounds. Use FMOD_CREATESOUNDEXINFO to specify length. This differs to FMOD_OPENMEMORY in that it uses the memory as is, without duplicating the memory into its own buffers. For Wii/PSP FMOD_HARDWARE supports this flag for the GCADPCM/VAG formats. On other platforms FMOD_SOFTWARE must be used, as sound hardware on the other platforms (ie PC) cannot access main ram. Cannot be freed after open, only after Sound::release. Will not work if the data is compressed and FMOD_CREATECOMPRESSEDSAMPLE is not used. */ -#define FMOD_OPENRAW 0x00001000 /* Will ignore file format and treat as raw pcm. Use FMOD_CREATESOUNDEXINFO to specify format. Requires at least defaultfrequency, numchannels and format to be specified before it will open. Must be little endian data. */ -#define FMOD_OPENONLY 0x00002000 /* Just open the file, dont prebuffer or read. Good for fast opens for info, or when sound::readData is to be used. */ -#define FMOD_ACCURATETIME 0x00004000 /* For System::createSound - for accurate Sound::getLength/Channel::setPosition on VBR MP3, and MOD/S3M/XM/IT/MIDI files. Scans file first, so takes longer to open. FMOD_OPENONLY does not affect this. */ -#define FMOD_MPEGSEARCH 0x00008000 /* For corrupted / bad MP3 files. This will search all the way through the file until it hits a valid MPEG header. Normally only searches for 4k. */ -#define FMOD_NONBLOCKING 0x00010000 /* For opening sounds and getting streamed subsounds (seeking) asyncronously. Use Sound::getOpenState to poll the state of the sound as it opens or retrieves the subsound in the background. */ -#define FMOD_UNIQUE 0x00020000 /* Unique sound, can only be played one at a time */ -#define FMOD_3D_HEADRELATIVE 0x00040000 /* Make the sound's position, velocity and orientation relative to the listener. */ -#define FMOD_3D_WORLDRELATIVE 0x00080000 /* Make the sound's position, velocity and orientation absolute (relative to the world). (DEFAULT) */ -#define FMOD_3D_INVERSEROLLOFF 0x00100000 /* This sound will follow the inverse rolloff model where mindistance = full volume, maxdistance = where sound stops attenuating, and rolloff is fixed according to the global rolloff factor. (DEFAULT) */ -#define FMOD_3D_LINEARROLLOFF 0x00200000 /* This sound will follow a linear rolloff model where mindistance = full volume, maxdistance = silence. Rolloffscale is ignored. */ -#define FMOD_3D_LINEARSQUAREROLLOFF 0x00400000 /* This sound will follow a linear-square rolloff model where mindistance = full volume, maxdistance = silence. Rolloffscale is ignored. */ -#define FMOD_3D_CUSTOMROLLOFF 0x04000000 /* This sound will follow a rolloff model defined by Sound::set3DCustomRolloff / Channel::set3DCustomRolloff. */ -#define FMOD_3D_IGNOREGEOMETRY 0x40000000 /* Is not affect by geometry occlusion. If not specified in Sound::setMode, or Channel::setMode, the flag is cleared and it is affected by geometry again. */ -#define FMOD_UNICODE 0x01000000 /* Filename is double-byte unicode. */ -#define FMOD_IGNORETAGS 0x02000000 /* Skips id3v2/asf/etc tag checks when opening a sound, to reduce seek/read overhead when opening files (helps with CD performance). */ -#define FMOD_LOWMEM 0x08000000 /* Removes some features from samples to give a lower memory overhead, like Sound::getName. See remarks. */ -#define FMOD_LOADSECONDARYRAM 0x20000000 /* Load sound into the secondary RAM of supported platform. On PS3, sounds will be loaded into RSX/VRAM. */ -#define FMOD_VIRTUAL_PLAYFROMSTART 0x80000000 /* For sounds that start virtual (due to being quiet or low importance), instead of swapping back to audible, and playing at the correct offset according to time, this flag makes the sound play from the start. */ - -/* [DEFINE_END] */ - - -/* -[ENUM] -[ - [DESCRIPTION] - These values describe what state a sound is in after FMOD_NONBLOCKING has been used to open it. - - [REMARKS] - With streams, if you are using FMOD_NONBLOCKING, note that if the user calls Sound::getSubSound, a stream will go into FMOD_OPENSTATE_SEEKING state and sound related commands will return FMOD_ERR_NOTREADY. - With streams, if you are using FMOD_NONBLOCKING, note that if the user calls Channel::getPosition, a stream will go into FMOD_OPENSTATE_SETPOSITION state and sound related commands will return FMOD_ERR_NOTREADY. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Sound::getOpenState - FMOD_MODE -] -*/ -typedef enum -{ - FMOD_OPENSTATE_READY = 0, /* Opened and ready to play. */ - FMOD_OPENSTATE_LOADING, /* Initial load in progress. */ - FMOD_OPENSTATE_ERROR, /* Failed to open - file not found, out of memory etc. See return value of Sound::getOpenState for what happened. */ - FMOD_OPENSTATE_CONNECTING, /* Connecting to remote host (internet sounds only). */ - FMOD_OPENSTATE_BUFFERING, /* Buffering data. */ - FMOD_OPENSTATE_SEEKING, /* Seeking to subsound and re-flushing stream buffer. */ - FMOD_OPENSTATE_PLAYING, /* Ready and playing, but not possible to release at this time without stalling the main thread. */ - FMOD_OPENSTATE_SETPOSITION, /* Seeking within a stream to a different position. */ - - FMOD_OPENSTATE_MAX, /* Maximum number of open state types. */ - FMOD_OPENSTATE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_OPENSTATE; - - -/* -[ENUM] -[ - [DESCRIPTION] - These flags are used with SoundGroup::setMaxAudibleBehavior to determine what happens when more sounds - are played than are specified with SoundGroup::setMaxAudible. - - [REMARKS] - When using FMOD_SOUNDGROUP_BEHAVIOR_MUTE, SoundGroup::setMuteFadeSpeed can be used to stop a sudden transition. - Instead, the time specified will be used to cross fade between the sounds that go silent and the ones that become audible. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - SoundGroup::setMaxAudibleBehavior - SoundGroup::getMaxAudibleBehavior - SoundGroup::setMaxAudible - SoundGroup::getMaxAudible - SoundGroup::setMuteFadeSpeed - SoundGroup::getMuteFadeSpeed -] -*/ -typedef enum -{ - FMOD_SOUNDGROUP_BEHAVIOR_FAIL, /* Any sound played that puts the sound count over the SoundGroup::setMaxAudible setting, will simply fail during System::playSound. */ - FMOD_SOUNDGROUP_BEHAVIOR_MUTE, /* Any sound played that puts the sound count over the SoundGroup::setMaxAudible setting, will be silent, then if another sound in the group stops the sound that was silent before becomes audible again. */ - FMOD_SOUNDGROUP_BEHAVIOR_STEALLOWEST, /* Any sound played that puts the sound count over the SoundGroup::setMaxAudible setting, will steal the quietest / least important sound playing in the group. */ - - FMOD_SOUNDGROUP_BEHAVIOR_MAX, /* Maximum number of open state types. */ - FMOD_SOUNDGROUP_BEHAVIOR_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_SOUNDGROUP_BEHAVIOR; - - -/* -[ENUM] -[ - [DESCRIPTION] - These callback types are used with Channel::setCallback. - - [REMARKS] - Each callback has commanddata parameters passed as int unique to the type of callback. - See reference to FMOD_CHANNEL_CALLBACK to determine what they might mean for each type of callback. - - Note! Currently the user must call System::update for these callbacks to trigger! - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Channel::setCallback - FMOD_CHANNEL_CALLBACK - System::update -] -*/ -typedef enum -{ - FMOD_CHANNEL_CALLBACKTYPE_END, /* Called when a sound ends. */ - FMOD_CHANNEL_CALLBACKTYPE_VIRTUALVOICE, /* Called when a voice is swapped out or swapped in. */ - FMOD_CHANNEL_CALLBACKTYPE_SYNCPOINT, /* Called when a syncpoint is encountered. Can be from wav file markers. */ - FMOD_CHANNEL_CALLBACKTYPE_OCCLUSION, /* Called when the channel has its geometry occlusion value calculated. Can be used to clamp or change the value. */ - - FMOD_CHANNEL_CALLBACKTYPE_MAX, /* Maximum number of callback types supported. */ - FMOD_CHANNEL_CALLBACKTYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_CHANNEL_CALLBACKTYPE; - - -/* -[ENUM] -[ - [DESCRIPTION] - These callback types are used with System::setCallback. - - [REMARKS] - Each callback has commanddata parameters passed as void* unique to the type of callback. - See reference to FMOD_SYSTEM_CALLBACK to determine what they might mean for each type of callback. - - Note! Using FMOD_SYSTEM_CALLBACKTYPE_DEVICELISTCHANGED (on Mac only) requires the application to be running an event loop which will allow external changes to device list to be detected by FMOD. - - Note! The 'system' object pointer will be null for FMOD_SYSTEM_CALLBACKTYPE_THREADCREATED and FMOD_SYSTEM_CALLBACKTYPE_MEMORYALLOCATIONFAILED callbacks. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::setCallback - FMOD_SYSTEM_CALLBACK - System::update - DSP::addInput -] -*/ -typedef enum -{ - FMOD_SYSTEM_CALLBACKTYPE_DEVICELISTCHANGED, /* Called from System::update when the enumerated list of devices has changed. */ - FMOD_SYSTEM_CALLBACKTYPE_DEVICELOST, /* Called from System::update when an output device has been lost due to control panel parameter changes and FMOD cannot automatically recover. */ - FMOD_SYSTEM_CALLBACKTYPE_MEMORYALLOCATIONFAILED, /* Called directly when a memory allocation fails somewhere in FMOD. (NOTE - 'system' will be NULL in this callback type.)*/ - FMOD_SYSTEM_CALLBACKTYPE_THREADCREATED, /* Called directly when a thread is created. (NOTE - 'system' will be NULL in this callback type.) */ - FMOD_SYSTEM_CALLBACKTYPE_BADDSPCONNECTION, /* Called when a bad connection was made with DSP::addInput. Usually called from mixer thread because that is where the connections are made. */ - FMOD_SYSTEM_CALLBACKTYPE_BADDSPLEVEL, /* Called when too many effects were added exceeding the maximum tree depth of 128. This is most likely caused by accidentally adding too many DSP effects. Usually called from mixer thread because that is where the connections are made. */ - - FMOD_SYSTEM_CALLBACKTYPE_MAX, /* Maximum number of callback types supported. */ - FMOD_SYSTEM_CALLBACKTYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_SYSTEM_CALLBACKTYPE; - - -/* - FMOD Callbacks -*/ -typedef FMOD_RESULT (F_CALLBACK *FMOD_SYSTEM_CALLBACK) (FMOD_SYSTEM *system, FMOD_SYSTEM_CALLBACKTYPE type, void *commanddata1, void *commanddata2); - -typedef FMOD_RESULT (F_CALLBACK *FMOD_CHANNEL_CALLBACK) (FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, void *commanddata1, void *commanddata2); - -typedef FMOD_RESULT (F_CALLBACK *FMOD_SOUND_NONBLOCKCALLBACK)(FMOD_SOUND *sound, FMOD_RESULT result); -typedef FMOD_RESULT (F_CALLBACK *FMOD_SOUND_PCMREADCALLBACK)(FMOD_SOUND *sound, void *data, unsigned int datalen); -typedef FMOD_RESULT (F_CALLBACK *FMOD_SOUND_PCMSETPOSCALLBACK)(FMOD_SOUND *sound, int subsound, unsigned int position, FMOD_TIMEUNIT postype); - -typedef FMOD_RESULT (F_CALLBACK *FMOD_FILE_OPENCALLBACK) (const char *name, int unicode, unsigned int *filesize, void **handle, void **userdata); -typedef FMOD_RESULT (F_CALLBACK *FMOD_FILE_CLOSECALLBACK) (void *handle, void *userdata); -typedef FMOD_RESULT (F_CALLBACK *FMOD_FILE_READCALLBACK) (void *handle, void *buffer, unsigned int sizebytes, unsigned int *bytesread, void *userdata); -typedef FMOD_RESULT (F_CALLBACK *FMOD_FILE_SEEKCALLBACK) (void *handle, unsigned int pos, void *userdata); -typedef FMOD_RESULT (F_CALLBACK *FMOD_FILE_ASYNCREADCALLBACK)(FMOD_ASYNCREADINFO *info, void *userdata); -typedef FMOD_RESULT (F_CALLBACK *FMOD_FILE_ASYNCCANCELCALLBACK)(void *handle, void *userdata); - -typedef void * (F_CALLBACK *FMOD_MEMORY_ALLOCCALLBACK) (unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr); -typedef void * (F_CALLBACK *FMOD_MEMORY_REALLOCCALLBACK)(void *ptr, unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr); -typedef void (F_CALLBACK *FMOD_MEMORY_FREECALLBACK) (void *ptr, FMOD_MEMORY_TYPE type, const char *sourcestr); - -typedef float (F_CALLBACK *FMOD_3D_ROLLOFFCALLBACK) (FMOD_CHANNEL *channel, float distance); - - -/* -[ENUM] -[ - [DESCRIPTION] - List of windowing methods used in spectrum analysis to reduce leakage / transient signals intefering with the analysis. - This is a problem with analysis of continuous signals that only have a small portion of the signal sample (the fft window size). - Windowing the signal with a curve or triangle tapers the sides of the fft window to help alleviate this problem. - - [REMARKS] - Cyclic signals such as a sine wave that repeat their cycle in a multiple of the window size do not need windowing. - I.e. If the sine wave repeats every 1024, 512, 256 etc samples and the FMOD fft window is 1024, then the signal would not need windowing. - Not windowing is the same as FMOD_DSP_FFT_WINDOW_RECT, which is the default. - If the cycle of the signal (ie the sine wave) is not a multiple of the window size, it will cause frequency abnormalities, so a different windowing method is needed. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::getSpectrum - Channel::getSpectrum -] -*/ -typedef enum -{ - FMOD_DSP_FFT_WINDOW_RECT, /* w[n] = 1.0 */ - FMOD_DSP_FFT_WINDOW_TRIANGLE, /* w[n] = TRI(2n/N) */ - FMOD_DSP_FFT_WINDOW_HAMMING, /* w[n] = 0.54 - (0.46 * COS(n/N) ) */ - FMOD_DSP_FFT_WINDOW_HANNING, /* w[n] = 0.5 * (1.0 - COS(n/N) ) */ - FMOD_DSP_FFT_WINDOW_BLACKMAN, /* w[n] = 0.42 - (0.5 * COS(n/N) ) + (0.08 * COS(2.0 * n/N) ) */ - FMOD_DSP_FFT_WINDOW_BLACKMANHARRIS, /* w[n] = 0.35875 - (0.48829 * COS(1.0 * n/N)) + (0.14128 * COS(2.0 * n/N)) - (0.01168 * COS(3.0 * n/N)) */ - - FMOD_DSP_FFT_WINDOW_MAX, /* Maximum number of FFT window types supported. */ - FMOD_DSP_FFT_WINDOW_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_DSP_FFT_WINDOW; - - -/* -[ENUM] -[ - [DESCRIPTION] - List of interpolation types that the FMOD Ex software mixer supports. - - [REMARKS] - The default resampler type is FMOD_DSP_RESAMPLER_LINEAR. - Use System::setSoftwareFormat to tell FMOD the resampling quality you require for FMOD_SOFTWARE based sounds. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::setSoftwareFormat - System::getSoftwareFormat -] -*/ -typedef enum -{ - FMOD_DSP_RESAMPLER_NOINTERP, /* No interpolation. High frequency aliasing hiss will be audible depending on the sample rate of the sound. */ - FMOD_DSP_RESAMPLER_LINEAR, /* Linear interpolation (default method). Fast and good quality, causes very slight lowpass effect on low frequency sounds. */ - FMOD_DSP_RESAMPLER_CUBIC, /* Cubic interpolation. Slower than linear interpolation but better quality. */ - FMOD_DSP_RESAMPLER_SPLINE, /* 5 point spline interpolation. Slowest resampling method but best quality. */ - - FMOD_DSP_RESAMPLER_MAX, /* Maximum number of resample methods supported. */ - FMOD_DSP_RESAMPLER_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_DSP_RESAMPLER; - - -/* -[ENUM] -[ - [DESCRIPTION] - List of tag types that could be stored within a sound. These include id3 tags, metadata from netstreams and vorbis/asf data. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Sound::getTag -] -*/ -typedef enum -{ - FMOD_TAGTYPE_UNKNOWN = 0, - FMOD_TAGTYPE_ID3V1, - FMOD_TAGTYPE_ID3V2, - FMOD_TAGTYPE_VORBISCOMMENT, - FMOD_TAGTYPE_SHOUTCAST, - FMOD_TAGTYPE_ICECAST, - FMOD_TAGTYPE_ASF, - FMOD_TAGTYPE_MIDI, - FMOD_TAGTYPE_PLAYLIST, - FMOD_TAGTYPE_FMOD, - FMOD_TAGTYPE_USER, - - FMOD_TAGTYPE_MAX, /* Maximum number of tag types supported. */ - FMOD_TAGTYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_TAGTYPE; - - -/* -[ENUM] -[ - [DESCRIPTION] - List of data types that can be returned by Sound::getTag - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Sound::getTag -] -*/ -typedef enum -{ - FMOD_TAGDATATYPE_BINARY = 0, - FMOD_TAGDATATYPE_INT, - FMOD_TAGDATATYPE_FLOAT, - FMOD_TAGDATATYPE_STRING, - FMOD_TAGDATATYPE_STRING_UTF16, - FMOD_TAGDATATYPE_STRING_UTF16BE, - FMOD_TAGDATATYPE_STRING_UTF8, - FMOD_TAGDATATYPE_CDTOC, - - FMOD_TAGDATATYPE_MAX, /* Maximum number of tag datatypes supported. */ - FMOD_TAGDATATYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_TAGDATATYPE; - - -/* -[ENUM] -[ - [DESCRIPTION] - Types of delay that can be used with Channel::setDelay / Channel::getDelay. - - [REMARKS] - If you haven't called Channel::setDelay yet, if you call Channel::getDelay with FMOD_DELAYTYPE_DSPCLOCK_START it will return the - equivalent global DSP clock value to determine when a channel started, so that you can use it for other channels to sync against. - - Use System::getDSPClock to also get the current dspclock time, a base for future calls to Channel::setDelay. - - Use FMOD_64BIT_ADD or FMOD_64BIT_SUB to add a hi/lo combination together and cope with wraparound. - - If FMOD_DELAYTYPE_END_MS is specified, the value is not treated as a 64 bit number, just the delayhi value is used and it is treated as milliseconds. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Channel::setDelay - Channel::getDelay - System::getDSPClock -] -*/ -typedef enum -{ - FMOD_DELAYTYPE_END_MS, /* Delay at the end of the sound in milliseconds. Use delayhi only. Channel::isPlaying will remain true until this delay has passed even though the sound itself has stopped playing.*/ - FMOD_DELAYTYPE_DSPCLOCK_START, /* Time the sound started if Channel::getDelay is used, or if Channel::setDelay is used, the sound will delay playing until this exact tick. */ - FMOD_DELAYTYPE_DSPCLOCK_END, /* Time the sound should end. If this is non-zero, the channel will go silent at this exact tick. */ - FMOD_DELAYTYPE_DSPCLOCK_PAUSE, /* Time the sound should pause. If this is non-zero, the channel will pause at this exact tick. */ - - FMOD_DELAYTYPE_MAX, /* Maximum number of tag datatypes supported. */ - FMOD_DELAYTYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_DELAYTYPE; - - -#define FMOD_64BIT_ADD(_hi1, _lo1, _hi2, _lo2) _hi1 += ((_hi2) + ((((_lo1) + (_lo2)) < (_lo1)) ? 1 : 0)); (_lo1) += (_lo2); -#define FMOD_64BIT_SUB(_hi1, _lo1, _hi2, _lo2) _hi1 -= ((_hi2) + ((((_lo1) - (_lo2)) > (_lo1)) ? 1 : 0)); (_lo1) -= (_lo2); - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure describing a piece of tag data. - - [REMARKS] - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Sound::getTag - FMOD_TAGTYPE - FMOD_TAGDATATYPE -] -*/ -typedef struct FMOD_TAG -{ - FMOD_TAGTYPE type; /* [r] The type of this tag. */ - FMOD_TAGDATATYPE datatype; /* [r] The type of data that this tag contains */ - char *name; /* [r] The name of this tag i.e. "TITLE", "ARTIST" etc. */ - void *data; /* [r] Pointer to the tag data - its format is determined by the datatype member */ - unsigned int datalen; /* [r] Length of the data contained in this tag */ - FMOD_BOOL updated; /* [r] True if this tag has been updated since last being accessed with Sound::getTag */ -} FMOD_TAG; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure describing a CD/DVD table of contents - - [REMARKS] - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Sound::getTag -] -*/ -typedef struct FMOD_CDTOC -{ - int numtracks; /* [r] The number of tracks on the CD */ - int min[100]; /* [r] The start offset of each track in minutes */ - int sec[100]; /* [r] The start offset of each track in seconds */ - int frame[100]; /* [r] The start offset of each track in frames */ -} FMOD_CDTOC; - - -/* -[DEFINE] -[ - [NAME] - FMOD_TIMEUNIT - - [DESCRIPTION] - List of time types that can be returned by Sound::getLength and used with Channel::setPosition or Channel::getPosition. - - [REMARKS] - FMOD_TIMEUNIT_SENTENCE_MS, FMOD_TIMEUNIT_SENTENCE_PCM, FMOD_TIMEUNIT_SENTENCE_PCMBYTES, FMOD_TIMEUNIT_SENTENCE and FMOD_TIMEUNIT_SENTENCE_SUBSOUND are only supported by Channel functions. - Do not combine flags except FMOD_TIMEUNIT_BUFFERED. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Sound::getLength - Channel::setPosition - Channel::getPosition -] -*/ -#define FMOD_TIMEUNIT_MS 0x00000001 /* Milliseconds. */ -#define FMOD_TIMEUNIT_PCM 0x00000002 /* PCM samples, related to milliseconds * samplerate / 1000. */ -#define FMOD_TIMEUNIT_PCMBYTES 0x00000004 /* Bytes, related to PCM samples * channels * datawidth (ie 16bit = 2 bytes). */ -#define FMOD_TIMEUNIT_RAWBYTES 0x00000008 /* Raw file bytes of (compressed) sound data (does not include headers). Only used by Sound::getLength and Channel::getPosition. */ -#define FMOD_TIMEUNIT_PCMFRACTION 0x00000010 /* Fractions of 1 PCM sample. Unsigned int range 0 to 0xFFFFFFFF. Used for sub-sample granularity for DSP purposes. */ -#define FMOD_TIMEUNIT_MODORDER 0x00000100 /* MOD/S3M/XM/IT. Order in a sequenced module format. Use Sound::getFormat to determine the PCM format being decoded to. */ -#define FMOD_TIMEUNIT_MODROW 0x00000200 /* MOD/S3M/XM/IT. Current row in a sequenced module format. Sound::getLength will return the number of rows in the currently playing or seeked to pattern. */ -#define FMOD_TIMEUNIT_MODPATTERN 0x00000400 /* MOD/S3M/XM/IT. Current pattern in a sequenced module format. Sound::getLength will return the number of patterns in the song and Channel::getPosition will return the currently playing pattern. */ -#define FMOD_TIMEUNIT_SENTENCE_MS 0x00010000 /* Currently playing subsound in a sentence time in milliseconds. */ -#define FMOD_TIMEUNIT_SENTENCE_PCM 0x00020000 /* Currently playing subsound in a sentence time in PCM Samples, related to milliseconds * samplerate / 1000. */ -#define FMOD_TIMEUNIT_SENTENCE_PCMBYTES 0x00040000 /* Currently playing subsound in a sentence time in bytes, related to PCM samples * channels * datawidth (ie 16bit = 2 bytes). */ -#define FMOD_TIMEUNIT_SENTENCE 0x00080000 /* Currently playing sentence index according to the channel. */ -#define FMOD_TIMEUNIT_SENTENCE_SUBSOUND 0x00100000 /* Currently playing subsound index in a sentence. */ -#define FMOD_TIMEUNIT_BUFFERED 0x10000000 /* Time value as seen by buffered stream. This is always ahead of audible time, and is only used for processing. */ -/* [DEFINE_END] */ - - -/* -[ENUM] -[ - [DESCRIPTION] - When creating a multichannel sound, FMOD will pan them to their default speaker locations, for example a 6 channel sound will default to one channel per 5.1 output speaker. - Another example is a stereo sound. It will default to left = front left, right = front right. - - This is for sounds that are not 'default'. For example you might have a sound that is 6 channels but actually made up of 3 stereo pairs, that should all be located in front left, front right only. - - [REMARKS] - For full flexibility of speaker assignments, use Channel::setSpeakerLevels. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_CREATESOUNDEXINFO - Channel::setSpeakerLevels -] -*/ -typedef enum -{ - FMOD_SPEAKERMAPTYPE_DEFAULT, /* This is the default, and just means FMOD decides which speakers it puts the source channels. */ - FMOD_SPEAKERMAPTYPE_ALLMONO, /* This means the sound is made up of all mono sounds. All voices will be panned to the front center by default in this case. */ - FMOD_SPEAKERMAPTYPE_ALLSTEREO, /* This means the sound is made up of all stereo sounds. All voices will be panned to front left and front right alternating every second channel. */ - FMOD_SPEAKERMAPTYPE_51_PROTOOLS /* Map a 5.1 sound to use protools L C R Ls Rs LFE mapping. Will return an error if not a 6 channel sound. */ -} FMOD_SPEAKERMAPTYPE; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Use this structure with System::createSound when more control is needed over loading. - The possible reasons to use this with System::createSound are: - - Loading a file from memory. - - Loading a file from within another larger (possibly wad/pak) file, by giving the loader an offset and length. - - To create a user created / non file based sound. - - To specify a starting subsound to seek to within a multi-sample sounds (ie FSB/DLS/SF2) when created as a stream. - - To specify which subsounds to load for multi-sample sounds (ie FSB/DLS/SF2) so that memory is saved and only a subset is actually loaded/read from disk. - - To specify 'piggyback' read and seek callbacks for capture of sound data as fmod reads and decodes it. Useful for ripping decoded PCM data from sounds as they are loaded / played. - - To specify a MIDI DLS/SF2 sample set file to load when opening a MIDI file. - See below on what members to fill for each of the above types of sound you want to create. - - [REMARKS] - This structure is optional! Specify 0 or NULL in System::createSound if you don't need it! - - Loading a file from memory. - - Create the sound using the FMOD_OPENMEMORY flag. - - Mandatory. Specify 'length' for the size of the memory block in bytes. - - Other flags are optional. - - - Loading a file from within another larger (possibly wad/pak) file, by giving the loader an offset and length. - - Mandatory. Specify 'fileoffset' and 'length'. - - Other flags are optional. - - - To create a user created / non file based sound. - - Create the sound using the FMOD_OPENUSER flag. - - Mandatory. Specify 'defaultfrequency, 'numchannels' and 'format'. - - Other flags are optional. - - - To specify a starting subsound to seek to and flush with, within a multi-sample stream (ie FSB/DLS/SF2). - - - Mandatory. Specify 'initialsubsound'. - - - To specify which subsounds to load for multi-sample sounds (ie FSB/DLS/SF2) so that memory is saved and only a subset is actually loaded/read from disk. - - - Mandatory. Specify 'inclusionlist' and 'inclusionlistnum'. - - - To specify 'piggyback' read and seek callbacks for capture of sound data as fmod reads and decodes it. Useful for ripping decoded PCM data from sounds as they are loaded / played. - - - Mandatory. Specify 'pcmreadcallback' and 'pcmseekcallback'. - - - To specify a MIDI DLS/SF2 sample set file to load when opening a MIDI file. - - - Mandatory. Specify 'dlsname'. - - - Setting the 'decodebuffersize' is for cpu intensive codecs that may be causing stuttering, not file intensive codecs (ie those from CD or netstreams) which are normally - altered with System::setStreamBufferSize. As an example of cpu intensive codecs, an mp3 file will take more cpu to decode than a PCM wav file. - If you have a stuttering effect, then it is using more cpu than the decode buffer playback rate can keep up with. Increasing the decode buffersize will most likely solve this problem. - - - FSB codec. If inclusionlist and numsubsounds are used together, this will trigger a special mode where subsounds are shuffled down to save memory. (useful for large FSB - files where you only want to load 1 sound). There will be no gaps, ie no null subsounds. As an example, if there are 10,000 subsounds and there is an inclusionlist with only 1 entry, - and numsubsounds = 1, then subsound 0 will be that entry, and there will only be the memory allocated for 1 subsound. Previously there would still be 10,000 subsound pointers and other - associated codec entries allocated along with it multiplied by 10,000. - - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::createSound - System::setStreamBufferSize - FMOD_MODE - FMOD_SOUND_FORMAT - FMOD_SOUND_TYPE - FMOD_SPEAKERMAPTYPE -] -*/ -typedef struct FMOD_CREATESOUNDEXINFO -{ - int cbsize; /* [w] Size of this structure. This is used so the structure can be expanded in the future and still work on older versions of FMOD Ex. */ - unsigned int length; /* [w] Optional. Specify 0 to ignore. Size in bytes of file to load, or sound to create (in this case only if FMOD_OPENUSER is used). Required if loading from memory. If 0 is specified, then it will use the size of the file (unless loading from memory then an error will be returned). */ - unsigned int fileoffset; /* [w] Optional. Specify 0 to ignore. Offset from start of the file to start loading from. This is useful for loading files from inside big data files. */ - int numchannels; /* [w] Optional. Specify 0 to ignore. Number of channels in a sound mandatory if FMOD_OPENUSER or FMOD_OPENRAW is used. */ - int defaultfrequency; /* [w] Optional. Specify 0 to ignore. Default frequency of sound in a sound mandatory if FMOD_OPENUSER or FMOD_OPENRAW is used. Other formats use the frequency determined by the file format. */ - FMOD_SOUND_FORMAT format; /* [w] Optional. Specify 0 or FMOD_SOUND_FORMAT_NONE to ignore. Format of the sound mandatory if FMOD_OPENUSER or FMOD_OPENRAW is used. Other formats use the format determined by the file format. */ - unsigned int decodebuffersize; /* [w] Optional. Specify 0 to ignore. For streams. This determines the size of the double buffer (in PCM samples) that a stream uses. Use this for user created streams if you want to determine the size of the callback buffer passed to you. Specify 0 to use FMOD's default size which is currently equivalent to 400ms of the sound format created/loaded. */ - int initialsubsound; /* [w] Optional. Specify 0 to ignore. In a multi-sample file format such as .FSB/.DLS/.SF2, specify the initial subsound to seek to, only if FMOD_CREATESTREAM is used. */ - int numsubsounds; /* [w] Optional. Specify 0 to ignore or have no subsounds. In a sound created with FMOD_OPENUSER, specify the number of subsounds that are accessable with Sound::getSubSound. If not created with FMOD_OPENUSER, this will limit the number of subsounds loaded within a multi-subsound file. If using FSB, then if FMOD_CREATESOUNDEXINFO::inclusionlist is used, this will shuffle subsounds down so that there are not any gaps. It will mean that the indices of the sounds will be different. */ - int *inclusionlist; /* [w] Optional. Specify 0 to ignore. In a multi-sample format such as .FSB/.DLS/.SF2 it may be desirable to specify only a subset of sounds to be loaded out of the whole file. This is an array of subsound indices to load into memory when created. */ - int inclusionlistnum; /* [w] Optional. Specify 0 to ignore. This is the number of integers contained within the inclusionlist array. */ - FMOD_SOUND_PCMREADCALLBACK pcmreadcallback; /* [w] Optional. Specify 0 to ignore. Callback to 'piggyback' on FMOD's read functions and accept or even write PCM data while FMOD is opening the sound. Used for user sounds created with FMOD_OPENUSER or for capturing decoded data as FMOD reads it. */ - FMOD_SOUND_PCMSETPOSCALLBACK pcmsetposcallback; /* [w] Optional. Specify 0 to ignore. Callback for when the user calls a seeking function such as Channel::setTime or Channel::setPosition within a multi-sample sound, and for when it is opened.*/ - FMOD_SOUND_NONBLOCKCALLBACK nonblockcallback; /* [w] Optional. Specify 0 to ignore. Callback for successful completion, or error while loading a sound that used the FMOD_NONBLOCKING flag.*/ - const char *dlsname; /* [w] Optional. Specify 0 to ignore. Filename for a DLS or SF2 sample set when loading a MIDI file. If not specified, on Windows it will attempt to open /windows/system32/drivers/gm.dls or /windows/system32/drivers/etc/gm.dls, on Mac it will attempt to load /System/Library/Components/CoreAudio.component/Contents/Resources/gs_instruments.dls, otherwise the MIDI will fail to open. Current DLS support is for level 1 of the specification. */ - const char *encryptionkey; /* [w] Optional. Specify 0 to ignore. Key for encrypted FSB file. Without this key an encrypted FSB file will not load. */ - int maxpolyphony; /* [w] Optional. Specify 0 to ignore. For sequenced formats with dynamic channel allocation such as .MID and .IT, this specifies the maximum voice count allowed while playing. .IT defaults to 64. .MID defaults to 32. */ - void *userdata; /* [w] Optional. Specify 0 to ignore. This is user data to be attached to the sound during creation. Access via Sound::getUserData. Note: This is not passed to FMOD_FILE_OPENCALLBACK, that is a different userdata that is file specific. */ - FMOD_SOUND_TYPE suggestedsoundtype; /* [w] Optional. Specify 0 or FMOD_SOUND_TYPE_UNKNOWN to ignore. Instead of scanning all codec types, use this to speed up loading by making it jump straight to this codec. */ - FMOD_FILE_OPENCALLBACK useropen; /* [w] Optional. Specify 0 to ignore. Callback for opening this file. */ - FMOD_FILE_CLOSECALLBACK userclose; /* [w] Optional. Specify 0 to ignore. Callback for closing this file. */ - FMOD_FILE_READCALLBACK userread; /* [w] Optional. Specify 0 to ignore. Callback for reading from this file. */ - FMOD_FILE_SEEKCALLBACK userseek; /* [w] Optional. Specify 0 to ignore. Callback for seeking within this file. */ - FMOD_FILE_ASYNCREADCALLBACK userasyncread; /* [w] Optional. Specify 0 to ignore. Callback for seeking within this file. */ - FMOD_FILE_ASYNCCANCELCALLBACK userasynccancel; /* [w] Optional. Specify 0 to ignore. Callback for seeking within this file. */ - FMOD_SPEAKERMAPTYPE speakermap; /* [w] Optional. Specify 0 to ignore. Use this to differ the way fmod maps multichannel sounds to speakers. See FMOD_SPEAKERMAPTYPE for more. */ - FMOD_SOUNDGROUP *initialsoundgroup; /* [w] Optional. Specify 0 to ignore. Specify a sound group if required, to put sound in as it is created. */ - unsigned int initialseekposition;/* [w] Optional. Specify 0 to ignore. For streams. Specify an initial position to seek the stream to. */ - FMOD_TIMEUNIT initialseekpostype; /* [w] Optional. Specify 0 to ignore. For streams. Specify the time unit for the position set in initialseekposition. */ - int ignoresetfilesystem;/* [w] Optional. Specify 0 to ignore. Set to 1 to use fmod's built in file system. Ignores setFileSystem callbacks and also FMOD_CREATESOUNEXINFO file callbacks. Useful for specific cases where you don't want to use your own file system but want to use fmod's file system (ie net streaming). */ - int cddaforceaspi; /* [w] Optional. Specify 0 to ignore. For CDDA sounds only - if non-zero use ASPI instead of NTSCSI to access the specified CD/DVD device. */ - unsigned int audioqueuepolicy; /* [w] Optional. Specify 0 or FMOD_AUDIOQUEUE_CODECPOLICY_DEFAULT to ignore. Policy used to determine whether hardware or software is used for decoding, see FMOD_AUDIOQUEUE_CODECPOLICY for options (iOS >= 3.0 required, otherwise only hardware is available) */ - unsigned int minmidigranularity; /* [w] Optional. Specify 0 to ignore. Allows you to set a minimum desired MIDI mixer granularity. Values smaller than 512 give greater than default accuracy at the cost of more CPU and vice versa. Specify 0 for default (512 samples). */ - int nonblockthreadid; /* [w] Optional. Specify 0 to ignore. Specifies a thread index to execute non blocking load on. Allows for up to 5 threads to be used for loading at once. This is to avoid one load blocking another. Maximum value = 4. */ -} FMOD_CREATESOUNDEXINFO; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure defining a reverb environment. - - [REMARKS] - Note the default reverb properties are the same as the FMOD_PRESET_GENERIC preset. - Note that integer values that typically range from -10,000 to 1000 are represented in - decibels, and are of a logarithmic scale, not linear, wheras float values are always linear. - - The numerical values listed below are the maximum, minimum and default values for each variable respectively. - - SUPPORTED next to each parameter means the platform the parameter can be set on. Some platforms support all parameters and some don't. - WII means Nintendo Wii hardware reverb (must use FMOD_HARDWARE). - PSP means Playstation Portable hardware reverb (must use FMOD_HARDWARE). - SFX means FMOD SFX software reverb. This works on any platform that uses FMOD_SOFTWARE for loading sounds. - --- means unsupported/deprecated. Will either be removed or supported by SFX in the future. - - Nintendo Wii Notes: - This structure supports only limited parameters, and maps them to the Wii hardware reverb as follows. - DecayTime = 'time' - ReverbDelay = 'predelay' - ModulationDepth = 'damping' - Reflections = 'coloration' - EnvDiffusion = 'crosstalk' - Room = 'mix' - - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - Members marked with [r/w] are either read or write depending on if you are using System::setReverbProperties (w) or System::getReverbProperties (r). - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::setReverbProperties - System::getReverbProperties - FMOD_REVERB_PRESETS - FMOD_REVERB_FLAGS -] -*/ -typedef struct FMOD_REVERB_PROPERTIES -{ /* MIN MAX DEFAULT DESCRIPTION */ - int Instance; /* [w] 0 3 0 Environment Instance. (SUPPORTED:SFX(4 instances) and Wii (3 instances)) */ - int Environment; /* [r/w] -1 25 -1 Sets all listener properties. -1 = OFF. (SUPPORTED:SFX(-1 only)/PSP) */ - float EnvDiffusion; /* [r/w] 0.0 1.0 1.0 Environment diffusion (SUPPORTED:WII) */ - int Room; /* [r/w] -10000 0 -1000 Room effect level (at mid frequencies) (SUPPORTED:SFX/WII/PSP) */ - int RoomHF; /* [r/w] -10000 0 -100 Relative room effect level at high frequencies (SUPPORTED:SFX) */ - int RoomLF; /* [r/w] -10000 0 0 Relative room effect level at low frequencies (SUPPORTED:SFX) */ - float DecayTime; /* [r/w] 0.1 20.0 1.49 Reverberation decay time at mid frequencies (SUPPORTED:SFX/WII) */ - float DecayHFRatio; /* [r/w] 0.1 2.0 0.83 High-frequency to mid-frequency decay time ratio (SUPPORTED:SFX) */ - float DecayLFRatio; /* [r/w] 0.1 2.0 1.0 Low-frequency to mid-frequency decay time ratio (SUPPORTED:---) */ - int Reflections; /* [r/w] -10000 1000 -2602 Early reflections level relative to room effect (SUPPORTED:SFX/WII) */ - float ReflectionsDelay; /* [r/w] 0.0 0.3 0.007 Initial reflection delay time (SUPPORTED:SFX) */ - int Reverb; /* [r/w] -10000 2000 200 Late reverberation level relative to room effect (SUPPORTED:SFX) */ - float ReverbDelay; /* [r/w] 0.0 0.1 0.011 Late reverberation delay time relative to initial reflection (SUPPORTED:SFX/WII) */ - float ModulationTime; /* [r/w] 0.04 4.0 0.25 Modulation time (SUPPORTED:---) */ - float ModulationDepth; /* [r/w] 0.0 1.0 0.0 Modulation depth (SUPPORTED:WII) */ - float HFReference; /* [r/w] 20.0 20000.0 5000.0 Reference high frequency (hz) (SUPPORTED:SFX) */ - float LFReference; /* [r/w] 20.0 1000.0 250.0 Reference low frequency (hz) (SUPPORTED:SFX) */ - float Diffusion; /* [r/w] 0.0 100.0 100.0 Value that controls the echo density in the late reverberation decay. (SUPPORTED:SFX) */ - float Density; /* [r/w] 0.0 100.0 100.0 Value that controls the modal density in the late reverberation decay (SUPPORTED:SFX) */ - unsigned int Flags; /* [r/w] FMOD_REVERB_FLAGS - modifies the behavior of above properties (SUPPORTED:WII) */ -} FMOD_REVERB_PROPERTIES; - - -/* -[DEFINE] -[ - [NAME] - FMOD_REVERB_FLAGS - - [DESCRIPTION] - Values for the Flags member of the FMOD_REVERB_PROPERTIES structure. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_REVERB_PROPERTIES -] -*/ -#define FMOD_REVERB_FLAGS_HIGHQUALITYREVERB 0x00000400 /* Wii. Use high quality reverb */ -#define FMOD_REVERB_FLAGS_HIGHQUALITYDPL2REVERB 0x00000800 /* Wii. Use high quality DPL2 reverb */ -#define FMOD_REVERB_FLAGS_HARDWAREONLY 0x00001000 /* Don't create an SFX reverb for FMOD_SOFTWARE channels, hardware reverb only */ -#define FMOD_REVERB_FLAGS_DEFAULT 0x00000000 -/* [DEFINE_END] */ - - -/* -[DEFINE] -[ - [NAME] - FMOD_REVERB_PRESETS - - [DESCRIPTION] - A set of predefined environment PARAMETERS. - These are used to initialize an FMOD_REVERB_PROPERTIES structure statically. - i.e. - FMOD_REVERB_PROPERTIES prop = FMOD_PRESET_GENERIC; - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::setReverbProperties -] -*/ -/* Inst Env Diffus Room RoomHF RmLF DecTm DecHF DecLF Refl RefDel Revb RevDel ModTm ModDp HFRef LFRef Diffus Densty FLAGS */ -#define FMOD_PRESET_OFF { 0, -1, 1.00f, -10000, -10000, 0, 1.00f, 1.00f, 1.0f, -2602, 0.007f, 200, 0.011f, 0.25f, 0.000f, 5000.0f, 250.0f, 0.0f, 0.0f, 0x33f } -#define FMOD_PRESET_GENERIC { 0, 0, 1.00f, -1000, -100, 0, 1.49f, 0.83f, 1.0f, -2602, 0.007f, 200, 0.011f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_PADDEDCELL { 0, 1, 1.00f, -1000, -6000, 0, 0.17f, 0.10f, 1.0f, -1204, 0.001f, 207, 0.002f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_ROOM { 0, 2, 1.00f, -1000, -454, 0, 0.40f, 0.83f, 1.0f, -1646, 0.002f, 53, 0.003f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_BATHROOM { 0, 3, 1.00f, -1000, -1200, 0, 1.49f, 0.54f, 1.0f, -370, 0.007f, 1030, 0.011f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 60.0f, 0x3f } -#define FMOD_PRESET_LIVINGROOM { 0, 4, 1.00f, -1000, -6000, 0, 0.50f, 0.10f, 1.0f, -1376, 0.003f, -1104, 0.004f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_STONEROOM { 0, 5, 1.00f, -1000, -300, 0, 2.31f, 0.64f, 1.0f, -711, 0.012f, 83, 0.017f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_AUDITORIUM { 0, 6, 1.00f, -1000, -476, 0, 4.32f, 0.59f, 1.0f, -789, 0.020f, -289, 0.030f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_CONCERTHALL { 0, 7, 1.00f, -1000, -500, 0, 3.92f, 0.70f, 1.0f, -1230, 0.020f, -2, 0.029f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_CAVE { 0, 8, 1.00f, -1000, 0, 0, 2.91f, 1.30f, 1.0f, -602, 0.015f, -302, 0.022f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x1f } -#define FMOD_PRESET_ARENA { 0, 9, 1.00f, -1000, -698, 0, 7.24f, 0.33f, 1.0f, -1166, 0.020f, 16, 0.030f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_HANGAR { 0, 10, 1.00f, -1000, -1000, 0, 10.05f, 0.23f, 1.0f, -602, 0.020f, 198, 0.030f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_CARPETTEDHALLWAY { 0, 11, 1.00f, -1000, -4000, 0, 0.30f, 0.10f, 1.0f, -1831, 0.002f, -1630, 0.030f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_HALLWAY { 0, 12, 1.00f, -1000, -300, 0, 1.49f, 0.59f, 1.0f, -1219, 0.007f, 441, 0.011f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_STONECORRIDOR { 0, 13, 1.00f, -1000, -237, 0, 2.70f, 0.79f, 1.0f, -1214, 0.013f, 395, 0.020f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_ALLEY { 0, 14, 0.30f, -1000, -270, 0, 1.49f, 0.86f, 1.0f, -1204, 0.007f, -4, 0.011f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_FOREST { 0, 15, 0.30f, -1000, -3300, 0, 1.49f, 0.54f, 1.0f, -2560, 0.162f, -229, 0.088f, 0.25f, 0.000f, 5000.0f, 250.0f, 79.0f, 100.0f, 0x3f } -#define FMOD_PRESET_CITY { 0, 16, 0.50f, -1000, -800, 0, 1.49f, 0.67f, 1.0f, -2273, 0.007f, -1691, 0.011f, 0.25f, 0.000f, 5000.0f, 250.0f, 50.0f, 100.0f, 0x3f } -#define FMOD_PRESET_MOUNTAINS { 0, 17, 0.27f, -1000, -2500, 0, 1.49f, 0.21f, 1.0f, -2780, 0.300f, -1434, 0.100f, 0.25f, 0.000f, 5000.0f, 250.0f, 27.0f, 100.0f, 0x1f } -#define FMOD_PRESET_QUARRY { 0, 18, 1.00f, -1000, -1000, 0, 1.49f, 0.83f, 1.0f, -10000, 0.061f, 500, 0.025f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } -#define FMOD_PRESET_PLAIN { 0, 19, 0.21f, -1000, -2000, 0, 1.49f, 0.50f, 1.0f, -2466, 0.179f, -1926, 0.100f, 0.25f, 0.000f, 5000.0f, 250.0f, 21.0f, 100.0f, 0x3f } -#define FMOD_PRESET_PARKINGLOT { 0, 20, 1.00f, -1000, 0, 0, 1.65f, 1.50f, 1.0f, -1363, 0.008f, -1153, 0.012f, 0.25f, 0.000f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x1f } -#define FMOD_PRESET_SEWERPIPE { 0, 21, 0.80f, -1000, -1000, 0, 2.81f, 0.14f, 1.0f, 429, 0.014f, 1023, 0.021f, 0.25f, 0.000f, 5000.0f, 250.0f, 80.0f, 60.0f, 0x3f } -#define FMOD_PRESET_UNDERWATER { 0, 22, 1.00f, -1000, -4000, 0, 1.49f, 0.10f, 1.0f, -449, 0.007f, 1700, 0.011f, 1.18f, 0.348f, 5000.0f, 250.0f, 100.0f, 100.0f, 0x3f } - -/* PlayStation Portable Only presets */ -#define FMOD_PRESET_PSP_ROOM { 0, 1, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, 0, 0.000f, 0.00f, 0.000f, 0000.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FMOD_PRESET_PSP_STUDIO_A { 0, 2, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, 0, 0.000f, 0.00f, 0.000f, 0000.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FMOD_PRESET_PSP_STUDIO_B { 0, 3, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, 0, 0.000f, 0.00f, 0.000f, 0000.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FMOD_PRESET_PSP_STUDIO_C { 0, 4, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, 0, 0.000f, 0.00f, 0.000f, 0000.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FMOD_PRESET_PSP_HALL { 0, 5, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, 0, 0.000f, 0.00f, 0.000f, 0000.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FMOD_PRESET_PSP_SPACE { 0, 6, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, 0, 0.000f, 0.00f, 0.000f, 0000.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FMOD_PRESET_PSP_ECHO { 0, 7, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, 0, 0.000f, 0.00f, 0.000f, 0000.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FMOD_PRESET_PSP_DELAY { 0, 8, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, 0, 0.000f, 0.00f, 0.000f, 0000.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FMOD_PRESET_PSP_PIPE { 0, 9, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, 0, 0.000f, 0.00f, 0.000f, 0000.0f, 0.0f, 0.0f, 0.0f, 0x31f } -/* [DEFINE_END] */ - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure defining the properties for a reverb source, related to a FMOD channel. - - Note the default reverb properties are the same as the FMOD_PRESET_GENERIC preset. - Note that integer values that typically range from -10,000 to 1000 are represented in - decibels, and are of a logarithmic scale, not linear, wheras float values are typically linear. - PORTABILITY: Each member has the platform it supports in braces ie (win32/wii). - - The numerical values listed below are the maximum, minimum and default values for each variable respectively. - - [REMARKS] - SUPPORTED next to each parameter means the platform the parameter can be set on. Some platforms support all parameters and some don't. - WII means Nintendo Wii hardware reverb (must use FMOD_HARDWARE). - PSP means Playstation Portable hardware reverb (must use FMOD_HARDWARE). - SFX means FMOD SFX software reverb. This works on any platform that uses FMOD_SOFTWARE for loading sounds. - --- means unsupported/deprecated. Will either be removed or supported by SFX in the future. - - - 'ConnectionPoint' Parameter. This parameter is for the FMOD software reverb only (known as SFX in the list above). - By default the dsp network connection for a channel and its reverb is between the 'SFX Reverb' unit, and the channel's wavetable/resampler/dspcodec/oscillator unit (the unit below the channel DSP head). NULL can be used for this parameter to make it use this default behaviour. - This parameter allows the user to connect the SFX reverb to somewhere else internally, for example the channel DSP head, or a related channelgroup. The event system uses this so that it can have the output of an event going to the reverb, instead of just the output of the event's channels (thereby ignoring event effects/submixes etc). - Do not use if you are unaware of DSP network connection issues. Leave it at the default of NULL instead. - - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - Members marked with [r/w] are either read or write depending on if you are using Channel::setReverbProperties (w) or Channel::getReverbProperties (r). - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - Channel::setReverbProperties - Channel::getReverbProperties - FMOD_REVERB_CHANNELFLAGS -] -*/ -typedef struct FMOD_REVERB_CHANNELPROPERTIES -{ /* MIN MAX DEFAULT DESCRIPTION */ - int Direct; /* [r/w] -10000 1000 0 Direct path level (SUPPORTED:SFX) */ - int Room; /* [r/w] -10000 1000 0 Room effect level (SUPPORTED:SFX) */ - unsigned int Flags; /* [r/w] FMOD_REVERB_CHANNELFLAGS - modifies the behavior of properties (SUPPORTED:SFX) */ - FMOD_DSP *ConnectionPoint; /* [r/w] See remarks. DSP network location to connect reverb for this channel. (SUPPORTED:SFX).*/ -} FMOD_REVERB_CHANNELPROPERTIES; - - -/* -[DEFINE] -[ - [NAME] - FMOD_REVERB_CHANNELFLAGS - - [DESCRIPTION] - Values for the Flags member of the FMOD_REVERB_CHANNELPROPERTIES structure. - - [REMARKS] - For SFX Reverb, there is support for multiple reverb environments. - Use FMOD_REVERB_CHANNELFLAGS_ENVIRONMENT0 to FMOD_REVERB_CHANNELFLAGS_ENVIRONMENT3 in the flags member - of FMOD_REVERB_CHANNELPROPERTIES to specify which environment instance(s) to target. - - If you do not specify any instance the first reverb instance will be used. - - If you specify more than one instance with getReverbProperties, the first instance will be used. - - If you specify more than one instance with setReverbProperties, it will set more than 1 instance at once. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_REVERB_CHANNELPROPERTIES -] -*/ -#define FMOD_REVERB_CHANNELFLAGS_INSTANCE0 0x00000010 /* SFX/Wii. Specify channel to target reverb instance 0. Default target. */ -#define FMOD_REVERB_CHANNELFLAGS_INSTANCE1 0x00000020 /* SFX/Wii. Specify channel to target reverb instance 1. */ -#define FMOD_REVERB_CHANNELFLAGS_INSTANCE2 0x00000040 /* SFX/Wii. Specify channel to target reverb instance 2. */ -#define FMOD_REVERB_CHANNELFLAGS_INSTANCE3 0x00000080 /* SFX. Specify channel to target reverb instance 3. */ - -#define FMOD_REVERB_CHANNELFLAGS_DEFAULT FMOD_REVERB_CHANNELFLAGS_INSTANCE0 -/* [DEFINE_END] */ - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Settings for advanced features like configuring memory and cpu usage for the FMOD_CREATECOMPRESSEDSAMPLE feature. - - [REMARKS] - maxMPEGcodecs / maxADPCMcodecs / maxXMAcodecs will determine the maximum cpu usage of playing realtime samples. Use this to lower potential excess cpu usage and also control memory usage. - - maxPCMcodecs is for use with PS3 only. It will determine the maximum number of PCM voices that can be played at once. This includes streams of any format and all sounds created - *without* the FMOD_CREATECOMPRESSEDSAMPLE flag. - - Memory will be allocated for codecs 'up front' (during System::init) if these values are specified as non zero. If any are zero, it allocates memory for the codec whenever a file of the type in question is loaded. So if maxMPEGcodecs is 0 for example, it will allocate memory for the mpeg codecs the first time an mp3 is loaded or an mp3 based .FSB file is loaded. - - Due to inefficient encoding techniques on certain .wav based ADPCM files, FMOD can can need an extra 29720 bytes per codec. This means for lowest memory consumption. Use FSB as it uses an optimal/small ADPCM block size. - - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - Members marked with [r/w] are either read or write depending on if you are using System::setAdvancedSettings (w) or System::getAdvancedSettings (r). - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::setAdvancedSettings - System::getAdvancedSettings - System::init - FMOD_MODE -] -*/ -typedef struct FMOD_ADVANCEDSETTINGS -{ - int cbsize; /* [w] Size of this structure. Use sizeof(FMOD_ADVANCEDSETTINGS) NOTE: This must be set before calling System::getAdvancedSettings! */ - int maxMPEGcodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. Mpeg codecs consume 21,684 bytes per instance and this number will determine how many mpeg channels can be played simultaneously. Default = 32. */ - int maxADPCMcodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. ADPCM codecs consume 2,136 bytes per instance and this number will determine how many ADPCM channels can be played simultaneously. Default = 32. */ - int maxXMAcodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. XMA codecs consume 14,836 bytes per instance and this number will determine how many XMA channels can be played simultaneously. Default = 32. */ - int maxCELTcodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. CELT codecs consume 11,500 bytes per instance and this number will determine how many CELT channels can be played simultaneously. Default = 32. */ - int maxVORBIScodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. Vorbis codecs consume 12,000 bytes per instance and this number will determine how many Vorbis channels can be played simultaneously. Default = 32. */ - int maxPCMcodecs; /* [r/w] Optional. Specify 0 to ignore. For use with PS3 only. PCM codecs consume 12,672 bytes per instance and this number will determine how many streams and PCM voices can be played simultaneously. Default = 16. */ - int ASIONumChannels; /* [r/w] Optional. Specify 0 to ignore. Number of channels available on the ASIO device. */ - char **ASIOChannelList; /* [r/w] Optional. Specify 0 to ignore. Pointer to an array of strings (number of entries defined by ASIONumChannels) with ASIO channel names. */ - FMOD_SPEAKER *ASIOSpeakerList; /* [r/w] Optional. Specify 0 to ignore. Pointer to a list of speakers that the ASIO channels map to. This can be called after System::init to remap ASIO output. */ - int max3DReverbDSPs; /* [r/w] Optional. Specify 0 to ignore. The max number of 3d reverb DSP's in the system. (NOTE: CURRENTLY DISABLED / UNUSED) */ - float HRTFMinAngle; /* [r/w] Optional. For use with FMOD_INIT_HRTF_LOWPASS. The angle range (0-360) of a 3D sound in relation to the listener, at which the HRTF function begins to have an effect. 0 = in front of the listener. 180 = from 90 degrees to the left of the listener to 90 degrees to the right. 360 = behind the listener. Default = 180.0. */ - float HRTFMaxAngle; /* [r/w] Optional. For use with FMOD_INIT_HRTF_LOWPASS. The angle range (0-360) of a 3D sound in relation to the listener, at which the HRTF function has maximum effect. 0 = front of the listener. 180 = from 90 degrees to the left of the listener to 90 degrees to the right. 360 = behind the listener. Default = 360.0. */ - float HRTFFreq; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_INIT_HRTF_LOWPASS. The cutoff frequency of the HRTF's lowpass filter function when at maximum effect. (i.e. at HRTFMaxAngle). Default = 4000.0. */ - float vol0virtualvol; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_INIT_VOL0_BECOMES_VIRTUAL. If this flag is used, and the volume is 0.0, then the sound will become virtual. Use this value to raise the threshold to a different point where a sound goes virtual. */ - int eventqueuesize; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD Event system only. Specifies the number of slots available for simultaneous non blocking loads, across all threads. Default = 32. */ - unsigned int defaultDecodeBufferSize; /* [r/w] Optional. Specify 0 to ignore. For streams. This determines the default size of the double buffer (in milliseconds) that a stream uses. Default = 400ms */ - char *debugLogFilename; /* [r/w] Optional. Specify 0 to ignore. Gives fmod's logging system a path/filename. Normally the log is placed in the same directory as the executable and called fmod.log. When using System::getAdvancedSettings, provide at least 256 bytes of memory to copy into. */ - unsigned short profileport; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_INIT_ENABLE_PROFILE. Specify the port to listen on for connections by the profiler application. */ - unsigned int geometryMaxFadeTime; /* [r/w] Optional. Specify 0 to ignore. The maximum time in miliseconds it takes for a channel to fade to the new level when its occlusion changes. */ - unsigned int maxSpectrumWaveDataBuffers; /* [r/w] Optional. Specify 0 to ignore. Tells System::init to allocate a pool of wavedata/spectrum buffers to prevent memory fragmentation, any additional buffers will be allocated normally. */ - unsigned int musicSystemCacheDelay; /* [r/w] Optional. Specify 0 to ignore. The delay the music system should allow for loading a sample from disk (in milliseconds). Default = 400 ms. */ - float distanceFilterCenterFreq; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_INIT_DISTANCE_FILTERING. The default center frequency in Hz for the distance filtering effect. Default = 1500.0. */ - unsigned int stackSizeStream; /* [r/w] Optional. Specify 0 to ignore. Specify the stack size for the FMOD Stream thread in bytes. Useful for custom codecs that use excess stack. Default 49,152 (48kb) */ - unsigned int stackSizeNonBlocking; /* [r/w] Optional. Specify 0 to ignore. Specify the stack size for the FMOD_NONBLOCKING loading thread. Useful for custom codecs that use excess stack. Default 65,536 (64kb) */ - unsigned int stackSizeMixer; /* [r/w] Optional. Specify 0 to ignore. Specify the stack size for the FMOD mixer thread. Useful for custom dsps that use excess stack. Default 49,152 (48kb) */ -} FMOD_ADVANCEDSETTINGS; - - -/* -[ENUM] -[ - [DESCRIPTION] - Special channel index values for FMOD functions. - - [REMARKS] - To get 'all' of the channels, use System::getMasterChannelGroup. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::playSound - System::playDSP - System::getChannel - System::getMasterChannelGroup -] -*/ -typedef enum -{ - FMOD_CHANNEL_FREE = -1, /* For a channel index, FMOD chooses a free voice using the priority system. */ - FMOD_CHANNEL_REUSE = -2 /* For a channel index, re-use the channel handle that was passed in. */ -} FMOD_CHANNELINDEX; - -#include "fmod_codec.h" -#include "fmod_dsp.h" -#include "fmod_memoryinfo.h" - -/* ========================================================================================== */ -/* FUNCTION PROTOTYPES */ -/* ========================================================================================== */ - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* - FMOD global system functions (optional). -*/ - -FMOD_RESULT F_API FMOD_Memory_Initialize (void *poolmem, int poollen, FMOD_MEMORY_ALLOCCALLBACK useralloc, FMOD_MEMORY_REALLOCCALLBACK userrealloc, FMOD_MEMORY_FREECALLBACK userfree, FMOD_MEMORY_TYPE memtypeflags); -FMOD_RESULT F_API FMOD_Memory_GetStats (int *currentalloced, int *maxalloced, FMOD_BOOL blocking); -FMOD_RESULT F_API FMOD_Debug_SetLevel (FMOD_DEBUGLEVEL level); -FMOD_RESULT F_API FMOD_Debug_GetLevel (FMOD_DEBUGLEVEL *level); -FMOD_RESULT F_API FMOD_File_SetDiskBusy (int busy); -FMOD_RESULT F_API FMOD_File_GetDiskBusy (int *busy); - -/* - FMOD System factory functions. Use this to create an FMOD System Instance. below you will see FMOD_System_Init/Close to get started. -*/ - -FMOD_RESULT F_API FMOD_System_Create (FMOD_SYSTEM **system); -FMOD_RESULT F_API FMOD_System_Release (FMOD_SYSTEM *system); - - -/* - 'System' API -*/ - -/* - Pre-init functions. -*/ - -FMOD_RESULT F_API FMOD_System_SetOutput (FMOD_SYSTEM *system, FMOD_OUTPUTTYPE output); -FMOD_RESULT F_API FMOD_System_GetOutput (FMOD_SYSTEM *system, FMOD_OUTPUTTYPE *output); -FMOD_RESULT F_API FMOD_System_GetNumDrivers (FMOD_SYSTEM *system, int *numdrivers); -FMOD_RESULT F_API FMOD_System_GetDriverInfo (FMOD_SYSTEM *system, int id, char *name, int namelen, FMOD_GUID *guid); -FMOD_RESULT F_API FMOD_System_GetDriverInfoW (FMOD_SYSTEM *system, int id, short *name, int namelen, FMOD_GUID *guid); -FMOD_RESULT F_API FMOD_System_GetDriverCaps (FMOD_SYSTEM *system, int id, FMOD_CAPS *caps, int *controlpaneloutputrate, FMOD_SPEAKERMODE *controlpanelspeakermode); -FMOD_RESULT F_API FMOD_System_SetDriver (FMOD_SYSTEM *system, int driver); -FMOD_RESULT F_API FMOD_System_GetDriver (FMOD_SYSTEM *system, int *driver); -FMOD_RESULT F_API FMOD_System_SetHardwareChannels (FMOD_SYSTEM *system, int numhardwarechannels); -FMOD_RESULT F_API FMOD_System_SetSoftwareChannels (FMOD_SYSTEM *system, int numsoftwarechannels); -FMOD_RESULT F_API FMOD_System_GetSoftwareChannels (FMOD_SYSTEM *system, int *numsoftwarechannels); -FMOD_RESULT F_API FMOD_System_SetSoftwareFormat (FMOD_SYSTEM *system, int samplerate, FMOD_SOUND_FORMAT format, int numoutputchannels, int maxinputchannels, FMOD_DSP_RESAMPLER resamplemethod); -FMOD_RESULT F_API FMOD_System_GetSoftwareFormat (FMOD_SYSTEM *system, int *samplerate, FMOD_SOUND_FORMAT *format, int *numoutputchannels, int *maxinputchannels, FMOD_DSP_RESAMPLER *resamplemethod, int *bits); -FMOD_RESULT F_API FMOD_System_SetDSPBufferSize (FMOD_SYSTEM *system, unsigned int bufferlength, int numbuffers); -FMOD_RESULT F_API FMOD_System_GetDSPBufferSize (FMOD_SYSTEM *system, unsigned int *bufferlength, int *numbuffers); -FMOD_RESULT F_API FMOD_System_SetFileSystem (FMOD_SYSTEM *system, FMOD_FILE_OPENCALLBACK useropen, FMOD_FILE_CLOSECALLBACK userclose, FMOD_FILE_READCALLBACK userread, FMOD_FILE_SEEKCALLBACK userseek, FMOD_FILE_ASYNCREADCALLBACK userasyncread, FMOD_FILE_ASYNCCANCELCALLBACK userasynccancel, int blockalign); -FMOD_RESULT F_API FMOD_System_AttachFileSystem (FMOD_SYSTEM *system, FMOD_FILE_OPENCALLBACK useropen, FMOD_FILE_CLOSECALLBACK userclose, FMOD_FILE_READCALLBACK userread, FMOD_FILE_SEEKCALLBACK userseek); -FMOD_RESULT F_API FMOD_System_SetAdvancedSettings (FMOD_SYSTEM *system, FMOD_ADVANCEDSETTINGS *settings); -FMOD_RESULT F_API FMOD_System_GetAdvancedSettings (FMOD_SYSTEM *system, FMOD_ADVANCEDSETTINGS *settings); -FMOD_RESULT F_API FMOD_System_SetSpeakerMode (FMOD_SYSTEM *system, FMOD_SPEAKERMODE speakermode); -FMOD_RESULT F_API FMOD_System_GetSpeakerMode (FMOD_SYSTEM *system, FMOD_SPEAKERMODE *speakermode); -FMOD_RESULT F_API FMOD_System_SetCallback (FMOD_SYSTEM *system, FMOD_SYSTEM_CALLBACK callback); - -/* - Plug-in support -*/ - -FMOD_RESULT F_API FMOD_System_SetPluginPath (FMOD_SYSTEM *system, const char *path); -FMOD_RESULT F_API FMOD_System_LoadPlugin (FMOD_SYSTEM *system, const char *filename, unsigned int *handle, unsigned int priority); -FMOD_RESULT F_API FMOD_System_UnloadPlugin (FMOD_SYSTEM *system, unsigned int handle); -FMOD_RESULT F_API FMOD_System_GetNumPlugins (FMOD_SYSTEM *system, FMOD_PLUGINTYPE plugintype, int *numplugins); -FMOD_RESULT F_API FMOD_System_GetPluginHandle (FMOD_SYSTEM *system, FMOD_PLUGINTYPE plugintype, int index, unsigned int *handle); -FMOD_RESULT F_API FMOD_System_GetPluginInfo (FMOD_SYSTEM *system, unsigned int handle, FMOD_PLUGINTYPE *plugintype, char *name, int namelen, unsigned int *version); -FMOD_RESULT F_API FMOD_System_SetOutputByPlugin (FMOD_SYSTEM *system, unsigned int handle); -FMOD_RESULT F_API FMOD_System_GetOutputByPlugin (FMOD_SYSTEM *system, unsigned int *handle); -FMOD_RESULT F_API FMOD_System_CreateDSPByPlugin (FMOD_SYSTEM *system, unsigned int handle, FMOD_DSP **dsp); -FMOD_RESULT F_API FMOD_System_RegisterCodec (FMOD_SYSTEM *system, FMOD_CODEC_DESCRIPTION *description, unsigned int *handle, unsigned int priority); -FMOD_RESULT F_API FMOD_System_RegisterDSP (FMOD_SYSTEM *system, FMOD_DSP_DESCRIPTION *description, unsigned int *handle); - -/* - Init/Close -*/ - -FMOD_RESULT F_API FMOD_System_Init (FMOD_SYSTEM *system, int maxchannels, FMOD_INITFLAGS flags, void *extradriverdata); -FMOD_RESULT F_API FMOD_System_Close (FMOD_SYSTEM *system); - -/* - General post-init system functions -*/ - -FMOD_RESULT F_API FMOD_System_Update (FMOD_SYSTEM *system); - -FMOD_RESULT F_API FMOD_System_Set3DSettings (FMOD_SYSTEM *system, float dopplerscale, float distancefactor, float rolloffscale); -FMOD_RESULT F_API FMOD_System_Get3DSettings (FMOD_SYSTEM *system, float *dopplerscale, float *distancefactor, float *rolloffscale); -FMOD_RESULT F_API FMOD_System_Set3DNumListeners (FMOD_SYSTEM *system, int numlisteners); -FMOD_RESULT F_API FMOD_System_Get3DNumListeners (FMOD_SYSTEM *system, int *numlisteners); -FMOD_RESULT F_API FMOD_System_Set3DListenerAttributes(FMOD_SYSTEM *system, int listener, const FMOD_VECTOR *pos, const FMOD_VECTOR *vel, const FMOD_VECTOR *forward, const FMOD_VECTOR *up); -FMOD_RESULT F_API FMOD_System_Get3DListenerAttributes(FMOD_SYSTEM *system, int listener, FMOD_VECTOR *pos, FMOD_VECTOR *vel, FMOD_VECTOR *forward, FMOD_VECTOR *up); -FMOD_RESULT F_API FMOD_System_Set3DRolloffCallback (FMOD_SYSTEM *system, FMOD_3D_ROLLOFFCALLBACK callback); -FMOD_RESULT F_API FMOD_System_Set3DSpeakerPosition (FMOD_SYSTEM *system, FMOD_SPEAKER speaker, float x, float y, FMOD_BOOL active); -FMOD_RESULT F_API FMOD_System_Get3DSpeakerPosition (FMOD_SYSTEM *system, FMOD_SPEAKER speaker, float *x, float *y, FMOD_BOOL *active); - -FMOD_RESULT F_API FMOD_System_SetStreamBufferSize (FMOD_SYSTEM *system, unsigned int filebuffersize, FMOD_TIMEUNIT filebuffersizetype); -FMOD_RESULT F_API FMOD_System_GetStreamBufferSize (FMOD_SYSTEM *system, unsigned int *filebuffersize, FMOD_TIMEUNIT *filebuffersizetype); - -/* - System information functions. -*/ - -FMOD_RESULT F_API FMOD_System_GetVersion (FMOD_SYSTEM *system, unsigned int *version); -FMOD_RESULT F_API FMOD_System_GetOutputHandle (FMOD_SYSTEM *system, void **handle); -FMOD_RESULT F_API FMOD_System_GetChannelsPlaying (FMOD_SYSTEM *system, int *channels); -FMOD_RESULT F_API FMOD_System_GetHardwareChannels (FMOD_SYSTEM *system, int *numhardwarechannels); -FMOD_RESULT F_API FMOD_System_GetCPUUsage (FMOD_SYSTEM *system, float *dsp, float *stream, float *geometry, float *update, float *total); -FMOD_RESULT F_API FMOD_System_GetSoundRAM (FMOD_SYSTEM *system, int *currentalloced, int *maxalloced, int *total); -FMOD_RESULT F_API FMOD_System_GetNumCDROMDrives (FMOD_SYSTEM *system, int *numdrives); -FMOD_RESULT F_API FMOD_System_GetCDROMDriveName (FMOD_SYSTEM *system, int drive, char *drivename, int drivenamelen, char *scsiname, int scsinamelen, char *devicename, int devicenamelen); -FMOD_RESULT F_API FMOD_System_GetSpectrum (FMOD_SYSTEM *system, float *spectrumarray, int numvalues, int channeloffset, FMOD_DSP_FFT_WINDOW windowtype); -FMOD_RESULT F_API FMOD_System_GetWaveData (FMOD_SYSTEM *system, float *wavearray, int numvalues, int channeloffset); - -/* - Sound/DSP/Channel/FX creation and retrieval. -*/ - -FMOD_RESULT F_API FMOD_System_CreateSound (FMOD_SYSTEM *system, const char *name_or_data, FMOD_MODE mode, FMOD_CREATESOUNDEXINFO *exinfo, FMOD_SOUND **sound); -FMOD_RESULT F_API FMOD_System_CreateStream (FMOD_SYSTEM *system, const char *name_or_data, FMOD_MODE mode, FMOD_CREATESOUNDEXINFO *exinfo, FMOD_SOUND **sound); -FMOD_RESULT F_API FMOD_System_CreateDSP (FMOD_SYSTEM *system, FMOD_DSP_DESCRIPTION *description, FMOD_DSP **dsp); -FMOD_RESULT F_API FMOD_System_CreateDSPByType (FMOD_SYSTEM *system, FMOD_DSP_TYPE type, FMOD_DSP **dsp); -FMOD_RESULT F_API FMOD_System_CreateChannelGroup (FMOD_SYSTEM *system, const char *name, FMOD_CHANNELGROUP **channelgroup); -FMOD_RESULT F_API FMOD_System_CreateSoundGroup (FMOD_SYSTEM *system, const char *name, FMOD_SOUNDGROUP **soundgroup); -FMOD_RESULT F_API FMOD_System_CreateReverb (FMOD_SYSTEM *system, FMOD_REVERB **reverb); - -FMOD_RESULT F_API FMOD_System_PlaySound (FMOD_SYSTEM *system, FMOD_CHANNELINDEX channelid, FMOD_SOUND *sound, FMOD_BOOL paused, FMOD_CHANNEL **channel); -FMOD_RESULT F_API FMOD_System_PlayDSP (FMOD_SYSTEM *system, FMOD_CHANNELINDEX channelid, FMOD_DSP *dsp, FMOD_BOOL paused, FMOD_CHANNEL **channel); -FMOD_RESULT F_API FMOD_System_GetChannel (FMOD_SYSTEM *system, int channelid, FMOD_CHANNEL **channel); -FMOD_RESULT F_API FMOD_System_GetMasterChannelGroup (FMOD_SYSTEM *system, FMOD_CHANNELGROUP **channelgroup); -FMOD_RESULT F_API FMOD_System_GetMasterSoundGroup (FMOD_SYSTEM *system, FMOD_SOUNDGROUP **soundgroup); - -/* - Reverb API -*/ - -FMOD_RESULT F_API FMOD_System_SetReverbProperties (FMOD_SYSTEM *system, const FMOD_REVERB_PROPERTIES *prop); -FMOD_RESULT F_API FMOD_System_GetReverbProperties (FMOD_SYSTEM *system, FMOD_REVERB_PROPERTIES *prop); -FMOD_RESULT F_API FMOD_System_SetReverbAmbientProperties(FMOD_SYSTEM *system, FMOD_REVERB_PROPERTIES *prop); -FMOD_RESULT F_API FMOD_System_GetReverbAmbientProperties(FMOD_SYSTEM *system, FMOD_REVERB_PROPERTIES *prop); - -/* - System level DSP access. -*/ - -FMOD_RESULT F_API FMOD_System_GetDSPHead (FMOD_SYSTEM *system, FMOD_DSP **dsp); -FMOD_RESULT F_API FMOD_System_AddDSP (FMOD_SYSTEM *system, FMOD_DSP *dsp, FMOD_DSPCONNECTION **connection); -FMOD_RESULT F_API FMOD_System_LockDSP (FMOD_SYSTEM *system); -FMOD_RESULT F_API FMOD_System_UnlockDSP (FMOD_SYSTEM *system); -FMOD_RESULT F_API FMOD_System_GetDSPClock (FMOD_SYSTEM *system, unsigned int *hi, unsigned int *lo); - -/* - Recording API. -*/ - -FMOD_RESULT F_API FMOD_System_GetRecordNumDrivers (FMOD_SYSTEM *system, int *numdrivers); -FMOD_RESULT F_API FMOD_System_GetRecordDriverInfo (FMOD_SYSTEM *system, int id, char *name, int namelen, FMOD_GUID *guid); -FMOD_RESULT F_API FMOD_System_GetRecordDriverInfoW (FMOD_SYSTEM *system, int id, short *name, int namelen, FMOD_GUID *guid); -FMOD_RESULT F_API FMOD_System_GetRecordDriverCaps (FMOD_SYSTEM *system, int id, FMOD_CAPS *caps, int *minfrequency, int *maxfrequency); -FMOD_RESULT F_API FMOD_System_GetRecordPosition (FMOD_SYSTEM *system, int id, unsigned int *position); - -FMOD_RESULT F_API FMOD_System_RecordStart (FMOD_SYSTEM *system, int id, FMOD_SOUND *sound, FMOD_BOOL loop); -FMOD_RESULT F_API FMOD_System_RecordStop (FMOD_SYSTEM *system, int id); -FMOD_RESULT F_API FMOD_System_IsRecording (FMOD_SYSTEM *system, int id, FMOD_BOOL *recording); - -/* - Geometry API. -*/ - -FMOD_RESULT F_API FMOD_System_CreateGeometry (FMOD_SYSTEM *system, int maxpolygons, int maxvertices, FMOD_GEOMETRY **geometry); -FMOD_RESULT F_API FMOD_System_SetGeometrySettings (FMOD_SYSTEM *system, float maxworldsize); -FMOD_RESULT F_API FMOD_System_GetGeometrySettings (FMOD_SYSTEM *system, float *maxworldsize); -FMOD_RESULT F_API FMOD_System_LoadGeometry (FMOD_SYSTEM *system, const void *data, int datasize, FMOD_GEOMETRY **geometry); -FMOD_RESULT F_API FMOD_System_GetGeometryOcclusion (FMOD_SYSTEM *system, const FMOD_VECTOR *listener, const FMOD_VECTOR *source, float *direct, float *reverb); - -/* - Network functions. -*/ - -FMOD_RESULT F_API FMOD_System_SetNetworkProxy (FMOD_SYSTEM *system, const char *proxy); -FMOD_RESULT F_API FMOD_System_GetNetworkProxy (FMOD_SYSTEM *system, char *proxy, int proxylen); -FMOD_RESULT F_API FMOD_System_SetNetworkTimeout (FMOD_SYSTEM *system, int timeout); -FMOD_RESULT F_API FMOD_System_GetNetworkTimeout (FMOD_SYSTEM *system, int *timeout); - -/* - Userdata set/get. -*/ - -FMOD_RESULT F_API FMOD_System_SetUserData (FMOD_SYSTEM *system, void *userdata); -FMOD_RESULT F_API FMOD_System_GetUserData (FMOD_SYSTEM *system, void **userdata); - -FMOD_RESULT F_API FMOD_System_GetMemoryInfo (FMOD_SYSTEM *system, unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, FMOD_MEMORY_USAGE_DETAILS *memoryused_details); - -/* - 'Sound' API -*/ - -FMOD_RESULT F_API FMOD_Sound_Release (FMOD_SOUND *sound); -FMOD_RESULT F_API FMOD_Sound_GetSystemObject (FMOD_SOUND *sound, FMOD_SYSTEM **system); - -/* - Standard sound manipulation functions. -*/ - -FMOD_RESULT F_API FMOD_Sound_Lock (FMOD_SOUND *sound, unsigned int offset, unsigned int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2); -FMOD_RESULT F_API FMOD_Sound_Unlock (FMOD_SOUND *sound, void *ptr1, void *ptr2, unsigned int len1, unsigned int len2); -FMOD_RESULT F_API FMOD_Sound_SetDefaults (FMOD_SOUND *sound, float frequency, float volume, float pan, int priority); -FMOD_RESULT F_API FMOD_Sound_GetDefaults (FMOD_SOUND *sound, float *frequency, float *volume, float *pan, int *priority); -FMOD_RESULT F_API FMOD_Sound_SetVariations (FMOD_SOUND *sound, float frequencyvar, float volumevar, float panvar); -FMOD_RESULT F_API FMOD_Sound_GetVariations (FMOD_SOUND *sound, float *frequencyvar, float *volumevar, float *panvar); -FMOD_RESULT F_API FMOD_Sound_Set3DMinMaxDistance (FMOD_SOUND *sound, float min, float max); -FMOD_RESULT F_API FMOD_Sound_Get3DMinMaxDistance (FMOD_SOUND *sound, float *min, float *max); -FMOD_RESULT F_API FMOD_Sound_Set3DConeSettings (FMOD_SOUND *sound, float insideconeangle, float outsideconeangle, float outsidevolume); -FMOD_RESULT F_API FMOD_Sound_Get3DConeSettings (FMOD_SOUND *sound, float *insideconeangle, float *outsideconeangle, float *outsidevolume); -FMOD_RESULT F_API FMOD_Sound_Set3DCustomRolloff (FMOD_SOUND *sound, FMOD_VECTOR *points, int numpoints); -FMOD_RESULT F_API FMOD_Sound_Get3DCustomRolloff (FMOD_SOUND *sound, FMOD_VECTOR **points, int *numpoints); -FMOD_RESULT F_API FMOD_Sound_SetSubSound (FMOD_SOUND *sound, int index, FMOD_SOUND *subsound); -FMOD_RESULT F_API FMOD_Sound_GetSubSound (FMOD_SOUND *sound, int index, FMOD_SOUND **subsound); -FMOD_RESULT F_API FMOD_Sound_SetSubSoundSentence (FMOD_SOUND *sound, int *subsoundlist, int numsubsounds); -FMOD_RESULT F_API FMOD_Sound_GetName (FMOD_SOUND *sound, char *name, int namelen); -FMOD_RESULT F_API FMOD_Sound_GetLength (FMOD_SOUND *sound, unsigned int *length, FMOD_TIMEUNIT lengthtype); -FMOD_RESULT F_API FMOD_Sound_GetFormat (FMOD_SOUND *sound, FMOD_SOUND_TYPE *type, FMOD_SOUND_FORMAT *format, int *channels, int *bits); -FMOD_RESULT F_API FMOD_Sound_GetNumSubSounds (FMOD_SOUND *sound, int *numsubsounds); -FMOD_RESULT F_API FMOD_Sound_GetNumTags (FMOD_SOUND *sound, int *numtags, int *numtagsupdated); -FMOD_RESULT F_API FMOD_Sound_GetTag (FMOD_SOUND *sound, const char *name, int index, FMOD_TAG *tag); -FMOD_RESULT F_API FMOD_Sound_GetOpenState (FMOD_SOUND *sound, FMOD_OPENSTATE *openstate, unsigned int *percentbuffered, FMOD_BOOL *starving, FMOD_BOOL *diskbusy); -FMOD_RESULT F_API FMOD_Sound_ReadData (FMOD_SOUND *sound, void *buffer, unsigned int lenbytes, unsigned int *read); -FMOD_RESULT F_API FMOD_Sound_SeekData (FMOD_SOUND *sound, unsigned int pcm); - -FMOD_RESULT F_API FMOD_Sound_SetSoundGroup (FMOD_SOUND *sound, FMOD_SOUNDGROUP *soundgroup); -FMOD_RESULT F_API FMOD_Sound_GetSoundGroup (FMOD_SOUND *sound, FMOD_SOUNDGROUP **soundgroup); - -/* - Synchronization point API. These points can come from markers embedded in wav files, and can also generate channel callbacks. -*/ - -FMOD_RESULT F_API FMOD_Sound_GetNumSyncPoints (FMOD_SOUND *sound, int *numsyncpoints); -FMOD_RESULT F_API FMOD_Sound_GetSyncPoint (FMOD_SOUND *sound, int index, FMOD_SYNCPOINT **point); -FMOD_RESULT F_API FMOD_Sound_GetSyncPointInfo (FMOD_SOUND *sound, FMOD_SYNCPOINT *point, char *name, int namelen, unsigned int *offset, FMOD_TIMEUNIT offsettype); -FMOD_RESULT F_API FMOD_Sound_AddSyncPoint (FMOD_SOUND *sound, unsigned int offset, FMOD_TIMEUNIT offsettype, const char *name, FMOD_SYNCPOINT **point); -FMOD_RESULT F_API FMOD_Sound_DeleteSyncPoint (FMOD_SOUND *sound, FMOD_SYNCPOINT *point); - -/* - Functions also in Channel class but here they are the 'default' to save having to change it in Channel all the time. -*/ - -FMOD_RESULT F_API FMOD_Sound_SetMode (FMOD_SOUND *sound, FMOD_MODE mode); -FMOD_RESULT F_API FMOD_Sound_GetMode (FMOD_SOUND *sound, FMOD_MODE *mode); -FMOD_RESULT F_API FMOD_Sound_SetLoopCount (FMOD_SOUND *sound, int loopcount); -FMOD_RESULT F_API FMOD_Sound_GetLoopCount (FMOD_SOUND *sound, int *loopcount); -FMOD_RESULT F_API FMOD_Sound_SetLoopPoints (FMOD_SOUND *sound, unsigned int loopstart, FMOD_TIMEUNIT loopstarttype, unsigned int loopend, FMOD_TIMEUNIT loopendtype); -FMOD_RESULT F_API FMOD_Sound_GetLoopPoints (FMOD_SOUND *sound, unsigned int *loopstart, FMOD_TIMEUNIT loopstarttype, unsigned int *loopend, FMOD_TIMEUNIT loopendtype); - -/* - For MOD/S3M/XM/IT/MID sequenced formats only. -*/ - -FMOD_RESULT F_API FMOD_Sound_GetMusicNumChannels (FMOD_SOUND *sound, int *numchannels); -FMOD_RESULT F_API FMOD_Sound_SetMusicChannelVolume (FMOD_SOUND *sound, int channel, float volume); -FMOD_RESULT F_API FMOD_Sound_GetMusicChannelVolume (FMOD_SOUND *sound, int channel, float *volume); -FMOD_RESULT F_API FMOD_Sound_SetMusicSpeed (FMOD_SOUND *sound, float speed); -FMOD_RESULT F_API FMOD_Sound_GetMusicSpeed (FMOD_SOUND *sound, float *speed); - -/* - Userdata set/get. -*/ - -FMOD_RESULT F_API FMOD_Sound_SetUserData (FMOD_SOUND *sound, void *userdata); -FMOD_RESULT F_API FMOD_Sound_GetUserData (FMOD_SOUND *sound, void **userdata); - -FMOD_RESULT F_API FMOD_Sound_GetMemoryInfo (FMOD_SOUND *sound, unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, FMOD_MEMORY_USAGE_DETAILS *memoryused_details); - -/* - 'Channel' API -*/ - -FMOD_RESULT F_API FMOD_Channel_GetSystemObject (FMOD_CHANNEL *channel, FMOD_SYSTEM **system); - -FMOD_RESULT F_API FMOD_Channel_Stop (FMOD_CHANNEL *channel); -FMOD_RESULT F_API FMOD_Channel_SetPaused (FMOD_CHANNEL *channel, FMOD_BOOL paused); -FMOD_RESULT F_API FMOD_Channel_GetPaused (FMOD_CHANNEL *channel, FMOD_BOOL *paused); -FMOD_RESULT F_API FMOD_Channel_SetVolume (FMOD_CHANNEL *channel, float volume); -FMOD_RESULT F_API FMOD_Channel_GetVolume (FMOD_CHANNEL *channel, float *volume); -FMOD_RESULT F_API FMOD_Channel_SetFrequency (FMOD_CHANNEL *channel, float frequency); -FMOD_RESULT F_API FMOD_Channel_GetFrequency (FMOD_CHANNEL *channel, float *frequency); -FMOD_RESULT F_API FMOD_Channel_SetPan (FMOD_CHANNEL *channel, float pan); -FMOD_RESULT F_API FMOD_Channel_GetPan (FMOD_CHANNEL *channel, float *pan); -FMOD_RESULT F_API FMOD_Channel_SetDelay (FMOD_CHANNEL *channel, FMOD_DELAYTYPE delaytype, unsigned int delayhi, unsigned int delaylo); -FMOD_RESULT F_API FMOD_Channel_GetDelay (FMOD_CHANNEL *channel, FMOD_DELAYTYPE delaytype, unsigned int *delayhi, unsigned int *delaylo); -FMOD_RESULT F_API FMOD_Channel_SetSpeakerMix (FMOD_CHANNEL *channel, float frontleft, float frontright, float center, float lfe, float backleft, float backright, float sideleft, float sideright); -FMOD_RESULT F_API FMOD_Channel_GetSpeakerMix (FMOD_CHANNEL *channel, float *frontleft, float *frontright, float *center, float *lfe, float *backleft, float *backright, float *sideleft, float *sideright); -FMOD_RESULT F_API FMOD_Channel_SetSpeakerLevels (FMOD_CHANNEL *channel, FMOD_SPEAKER speaker, float *levels, int numlevels); -FMOD_RESULT F_API FMOD_Channel_GetSpeakerLevels (FMOD_CHANNEL *channel, FMOD_SPEAKER speaker, float *levels, int numlevels); -FMOD_RESULT F_API FMOD_Channel_SetInputChannelMix (FMOD_CHANNEL *channel, float *levels, int numlevels); -FMOD_RESULT F_API FMOD_Channel_GetInputChannelMix (FMOD_CHANNEL *channel, float *levels, int numlevels); -FMOD_RESULT F_API FMOD_Channel_SetMute (FMOD_CHANNEL *channel, FMOD_BOOL mute); -FMOD_RESULT F_API FMOD_Channel_GetMute (FMOD_CHANNEL *channel, FMOD_BOOL *mute); -FMOD_RESULT F_API FMOD_Channel_SetPriority (FMOD_CHANNEL *channel, int priority); -FMOD_RESULT F_API FMOD_Channel_GetPriority (FMOD_CHANNEL *channel, int *priority); -FMOD_RESULT F_API FMOD_Channel_SetPosition (FMOD_CHANNEL *channel, unsigned int position, FMOD_TIMEUNIT postype); -FMOD_RESULT F_API FMOD_Channel_GetPosition (FMOD_CHANNEL *channel, unsigned int *position, FMOD_TIMEUNIT postype); -FMOD_RESULT F_API FMOD_Channel_SetReverbProperties (FMOD_CHANNEL *channel, const FMOD_REVERB_CHANNELPROPERTIES *prop); -FMOD_RESULT F_API FMOD_Channel_GetReverbProperties (FMOD_CHANNEL *channel, FMOD_REVERB_CHANNELPROPERTIES *prop); -FMOD_RESULT F_API FMOD_Channel_SetLowPassGain (FMOD_CHANNEL *channel, float gain); -FMOD_RESULT F_API FMOD_Channel_GetLowPassGain (FMOD_CHANNEL *channel, float *gain); - -FMOD_RESULT F_API FMOD_Channel_SetChannelGroup (FMOD_CHANNEL *channel, FMOD_CHANNELGROUP *channelgroup); -FMOD_RESULT F_API FMOD_Channel_GetChannelGroup (FMOD_CHANNEL *channel, FMOD_CHANNELGROUP **channelgroup); -FMOD_RESULT F_API FMOD_Channel_SetCallback (FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACK callback); - -/* - 3D functionality. -*/ - -FMOD_RESULT F_API FMOD_Channel_Set3DAttributes (FMOD_CHANNEL *channel, const FMOD_VECTOR *pos, const FMOD_VECTOR *vel); -FMOD_RESULT F_API FMOD_Channel_Get3DAttributes (FMOD_CHANNEL *channel, FMOD_VECTOR *pos, FMOD_VECTOR *vel); -FMOD_RESULT F_API FMOD_Channel_Set3DMinMaxDistance (FMOD_CHANNEL *channel, float mindistance, float maxdistance); -FMOD_RESULT F_API FMOD_Channel_Get3DMinMaxDistance (FMOD_CHANNEL *channel, float *mindistance, float *maxdistance); -FMOD_RESULT F_API FMOD_Channel_Set3DConeSettings (FMOD_CHANNEL *channel, float insideconeangle, float outsideconeangle, float outsidevolume); -FMOD_RESULT F_API FMOD_Channel_Get3DConeSettings (FMOD_CHANNEL *channel, float *insideconeangle, float *outsideconeangle, float *outsidevolume); -FMOD_RESULT F_API FMOD_Channel_Set3DConeOrientation (FMOD_CHANNEL *channel, FMOD_VECTOR *orientation); -FMOD_RESULT F_API FMOD_Channel_Get3DConeOrientation (FMOD_CHANNEL *channel, FMOD_VECTOR *orientation); -FMOD_RESULT F_API FMOD_Channel_Set3DCustomRolloff (FMOD_CHANNEL *channel, FMOD_VECTOR *points, int numpoints); -FMOD_RESULT F_API FMOD_Channel_Get3DCustomRolloff (FMOD_CHANNEL *channel, FMOD_VECTOR **points, int *numpoints); -FMOD_RESULT F_API FMOD_Channel_Set3DOcclusion (FMOD_CHANNEL *channel, float directocclusion, float reverbocclusion); -FMOD_RESULT F_API FMOD_Channel_Get3DOcclusion (FMOD_CHANNEL *channel, float *directocclusion, float *reverbocclusion); -FMOD_RESULT F_API FMOD_Channel_Set3DSpread (FMOD_CHANNEL *channel, float angle); -FMOD_RESULT F_API FMOD_Channel_Get3DSpread (FMOD_CHANNEL *channel, float *angle); -FMOD_RESULT F_API FMOD_Channel_Set3DPanLevel (FMOD_CHANNEL *channel, float level); -FMOD_RESULT F_API FMOD_Channel_Get3DPanLevel (FMOD_CHANNEL *channel, float *level); -FMOD_RESULT F_API FMOD_Channel_Set3DDopplerLevel (FMOD_CHANNEL *channel, float level); -FMOD_RESULT F_API FMOD_Channel_Get3DDopplerLevel (FMOD_CHANNEL *channel, float *level); -FMOD_RESULT F_API FMOD_Channel_Set3DDistanceFilter (FMOD_CHANNEL *channel, FMOD_BOOL custom, float customLevel, float centerFreq); -FMOD_RESULT F_API FMOD_Channel_Get3DDistanceFilter (FMOD_CHANNEL *channel, FMOD_BOOL *custom, float *customLevel, float *centerFreq); - -/* - DSP functionality only for channels playing sounds created with FMOD_SOFTWARE. -*/ - -FMOD_RESULT F_API FMOD_Channel_GetDSPHead (FMOD_CHANNEL *channel, FMOD_DSP **dsp); -FMOD_RESULT F_API FMOD_Channel_AddDSP (FMOD_CHANNEL *channel, FMOD_DSP *dsp, FMOD_DSPCONNECTION **connection); - -/* - Information only functions. -*/ - -FMOD_RESULT F_API FMOD_Channel_IsPlaying (FMOD_CHANNEL *channel, FMOD_BOOL *isplaying); -FMOD_RESULT F_API FMOD_Channel_IsVirtual (FMOD_CHANNEL *channel, FMOD_BOOL *isvirtual); -FMOD_RESULT F_API FMOD_Channel_GetAudibility (FMOD_CHANNEL *channel, float *audibility); -FMOD_RESULT F_API FMOD_Channel_GetCurrentSound (FMOD_CHANNEL *channel, FMOD_SOUND **sound); -FMOD_RESULT F_API FMOD_Channel_GetSpectrum (FMOD_CHANNEL *channel, float *spectrumarray, int numvalues, int channeloffset, FMOD_DSP_FFT_WINDOW windowtype); -FMOD_RESULT F_API FMOD_Channel_GetWaveData (FMOD_CHANNEL *channel, float *wavearray, int numvalues, int channeloffset); -FMOD_RESULT F_API FMOD_Channel_GetIndex (FMOD_CHANNEL *channel, int *index); - -/* - Functions also found in Sound class but here they can be set per channel. -*/ - -FMOD_RESULT F_API FMOD_Channel_SetMode (FMOD_CHANNEL *channel, FMOD_MODE mode); -FMOD_RESULT F_API FMOD_Channel_GetMode (FMOD_CHANNEL *channel, FMOD_MODE *mode); -FMOD_RESULT F_API FMOD_Channel_SetLoopCount (FMOD_CHANNEL *channel, int loopcount); -FMOD_RESULT F_API FMOD_Channel_GetLoopCount (FMOD_CHANNEL *channel, int *loopcount); -FMOD_RESULT F_API FMOD_Channel_SetLoopPoints (FMOD_CHANNEL *channel, unsigned int loopstart, FMOD_TIMEUNIT loopstarttype, unsigned int loopend, FMOD_TIMEUNIT loopendtype); -FMOD_RESULT F_API FMOD_Channel_GetLoopPoints (FMOD_CHANNEL *channel, unsigned int *loopstart, FMOD_TIMEUNIT loopstarttype, unsigned int *loopend, FMOD_TIMEUNIT loopendtype); - -/* - Userdata set/get. -*/ - -FMOD_RESULT F_API FMOD_Channel_SetUserData (FMOD_CHANNEL *channel, void *userdata); -FMOD_RESULT F_API FMOD_Channel_GetUserData (FMOD_CHANNEL *channel, void **userdata); - -FMOD_RESULT F_API FMOD_Channel_GetMemoryInfo (FMOD_CHANNEL *channel, unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, FMOD_MEMORY_USAGE_DETAILS *memoryused_details); - -/* - 'ChannelGroup' API -*/ - -FMOD_RESULT F_API FMOD_ChannelGroup_Release (FMOD_CHANNELGROUP *channelgroup); -FMOD_RESULT F_API FMOD_ChannelGroup_GetSystemObject (FMOD_CHANNELGROUP *channelgroup, FMOD_SYSTEM **system); - -/* - Channelgroup scale values. (changes attributes relative to the channels, doesn't overwrite them) -*/ - -FMOD_RESULT F_API FMOD_ChannelGroup_SetVolume (FMOD_CHANNELGROUP *channelgroup, float volume); -FMOD_RESULT F_API FMOD_ChannelGroup_GetVolume (FMOD_CHANNELGROUP *channelgroup, float *volume); -FMOD_RESULT F_API FMOD_ChannelGroup_SetPitch (FMOD_CHANNELGROUP *channelgroup, float pitch); -FMOD_RESULT F_API FMOD_ChannelGroup_GetPitch (FMOD_CHANNELGROUP *channelgroup, float *pitch); -FMOD_RESULT F_API FMOD_ChannelGroup_Set3DOcclusion (FMOD_CHANNELGROUP *channelgroup, float directocclusion, float reverbocclusion); -FMOD_RESULT F_API FMOD_ChannelGroup_Get3DOcclusion (FMOD_CHANNELGROUP *channelgroup, float *directocclusion, float *reverbocclusion); -FMOD_RESULT F_API FMOD_ChannelGroup_SetPaused (FMOD_CHANNELGROUP *channelgroup, FMOD_BOOL paused); -FMOD_RESULT F_API FMOD_ChannelGroup_GetPaused (FMOD_CHANNELGROUP *channelgroup, FMOD_BOOL *paused); -FMOD_RESULT F_API FMOD_ChannelGroup_SetMute (FMOD_CHANNELGROUP *channelgroup, FMOD_BOOL mute); -FMOD_RESULT F_API FMOD_ChannelGroup_GetMute (FMOD_CHANNELGROUP *channelgroup, FMOD_BOOL *mute); - -/* - Channelgroup override values. (recursively overwrites whatever settings the channels had) -*/ - -FMOD_RESULT F_API FMOD_ChannelGroup_Stop (FMOD_CHANNELGROUP *channelgroup); -FMOD_RESULT F_API FMOD_ChannelGroup_OverrideVolume (FMOD_CHANNELGROUP *channelgroup, float volume); -FMOD_RESULT F_API FMOD_ChannelGroup_OverrideFrequency(FMOD_CHANNELGROUP *channelgroup, float frequency); -FMOD_RESULT F_API FMOD_ChannelGroup_OverridePan (FMOD_CHANNELGROUP *channelgroup, float pan); -FMOD_RESULT F_API FMOD_ChannelGroup_OverrideReverbProperties(FMOD_CHANNELGROUP *channelgroup, const FMOD_REVERB_CHANNELPROPERTIES *prop); -FMOD_RESULT F_API FMOD_ChannelGroup_Override3DAttributes(FMOD_CHANNELGROUP *channelgroup, const FMOD_VECTOR *pos, const FMOD_VECTOR *vel); -FMOD_RESULT F_API FMOD_ChannelGroup_OverrideSpeakerMix(FMOD_CHANNELGROUP *channelgroup, float frontleft, float frontright, float center, float lfe, float backleft, float backright, float sideleft, float sideright); - -/* - Nested channel groups. -*/ - -FMOD_RESULT F_API FMOD_ChannelGroup_AddGroup (FMOD_CHANNELGROUP *channelgroup, FMOD_CHANNELGROUP *group); -FMOD_RESULT F_API FMOD_ChannelGroup_GetNumGroups (FMOD_CHANNELGROUP *channelgroup, int *numgroups); -FMOD_RESULT F_API FMOD_ChannelGroup_GetGroup (FMOD_CHANNELGROUP *channelgroup, int index, FMOD_CHANNELGROUP **group); -FMOD_RESULT F_API FMOD_ChannelGroup_GetParentGroup (FMOD_CHANNELGROUP *channelgroup, FMOD_CHANNELGROUP **group); - -/* - DSP functionality only for channel groups playing sounds created with FMOD_SOFTWARE. -*/ - -FMOD_RESULT F_API FMOD_ChannelGroup_GetDSPHead (FMOD_CHANNELGROUP *channelgroup, FMOD_DSP **dsp); -FMOD_RESULT F_API FMOD_ChannelGroup_AddDSP (FMOD_CHANNELGROUP *channelgroup, FMOD_DSP *dsp, FMOD_DSPCONNECTION **connection); - -/* - Information only functions. -*/ - -FMOD_RESULT F_API FMOD_ChannelGroup_GetName (FMOD_CHANNELGROUP *channelgroup, char *name, int namelen); -FMOD_RESULT F_API FMOD_ChannelGroup_GetNumChannels (FMOD_CHANNELGROUP *channelgroup, int *numchannels); -FMOD_RESULT F_API FMOD_ChannelGroup_GetChannel (FMOD_CHANNELGROUP *channelgroup, int index, FMOD_CHANNEL **channel); -FMOD_RESULT F_API FMOD_ChannelGroup_GetSpectrum (FMOD_CHANNELGROUP *channelgroup, float *spectrumarray, int numvalues, int channeloffset, FMOD_DSP_FFT_WINDOW windowtype); -FMOD_RESULT F_API FMOD_ChannelGroup_GetWaveData (FMOD_CHANNELGROUP *channelgroup, float *wavearray, int numvalues, int channeloffset); - -/* - Userdata set/get. -*/ - -FMOD_RESULT F_API FMOD_ChannelGroup_SetUserData (FMOD_CHANNELGROUP *channelgroup, void *userdata); -FMOD_RESULT F_API FMOD_ChannelGroup_GetUserData (FMOD_CHANNELGROUP *channelgroup, void **userdata); - -FMOD_RESULT F_API FMOD_ChannelGroup_GetMemoryInfo (FMOD_CHANNELGROUP *channelgroup, unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, FMOD_MEMORY_USAGE_DETAILS *memoryused_details); - -/* - 'SoundGroup' API -*/ - -FMOD_RESULT F_API FMOD_SoundGroup_Release (FMOD_SOUNDGROUP *soundgroup); -FMOD_RESULT F_API FMOD_SoundGroup_GetSystemObject (FMOD_SOUNDGROUP *soundgroup, FMOD_SYSTEM **system); - -/* - SoundGroup control functions. -*/ - -FMOD_RESULT F_API FMOD_SoundGroup_SetMaxAudible (FMOD_SOUNDGROUP *soundgroup, int maxaudible); -FMOD_RESULT F_API FMOD_SoundGroup_GetMaxAudible (FMOD_SOUNDGROUP *soundgroup, int *maxaudible); -FMOD_RESULT F_API FMOD_SoundGroup_SetMaxAudibleBehavior(FMOD_SOUNDGROUP *soundgroup, FMOD_SOUNDGROUP_BEHAVIOR behavior); -FMOD_RESULT F_API FMOD_SoundGroup_GetMaxAudibleBehavior(FMOD_SOUNDGROUP *soundgroup, FMOD_SOUNDGROUP_BEHAVIOR *behavior); -FMOD_RESULT F_API FMOD_SoundGroup_SetMuteFadeSpeed (FMOD_SOUNDGROUP *soundgroup, float speed); -FMOD_RESULT F_API FMOD_SoundGroup_GetMuteFadeSpeed (FMOD_SOUNDGROUP *soundgroup, float *speed); -FMOD_RESULT F_API FMOD_SoundGroup_SetVolume (FMOD_SOUNDGROUP *soundgroup, float volume); -FMOD_RESULT F_API FMOD_SoundGroup_GetVolume (FMOD_SOUNDGROUP *soundgroup, float *volume); -FMOD_RESULT F_API FMOD_SoundGroup_Stop (FMOD_SOUNDGROUP *soundgroup); - -/* - Information only functions. -*/ - -FMOD_RESULT F_API FMOD_SoundGroup_GetName (FMOD_SOUNDGROUP *soundgroup, char *name, int namelen); -FMOD_RESULT F_API FMOD_SoundGroup_GetNumSounds (FMOD_SOUNDGROUP *soundgroup, int *numsounds); -FMOD_RESULT F_API FMOD_SoundGroup_GetSound (FMOD_SOUNDGROUP *soundgroup, int index, FMOD_SOUND **sound); -FMOD_RESULT F_API FMOD_SoundGroup_GetNumPlaying (FMOD_SOUNDGROUP *soundgroup, int *numplaying); - -/* - Userdata set/get. -*/ - -FMOD_RESULT F_API FMOD_SoundGroup_SetUserData (FMOD_SOUNDGROUP *soundgroup, void *userdata); -FMOD_RESULT F_API FMOD_SoundGroup_GetUserData (FMOD_SOUNDGROUP *soundgroup, void **userdata); - -FMOD_RESULT F_API FMOD_SoundGroup_GetMemoryInfo (FMOD_SOUNDGROUP *soundgroup, unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, FMOD_MEMORY_USAGE_DETAILS *memoryused_details); - -/* - 'DSP' API -*/ - -FMOD_RESULT F_API FMOD_DSP_Release (FMOD_DSP *dsp); -FMOD_RESULT F_API FMOD_DSP_GetSystemObject (FMOD_DSP *dsp, FMOD_SYSTEM **system); - -/* - Connection / disconnection / input and output enumeration. -*/ - -FMOD_RESULT F_API FMOD_DSP_AddInput (FMOD_DSP *dsp, FMOD_DSP *target, FMOD_DSPCONNECTION **connection); -FMOD_RESULT F_API FMOD_DSP_DisconnectFrom (FMOD_DSP *dsp, FMOD_DSP *target); -FMOD_RESULT F_API FMOD_DSP_DisconnectAll (FMOD_DSP *dsp, FMOD_BOOL inputs, FMOD_BOOL outputs); -FMOD_RESULT F_API FMOD_DSP_Remove (FMOD_DSP *dsp); -FMOD_RESULT F_API FMOD_DSP_GetNumInputs (FMOD_DSP *dsp, int *numinputs); -FMOD_RESULT F_API FMOD_DSP_GetNumOutputs (FMOD_DSP *dsp, int *numoutputs); -FMOD_RESULT F_API FMOD_DSP_GetInput (FMOD_DSP *dsp, int index, FMOD_DSP **input, FMOD_DSPCONNECTION **inputconnection); -FMOD_RESULT F_API FMOD_DSP_GetOutput (FMOD_DSP *dsp, int index, FMOD_DSP **output, FMOD_DSPCONNECTION **outputconnection); - -/* - DSP unit control. -*/ - -FMOD_RESULT F_API FMOD_DSP_SetActive (FMOD_DSP *dsp, FMOD_BOOL active); -FMOD_RESULT F_API FMOD_DSP_GetActive (FMOD_DSP *dsp, FMOD_BOOL *active); -FMOD_RESULT F_API FMOD_DSP_SetBypass (FMOD_DSP *dsp, FMOD_BOOL bypass); -FMOD_RESULT F_API FMOD_DSP_GetBypass (FMOD_DSP *dsp, FMOD_BOOL *bypass); -FMOD_RESULT F_API FMOD_DSP_SetSpeakerActive (FMOD_DSP *dsp, FMOD_SPEAKER speaker, FMOD_BOOL active); -FMOD_RESULT F_API FMOD_DSP_GetSpeakerActive (FMOD_DSP *dsp, FMOD_SPEAKER speaker, FMOD_BOOL *active); -FMOD_RESULT F_API FMOD_DSP_Reset (FMOD_DSP *dsp); - -/* - DSP parameter control. -*/ - -FMOD_RESULT F_API FMOD_DSP_SetParameter (FMOD_DSP *dsp, int index, float value); -FMOD_RESULT F_API FMOD_DSP_GetParameter (FMOD_DSP *dsp, int index, float *value, char *valuestr, int valuestrlen); -FMOD_RESULT F_API FMOD_DSP_GetNumParameters (FMOD_DSP *dsp, int *numparams); -FMOD_RESULT F_API FMOD_DSP_GetParameterInfo (FMOD_DSP *dsp, int index, char *name, char *label, char *description, int descriptionlen, float *min, float *max); -FMOD_RESULT F_API FMOD_DSP_ShowConfigDialog (FMOD_DSP *dsp, void *hwnd, FMOD_BOOL show); - -/* - DSP attributes. -*/ - -FMOD_RESULT F_API FMOD_DSP_GetInfo (FMOD_DSP *dsp, char *name, unsigned int *version, int *channels, int *configwidth, int *configheight); -FMOD_RESULT F_API FMOD_DSP_GetType (FMOD_DSP *dsp, FMOD_DSP_TYPE *type); -FMOD_RESULT F_API FMOD_DSP_SetDefaults (FMOD_DSP *dsp, float frequency, float volume, float pan, int priority); -FMOD_RESULT F_API FMOD_DSP_GetDefaults (FMOD_DSP *dsp, float *frequency, float *volume, float *pan, int *priority); - -/* - Userdata set/get. -*/ - -FMOD_RESULT F_API FMOD_DSP_SetUserData (FMOD_DSP *dsp, void *userdata); -FMOD_RESULT F_API FMOD_DSP_GetUserData (FMOD_DSP *dsp, void **userdata); - -FMOD_RESULT F_API FMOD_DSP_GetMemoryInfo (FMOD_DSP *dsp, unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, FMOD_MEMORY_USAGE_DETAILS *memoryused_details); - -/* - 'DSPConnection' API -*/ - -FMOD_RESULT F_API FMOD_DSPConnection_GetInput (FMOD_DSPCONNECTION *dspconnection, FMOD_DSP **input); -FMOD_RESULT F_API FMOD_DSPConnection_GetOutput (FMOD_DSPCONNECTION *dspconnection, FMOD_DSP **output); -FMOD_RESULT F_API FMOD_DSPConnection_SetMix (FMOD_DSPCONNECTION *dspconnection, float volume); -FMOD_RESULT F_API FMOD_DSPConnection_GetMix (FMOD_DSPCONNECTION *dspconnection, float *volume); -FMOD_RESULT F_API FMOD_DSPConnection_SetLevels (FMOD_DSPCONNECTION *dspconnection, FMOD_SPEAKER speaker, float *levels, int numlevels); -FMOD_RESULT F_API FMOD_DSPConnection_GetLevels (FMOD_DSPCONNECTION *dspconnection, FMOD_SPEAKER speaker, float *levels, int numlevels); - -/* - Userdata set/get. -*/ - -FMOD_RESULT F_API FMOD_DSPConnection_SetUserData (FMOD_DSPCONNECTION *dspconnection, void *userdata); -FMOD_RESULT F_API FMOD_DSPConnection_GetUserData (FMOD_DSPCONNECTION *dspconnection, void **userdata); - -FMOD_RESULT F_API FMOD_DSPConnection_GetMemoryInfo (FMOD_DSPCONNECTION *dspconnection, unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, FMOD_MEMORY_USAGE_DETAILS *memoryused_details); - -/* - 'Geometry' API -*/ - -FMOD_RESULT F_API FMOD_Geometry_Release (FMOD_GEOMETRY *geometry); - -/* - Polygon manipulation. -*/ - -FMOD_RESULT F_API FMOD_Geometry_AddPolygon (FMOD_GEOMETRY *geometry, float directocclusion, float reverbocclusion, FMOD_BOOL doublesided, int numvertices, const FMOD_VECTOR *vertices, int *polygonindex); -FMOD_RESULT F_API FMOD_Geometry_GetNumPolygons (FMOD_GEOMETRY *geometry, int *numpolygons); -FMOD_RESULT F_API FMOD_Geometry_GetMaxPolygons (FMOD_GEOMETRY *geometry, int *maxpolygons, int *maxvertices); -FMOD_RESULT F_API FMOD_Geometry_GetPolygonNumVertices(FMOD_GEOMETRY *geometry, int index, int *numvertices); -FMOD_RESULT F_API FMOD_Geometry_SetPolygonVertex (FMOD_GEOMETRY *geometry, int index, int vertexindex, const FMOD_VECTOR *vertex); -FMOD_RESULT F_API FMOD_Geometry_GetPolygonVertex (FMOD_GEOMETRY *geometry, int index, int vertexindex, FMOD_VECTOR *vertex); -FMOD_RESULT F_API FMOD_Geometry_SetPolygonAttributes (FMOD_GEOMETRY *geometry, int index, float directocclusion, float reverbocclusion, FMOD_BOOL doublesided); -FMOD_RESULT F_API FMOD_Geometry_GetPolygonAttributes (FMOD_GEOMETRY *geometry, int index, float *directocclusion, float *reverbocclusion, FMOD_BOOL *doublesided); - -/* - Object manipulation. -*/ - -FMOD_RESULT F_API FMOD_Geometry_SetActive (FMOD_GEOMETRY *geometry, FMOD_BOOL active); -FMOD_RESULT F_API FMOD_Geometry_GetActive (FMOD_GEOMETRY *geometry, FMOD_BOOL *active); -FMOD_RESULT F_API FMOD_Geometry_SetRotation (FMOD_GEOMETRY *geometry, const FMOD_VECTOR *forward, const FMOD_VECTOR *up); -FMOD_RESULT F_API FMOD_Geometry_GetRotation (FMOD_GEOMETRY *geometry, FMOD_VECTOR *forward, FMOD_VECTOR *up); -FMOD_RESULT F_API FMOD_Geometry_SetPosition (FMOD_GEOMETRY *geometry, const FMOD_VECTOR *position); -FMOD_RESULT F_API FMOD_Geometry_GetPosition (FMOD_GEOMETRY *geometry, FMOD_VECTOR *position); -FMOD_RESULT F_API FMOD_Geometry_SetScale (FMOD_GEOMETRY *geometry, const FMOD_VECTOR *scale); -FMOD_RESULT F_API FMOD_Geometry_GetScale (FMOD_GEOMETRY *geometry, FMOD_VECTOR *scale); -FMOD_RESULT F_API FMOD_Geometry_Save (FMOD_GEOMETRY *geometry, void *data, int *datasize); - -/* - Userdata set/get. -*/ - -FMOD_RESULT F_API FMOD_Geometry_SetUserData (FMOD_GEOMETRY *geometry, void *userdata); -FMOD_RESULT F_API FMOD_Geometry_GetUserData (FMOD_GEOMETRY *geometry, void **userdata); - -FMOD_RESULT F_API FMOD_Geometry_GetMemoryInfo (FMOD_GEOMETRY *geometry, unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, FMOD_MEMORY_USAGE_DETAILS *memoryused_details); - -/* - 'Reverb' API -*/ - -FMOD_RESULT F_API FMOD_Reverb_Release (FMOD_REVERB *reverb); - -/* - Reverb manipulation. -*/ - -FMOD_RESULT F_API FMOD_Reverb_Set3DAttributes (FMOD_REVERB *reverb, const FMOD_VECTOR *position, float mindistance, float maxdistance); -FMOD_RESULT F_API FMOD_Reverb_Get3DAttributes (FMOD_REVERB *reverb, FMOD_VECTOR *position, float *mindistance, float *maxdistance); -FMOD_RESULT F_API FMOD_Reverb_SetProperties (FMOD_REVERB *reverb, const FMOD_REVERB_PROPERTIES *properties); -FMOD_RESULT F_API FMOD_Reverb_GetProperties (FMOD_REVERB *reverb, FMOD_REVERB_PROPERTIES *properties); -FMOD_RESULT F_API FMOD_Reverb_SetActive (FMOD_REVERB *reverb, FMOD_BOOL active); -FMOD_RESULT F_API FMOD_Reverb_GetActive (FMOD_REVERB *reverb, FMOD_BOOL *active); - -/* - Userdata set/get. -*/ - -FMOD_RESULT F_API FMOD_Reverb_SetUserData (FMOD_REVERB *reverb, void *userdata); -FMOD_RESULT F_API FMOD_Reverb_GetUserData (FMOD_REVERB *reverb, void **userdata); - -FMOD_RESULT F_API FMOD_Reverb_GetMemoryInfo (FMOD_REVERB *reverb, unsigned int memorybits, unsigned int event_memorybits, unsigned int *memoryused, FMOD_MEMORY_USAGE_DETAILS *memoryused_details); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/libs/fmodex/inc/fmod_codec.h b/libs/fmodex/inc/fmod_codec.h deleted file mode 100644 index 2e13eb69d..000000000 --- a/libs/fmodex/inc/fmod_codec.h +++ /dev/null @@ -1,159 +0,0 @@ -/* ==================================================================================================== */ -/* FMOD Ex - codec development header file. Copyright (c), Firelight Technologies Pty, Ltd. 2004-2011. */ -/* */ -/* Use this header if you are wanting to develop your own file format plugin to use with */ -/* FMOD's codec system. With this header you can make your own fileformat plugin that FMOD */ -/* can register and use. See the documentation and examples on how to make a working plugin. */ -/* */ -/* ==================================================================================================== */ - -#ifndef _FMOD_CODEC_H -#define _FMOD_CODEC_H - -typedef struct FMOD_CODEC_STATE FMOD_CODEC_STATE; -typedef struct FMOD_CODEC_WAVEFORMAT FMOD_CODEC_WAVEFORMAT; - -/* - Codec callbacks -*/ -typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_OPENCALLBACK) (FMOD_CODEC_STATE *codec_state, FMOD_MODE usermode, FMOD_CREATESOUNDEXINFO *userexinfo); -typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_CLOSECALLBACK) (FMOD_CODEC_STATE *codec_state); -typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_READCALLBACK) (FMOD_CODEC_STATE *codec_state, void *buffer, unsigned int sizebytes, unsigned int *bytesread); -typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_GETLENGTHCALLBACK) (FMOD_CODEC_STATE *codec_state, unsigned int *length, FMOD_TIMEUNIT lengthtype); -typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_SETPOSITIONCALLBACK) (FMOD_CODEC_STATE *codec_state, int subsound, unsigned int position, FMOD_TIMEUNIT postype); -typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_GETPOSITIONCALLBACK) (FMOD_CODEC_STATE *codec_state, unsigned int *position, FMOD_TIMEUNIT postype); -typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_SOUNDCREATECALLBACK) (FMOD_CODEC_STATE *codec_state, int subsound, FMOD_SOUND *sound); -typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_METADATACALLBACK) (FMOD_CODEC_STATE *codec_state, FMOD_TAGTYPE tagtype, char *name, void *data, unsigned int datalen, FMOD_TAGDATATYPE datatype, int unique); -typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_GETWAVEFORMAT) (FMOD_CODEC_STATE *codec_state, int index, FMOD_CODEC_WAVEFORMAT *waveformat); - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - When creating a codec, declare one of these and provide the relevant callbacks and name for FMOD to use when it opens and reads a file. - - [REMARKS] - Members marked with [in] mean the variable can be written to. The user can set the value. - Members marked with [out] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_CODEC_STATE -] -*/ -typedef struct FMOD_CODEC_DESCRIPTION -{ - const char *name; /* [in] Name of the codec. */ - unsigned int version; /* [in] Plugin writer's version number. */ - int defaultasstream; /* [in] Tells FMOD to open the file as a stream when calling System::createSound, and not a static sample. Should normally be 0 (FALSE), because generally the user wants to decode the file into memory when using System::createSound. Mainly used for formats that decode for a very long time, or could use large amounts of memory when decoded. Usually sequenced formats such as mod/s3m/xm/it/midi fall into this category. It is mainly to stop users that don't know what they're doing from getting FMOD_ERR_MEMORY returned from createSound when they should have in fact called System::createStream or used FMOD_CREATESTREAM in System::createSound. */ - FMOD_TIMEUNIT timeunits; /* [in] When setposition codec is called, only these time formats will be passed to the codec. Use bitwise OR to accumulate different types. */ - FMOD_CODEC_OPENCALLBACK open; /* [in] Open callback for the codec for when FMOD tries to open a sound using this codec. */ - FMOD_CODEC_CLOSECALLBACK close; /* [in] Close callback for the codec for when FMOD tries to close a sound using this codec. */ - FMOD_CODEC_READCALLBACK read; /* [in] Read callback for the codec for when FMOD tries to read some data from the file to the destination format (specified in the open callback). */ - FMOD_CODEC_GETLENGTHCALLBACK getlength; /* [in] Callback to return the length of the song in whatever format required when Sound::getLength is called. */ - FMOD_CODEC_SETPOSITIONCALLBACK setposition; /* [in] Seek callback for the codec for when FMOD tries to seek within the file with Channel::setPosition. */ - FMOD_CODEC_GETPOSITIONCALLBACK getposition; /* [in] Tell callback for the codec for when FMOD tries to get the current position within the with Channel::getPosition. */ - FMOD_CODEC_SOUNDCREATECALLBACK soundcreate; /* [in] Sound creation callback for the codec when FMOD finishes creating the sound. (So the codec can set more parameters for the related created sound, ie loop points/mode or 3D attributes etc). */ - FMOD_CODEC_GETWAVEFORMAT getwaveformat; /* [in] Callback to tell FMOD about the waveformat of a particular subsound. This is to save memory, rather than saving 1000 FMOD_CODEC_WAVEFORMAT structures in the codec, the codec might have a more optimal way of storing this information. */ -} FMOD_CODEC_DESCRIPTION; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Set these values marked 'in' to tell fmod what sort of sound to create. - The format, channels and frequency tell FMOD what sort of hardware buffer to create when you initialize your code. So if you wrote an MP3 codec that decoded to stereo 16bit integer PCM, you would specify FMOD_SOUND_FORMAT_PCM16, and channels would be equal to 2. - Members marked as 'out' are set by fmod. Do not modify these. Simply specify 0 for these values when declaring the structure, FMOD will fill in the values for you after creation with the correct function pointers. - - [REMARKS] - Members marked with [in] mean the variable can be written to. The user can set the value. - Members marked with [out] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - - An FMOD file might be from disk, memory or network, however the file may be opened by the user. - - 'numsubsounds' should be 0 if the file is a normal single sound stream or sound. Examples of this would be .WAV, .WMA, .MP3, .AIFF. - 'numsubsounds' should be 1+ if the file is a container format, and does not contain wav data itself. Examples of these types would be CDDA (multiple CD tracks), FSB (contains multiple sounds), MIDI/MOD/S3M/XM/IT (contain instruments). - The arrays of format, channel, frequency, length and blockalign should point to arrays of information based on how many subsounds are in the format. If the number of subsounds is 0 then it should point to 1 of each attribute, the same as if the number of subsounds was 1. If subsounds was 100 for example, each pointer should point to an array of 100 of each attribute. - When a sound has 1 or more subsounds, you must play the individual sounds specified by first obtaining the subsound with Sound::getSubSound. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_SOUND_FORMAT - FMOD_FILE_READCALLBACK - FMOD_FILE_SEEKCALLBACK - FMOD_CODEC_METADATACALLBACK - Sound::getSubSound - Sound::getNumSubSounds -] -*/ -struct FMOD_CODEC_WAVEFORMAT -{ - char name[256]; /* [in] Name of sound.*/ - FMOD_SOUND_FORMAT format; /* [in] Format for (decompressed) codec output, ie FMOD_SOUND_FORMAT_PCM8, FMOD_SOUND_FORMAT_PCM16.*/ - int channels; /* [in] Number of channels used by codec, ie mono = 1, stereo = 2. */ - int frequency; /* [in] Default frequency in hz of the codec, ie 44100. */ - unsigned int lengthbytes; /* [in] Length in bytes of the source data. */ - unsigned int lengthpcm; /* [in] Length in decompressed, PCM samples of the file, ie length in seconds * frequency. Used for Sound::getLength and for memory allocation of static decompressed sample data. */ - int blockalign; /* [in] Blockalign in decompressed, PCM samples of the optimal decode chunk size for this format. The codec read callback will be called in multiples of this value. */ - int loopstart; /* [in] Loopstart in decompressed, PCM samples of file. */ - int loopend; /* [in] Loopend in decompressed, PCM samples of file. */ - FMOD_MODE mode; /* [in] Mode to determine whether the sound should by default load as looping, non looping, 2d or 3d. */ - unsigned int channelmask; /* [in] Microsoft speaker channel mask, as defined for WAVEFORMATEXTENSIBLE and is found in ksmedia.h. Leave at 0 to play in natural speaker order. */ -}; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Codec plugin structure that is passed into each callback. - - Set these numsubsounds and waveformat members when called in FMOD_CODEC_OPENCALLBACK to tell fmod what sort of sound to create. - - The format, channels and frequency tell FMOD what sort of hardware buffer to create when you initialize your code. So if you wrote an MP3 codec that decoded to stereo 16bit integer PCM, you would specify FMOD_SOUND_FORMAT_PCM16, and channels would be equal to 2. - - [REMARKS] - Members marked with [in] mean the variable can be written to. The user can set the value. - Members marked with [out] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - - An FMOD file might be from disk, memory or internet, however the file may be opened by the user. - - 'numsubsounds' should be 0 if the file is a normal single sound stream or sound. Examples of this would be .WAV, .WMA, .MP3, .AIFF. - 'numsubsounds' should be 1+ if the file is a container format, and does not contain wav data itself. Examples of these types would be CDDA (multiple CD tracks), FSB (contains multiple sounds), DLS (contain instruments). - The arrays of format, channel, frequency, length and blockalign should point to arrays of information based on how many subsounds are in the format. If the number of subsounds is 0 then it should point to 1 of each attribute, the same as if the number of subsounds was 1. If subsounds was 100 for example, each pointer should point to an array of 100 of each attribute. - When a sound has 1 or more subsounds, you must play the individual sounds specified by first obtaining the subsound with Sound::getSubSound. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_SOUND_FORMAT - FMOD_FILE_READCALLBACK - FMOD_FILE_SEEKCALLBACK - FMOD_CODEC_METADATACALLBACK - Sound::getSubSound - Sound::getNumSubSounds -] -*/ -struct FMOD_CODEC_STATE -{ - int numsubsounds; /* [in] Number of 'subsounds' in this sound. Anything other than 0 makes it a 'container' format (ie CDDA/DLS/FSB etc which contain 1 or more su bsounds). For most normal, single sound codec such as WAV/AIFF/MP3, this should be 0 as they are not a container for subsounds, they are the sound by itself. */ - FMOD_CODEC_WAVEFORMAT *waveformat; /* [in] Pointer to an array of format structures containing information about each sample. Can be 0 or NULL if FMOD_CODEC_GETWAVEFORMAT callback is preferred. The number of entries here must equal the number of subsounds defined in the subsound parameter. If numsubsounds = 0 then there should be 1 instance of this structure. */ - void *plugindata; /* [in] Plugin writer created data the codec author wants to attach to this object. */ - - void *filehandle; /* [out] This will return an internal FMOD file handle to use with the callbacks provided. */ - unsigned int filesize; /* [out] This will contain the size of the file in bytes. */ - FMOD_FILE_READCALLBACK fileread; /* [out] This will return a callable FMOD file function to use from codec. */ - FMOD_FILE_SEEKCALLBACK fileseek; /* [out] This will return a callable FMOD file function to use from codec. */ - FMOD_CODEC_METADATACALLBACK metadata; /* [out] This will return a callable FMOD metadata function to use from codec. */ -}; - -#endif - - diff --git a/libs/fmodex/inc/fmod_dsp.h b/libs/fmodex/inc/fmod_dsp.h deleted file mode 100644 index 1c5e2a62b..000000000 --- a/libs/fmodex/inc/fmod_dsp.h +++ /dev/null @@ -1,743 +0,0 @@ -/* ========================================================================================== */ -/* FMOD Ex - DSP header file. Copyright (c), Firelight Technologies Pty, Ltd. 2004-2011. */ -/* */ -/* Use this header if you are interested in delving deeper into the FMOD software mixing / */ -/* DSP engine. In this header you can find parameter structures for FMOD system reigstered */ -/* DSP effects and generators. */ -/* Also use this header if you are wanting to develop your own DSP plugin to use with FMOD's */ -/* dsp system. With this header you can make your own DSP plugin that FMOD can */ -/* register and use. See the documentation and examples on how to make a working plugin. */ -/* */ -/* ========================================================================================== */ - -#ifndef _FMOD_DSP_H -#define _FMOD_DSP_H - -typedef struct FMOD_DSP_STATE FMOD_DSP_STATE; - -/* - DSP callbacks -*/ -typedef FMOD_RESULT (F_CALLBACK *FMOD_DSP_CREATECALLBACK) (FMOD_DSP_STATE *dsp_state); -typedef FMOD_RESULT (F_CALLBACK *FMOD_DSP_RELEASECALLBACK) (FMOD_DSP_STATE *dsp_state); -typedef FMOD_RESULT (F_CALLBACK *FMOD_DSP_RESETCALLBACK) (FMOD_DSP_STATE *dsp_state); -typedef FMOD_RESULT (F_CALLBACK *FMOD_DSP_READCALLBACK) (FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int outchannels); -typedef FMOD_RESULT (F_CALLBACK *FMOD_DSP_SETPOSITIONCALLBACK)(FMOD_DSP_STATE *dsp_state, unsigned int pos); -typedef FMOD_RESULT (F_CALLBACK *FMOD_DSP_SETPARAMCALLBACK) (FMOD_DSP_STATE *dsp_state, int index, float value); -typedef FMOD_RESULT (F_CALLBACK *FMOD_DSP_GETPARAMCALLBACK) (FMOD_DSP_STATE *dsp_state, int index, float *value, char *valuestr); -typedef FMOD_RESULT (F_CALLBACK *FMOD_DSP_DIALOGCALLBACK) (FMOD_DSP_STATE *dsp_state, void *hwnd, int show); - -/* -[ENUM] -[ - [DESCRIPTION] - These definitions can be used for creating FMOD defined special effects or DSP units. - - [REMARKS] - To get them to be active, first create the unit, then add it somewhere into the DSP network, either at the front of the network near the soundcard unit to affect the global output (by using System::getDSPHead), or on a single channel (using Channel::getDSPHead). - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::createDSPByType -] -*/ -typedef enum -{ - FMOD_DSP_TYPE_UNKNOWN, /* This unit was created via a non FMOD plugin so has an unknown purpose. */ - FMOD_DSP_TYPE_MIXER, /* This unit does nothing but take inputs and mix them together then feed the result to the soundcard unit. */ - FMOD_DSP_TYPE_OSCILLATOR, /* This unit generates sine/square/saw/triangle or noise tones. */ - FMOD_DSP_TYPE_LOWPASS, /* This unit filters sound using a high quality, resonant lowpass filter algorithm but consumes more CPU time. */ - FMOD_DSP_TYPE_ITLOWPASS, /* This unit filters sound using a resonant lowpass filter algorithm that is used in Impulse Tracker, but with limited cutoff range (0 to 8060hz). */ - FMOD_DSP_TYPE_HIGHPASS, /* This unit filters sound using a resonant highpass filter algorithm. */ - FMOD_DSP_TYPE_ECHO, /* This unit produces an echo on the sound and fades out at the desired rate. */ - FMOD_DSP_TYPE_FLANGE, /* This unit produces a flange effect on the sound. */ - FMOD_DSP_TYPE_DISTORTION, /* This unit distorts the sound. */ - FMOD_DSP_TYPE_NORMALIZE, /* This unit normalizes or amplifies the sound to a certain level. */ - FMOD_DSP_TYPE_PARAMEQ, /* This unit attenuates or amplifies a selected frequency range. */ - FMOD_DSP_TYPE_PITCHSHIFT, /* This unit bends the pitch of a sound without changing the speed of playback. */ - FMOD_DSP_TYPE_CHORUS, /* This unit produces a chorus effect on the sound. */ - FMOD_DSP_TYPE_VSTPLUGIN, /* This unit allows the use of Steinberg VST plugins */ - FMOD_DSP_TYPE_WINAMPPLUGIN, /* This unit allows the use of Nullsoft Winamp plugins */ - FMOD_DSP_TYPE_ITECHO, /* This unit produces an echo on the sound and fades out at the desired rate as is used in Impulse Tracker. */ - FMOD_DSP_TYPE_COMPRESSOR, /* This unit implements dynamic compression (linked multichannel, wideband) */ - FMOD_DSP_TYPE_SFXREVERB, /* This unit implements SFX reverb */ - FMOD_DSP_TYPE_LOWPASS_SIMPLE, /* This unit filters sound using a simple lowpass with no resonance, but has flexible cutoff and is fast. */ - FMOD_DSP_TYPE_DELAY, /* This unit produces different delays on individual channels of the sound. */ - FMOD_DSP_TYPE_TREMOLO, /* This unit produces a tremolo / chopper effect on the sound. */ - FMOD_DSP_TYPE_LADSPAPLUGIN, /* This unit allows the use of LADSPA standard plugins. */ - FMOD_DSP_TYPE_HIGHPASS_SIMPLE, /* This unit filters sound using a simple highpass with no resonance, but has flexible cutoff and is fast. */ - FMOD_DSP_TYPE_HARDWARE = 1000, /* Offset that platform specific FMOD_HARDWARE DSPs will start at. */ - FMOD_DSP_TYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ -} FMOD_DSP_TYPE; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure to define a parameter for a DSP unit. - - [REMARKS] - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::createDSP - DSP::setParameter -] -*/ -typedef struct FMOD_DSP_PARAMETERDESC -{ - float min; /* [w] Minimum value of the parameter (ie 100.0). */ - float max; /* [w] Maximum value of the parameter (ie 22050.0). */ - float defaultval; /* [w] Default value of parameter. */ - char name[16]; /* [w] Name of the parameter to be displayed (ie "Cutoff frequency"). */ - char label[16]; /* [w] Short string to be put next to value to denote the unit type (ie "hz"). */ - const char *description; /* [w] Description of the parameter to be displayed as a help item / tooltip for this parameter. */ -} FMOD_DSP_PARAMETERDESC; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - When creating a DSP unit, declare one of these and provide the relevant callbacks and name for FMOD to use when it creates and uses a DSP unit of this type. - - [REMARKS] - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - - There are 2 different ways to change a parameter in this architecture. - One is to use DSP::setParameter / DSP::getParameter. This is platform independant and is dynamic, so new unknown plugins can have their parameters enumerated and used. - The other is to use DSP::showConfigDialog. This is platform specific and requires a GUI, and will display a dialog box to configure the plugin. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::createDSP - FMOD_DSP_STATE -] -*/ -typedef struct FMOD_DSP_DESCRIPTION -{ - char name[32]; /* [w] Name of the unit to be displayed in the network. */ - unsigned int version; /* [w] Plugin writer's version number. */ - int channels; /* [w] Number of channels. Use 0 to process whatever number of channels is currently in the network. >0 would be mostly used if the unit is a unit that only generates sound. */ - FMOD_DSP_CREATECALLBACK create; /* [w] Create callback. This is called when DSP unit is created. Can be null. */ - FMOD_DSP_RELEASECALLBACK release; /* [w] Release callback. This is called just before the unit is freed so the user can do any cleanup needed for the unit. Can be null. */ - FMOD_DSP_RESETCALLBACK reset; /* [w] Reset callback. This is called by the user to reset any history buffers that may need resetting for a filter, when it is to be used or re-used for the first time to its initial clean state. Use to avoid clicks or artifacts. */ - FMOD_DSP_READCALLBACK read; /* [w] Read callback. Processing is done here. Can be null. */ - FMOD_DSP_SETPOSITIONCALLBACK setposition; /* [w] Set position callback. This is called if the unit wants to update its position info but not process data, or reset a cursor position internally if it is reading data from a certain source. Can be null. */ - - int numparameters; /* [w] Number of parameters used in this filter. The user finds this with DSP::getNumParameters */ - FMOD_DSP_PARAMETERDESC *paramdesc; /* [w] Variable number of parameter structures. */ - FMOD_DSP_SETPARAMCALLBACK setparameter; /* [w] This is called when the user calls DSP::setParameter. Can be null. */ - FMOD_DSP_GETPARAMCALLBACK getparameter; /* [w] This is called when the user calls DSP::getParameter. Can be null. */ - FMOD_DSP_DIALOGCALLBACK config; /* [w] This is called when the user calls DSP::showConfigDialog. Can be used to display a dialog to configure the filter. Can be null. */ - int configwidth; /* [w] Width of config dialog graphic if there is one. 0 otherwise.*/ - int configheight; /* [w] Height of config dialog graphic if there is one. 0 otherwise.*/ - void *userdata; /* [w] Optional. Specify 0 to ignore. This is user data to be attached to the DSP unit during creation. Access via DSP::getUserData. */ -} FMOD_DSP_DESCRIPTION; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - DSP plugin structure that is passed into each callback. - - [REMARKS] - Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - Members marked with [w] mean the variable can be written to. The user can set the value. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_DSP_DESCRIPTION -] -*/ -struct FMOD_DSP_STATE -{ - FMOD_DSP *instance; /* [r] Handle to the DSP hand the user created. Not to be modified. C++ users cast to FMOD::DSP to use. */ - void *plugindata; /* [w] Plugin writer created data the output author wants to attach to this object. */ - unsigned short speakermask; /* [w] Specifies which speakers the DSP effect is active on */ -}; - - -/* - =================================================================================================== - - FMOD built in effect parameters. - Use DSP::setParameter with these enums for the 'index' parameter. - - =================================================================================================== -*/ - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_OSCILLATOR filter. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_OSCILLATOR_TYPE, /* Waveform type. 0 = sine. 1 = square. 2 = sawup. 3 = sawdown. 4 = triangle. 5 = noise. */ - FMOD_DSP_OSCILLATOR_RATE /* Frequency of the sinewave in hz. 1.0 to 22000.0. Default = 220.0. */ -} FMOD_DSP_OSCILLATOR; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_LOWPASS filter. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_LOWPASS_CUTOFF, /* Lowpass cutoff frequency in hz. 10.0 to 22000.0. Default = 5000.0. */ - FMOD_DSP_LOWPASS_RESONANCE /* Lowpass resonance Q value. 1.0 to 10.0. Default = 1.0. */ -} FMOD_DSP_LOWPASS; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_ITLOWPASS filter. - This is different to the default FMOD_DSP_TYPE_ITLOWPASS filter in that it uses a different quality algorithm and is - the filter used to produce the correct sounding playback in .IT files. - FMOD Ex's .IT playback uses this filter. - - [REMARKS] - Note! This filter actually has a limited cutoff frequency below the specified maximum, due to its limited design, - so for a more open range filter use FMOD_DSP_LOWPASS or if you don't mind not having resonance, - FMOD_DSP_LOWPASS_SIMPLE. - The effective maximum cutoff is about 8060hz. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_ITLOWPASS_CUTOFF, /* Lowpass cutoff frequency in hz. 1.0 to 22000.0. Default = 5000.0/ */ - FMOD_DSP_ITLOWPASS_RESONANCE /* Lowpass resonance Q value. 0.0 to 127.0. Default = 1.0. */ -} FMOD_DSP_ITLOWPASS; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_HIGHPASS filter. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_HIGHPASS_CUTOFF, /* Highpass cutoff frequency in hz. 1.0 to output 22000.0. Default = 5000.0. */ - FMOD_DSP_HIGHPASS_RESONANCE /* Highpass resonance Q value. 1.0 to 10.0. Default = 1.0. */ -} FMOD_DSP_HIGHPASS; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_ECHO filter. - - [REMARKS] - Note. Every time the delay is changed, the plugin re-allocates the echo buffer. This means the echo will dissapear at that time while it refills its new buffer. - Larger echo delays result in larger amounts of memory allocated. - - 'maxchannels' also dictates the amount of memory allocated. By default, the maxchannels value is 0. If FMOD is set to stereo, the echo unit will allocate enough memory for 2 channels. If it is 5.1, it will allocate enough memory for a 6 channel echo, etc. - If the echo effect is only ever applied to the global mix (ie it was added with System::addDSP), then 0 is the value to set as it will be enough to handle all speaker modes. - When the echo is added to a channel (ie Channel::addDSP) then the channel count that comes in could be anything from 1 to 8 possibly. It is only in this case where you might want to increase the channel count above the output's channel count. - If a channel echo is set to a lower number than the sound's channel count that is coming in, it will not echo the sound. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_ECHO_DELAY, /* Echo delay in ms. 10 to 5000. Default = 500. */ - FMOD_DSP_ECHO_DECAYRATIO, /* Echo decay per delay. 0 to 1. 1.0 = No decay, 0.0 = total decay (ie simple 1 line delay). Default = 0.5. */ - FMOD_DSP_ECHO_MAXCHANNELS, /* Maximum channels supported. 0 to 16. 0 = same as fmod's default output polyphony, 1 = mono, 2 = stereo etc. See remarks for more. Default = 0. It is suggested to leave at 0! */ - FMOD_DSP_ECHO_DRYMIX, /* Volume of original signal to pass to output. 0.0 to 1.0. Default = 1.0. */ - FMOD_DSP_ECHO_WETMIX /* Volume of echo signal to pass to output. 0.0 to 1.0. Default = 1.0. */ -} FMOD_DSP_ECHO; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_DELAY filter. - - [REMARKS] - Note. Every time MaxDelay is changed, the plugin re-allocates the delay buffer. This means the delay will dissapear at that time while it refills its new buffer. - A larger MaxDelay results in larger amounts of memory allocated. - Channel delays above MaxDelay will be clipped to MaxDelay and the delay buffer will not be resized. - - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_DELAY_CH0, /* Channel #0 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH1, /* Channel #1 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH2, /* Channel #2 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH3, /* Channel #3 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH4, /* Channel #4 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH5, /* Channel #5 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH6, /* Channel #6 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH7, /* Channel #7 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH8, /* Channel #8 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH9, /* Channel #9 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH10, /* Channel #10 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH11, /* Channel #11 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH12, /* Channel #12 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH13, /* Channel #13 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH14, /* Channel #14 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_CH15, /* Channel #15 Delay in ms. 0 to 10000. Default = 0. */ - FMOD_DSP_DELAY_MAXDELAY /* Maximum delay in ms. 0 to 10000. Default = 10. */ -} FMOD_DSP_DELAY; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_FLANGE filter. - - [REMARKS] - Flange is an effect where the signal is played twice at the same time, and one copy slides back and forth creating a whooshing or flanging effect. - As there are 2 copies of the same signal, by default each signal is given 50% mix, so that the total is not louder than the original unaffected signal. - - Flange depth is a percentage of a 10ms shift from the original signal. Anything above 10ms is not considered flange because to the ear it begins to 'echo' so 10ms is the highest value possible. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_FLANGE_DRYMIX, /* Volume of original signal to pass to output. 0.0 to 1.0. Default = 0.45. */ - FMOD_DSP_FLANGE_WETMIX, /* Volume of flange signal to pass to output. 0.0 to 1.0. Default = 0.55. */ - FMOD_DSP_FLANGE_DEPTH, /* Flange depth (percentage of 40ms delay). 0.01 to 1.0. Default = 1.0. */ - FMOD_DSP_FLANGE_RATE /* Flange speed in hz. 0.0 to 20.0. Default = 0.1. */ -} FMOD_DSP_FLANGE; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_TREMOLO filter. - - [REMARKS] - The tremolo effect varies the amplitude of a sound. Depending on the settings, this unit can produce a tremolo, chopper or auto-pan effect. - - The shape of the LFO (low freq. oscillator) can morphed between sine, triangle and sawtooth waves using the FMOD_DSP_TREMOLO_SHAPE and FMOD_DSP_TREMOLO_SKEW parameters. - FMOD_DSP_TREMOLO_DUTY and FMOD_DSP_TREMOLO_SQUARE are useful for a chopper-type effect where the first controls the on-time duration and second controls the flatness of the envelope. - FMOD_DSP_TREMOLO_SPREAD varies the LFO phase between channels to get an auto-pan effect. This works best with a sine shape LFO. - The LFO can be synchronized using the FMOD_DSP_TREMOLO_PHASE parameter which sets its instantaneous phase. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_TREMOLO_FREQUENCY, /* LFO frequency in Hz. 0.1 to 20. Default = 4. */ - FMOD_DSP_TREMOLO_DEPTH, /* Tremolo depth. 0 to 1. Default = 0. */ - FMOD_DSP_TREMOLO_SHAPE, /* LFO shape morph between triangle and sine. 0 to 1. Default = 0. */ - FMOD_DSP_TREMOLO_SKEW, /* Time-skewing of LFO cycle. -1 to 1. Default = 0. */ - FMOD_DSP_TREMOLO_DUTY, /* LFO on-time. 0 to 1. Default = 0.5. */ - FMOD_DSP_TREMOLO_SQUARE, /* Flatness of the LFO shape. 0 to 1. Default = 0. */ - FMOD_DSP_TREMOLO_PHASE, /* Instantaneous LFO phase. 0 to 1. Default = 0. */ - FMOD_DSP_TREMOLO_SPREAD /* Rotation / auto-pan effect. -1 to 1. Default = 0. */ -} FMOD_DSP_TREMOLO; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_DISTORTION filter. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_DISTORTION_LEVEL /* Distortion value. 0.0 to 1.0. Default = 0.5. */ -} FMOD_DSP_DISTORTION; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_NORMALIZE filter. - - [REMARKS] - Normalize amplifies the sound based on the maximum peaks within the signal. - For example if the maximum peaks in the signal were 50% of the bandwidth, it would scale the whole sound by 2. - The lower threshold value makes the normalizer ignores peaks below a certain point, to avoid over-amplification if a loud signal suddenly came in, and also to avoid amplifying to maximum things like background hiss. - - Because FMOD is a realtime audio processor, it doesn't have the luxury of knowing the peak for the whole sound (ie it can't see into the future), so it has to process data as it comes in. - To avoid very sudden changes in volume level based on small samples of new data, fmod fades towards the desired amplification which makes for smooth gain control. The fadetime parameter can control this. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_NORMALIZE_FADETIME, /* Time to ramp the silence to full in ms. 0.0 to 20000.0. Default = 5000.0. */ - FMOD_DSP_NORMALIZE_THRESHHOLD, /* Lower volume range threshold to ignore. 0.0 to 1.0. Default = 0.1. Raise higher to stop amplification of very quiet signals. */ - FMOD_DSP_NORMALIZE_MAXAMP /* Maximum amplification allowed. 1.0 to 100000.0. Default = 20.0. 1.0 = no amplifaction, higher values allow more boost. */ -} FMOD_DSP_NORMALIZE; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_PARAMEQ filter. - - [REMARKS] - Parametric EQ is a bandpass filter that attenuates or amplifies a selected frequency and its neighbouring frequencies. - - To create a multi-band EQ create multiple FMOD_DSP_TYPE_PARAMEQ units and set each unit to different frequencies, for example 1000hz, 2000hz, 4000hz, 8000hz, 16000hz with a range of 1 octave each. - - When a frequency has its gain set to 1.0, the sound will be unaffected and represents the original signal exactly. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_PARAMEQ_CENTER, /* Frequency center. 20.0 to 22000.0. Default = 8000.0. */ - FMOD_DSP_PARAMEQ_BANDWIDTH, /* Octave range around the center frequency to filter. 0.2 to 5.0. Default = 1.0. */ - FMOD_DSP_PARAMEQ_GAIN /* Frequency Gain. 0.05 to 3.0. Default = 1.0. */ -} FMOD_DSP_PARAMEQ; - - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_PITCHSHIFT filter. - - [REMARKS] - This pitch shifting unit can be used to change the pitch of a sound without speeding it up or slowing it down. - It can also be used for time stretching or scaling, for example if the pitch was doubled, and the frequency of the sound was halved, the pitch of the sound would sound correct but it would be twice as slow. - - Warning! This filter is very computationally expensive! Similar to a vocoder, it requires several overlapping FFT and IFFT's to produce smooth output, and can require around 440mhz for 1 stereo 48khz signal using the default settings. - Reducing the signal to mono will half the cpu usage. - Reducing this will lower audio quality, but what settings to use are largely dependant on the sound being played. A noisy polyphonic signal will need higher fft size compared to a speaking voice for example. - - This pitch shifter is based on the pitch shifter code at http://www.dspdimension.com, written by Stephan M. Bernsee. - The original code is COPYRIGHT 1999-2003 Stephan M. Bernsee . - - 'maxchannels' dictates the amount of memory allocated. By default, the maxchannels value is 0. If FMOD is set to stereo, the pitch shift unit will allocate enough memory for 2 channels. If it is 5.1, it will allocate enough memory for a 6 channel pitch shift, etc. - If the pitch shift effect is only ever applied to the global mix (ie it was added with System::addDSP), then 0 is the value to set as it will be enough to handle all speaker modes. - When the pitch shift is added to a channel (ie Channel::addDSP) then the channel count that comes in could be anything from 1 to 8 possibly. It is only in this case where you might want to increase the channel count above the output's channel count. - If a channel pitch shift is set to a lower number than the sound's channel count that is coming in, it will not pitch shift the sound. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_PITCHSHIFT_PITCH, /* Pitch value. 0.5 to 2.0. Default = 1.0. 0.5 = one octave down, 2.0 = one octave up. 1.0 does not change the pitch. */ - FMOD_DSP_PITCHSHIFT_FFTSIZE, /* FFT window size. 256, 512, 1024, 2048, 4096. Default = 1024. Increase this to reduce 'smearing'. This effect is a warbling sound similar to when an mp3 is encoded at very low bitrates. */ - FMOD_DSP_PITCHSHIFT_OVERLAP, /* Removed. Do not use. FMOD now uses 4 overlaps and cannot be changed. */ - FMOD_DSP_PITCHSHIFT_MAXCHANNELS /* Maximum channels supported. 0 to 16. 0 = same as fmod's default output polyphony, 1 = mono, 2 = stereo etc. See remarks for more. Default = 0. It is suggested to leave at 0! */ -} FMOD_DSP_PITCHSHIFT; - - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_CHORUS filter. - - [REMARKS] - Chrous is an effect where the sound is more 'spacious' due to 1 to 3 versions of the sound being played along side the original signal but with the pitch of each copy modulating on a sine wave. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_CHORUS_DRYMIX, /* Volume of original signal to pass to output. 0.0 to 1.0. Default = 0.5. */ - FMOD_DSP_CHORUS_WETMIX1, /* Volume of 1st chorus tap. 0.0 to 1.0. Default = 0.5. */ - FMOD_DSP_CHORUS_WETMIX2, /* Volume of 2nd chorus tap. This tap is 90 degrees out of phase of the first tap. 0.0 to 1.0. Default = 0.5. */ - FMOD_DSP_CHORUS_WETMIX3, /* Volume of 3rd chorus tap. This tap is 90 degrees out of phase of the second tap. 0.0 to 1.0. Default = 0.5. */ - FMOD_DSP_CHORUS_DELAY, /* Chorus delay in ms. 0.1 to 100.0. Default = 40.0 ms. */ - FMOD_DSP_CHORUS_RATE, /* Chorus modulation rate in hz. 0.0 to 20.0. Default = 0.8 hz. */ - FMOD_DSP_CHORUS_DEPTH /* Chorus modulation depth. 0.0 to 1.0. Default = 0.03. */ -} FMOD_DSP_CHORUS; - - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_ITECHO filter. - This is effectively a software based echo filter that emulates the DirectX DMO echo effect. Impulse tracker files can support this, and FMOD will produce the effect on ANY platform, not just those that support DirectX effects! - - [REMARKS] - Note. Every time the delay is changed, the plugin re-allocates the echo buffer. This means the echo will dissapear at that time while it refills its new buffer. - Larger echo delays result in larger amounts of memory allocated. - - As this is a stereo filter made mainly for IT playback, it is targeted for stereo signals. - With mono signals only the FMOD_DSP_ITECHO_LEFTDELAY is used. - For multichannel signals (>2) there will be no echo on those channels. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::SetParameter - DSP::GetParameter - FMOD_DSP_TYPE - System::addDSP -] -*/ -typedef enum -{ - FMOD_DSP_ITECHO_WETDRYMIX, /* Ratio of wet (processed) signal to dry (unprocessed) signal. Must be in the range from 0.0 through 100.0 (all wet). The default value is 50. */ - FMOD_DSP_ITECHO_FEEDBACK, /* Percentage of output fed back into input, in the range from 0.0 through 100.0. The default value is 50. */ - FMOD_DSP_ITECHO_LEFTDELAY, /* Delay for left channel, in milliseconds, in the range from 1.0 through 2000.0. The default value is 500 ms. */ - FMOD_DSP_ITECHO_RIGHTDELAY, /* Delay for right channel, in milliseconds, in the range from 1.0 through 2000.0. The default value is 500 ms. */ - FMOD_DSP_ITECHO_PANDELAY /* Value that specifies whether to swap left and right delays with each successive echo. The default value is zero, meaning no swap. Possible values are defined as 0.0 (equivalent to FALSE) and 1.0 (equivalent to TRUE). CURRENTLY NOT SUPPORTED. */ -} FMOD_DSP_ITECHO; - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_COMPRESSOR unit. - This is a simple linked multichannel software limiter that is uniform across the whole spectrum. - - [REMARKS] - The limiter is not guaranteed to catch every peak above the threshold level, - because it cannot apply gain reduction instantaneously - the time delay is - determined by the attack time. However setting the attack time too short will - distort the sound, so it is a compromise. High level peaks can be avoided by - using a short attack time - but not too short, and setting the threshold a few - decibels below the critical level. - - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::SetParameter - DSP::GetParameter - FMOD_DSP_TYPE - System::addDSP -] -*/ -typedef enum -{ - FMOD_DSP_COMPRESSOR_THRESHOLD, /* Threshold level (dB) in the range from -60 through 0. The default value is 0. */ - FMOD_DSP_COMPRESSOR_ATTACK, /* Gain reduction attack time (milliseconds), in the range from 10 through 200. The default value is 50. */ - FMOD_DSP_COMPRESSOR_RELEASE, /* Gain reduction release time (milliseconds), in the range from 20 through 1000. The default value is 50. */ - FMOD_DSP_COMPRESSOR_GAINMAKEUP /* Make-up gain (dB) applied after limiting, in the range from 0 through 30. The default value is 0. */ -} FMOD_DSP_COMPRESSOR; - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_SFXREVERB unit. - - [REMARKS] - This is a high quality I3DL2 based reverb. - On top of the I3DL2 property set, "Dry Level" is also included to allow the dry mix to be changed. - - These properties can be set with presets in FMOD_REVERB_PRESETS. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::SetParameter - DSP::GetParameter - FMOD_DSP_TYPE - System::addDSP - FMOD_REVERB_PRESETS -] -*/ -typedef enum -{ - FMOD_DSP_SFXREVERB_DRYLEVEL, /* Dry Level : Mix level of dry signal in output in mB. Ranges from -10000.0 to 0.0. Default is 0. */ - FMOD_DSP_SFXREVERB_ROOM, /* Room : Room effect level at low frequencies in mB. Ranges from -10000.0 to 0.0. Default is -10000.0. */ - FMOD_DSP_SFXREVERB_ROOMHF, /* Room HF : Room effect high-frequency level re. low frequency level in mB. Ranges from -10000.0 to 0.0. Default is 0.0. */ - FMOD_DSP_SFXREVERB_DECAYTIME, /* Decay Time : Reverberation decay time at low-frequencies in seconds. Ranges from 0.1 to 20.0. Default is 1.0. */ - FMOD_DSP_SFXREVERB_DECAYHFRATIO, /* Decay HF Ratio : High-frequency to low-frequency decay time ratio. Ranges from 0.1 to 2.0. Default is 0.5. */ - FMOD_DSP_SFXREVERB_REFLECTIONSLEVEL, /* Reflections : Early reflections level relative to room effect in mB. Ranges from -10000.0 to 1000.0. Default is -10000.0. */ - FMOD_DSP_SFXREVERB_REFLECTIONSDELAY, /* Reflect Delay : Delay time of first reflection in seconds. Ranges from 0.0 to 0.3. Default is 0.02. */ - FMOD_DSP_SFXREVERB_REVERBLEVEL, /* Reverb : Late reverberation level relative to room effect in mB. Ranges from -10000.0 to 2000.0. Default is 0.0. */ - FMOD_DSP_SFXREVERB_REVERBDELAY, /* Reverb Delay : Late reverberation delay time relative to first reflection in seconds. Ranges from 0.0 to 0.1. Default is 0.04. */ - FMOD_DSP_SFXREVERB_DIFFUSION, /* Diffusion : Reverberation diffusion (echo density) in percent. Ranges from 0.0 to 100.0. Default is 100.0. */ - FMOD_DSP_SFXREVERB_DENSITY, /* Density : Reverberation density (modal density) in percent. Ranges from 0.0 to 100.0. Default is 100.0. */ - FMOD_DSP_SFXREVERB_HFREFERENCE, /* HF Reference : Reference high frequency in Hz. Ranges from 20.0 to 20000.0. Default is 5000.0. */ - FMOD_DSP_SFXREVERB_ROOMLF, /* Room LF : Room effect low-frequency level in mB. Ranges from -10000.0 to 0.0. Default is 0.0. */ - FMOD_DSP_SFXREVERB_LFREFERENCE /* LF Reference : Reference low-frequency in Hz. Ranges from 20.0 to 1000.0. Default is 250.0. */ -} FMOD_DSP_SFXREVERB; - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_LOWPASS_SIMPLE filter. - This is a very simple low pass filter, based on two single-pole RC time-constant modules. - The emphasis is on speed rather than accuracy, so this should not be used for task requiring critical filtering. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_LOWPASS_SIMPLE_CUTOFF /* Lowpass cutoff frequency in hz. 10.0 to 22000.0. Default = 5000.0 */ -} FMOD_DSP_LOWPASS_SIMPLE; - -/* -[ENUM] -[ - [DESCRIPTION] - Parameter types for the FMOD_DSP_TYPE_HIGHPASS_SIMPLE filter. - This is a very simple single-order high pass filter. - The emphasis is on speed rather than accuracy, so this should not be used for task requiring critical filtering. - - [REMARKS] - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - DSP::setParameter - DSP::getParameter - FMOD_DSP_TYPE -] -*/ -typedef enum -{ - FMOD_DSP_HIGHPASS_SIMPLE_CUTOFF /* Highpass cutoff frequency in hz. 10.0 to 22000.0. Default = 1000.0 */ -} FMOD_DSP_HIGHPASS_SIMPLE; - -#endif - diff --git a/libs/fmodex/inc/fmod_errors.h b/libs/fmodex/inc/fmod_errors.h deleted file mode 100644 index fdb85984b..000000000 --- a/libs/fmodex/inc/fmod_errors.h +++ /dev/null @@ -1,123 +0,0 @@ - -/* ============================================================================================== */ -/* FMOD Ex - Error string header file. Copyright (c), Firelight Technologies Pty, Ltd. 2004-2011. */ -/* */ -/* Use this header if you want to store or display a string version / english explanation of */ -/* the FMOD error codes. */ -/* */ -/* ============================================================================================== */ - -#ifndef _FMOD_ERRORS_H -#define _FMOD_ERRORS_H - -#include "fmod.h" - -#ifdef __GNUC__ -static const char *FMOD_ErrorString(FMOD_RESULT errcode) __attribute__((unused)); -#endif - -static const char *FMOD_ErrorString(FMOD_RESULT errcode) -{ - switch (errcode) - { - case FMOD_ERR_ALREADYLOCKED: return "Tried to call lock a second time before unlock was called. "; - case FMOD_ERR_BADCOMMAND: return "Tried to call a function on a data type that does not allow this type of functionality (ie calling Sound::lock on a streaming sound). "; - case FMOD_ERR_CDDA_DRIVERS: return "Neither NTSCSI nor ASPI could be initialised. "; - case FMOD_ERR_CDDA_INIT: return "An error occurred while initialising the CDDA subsystem. "; - case FMOD_ERR_CDDA_INVALID_DEVICE: return "Couldn't find the specified device. "; - case FMOD_ERR_CDDA_NOAUDIO: return "No audio tracks on the specified disc. "; - case FMOD_ERR_CDDA_NODEVICES: return "No CD/DVD devices were found. "; - case FMOD_ERR_CDDA_NODISC: return "No disc present in the specified drive. "; - case FMOD_ERR_CDDA_READ: return "A CDDA read error occurred. "; - case FMOD_ERR_CHANNEL_ALLOC: return "Error trying to allocate a channel. "; - case FMOD_ERR_CHANNEL_STOLEN: return "The specified channel has been reused to play another sound. "; - case FMOD_ERR_COM: return "A Win32 COM related error occured. COM failed to initialize or a QueryInterface failed meaning a Windows codec or driver was not installed properly. "; - case FMOD_ERR_DMA: return "DMA Failure. See debug output for more information. "; - case FMOD_ERR_DSP_CONNECTION: return "DSP connection error. Connection possibly caused a cyclic dependancy. Or tried to connect a tree too many units deep (more than 128). "; - case FMOD_ERR_DSP_FORMAT: return "DSP Format error. A DSP unit may have attempted to connect to this network with the wrong format. "; - case FMOD_ERR_DSP_NOTFOUND: return "DSP connection error. Couldn't find the DSP unit specified. "; - case FMOD_ERR_DSP_RUNNING: return "DSP error. Cannot perform this operation while the network is in the middle of running. This will most likely happen if a connection or disconnection is attempted in a DSP callback. "; - case FMOD_ERR_DSP_TOOMANYCONNECTIONS: return "DSP connection error. The unit being connected to or disconnected should only have 1 input or output. "; - case FMOD_ERR_EVENT_ALREADY_LOADED: return "The specified project or bank has already been loaded. Having multiple copies of the same project loaded simultaneously is forbidden. "; - case FMOD_ERR_EVENT_FAILED: return "An Event failed to be retrieved, most likely due to 'just fail' being specified as the max playbacks behavior. "; - case FMOD_ERR_EVENT_GUIDCONFLICT: return "An event with the same GUID already exists. "; - case FMOD_ERR_EVENT_INFOONLY: return "Can't execute this command on an EVENT_INFOONLY event. "; - case FMOD_ERR_EVENT_INTERNAL: return "An error occured that wasn't supposed to. See debug log for reason. "; - case FMOD_ERR_EVENT_MAXSTREAMS: return "Event failed because 'Max streams' was hit when FMOD_EVENT_INIT_FAIL_ON_MAXSTREAMS was specified. "; - case FMOD_ERR_EVENT_MISMATCH: return "FSB mismatches the FEV it was compiled with, the stream/sample mode it was meant to be created with was different, or the FEV was built for a different platform. "; - case FMOD_ERR_EVENT_NAMECONFLICT: return "A category with the same name already exists. "; - case FMOD_ERR_EVENT_NEEDSSIMPLE: return "Tried to call a function on a complex event that's only supported by simple events. "; - case FMOD_ERR_EVENT_NOTFOUND: return "The requested event, event group, event category or event property could not be found. "; - case FMOD_ERR_FILE_BAD: return "Error loading file. "; - case FMOD_ERR_FILE_COULDNOTSEEK: return "Couldn't perform seek operation. This is a limitation of the medium (ie netstreams) or the file format. "; - case FMOD_ERR_FILE_DISKEJECTED: return "Media was ejected while reading. "; - case FMOD_ERR_FILE_EOF: return "End of file unexpectedly reached while trying to read essential data (truncated data?). "; - case FMOD_ERR_FILE_NOTFOUND: return "File not found. "; - case FMOD_ERR_FILE_UNWANTED: return "Unwanted file access occured. "; - case FMOD_ERR_FORMAT: return "Unsupported file or audio format. "; - case FMOD_ERR_HTTP: return "A HTTP error occurred. This is a catch-all for HTTP errors not listed elsewhere. "; - case FMOD_ERR_HTTP_ACCESS: return "The specified resource requires authentication or is forbidden. "; - case FMOD_ERR_HTTP_PROXY_AUTH: return "Proxy authentication is required to access the specified resource. "; - case FMOD_ERR_HTTP_SERVER_ERROR: return "A HTTP server error occurred. "; - case FMOD_ERR_HTTP_TIMEOUT: return "The HTTP request timed out. "; - case FMOD_ERR_INITIALIZATION: return "FMOD was not initialized correctly to support this function. "; - case FMOD_ERR_INITIALIZED: return "Cannot call this command after System::init. "; - case FMOD_ERR_INTERNAL: return "An error occured that wasn't supposed to. Contact support. "; - case FMOD_ERR_INVALID_ADDRESS: return "On Xbox 360, this memory address passed to FMOD must be physical, (ie allocated with XPhysicalAlloc.) "; - case FMOD_ERR_INVALID_FLOAT: return "Value passed in was a NaN, Inf or denormalized float. "; - case FMOD_ERR_INVALID_HANDLE: return "An invalid object handle was used. "; - case FMOD_ERR_INVALID_PARAM: return "An invalid parameter was passed to this function. "; - case FMOD_ERR_INVALID_POSITION: return "An invalid seek position was passed to this function. "; - case FMOD_ERR_INVALID_SPEAKER: return "An invalid speaker was passed to this function based on the current speaker mode. "; - case FMOD_ERR_INVALID_SYNCPOINT: return "The syncpoint did not come from this sound handle. "; - case FMOD_ERR_INVALID_VECTOR: return "The vectors passed in are not unit length, or perpendicular. "; - case FMOD_ERR_MAXAUDIBLE: return "Reached maximum audible playback count for this sound's soundgroup. "; - case FMOD_ERR_MEMORY: return "Not enough memory or resources. "; - case FMOD_ERR_MEMORY_CANTPOINT: return "Can't use FMOD_OPENMEMORY_POINT on non PCM source data, or non mp3/xma/adpcm data if FMOD_CREATECOMPRESSEDSAMPLE was used. "; - case FMOD_ERR_MEMORY_SRAM: return "Not enough memory or resources on console sound ram. "; - case FMOD_ERR_MUSIC_NOCALLBACK: return "The music callback is required, but it has not been set. "; - case FMOD_ERR_MUSIC_NOTFOUND: return "The requested music entity could not be found. "; - case FMOD_ERR_MUSIC_UNINITIALIZED: return "Music system is not initialized probably because no music data is loaded. "; - case FMOD_ERR_NEEDS2D: return "Tried to call a command on a 3d sound when the command was meant for 2d sound. "; - case FMOD_ERR_NEEDS3D: return "Tried to call a command on a 2d sound when the command was meant for 3d sound. "; - case FMOD_ERR_NEEDSHARDWARE: return "Tried to use a feature that requires hardware support. (ie trying to play a GCADPCM compressed sound in software on Wii). "; - case FMOD_ERR_NEEDSSOFTWARE: return "Tried to use a feature that requires the software engine. Software engine has either been turned off, or command was executed on a hardware channel which does not support this feature. "; - case FMOD_ERR_NET_CONNECT: return "Couldn't connect to the specified host. "; - case FMOD_ERR_NET_SOCKET_ERROR: return "A socket error occurred. This is a catch-all for socket-related errors not listed elsewhere. "; - case FMOD_ERR_NET_URL: return "The specified URL couldn't be resolved. "; - case FMOD_ERR_NET_WOULD_BLOCK: return "Operation on a non-blocking socket could not complete immediately. "; - case FMOD_ERR_NOTREADY: return "Operation could not be performed because specified sound/DSP connection is not ready. "; - case FMOD_ERR_OUTPUT_ALLOCATED: return "Error initializing output device, but more specifically, the output device is already in use and cannot be reused. "; - case FMOD_ERR_OUTPUT_CREATEBUFFER: return "Error creating hardware sound buffer. "; - case FMOD_ERR_OUTPUT_DRIVERCALL: return "A call to a standard soundcard driver failed, which could possibly mean a bug in the driver or resources were missing or exhausted. "; - case FMOD_ERR_OUTPUT_ENUMERATION: return "Error enumerating the available driver list. List may be inconsistent due to a recent device addition or removal. "; - case FMOD_ERR_OUTPUT_FORMAT: return "Soundcard does not support the minimum features needed for this soundsystem (16bit stereo output). "; - case FMOD_ERR_OUTPUT_INIT: return "Error initializing output device. "; - case FMOD_ERR_OUTPUT_NOHARDWARE: return "FMOD_HARDWARE was specified but the sound card does not have the resources necessary to play it. "; - case FMOD_ERR_OUTPUT_NOSOFTWARE: return "Attempted to create a software sound but no software channels were specified in System::init. "; - case FMOD_ERR_PAN: return "Panning only works with mono or stereo sound sources. "; - case FMOD_ERR_PLUGIN: return "An unspecified error has been returned from a 3rd party plugin. "; - case FMOD_ERR_PLUGIN_INSTANCES: return "The number of allowed instances of a plugin has been exceeded. "; - case FMOD_ERR_PLUGIN_MISSING: return "A requested output, dsp unit type or codec was not available. "; - case FMOD_ERR_PLUGIN_RESOURCE: return "A resource that the plugin requires cannot be found. (ie the DLS file for MIDI playback or other DLLs that it needs to load) "; - case FMOD_ERR_PRELOADED: return "The specified sound is still in use by the event system, call EventSystem::unloadFSB before trying to release it. "; - case FMOD_ERR_PROGRAMMERSOUND: return "The specified sound is still in use by the event system, wait for the event which is using it finish with it. "; - case FMOD_ERR_RECORD: return "An error occured trying to initialize the recording device. "; - case FMOD_ERR_REVERB_INSTANCE: return "Specified instance in FMOD_REVERB_PROPERTIES couldn't be set. Most likely because it is an invalid instance number or the reverb doesnt exist. "; - case FMOD_ERR_SUBSOUNDS: return "The error occured because the sound referenced contains subsounds when it shouldn't have, or it doesn't contain subsounds when it should have. The operation may also not be able to be performed on a parent sound, or a parent sound was played without setting up a sentence first. "; - case FMOD_ERR_SUBSOUND_ALLOCATED: return "This subsound is already being used by another sound, you cannot have more than one parent to a sound. Null out the other parent's entry first. "; - case FMOD_ERR_SUBSOUND_CANTMOVE: return "Shared subsounds cannot be replaced or moved from their parent stream, such as when the parent stream is an FSB file. "; - case FMOD_ERR_SUBSOUND_MODE: return "The subsound's mode bits do not match with the parent sound's mode bits. See documentation for function that it was called with. "; - case FMOD_ERR_TAGNOTFOUND: return "The specified tag could not be found or there are no tags. "; - case FMOD_ERR_TOOMANYCHANNELS: return "The sound created exceeds the allowable input channel count. This can be increased using the maxinputchannels parameter in System::setSoftwareFormat. "; - case FMOD_ERR_UNIMPLEMENTED: return "Something in FMOD hasn't been implemented when it should be! contact support! "; - case FMOD_ERR_UNINITIALIZED: return "This command failed because System::init or System::setDriver was not called. "; - case FMOD_ERR_UNSUPPORTED: return "A command issued was not supported by this object. Possibly a plugin without certain callbacks specified. "; - case FMOD_ERR_UPDATE: return "An error caused by System::update occured. "; - case FMOD_ERR_VERSION: return "The version number of this file format is not supported. "; - case FMOD_OK: return "No errors."; - default : return "Unknown error."; - }; -} - -#endif diff --git a/libs/fmodex/inc/fmod_memoryinfo.h b/libs/fmodex/inc/fmod_memoryinfo.h deleted file mode 100644 index 6db9de3b8..000000000 --- a/libs/fmodex/inc/fmod_memoryinfo.h +++ /dev/null @@ -1,201 +0,0 @@ -/* ============================================================================================= */ -/* FMOD Ex - Memory info header file. Copyright (c), Firelight Technologies Pty, Ltd. 2008-2011. */ -/* */ -/* Use this header if you are interested in getting detailed information on FMOD's memory */ -/* usage. See the documentation for more details. */ -/* */ -/* ============================================================================================= */ - -#ifndef _FMOD_MEMORYINFO_H -#define _FMOD_MEMORYINFO_H - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure to be filled with detailed memory usage information of an FMOD object - - [REMARKS] - Every public FMOD class has a getMemoryInfo function which can be used to get detailed information on what memory resources are associated with the object in question. - On return from getMemoryInfo, each member of this structure will hold the amount of memory used for its type in bytes. - - Members marked with [in] mean the user sets the value before passing it to the function. - Members marked with [out] mean FMOD sets the value to be used after the function exits. - - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - System::getMemoryInfo - EventSystem::getMemoryInfo - FMOD_MEMBITS - FMOD_EVENT_MEMBITS -] -*/ -typedef struct FMOD_MEMORY_USAGE_DETAILS -{ - unsigned int other; /* [out] Memory not accounted for by other types */ - unsigned int string; /* [out] String data */ - unsigned int system; /* [out] System object and various internals */ - unsigned int plugins; /* [out] Plugin objects and internals */ - unsigned int output; /* [out] Output module object and internals */ - unsigned int channel; /* [out] Channel related memory */ - unsigned int channelgroup; /* [out] ChannelGroup objects and internals */ - unsigned int codec; /* [out] Codecs allocated for streaming */ - unsigned int file; /* [out] File buffers and structures */ - unsigned int sound; /* [out] Sound objects and internals */ - unsigned int secondaryram; /* [out] Sound data stored in secondary RAM */ - unsigned int soundgroup; /* [out] SoundGroup objects and internals */ - unsigned int streambuffer; /* [out] Stream buffer memory */ - unsigned int dspconnection; /* [out] DSPConnection objects and internals */ - unsigned int dsp; /* [out] DSP implementation objects */ - unsigned int dspcodec; /* [out] Realtime file format decoding DSP objects */ - unsigned int profile; /* [out] Profiler memory footprint. */ - unsigned int recordbuffer; /* [out] Buffer used to store recorded data from microphone */ - unsigned int reverb; /* [out] Reverb implementation objects */ - unsigned int reverbchannelprops; /* [out] Reverb channel properties structs */ - unsigned int geometry; /* [out] Geometry objects and internals */ - unsigned int syncpoint; /* [out] Sync point memory. */ - unsigned int eventsystem; /* [out] EventSystem and various internals */ - unsigned int musicsystem; /* [out] MusicSystem and various internals */ - unsigned int fev; /* [out] Definition of objects contained in all loaded projects e.g. events, groups, categories */ - unsigned int memoryfsb; /* [out] Data loaded with preloadFSB */ - unsigned int eventproject; /* [out] EventProject objects and internals */ - unsigned int eventgroupi; /* [out] EventGroup objects and internals */ - unsigned int soundbankclass; /* [out] Objects used to manage wave banks */ - unsigned int soundbanklist; /* [out] Data used to manage lists of wave bank usage */ - unsigned int streaminstance; /* [out] Stream objects and internals */ - unsigned int sounddefclass; /* [out] Sound definition objects */ - unsigned int sounddefdefclass; /* [out] Sound definition static data objects */ - unsigned int sounddefpool; /* [out] Sound definition pool data */ - unsigned int reverbdef; /* [out] Reverb definition objects */ - unsigned int eventreverb; /* [out] Reverb objects */ - unsigned int userproperty; /* [out] User property objects */ - unsigned int eventinstance; /* [out] Event instance base objects */ - unsigned int eventinstance_complex; /* [out] Complex event instance objects */ - unsigned int eventinstance_simple; /* [out] Simple event instance objects */ - unsigned int eventinstance_layer; /* [out] Event layer instance objects */ - unsigned int eventinstance_sound; /* [out] Event sound instance objects */ - unsigned int eventenvelope; /* [out] Event envelope objects */ - unsigned int eventenvelopedef; /* [out] Event envelope definition objects */ - unsigned int eventparameter; /* [out] Event parameter objects */ - unsigned int eventcategory; /* [out] Event category objects */ - unsigned int eventenvelopepoint; /* [out] Event envelope point objects */ - unsigned int eventinstancepool; /* [out] Event instance pool memory */ -} FMOD_MEMORY_USAGE_DETAILS; - - -/* -[DEFINE] -[ - [NAME] - FMOD_MEMBITS - - [DESCRIPTION] - Bitfield used to request specific memory usage information from the getMemoryInfo function of every public FMOD Ex class. - Use with the "memorybits" parameter of getMemoryInfo to get information on FMOD Ex memory usage. - - [REMARKS] - Every public FMOD class has a getMemoryInfo function which can be used to get detailed information on what memory resources are associated with the object in question. - The FMOD_MEMBITS defines can be OR'd together to specify precisely what memory usage you'd like to get information on. See System::getMemoryInfo for an example. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_EVENT_MEMBITS - System::getMemoryInfo -] -*/ -#define FMOD_MEMBITS_OTHER 0x00000001 /* Memory not accounted for by other types */ -#define FMOD_MEMBITS_STRING 0x00000002 /* String data */ - -#define FMOD_MEMBITS_SYSTEM 0x00000004 /* System object and various internals */ -#define FMOD_MEMBITS_PLUGINS 0x00000008 /* Plugin objects and internals */ -#define FMOD_MEMBITS_OUTPUT 0x00000010 /* Output module object and internals */ -#define FMOD_MEMBITS_CHANNEL 0x00000020 /* Channel related memory */ -#define FMOD_MEMBITS_CHANNELGROUP 0x00000040 /* ChannelGroup objects and internals */ -#define FMOD_MEMBITS_CODEC 0x00000080 /* Codecs allocated for streaming */ -#define FMOD_MEMBITS_FILE 0x00000100 /* Codecs allocated for streaming */ -#define FMOD_MEMBITS_SOUND 0x00000200 /* Sound objects and internals */ -#define FMOD_MEMBITS_SOUND_SECONDARYRAM 0x00000400 /* Sound data stored in secondary RAM */ -#define FMOD_MEMBITS_SOUNDGROUP 0x00000800 /* SoundGroup objects and internals */ -#define FMOD_MEMBITS_STREAMBUFFER 0x00001000 /* Stream buffer memory */ -#define FMOD_MEMBITS_DSPCONNECTION 0x00002000 /* DSPConnection objects and internals */ -#define FMOD_MEMBITS_DSP 0x00004000 /* DSP implementation objects */ -#define FMOD_MEMBITS_DSPCODEC 0x00008000 /* Realtime file format decoding DSP objects */ -#define FMOD_MEMBITS_PROFILE 0x00010000 /* Profiler memory footprint. */ -#define FMOD_MEMBITS_RECORDBUFFER 0x00020000 /* Buffer used to store recorded data from microphone */ -#define FMOD_MEMBITS_REVERB 0x00040000 /* Reverb implementation objects */ -#define FMOD_MEMBITS_REVERBCHANNELPROPS 0x00080000 /* Reverb channel properties structs */ -#define FMOD_MEMBITS_GEOMETRY 0x00100000 /* Geometry objects and internals */ -#define FMOD_MEMBITS_SYNCPOINT 0x00200000 /* Sync point memory. */ -#define FMOD_MEMBITS_ALL 0xffffffff /* All memory used by FMOD Ex */ -/* [DEFINE_END] */ - - -/* -[DEFINE] -[ - [NAME] - FMOD_EVENT_MEMBITS - - [DESCRIPTION] - Bitfield used to request specific memory usage information from the getMemoryInfo function of every public FMOD Event System class. - Use with the "event_memorybits" parameter of getMemoryInfo to get information on FMOD Event System memory usage. - - [REMARKS] - Every public FMOD Event System class has a getMemoryInfo function which can be used to get detailed information on what memory resources are associated with the object in question. - The FMOD_EVENT_MEMBITS defines can be OR'd together to specify precisely what memory usage you'd like to get information on. See EventSystem::getMemoryInfo for an example. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_MEMBITS - System::getMemoryInfo -] -*/ -#define FMOD_EVENT_MEMBITS_EVENTSYSTEM 0x00000001 /* EventSystem and various internals */ -#define FMOD_EVENT_MEMBITS_MUSICSYSTEM 0x00000002 /* MusicSystem and various internals */ -#define FMOD_EVENT_MEMBITS_FEV 0x00000004 /* Definition of objects contained in all loaded projects e.g. events, groups, categories */ -#define FMOD_EVENT_MEMBITS_MEMORYFSB 0x00000008 /* Data loaded with preloadFSB */ -#define FMOD_EVENT_MEMBITS_EVENTPROJECT 0x00000010 /* EventProject objects and internals */ -#define FMOD_EVENT_MEMBITS_EVENTGROUPI 0x00000020 /* EventGroup objects and internals */ -#define FMOD_EVENT_MEMBITS_SOUNDBANKCLASS 0x00000040 /* Objects used to manage wave banks */ -#define FMOD_EVENT_MEMBITS_SOUNDBANKLIST 0x00000080 /* Data used to manage lists of wave bank usage */ -#define FMOD_EVENT_MEMBITS_STREAMINSTANCE 0x00000100 /* Stream objects and internals */ -#define FMOD_EVENT_MEMBITS_SOUNDDEFCLASS 0x00000200 /* Sound definition objects */ -#define FMOD_EVENT_MEMBITS_SOUNDDEFDEFCLASS 0x00000400 /* Sound definition static data objects */ -#define FMOD_EVENT_MEMBITS_SOUNDDEFPOOL 0x00000800 /* Sound definition pool data */ -#define FMOD_EVENT_MEMBITS_REVERBDEF 0x00001000 /* Reverb definition objects */ -#define FMOD_EVENT_MEMBITS_EVENTREVERB 0x00002000 /* Reverb objects */ -#define FMOD_EVENT_MEMBITS_USERPROPERTY 0x00004000 /* User property objects */ -#define FMOD_EVENT_MEMBITS_EVENTINSTANCE 0x00008000 /* Event instance base objects */ -#define FMOD_EVENT_MEMBITS_EVENTINSTANCE_COMPLEX 0x00010000 /* Complex event instance objects */ -#define FMOD_EVENT_MEMBITS_EVENTINSTANCE_SIMPLE 0x00020000 /* Simple event instance objects */ -#define FMOD_EVENT_MEMBITS_EVENTINSTANCE_LAYER 0x00040000 /* Event layer instance objects */ -#define FMOD_EVENT_MEMBITS_EVENTINSTANCE_SOUND 0x00080000 /* Event sound instance objects */ -#define FMOD_EVENT_MEMBITS_EVENTENVELOPE 0x00100000 /* Event envelope objects */ -#define FMOD_EVENT_MEMBITS_EVENTENVELOPEDEF 0x00200000 /* Event envelope definition objects */ -#define FMOD_EVENT_MEMBITS_EVENTPARAMETER 0x00400000 /* Event parameter objects */ -#define FMOD_EVENT_MEMBITS_EVENTCATEGORY 0x00800000 /* Event category objects */ -#define FMOD_EVENT_MEMBITS_EVENTENVELOPEPOINT 0x01000000 /* Event envelope point object+s */ -#define FMOD_EVENT_MEMBITS_EVENTINSTANCEPOOL 0x02000000 /* Event instance pool data */ -#define FMOD_EVENT_MEMBITS_ALL 0xffffffff /* All memory used by FMOD Event System */ - -/* All event instance memory */ -#define FMOD_EVENT_MEMBITS_EVENTINSTANCE_GROUP (FMOD_EVENT_MEMBITS_EVENTINSTANCE | \ - FMOD_EVENT_MEMBITS_EVENTINSTANCE_COMPLEX | \ - FMOD_EVENT_MEMBITS_EVENTINSTANCE_SIMPLE | \ - FMOD_EVENT_MEMBITS_EVENTINSTANCE_LAYER | \ - FMOD_EVENT_MEMBITS_EVENTINSTANCE_SOUND) - -/* All sound definition memory */ -#define FMOD_EVENT_MEMBITS_SOUNDDEF_GROUP (FMOD_EVENT_MEMBITS_SOUNDDEFCLASS | \ - FMOD_EVENT_MEMBITS_SOUNDDEFDEFCLASS | \ - FMOD_EVENT_MEMBITS_SOUNDDEFPOOL) -/* [DEFINE_END] */ - -#endif diff --git a/libs/fmodex/inc/fmod_output.h b/libs/fmodex/inc/fmod_output.h deleted file mode 100644 index 2ffb867bd..000000000 --- a/libs/fmodex/inc/fmod_output.h +++ /dev/null @@ -1,93 +0,0 @@ -/* ==================================================================================================== */ -/* FMOD Ex - output development header file. Copyright (c), Firelight Technologies Pty, Ltd. 2004-2011. */ -/* */ -/* Use this header if you are wanting to develop your own output plugin to use with */ -/* FMOD's output system. With this header you can make your own output plugin that FMOD */ -/* can register and use. See the documentation and examples on how to make a working plugin. */ -/* */ -/* ==================================================================================================== */ - -#ifndef _FMOD_OUTPUT_H -#define _FMOD_OUTPUT_H - -#include "fmod.h" - -typedef struct FMOD_OUTPUT_STATE FMOD_OUTPUT_STATE; - -/* - Output callbacks -*/ -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_GETNUMDRIVERSCALLBACK)(FMOD_OUTPUT_STATE *output_state, int *numdrivers); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_GETDRIVERNAMECALLBACK)(FMOD_OUTPUT_STATE *output_state, int id, char *name, int namelen); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_GETDRIVERCAPSCALLBACK)(FMOD_OUTPUT_STATE *output_state, int id, FMOD_CAPS *caps); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_INITCALLBACK) (FMOD_OUTPUT_STATE *output_state, int selecteddriver, FMOD_INITFLAGS flags, int *outputrate, int outputchannels, FMOD_SOUND_FORMAT *outputformat, int dspbufferlength, int dspnumbuffers, void *extradriverdata); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_CLOSECALLBACK) (FMOD_OUTPUT_STATE *output_state); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_UPDATECALLBACK) (FMOD_OUTPUT_STATE *output_state); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_GETHANDLECALLBACK) (FMOD_OUTPUT_STATE *output_state, void **handle); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_GETPOSITIONCALLBACK) (FMOD_OUTPUT_STATE *output_state, unsigned int *pcm); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_LOCKCALLBACK) (FMOD_OUTPUT_STATE *output_state, unsigned int offset, unsigned int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_UNLOCKCALLBACK) (FMOD_OUTPUT_STATE *output_state, void *ptr1, void *ptr2, unsigned int len1, unsigned int len2); -typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_READFROMMIXER) (FMOD_OUTPUT_STATE *output_state, void *buffer, unsigned int length); - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - When creating an output, declare one of these and provide the relevant callbacks and name for FMOD to use when it opens and reads a file of this type. - - [REMARKS] - Members marked with [in] mean the variable can be written to. The user can set the value. - Members marked with [out] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_OUTPUT_STATE -] -*/ -typedef struct FMOD_OUTPUT_DESCRIPTION -{ - const char *name; /* [in] Name of the output. */ - unsigned int version; /* [in] Plugin writer's version number. */ - int polling; /* [in] If TRUE (non zero), this tells FMOD to start a thread and call getposition / lock / unlock for feeding data. If 0, the output is probably callback based, so all the plugin needs to do is call readfrommixer to the appropriate pointer. */ - FMOD_OUTPUT_GETNUMDRIVERSCALLBACK getnumdrivers; /* [in] For sound device enumeration. This callback is to give System::getNumDrivers somthing to return. */ - FMOD_OUTPUT_GETDRIVERNAMECALLBACK getdrivername; /* [in] For sound device enumeration. This callback is to give System::getDriverName somthing to return. */ - FMOD_OUTPUT_GETDRIVERCAPSCALLBACK getdrivercaps; /* [in] For sound device enumeration. This callback is to give System::getDriverCaps somthing to return. */ - FMOD_OUTPUT_INITCALLBACK init; /* [in] Initialization function for the output device. This is called from System::init. */ - FMOD_OUTPUT_CLOSECALLBACK close; /* [in] Cleanup / close down function for the output device. This is called from System::close. */ - FMOD_OUTPUT_UPDATECALLBACK update; /* [in] Update function that is called once a frame by the user. This is called from System::update. */ - FMOD_OUTPUT_GETHANDLECALLBACK gethandle; /* [in] This is called from System::getOutputHandle. This is just to return a pointer to the internal system device object that the system may be using.*/ - FMOD_OUTPUT_GETPOSITIONCALLBACK getposition; /* [in] This is called from the FMOD software mixer thread if 'polling' = true. This returns a position value in samples so that FMOD knows where and when to fill its buffer. */ - FMOD_OUTPUT_LOCKCALLBACK lock; /* [in] This is called from the FMOD software mixer thread if 'polling' = true. This function provides a pointer to data that FMOD can write to when software mixing. */ - FMOD_OUTPUT_UNLOCKCALLBACK unlock; /* [in] This is called from the FMOD software mixer thread if 'polling' = true. This optional function accepts the data that has been mixed and copies it or does whatever it needs to before sending it to the hardware. */ -} FMOD_OUTPUT_DESCRIPTION; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Output plugin structure that is passed into each callback. - - [REMARKS] - Members marked with [in] mean the variable can be written to. The user can set the value. - Members marked with [out] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. - - [PLATFORMS] - Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android - - [SEE_ALSO] - FMOD_OUTPUT_DESCRIPTION -] -*/ -struct FMOD_OUTPUT_STATE -{ - void *plugindata; /* [in] Plugin writer created data the output author wants to attach to this object. */ - FMOD_OUTPUT_READFROMMIXER readfrommixer; /* [out] Function to update mixer and write the result to the provided pointer. Used from callback based output only. Polling based output uses lock/unlock/getposition. */ -}; - -#endif - - diff --git a/libs/fmodex/lib/fmodex64_vc.lib b/libs/fmodex/lib/fmodex64_vc.lib deleted file mode 100644 index 77a761d34..000000000 Binary files a/libs/fmodex/lib/fmodex64_vc.lib and /dev/null differ diff --git a/libs/fmodex/lib/fmodexL64_vc.lib b/libs/fmodex/lib/fmodexL64_vc.lib deleted file mode 100644 index 6c008895c..000000000 Binary files a/libs/fmodex/lib/fmodexL64_vc.lib and /dev/null differ diff --git a/libs/fmodex/lib/fmodexL_bc.lib b/libs/fmodex/lib/fmodexL_bc.lib deleted file mode 100644 index 0ae81171b..000000000 Binary files a/libs/fmodex/lib/fmodexL_bc.lib and /dev/null differ diff --git a/libs/fmodex/lib/fmodexL_lcc.lib b/libs/fmodex/lib/fmodexL_lcc.lib deleted file mode 100644 index 0c0e22918..000000000 Binary files a/libs/fmodex/lib/fmodexL_lcc.lib and /dev/null differ diff --git a/libs/fmodex/lib/fmodexL_vc.lib b/libs/fmodex/lib/fmodexL_vc.lib deleted file mode 100644 index 63b6ee4fa..000000000 Binary files a/libs/fmodex/lib/fmodexL_vc.lib and /dev/null differ diff --git a/libs/fmodex/lib/fmodex_bc.lib b/libs/fmodex/lib/fmodex_bc.lib deleted file mode 100644 index 1f5c98ca3..000000000 Binary files a/libs/fmodex/lib/fmodex_bc.lib and /dev/null differ diff --git a/libs/fmodex/lib/fmodex_lcc.lib b/libs/fmodex/lib/fmodex_lcc.lib deleted file mode 100644 index 235fe165c..000000000 Binary files a/libs/fmodex/lib/fmodex_lcc.lib and /dev/null differ diff --git a/libs/fmodex/lib/fmodex_vc.lib b/libs/fmodex/lib/fmodex_vc.lib deleted file mode 100644 index ec169885f..000000000 Binary files a/libs/fmodex/lib/fmodex_vc.lib and /dev/null differ diff --git a/libs/fmodex/lib/libfmodex.a b/libs/fmodex/lib/libfmodex.a deleted file mode 100644 index 6c49195aa..000000000 Binary files a/libs/fmodex/lib/libfmodex.a and /dev/null differ diff --git a/libs/fmodex/lib/libfmodexL.a b/libs/fmodex/lib/libfmodexL.a deleted file mode 100644 index fe253aaf6..000000000 Binary files a/libs/fmodex/lib/libfmodexL.a and /dev/null differ diff --git a/libs/fmodex/lib/which library do I use.txt b/libs/fmodex/lib/which library do I use.txt deleted file mode 100644 index 12738bed0..000000000 --- a/libs/fmodex/lib/which library do I use.txt +++ /dev/null @@ -1,28 +0,0 @@ -Which library do I link? ------------------------- - -If you want to use fmodex.dll: - -Visual Studio users - fmodex_vc.lib. -Metrowerks Codewarrior users - fmodex_vc.lib. -Borland users - fmodex_bc.lib. -LCC-Win32 users - fmodex_lcc.lib. -Dev-C++, MinGW and CygWin users - libfmodex.a. - -If you want to use fmodexL.dll: (same as fmodex.dll but with debug logging enabled) - -Visual Studio users - fmodexL_vc.lib. -Metrowerks Codewarrior users - fmodexL_vc.lib. -Borland users - fmodexL_bc.lib. -LCC-Win32 users - fmodexL_lcc.lib. -Dev-C++, MinGW and CygWin users - libfmodexL.a. - -If you want to use fmodex64.dll: (same as fmodex.dll but for 64bit machines) - -Visual Studio users - fmodex64_vc.lib. - -If you want to use fmodexL64.dll: (same as fmodex64.dll but with debug logging enabled) - -Visual Studio users - fmodexL64_vc.lib. - -No other compilers are supported for 64bit libraries. \ No newline at end of file diff --git a/src/d_netcmd.c b/src/d_netcmd.c index d9080d342..679e102e2 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -880,7 +880,7 @@ void D_RegisterClientCommands(void) // ingame object placing COM_AddCommand("objectplace", Command_ObjectPlace_f); - COM_AddCommand("writethings", Command_Writethings_f); + //COM_AddCommand("writethings", Command_Writethings_f); CV_RegisterVar(&cv_speed); CV_RegisterVar(&cv_opflags); CV_RegisterVar(&cv_ophoopflags); diff --git a/src/deh_lua.c b/src/deh_lua.c index 1f4d22dca..09dc155cf 100644 --- a/src/deh_lua.c +++ b/src/deh_lua.c @@ -330,14 +330,85 @@ static inline int lib_getenum(lua_State *L) } else if (fastncmp("ML_", word, 3)) { p = word+3; - for (i = 0; i < 16; i++) - if (ML_LIST[i] && fastcmp(p, ML_LIST[i])) { + for (i = 0; ML_LIST[i]; i++) + if (fastcmp(p, ML_LIST[i])) { lua_pushinteger(L, ((lua_Integer)1<mo->angle = FixedAngle(mthing->angle << FRACBITS); f = gh->mo->floorz; c = gh->mo->ceilingz - mobjinfo[MT_PLAYER].height; - if (!!(mthing->options & MTF_AMBUSH) ^ !!(mthing->options & MTF_OBJECTFLIP)) + if (!!(mthing->args[0]) ^ !!(mthing->options & MTF_OBJECTFLIP)) { z = c - offset; if (z < f) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index fd8a23013..a6b08812b 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1146,7 +1146,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // PEGGING if (gl_linedef->flags & ML_DONTPEGTOP) texturevpegtop = 0; - else if (gl_linedef->flags & ML_EFFECT1) + else if (gl_linedef->flags & ML_SKEWTD) texturevpegtop = worldhigh + textureheight[gl_sidedef->toptexture] - worldtop; else texturevpegtop = gl_backsector->ceilingheight + textureheight[gl_sidedef->toptexture] - gl_frontsector->ceilingheight; @@ -1162,7 +1162,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; // Adjust t value for sloped walls - if (!(gl_linedef->flags & ML_EFFECT1)) + if (!(gl_linedef->flags & ML_SKEWTD)) { // Unskewed wallVerts[3].t -= (worldtop - gl_frontsector->ceilingheight) * grTex->scaleY; @@ -1212,7 +1212,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // PEGGING if (!(gl_linedef->flags & ML_DONTPEGBOTTOM)) texturevpegbottom = 0; - else if (gl_linedef->flags & ML_EFFECT1) + else if (gl_linedef->flags & ML_SKEWTD) texturevpegbottom = worldbottom - worldlow; else texturevpegbottom = gl_frontsector->floorheight - gl_backsector->floorheight; @@ -1228,7 +1228,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; // Adjust t value for sloped walls - if (!(gl_linedef->flags & ML_EFFECT1)) + if (!(gl_linedef->flags & ML_SKEWTD)) { // Unskewed wallVerts[0].t -= (worldbottom - gl_frontsector->floorheight) * grTex->scaleY; @@ -1286,7 +1286,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (gl_sidedef->repeatcnt) repeats = 1 + gl_sidedef->repeatcnt; - else if (gl_linedef->flags & ML_EFFECT5) + else if (gl_linedef->flags & ML_WRAPMIDTEX) { fixed_t high, low; @@ -1328,9 +1328,9 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom popenbottom = max(worldbottom, worldlow); } - if (gl_linedef->flags & ML_EFFECT2) + if (gl_linedef->flags & ML_NOSKEW) { - if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) + if (gl_linedef->flags & ML_MIDPEG) { polybottom = max(front->floorheight, back->floorheight) + gl_sidedef->rowoffset; polytop = polybottom + textureheight[gl_midtexture]*repeats; @@ -1341,7 +1341,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom polybottom = polytop - textureheight[gl_midtexture]*repeats; } } - else if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) + else if (gl_linedef->flags & ML_MIDPEG) { polybottom = popenbottom + gl_sidedef->rowoffset; polytop = polybottom + textureheight[gl_midtexture]*repeats; @@ -1371,7 +1371,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { // PEGGING - if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) + if (gl_linedef->flags & ML_MIDPEG) texturevpeg = textureheight[gl_sidedef->midtexture]*repeats - h + polybottom; else texturevpeg = polytop - h; @@ -1394,9 +1394,9 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { fixed_t midtextureslant; - if (gl_linedef->flags & ML_EFFECT2) + if (gl_linedef->flags & ML_NOSKEW) midtextureslant = 0; - else if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) + else if (gl_linedef->flags & ML_MIDPEG) midtextureslant = worldlow < worldbottom ? worldbottomslope-worldbottom : worldlowslope-worldlow; @@ -1421,7 +1421,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { // PEGGING - if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) + if (gl_linedef->flags & ML_MIDPEG) texturevpeg = textureheight[gl_sidedef->midtexture]*repeats - h + polybottom; else texturevpeg = polytop - h; @@ -1435,44 +1435,17 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // set alpha for transparent walls // ooops ! this do not work at all because render order we should render it in backtofront order - switch (gl_linedef->special) + if (gl_linedef->blendmode && gl_linedef->blendmode != AST_FOG) { - // Translucent - case 102: - case 121: - case 123: - case 124: - case 125: - case 141: - case 142: - case 144: - case 145: - case 174: - case 175: - case 192: - case 195: - case 221: - case 253: - case 256: - if (gl_linedef->blendmode && gl_linedef->blendmode != AST_FOG) - blendmode = HWR_SurfaceBlend(gl_linedef->blendmode, R_GetLinedefTransTable(gl_linedef->alpha), &Surf); - else - blendmode = PF_Translucent; - break; - default: - if (gl_linedef->blendmode && gl_linedef->blendmode != AST_FOG) - { - if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT) - blendmode = HWR_SurfaceBlend(gl_linedef->blendmode, R_GetLinedefTransTable(gl_linedef->alpha), &Surf); - else - blendmode = HWR_GetBlendModeFlag(gl_linedef->blendmode); - } - else if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT) - blendmode = HWR_TranstableToAlpha(R_GetLinedefTransTable(gl_linedef->alpha), &Surf); - else - blendmode = PF_Masked; - break; + if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT) + blendmode = HWR_SurfaceBlend(gl_linedef->blendmode, R_GetLinedefTransTable(gl_linedef->alpha), &Surf); + else + blendmode = HWR_GetBlendModeFlag(gl_linedef->blendmode); } + else if (gl_linedef->alpha >= 0 && gl_linedef->alpha < FRACUNIT) + blendmode = HWR_TranstableToAlpha(R_GetLinedefTransTable(gl_linedef->alpha), &Surf); + else + blendmode = PF_Masked; if (gl_curline->polyseg && gl_curline->polyseg->translucency > 0) { @@ -1538,7 +1511,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { fixed_t texturevpeg; // PEGGING - if ((gl_linedef->flags & (ML_DONTPEGBOTTOM|ML_EFFECT2)) == (ML_DONTPEGBOTTOM|ML_EFFECT2)) + if ((gl_linedef->flags & (ML_DONTPEGBOTTOM|ML_NOSKEW)) == (ML_DONTPEGBOTTOM|ML_NOSKEW)) texturevpeg = gl_frontsector->floorheight + textureheight[gl_sidedef->midtexture] - gl_frontsector->ceilingheight + gl_sidedef->rowoffset; else if (gl_linedef->flags & ML_DONTPEGBOTTOM) texturevpeg = worldbottom + textureheight[gl_sidedef->midtexture] - worldtop + gl_sidedef->rowoffset; @@ -1554,7 +1527,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX; // Texture correction for slopes - if (gl_linedef->flags & ML_EFFECT2) { + if (gl_linedef->flags & ML_NOSKEW) { wallVerts[3].t += (gl_frontsector->ceilingheight - worldtop) * grTex->scaleY; wallVerts[2].t += (gl_frontsector->ceilingheight - worldtopslope) * grTex->scaleY; wallVerts[0].t += (gl_frontsector->floorheight - worldbottom) * grTex->scaleY; @@ -1703,13 +1676,13 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { texturevpeg = sides[newline->sidenum[0]].rowoffset; attachtobottom = !!(newline->flags & ML_DONTPEGBOTTOM); - slopeskew = !!(newline->flags & ML_DONTPEGTOP); + slopeskew = !!(newline->flags & ML_SKEWTD); } else { texturevpeg = sides[rover->master->sidenum[0]].rowoffset; attachtobottom = !!(gl_linedef->flags & ML_DONTPEGBOTTOM); - slopeskew = !!(rover->master->flags & ML_DONTPEGTOP); + slopeskew = !!(rover->master->flags & ML_SKEWTD); } grTex = HWR_GetTexture(texnum); @@ -3062,13 +3035,13 @@ static void HWR_Subsector(size_t num) } light = R_GetPlaneLight(gl_frontsector, locFloorHeight, false); - if (gl_frontsector->floorlightsec == -1) - floorlightlevel = *gl_frontsector->lightlist[light].lightlevel; + if (gl_frontsector->floorlightsec == -1 && !gl_frontsector->floorlightabsolute) + floorlightlevel = max(0, min(255, *gl_frontsector->lightlist[light].lightlevel + gl_frontsector->floorlightlevel)); floorcolormap = *gl_frontsector->lightlist[light].extra_colormap; light = R_GetPlaneLight(gl_frontsector, locCeilingHeight, false); - if (gl_frontsector->ceilinglightsec == -1) - ceilinglightlevel = *gl_frontsector->lightlist[light].lightlevel; + if (gl_frontsector->ceilinglightsec == -1 && !gl_frontsector->ceilinglightabsolute) + ceilinglightlevel = max(0, min(255, *gl_frontsector->lightlist[light].lightlevel + gl_frontsector->ceilinglightlevel)); ceilingcolormap = *gl_frontsector->lightlist[light].extra_colormap; } @@ -3594,7 +3567,7 @@ static boolean HWR_DoCulling(line_t *cullheight, line_t *viewcullheight, float v return false; cullplane = FIXED_TO_FLOAT(cullheight->frontsector->floorheight); - if (cullheight->flags & ML_NOCLIMB) // Group culling + if (cullheight->args[1]) // Group culling { if (!viewcullheight) return false; diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index d546e2f7f..a003163db 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1306,7 +1306,11 @@ boolean HWR_DrawModel(gl_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 (!R_ThingIsFullBright(spr->mobj)) + if (R_ThingIsFullDark(spr->mobj)) + lightlevel = 0; + else if (R_ThingIsSemiBright(spr->mobj)) + lightlevel = 128 + (*sector->lightlist[light].lightlevel>>1); + else if (!R_ThingIsFullBright(spr->mobj)) lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel; if (*sector->lightlist[light].extra_colormap) @@ -1314,7 +1318,11 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) } else { - if (!R_ThingIsFullBright(spr->mobj)) + if (R_ThingIsFullDark(spr->mobj)) + lightlevel = 0; + else if (R_ThingIsSemiBright(spr->mobj)) + lightlevel = 128 + (sector->lightlevel>>1); + else if (!R_ThingIsFullBright(spr->mobj)) lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel; if (sector->extra_colormap) @@ -1346,12 +1354,18 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) //if (tics > durs) //durs = tics; + INT32 blendmode; + if (spr->mobj->frame & FF_BLENDMASK) + blendmode = ((spr->mobj->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1; + else + blendmode = spr->mobj->blendmode; + if (spr->mobj->frame & FF_TRANSMASK) - Surf.PolyFlags = HWR_SurfaceBlend(spr->mobj->blendmode, (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf); + Surf.PolyFlags = HWR_SurfaceBlend(blendmode, (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf); else { Surf.PolyColor.s.alpha = (spr->mobj->flags2 & MF2_SHADOW) ? 0x40 : 0xff; - Surf.PolyFlags = HWR_GetBlendModeFlag(spr->mobj->blendmode); + Surf.PolyFlags = HWR_GetBlendModeFlag(blendmode); } // don't forget to enable the depth test because we can't do this diff --git a/src/info.c b/src/info.c index 942934888..179370ca4 100644 --- a/src/info.c +++ b/src/info.c @@ -903,7 +903,7 @@ state_t states[NUMSTATES] = {SPR_TRET, FF_FULLBRIGHT|2, 7, {A_Pain}, 0, 0, S_TURRETSHOCK7}, // S_TURRETSHOCK6 {SPR_TRET, FF_FULLBRIGHT|3, 7, {NULL}, 0, 0, S_TURRETSHOCK8}, // S_TURRETSHOCK7 {SPR_TRET, FF_FULLBRIGHT|4, 7, {NULL}, 0, 0, S_TURRETSHOCK9}, // S_TURRETSHOCK8 - {SPR_TRET, FF_FULLBRIGHT|4, 7, {A_LinedefExecute}, LE_TURRET, 0, S_XPLD1}, // S_TURRETSHOCK9 + {SPR_TRET, FF_FULLBRIGHT|4, 7, {A_LinedefExecuteFromArg}, 0, 0, S_XPLD1}, // S_TURRETSHOCK9 {SPR_TURR, 0, 1, {A_Look}, 1, 0, S_TURRETPOPDOWN8}, // S_TURRETLOOK {SPR_TURR, 0, 0, {A_FaceTarget}, 0, 0, S_TURRETPOPUP1}, // S_TURRETSEE @@ -1456,7 +1456,7 @@ state_t states[NUMSTATES] = {SPR_FANG, 18, 16, {A_FaceTarget}, 3, 0, S_FANG_PINCHLOBSHOT1}, // S_FANG_PINCHLOBSHOT0 {SPR_FANG, 19, 2, {A_FaceTarget}, 3, 0, S_FANG_PINCHLOBSHOT2}, // S_FANG_PINCHLOBSHOT1 {SPR_FANG, 20, 30, {A_Boss5MakeItRain}, MT_FBOMB, -16, S_FANG_PINCHLOBSHOT3}, // S_FANG_PINCHLOBSHOT2 - {SPR_FANG, 20, 18, {A_LinedefExecute}, LE_BOSS4DROP, 0, S_FANG_PINCHLOBSHOT4}, // S_FANG_PINCHLOBSHOT3 + {SPR_FANG, 20, 18, {A_LinedefExecuteFromArg}, 4, 0, S_FANG_PINCHLOBSHOT4}, // S_FANG_PINCHLOBSHOT3 {SPR_FANG, 0, 0, {A_Boss5Calm}, 0, 0, S_FANG_PATHINGSTART1}, // S_FANG_PINCHLOBSHOT4 {SPR_FANG, 21, 0, {A_DoNPCPain}, 0, 0, S_FANG_DIE2}, // S_FANG_DIE1 @@ -1588,7 +1588,7 @@ state_t states[NUMSTATES] = {SPR_BRAK, 21, 3*TICRATE, {NULL}, 0, 0, S_BLACKEGG_DESTROYPLAT2}, // S_BLACKEGG_DESTROYPLAT1 {SPR_BRAK, 21, 1, {A_PlaySound}, sfx_s3k54, 0, S_BLACKEGG_DESTROYPLAT3}, // S_BLACKEGG_DESTROYPLAT2 - {SPR_BRAK, 21, 14, {A_LinedefExecute}, LE_BRAKPLATFORM, 0, S_BLACKEGG_STND}, // S_BLACKEGG_DESTROYPLAT3 + {SPR_BRAK, 21, 14, {A_LinedefExecuteFromArg}, 5, 0, S_BLACKEGG_STND}, // S_BLACKEGG_DESTROYPLAT3 {SPR_NULL, 0, 1, {A_CapeChase}, (160 - 20) << 16, 0, S_BLACKEGG_HELPER}, // S_BLACKEGG_HELPER @@ -1622,7 +1622,7 @@ state_t states[NUMSTATES] = {SPR_BRAK, 26 + FF_FULLBRIGHT, 2, {A_BrakFireShot}, MT_CYBRAKDEMON_FLAMESHOT, 128, S_CYBRAKDEMON_FLAME_ATTACK4}, // S_CYBRAKDEMON_FLAME_ATTACK3 // Fire {SPR_BRAK, 7, 1, {A_Repeat}, 30, S_CYBRAKDEMON_FLAME_ATTACK3, S_CYBRAKDEMON_FINISH_ATTACK1}, // S_CYBRAKDEMON_FLAME_ATTACK4 // Loop {SPR_BRAK, 0, 6, {A_RandomState}, S_CYBRAKDEMON_VILE_ATTACK1, S_CYBRAKDEMON_NAPALM_ATTACK1, S_CYBRAKDEMON_MISSILE_ATTACK1}, // S_CYBRAKDEMON_CHOOSE_ATTACK2 - {SPR_BRAK, 20, 0, {A_LinedefExecute}, LE_BRAKVILEATACK, 0, S_CYBRAKDEMON_VILE_ATTACK2}, // S_CYBRAKDEMON_VILE_ATTACK1 + {SPR_BRAK, 20, 0, {A_LinedefExecuteFromArg}, 5, 0, S_CYBRAKDEMON_VILE_ATTACK2}, // S_CYBRAKDEMON_VILE_ATTACK1 {SPR_BRAK, 20, 24, {A_VileTarget}, MT_CYBRAKDEMON_TARGET_RETICULE, 1, S_CYBRAKDEMON_VILE_ATTACK3}, // S_CYBRAKDEMON_VILE_ATTACK2 {SPR_BRAK, 19, 8, {A_FaceTarget}, 0, 0, S_CYBRAKDEMON_VILE_ATTACK4}, // S_CYBRAKDEMON_VILE_ATTACK3 {SPR_BRAK, 18, 8, {A_FaceTarget}, 0, 0, S_CYBRAKDEMON_VILE_ATTACK5}, // S_CYBRAKDEMON_VILE_ATTACK4 @@ -1635,7 +1635,7 @@ state_t states[NUMSTATES] = {SPR_BRAK, 0, 0, {A_SetReactionTime}, 0, 0, S_CYBRAKDEMON_WALK1}, // S_CYBRAKDEMON_FINISH_ATTACK2 // If just attacked, remove MF2_FRET w/out going back to spawnstate {SPR_BRAK, 18, 24, {A_Pain}, 0, 0, S_CYBRAKDEMON_PAIN2}, // S_CYBRAKDEMON_PAIN1 {SPR_BRAK, 18, 0, {A_CheckHealth}, 3, S_CYBRAKDEMON_PAIN3, S_CYBRAKDEMON_CHOOSE_ATTACK1}, // S_CYBRAKDEMON_PAIN2 - {SPR_BRAK, 18, 0, {A_LinedefExecute}, LE_PINCHPHASE, 0, S_CYBRAKDEMON_CHOOSE_ATTACK1}, // S_CYBRAKDEMON_PAIN3 + {SPR_BRAK, 18, 0, {A_LinedefExecuteFromArg}, 4, 0, S_CYBRAKDEMON_CHOOSE_ATTACK1}, // S_CYBRAKDEMON_PAIN3 {SPR_BRAK, 18, 1, {A_Repeat}, 1, S_CYBRAKDEMON_DIE1, S_CYBRAKDEMON_DIE2}, // S_CYBRAKDEMON_DIE1 {SPR_BRAK, 18, 2, {A_BossScream}, 2, 0, S_CYBRAKDEMON_DIE3}, // S_CYBRAKDEMON_DIE2 {SPR_BRAK, 18, 0, {A_Repeat}, 52, S_CYBRAKDEMON_DIE2, S_CYBRAKDEMON_DIE4}, // S_CYBRAKDEMON_DIE3 @@ -18217,13 +18217,13 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - // ambient water 1a (large) - { // MT_AWATERA + // ambient sound effect + { // MT_AMBIENT 700, // doomednum S_INVISIBLE, // spawnstate - 35, // spawnhealth + 1000, // spawnhealth S_NULL, // seestate - sfx_amwtr1, // seesound + sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound S_NULL, // painstate @@ -18245,283 +18245,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - // ambient water 1b (large) - { // MT_AWATERB - 701, // doomednum - S_INVISIBLE, // spawnstate - 35, // spawnhealth - S_NULL, // seestate - sfx_amwtr2, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - - // ambient water 2a (medium) - { // MT_AWATERC - 702, // doomednum - S_INVISIBLE, // spawnstate - 35, // spawnhealth - S_NULL, // seestate - sfx_amwtr3, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - - // ambient water 2b (medium) - { // MT_AWATERD - 703, // doomednum - S_INVISIBLE, // spawnstate - 35, // spawnhealth - S_NULL, // seestate - sfx_amwtr4, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - - // ambient water 3a (small) - { // MT_AWATERE - 704, // doomednum - S_INVISIBLE, // spawnstate - 35, // spawnhealth - S_NULL, // seestate - sfx_amwtr5, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - - // ambient water 3b (small) - { // MT_AWATERF - 705, // doomednum - S_INVISIBLE, // spawnstate - 35, // spawnhealth - S_NULL, // seestate - sfx_amwtr6, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - - // ambient water 4a (extra large) - { // MT_AWATERG - 706, // doomednum - S_INVISIBLE, // spawnstate - 35, // spawnhealth - S_NULL, // seestate - sfx_amwtr7, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - - // ambient water 4b (extra large) - { // MT_AWATERH - 707, // doomednum - S_INVISIBLE, // spawnstate - 35, // spawnhealth - S_NULL, // seestate - sfx_amwtr8, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - - { // MT_RANDOMAMBIENT - 708, // doomednum - S_INVISIBLE, // spawnstate - 512, // spawnhealth: repeat speed - S_NULL, // seestate - sfx_ambint, // seesound - 0, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 255, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 8*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 1000, // mass - 0, // damage - sfx_None, // activesound - MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - - { // MT_RANDOMAMBIENT2 - 709, // doomednum - S_INVISIBLE, // spawnstate - 220, // spawnhealth: repeat speed - S_NULL, // seestate - sfx_ambin2, // seesound - 0, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 255, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 8*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 1000, // mass - 0, // damage - sfx_None, // activesound - MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - - { // MT_MACHINEAMBIENCE - 710, // doomednum - S_INVISIBLE, // spawnstate - 24, // spawnhealth: repeat speed - S_NULL, // seestate - sfx_ambmac, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 200, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 1*FRACUNIT, // speed - 16*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 100, // mass - 20, // damage - sfx_None, // activesound - MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_AMBIENT, // flags - S_NULL // raisestate - }, - { // MT_CORK -1, // doomednum S_CORK, // spawnstate @@ -20874,34 +20597,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - // for use with wind and current effects - { // MT_PULL - 755, // doomednum - S_INVISIBLE, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 8, // radius - 8, // height - 0, // display offset - 10, // mass - 0, // damage - sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOGRAVITY, // flags - S_NULL // raisestate - }, - { // MT_GHOST -1, // doomednum S_THOK, // spawnstate diff --git a/src/info.h b/src/info.h index 1b7a201ce..a9f68721f 100644 --- a/src/info.h +++ b/src/info.h @@ -152,6 +152,7 @@ enum actionnum A_BOSS3PATH, A_BOSS3SHOCKTHINK, A_LINEDEFEXECUTE, + A_LINEDEFEXECUTEFROMARG, A_PLAYSEESOUND, A_PLAYATTACKSOUND, A_PLAYACTIVESOUND, @@ -415,6 +416,7 @@ void A_Boss3TakeDamage(); void A_Boss3Path(); void A_Boss3ShockThink(); void A_LinedefExecute(); +void A_LinedefExecuteFromArg(); void A_PlaySeeSound(); void A_PlayAttackSound(); void A_PlayActiveSound(); @@ -4999,17 +5001,7 @@ typedef enum mobj_type MT_FINISHFLAG, // Finish flag // Ambient Sounds - MT_AWATERA, // Ambient Water Sound 1 - MT_AWATERB, // Ambient Water Sound 2 - MT_AWATERC, // Ambient Water Sound 3 - MT_AWATERD, // Ambient Water Sound 4 - MT_AWATERE, // Ambient Water Sound 5 - MT_AWATERF, // Ambient Water Sound 6 - MT_AWATERG, // Ambient Water Sound 7 - MT_AWATERH, // Ambient Water Sound 8 - MT_RANDOMAMBIENT, - MT_RANDOMAMBIENT2, - MT_MACHINEAMBIENCE, + MT_AMBIENT, MT_CORK, MT_LHRT, @@ -5113,7 +5105,6 @@ typedef enum mobj_type MT_CRUMBLEOBJ, // Sound generator for crumbling platform MT_TUBEWAYPOINT, MT_PUSH, - MT_PULL, MT_GHOST, MT_OVERLAY, MT_ANGLEMAN, diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 120ab671e..da3614271 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2202,6 +2202,31 @@ static int lib_pExplodeMissile(lua_State *L) return 0; } +static int lib_pMobjTouchingSectorSpecial(lua_State *L) +{ + mobj_t *mo = *((mobj_t**)luaL_checkudata(L, 1, META_MOBJ)); + INT32 section = (INT32)luaL_checkinteger(L, 2); + INT32 number = (INT32)luaL_checkinteger(L, 3); + //HUDSAFE + INLEVEL + if (!mo) + return LUA_ErrInvalid(L, "mobj_t"); + LUA_PushUserdata(L, P_MobjTouchingSectorSpecial(mo, section, number), META_SECTOR); + return 1; +} + +static int lib_pMobjTouchingSectorSpecialFlag(lua_State *L) +{ + mobj_t *mo = *((mobj_t**)luaL_checkudata(L, 1, META_MOBJ)); + sectorspecialflags_t flag = (INT32)luaL_checkinteger(L, 2); + //HUDSAFE + INLEVEL + if (!mo) + return LUA_ErrInvalid(L, "mobj_t"); + LUA_PushUserdata(L, P_MobjTouchingSectorSpecialFlag(mo, flag), META_SECTOR); + return 1; +} + static int lib_pPlayerTouchingSectorSpecial(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); @@ -2215,6 +2240,18 @@ static int lib_pPlayerTouchingSectorSpecial(lua_State *L) return 1; } +static int lib_pPlayerTouchingSectorSpecialFlag(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + sectorspecialflags_t flag = (INT32)luaL_checkinteger(L, 2); + //HUDSAFE + INLEVEL + if (!player) + return LUA_ErrInvalid(L, "player_t"); + LUA_PushUserdata(L, P_PlayerTouchingSectorSpecialFlag(player, flag), META_SECTOR); + return 1; +} + static int lib_pFindLowestFloorSurrounding(lua_State *L) { sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); @@ -2346,23 +2383,13 @@ static int lib_pFadeLight(lua_State *L) INT32 speed = (INT32)luaL_checkinteger(L, 3); boolean ticbased = lua_optboolean(L, 4); boolean force = lua_optboolean(L, 5); + boolean relative = lua_optboolean(L, 6); NOHUD INLEVEL - P_FadeLight(tag, destvalue, speed, ticbased, force); + P_FadeLight(tag, destvalue, speed, ticbased, force, relative); return 0; } -static int lib_pThingOnSpecial3DFloor(lua_State *L) -{ - mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); - NOHUD - INLEVEL - if (!mo) - return LUA_ErrInvalid(L, "mobj_t"); - LUA_PushUserdata(L, P_ThingOnSpecial3DFloor(mo), META_SECTOR); - return 1; -} - static int lib_pIsFlagAtBase(lua_State *L) { mobjtype_t flag = luaL_checkinteger(L, 1); @@ -4055,7 +4082,10 @@ static luaL_Reg lib[] = { {"P_SetMobjStateNF",lib_pSetMobjStateNF}, {"P_DoSuperTransformation",lib_pDoSuperTransformation}, {"P_ExplodeMissile",lib_pExplodeMissile}, + {"P_MobjTouchingSectorSpecial",lib_pMobjTouchingSectorSpecial}, + {"P_MobjTouchingSectorSpecialFlag",lib_pMobjTouchingSectorSpecialFlag}, {"P_PlayerTouchingSectorSpecial",lib_pPlayerTouchingSectorSpecial}, + {"P_PlayerTouchingSectorSpecialFlag",lib_pPlayerTouchingSectorSpecialFlag}, {"P_FindLowestFloorSurrounding",lib_pFindLowestFloorSurrounding}, {"P_FindHighestFloorSurrounding",lib_pFindHighestFloorSurrounding}, {"P_FindNextHighestFloor",lib_pFindNextHighestFloor}, @@ -4067,7 +4097,6 @@ static luaL_Reg lib[] = { {"P_LinedefExecute",lib_pLinedefExecute}, {"P_SpawnLightningFlash",lib_pSpawnLightningFlash}, {"P_FadeLight",lib_pFadeLight}, - {"P_ThingOnSpecial3DFloor",lib_pThingOnSpecial3DFloor}, {"P_IsFlagAtBase",lib_pIsFlagAtBase}, {"P_SetupLevelSky",lib_pSetupLevelSky}, {"P_SetSkyboxMobj",lib_pSetSkyboxMobj}, diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 9e58f4b6b..0c3440426 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -35,6 +35,10 @@ enum sector_e { sector_floorpic, sector_ceilingpic, sector_lightlevel, + sector_floorlightlevel, + sector_floorlightabsolute, + sector_ceilinglightlevel, + sector_ceilinglightabsolute, sector_special, sector_tag, sector_taglist, @@ -44,7 +48,14 @@ enum sector_e { sector_lines, sector_ffloors, sector_fslope, - sector_cslope + sector_cslope, + sector_flags, + sector_specialflags, + sector_damagetype, + sector_triggertag, + sector_triggerer, + sector_friction, + sector_gravity, }; static const char *const sector_opt[] = { @@ -54,6 +65,10 @@ static const char *const sector_opt[] = { "floorpic", "ceilingpic", "lightlevel", + "floorlightlevel", + "floorlightabsolute", + "ceilinglightlevel", + "ceilinglightabsolute", "special", "tag", "taglist", @@ -64,6 +79,13 @@ static const char *const sector_opt[] = { "ffloors", "f_slope", "c_slope", + "flags", + "specialflags", + "damagetype", + "triggertag", + "triggerer", + "friction", + "gravity", NULL}; enum subsector_e { @@ -199,6 +221,12 @@ enum ffloor_e { ffloor_prev, ffloor_alpha, ffloor_blend, + ffloor_bustflags, + ffloor_busttype, + ffloor_busttag, + ffloor_sinkspeed, + ffloor_friction, + ffloor_bouncestrength, }; static const char *const ffloor_opt[] = { @@ -218,6 +246,12 @@ static const char *const ffloor_opt[] = { "prev", "alpha", "blend", + "bustflags", + "busttype", + "busttag", + "sinkspeed", + "friction", + "bouncestrength", NULL}; #ifdef HAVE_LUA_SEGS @@ -583,6 +617,18 @@ static int sector_get(lua_State *L) case sector_lightlevel: lua_pushinteger(L, sector->lightlevel); return 1; + case sector_floorlightlevel: + lua_pushinteger(L, sector->floorlightlevel); + return 1; + case sector_floorlightabsolute: + lua_pushboolean(L, sector->floorlightabsolute); + return 1; + case sector_ceilinglightlevel: + lua_pushinteger(L, sector->ceilinglightlevel); + return 1; + case sector_ceilinglightabsolute: + lua_pushboolean(L, sector->ceilinglightabsolute); + return 1; case sector_special: lua_pushinteger(L, sector->special); return 1; @@ -621,6 +667,27 @@ static int sector_get(lua_State *L) case sector_cslope: // c_slope LUA_PushUserdata(L, sector->c_slope, META_SLOPE); return 1; + case sector_flags: // flags + lua_pushinteger(L, sector->flags); + return 1; + case sector_specialflags: // specialflags + lua_pushinteger(L, sector->specialflags); + return 1; + case sector_damagetype: // damagetype + lua_pushinteger(L, (UINT8)sector->damagetype); + return 1; + case sector_triggertag: // triggertag + lua_pushinteger(L, (INT16)sector->triggertag); + return 1; + case sector_triggerer: // triggerer + lua_pushinteger(L, (UINT8)sector->triggerer); + return 1; + case sector_friction: // friction + lua_pushfixed(L, sector->friction); + return 1; + case sector_gravity: // gravity + lua_pushfixed(L, sector->gravity); + return 1; } return 0; } @@ -648,6 +715,7 @@ static int sector_set(lua_State *L) case sector_ffloors: // ffloors case sector_fslope: // f_slope case sector_cslope: // c_slope + case sector_friction: // friction default: return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]); case sector_floorheight: { // floorheight @@ -687,6 +755,18 @@ static int sector_set(lua_State *L) case sector_lightlevel: sector->lightlevel = (INT16)luaL_checkinteger(L, 3); break; + case sector_floorlightlevel: + sector->floorlightlevel = (INT16)luaL_checkinteger(L, 3); + break; + case sector_floorlightabsolute: + sector->floorlightabsolute = luaL_checkboolean(L, 3); + break; + case sector_ceilinglightlevel: + sector->ceilinglightlevel = (INT16)luaL_checkinteger(L, 3); + break; + case sector_ceilinglightabsolute: + sector->ceilinglightabsolute = luaL_checkboolean(L, 3); + break; case sector_special: sector->special = (INT16)luaL_checkinteger(L, 3); break; @@ -695,6 +775,25 @@ static int sector_set(lua_State *L) break; case sector_taglist: return LUA_ErrSetDirectly(L, "sector_t", "taglist"); + case sector_flags: + sector->flags = luaL_checkinteger(L, 3); + CheckForReverseGravity |= (sector->flags & MSF_GRAVITYFLIP); + break; + case sector_specialflags: + sector->specialflags = luaL_checkinteger(L, 3); + break; + case sector_damagetype: + sector->damagetype = (UINT8)luaL_checkinteger(L, 3); + break; + case sector_triggertag: + sector->triggertag = (INT16)luaL_checkinteger(L, 3); + break; + case sector_triggerer: + sector->triggerer = (UINT8)luaL_checkinteger(L, 3); + break; + case sector_gravity: + sector->gravity = luaL_checkfixed(L, 3); + break; } return 0; } @@ -1817,6 +1916,24 @@ static int ffloor_get(lua_State *L) case ffloor_blend: lua_pushinteger(L, ffloor->blend); return 1; + case ffloor_bustflags: + lua_pushinteger(L, ffloor->bustflags); + return 1; + case ffloor_busttype: + lua_pushinteger(L, ffloor->busttype); + return 1; + case ffloor_busttag: + lua_pushinteger(L, ffloor->busttag); + return 1; + case ffloor_sinkspeed: + lua_pushfixed(L, ffloor->sinkspeed); + return 1; + case ffloor_friction: + lua_pushfixed(L, ffloor->friction); + return 1; + case ffloor_bouncestrength: + lua_pushfixed(L, ffloor->bouncestrength); + return 1; } return 0; } diff --git a/src/lua_polyobjlib.c b/src/lua_polyobjlib.c index e254b0e4a..a91c354f4 100644 --- a/src/lua_polyobjlib.c +++ b/src/lua_polyobjlib.c @@ -244,13 +244,14 @@ static int lib_polyobj_rotate(lua_State *L) { polyobj_t *po = *((polyobj_t **)luaL_checkudata(L, 1, META_POLYOBJ)); angle_t delta = luaL_checkangle(L, 2); - UINT8 turnthings = (UINT8)luaL_optinteger(L, 3, 0); // don't turn anything by default? (could change this if not desired) - boolean checkmobjs = lua_opttrueboolean(L, 4); + boolean turnplayers = lua_opttrueboolean(L, 3); + boolean turnothers = lua_opttrueboolean(L, 4); + boolean checkmobjs = lua_opttrueboolean(L, 5); NOHUD INLEVEL if (!po) return LUA_ErrInvalid(L, "polyobj_t"); - lua_pushboolean(L, Polyobj_rotate(po, delta, turnthings, checkmobjs)); + lua_pushboolean(L, Polyobj_rotate(po, delta, turnplayers, turnothers, checkmobjs)); return 1; } diff --git a/src/m_cheat.c b/src/m_cheat.c index 82d0b9d5a..40b9a1230 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -539,7 +539,7 @@ void Command_Teleport_f(void) // Flagging a player's ambush will make them start on the ceiling // Objectflip inverts - if (!!(mt->options & MTF_AMBUSH) ^ !!(mt->options & MTF_OBJECTFLIP)) + if (!!(mt->args[0]) ^ !!(mt->options & MTF_OBJECTFLIP)) intz = ss->sector->ceilingheight - p->mo->height - offset; else intz = ss->sector->floorheight + offset; @@ -1004,7 +1004,7 @@ static void OP_CycleThings(INT32 amt) } while (mobjinfo[op_currentthing].doomednum == -1 || op_currentthing == MT_NIGHTSDRONE - || mobjinfo[op_currentthing].flags & (MF_AMBIENT|MF_NOSECTOR) + || mobjinfo[op_currentthing].flags & MF_NOSECTOR || (states[mobjinfo[op_currentthing].spawnstate].sprite == SPR_NULL && states[mobjinfo[op_currentthing].seestate].sprite == SPR_NULL) ); @@ -1137,7 +1137,7 @@ void OP_ResetObjectplace(void) // // Main meat of objectplace: handling functions // -void OP_NightsObjectplace(player_t *player) +/*void OP_NightsObjectplace(player_t *player) { ticcmd_t *cmd = &player->cmd; mapthing_t *mt; @@ -1283,14 +1283,14 @@ void OP_NightsObjectplace(player_t *player) mt = OP_CreateNewMapThing(player, (UINT16)cv_mapthingnum.value, false); mt->angle = angle; - if (mt->type >= 600 && mt->type <= 609) // Placement patterns + if (mt->type >= 600 && mt->type <= 611) // Placement patterns P_SpawnItemPattern(mt, false); - else if (mt->type == 1705 || mt->type == 1713) // NiGHTS Hoops + else if (mt->type == 1713) // NiGHTS Hoops P_SpawnHoop(mt); else P_SpawnMapThing(mt); } -} +}*/ // // OP_ObjectplaceMovement @@ -1414,9 +1414,9 @@ void OP_ObjectplaceMovement(player_t *player) return; mt = OP_CreateNewMapThing(player, (UINT16)spawnthing, ceiling); - if (mt->type >= 600 && mt->type <= 609) // Placement patterns + if (mt->type >= 600 && mt->type <= 611) // Placement patterns P_SpawnItemPattern(mt, false); - else if (mt->type == 1705 || mt->type == 1713) // NiGHTS Hoops + else if (mt->type == 1713) // NiGHTS Hoops P_SpawnHoop(mt); else P_SpawnMapThing(mt); @@ -1428,14 +1428,14 @@ void OP_ObjectplaceMovement(player_t *player) // // Objectplace related commands. // -void Command_Writethings_f(void) +/*void Command_Writethings_f(void) { REQUIRE_INLEVEL; REQUIRE_SINGLEPLAYER; REQUIRE_OBJECTPLACE; P_WriteThings(); -} +}*/ void Command_ObjectPlace_f(void) { diff --git a/src/m_cheat.h b/src/m_cheat.h index c22e262fb..086117579 100644 --- a/src/m_cheat.h +++ b/src/m_cheat.h @@ -26,7 +26,7 @@ void cht_Init(void); // ObjectPlace // void Command_ObjectPlace_f(void); -void Command_Writethings_f(void); +//void Command_Writethings_f(void); extern consvar_t cv_opflags, cv_ophoopflags, cv_mapthingnum, cv_speed; //extern consvar_t cv_snapto, cv_grid; @@ -38,7 +38,7 @@ extern UINT32 op_displayflags; boolean OP_FreezeObjectplace(void); void OP_ResetObjectplace(void); -void OP_NightsObjectplace(player_t *player); +//void OP_NightsObjectplace(player_t *player); void OP_ObjectplaceMovement(player_t *player); // diff --git a/src/m_misc.c b/src/m_misc.c index d7d6d6bbb..f9afa4803 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1970,18 +1970,168 @@ void M_UnGetToken(void) endPos = oldendPos; } -/** Returns the current token's position. - */ -UINT32 M_GetTokenPos(void) +#define NUMTOKENS 2 +static const char *tokenizerInput = NULL; +static UINT32 tokenCapacity[NUMTOKENS] = {0}; +static char *tokenizerToken[NUMTOKENS] = {NULL}; +static UINT32 tokenizerStartPos = 0; +static UINT32 tokenizerEndPos = 0; +static UINT32 tokenizerInputLength = 0; +static UINT8 tokenizerInComment = 0; // 0 = not in comment, 1 = // Single-line, 2 = /* Multi-line */ + +void M_TokenizerOpen(const char *inputString) { - return endPos; + size_t i; + + tokenizerInput = inputString; + for (i = 0; i < NUMTOKENS; i++) + { + tokenCapacity[i] = 1024; + tokenizerToken[i] = (char*)Z_Malloc(tokenCapacity[i] * sizeof(char), PU_STATIC, NULL); + } + tokenizerInputLength = strlen(tokenizerInput); } -/** Sets the current token's position. - */ -void M_SetTokenPos(UINT32 newPos) +void M_TokenizerClose(void) { - endPos = newPos; + size_t i; + + tokenizerInput = NULL; + for (i = 0; i < NUMTOKENS; i++) + Z_Free(tokenizerToken[i]); + tokenizerStartPos = 0; + tokenizerEndPos = 0; + tokenizerInComment = 0; +} + +static void M_DetectComment(UINT32 *pos) +{ + if (tokenizerInComment) + return; + + if (*pos >= tokenizerInputLength - 1) + return; + + if (tokenizerInput[*pos] != '/') + return; + + //Single-line comment start + if (tokenizerInput[*pos + 1] == '/') + tokenizerInComment = 1; + //Multi-line comment start + else if (tokenizerInput[*pos + 1] == '*') + tokenizerInComment = 2; +} + +static void M_ReadTokenString(UINT32 i) +{ + UINT32 tokenLength = tokenizerEndPos - tokenizerStartPos; + if (tokenLength + 1 > tokenCapacity[i]) + { + tokenCapacity[i] = tokenLength + 1; + // Assign the memory. Don't forget an extra byte for the end of the string! + tokenizerToken[i] = (char *)Z_Malloc(tokenCapacity[i] * sizeof(char), PU_STATIC, NULL); + } + // Copy the string. + M_Memcpy(tokenizerToken[i], tokenizerInput + tokenizerStartPos, (size_t)tokenLength); + // Make the final character NUL. + tokenizerToken[i][tokenLength] = '\0'; +} + +const char *M_TokenizerRead(UINT32 i) +{ + if (!tokenizerInput) + return NULL; + + tokenizerStartPos = tokenizerEndPos; + + // Try to detect comments now, in case we're pointing right at one + M_DetectComment(&tokenizerStartPos); + + // Find the first non-whitespace char, or else the end of the string trying + while ((tokenizerInput[tokenizerStartPos] == ' ' + || tokenizerInput[tokenizerStartPos] == '\t' + || tokenizerInput[tokenizerStartPos] == '\r' + || tokenizerInput[tokenizerStartPos] == '\n' + || tokenizerInput[tokenizerStartPos] == '\0' + || tokenizerInput[tokenizerStartPos] == '=' || tokenizerInput[tokenizerStartPos] == ';' // UDMF TEXTMAP. + || tokenizerInComment != 0) + && tokenizerStartPos < tokenizerInputLength) + { + // Try to detect comment endings now + if (tokenizerInComment == 1 && tokenizerInput[tokenizerStartPos] == '\n') + tokenizerInComment = 0; // End of line for a single-line comment + else if (tokenizerInComment == 2 + && tokenizerStartPos < tokenizerInputLength - 1 + && tokenizerInput[tokenizerStartPos] == '*' + && tokenizerInput[tokenizerStartPos+1] == '/') + { + // End of multi-line comment + tokenizerInComment = 0; + tokenizerStartPos++; // Make damn well sure we're out of the comment ending at the end of it all + } + + tokenizerStartPos++; + M_DetectComment(&tokenizerStartPos); + } + + // If the end of the string is reached, no token is to be read + if (tokenizerStartPos == tokenizerInputLength) { + tokenizerEndPos = tokenizerInputLength; + return NULL; + } + // Else, if it's one of these three symbols, capture only this one character + else if (tokenizerInput[tokenizerStartPos] == ',' + || tokenizerInput[tokenizerStartPos] == '{' + || tokenizerInput[tokenizerStartPos] == '}') + { + tokenizerEndPos = tokenizerStartPos + 1; + tokenizerToken[i][0] = tokenizerInput[tokenizerStartPos]; + tokenizerToken[i][1] = '\0'; + return tokenizerToken[i]; + } + // Return entire string within quotes, except without the quotes. + else if (tokenizerInput[tokenizerStartPos] == '"') + { + tokenizerEndPos = ++tokenizerStartPos; + while (tokenizerInput[tokenizerEndPos] != '"' && tokenizerEndPos < tokenizerInputLength) + tokenizerEndPos++; + + M_ReadTokenString(i); + tokenizerEndPos++; + return tokenizerToken[i]; + } + + // Now find the end of the token. This includes several additional characters that are okay to capture as one character, but not trailing at the end of another token. + tokenizerEndPos = tokenizerStartPos + 1; + while ((tokenizerInput[tokenizerEndPos] != ' ' + && tokenizerInput[tokenizerEndPos] != '\t' + && tokenizerInput[tokenizerEndPos] != '\r' + && tokenizerInput[tokenizerEndPos] != '\n' + && tokenizerInput[tokenizerEndPos] != ',' + && tokenizerInput[tokenizerEndPos] != '{' + && tokenizerInput[tokenizerEndPos] != '}' + && tokenizerInput[tokenizerEndPos] != '=' && tokenizerInput[tokenizerEndPos] != ';' // UDMF TEXTMAP. + && tokenizerInComment == 0) + && tokenizerEndPos < tokenizerInputLength) + { + tokenizerEndPos++; + // Try to detect comment starts now; if it's in a comment, we don't want it in this token + M_DetectComment(&tokenizerEndPos); + } + + M_ReadTokenString(i); + return tokenizerToken[i]; +} + +UINT32 M_TokenizerGetEndPos(void) +{ + return tokenizerEndPos; +} + +void M_TokenizerSetEndPos(UINT32 newPos) +{ + tokenizerEndPos = newPos; } /** Count bits in a number. diff --git a/src/p_ceilng.c b/src/p_ceilng.c index 50344ee0c..d88d9be86 100644 --- a/src/p_ceilng.c +++ b/src/p_ceilng.c @@ -34,7 +34,6 @@ INT32 ceilmovesound = sfx_None; void T_MoveCeiling(ceiling_t *ceiling) { result_e res; - boolean dontupdate = false; if (ceiling->delaytimer) { @@ -42,259 +41,81 @@ void T_MoveCeiling(ceiling_t *ceiling) return; } - switch (ceiling->direction) + res = T_MovePlane(ceiling->sector, ceiling->speed, (ceiling->direction == 1) ? ceiling->topheight : ceiling->bottomheight, false, true, ceiling->direction); + + if (ceiling->type == bounceCeiling) { - case 0: // IN STASIS - break; - case 1: // UP - res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->topheight, false, true, ceiling->direction); - - if (ceiling->type == bounceCeiling) - { - const fixed_t origspeed = FixedDiv(ceiling->origspeed,(ELEVATORSPEED/2)); - const fixed_t fs = abs(ceiling->sector->ceilingheight - lines[ceiling->texture].frontsector->ceilingheight); - const fixed_t bs = abs(ceiling->sector->ceilingheight - lines[ceiling->texture].backsector->ceilingheight); - if (fs < bs) - ceiling->speed = FixedDiv(fs,25*FRACUNIT) + FRACUNIT/4; - else - ceiling->speed = FixedDiv(bs,25*FRACUNIT) + FRACUNIT/4; - - ceiling->speed = FixedMul(ceiling->speed,origspeed); - } - - if (res == pastdest) - { - switch (ceiling->type) - { - case instantMoveCeilingByFrontSector: - if (ceiling->texture > -1) - ceiling->sector->ceilingpic = ceiling->texture; - ceiling->sector->ceilingdata = NULL; - ceiling->sector->ceilspeed = 0; - P_RemoveThinker(&ceiling->thinker); - dontupdate = true; - break; - case moveCeilingByFrontSector: - if (ceiling->texture < -1) // chained linedef executing - P_LinedefExecute((INT16)(ceiling->texture + INT16_MAX + 2), NULL, NULL); - if (ceiling->texture > -1) // flat changing - ceiling->sector->ceilingpic = ceiling->texture; - /* FALLTHRU */ - case raiseToHighest: -// case raiseCeilingByLine: - case moveCeilingByFrontTexture: - ceiling->sector->ceilingdata = NULL; - ceiling->sector->ceilspeed = 0; - P_RemoveThinker(&ceiling->thinker); - dontupdate = true; - break; - - case fastCrushAndRaise: - case crushAndRaise: - ceiling->direction = -1; - break; - - case bounceCeiling: - { - fixed_t dest = ceiling->topheight; - - if (dest == lines[ceiling->texture].frontsector->ceilingheight) - dest = lines[ceiling->texture].backsector->ceilingheight; - else - dest = lines[ceiling->texture].frontsector->ceilingheight; - - if (dest < ceiling->sector->ceilingheight) // must move down - { - ceiling->direction = -1; - ceiling->bottomheight = dest; - } - else // must move up - { - ceiling->direction = 1; - ceiling->topheight = dest; - } - - ceiling->delaytimer = ceiling->delay; - - // That's it. Do not set dontupdate, do not remove the thinker. - break; - } - - case bounceCeilingCrush: - { - fixed_t dest = ceiling->topheight; - - if (dest == lines[ceiling->texture].frontsector->ceilingheight) - { - dest = lines[ceiling->texture].backsector->ceilingheight; - ceiling->speed = ceiling->origspeed = FixedDiv(abs(lines[ceiling->texture].dy),4*FRACUNIT); // return trip, use dy - } - else - { - dest = lines[ceiling->texture].frontsector->ceilingheight; - ceiling->speed = ceiling->origspeed = FixedDiv(abs(lines[ceiling->texture].dx),4*FRACUNIT); // going frontways, use dx - } - - if (dest < ceiling->sector->ceilingheight) // must move down - { - ceiling->direction = -1; - ceiling->bottomheight = dest; - } - else // must move up - { - ceiling->direction = 1; - ceiling->topheight = dest; - } - - ceiling->delaytimer = ceiling->delay; - - // That's it. Do not set dontupdate, do not remove the thinker. - break; - } - - default: - break; - } - } - break; - - case -1: // DOWN - res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight, ceiling->crush, true, ceiling->direction); - - if (ceiling->type == bounceCeiling) - { - const fixed_t origspeed = FixedDiv(ceiling->origspeed,(ELEVATORSPEED/2)); - const fixed_t fs = abs(ceiling->sector->ceilingheight - lines[ceiling->texture].frontsector->ceilingheight); - const fixed_t bs = abs(ceiling->sector->ceilingheight - lines[ceiling->texture].backsector->ceilingheight); - if (fs < bs) - ceiling->speed = FixedDiv(fs,25*FRACUNIT) + FRACUNIT/4; - else - ceiling->speed = FixedDiv(bs,25*FRACUNIT) + FRACUNIT/4; - ceiling->speed = FixedMul(ceiling->speed,origspeed); - } - - if (res == pastdest) - { - switch (ceiling->type) - { - // make platform stop at bottom of all crusher strokes - // except generalized ones, reset speed, start back up - case crushAndRaise: - ceiling->speed = CEILSPEED; - /* FALLTHRU */ - case fastCrushAndRaise: - ceiling->direction = 1; - break; - - case instantMoveCeilingByFrontSector: - if (ceiling->texture > -1) - ceiling->sector->ceilingpic = ceiling->texture; - ceiling->sector->ceilingdata = NULL; - ceiling->sector->ceilspeed = 0; - P_RemoveThinker(&ceiling->thinker); - dontupdate = true; - break; - - case moveCeilingByFrontSector: - if (ceiling->texture < -1) // chained linedef executing - P_LinedefExecute((INT16)(ceiling->texture + INT16_MAX + 2), NULL, NULL); - if (ceiling->texture > -1) // flat changing - ceiling->sector->ceilingpic = ceiling->texture; - // don't break - /* FALLTHRU */ - - // in all other cases, just remove the active ceiling - case lowerAndCrush: - case lowerToLowest: - case raiseToLowest: -// case lowerCeilingByLine: - case moveCeilingByFrontTexture: - ceiling->sector->ceilingdata = NULL; - ceiling->sector->ceilspeed = 0; - P_RemoveThinker(&ceiling->thinker); - dontupdate = true; - break; - case bounceCeiling: - { - fixed_t dest = ceiling->bottomheight; - - if (dest == lines[ceiling->texture].frontsector->ceilingheight) - dest = lines[ceiling->texture].backsector->ceilingheight; - else - dest = lines[ceiling->texture].frontsector->ceilingheight; - - if (dest < ceiling->sector->ceilingheight) // must move down - { - ceiling->direction = -1; - ceiling->bottomheight = dest; - } - else // must move up - { - ceiling->direction = 1; - ceiling->topheight = dest; - } - - ceiling->delaytimer = ceiling->delay; - - // That's it. Do not set dontupdate, do not remove the thinker. - break; - } - - case bounceCeilingCrush: - { - fixed_t dest = ceiling->bottomheight; - - if (dest == lines[ceiling->texture].frontsector->ceilingheight) - { - dest = lines[ceiling->texture].backsector->ceilingheight; - ceiling->speed = ceiling->origspeed = FixedDiv(abs(lines[ceiling->texture].dy),4*FRACUNIT); // return trip, use dy - } - else - { - dest = lines[ceiling->texture].frontsector->ceilingheight; - ceiling->speed = ceiling->origspeed = FixedDiv(abs(lines[ceiling->texture].dx),4*FRACUNIT); // going frontways, use dx - } - - if (dest < ceiling->sector->ceilingheight) // must move down - { - ceiling->direction = -1; - ceiling->bottomheight = dest; - } - else // must move up - { - ceiling->direction = 1; - ceiling->topheight = dest; - } - - ceiling->delaytimer = ceiling->delay; - - // That's it. Do not set dontupdate, do not remove the thinker. - break; - } - - default: - break; - } - } - else if (res == crushed) - { - switch (ceiling->type) - { - case crushAndRaise: - case lowerAndCrush: - ceiling->speed = FixedDiv(CEILSPEED,8*FRACUNIT); - break; - - default: - break; - } - } - break; + const fixed_t origspeed = FixedDiv(ceiling->origspeed, (ELEVATORSPEED/2)); + const fixed_t fs = abs(ceiling->sector->ceilingheight - lines[ceiling->sourceline].frontsector->ceilingheight); + const fixed_t bs = abs(ceiling->sector->ceilingheight - lines[ceiling->sourceline].backsector->ceilingheight); + if (fs < bs) + ceiling->speed = FixedDiv(fs, 25*FRACUNIT) + FRACUNIT/4; + else + ceiling->speed = FixedDiv(bs, 25*FRACUNIT) + FRACUNIT/4; + ceiling->speed = FixedMul(ceiling->speed, origspeed); } - if (!dontupdate) - ceiling->sector->ceilspeed = ceiling->speed*ceiling->direction; - else - ceiling->sector->ceilspeed = 0; + + if (res == pastdest) + { + switch (ceiling->type) + { + case instantMoveCeilingByFrontSector: + if (ceiling->texture > -1) // flat changing + ceiling->sector->ceilingpic = ceiling->texture; + ceiling->sector->ceilingdata = NULL; + ceiling->sector->ceilspeed = 0; + P_RemoveThinker(&ceiling->thinker); + return; + case moveCeilingByFrontSector: + if (ceiling->tag) // chained linedef executing + P_LinedefExecute(ceiling->tag, NULL, NULL); + if (ceiling->texture > -1) // flat changing + ceiling->sector->ceilingpic = ceiling->texture; + /* FALLTHRU */ + case raiseToHighest: + case moveCeilingByDistance: + ceiling->sector->ceilingdata = NULL; + ceiling->sector->ceilspeed = 0; + P_RemoveThinker(&ceiling->thinker); + return; + case bounceCeiling: + case bounceCeilingCrush: + { + fixed_t dest = (ceiling->direction == 1) ? ceiling->topheight : ceiling->bottomheight; + + if (dest == lines[ceiling->sourceline].frontsector->ceilingheight) + { + dest = lines[ceiling->sourceline].backsector->ceilingheight; + ceiling->origspeed = lines[ceiling->sourceline].args[3] << (FRACBITS - 2); // return trip, use args[3] + } + else + { + dest = lines[ceiling->sourceline].frontsector->ceilingheight; + ceiling->origspeed = lines[ceiling->sourceline].args[2] << (FRACBITS - 2); // going frontways, use args[2] + } + + if (ceiling->type == bounceCeilingCrush) + ceiling->speed = ceiling->origspeed; + + if (dest < ceiling->sector->ceilingheight) // must move down + { + ceiling->direction = -1; + ceiling->bottomheight = dest; + } + else // must move up + { + ceiling->direction = 1; + ceiling->topheight = dest; + } + + ceiling->delaytimer = ceiling->delay; + break; + } + default: + break; + } + } + ceiling->sector->ceilspeed = ceiling->speed*ceiling->direction; } /** Moves a ceiling crusher. @@ -322,11 +143,7 @@ void T_CrushCeiling(ceiling_t *ceiling) if (res == pastdest) { ceiling->direction = -1; - - if (lines[ceiling->sourceline].flags & ML_EFFECT4) - ceiling->speed = ceiling->oldspeed; - else - ceiling->speed = ceiling->oldspeed*2; + ceiling->speed = lines[ceiling->sourceline].args[2] << (FRACBITS - 2); if (ceiling->type == crushCeilOnce || ceiling->type == crushBothOnce) @@ -367,12 +184,8 @@ void T_CrushCeiling(ceiling_t *ceiling) ceiling->sector->soundorg.z = ceiling->sector->floorheight; S_StartSound(mp,sfx_pstop); - if (lines[ceiling->sourceline].flags & ML_EFFECT4) - ceiling->speed = ceiling->oldspeed; - else - ceiling->speed = ceiling->oldspeed/2; - ceiling->direction = 1; + ceiling->speed = lines[ceiling->sourceline].args[3] << (FRACBITS - 2); } break; } @@ -385,18 +198,18 @@ void T_CrushCeiling(ceiling_t *ceiling) /** Starts a ceiling mover. * + * \param tag Tag. * \param line The source line. * \param type The type of ceiling movement. * \return 1 if at least one ceiling mover was started, 0 otherwise. * \sa EV_DoCrush, EV_DoFloor, EV_DoElevator, T_MoveCeiling */ -INT32 EV_DoCeiling(line_t *line, ceiling_e type) +INT32 EV_DoCeiling(mtag_t tag, line_t *line, ceiling_e type) { INT32 rtn = 0, firstone = 1; INT32 secnum = -1; sector_t *sec; ceiling_t *ceiling; - mtag_t tag = Tag_FGet(&line->tags); TAG_ITER_SECTORS(tag, secnum) { @@ -417,44 +230,12 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type) switch (type) { - case fastCrushAndRaise: - ceiling->crush = true; - ceiling->topheight = sec->ceilingheight; - ceiling->bottomheight = sec->floorheight + (8*FRACUNIT); - ceiling->direction = -1; - ceiling->speed = CEILSPEED * 2; - break; - - case crushAndRaise: - ceiling->crush = true; - ceiling->topheight = sec->ceilingheight; - /* FALLTHRU */ - case lowerAndCrush: - ceiling->bottomheight = sec->floorheight; - ceiling->bottomheight += 4*FRACUNIT; - ceiling->direction = -1; - ceiling->speed = line->dx; - break; - case raiseToHighest: ceiling->topheight = P_FindHighestCeilingSurrounding(sec); ceiling->direction = 1; ceiling->speed = CEILSPEED; break; - //SoM: 3/6/2000: Added Boom types - case lowerToLowest: - ceiling->bottomheight = P_FindLowestCeilingSurrounding(sec); - ceiling->direction = -1; - ceiling->speed = CEILSPEED; - break; - - case raiseToLowest: // Graue 09-07-2004 - ceiling->topheight = P_FindLowestCeilingSurrounding(sec) - 4*FRACUNIT; - ceiling->direction = 1; - ceiling->speed = line->dx; // hack - break; - case lowerToLowestFast: ceiling->bottomheight = P_FindLowestCeilingSurrounding(sec); ceiling->direction = -1; @@ -469,8 +250,7 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type) // Linedef executor excellence case moveCeilingByFrontSector: - ceiling->speed = P_AproxDistance(line->dx, line->dy); - ceiling->speed = FixedDiv(ceiling->speed,8*FRACUNIT); + ceiling->speed = line->args[2] << (FRACBITS - 3); if (line->frontsector->ceilingheight >= sec->ceilingheight) // Move up { ceiling->direction = 1; @@ -483,21 +263,13 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type) } // chained linedef executing ability - if (line->flags & ML_BLOCKMONSTERS) - { - // only set it on ONE of the moving sectors (the smallest numbered) - // and front side x offset must be positive - if (firstone && sides[line->sidenum[0]].textureoffset > 0) - ceiling->texture = (sides[line->sidenum[0]].textureoffset>>FRACBITS) - 32769; - else - ceiling->texture = -1; - } + // only set it on ONE of the moving sectors (the smallest numbered) + // only set it if there isn't also a floor mover + if (line->args[3] && line->args[1] == 1) + ceiling->tag = firstone ? (INT16)line->args[3] : 0; // flat changing ability - else if (line->flags & ML_NOCLIMB) - ceiling->texture = line->frontsector->ceilingpic; - else - ceiling->texture = -1; + ceiling->texture = line->args[4] ? line->frontsector->ceilingpic : -1; break; // More linedef executor junk @@ -514,67 +286,30 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type) ceiling->direction = -1; ceiling->bottomheight = line->frontsector->ceilingheight; } - if (line->flags & ML_NOCLIMB) - ceiling->texture = -1; - else - ceiling->texture = line->frontsector->ceilingpic; + + // If flag is set, change ceiling texture after moving + ceiling->texture = line->args[2] ? line->frontsector->ceilingpic : -1; break; - case moveCeilingByFrontTexture: - if (line->flags & ML_NOCLIMB) + case moveCeilingByDistance: + if (line->args[4]) ceiling->speed = INT32_MAX/2; // as above, "instant" is one tic else - ceiling->speed = FixedDiv(sides[line->sidenum[0]].textureoffset,8*FRACUNIT); // texture x offset - if (sides[line->sidenum[0]].rowoffset > 0) + ceiling->speed = line->args[3] << (FRACBITS - 3); + if (line->args[2] > 0) { ceiling->direction = 1; // up - ceiling->topheight = sec->ceilingheight + sides[line->sidenum[0]].rowoffset; // texture y offset + ceiling->topheight = sec->ceilingheight + (line->args[2] << FRACBITS); } else { ceiling->direction = -1; // down - ceiling->bottomheight = sec->ceilingheight + sides[line->sidenum[0]].rowoffset; // texture y offset + ceiling->bottomheight = sec->ceilingheight + (line->args[2] << FRACBITS); } break; -/* - case lowerCeilingByLine: - ceiling->speed = FixedDiv(abs(line->dx),8*FRACUNIT); - ceiling->direction = -1; // Move down - ceiling->bottomheight = sec->ceilingheight - abs(line->dy); - break; - - case raiseCeilingByLine: - ceiling->speed = FixedDiv(abs(line->dx),8*FRACUNIT); - ceiling->direction = 1; // Move up - ceiling->topheight = sec->ceilingheight + abs(line->dy); - break; -*/ - case bounceCeiling: - ceiling->speed = P_AproxDistance(line->dx, line->dy); // same speed as elevateContinuous - ceiling->speed = FixedDiv(ceiling->speed,4*FRACUNIT); - ceiling->origspeed = ceiling->speed; - if (line->frontsector->ceilingheight >= sec->ceilingheight) // Move up - { - ceiling->direction = 1; - ceiling->topheight = line->frontsector->ceilingheight; - } - else // Move down - { - ceiling->direction = -1; - ceiling->bottomheight = line->frontsector->ceilingheight; - } - - // Any delay? - ceiling->delay = sides[line->sidenum[0]].textureoffset >> FRACBITS; - ceiling->delaytimer = sides[line->sidenum[0]].rowoffset >> FRACBITS; // Initial delay - - ceiling->texture = (fixed_t)(line - lines); // hack: use texture to store sourceline number - break; - case bounceCeilingCrush: - ceiling->speed = abs(line->dx); // same speed as elevateContinuous - ceiling->speed = FixedDiv(ceiling->speed,4*FRACUNIT); + ceiling->speed = line->args[2] << (FRACBITS - 2); // same speed as elevateContinuous ceiling->origspeed = ceiling->speed; if (line->frontsector->ceilingheight >= sec->ceilingheight) // Move up { @@ -588,10 +323,8 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type) } // Any delay? - ceiling->delay = sides[line->sidenum[0]].textureoffset >> FRACBITS; - ceiling->delaytimer = sides[line->sidenum[0]].rowoffset >> FRACBITS; // Initial delay - - ceiling->texture = (fixed_t)(line - lines); // hack: use texture to store sourceline number + ceiling->delay = line->args[5]; + ceiling->delaytimer = line->args[4]; // Initial delay break; default: @@ -599,7 +332,6 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type) } - ceiling->tag = tag; ceiling->type = type; firstone = 0; } @@ -608,19 +340,19 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type) /** Starts a ceiling crusher. * + * \param tag Tag. * \param line The source line. * \param type The type of ceiling, either ::crushAndRaise or * ::fastCrushAndRaise. * \return 1 if at least one crusher was started, 0 otherwise. * \sa EV_DoCeiling, EV_DoFloor, EV_DoElevator, T_CrushCeiling */ -INT32 EV_DoCrush(line_t *line, ceiling_e type) +INT32 EV_DoCrush(mtag_t tag, line_t *line, ceiling_e type) { INT32 rtn = 0; INT32 secnum = -1; sector_t *sec; ceiling_t *ceiling; - mtag_t tag = Tag_FGet(&line->tags); TAG_ITER_SECTORS(tag, secnum) { @@ -638,46 +370,33 @@ INT32 EV_DoCrush(line_t *line, ceiling_e type) ceiling->sector = sec; ceiling->crush = true; ceiling->sourceline = (INT32)(line-lines); - - if (line->flags & ML_EFFECT4) - ceiling->oldspeed = FixedDiv(abs(line->dx),4*FRACUNIT); - else - ceiling->oldspeed = (R_PointToDist2(line->v2->x, line->v2->y, line->v1->x, line->v1->y)/16); + ceiling->speed = ceiling->origspeed = line->args[2] << (FRACBITS - 2); switch(type) { - case fastCrushAndRaise: // Up and then down + case raiseAndCrush: // Up and then down ceiling->topheight = P_FindHighestCeilingSurrounding(sec); ceiling->direction = 1; - ceiling->speed = ceiling->oldspeed; + // Retain stupid behavior for backwards compatibility + if (!udmf && !(line->flags & ML_MIDSOLID)) + ceiling->speed /= 2; + else + ceiling->speed = line->args[3] << (FRACBITS - 2); ceiling->bottomheight = sec->floorheight + FRACUNIT; break; case crushBothOnce: ceiling->topheight = sec->ceilingheight; ceiling->bottomheight = sec->floorheight + (sec->ceilingheight-sec->floorheight)/2; ceiling->direction = -1; - - if (line->flags & ML_EFFECT4) - ceiling->speed = ceiling->oldspeed; - else - ceiling->speed = ceiling->oldspeed*2; - break; case crushCeilOnce: default: // Down and then up. ceiling->topheight = sec->ceilingheight; ceiling->direction = -1; - - if (line->flags & ML_EFFECT4) - ceiling->speed = ceiling->oldspeed; - else - ceiling->speed = ceiling->oldspeed*2; - ceiling->bottomheight = sec->floorheight + FRACUNIT; break; } - ceiling->tag = tag; ceiling->type = type; } return rtn; diff --git a/src/p_enemy.c b/src/p_enemy.c index 87aa5ff2f..cd381e712 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -12,6 +12,7 @@ /// \brief Enemy thinking, AI /// Action Pointer Functions that are associated with states/frames +#include "dehacked.h" #include "doomdef.h" #include "g_game.h" #include "p_local.h" @@ -174,6 +175,7 @@ void A_Boss3TakeDamage(mobj_t *actor); void A_Boss3Path(mobj_t *actor); void A_Boss3ShockThink(mobj_t *actor); void A_LinedefExecute(mobj_t *actor); +void A_LinedefExecuteFromArg(mobj_t *actor); void A_PlaySeeSound(mobj_t *actor); void A_PlayAttackSound(mobj_t *actor); void A_PlayActiveSound(mobj_t *actor); @@ -3709,8 +3711,8 @@ void A_MonitorPop(mobj_t *actor) // Run a linedef executor immediately upon popping // You may want to delay your effects by 18 tics to sync with the reward giving - if (actor->spawnpoint && actor->lastlook) - P_LinedefExecute(actor->lastlook, actor->target, NULL); + if (actor->spawnpoint && actor->spawnpoint->args[0]) + P_LinedefExecute(actor->spawnpoint->args[0], actor->target, NULL); } // Function: A_GoldMonitorPop @@ -3795,8 +3797,8 @@ void A_GoldMonitorPop(mobj_t *actor) // Run a linedef executor immediately upon popping // You may want to delay your effects by 18 tics to sync with the reward giving - if (actor->spawnpoint && actor->lastlook) - P_LinedefExecute(actor->lastlook, actor->target, NULL); + if (actor->spawnpoint && actor->spawnpoint->args[0]) + P_LinedefExecute(actor->spawnpoint->args[0], actor->target, NULL); } // Function: A_GoldMonitorRestore @@ -3854,58 +3856,61 @@ void A_Explode(mobj_t *actor) P_RadiusAttack(actor, actor->target, actor->info->damage, locvar1, true); } -// Function: A_BossDeath -// -// Description: Possibly trigger special effects when boss dies. -// -// var1 = unused -// var2 = unused -// -void A_BossDeath(mobj_t *mo) +static mobj_t *P_FindBossFlyPoint(mobj_t *mo, INT32 tag) +{ + INT32 i; + mobj_t *closest = NULL; + + TAG_ITER_THINGS(tag, i) + { + mobj_t *mo2 = mapthings[i].mobj; + + if (!mo2) + continue; + + if (mo2->type != MT_BOSSFLYPOINT) + continue; + + // If this one's further than the last one, don't go for it. + if (closest && + P_AproxDistance(P_AproxDistance(mo->x - mo2->x, mo->y - mo2->y), mo->z - mo2->z) > + P_AproxDistance(P_AproxDistance(mo->x - closest->x, mo->y - closest->y), mo->z - closest->z)) + continue; + + closest = mo2; + } + + return closest; +} + +static void P_DoBossVictory(mobj_t *mo) { thinker_t *th; mobj_t *mo2; - line_t junk; INT32 i; - if (LUA_CallAction(A_BOSSDEATH, mo)) - return; - - if (mo->spawnpoint && mo->spawnpoint->extrainfo) - P_LinedefExecute(LE_BOSSDEAD+(mo->spawnpoint->extrainfo*LE_PARAMWIDTH), mo, NULL); - else - P_LinedefExecute(LE_BOSSDEAD, mo, NULL); - mo->health = 0; - - // Boss is dead (but not necessarily fleeing...) - // Lua may use this to ignore bosses after they start fleeing - mo->flags2 |= MF2_BOSSDEAD; - - // make sure there is a player alive for victory - for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i] && ((players[i].mo && players[i].mo->health) - || ((netgame || multiplayer) && (players[i].lives || players[i].continues)))) - break; - - if (i == MAXPLAYERS) - return; // no one left alive, so do not end game - - // scan the remaining thinkers to see - // if all bosses are dead + // scan the remaining thinkers to see if all bosses are dead for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) continue; mo2 = (mobj_t *)th; - if (mo2 != mo && (mo2->flags & MF_BOSS) && mo2->health > 0) - goto bossjustdie; // other boss not dead - just go straight to dying! + + if (mo2 == mo) + continue; + + if ((mo2->flags & MF_BOSS) && mo2->health > 0) + return; } // victory! - P_LinedefExecute(LE_ALLBOSSESDEAD, mo, NULL); + if (mo->spawnpoint) + P_LinedefExecute(mo->spawnpoint->args[3], mo, NULL); + if (stoppedclock && modeattacking) // if you're just time attacking, skip making the capsule appear since you don't need to step on it anyways. - goto bossjustdie; + return; + if (mo->flags2 & MF2_BOSSNOTRAP) { for (i = 0; i < MAXPLAYERS; i++) @@ -3917,18 +3922,14 @@ void A_BossDeath(mobj_t *mo) } else { - // Initialize my junk - junk.tags.tags = NULL; - junk.tags.count = 0; - - // Bring the egg trap up to the surface - // Incredibly shitty code ahead - Tag_FSet(&junk.tags, LE_CAPSULE0); - EV_DoElevator(&junk, elevateHighest, false); - Tag_FSet(&junk.tags, LE_CAPSULE1); - EV_DoElevator(&junk, elevateUp, false); - Tag_FSet(&junk.tags, LE_CAPSULE2); - EV_DoElevator(&junk, elevateHighest, false); + if (!udmf) + { + // Bring the egg trap up to the surface + // Incredibly shitty code ahead + EV_DoElevator(LE_CAPSULE0, NULL, elevateHighest); + EV_DoElevator(LE_CAPSULE1, NULL, elevateUp); + EV_DoElevator(LE_CAPSULE2, NULL, elevateHighest); + } if (mapheaderinfo[gamemap-1]->muspostbossname[0] && S_MusicExists(mapheaderinfo[gamemap-1]->muspostbossname, !midi_disabled, !digital_disabled)) @@ -3952,8 +3953,196 @@ void A_BossDeath(mobj_t *mo) mapheaderinfo[gamemap-1]->muspostbossfadein); } } +} + +static void P_SpawnBoss1Junk(mobj_t *mo) +{ + mobj_t *mo2 = P_SpawnMobjFromMobj(mo, + P_ReturnThrustX(mo, mo->angle - ANGLE_90, 32<angle - ANGLE_90, 32<angle = mo->angle; + P_InstaThrust(mo2, mo2->angle - ANGLE_90, 4*mo2->scale); + P_SetObjectMomZ(mo2, 4*FRACUNIT, false); + P_SetMobjState(mo2, S_BOSSEGLZ1); + + mo2 = P_SpawnMobjFromMobj(mo, + P_ReturnThrustX(mo, mo->angle + ANGLE_90, 32<angle + ANGLE_90, 32<angle = mo->angle; + P_InstaThrust(mo2, mo2->angle + ANGLE_90, 4*mo2->scale); + P_SetObjectMomZ(mo2, 4*FRACUNIT, false); + P_SetMobjState(mo2, S_BOSSEGLZ2); +} + +static void P_SpawnBoss2Junk(mobj_t *mo) +{ + mobj_t *mo2 = P_SpawnMobjFromMobj(mo, + P_ReturnThrustX(mo, mo->angle - ANGLE_90, 32<angle - ANGLE_90, 32<angle = mo->angle; + P_InstaThrust(mo2, mo2->angle - ANGLE_90, 4*mo2->scale); + P_SetObjectMomZ(mo2, 4*FRACUNIT, false); + P_SetMobjState(mo2, S_BOSSTANK1); + + mo2 = P_SpawnMobjFromMobj(mo, + P_ReturnThrustX(mo, mo->angle + ANGLE_90, 32<angle + ANGLE_90, 32<angle = mo->angle; + P_InstaThrust(mo2, mo2->angle + ANGLE_90, 4*mo2->scale); + P_SetObjectMomZ(mo2, 4*FRACUNIT, false); + P_SetMobjState(mo2, S_BOSSTANK2); + + mo2 = P_SpawnMobjFromMobj(mo, 0, 0, + mobjinfo[MT_EGGMOBILE2].height + (32<angle = mo->angle; + P_SetObjectMomZ(mo2, 4*FRACUNIT, false); + mo2->momz += mo->momz; + P_SetMobjState(mo2, S_BOSSSPIGOT); +} + +static void P_SpawnBoss3Junk(mobj_t *mo) +{ + mobj_t *mo2 = P_SpawnMobjFromMobj(mo, 0, 0, 0, MT_BOSSJUNK); + mo2->angle = mo->angle; + P_SetMobjState(mo2, S_BOSSSEBH1); +} + +static void P_DoCybrakdemonDeath(mobj_t *mo) +{ + mo->flags |= MF_NOCLIP; + mo->flags &= ~(MF_SPECIAL|MF_NOGRAVITY|MF_NOCLIPHEIGHT); + + S_StartSound(NULL, sfx_bedie2); + P_SpawnMobjFromMobj(mo, 0, 0, 0, MT_CYBRAKDEMON_VILE_EXPLOSION); + mo->z += P_MobjFlip(mo); + P_SetObjectMomZ(mo, 12*FRACUNIT, false); + S_StartSound(mo, sfx_bgxpld); + if (mo->spawnpoint && !(mo->spawnpoint->args[6] & TMB_NODEATHFLING)) + P_InstaThrust(mo, R_PointToAngle2(0, 0, mo->x, mo->y), 14*FRACUNIT); +} + +static void P_DoBoss5Death(mobj_t *mo) +{ + if (mo->flags2 & MF2_SLIDEPUSH) + { + P_RemoveMobj(mo); + return; + } + if (mo->tracer) + { + var1 = var2 = 0; + A_Boss5Jump(mo); + mo->momx = ((16 - 1)*mo->momx)/16; + mo->momy = ((16 - 1)*mo->momy)/16; + { + const fixed_t time = FixedHypot(mo->tracer->x - mo->x, mo->tracer->y - mo->y)/FixedHypot(mo->momx, mo->momy); + const fixed_t speed = 64*FRACUNIT; + mobj_t *pole = P_SpawnMobj( + mo->tracer->x - P_ReturnThrustX(mo->tracer, mo->tracer->angle, speed*time), + mo->tracer->y - P_ReturnThrustY(mo->tracer, mo->tracer->angle, speed*time), + mo->tracer->floorz + (256+1)*FRACUNIT, + MT_FSGNB); + P_SetTarget(&pole->tracer, P_SpawnMobj( + pole->x, pole->y, + pole->z - 256*FRACUNIT, + MT_FSGNB)); + P_SetTarget(&pole->tracer->tracer, P_SpawnMobj( + pole->x + P_ReturnThrustX(pole, mo->tracer->angle, FRACUNIT), + pole->y + P_ReturnThrustY(pole, mo->tracer->angle, FRACUNIT), + pole->z + 256*FRACUNIT, + MT_FSGNA)); + pole->tracer->flags |= MF_NOCLIPTHING; + P_SetScale(pole, (pole->destscale = 2*FRACUNIT)); + P_SetScale(pole->tracer, (pole->tracer->destscale = 2*FRACUNIT)); + pole->angle = pole->tracer->angle = mo->tracer->angle; + pole->tracer->tracer->angle = pole->angle - ANGLE_90; + pole->momx = P_ReturnThrustX(pole, pole->angle, speed); + pole->momy = P_ReturnThrustY(pole, pole->angle, speed); + pole->tracer->momx = pole->momx; + pole->tracer->momy = pole->momy; + pole->tracer->tracer->momx = pole->momx; + pole->tracer->tracer->momy = pole->momy; + } + } + else + { + P_SetObjectMomZ(mo, 10*FRACUNIT, false); + mo->flags |= MF_NOGRAVITY; + } + mo->flags |= MF_NOCLIP|MF_NOCLIPHEIGHT; +} + +static void P_DoBossDefaultDeath(mobj_t *mo) +{ + INT32 bossid = (mo->spawnpoint ? mo->spawnpoint->args[0] : 0); + + // Stop exploding and prepare to run. + P_SetMobjState(mo, mo->info->xdeathstate); + if (P_MobjWasRemoved(mo)) + return; + + P_SetTarget(&mo->target, P_FindBossFlyPoint(mo, bossid)); + + mo->flags |= MF_NOGRAVITY|MF_NOCLIP; + mo->flags |= MF_NOCLIPHEIGHT; + + mo->movedir = 0; + mo->extravalue1 = 35; + mo->flags2 |= MF2_BOSSFLEE; + mo->momz = P_MobjFlip(mo)*2*mo->scale; + + if (mo->target) + { + angle_t diff = R_PointToAngle2(mo->x, mo->y, mo->target->x, mo->target->y) - mo->angle; + if (diff) + { + if (diff > ANGLE_180) + diff = InvAngle(InvAngle(diff)/mo->extravalue1); + else + diff /= mo->extravalue1; + mo->movedir = diff; + } + } +} + +// Function: A_BossDeath +// +// Description: Possibly trigger special effects when boss dies. +// +// var1 = unused +// var2 = unused +// +void A_BossDeath(mobj_t *mo) +{ + INT32 i; + + if (LUA_CallAction(A_BOSSDEATH, mo)) + return; + + if (mo->spawnpoint) + P_LinedefExecute(mo->spawnpoint->args[2], mo, NULL); + mo->health = 0; + + // Boss is dead (but not necessarily fleeing...) + // Lua may use this to ignore bosses after they start fleeing + mo->flags2 |= MF2_BOSSDEAD; + + // make sure there is a player alive for victory + for (i = 0; i < MAXPLAYERS; i++) + if (playeringame[i] && ((players[i].mo && players[i].mo->health) + || ((netgame || multiplayer) && (players[i].lives || players[i].continues)))) + break; + + if (i == MAXPLAYERS) + return; // no one left alive, so do not end game + + P_DoBossVictory(mo); -bossjustdie: if (LUA_HookMobj(mo, MOBJ_HOOK(BossDeath))) return; else if (P_MobjWasRemoved(mo)) @@ -3965,61 +4154,13 @@ bossjustdie: default: break; case MT_EGGMOBILE: // twin laser pods - { - mo2 = P_SpawnMobjFromMobj(mo, - P_ReturnThrustX(mo, mo->angle - ANGLE_90, 32<angle - ANGLE_90, 32<angle = mo->angle; - P_InstaThrust(mo2, mo2->angle - ANGLE_90, 4*mo2->scale); - P_SetObjectMomZ(mo2, 4*FRACUNIT, false); - P_SetMobjState(mo2, S_BOSSEGLZ1); - - mo2 = P_SpawnMobjFromMobj(mo, - P_ReturnThrustX(mo, mo->angle + ANGLE_90, 32<angle + ANGLE_90, 32<angle = mo->angle; - P_InstaThrust(mo2, mo2->angle + ANGLE_90, 4*mo2->scale); - P_SetObjectMomZ(mo2, 4*FRACUNIT, false); - P_SetMobjState(mo2, S_BOSSEGLZ2); - } + P_SpawnBoss1Junk(mo); break; case MT_EGGMOBILE2: // twin tanks + spigot - { - mo2 = P_SpawnMobjFromMobj(mo, - P_ReturnThrustX(mo, mo->angle - ANGLE_90, 32<angle - ANGLE_90, 32<angle = mo->angle; - P_InstaThrust(mo2, mo2->angle - ANGLE_90, 4*mo2->scale); - P_SetObjectMomZ(mo2, 4*FRACUNIT, false); - P_SetMobjState(mo2, S_BOSSTANK1); - - mo2 = P_SpawnMobjFromMobj(mo, - P_ReturnThrustX(mo, mo->angle + ANGLE_90, 32<angle + ANGLE_90, 32<angle = mo->angle; - P_InstaThrust(mo2, mo2->angle + ANGLE_90, 4*mo2->scale); - P_SetObjectMomZ(mo2, 4*FRACUNIT, false); - P_SetMobjState(mo2, S_BOSSTANK2); - - mo2 = P_SpawnMobjFromMobj(mo, 0, 0, - mobjinfo[MT_EGGMOBILE2].height + (32<angle = mo->angle; - P_SetObjectMomZ(mo2, 4*FRACUNIT, false); - mo2->momz += mo->momz; - P_SetMobjState(mo2, S_BOSSSPIGOT); - } + P_SpawnBoss2Junk(mo); break; case MT_EGGMOBILE3: - { - mo2 = P_SpawnMobjFromMobj(mo, 0, 0, 0, MT_BOSSJUNK); - mo2->angle = mo->angle; - P_SetMobjState(mo2, S_BOSSSEBH1); - } + P_SpawnBoss3Junk(mo); break; } @@ -4027,147 +4168,20 @@ bossjustdie: switch (mo->type) { case MT_BLACKEGGMAN: - { mo->flags |= MF_NOCLIP; mo->flags &= ~MF_SPECIAL; S_StartSound(NULL, sfx_befall); break; - } case MT_CYBRAKDEMON: - { - mo->flags |= MF_NOCLIP; - mo->flags &= ~(MF_SPECIAL|MF_NOGRAVITY|MF_NOCLIPHEIGHT); - - S_StartSound(NULL, sfx_bedie2); - P_SpawnMobjFromMobj(mo, 0, 0, 0, MT_CYBRAKDEMON_VILE_EXPLOSION); - mo->z += P_MobjFlip(mo); - P_SetObjectMomZ(mo, 12*FRACUNIT, false); - S_StartSound(mo, sfx_bgxpld); - if (mo->spawnpoint && !(mo->spawnpoint->options & MTF_EXTRA)) - P_InstaThrust(mo, R_PointToAngle2(0, 0, mo->x, mo->y), 14*FRACUNIT); + P_DoCybrakdemonDeath(mo); break; - } - case MT_KOOPA: - { - // Initialize my junk - junk.tags.tags = NULL; - junk.tags.count = 0; - - Tag_FSet(&junk.tags, LE_KOOPA); - EV_DoCeiling(&junk, raiseToHighest); - return; - } case MT_FANG: - { - if (mo->flags2 & MF2_SLIDEPUSH) - { - P_RemoveMobj(mo); - return; - } - if (mo->tracer) - { - var1 = var2 = 0; - A_Boss5Jump(mo); - mo->momx = ((16 - 1)*mo->momx)/16; - mo->momy = ((16 - 1)*mo->momy)/16; - { - const fixed_t time = FixedHypot(mo->tracer->x - mo->x, mo->tracer->y - mo->y)/FixedHypot(mo->momx, mo->momy); - const fixed_t speed = 64*FRACUNIT; - mobj_t *pole = P_SpawnMobj( - mo->tracer->x - P_ReturnThrustX(mo->tracer, mo->tracer->angle, speed*time), - mo->tracer->y - P_ReturnThrustY(mo->tracer, mo->tracer->angle, speed*time), - mo->tracer->floorz + (256+1)*FRACUNIT, - MT_FSGNB); - P_SetTarget(&pole->tracer, P_SpawnMobj( - pole->x, pole->y, - pole->z - 256*FRACUNIT, - MT_FSGNB)); - P_SetTarget(&pole->tracer->tracer, P_SpawnMobj( - pole->x + P_ReturnThrustX(pole, mo->tracer->angle, FRACUNIT), - pole->y + P_ReturnThrustY(pole, mo->tracer->angle, FRACUNIT), - pole->z + 256*FRACUNIT, - MT_FSGNA)); - pole->tracer->flags |= MF_NOCLIPTHING; - P_SetScale(pole, (pole->destscale = 2*FRACUNIT)); - P_SetScale(pole->tracer, (pole->tracer->destscale = 2*FRACUNIT)); - pole->angle = pole->tracer->angle = mo->tracer->angle; - pole->tracer->tracer->angle = pole->angle - ANGLE_90; - pole->momx = P_ReturnThrustX(pole, pole->angle, speed); - pole->momy = P_ReturnThrustY(pole, pole->angle, speed); - pole->tracer->momx = pole->momx; - pole->tracer->momy = pole->momy; - pole->tracer->tracer->momx = pole->momx; - pole->tracer->tracer->momy = pole->momy; - } - } - else - { - P_SetObjectMomZ(mo, 10*FRACUNIT, false); - mo->flags |= MF_NOGRAVITY; - } - mo->flags |= MF_NOCLIP|MF_NOCLIPHEIGHT; - return; - } - default: //eggmobiles - { - UINT8 extrainfo = (mo->spawnpoint ? mo->spawnpoint->extrainfo : 0); - - // Stop exploding and prepare to run. - P_SetMobjState(mo, mo->info->xdeathstate); - if (P_MobjWasRemoved(mo)) - return; - - P_SetTarget(&mo->target, NULL); - - // Flee! Flee! Find a point to escape to! If none, just shoot upward! - // scan the thinkers to find the runaway point - for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) - { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) - continue; - - mo2 = (mobj_t *)th; - - if (mo2->type != MT_BOSSFLYPOINT) - continue; - - if (mo2->spawnpoint && mo2->spawnpoint->extrainfo != extrainfo) - continue; - - // If this one's further then the last one, don't go for it. - if (mo->target && - P_AproxDistance(P_AproxDistance(mo->x - mo2->x, mo->y - mo2->y), mo->z - mo2->z) > - P_AproxDistance(P_AproxDistance(mo->x - mo->target->x, mo->y - mo->target->y), mo->z - mo->target->z)) - continue; - - // Otherwise... Do! - P_SetTarget(&mo->target, mo2); - } - - mo->flags |= MF_NOGRAVITY|MF_NOCLIP; - mo->flags |= MF_NOCLIPHEIGHT; - - mo->movedir = 0; - mo->extravalue1 = 35; - mo->flags2 |= MF2_BOSSFLEE; - mo->momz = P_MobjFlip(mo)*2*mo->scale; - - if (mo->target) - { - angle_t diff = R_PointToAngle2(mo->x, mo->y, mo->target->x, mo->target->y) - mo->angle; - if (diff) - { - if (diff > ANGLE_180) - diff = InvAngle(InvAngle(diff)/mo->extravalue1); - else - diff /= mo->extravalue1; - mo->movedir = diff; - } - } - + P_DoBoss5Death(mo); + break; + default: //eggmobiles + P_DoBossDefaultDeath(mo); break; - } } } @@ -4836,12 +4850,16 @@ void A_FishJump(mobj_t *actor) fixed_t jumpval; if (locvar1) - jumpval = var1; + jumpval = locvar1; else - jumpval = FixedMul(AngleFixed(actor->angle)/4, actor->scale); + { + if (actor->spawnpoint && actor->spawnpoint->args[0]) + jumpval = actor->spawnpoint->args[0]; + else + jumpval = 44; + } - if (!jumpval) jumpval = FixedMul(44*(FRACUNIT/4), actor->scale); - actor->momz = jumpval; + actor->momz = FixedMul(jumpval << (FRACBITS - 2), actor->scale); P_SetMobjStateNF(actor, actor->info->seestate); } @@ -6218,48 +6236,34 @@ void A_RockSpawn(mobj_t *actor) { mobj_t *mo; mobjtype_t type; - INT32 i = Tag_FindLineSpecial(12, (INT16)actor->threshold); - line_t *line; fixed_t dist; - fixed_t randomoomph; if (LUA_CallAction(A_ROCKSPAWN, actor)) return; - if (i == -1) + if (!actor->spawnpoint) + return; + + type = actor->spawnpoint->stringargs[0] ? get_number(actor->spawnpoint->stringargs[0]) : MT_ROCKCRUMBLE1; + + if (type < MT_NULL || type >= NUMMOBJTYPES) { - CONS_Debug(DBG_GAMELOGIC, "A_RockSpawn: Unable to find parameter line 12 (tag %d)!\n", actor->threshold); + CONS_Debug(DBG_GAMELOGIC, "A_RockSpawn: Invalid mobj type %s!\n", actor->spawnpoint->stringargs[0]); return; } - line = &lines[i]; - - if (!(sides[line->sidenum[0]].textureoffset >> FRACBITS)) - { - CONS_Debug(DBG_GAMELOGIC, "A_RockSpawn: No X-offset detected! (tag %d)!\n", actor->threshold); - return; - } - - dist = P_AproxDistance(line->dx, line->dy)/16; - - if (dist < 1) - dist = 1; - - type = MT_ROCKCRUMBLE1 + (sides[line->sidenum[0]].rowoffset >> FRACBITS); - - if (line->flags & ML_NOCLIMB) - randomoomph = P_RandomByte() * (FRACUNIT/32); - else - randomoomph = 0; + dist = max(actor->spawnpoint->args[0] << (FRACBITS - 4), 1); + if (actor->spawnpoint->args[2]) + dist += actor->spawnpoint->args[2] ? P_RandomByte() * (FRACUNIT/32) : 0; // random oomph mo = P_SpawnMobj(actor->x, actor->y, actor->z, MT_FALLINGROCK); P_SetMobjState(mo, mobjinfo[type].spawnstate); - mo->angle = R_PointToAngle2(line->v2->x, line->v2->y, line->v1->x, line->v1->y); + mo->angle = FixedAngle(actor->spawnpoint->angle << FRACBITS); - P_InstaThrust(mo, mo->angle, dist + randomoomph); - mo->momz = dist + randomoomph; + P_InstaThrust(mo, mo->angle, dist); + mo->momz = dist; - var1 = sides[line->sidenum[0]].textureoffset >> FRACBITS; + var1 = actor->spawnpoint->args[1]; A_SetTics(actor); } @@ -7093,10 +7097,8 @@ void A_Boss1Chase(mobj_t *actor) } else { - if (actor->spawnpoint && actor->spawnpoint->extrainfo) - P_LinedefExecute(LE_PINCHPHASE+(actor->spawnpoint->extrainfo*LE_PARAMWIDTH), actor, NULL); - else - P_LinedefExecute(LE_PINCHPHASE, actor, NULL); + if (actor->spawnpoint) + P_LinedefExecute(actor->spawnpoint->args[4], actor, NULL); P_SetMobjState(actor, actor->info->raisestate); } @@ -7220,7 +7222,7 @@ void A_Boss2Chase(mobj_t *actor) } else { - // Only speed up if you have the 'Deaf' flag. + // Only speed up if you have the ambush flag. if (actor->flags2 & MF2_AMBUSH) speedvar = actor->health; else @@ -7933,12 +7935,21 @@ void A_GuardChase(mobj_t *actor) false) && speed > 0) // can't be the same check as previous so that P_TryMove gets to happen. { - if (actor->spawnpoint && ((actor->spawnpoint->options & (MTF_EXTRA|MTF_OBJECTSPECIAL)) == MTF_OBJECTSPECIAL)) - actor->angle += ANGLE_90; - else if (actor->spawnpoint && ((actor->spawnpoint->options & (MTF_EXTRA|MTF_OBJECTSPECIAL)) == MTF_EXTRA)) - actor->angle -= ANGLE_90; - else - actor->angle += ANGLE_180; + INT32 direction = actor->spawnpoint ? actor->spawnpoint->args[0] : TMGD_BACK; + + switch (direction) + { + case TMGD_BACK: + default: + actor->angle += ANGLE_180; + break; + case TMGD_RIGHT: + actor->angle -= ANGLE_90; + break; + case TMGD_LEFT: + actor->angle += ANGLE_90; + break; + } } if (actor->extravalue1 < actor->info->speed) @@ -8138,10 +8149,6 @@ void A_Boss3TakeDamage(mobj_t *actor) actor->movecount = var1; actor->movefactor = -512*FRACUNIT; - - /*if (actor->target && actor->target->spawnpoint) - actor->threshold = actor->target->spawnpoint->extrainfo;*/ - } // Function: A_Boss3Path @@ -8181,27 +8188,21 @@ void A_Boss3Path(mobj_t *actor) if (!(actor->flags2 & MF2_STRONGBOX)) { - thinker_t *th; mobj_t *mo2; + INT32 i; P_SetTarget(&actor->target, NULL); - // scan the thinkers - // to find a point that matches - // the number - for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) + // Find waypoint + TAG_ITER_THINGS(actor->cusval, i) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) - continue; + mo2 = mapthings[i].mobj; - mo2 = (mobj_t *)th; + if (!mo2) + continue; if (mo2->type != MT_BOSS3WAYPOINT) continue; - if (!mo2->spawnpoint) - continue; - if (mo2->spawnpoint->angle != actor->threshold) - continue; - if (mo2->spawnpoint->extrainfo != actor->cusval) + if (mapthings[i].args[0] != actor->threshold) continue; P_SetTarget(&actor->target, mo2); @@ -8347,8 +8348,6 @@ void A_LinedefExecute(mobj_t *actor) if (locvar2) tagnum += locvar2*(AngleFixed(actor->angle)>>FRACBITS); - else if (actor->spawnpoint && actor->spawnpoint->extrainfo) - tagnum += (actor->spawnpoint->extrainfo*LE_PARAMWIDTH); CONS_Debug(DBG_GAMELOGIC, "A_LinedefExecute: Running mobjtype %d's sector with tag %d\n", actor->type, tagnum); @@ -8356,6 +8355,38 @@ void A_LinedefExecute(mobj_t *actor) P_LinedefExecute((INT16)tagnum, actor, actor->subsector->sector); } +// Function: A_LinedefExecuteFromArg +// +// Description: Object's location is used to set the calling sector. The tag used is the spawnpoint mapthing's args[var1]. +// +// var1 = mapthing arg to take tag from +// var2 = unused +// +void A_LinedefExecuteFromArg(mobj_t *actor) +{ + INT32 tagnum; + INT32 locvar1 = var1; + + if (LUA_CallAction(A_LINEDEFEXECUTEFROMARG, actor)) + return; + + if (!actor->spawnpoint) + return; + + if (locvar1 < 0 || locvar1 > NUMMAPTHINGARGS) + { + CONS_Debug(DBG_GAMELOGIC, "A_LinedefExecuteFromArg: Invalid mapthing arg %d\n", locvar1); + return; + } + + tagnum = actor->spawnpoint->args[locvar1]; + + CONS_Debug(DBG_GAMELOGIC, "A_LinedefExecuteFromArg: Running mobjtype %d's sector with tag %d\n", actor->type, tagnum); + + // tag 32768 displayed in map editors is actually tag -32768, tag 32769 is -32767, 65535 is -1 etc. + P_LinedefExecute((INT16)tagnum, actor, actor->subsector->sector); +} + // Function: A_PlaySeeSound // // Description: Plays the object's seesound. @@ -11496,10 +11527,7 @@ void A_BrakLobShot(mobj_t *actor) return; // Don't even bother if we've got nothing to aim at. // Look up actor's current gravity situation - if (actor->subsector->sector->gravity) - g = FixedMul(gravity,(FixedDiv(*actor->subsector->sector->gravity>>FRACBITS, 1000))); - else - g = gravity; + g = FixedMul(gravity, P_GetSectorGravityFactor(actor->subsector->sector)); // Look up distance between actor and its target x = P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y); @@ -11611,10 +11639,7 @@ void A_NapalmScatter(mobj_t *actor) airtime = 16<subsector->sector->gravity) - g = FixedMul(gravity,(FixedDiv(*actor->subsector->sector->gravity>>FRACBITS, 1000))); - else - g = gravity; + g = FixedMul(gravity, P_GetSectorGravityFactor(actor->subsector->sector)); // vy = (g*(airtime-1))/2 vy = FixedMul(g,(airtime-(1<>1; @@ -11737,7 +11762,7 @@ void A_FlickySpawn(mobj_t *actor) } // Internal Flicky color setting -void P_InternalFlickySetColor(mobj_t *actor, UINT8 extrainfo) +void P_InternalFlickySetColor(mobj_t *actor, UINT8 color) { UINT8 flickycolors[] = { SKINCOLOR_RED, @@ -11757,11 +11782,11 @@ void P_InternalFlickySetColor(mobj_t *actor, UINT8 extrainfo) SKINCOLOR_YELLOW, }; - if (extrainfo == 0) + if (color == 0) // until we can customize flicky colors by level header, just stick to SRB2's defaults actor->color = flickycolors[P_RandomKey(2)]; //flickycolors[P_RandomKey(sizeof(flickycolors))]; else - actor->color = flickycolors[min(extrainfo-1, 14)]; // sizeof(flickycolors)-1 + actor->color = flickycolors[min(color-1, 14)]; // sizeof(flickycolors)-1 } // Function: A_FlickyCenter @@ -11771,17 +11796,17 @@ void P_InternalFlickySetColor(mobj_t *actor, UINT8 extrainfo) // var1: // Lower 16 bits = if 0, spawns random flicky based on level header. Else, spawns the designated thing type. // Bits 17-20 = Flicky color, up to 15. Applies to fish. -// Bit 21 = Flag MF_SLIDEME (see below) -// Bit 22 = Flag MF_GRENADEBOUNCE (see below) -// Bit 23 = Flag MF_NOCLIPTHING (see below) +// Bit 21 = Flag TMFF_AIMLESS (see below) +// Bit 22 = Flag TMFF_STATIONARY (see below) +// Bit 23 = Flag TMFF_HOP (see below) // // If actor is placed from a spawnpoint (map Thing), the Thing's properties take precedence. // -// var2 = maximum default distance away from spawn the flickies are allowed to travel. If angle != 0, then that's the radius. +// var2 = maximum default distance away from spawn the flickies are allowed to travel. If args[0] != 0, then that's the radius. // -// If MTF_EXTRA (MF_SLIDEME): is flagged, Flickies move aimlessly. Else, orbit around the target. -// If MTF_OBJECTSPECIAL (MF_GRENADEBOUNCE): Flickies stand in-place without gravity (unless they hop, then gravity is applied.) -// If MTF_AMBUSH (MF_NOCLIPTHING): is flagged, Flickies hop. +// If TMFF_AIMLESS (MF_SLIDEME): is flagged, Flickies move aimlessly. Else, orbit around the target. +// If TMFF_STATIONARY (MF_GRENADEBOUNCE): Flickies stand in-place without gravity (unless they hop, then gravity is applied.) +// If TMFF_HOP (MF_NOCLIPTHING): is flagged, Flickies hop. // void A_FlickyCenter(mobj_t *actor) { @@ -11803,14 +11828,15 @@ void A_FlickyCenter(mobj_t *actor) if (actor->spawnpoint) { actor->flags &= ~(MF_SLIDEME|MF_GRENADEBOUNCE|MF_NOCLIPTHING); - actor->flags |= ( - ((actor->spawnpoint->options & MTF_EXTRA) ? MF_SLIDEME : 0) - | ((actor->spawnpoint->options & MTF_OBJECTSPECIAL) ? MF_GRENADEBOUNCE : 0) - | ((actor->spawnpoint->options & MTF_AMBUSH) ? MF_NOCLIPTHING : 0) - ); - actor->extravalue1 = actor->spawnpoint->angle ? abs(actor->spawnpoint->angle) * FRACUNIT - : locvar2 ? abs(locvar2) : 384 * FRACUNIT; - actor->extravalue2 = actor->spawnpoint->extrainfo; + if (actor->spawnpoint->args[1] & TMFF_AIMLESS) + actor->flags |= MF_SLIDEME; + if (actor->spawnpoint->args[1] & TMFF_STATIONARY) + actor->flags |= MF_GRENADEBOUNCE; + if (actor->spawnpoint->args[1] & TMFF_HOP) + actor->flags |= MF_NOCLIPTHING; + actor->extravalue1 = actor->spawnpoint->args[0] ? abs(actor->spawnpoint->args[0])*FRACUNIT + : locvar2 ? abs(locvar2) : 384*FRACUNIT; + actor->extravalue2 = actor->spawnpoint->args[2]; actor->friction = actor->spawnpoint->x*FRACUNIT; actor->movefactor = actor->spawnpoint->y*FRACUNIT; actor->watertop = actor->spawnpoint->z*FRACUNIT; @@ -11818,11 +11844,12 @@ void A_FlickyCenter(mobj_t *actor) else { actor->flags &= ~(MF_SLIDEME|MF_GRENADEBOUNCE|MF_NOCLIPTHING); - actor->flags |= ( - ((flickyflags & 1) ? MF_SLIDEME : 0) - | ((flickyflags & 2) ? MF_GRENADEBOUNCE : 0) - | ((flickyflags & 4) ? MF_NOCLIPTHING : 0) - ); + if (flickyflags & TMFF_AIMLESS) + actor->flags |= MF_SLIDEME; + if (flickyflags & TMFF_STATIONARY) + actor->flags |= MF_GRENADEBOUNCE; + if (flickyflags & TMFF_HOP) + actor->flags |= MF_NOCLIPTHING; actor->extravalue1 = abs(locvar2); actor->extravalue2 = flickycolor; actor->friction = actor->x; @@ -12322,10 +12349,7 @@ void A_Boss5Jump(mobj_t *actor) return; // Don't even bother if we've got nothing to aim at. // Look up actor's current gravity situation - if (actor->subsector->sector->gravity) - g = FixedMul(gravity,(FixedDiv(*actor->subsector->sector->gravity>>FRACBITS, 1000))); - else - g = gravity; + g = FixedMul(gravity, P_GetSectorGravityFactor(actor->subsector->sector)); // Look up distance between actor and its tracer x = P_AproxDistance(actor->tracer->x - actor->x, actor->tracer->y - actor->y); @@ -12747,67 +12771,43 @@ void A_Boss5FindWaypoint(mobj_t *actor) { INT32 locvar1 = var1; boolean avoidcenter; - UINT32 i; - UINT8 extrainfo = (actor->spawnpoint ? actor->spawnpoint->extrainfo : 0); + INT32 i; + INT32 bossid = (actor->spawnpoint ? actor->spawnpoint->args[0] : 0); if (LUA_CallAction(A_BOSS5FINDWAYPOINT, actor)) return; avoidcenter = !actor->tracer || (actor->health == actor->info->damage+1); - if (locvar1 == 2) // look for the boss waypoint + if (locvar1 == 2) // look for the boss flypoint { - thinker_t *th; - mobj_t *mo2; - P_SetTarget(&actor->tracer, NULL); - // Flee! Flee! Find a point to escape to! If none, just shoot upward! - // scan the thinkers to find the runaway point - for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) - { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) - continue; + P_SetTarget(&actor->tracer, P_FindBossFlyPoint(actor, bossid)); - mo2 = (mobj_t *)th; - - if (mo2->type != MT_BOSSFLYPOINT) - continue; - - if (mo2->spawnpoint && mo2->spawnpoint->extrainfo != extrainfo) - continue; - - // If this one's further then the last one, don't go for it. - if (actor->tracer && - P_AproxDistance(P_AproxDistance(actor->x - mo2->x, actor->y - mo2->y), actor->z - mo2->z) > - P_AproxDistance(P_AproxDistance(actor->x - actor->tracer->x, actor->y - actor->tracer->y), actor->z - actor->tracer->z)) - continue; - - // Otherwise... Do! - P_SetTarget(&actor->tracer, mo2); - } if (!actor->tracer) return; // no boss flypoints found } else if (locvar1 == 1) // always go to ambush-marked waypoint { + boolean found = false; + if (avoidcenter) goto nowaypoints; // if we can't go the center, why on earth are we doing this? - for (i = 0; i < nummapthings; i++) + TAG_ITER_THINGS(bossid, i) { if (!mapthings[i].mobj) continue; if (mapthings[i].mobj->type != MT_FANGWAYPOINT) continue; - if (mapthings[i].extrainfo != extrainfo) - continue; - if (!(mapthings[i].options & MTF_AMBUSH)) + if (!(mapthings[i].args[0])) continue; P_SetTarget(&actor->tracer, mapthings[i].mobj); + found = true; break; } - if (i == nummapthings) + if (!found) goto nowaypoints; } else // locvar1 == 0 @@ -12820,7 +12820,7 @@ void A_Boss5FindWaypoint(mobj_t *actor) actor->z += hackoffset; // first, count how many waypoints we have - for (i = 0; i < nummapthings; i++) + TAG_ITER_THINGS(bossid, i) { if (!mapthings[i].mobj) continue; @@ -12828,9 +12828,7 @@ void A_Boss5FindWaypoint(mobj_t *actor) continue; if (actor->tracer == mapthings[i].mobj) // this was your tracer last time continue; - if (mapthings[i].extrainfo != extrainfo) - continue; - if (mapthings[i].options & MTF_AMBUSH) + if (mapthings[i].args[0]) { if (avoidcenter) continue; @@ -12877,7 +12875,7 @@ void A_Boss5FindWaypoint(mobj_t *actor) numfangwaypoints = 0; // now find them again and add them to the table! - for (i = 0; i < nummapthings; i++) + TAG_ITER_THINGS(bossid, i) { if (!mapthings[i].mobj) continue; @@ -12885,9 +12883,7 @@ void A_Boss5FindWaypoint(mobj_t *actor) continue; if (actor->tracer == mapthings[i].mobj) // this was your tracer last time continue; - if (mapthings[i].extrainfo != extrainfo) - continue; - if (mapthings[i].options & MTF_AMBUSH) + if (mapthings[i].args[0]) { if (avoidcenter) continue; @@ -14324,7 +14320,7 @@ void A_SpawnPterabytes(mobj_t *actor) return; if (actor->spawnpoint) - amount = actor->spawnpoint->extrainfo + 1; + amount = min(1, actor->spawnpoint->args[0]); interval = FixedAngle(FRACUNIT*360/amount); diff --git a/src/p_floor.c b/src/p_floor.c index 5536ee913..b65435c21 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -11,6 +11,7 @@ /// \file p_floor.c /// \brief Floor animation, elevators +#include "dehacked.h" #include "doomdef.h" #include "doomstat.h" #include "m_random.h" @@ -162,7 +163,7 @@ result_e T_MovePlane(sector_t *sector, fixed_t speed, fixed_t dest, boolean crus void T_MoveFloor(floormove_t *movefloor) { result_e res = 0; - boolean dontupdate = false; + boolean remove = false; if (movefloor->delaytimer) { @@ -178,8 +179,8 @@ void T_MoveFloor(floormove_t *movefloor) if (movefloor->type == bounceFloor) { const fixed_t origspeed = FixedDiv(movefloor->origspeed,(ELEVATORSPEED/2)); - const fixed_t fs = abs(movefloor->sector->floorheight - lines[movefloor->texture].frontsector->floorheight); - const fixed_t bs = abs(movefloor->sector->floorheight - lines[movefloor->texture].backsector->floorheight); + const fixed_t fs = abs(movefloor->sector->floorheight - lines[movefloor->sourceline].frontsector->floorheight); + const fixed_t bs = abs(movefloor->sector->floorheight - lines[movefloor->sourceline].backsector->floorheight); if (fs < bs) movefloor->speed = FixedDiv(fs,25*FRACUNIT) + FRACUNIT/4; else @@ -190,113 +191,62 @@ void T_MoveFloor(floormove_t *movefloor) if (res == pastdest) { - if (movefloor->direction == 1) + switch (movefloor->type) { - switch (movefloor->type) - { - case moveFloorByFrontSector: - if (movefloor->texture < -1) // chained linedef executing - P_LinedefExecute((INT16)(movefloor->texture + INT16_MAX + 2), NULL, NULL); - /* FALLTHRU */ - case instantMoveFloorByFrontSector: - if (movefloor->texture > -1) // flat changing - movefloor->sector->floorpic = movefloor->texture; - break; - case bounceFloor: // Graue 03-12-2004 - if (movefloor->floordestheight == lines[movefloor->texture].frontsector->floorheight) - movefloor->floordestheight = lines[movefloor->texture].backsector->floorheight; - else - movefloor->floordestheight = lines[movefloor->texture].frontsector->floorheight; - movefloor->direction = (movefloor->floordestheight < movefloor->sector->floorheight) ? -1 : 1; - movefloor->sector->floorspeed = movefloor->speed * movefloor->direction; - movefloor->delaytimer = movefloor->delay; - P_RecalcPrecipInSector(movefloor->sector); - return; // not break, why did this work? Graue 04-03-2004 - case bounceFloorCrush: // Graue 03-27-2004 - if (movefloor->floordestheight == lines[movefloor->texture].frontsector->floorheight) - { - movefloor->floordestheight = lines[movefloor->texture].backsector->floorheight; - movefloor->speed = movefloor->origspeed = FixedDiv(abs(lines[movefloor->texture].dy),4*FRACUNIT); // return trip, use dy - } - else - { - movefloor->floordestheight = lines[movefloor->texture].frontsector->floorheight; - movefloor->speed = movefloor->origspeed = FixedDiv(abs(lines[movefloor->texture].dx),4*FRACUNIT); // forward again, use dx - } - movefloor->direction = (movefloor->floordestheight < movefloor->sector->floorheight) ? -1 : 1; - movefloor->sector->floorspeed = movefloor->speed * movefloor->direction; - movefloor->delaytimer = movefloor->delay; - P_RecalcPrecipInSector(movefloor->sector); - return; // not break, why did this work? Graue 04-03-2004 - case crushFloorOnce: - movefloor->floordestheight = lines[movefloor->texture].frontsector->floorheight; + case moveFloorByFrontSector: + if (movefloor->tag) // chained linedef executing + P_LinedefExecute(movefloor->tag, NULL, NULL); + /* FALLTHRU */ + case instantMoveFloorByFrontSector: + if (movefloor->texture > -1) // flat changing + movefloor->sector->floorpic = movefloor->texture; + remove = true; + break; + case bounceFloor: // Graue 03-12-2004 + case bounceFloorCrush: // Graue 03-27-2004 + if (movefloor->floordestheight == lines[movefloor->sourceline].frontsector->floorheight) + { + movefloor->floordestheight = lines[movefloor->sourceline].backsector->floorheight; + movefloor->origspeed = lines[movefloor->sourceline].args[3] << (FRACBITS - 2); // return trip, use args[3] + } + else + { + movefloor->floordestheight = lines[movefloor->sourceline].frontsector->floorheight; + movefloor->origspeed = lines[movefloor->sourceline].args[2] << (FRACBITS - 2); // forward again, use args[2] + } + if (movefloor->type == bounceFloorCrush) + movefloor->speed = movefloor->origspeed; + movefloor->direction = (movefloor->floordestheight < movefloor->sector->floorheight) ? -1 : 1; + movefloor->delaytimer = movefloor->delay; + remove = false; + break; + case crushFloorOnce: + if (movefloor->direction == 1) + { + movefloor->floordestheight = lines[movefloor->sourceline].frontsector->floorheight; movefloor->direction = -1; + movefloor->speed = lines[movefloor->sourceline].args[3] << (FRACBITS - 2); movefloor->sector->soundorg.z = movefloor->sector->floorheight; - S_StartSound(&movefloor->sector->soundorg,sfx_pstop); - P_RecalcPrecipInSector(movefloor->sector); - return; - default: - break; - } - } - else if (movefloor->direction == -1) - { - switch (movefloor->type) - { - case moveFloorByFrontSector: - if (movefloor->texture < -1) // chained linedef executing - P_LinedefExecute((INT16)(movefloor->texture + INT16_MAX + 2), NULL, NULL); - /* FALLTHRU */ - case instantMoveFloorByFrontSector: - if (movefloor->texture > -1) // flat changing - movefloor->sector->floorpic = movefloor->texture; - break; - case bounceFloor: // Graue 03-12-2004 - if (movefloor->floordestheight == lines[movefloor->texture].frontsector->floorheight) - movefloor->floordestheight = lines[movefloor->texture].backsector->floorheight; - else - movefloor->floordestheight = lines[movefloor->texture].frontsector->floorheight; - movefloor->direction = (movefloor->floordestheight < movefloor->sector->floorheight) ? -1 : 1; - movefloor->sector->floorspeed = movefloor->speed * movefloor->direction; - movefloor->delaytimer = movefloor->delay; - P_RecalcPrecipInSector(movefloor->sector); - return; // not break, why did this work? Graue 04-03-2004 - case bounceFloorCrush: // Graue 03-27-2004 - if (movefloor->floordestheight == lines[movefloor->texture].frontsector->floorheight) - { - movefloor->floordestheight = lines[movefloor->texture].backsector->floorheight; - movefloor->speed = movefloor->origspeed = FixedDiv(abs(lines[movefloor->texture].dy),4*FRACUNIT); // return trip, use dy - } - else - { - movefloor->floordestheight = lines[movefloor->texture].frontsector->floorheight; - movefloor->speed = movefloor->origspeed = FixedDiv(abs(lines[movefloor->texture].dx),4*FRACUNIT); // forward again, use dx - } - movefloor->direction = (movefloor->floordestheight < movefloor->sector->floorheight) ? -1 : 1; - movefloor->sector->floorspeed = movefloor->speed * movefloor->direction; - movefloor->delaytimer = movefloor->delay; - P_RecalcPrecipInSector(movefloor->sector); - return; // not break, why did this work? Graue 04-03-2004 - case crushFloorOnce: - movefloor->sector->floordata = NULL; // Clear up the thinker so others can use it - P_RemoveThinker(&movefloor->thinker); - movefloor->sector->floorspeed = 0; - P_RecalcPrecipInSector(movefloor->sector); - return; - default: - break; - } + S_StartSound(&movefloor->sector->soundorg, sfx_pstop); + remove = false; + } + else + remove = true; + break; + default: + remove = true; + break; } + } + if (remove) + { movefloor->sector->floordata = NULL; // Clear up the thinker so others can use it movefloor->sector->floorspeed = 0; P_RemoveThinker(&movefloor->thinker); - dontupdate = true; } - if (!dontupdate) - movefloor->sector->floorspeed = movefloor->speed*movefloor->direction; else - movefloor->sector->floorspeed = 0; + movefloor->sector->floorspeed = movefloor->speed*movefloor->direction; P_RecalcPrecipInSector(movefloor->sector); } @@ -634,7 +584,6 @@ void T_BounceCheese(bouncecheese_t *bouncer) sector_t *actionsector; boolean remove; INT32 i; - mtag_t tag = Tag_FGet(&bouncer->sourceline->tags); if (bouncer->sector->crumblestate == CRUMBLE_RESTORE || bouncer->sector->crumblestate == CRUMBLE_WAIT || bouncer->sector->crumblestate == CRUMBLE_ACTIVATED) // Oops! Crumbler says to remove yourself! @@ -649,7 +598,7 @@ void T_BounceCheese(bouncecheese_t *bouncer) } // You can use multiple target sectors, but at your own risk!!! - TAG_ITER_SECTORS(tag, i) + TAG_ITER_SECTORS(bouncer->sourceline->args[0], i) { actionsector = §ors[i]; actionsector->moved = true; @@ -773,7 +722,7 @@ void T_StartCrumble(crumble_t *crumble) ffloor_t *rover; sector_t *sector; INT32 i; - mtag_t tag = Tag_FGet(&crumble->sourceline->tags); + mtag_t tag = crumble->sourceline->args[0]; // Once done, the no-return thinker just sits there, // constantly 'returning'... kind of an oxymoron, isn't it? @@ -1097,23 +1046,6 @@ void T_MarioBlockChecker(mariocheck_t *block) } } -static boolean P_IsPlayerValid(size_t playernum) -{ - if (!playeringame[playernum]) - return false; - - if (!players[playernum].mo) - return false; - - if (players[playernum].mo->health <= 0) - return false; - - if (players[playernum].spectator) - return false; - - return true; -} - // This is the Thwomp's 'brain'. It looks around for players nearby, and if // it finds any, **SMASH**!!! Muahahhaa.... void T_ThwompSector(thwomp_t *thwomp) @@ -1290,7 +1222,7 @@ void T_NoEnemiesSector(noenemies_t *nobaddies) sector_t *sec = NULL; INT32 secnum = -1; boolean FOFsector = false; - mtag_t tag = Tag_FGet(&nobaddies->sourceline->tags); + mtag_t tag = nobaddies->sourceline->args[0]; TAG_ITER_SECTORS(tag, secnum) { @@ -1302,14 +1234,13 @@ void T_NoEnemiesSector(noenemies_t *nobaddies) for (i = 0; i < sec->linecount; i++) { INT32 targetsecnum = -1; - mtag_t tag2 = Tag_FGet(&sec->lines[i]->tags); if (sec->lines[i]->special < 100 || sec->lines[i]->special >= 300) continue; FOFsector = true; - TAG_ITER_SECTORS(tag2, targetsecnum) + TAG_ITER_SECTORS(sec->lines[i]->args[0], targetsecnum) { if (T_SectorHasEnemies(§ors[targetsecnum])) return; @@ -1327,217 +1258,68 @@ void T_NoEnemiesSector(noenemies_t *nobaddies) P_RemoveThinker(&nobaddies->thinker); } -// -// P_IsObjectOnRealGround -// -// Helper function for T_EachTimeThinker -// Like P_IsObjectOnGroundIn, except ONLY THE REAL GROUND IS CONSIDERED, NOT FOFS -// I'll consider whether to make this a more globally accessible function or whatever in future -// -- Monster Iestyn -// -static boolean P_IsObjectOnRealGround(mobj_t *mo, sector_t *sec) +static boolean P_CheckAllTrigger(eachtime_t *eachtime) { - // Is the object in reverse gravity? - if (mo->eflags & MFE_VERTICALFLIP) + size_t i; + + for (i = 0; i < MAXPLAYERS; i++) { - // Detect if the player is on the ceiling. - if (mo->z+mo->height >= P_GetSpecialTopZ(mo, sec, sec)) - return true; + if (P_CanPlayerTrigger(i) && !eachtime->playersInArea[i]) + return false; } - // Nope! - else - { - // Detect if the player is on the floor. - if (mo->z <= P_GetSpecialBottomZ(mo, sec, sec)) - return true; - } - return false; + + return true; } -static boolean P_IsMobjTouchingSector(mobj_t *mo, sector_t *sec) -{ - msecnode_t *node; - - if (mo->subsector->sector == sec) - return true; - - if (!(sec->flags & SF_TRIGGERSPECIAL_TOUCH)) - return false; - - for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next) - { - if (node->m_sector == sec) - return true; - } - - return false; -} - -// -// T_EachTimeThinker -// -// Runs a linedef exec whenever a player enters an area. -// Keeps track of players currently in the area and notices any changes. -// -// \sa P_AddEachTimeThinker -// void T_EachTimeThinker(eachtime_t *eachtime) { - size_t i, j; - sector_t *sec = NULL; - sector_t *targetsec = NULL; - INT32 secnum = -1; + size_t i; boolean oldPlayersInArea[MAXPLAYERS]; - boolean oldPlayersOnArea[MAXPLAYERS]; - boolean *oldPlayersArea; - boolean *playersArea; - boolean FOFsector = false; - boolean floortouch = false; - fixed_t bottomheight, topheight; - ffloor_t *rover; - mtag_t tag = Tag_FGet(&eachtime->sourceline->tags); + sector_t *caller[MAXPLAYERS]; + boolean allPlayersChecked = false; + boolean allPlayersTrigger = false; for (i = 0; i < MAXPLAYERS; i++) { oldPlayersInArea[i] = eachtime->playersInArea[i]; - oldPlayersOnArea[i] = eachtime->playersOnArea[i]; - eachtime->playersInArea[i] = false; - eachtime->playersOnArea[i] = false; - } - - TAG_ITER_SECTORS(tag, secnum) - { - sec = §ors[secnum]; - - FOFsector = false; - - if (GETSECSPECIAL(sec->special, 2) == 3 || GETSECSPECIAL(sec->special, 2) == 5) - floortouch = true; - else if (GETSECSPECIAL(sec->special, 2) >= 1 && GETSECSPECIAL(sec->special, 2) <= 8) - floortouch = false; - else - continue; - - // Check the lines of this sector, to see if it is a FOF control sector. - for (i = 0; i < sec->linecount; i++) - { - INT32 targetsecnum = -1; - mtag_t tag2 = Tag_FGet(&sec->lines[i]->tags); - - if (sec->lines[i]->special < 100 || sec->lines[i]->special >= 300) - continue; - - FOFsector = true; - - TAG_ITER_SECTORS(tag2, targetsecnum) - { - targetsec = §ors[targetsecnum]; - - // Find the FOF corresponding to the control linedef - for (rover = targetsec->ffloors; rover; rover = rover->next) - { - if (rover->master == sec->lines[i]) - break; - } - - if (!rover) // This should be impossible, but don't complain if it is the case somehow - continue; - - if (!(rover->flags & FF_EXISTS)) // If the FOF does not "exist", we pretend that nobody's there - continue; - - for (j = 0; j < MAXPLAYERS; j++) - { - if (!P_IsPlayerValid(j)) - continue; - - if (!P_IsMobjTouchingSector(players[j].mo, targetsec)) - continue; - - topheight = P_GetSpecialTopZ(players[j].mo, sec, targetsec); - bottomheight = P_GetSpecialBottomZ(players[j].mo, sec, targetsec); - - if (players[j].mo->z > topheight) - continue; - - if (players[j].mo->z + players[j].mo->height < bottomheight) - continue; - - if (floortouch && P_IsObjectOnGroundIn(players[j].mo, targetsec)) - eachtime->playersOnArea[j] = true; - else - eachtime->playersInArea[j] = true; - } - } - } - - if (!FOFsector) - { - for (i = 0; i < MAXPLAYERS; i++) - { - if (!P_IsPlayerValid(i)) - continue; - - if (!P_IsMobjTouchingSector(players[i].mo, sec)) - continue; - - if (!(players[i].mo->subsector->sector == sec - || P_PlayerTouchingSectorSpecial(&players[i], 2, (GETSECSPECIAL(sec->special, 2))) == sec)) - continue; - - if (floortouch && P_IsObjectOnRealGround(players[i].mo, sec)) - eachtime->playersOnArea[i] = true; - else - eachtime->playersInArea[i] = true; - } - } - } - - // Check if a new player entered. - // If not, check if a player hit the floor. - // If either condition is true, execute. - if (floortouch) - { - playersArea = eachtime->playersOnArea; - oldPlayersArea = oldPlayersOnArea; - } - else - { - playersArea = eachtime->playersInArea; - oldPlayersArea = oldPlayersInArea; + caller[i] = P_CanPlayerTrigger(i) ? P_FindPlayerTrigger(&players[i], eachtime->sourceline) : NULL; + eachtime->playersInArea[i] = caller[i] != NULL; } // Easy check... nothing has changed - if (!memcmp(playersArea, oldPlayersArea, sizeof(boolean)*MAXPLAYERS)) + if (!memcmp(eachtime->playersInArea, oldPlayersInArea, sizeof(boolean)*MAXPLAYERS)) return; - // If sector has an "all players" trigger type, all players need to be in area - if (GETSECSPECIAL(sec->special, 2) == 2 || GETSECSPECIAL(sec->special, 2) == 3) - { - for (i = 0; i < MAXPLAYERS; i++) - { - if (P_IsPlayerValid(i) && !playersArea[i]) - return; - } - } - // Trigger for every player who has entered (and exited, if triggerOnExit) for (i = 0; i < MAXPLAYERS; i++) { - if (playersArea[i] == oldPlayersArea[i]) + if (eachtime->playersInArea[i] == oldPlayersInArea[i]) continue; // If player has just left, check if still valid - if (!playersArea[i] && (!eachtime->triggerOnExit || !P_IsPlayerValid(i))) + if (!eachtime->playersInArea[i] && (!eachtime->triggerOnExit || !P_CanPlayerTrigger(i))) continue; - CONS_Debug(DBG_GAMELOGIC, "Trying to activate each time executor with tag %d\n", tag); + // If sector has an "all players" trigger type, all players need to be in area + if (caller[i] && caller[i]->triggerer == TO_ALLPLAYERS) + { + if (!allPlayersChecked) + { + allPlayersChecked = true; + allPlayersTrigger = P_CheckAllTrigger(eachtime); + } + + if (!allPlayersTrigger) + continue; + } + + CONS_Debug(DBG_GAMELOGIC, "Trying to activate each time executor with tag %d\n", Tag_FGet(&eachtime->sourceline->tags)); // 03/08/14 -Monster Iestyn // No more stupid hacks involving changing eachtime->sourceline's tag or special or whatever! // This should now run ONLY the stuff for eachtime->sourceline itself, instead of all trigger linedefs sharing the same tag. // Makes much more sense doing it this way, honestly. - P_RunTriggerLinedef(eachtime->sourceline, players[i].mo, sec); + P_RunTriggerLinedef(eachtime->sourceline, players[i].mo, caller[i]); if (!eachtime->sourceline->special) // this happens only for "Trigger on X calls" linedefs P_RemoveThinker(&eachtime->thinker); @@ -1806,13 +1588,12 @@ void T_PlaneDisplace(planedisplace_t *pd) // (egg capsule button), P_PlayerInSpecialSector (buttons), // and P_SpawnSpecials (continuous floor movers and instant lower). // -void EV_DoFloor(line_t *line, floor_e floortype) +void EV_DoFloor(mtag_t tag, line_t *line, floor_e floortype) { INT32 firstone = 1; INT32 secnum = -1; sector_t *sec; floormove_t *dofloor; - mtag_t tag = Tag_FGet(&line->tags); TAG_ITER_SECTORS(tag, secnum) { @@ -1833,34 +1614,25 @@ void EV_DoFloor(line_t *line, floor_e floortype) dofloor->type = floortype; dofloor->crush = false; // default: types that crush will change this dofloor->sector = sec; + dofloor->sourceline = (INT32)(line - lines); switch (floortype) { - // Lowers a floor to the lowest surrounding floor. - case lowerFloorToLowest: - dofloor->direction = -1; // down - dofloor->speed = FLOORSPEED*2; // 2 fracunits per tic - dofloor->floordestheight = P_FindLowestFloorSurrounding(sec); - break; - - // Used for part of the Egg Capsule, when an FOF with type 666 is - // contacted by the player. + // Used to open the top of an Egg Capsule. case raiseFloorToNearestFast: dofloor->direction = -1; // down dofloor->speed = FLOORSPEED*4; // 4 fracunits per tic dofloor->floordestheight = P_FindNextHighestFloor(sec, sec->floorheight); break; - // Used for sectors tagged to 50 linedefs (effectively - // changing the base height for placing things in that sector). + // Instantly lower floor to surrounding sectors. + // Used as a hack in the binary map format to allow thing heights above 4096. case instantLower: dofloor->direction = -1; // down dofloor->speed = INT32_MAX/2; // "instant" means "takes one tic" dofloor->floordestheight = P_FindLowestFloorSurrounding(sec); break; - // Linedef executor command, linetype 101. - // Front sector floor = destination height. case instantMoveFloorByFrontSector: dofloor->speed = INT32_MAX/2; // as above, "instant" is one tic dofloor->floordestheight = line->frontsector->floorheight; @@ -1870,22 +1642,12 @@ void EV_DoFloor(line_t *line, floor_e floortype) else dofloor->direction = -1; // down - // New for 1.09: now you can use the no climb flag to - // DISABLE the flat changing. This makes it work - // totally opposite the way linetype 106 does. Yet - // another reason I'll be glad to break backwards - // compatibility for the final. - if (line->flags & ML_NOCLIMB) - dofloor->texture = -1; // don't mess with the floorpic - else - dofloor->texture = line->frontsector->floorpic; + // If flag is set, change floor texture after moving + dofloor->texture = line->args[2] ? line->frontsector->floorpic : -1; break; - // Linedef executor command, linetype 106. - // Line length = speed, front sector floor = destination height. case moveFloorByFrontSector: - dofloor->speed = P_AproxDistance(line->dx, line->dy); - dofloor->speed = FixedDiv(dofloor->speed,8*FRACUNIT); + dofloor->speed = line->args[2] << (FRACBITS - 3); dofloor->floordestheight = line->frontsector->floorheight; if (dofloor->floordestheight >= sec->floorheight) @@ -1894,85 +1656,31 @@ void EV_DoFloor(line_t *line, floor_e floortype) dofloor->direction = -1; // down // chained linedef executing ability - if (line->flags & ML_BLOCKMONSTERS) - { - // Only set it on one of the moving sectors (the - // smallest numbered) and only if the front side - // x offset is positive, indicating a valid tag. - if (firstone && sides[line->sidenum[0]].textureoffset > 0) - dofloor->texture = (sides[line->sidenum[0]].textureoffset>>FRACBITS) - 32769; - else - dofloor->texture = -1; - } + // Only set it on one of the moving sectors (the smallest numbered) + if (line->args[3]) + dofloor->tag = firstone ? (INT16)line->args[3] : -1; // flat changing ability - else if (line->flags & ML_NOCLIMB) - dofloor->texture = line->frontsector->floorpic; - else - dofloor->texture = -1; // nothing special to do after movement completes - + dofloor->texture = line->args[4] ? line->frontsector->floorpic : -1; break; - case moveFloorByFrontTexture: - if (line->flags & ML_NOCLIMB) + case moveFloorByDistance: + if (line->args[4]) dofloor->speed = INT32_MAX/2; // as above, "instant" is one tic else - dofloor->speed = FixedDiv(sides[line->sidenum[0]].textureoffset,8*FRACUNIT); // texture x offset - dofloor->floordestheight = sec->floorheight + sides[line->sidenum[0]].rowoffset; // texture y offset + dofloor->speed = line->args[3] << (FRACBITS - 3); + dofloor->floordestheight = sec->floorheight + (line->args[2] << FRACBITS); if (dofloor->floordestheight > sec->floorheight) dofloor->direction = 1; // up else dofloor->direction = -1; // down break; -/* - // Linedef executor command, linetype 108. - // dx = speed, dy = amount to lower. - case lowerFloorByLine: - dofloor->direction = -1; // down - dofloor->speed = FixedDiv(abs(line->dx),8*FRACUNIT); - dofloor->floordestheight = sec->floorheight - abs(line->dy); - if (dofloor->floordestheight > sec->floorheight) // wrapped around - I_Error("Can't lower sector %d\n", secnum); - break; - - // Linedef executor command, linetype 109. - // dx = speed, dy = amount to raise. - case raiseFloorByLine: - dofloor->direction = 1; // up - dofloor->speed = FixedDiv(abs(line->dx),8*FRACUNIT); - dofloor->floordestheight = sec->floorheight + abs(line->dy); - if (dofloor->floordestheight < sec->floorheight) // wrapped around - I_Error("Can't raise sector %d\n", secnum); - break; -*/ - - // Linetypes 2/3. - // Move floor up and down indefinitely like the old elevators. + // Move floor up and down indefinitely. + // bounceFloor has slowdown at the top and bottom of movement. case bounceFloor: - dofloor->speed = P_AproxDistance(line->dx, line->dy); // same speed as elevateContinuous - dofloor->speed = FixedDiv(dofloor->speed,4*FRACUNIT); - dofloor->origspeed = dofloor->speed; // it gets slowed down at the top and bottom - dofloor->floordestheight = line->frontsector->floorheight; - - if (dofloor->floordestheight >= sec->floorheight) - dofloor->direction = 1; // up - else - dofloor->direction = -1; // down - - // Any delay? - dofloor->delay = sides[line->sidenum[0]].textureoffset >> FRACBITS; - dofloor->delaytimer = sides[line->sidenum[0]].rowoffset >> FRACBITS; // Initial delay - - dofloor->texture = (fixed_t)(line - lines); // hack: store source line number - break; - - // Linetypes 6/7. - // Like 2/3, but no slowdown at the top and bottom of movement, - // and the speed is line->dx the first way, line->dy for the - // return trip. Good for crushers. case bounceFloorCrush: - dofloor->speed = FixedDiv(abs(line->dx),4*FRACUNIT); + dofloor->speed = line->args[2] << (FRACBITS - 2); // same speed as elevateContinuous dofloor->origspeed = dofloor->speed; dofloor->floordestheight = line->frontsector->floorheight; @@ -1982,27 +1690,18 @@ void EV_DoFloor(line_t *line, floor_e floortype) dofloor->direction = -1; // down // Any delay? - dofloor->delay = sides[line->sidenum[0]].textureoffset >> FRACBITS; - dofloor->delaytimer = sides[line->sidenum[0]].rowoffset >> FRACBITS; // Initial delay - - dofloor->texture = (fixed_t)(line - lines); // hack: store source line number + dofloor->delay = line->args[5]; + dofloor->delaytimer = line->args[4]; // Initial delay break; case crushFloorOnce: - dofloor->speed = FixedDiv(abs(line->dx),4*FRACUNIT); - dofloor->origspeed = dofloor->speed; + dofloor->speed = dofloor->origspeed = line->args[2] << (FRACBITS - 2); dofloor->floordestheight = line->frontsector->ceilingheight; if (dofloor->floordestheight >= sec->floorheight) dofloor->direction = 1; // up else dofloor->direction = -1; // down - - // Any delay? - dofloor->delay = sides[line->sidenum[0]].textureoffset >> FRACBITS; - dofloor->delaytimer = sides[line->sidenum[0]].rowoffset >> FRACBITS; - - dofloor->texture = (fixed_t)(line - lines); // hack: store source line number break; default: @@ -2023,14 +1722,13 @@ void EV_DoFloor(line_t *line, floor_e floortype) // // jff 2/22/98 new type to move floor and ceiling in parallel // -void EV_DoElevator(line_t *line, elevator_e elevtype, boolean customspeed) +void EV_DoElevator(mtag_t tag, line_t *line, elevator_e elevtype) { INT32 secnum = -1; sector_t *sec; elevator_t *elevator; - mtag_t tag = Tag_FGet(&line->tags); - // act on all sectors with the same tag as the triggering linedef + // act on all sectors with the given tag TAG_ITER_SECTORS(tag, secnum) { sec = §ors[secnum]; @@ -2048,6 +1746,7 @@ void EV_DoElevator(line_t *line, elevator_e elevtype, boolean customspeed) elevator->type = elevtype; elevator->sourceline = line; elevator->distance = 1; // Always crush unless otherwise + elevator->sector = sec; // set up the fields according to the type of elevator action switch (elevtype) @@ -2055,91 +1754,57 @@ void EV_DoElevator(line_t *line, elevator_e elevtype, boolean customspeed) // elevator down to next floor case elevateDown: elevator->direction = -1; - elevator->sector = sec; elevator->speed = ELEVATORSPEED/2; // half speed elevator->floordestheight = P_FindNextLowestFloor(sec, sec->floorheight); - elevator->ceilingdestheight = elevator->floordestheight - + sec->ceilingheight - sec->floorheight; break; // elevator up to next floor case elevateUp: elevator->direction = 1; - elevator->sector = sec; elevator->speed = ELEVATORSPEED/4; // quarter speed elevator->floordestheight = P_FindNextHighestFloor(sec, sec->floorheight); - elevator->ceilingdestheight = elevator->floordestheight - + sec->ceilingheight - sec->floorheight; break; // elevator up to highest floor case elevateHighest: elevator->direction = 1; - elevator->sector = sec; elevator->speed = ELEVATORSPEED/4; // quarter speed elevator->floordestheight = P_FindHighestFloorSurrounding(sec); - elevator->ceilingdestheight = elevator->floordestheight - + sec->ceilingheight - sec->floorheight; - break; - - // elevator to floor height of activating switch's front sector - case elevateCurrent: - elevator->sector = sec; - elevator->speed = ELEVATORSPEED; - elevator->floordestheight = line->frontsector->floorheight; - elevator->ceilingdestheight = elevator->floordestheight - + sec->ceilingheight - sec->floorheight; - elevator->direction = elevator->floordestheight > sec->floorheight? 1 : -1; break; case elevateContinuous: - if (customspeed) - { - elevator->origspeed = P_AproxDistance(line->dx, line->dy); - elevator->origspeed = FixedDiv(elevator->origspeed,4*FRACUNIT); - elevator->speed = elevator->origspeed; - } - else - { - elevator->speed = ELEVATORSPEED/2; - elevator->origspeed = elevator->speed; - } + elevator->origspeed = line->args[1] << (FRACBITS - 2); + elevator->speed = elevator->origspeed; - elevator->sector = sec; - elevator->low = !(line->flags & ML_NOCLIMB); // go down first unless noclimb is on + elevator->low = !line->args[4]; // go down first unless args[4] is set if (elevator->low) { elevator->direction = 1; elevator->floordestheight = P_FindNextHighestFloor(sec, sec->floorheight); - elevator->ceilingdestheight = elevator->floordestheight - + sec->ceilingheight - sec->floorheight; } else { elevator->direction = -1; elevator->floordestheight = P_FindNextLowestFloor(sec,sec->floorheight); - elevator->ceilingdestheight = elevator->floordestheight - + sec->ceilingheight - sec->floorheight; } elevator->floorwasheight = elevator->sector->floorheight; elevator->ceilingwasheight = elevator->sector->ceilingheight; - elevator->delay = sides[line->sidenum[0]].textureoffset >> FRACBITS; - elevator->delaytimer = sides[line->sidenum[0]].rowoffset >> FRACBITS; // Initial delay + elevator->delay = line->args[3]; + elevator->delaytimer = line->args[2]; // Initial delay break; case bridgeFall: elevator->direction = -1; - elevator->sector = sec; elevator->speed = ELEVATORSPEED*4; // quadruple speed elevator->floordestheight = P_FindNextLowestFloor(sec, sec->floorheight); - elevator->ceilingdestheight = elevator->floordestheight - + sec->ceilingheight - sec->floorheight; break; default: break; } + + elevator->ceilingdestheight = elevator->floordestheight + sec->ceilingheight - sec->floorheight; } } @@ -2149,7 +1814,7 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover) fixed_t leftx, rightx, topy, bottomy, topz, bottomz, widthfactor, heightfactor, a, b, c, spacing; mobjtype_t type; tic_t lifetime; - INT16 flags; + boolean fromcenter; sector_t *controlsec = rover->master->frontsector; mtag_t tag = Tag_FGet(&controlsec->tags); @@ -2179,25 +1844,20 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover) spacing = (32<>FRACBITS != -1) - lifetime = (sides[lines[tagline].sidenum[0]].rowoffset>>FRACBITS); - else - lifetime = 0; - } - flags = lines[tagline].flags; + if (lines[tagline].stringargs[0]) + type = get_number(lines[tagline].stringargs[0]); + if (lines[tagline].args[0]) + spacing = lines[tagline].args[0] << FRACBITS; + if (lines[tagline].args[1]) + lifetime = (lines[tagline].args[1] != -1) ? lines[tagline].args[1] : 0; + fromcenter = !!lines[tagline].args[2]; } } @@ -2232,7 +1892,7 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover) topz = *rover->topheight-(spacing>>1); bottomz = *rover->bottomheight; - if (flags & ML_EFFECT1) + if (fromcenter) { widthfactor = (rightx + topy - leftx - bottomy)>>3; heightfactor = (topz - *rover->bottomheight)>>2; @@ -2255,7 +1915,7 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover) spawned = P_SpawnMobj(a, b, c, type); spawned->angle += P_RandomKey(36)*ANG10; // irrelevant for default objects but might make sense for some custom ones - if (flags & ML_EFFECT1) + if (fromcenter) { P_InstaThrust(spawned, R_PointToAngle2(sec->soundorg.x, sec->soundorg.y, a, b), FixedDiv(P_AproxDistance(a - sec->soundorg.x, b - sec->soundorg.y), widthfactor)); P_SetObjectMomZ(spawned, FixedDiv((c - bottomz), heightfactor), false); @@ -2327,7 +1987,7 @@ INT32 EV_StartCrumble(sector_t *sec, ffloor_t *rover, boolean floating, crumble_t *crumble; sector_t *foundsec; INT32 i; - mtag_t tag = Tag_FGet(&rover->master->tags); + mtag_t tag = rover->master->args[0]; // If floor is already activated, skip it if (sec->floordata) @@ -2419,7 +2079,7 @@ void EV_MarioBlock(ffloor_t *rover, sector_t *sector, mobj_t *puncher) block->direction = 1; block->floorstartheight = block->sector->floorheight; block->ceilingstartheight = block->sector->ceilingheight; - block->tag = (INT16)Tag_FGet(§or->tags); + block->tag = (INT16)rover->master->args[0]; if (itsamonitor) { diff --git a/src/p_inter.c b/src/p_inter.c index 582cdb0d0..c230ce178 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -762,6 +762,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // return; { UINT8 flagteam = (special->type == MT_REDFLAG) ? 1 : 2; + sectorspecialflags_t specialflag = (special->type == MT_REDFLAG) ? SSF_REDTEAMBASE : SSF_BLUETEAMBASE; const char *flagtext; char flagcolor; char plname[MAXPLAYERNAME+4]; @@ -791,7 +792,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) special->fuse = 1; special->flags2 |= MF2_JUSTATTACKED; - if (!P_PlayerTouchingSectorSpecial(player, 4, 2 + flagteam)) + if (!P_PlayerTouchingSectorSpecialFlag(player, specialflag)) { CONS_Printf(M_GetText("%s returned the %c%s%c to base.\n"), plname, flagcolor, flagtext, 0x80); @@ -1380,19 +1381,14 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; case MT_AXE: { - line_t junk; thinker_t *th; mobj_t *mo2; if (player->bot && player->bot != BOT_MPAI) return; - // Initialize my junk - junk.tags.tags = NULL; - junk.tags.count = 0; - - Tag_FSet(&junk.tags, LE_AXE); - EV_DoElevator(&junk, bridgeFall, false); + if (special->spawnpoint) + EV_DoElevator(special->spawnpoint->args[0], NULL, bridgeFall); // scan the remaining thinkers to find koopa for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) @@ -1441,7 +1437,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // Misc touchables // // *************** // case MT_STARPOST: - P_TouchStarPost(special, player, special->spawnpoint && (special->spawnpoint->options & MTF_OBJECTSPECIAL)); + P_TouchStarPost(special, player, special->spawnpoint && special->spawnpoint->args[1]); return; case MT_FAKEMOBILE: @@ -2775,7 +2771,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget case MT_BLASTEXECUTOR: if (target->spawnpoint) - P_LinedefExecute(target->spawnpoint->angle, (source ? source : inflictor), target->subsector->sector); + P_LinedefExecute(target->spawnpoint->args[0], (source ? source : inflictor), target->subsector->sector); break; case MT_SPINBOBERT: diff --git a/src/p_lights.c b/src/p_lights.c index d7bbea90c..4c783f884 100644 --- a/src/p_lights.c +++ b/src/p_lights.c @@ -30,7 +30,7 @@ void P_RemoveLighting(sector_t *sector) // The thinker is the first member in all the lighting action structs, // so just let the thinker get freed, and that will free the whole // structure. - P_RemoveThinker(&((elevator_t *)sector->lightingdata)->thinker); + P_RemoveThinker(&((thinkerdata_t *)sector->lightingdata)->thinker); sector->lightingdata = NULL; } } @@ -54,43 +54,36 @@ void T_FireFlicker(fireflicker_t *flick) amount = (INT16)((UINT8)(P_RandomByte() & 3) * 16); if (flick->sector->lightlevel - amount < flick->minlight) - flick->sector->lightlevel = (INT16)flick->minlight; + flick->sector->lightlevel = flick->minlight; else - flick->sector->lightlevel = (INT16)((INT16)flick->maxlight - amount); + flick->sector->lightlevel = flick->maxlight - amount; flick->count = flick->resetcount; } /** Spawns an adjustable fire flicker effect in a sector. * - * \param minsector Sector whose light level is used as the darkest. - * \param maxsector Sector whose light level is used as the brightest, - * and also the target sector for the effect. + * \param sector Target sector for the effect. + * \param lighta One of the two light levels to move between. + * \param lightb The other light level. * \param length Four times the number of tics between flickers. * \sa T_FireFlicker */ -fireflicker_t *P_SpawnAdjustableFireFlicker(sector_t *minsector, sector_t *maxsector, INT32 length) +fireflicker_t *P_SpawnAdjustableFireFlicker(sector_t *sector, INT16 lighta, INT16 lightb, INT32 length) { fireflicker_t *flick; - P_RemoveLighting(maxsector); // out with the old, in with the new + P_RemoveLighting(sector); // out with the old, in with the new flick = Z_Calloc(sizeof (*flick), PU_LEVSPEC, NULL); P_AddThinker(THINK_MAIN, &flick->thinker); flick->thinker.function.acp1 = (actionf_p1)T_FireFlicker; - flick->sector = maxsector; - flick->maxlight = maxsector->lightlevel; - flick->minlight = minsector->lightlevel; - if (flick->minlight > flick->maxlight) - { - // You mixed them up, you dummy. - INT32 oops = flick->minlight; - flick->minlight = flick->maxlight; - flick->maxlight = oops; - } + flick->sector = sector; + flick->maxlight = max(lighta, lightb); + flick->minlight = min(lighta, lightb); flick->count = flick->resetcount = length/4; - maxsector->lightingdata = flick; + sector->lightingdata = flick; // input bounds checking and stuff if (!flick->resetcount) @@ -103,6 +96,9 @@ fireflicker_t *P_SpawnAdjustableFireFlicker(sector_t *minsector, sector_t *maxse flick->maxlight++; } + // Make sure the starting light level is in range. + sector->lightlevel = max(flick->minlight, min(flick->maxlight, sector->lightlevel)); + return flick; } @@ -148,7 +144,7 @@ void P_SpawnLightningFlash(sector_t *sector) minlight = ((lightflash_t *)sector->lightingdata)->minlight; } - P_RemoveThinker(&((elevator_t *)sector->lightingdata)->thinker); + P_RemoveThinker(&((thinkerdata_t *)sector->lightingdata)->thinker); } sector->lightingdata = NULL; @@ -182,21 +178,21 @@ void T_StrobeFlash(strobe_t *flash) if (flash->sector->lightlevel == flash->minlight) { - flash->sector->lightlevel = (INT16)flash->maxlight; + flash->sector->lightlevel = flash->maxlight; flash->count = flash->brighttime; } else { - flash->sector->lightlevel = (INT16)flash->minlight; + flash->sector->lightlevel = flash->minlight; flash->count = flash->darktime; } } /** Spawns an adjustable strobe light effect in a sector. * - * \param minsector Sector whose light level is used as the darkest. - * \param maxsector Sector whose light level is used as the brightest, - * and also the target sector for the effect. + * \param sector Target sector for the effect. + * \param lighta One of the two light levels to move between. + * \param lightb The other light level. * \param darktime Time in tics for the light to be dark. * \param brighttime Time in tics for the light to be bright. * \param inSync If true, the effect will be kept in sync @@ -207,29 +203,21 @@ void T_StrobeFlash(strobe_t *flash) * the strobe flash is random. * \sa T_StrobeFlash */ -strobe_t *P_SpawnAdjustableStrobeFlash(sector_t *minsector, sector_t *maxsector, INT32 darktime, INT32 brighttime, boolean inSync) +strobe_t *P_SpawnAdjustableStrobeFlash(sector_t *sector, INT16 lighta, INT16 lightb, INT32 darktime, INT32 brighttime, boolean inSync) { strobe_t *flash; - P_RemoveLighting(maxsector); // out with the old, in with the new + P_RemoveLighting(sector); // out with the old, in with the new flash = Z_Calloc(sizeof (*flash), PU_LEVSPEC, NULL); P_AddThinker(THINK_MAIN, &flash->thinker); - flash->sector = maxsector; + flash->sector = sector; flash->darktime = darktime; flash->brighttime = brighttime; flash->thinker.function.acp1 = (actionf_p1)T_StrobeFlash; - flash->maxlight = maxsector->lightlevel; - flash->minlight = minsector->lightlevel; - - if (flash->minlight > flash->maxlight) - { - // You mixed them up, you dummy. - INT32 oops = flash->minlight; - flash->minlight = flash->maxlight; - flash->maxlight = oops; - } + flash->maxlight = max(lighta, lightb); + flash->minlight = min(lighta, lightb); if (flash->minlight == flash->maxlight) flash->minlight = 0; @@ -239,7 +227,10 @@ strobe_t *P_SpawnAdjustableStrobeFlash(sector_t *minsector, sector_t *maxsector, else flash->count = 1; - maxsector->lightingdata = flash; + // Make sure the starting light level is in range. + sector->lightlevel = max(flash->minlight, min(flash->maxlight, sector->lightlevel)); + + sector->lightingdata = flash; return flash; } @@ -254,20 +245,20 @@ void T_Glow(glow_t *g) { case -1: // DOWN - g->sector->lightlevel = (INT16)(g->sector->lightlevel - (INT16)g->speed); + g->sector->lightlevel -= g->speed; if (g->sector->lightlevel <= g->minlight) { - g->sector->lightlevel = (INT16)(g->sector->lightlevel + (INT16)g->speed); + g->sector->lightlevel += g->speed; g->direction = 1; } break; case 1: // UP - g->sector->lightlevel = (INT16)(g->sector->lightlevel + (INT16)g->speed); + g->sector->lightlevel += g->speed; if (g->sector->lightlevel >= g->maxlight) { - g->sector->lightlevel = (INT16)(g->sector->lightlevel - (INT16)g->speed); + g->sector->lightlevel -= g->speed; g->direction = -1; } break; @@ -276,34 +267,27 @@ void T_Glow(glow_t *g) /** Spawns an adjustable glowing light effect in a sector. * - * \param minsector Sector whose light level is used as the darkest. - * \param maxsector Sector whose light level is used as the brightest, - * and also the target sector for the effect. + * \param sector Target sector for the effect. + * \param lighta One of the two light levels to move between. + * \param lightb The other light level. * \param length The speed of the effect. * \sa T_Glow */ -glow_t *P_SpawnAdjustableGlowingLight(sector_t *minsector, sector_t *maxsector, INT32 length) +glow_t *P_SpawnAdjustableGlowingLight(sector_t *sector, INT16 lighta, INT16 lightb, INT32 length) { glow_t *g; - P_RemoveLighting(maxsector); // out with the old, in with the new + P_RemoveLighting(sector); // out with the old, in with the new g = Z_Calloc(sizeof (*g), PU_LEVSPEC, NULL); P_AddThinker(THINK_MAIN, &g->thinker); - g->sector = maxsector; - g->minlight = minsector->lightlevel; - g->maxlight = maxsector->lightlevel; - if (g->minlight > g->maxlight) - { - // You mixed them up, you dummy. - INT32 oops = g->minlight; - g->minlight = g->maxlight; - g->maxlight = oops; - } + g->sector = sector; + g->minlight = min(lighta, lightb); + g->maxlight = max(lighta, lightb); g->thinker.function.acp1 = (actionf_p1)T_Glow; g->direction = 1; - g->speed = length/4; + g->speed = (INT16)(length/4); if (g->speed > (g->maxlight - g->minlight)/2) // don't make it ridiculous speed g->speed = (g->maxlight - g->minlight)/2; @@ -317,7 +301,10 @@ glow_t *P_SpawnAdjustableGlowingLight(sector_t *minsector, sector_t *maxsector, g->speed = (g->maxlight - g->minlight)/2; } - maxsector->lightingdata = g; + // Make sure the starting light level is in range. + sector->lightlevel = max(g->minlight, min(g->maxlight, sector->lightlevel)); + + sector->lightingdata = g; return g; } @@ -371,9 +358,10 @@ void P_FadeLightBySector(sector_t *sector, INT32 destvalue, INT32 speed, boolean } } -void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed, boolean ticbased, boolean force) +void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed, boolean ticbased, boolean force, boolean relative) { INT32 i; + INT32 realdestvalue; // search all sectors for ones with tag TAG_ITER_SECTORS(tag, i) @@ -386,7 +374,9 @@ void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed, boolean ticbased, bool CONS_Debug(DBG_GAMELOGIC, "Line type 420 Executor: Fade light thinker already exists, timer: %d\n", ((lightlevel_t*)sectors[i].lightingdata)->timer); continue; } - P_FadeLightBySector(§ors[i], destvalue, speed, ticbased); + + realdestvalue = relative ? max(0, min(255, sectors[i].lightlevel + destvalue)) : destvalue; + P_FadeLightBySector(§ors[i], realdestvalue, speed, ticbased); } } diff --git a/src/p_local.h b/src/p_local.h index ba8cbe166..f50606117 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -148,7 +148,6 @@ boolean P_PlayerShouldUseSpinHeight(player_t *player); boolean P_IsObjectInGoop(mobj_t *mo); boolean P_IsObjectOnGround(mobj_t *mo); -boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec); boolean P_InSpaceSector(mobj_t *mo); boolean P_InQuicksand(mobj_t *mo); boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff); @@ -373,7 +372,7 @@ void P_NewChaseDir(mobj_t *actor); boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed_t dist); mobj_t *P_InternalFlickySpawn(mobj_t *actor, mobjtype_t flickytype, fixed_t momz, boolean lookforplayers, SINT8 moveforward); -void P_InternalFlickySetColor(mobj_t *actor, UINT8 extrainfo); +void P_InternalFlickySetColor(mobj_t *actor, UINT8 color); #define P_IsFlickyCenter(type) (type > MT_FLICKY_01 && type < MT_SEED && (type - MT_FLICKY_01) % 2 ? 1 : 0) void P_InternalFlickyBubble(mobj_t *actor); void P_InternalFlickyFly(mobj_t *actor, fixed_t flyspeed, fixed_t targetdist, fixed_t chasez); diff --git a/src/p_map.c b/src/p_map.c index 9f80d92b5..aee13ae7e 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -492,7 +492,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object) switch (spring->type) { case MT_FAN: // fan - if (zdist > (spring->health << FRACBITS)) // max z distance determined by health (set by map thing angle) + if (zdist > (spring->health << FRACBITS)) // max z distance determined by health (set by map thing args[0]) break; if (flipval*object->momz >= FixedMul(speed, spring->scale)) // if object's already moving faster than your best, don't bother break; @@ -2331,7 +2331,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) mapcampointer = thiscam; - if (GETSECSPECIAL(newsubsec->sector->special, 4) == 12) + if (newsubsec->sector->flags & MSF_NOCLIPCAMERA) { // Camera noclip on entire sector. tmfloorz = tmdropoffz = thiscam->z; tmceilingz = tmdrpoffceilz = thiscam->z + thiscam->height; @@ -2371,7 +2371,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) for (rover = newsubsec->sector->ffloors; rover; rover = rover->next) { fixed_t topheight, bottomheight; - if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) + if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || (rover->master->frontsector->flags & MSF_NOCLIPCAMERA)) continue; topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, x, y, NULL); @@ -2443,7 +2443,7 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) // We're inside it! Yess... polysec = po->lines[0]->backsector; - if (GETSECSPECIAL(polysec->special, 4) == 12) + if (polysec->flags & MSF_NOCLIPCAMERA) { // Camera noclip polyobj. plink = (polymaplink_t *)(plink->link.next); continue; @@ -2711,14 +2711,14 @@ increment_move if (thing->player) { - // If using type Section1:13, double the maxstep. - if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13) - || GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13) + // If using SSF_DOUBLESTEPUP, double the maxstep. + if (P_PlayerTouchingSectorSpecialFlag(thing->player, SSF_DOUBLESTEPUP) + || (R_PointInSubsector(x, y)->sector->specialflags & SSF_DOUBLESTEPUP)) maxstep <<= 1; - // If using type Section1:14, no maxstep. - if (P_PlayerTouchingSectorSpecial(thing->player, 1, 14) - || GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14) + // If using SSF_NOSTEPDOWN, no maxstep. + if (P_PlayerTouchingSectorSpecialFlag(thing->player, SSF_NOSTEPDOWN) + || (R_PointInSubsector(x, y)->sector->specialflags & SSF_NOSTEPDOWN)) maxstep = 0; // Don't 'step up' while springing, @@ -2729,12 +2729,12 @@ increment_move } else if (thing->flags & MF_PUSHABLE) { - // If using type Section1:13, double the maxstep. - if (GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13) + // If using SSF_DOUBLESTEPUP, double the maxstep. + if (R_PointInSubsector(x, y)->sector->specialflags & SSF_DOUBLESTEPUP) maxstep <<= 1; - // If using type Section1:14, no maxstep. - if (GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14) + // If using SSF_NOSTEPDOWN, no maxstep. + if (R_PointInSubsector(x, y)->sector->specialflags & SSF_NOSTEPDOWN) maxstep = 0; } @@ -3498,7 +3498,7 @@ static boolean PTR_SlideTraverse(intercept_t *in) // see if it is closer than best so far if (li->polyobj && slidemo->player) { - if ((li->polyobj->lines[0]->backsector->flags & SF_TRIGGERSPECIAL_TOUCH) && !(li->polyobj->flags & POF_NOSPECIALS)) + if ((li->polyobj->lines[0]->backsector->flags & MSF_TRIGGERSPECIAL_TOUCH) && !(li->polyobj->flags & POF_NOSPECIALS)) P_ProcessSpecialSector(slidemo->player, slidemo->subsector->sector, li->polyobj->lines[0]->backsector); } @@ -3637,10 +3637,7 @@ static void P_CheckLavaWall(mobj_t *mo, sector_t *sec) if (!(rover->flags & FF_SWIMMABLE)) continue; - if (GETSECSPECIAL(rover->master->frontsector->special, 1) != 3) - continue; - - if (rover->master->flags & ML_BLOCKMONSTERS) + if (rover->master->frontsector->damagetype != SD_LAVA) continue; topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y); diff --git a/src/p_maputl.c b/src/p_maputl.c index 43a7e92a1..614db93e3 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -374,7 +374,7 @@ void P_CameraLineOpening(line_t *linedef) for (rover = front->ffloors; rover; rover = rover->next) { fixed_t topheight, bottomheight; - if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) + if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || (rover->master->frontsector->flags & MSF_NOCLIPCAMERA)) continue; topheight = P_CameraGetFOFTopZ(mapcampointer, front, rover, tmx, tmy, linedef); @@ -398,7 +398,7 @@ void P_CameraLineOpening(line_t *linedef) for (rover = back->ffloors; rover; rover = rover->next) { fixed_t topheight, bottomheight; - if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) + if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_RENDERALL) || !(rover->flags & FF_EXISTS) || (rover->master->frontsector->flags & MSF_NOCLIPCAMERA)) continue; topheight = P_CameraGetFOFTopZ(mapcampointer, back, rover, tmx, tmy, linedef); @@ -491,7 +491,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) fixed_t thingtop = mobj->z + mobj->height; // Check for collision with front side's midtexture if Effect 4 is set - if (linedef->flags & ML_EFFECT4 + if (linedef->flags & ML_MIDSOLID && !linedef->polyobj // don't do anything for polyobjects! ...for now ) { side_t *side = &sides[linedef->sidenum[0]]; @@ -508,10 +508,10 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) // don't remove this code unless solid midtextures // on non-solid polyobjects should NEVER happen in the future if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) { - if (linedef->flags & ML_EFFECT5 && !side->repeatcnt) { // "infinite" repeat + if (linedef->flags & ML_WRAPMIDTEX && !side->repeatcnt) { // "infinite" repeat texbottom = back->floorheight + side->rowoffset; textop = back->ceilingheight + side->rowoffset; - } else if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) { + } else if (linedef->flags & ML_MIDTEX) { texbottom = back->floorheight + side->rowoffset; textop = texbottom + texheight*(side->repeatcnt+1); } else { @@ -521,10 +521,10 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) } else #endif { - if (linedef->flags & ML_EFFECT5 && !side->repeatcnt) { // "infinite" repeat + if (linedef->flags & ML_WRAPMIDTEX && !side->repeatcnt) { // "infinite" repeat texbottom = openbottom + side->rowoffset; textop = opentop + side->rowoffset; - } else if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) { + } else if (linedef->flags & ML_MIDPEG) { texbottom = openbottom + side->rowoffset; textop = texbottom + texheight*(side->repeatcnt+1); } else { diff --git a/src/p_mobj.c b/src/p_mobj.c index e88cd4b9f..36253569b 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11,6 +11,7 @@ /// \file p_mobj.c /// \brief Moving object handling. Spawn functions +#include "dehacked.h" #include "doomdef.h" #include "g_game.h" #include "g_input.h" @@ -1445,6 +1446,7 @@ fixed_t P_GetMobjGravity(mobj_t *mo) if (mo->subsector->sector->ffloors) // Check for 3D floor gravity too. { ffloor_t *rover; + fixed_t gravfactor; for (rover = mo->subsector->sector->ffloors; rover; rover = rover->next) { @@ -1454,13 +1456,14 @@ fixed_t P_GetMobjGravity(mobj_t *mo) if ((rover->flags & (FF_SWIMMABLE|FF_GOOWATER)) == (FF_SWIMMABLE|FF_GOOWATER)) goopgravity = true; - if (!(rover->master->frontsector->gravity)) + gravfactor = P_GetSectorGravityFactor(rover->master->frontsector); + + if (gravfactor == FRACUNIT) continue; - gravityadd = -FixedMul(gravity, - (FixedDiv(*rover->master->frontsector->gravity>>FRACBITS, 1000))); + gravityadd = -FixedMul(gravity, gravfactor); - if (rover->master->frontsector->verticalflip && gravityadd > 0) + if ((rover->master->frontsector->flags & MSF_GRAVITYFLIP) && gravityadd > 0) mo->eflags |= MFE_VERTICALFLIP; no3dfloorgrav = false; @@ -1470,13 +1473,9 @@ fixed_t P_GetMobjGravity(mobj_t *mo) if (no3dfloorgrav) { - if (mo->subsector->sector->gravity) - gravityadd = -FixedMul(gravity, - (FixedDiv(*mo->subsector->sector->gravity>>FRACBITS, 1000))); - else - gravityadd = -gravity; + gravityadd = -FixedMul(gravity, P_GetSectorGravityFactor(mo->subsector->sector)); - if (mo->subsector->sector->verticalflip && gravityadd > 0) + if ((mo->subsector->sector->flags & MSF_GRAVITYFLIP) && gravityadd > 0) mo->eflags |= MFE_VERTICALFLIP; } @@ -1721,8 +1720,7 @@ static void P_PushableCheckBustables(mobj_t *mo) if (!(rover->flags & FF_BUSTUP)) continue; - // Needs ML_EFFECT4 flag for pushables to break it - if (!(rover->master->flags & ML_EFFECT4)) + if (!(rover->bustflags & FB_PUSHABLES)) continue; if (rover->master->frontsector->crumblestate != CRUMBLE_NONE) @@ -1732,7 +1730,7 @@ static void P_PushableCheckBustables(mobj_t *mo) bottomheight = P_GetFOFBottomZ(mo, node->m_sector, rover, mo->x, mo->y, NULL); // Height checks - if (rover->flags & FF_SHATTERBOTTOM) + if (rover->bustflags & FB_ONLYBOTTOM) { if (mo->z + mo->momz + mo->height < bottomheight) continue; @@ -1740,36 +1738,42 @@ static void P_PushableCheckBustables(mobj_t *mo) if (mo->z + mo->height > bottomheight) continue; } - else if (rover->flags & FF_SPINBUST) - { - if (mo->z + mo->momz > topheight) - continue; - - if (mo->z + mo->height < bottomheight) - continue; - } - else if (rover->flags & FF_SHATTER) - { - if (mo->z + mo->momz > topheight) - continue; - - if (mo->z + mo->momz + mo->height < bottomheight) - continue; - } else { - if (mo->z >= topheight) - continue; + switch (rover->busttype) + { + case BT_TOUCH: + if (mo->z + mo->momz > topheight) + continue; - if (mo->z + mo->height < bottomheight) - continue; + if (mo->z + mo->momz + mo->height < bottomheight) + continue; + + break; + case BT_SPINBUST: + if (mo->z + mo->momz > topheight) + continue; + + if (mo->z + mo->height < bottomheight) + continue; + + break; + default: + if (mo->z >= topheight) + continue; + + if (mo->z + mo->height < bottomheight) + continue; + + break; + } } EV_CrumbleChain(NULL, rover); // node->m_sector // Run a linedef executor?? - if (rover->master->flags & ML_EFFECT5) - P_LinedefExecute((INT16)(P_AproxDistance(rover->master->dx, rover->master->dy)>>FRACBITS), mo, node->m_sector); + if (rover->bustflags & FB_EXECUTOR) + P_LinedefExecute(rover->busttag, mo, node->m_sector); goto bustupdone; } @@ -2318,11 +2322,11 @@ boolean P_CheckDeathPitCollide(mobj_t *mo) return false; if (((mo->z <= mo->subsector->sector->floorheight - && ((mo->subsector->sector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || !(mo->eflags & MFE_VERTICALFLIP)) && (mo->subsector->sector->flags & SF_FLIPSPECIAL_FLOOR)) + && ((mo->subsector->sector->flags & MSF_TRIGGERSPECIAL_HEADBUMP) || !(mo->eflags & MFE_VERTICALFLIP)) && (mo->subsector->sector->flags & MSF_FLIPSPECIAL_FLOOR)) || (mo->z + mo->height >= mo->subsector->sector->ceilingheight - && ((mo->subsector->sector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || (mo->eflags & MFE_VERTICALFLIP)) && (mo->subsector->sector->flags & SF_FLIPSPECIAL_CEILING))) - && (GETSECSPECIAL(mo->subsector->sector->special, 1) == 6 - || GETSECSPECIAL(mo->subsector->sector->special, 1) == 7)) + && ((mo->subsector->sector->flags & MSF_TRIGGERSPECIAL_HEADBUMP) || (mo->eflags & MFE_VERTICALFLIP)) && (mo->subsector->sector->flags & MSF_FLIPSPECIAL_CEILING))) + && (mo->subsector->sector->damagetype == SD_DEATHPITTILT + || mo->subsector->sector->damagetype == SD_DEATHPITNOTILT)) return true; return false; @@ -2330,11 +2334,7 @@ boolean P_CheckDeathPitCollide(mobj_t *mo) boolean P_CheckSolidLava(ffloor_t *rover) { - if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3 - && !(rover->master->flags & ML_BLOCKMONSTERS)) - return true; - - return false; + return (rover->flags & FF_SWIMMABLE) && (rover->master->frontsector->damagetype == SD_LAVA); } // @@ -2675,7 +2675,7 @@ boolean P_ZMovement(mobj_t *mo) { if (mo->flags2 & MF2_AMBUSH) { - // If deafed, give the tumbleweed another random kick if it runs out of steam. + // Give the tumbleweed another random kick if it runs out of steam. mom.z += P_MobjFlip(mo)*FixedMul(6*FRACUNIT, mo->scale); if (P_RandomChance(FRACUNIT/2)) @@ -2840,7 +2840,7 @@ static void P_CheckMarioBlocks(mobj_t *mo) if (*rover->bottomheight != mo->ceilingz) continue; - if (rover->flags & FF_SHATTERBOTTOM) // Brick block! + if (rover->flags & FF_GOOWATER) // Brick block! EV_CrumbleChain(node->m_sector, rover); else // Question block! EV_MarioBlock(rover, node->m_sector, mo); @@ -3301,7 +3301,7 @@ void P_MobjCheckWater(mobj_t *mobj) if (mobj->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER)) { - if (GETSECSPECIAL(rover->master->frontsector->special, 1) == 3) + if (rover->master->frontsector->damagetype == SD_FIRE || rover->master->frontsector->damagetype == SD_LAVA) mobj->eflags |= MFE_TOUCHLAVA; if (rover->flags & FF_GOOWATER && !(mobj->flags & MF_NOGRAVITY)) @@ -3545,19 +3545,16 @@ static boolean P_CameraCheckHeat(camera_t *thiscam) { sector_t *sector; fixed_t halfheight = thiscam->z + (thiscam->height >> 1); - size_t i; // see if we are in water sector = thiscam->subsector->sector; - for (i = 0; i < sector->tags.count; i++) - if (Tag_FindLineSpecial(13, sector->tags.tags[i]) != -1) - return true; + if (sector->flags & MSF_HEATWAVE) + return true; if (sector->ffloors) { ffloor_t *rover; - size_t j; for (rover = sector->ffloors; rover; rover = rover->next) { @@ -3569,8 +3566,7 @@ static boolean P_CameraCheckHeat(camera_t *thiscam) if (halfheight <= P_GetFFloorBottomZAt(rover, thiscam->x, thiscam->y)) continue; - for (j = 0; j < rover->master->frontsector->tags.count; j++) - if (Tag_FindLineSpecial(13, rover->master->frontsector->tags.tags[j]) != -1) + if (rover->master->frontsector->flags & MSF_HEATWAVE) return true; } } @@ -4096,9 +4092,11 @@ static void P_KillRingsInLava(mobj_t *mo) { if (!(rover->flags & FF_EXISTS)) continue; // fof must be real - if (!(rover->flags & FF_SWIMMABLE // fof must be water - && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3)) // fof must be lava water - continue; + if (!(rover->flags & FF_SWIMMABLE)) + continue; // fof must be water + + if (rover->master->frontsector->damagetype != SD_FIRE && rover->master->frontsector->damagetype != SD_LAVA) + continue; // fof must have fire or lava damage // find heights of FOF topheight = P_GetFOFTopZ(mo, node->m_sector, rover, mo->x, mo->y, NULL); @@ -4341,7 +4339,8 @@ static void P_Boss2Thinker(mobj_t *mobj) { mobj->flags &= ~MF_NOGRAVITY; A_Boss2Pogo(mobj); - P_LinedefExecute(LE_PINCHPHASE, mobj, NULL); + if (mobj->spawnpoint) + P_LinedefExecute(mobj->spawnpoint->args[4], mobj, NULL); } } @@ -4470,7 +4469,8 @@ static void P_Boss3Thinker(mobj_t *mobj) dummy->cusval = mobj->cusval; CONS_Debug(DBG_GAMELOGIC, "Eggman path %d - Dummy selected paths %d and %d\n", way0, way1, way2); - P_LinedefExecute(LE_PINCHPHASE+(mobj->cusval*LE_PARAMWIDTH), mobj, NULL); + if (mobj->spawnpoint) + P_LinedefExecute(mobj->spawnpoint->args[3], mobj, NULL); } } else if (mobj->movecount) // Firing mode @@ -4512,27 +4512,21 @@ static void P_Boss3Thinker(mobj_t *mobj) if (!(mobj->flags2 & MF2_STRONGBOX)) { - thinker_t *th; mobj_t *mo2; + INT32 i; P_SetTarget(&mobj->tracer, NULL); - // scan the thinkers - // to find a point that matches - // the number - for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) + // Find waypoint + TAG_ITER_THINGS(mobj->cusval, i) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) - continue; + mo2 = mapthings[i].mobj; - mo2 = (mobj_t *)th; + if (!mo2) + continue; if (mo2->type != MT_BOSS3WAYPOINT) continue; - if (!mo2->spawnpoint) - continue; - if (mo2->spawnpoint->angle != mobj->threshold) - continue; - if (mo2->spawnpoint->extrainfo != mobj->cusval) + if (mapthings[i].args[0] != mobj->threshold) continue; P_SetTarget(&mobj->tracer, mo2); @@ -4636,12 +4630,14 @@ static void P_Boss3Thinker(mobj_t *mobj) // Move Boss4's sectors by delta. static boolean P_Boss4MoveCage(mobj_t *mobj, fixed_t delta) { - const UINT16 tag = 65534 + (mobj->spawnpoint ? mobj->spawnpoint->extrainfo*LE_PARAMWIDTH : 0); INT32 snum; sector_t *sector; boolean gotcage = false; - TAG_ITER_SECTORS(tag, snum) + if (!mobj->spawnpoint) + return false; + + TAG_ITER_SECTORS(mobj->spawnpoint->args[4], snum) { sector = §ors[snum]; sector->floorheight += delta; @@ -4720,13 +4716,15 @@ static void P_Boss4PinchSpikeballs(mobj_t *mobj, angle_t angle, fixed_t dz) // Destroy cage FOFs. static void P_Boss4DestroyCage(mobj_t *mobj) { - const UINT16 tag = 65534 + (mobj->spawnpoint ? mobj->spawnpoint->extrainfo*LE_PARAMWIDTH : 0); INT32 snum; size_t a; sector_t *sector, *rsec; ffloor_t *rover; - TAG_ITER_SECTORS(tag, snum) + if (!mobj->spawnpoint) + return; + + TAG_ITER_SECTORS(mobj->spawnpoint->args[4], snum) { sector = §ors[snum]; @@ -4999,13 +4997,15 @@ static void P_Boss4Thinker(mobj_t *mobj) { // Proceed to pinch phase! P_Boss4DestroyCage(mobj); mobj->movedir = 3; - P_LinedefExecute(LE_PINCHPHASE + (mobj->spawnpoint ? mobj->spawnpoint->extrainfo*LE_PARAMWIDTH : 0), mobj, NULL); + if (mobj->spawnpoint) + P_LinedefExecute(mobj->spawnpoint->args[4], mobj, NULL); P_Boss4MoveSpikeballs(mobj, FixedAngle(mobj->movecount), 0); var1 = 3; A_BossJetFume(mobj); return; } - P_LinedefExecute(LE_BOSS4DROP - (mobj->info->spawnhealth-mobj->health) + (mobj->spawnpoint ? mobj->spawnpoint->extrainfo*LE_PARAMWIDTH : 0), mobj, NULL); + if (mobj->spawnpoint) + P_LinedefExecute(mobj->spawnpoint->args[5] - (mobj->info->spawnhealth-mobj->health), mobj, NULL); // 1 -> 1.5 second timer mobj->threshold = TICRATE+(TICRATE*(mobj->info->spawnhealth-mobj->health)/10); if (mobj->threshold < 1) @@ -5037,7 +5037,8 @@ static void P_Boss4Thinker(mobj_t *mobj) { // Proceed to pinch phase! P_Boss4DestroyCage(mobj); mobj->movedir = 3; - P_LinedefExecute(LE_PINCHPHASE + (mobj->spawnpoint ? mobj->spawnpoint->extrainfo*LE_PARAMWIDTH : 0), mobj, NULL); + if (mobj->spawnpoint) + P_LinedefExecute(mobj->spawnpoint->args[4], mobj, NULL); var1 = 3; A_BossJetFume(mobj); return; @@ -5177,7 +5178,8 @@ static void P_Boss7Thinker(mobj_t *mobj) // Begin platform destruction mobj->flags2 |= MF2_FRET; P_SetMobjState(mobj, mobj->info->raisestate); - P_LinedefExecute(LE_PINCHPHASE, mobj, NULL); + if (mobj->spawnpoint) + P_LinedefExecute(mobj->spawnpoint->args[4], mobj, NULL); } } else if (mobj->state == &states[S_BLACKEGG_HITFACE4] && mobj->tics == mobj->state->tics) @@ -5267,11 +5269,10 @@ static void P_Boss7Thinker(mobj_t *mobj) fixed_t vertical, horizontal; fixed_t airtime = 5*TICRATE; INT32 waypointNum = 0; - thinker_t *th; - INT32 i; + INT32 i, j; boolean foundgoop = false; INT32 closestNum; - UINT8 extrainfo = (mobj->spawnpoint ? mobj->spawnpoint->extrainfo : 0); + UINT8 bossid = (mobj->spawnpoint ? mobj->spawnpoint->args[0] : 0); // Looks for players in goop. If you find one, try to jump on him. for (i = 0; i < MAXPLAYERS; i++) @@ -5291,19 +5292,15 @@ static void P_Boss7Thinker(mobj_t *mobj) closestdist = INT32_MAX; // Just in case... // Find waypoint he is closest to - for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) + TAG_ITER_THINGS(bossid, j) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) - continue; + mo2 = mapthings[j].mobj; - mo2 = (mobj_t *)th; + if (!mo2) + continue; if (mo2->type != MT_BOSS3WAYPOINT) continue; - if (!mo2->spawnpoint) - continue; - if (mo2->spawnpoint->extrainfo != extrainfo) - continue; - if (mobj->health <= mobj->info->damage && !(mo2->spawnpoint->options & 7)) + if (mobj->health <= mobj->info->damage && !mapthings[j].args[1]) continue; // don't jump to center dist = P_AproxDistance(players[i].mo->x - mo2->x, players[i].mo->y - mo2->y); @@ -5311,7 +5308,7 @@ static void P_Boss7Thinker(mobj_t *mobj) if (!(closestNum == -1 || dist < closestdist)) continue; - closestNum = (mo2->spawnpoint->options & 7); + closestNum = mapthings[j].args[1]; closestdist = dist; foundgoop = true; } @@ -5331,7 +5328,7 @@ static void P_Boss7Thinker(mobj_t *mobj) } if (mobj->tracer && mobj->tracer->type == MT_BOSS3WAYPOINT - && mobj->tracer->spawnpoint && (mobj->tracer->spawnpoint->options & 7) == waypointNum) + && mobj->tracer->spawnpoint && mobj->tracer->spawnpoint->args[1] == waypointNum) { if (P_RandomChance(FRACUNIT/2)) waypointNum++; @@ -5344,28 +5341,25 @@ static void P_Boss7Thinker(mobj_t *mobj) waypointNum = ((waypointNum + 5) % 5); } - // scan the thinkers to find - // the waypoint to use - for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) + // Scan mapthings to find the waypoint to use + TAG_ITER_THINGS(bossid, i) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + mo2 = mapthings[i].mobj; + + if (!mo2) continue; - mo2 = (mobj_t *)th; if (mo2->type != MT_BOSS3WAYPOINT) continue; - if (!mo2->spawnpoint) - continue; - if ((mo2->spawnpoint->options & 7) != waypointNum) - continue; - if (mo2->spawnpoint->extrainfo != extrainfo) + + if (mapthings[i].args[1] != waypointNum) continue; hitspot = mo2; break; } - if (hitspot == NULL) + if (!hitspot) { CONS_Debug(DBG_GAMELOGIC, "BlackEggman unable to find waypoint #%d!\n", waypointNum); P_SetMobjState(mobj, mobj->info->spawnstate); @@ -6034,7 +6028,8 @@ static void P_Boss9Thinker(mobj_t *mobj) mobj->watertop = mobj->floorz + 16*FRACUNIT; else mobj->watertop = mobj->target->floorz + 16*FRACUNIT; - P_LinedefExecute(LE_PINCHPHASE, mobj, NULL); + if (mobj->spawnpoint) + P_LinedefExecute(mobj->spawnpoint->args[4], mobj, NULL); #if 0 whoosh = P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_GHOST); // done here so the offset is correct @@ -6933,7 +6928,6 @@ static void P_RemoveOverlay(mobj_t *thing) } } -void A_BossDeath(mobj_t *mo); // AI for the Koopa boss. static void P_KoopaThinker(mobj_t *koopa) { @@ -6941,7 +6935,8 @@ static void P_KoopaThinker(mobj_t *koopa) if (koopa->watertop > koopa->z + koopa->height + FixedMul(128*FRACUNIT, koopa->scale) && koopa->health > 0) { - A_BossDeath(koopa); + if (koopa->spawnpoint) + EV_DoCeiling(koopa->spawnpoint->args[0], NULL, raiseToHighest); P_RemoveMobj(koopa); return; } @@ -7225,8 +7220,7 @@ static void P_FlameJetSceneryThink(mobj_t *mobj) else flame->angle += FixedAngle(mobj->fuse<movedir; + strength = (mobj->movedir ? mobj->movedir : 80)<<(FRACBITS-2); P_InstaThrust(flame, flame->angle, strength); S_StartSound(flame, sfx_fire); @@ -7256,8 +7250,7 @@ static void P_VerticalFlameJetSceneryThink(mobj_t *mobj) flame = P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_FLAMEJETFLAME); - strength = 20*FRACUNIT; - strength -= ((20*FRACUNIT)/16)*mobj->movedir; + strength = (mobj->movedir ? mobj->movedir : 80)<<(FRACBITS-2); // If deaf'd, the object spawns on the ceiling. if (mobj->flags2 & MF2_AMBUSH) @@ -7291,8 +7284,22 @@ static boolean P_ParticleGenSceneryThink(mobj_t *mobj) mobj->fuse = (tic_t)mobj->reactiontime; - bottomheight = lines[line].frontsector->floorheight; - topheight = lines[line].frontsector->ceilingheight - mobjinfo[(mobjtype_t)type].height; + if (line != -1) + { + bottomheight = lines[line].frontsector->floorheight; + topheight = lines[line].frontsector->ceilingheight - mobjinfo[(mobjtype_t)type].height; + } + else if (mobj->flags2 & MF2_OBJECTFLIP) + { + bottomheight = mobj->z - mobj->extravalue1; + topheight = mobj->z - mobjinfo[(mobjtype_t)type].height; + } + else + { + bottomheight = mobj->z; + topheight = mobj->z + mobj->extravalue1 - mobjinfo[(mobjtype_t)type].height; + } + if (mobj->waterbottom != bottomheight || mobj->watertop != topheight) { @@ -7301,7 +7308,8 @@ static boolean P_ParticleGenSceneryThink(mobj_t *mobj) else mobj->health = 0; - mobj->z = ((mobj->flags2 & MF2_OBJECTFLIP) ? topheight : bottomheight); + if (line != -1) + mobj->z = ((mobj->flags2 & MF2_OBJECTFLIP) ? topheight : bottomheight); } if (!mobj->health) @@ -8584,9 +8592,9 @@ static boolean P_EggRobo1Think(mobj_t *mobj) { fixed_t basex = mobj->cusval, basey = mobj->cvmem; - if (mobj->spawnpoint && mobj->spawnpoint->options & (MTF_AMBUSH|MTF_OBJECTSPECIAL)) + if (mobj->spawnpoint && mobj->spawnpoint->args[0] != TMED_NONE) { - angle_t sideang = mobj->movedir + ((mobj->spawnpoint->options & MTF_AMBUSH) ? ANGLE_90 : -ANGLE_90); + angle_t sideang = mobj->movedir + ((mobj->spawnpoint->args[0] == TMED_LEFT) ? ANGLE_90 : -ANGLE_90); fixed_t oscillate = FixedMul(FINESINE(((leveltime * ANG1) >> (ANGLETOFINESHIFT + 2)) & FINEMASK), 250*mobj->scale); basex += P_ReturnThrustX(mobj, sideang, oscillate); basey += P_ReturnThrustY(mobj, sideang, oscillate); @@ -8681,245 +8689,242 @@ static boolean P_EggRobo1Think(mobj_t *mobj) static void P_NiGHTSDroneThink(mobj_t *mobj) { + mobj_t *goalpost = NULL; + mobj_t *sparkle = NULL; + mobj_t *droneman = NULL; + + boolean flip = mobj->flags2 & MF2_OBJECTFLIP; + boolean topaligned = (mobj->flags & MF_SLIDEME) && !(mobj->flags & MF_GRENADEBOUNCE); + boolean middlealigned = (mobj->flags & MF_GRENADEBOUNCE) && !(mobj->flags & MF_SLIDEME); + boolean bottomoffsetted = !(mobj->flags & MF_SLIDEME) && !(mobj->flags & MF_GRENADEBOUNCE); + boolean flipchanged = false; + + fixed_t dronemanoffset, goaloffset, sparkleoffset, droneboxmandiff, dronemangoaldiff; + + if (mobj->target && mobj->target->type == MT_NIGHTSDRONE_GOAL) { - // variable setup - mobj_t *goalpost = NULL; - mobj_t *sparkle = NULL; - mobj_t *droneman = NULL; + goalpost = mobj->target; + if (goalpost->target && goalpost->target->type == MT_NIGHTSDRONE_SPARKLING) + sparkle = goalpost->target; + if (goalpost->tracer && goalpost->tracer->type == MT_NIGHTSDRONE_MAN) + droneman = goalpost->tracer; + } - boolean flip = mobj->flags2 & MF2_OBJECTFLIP; - boolean topaligned = (mobj->flags & MF_SLIDEME) && !(mobj->flags & MF_GRENADEBOUNCE); - boolean middlealigned = (mobj->flags & MF_GRENADEBOUNCE) && !(mobj->flags & MF_SLIDEME); - boolean bottomoffsetted = !(mobj->flags & MF_SLIDEME) && !(mobj->flags & MF_GRENADEBOUNCE); - boolean flipchanged = false; + if (!goalpost || !sparkle || !droneman) + return; - fixed_t dronemanoffset, goaloffset, sparkleoffset, droneboxmandiff, dronemangoaldiff; + // did NIGHTSDRONE position, scale, flip, or flags change? all elements need to be synced + droneboxmandiff = max(mobj->height - droneman->height, 0); + dronemangoaldiff = max(droneman->height - goalpost->height, 0); - if (mobj->target && mobj->target->type == MT_NIGHTSDRONE_GOAL) + if (!(goalpost->flags2 & MF2_OBJECTFLIP) && (mobj->flags2 & MF2_OBJECTFLIP)) + { + goalpost->eflags |= MFE_VERTICALFLIP; + goalpost->flags2 |= MF2_OBJECTFLIP; + sparkle->eflags |= MFE_VERTICALFLIP; + sparkle->flags2 |= MF2_OBJECTFLIP; + droneman->eflags |= MFE_VERTICALFLIP; + droneman->flags2 |= MF2_OBJECTFLIP; + flipchanged = true; + } + else if ((goalpost->flags2 & MF2_OBJECTFLIP) && !(mobj->flags2 & MF2_OBJECTFLIP)) + { + goalpost->eflags &= ~MFE_VERTICALFLIP; + goalpost->flags2 &= ~MF2_OBJECTFLIP; + sparkle->eflags &= ~MFE_VERTICALFLIP; + sparkle->flags2 &= ~MF2_OBJECTFLIP; + droneman->eflags &= ~MFE_VERTICALFLIP; + droneman->flags2 &= ~MF2_OBJECTFLIP; + flipchanged = true; + } + + if (goalpost->destscale != mobj->destscale + || goalpost->movefactor != mobj->z + || goalpost->friction != mobj->height + || flipchanged + || goalpost->threshold != (INT32)(mobj->flags & (MF_SLIDEME|MF_GRENADEBOUNCE))) + { + goalpost->destscale = sparkle->destscale = droneman->destscale = mobj->destscale; + + // straight copy-pasta from P_SpawnMapThing, case MT_NIGHTSDRONE + if (!flip) { - goalpost = mobj->target; - if (goalpost->target && goalpost->target->type == MT_NIGHTSDRONE_SPARKLING) - sparkle = goalpost->target; - if (goalpost->tracer && goalpost->tracer->type == MT_NIGHTSDRONE_MAN) - droneman = goalpost->tracer; - } - - if (!goalpost || !sparkle || !droneman) - return; - - // did NIGHTSDRONE position, scale, flip, or flags change? all elements need to be synced - droneboxmandiff = max(mobj->height - droneman->height, 0); - dronemangoaldiff = max(droneman->height - goalpost->height, 0); - - if (!(goalpost->flags2 & MF2_OBJECTFLIP) && (mobj->flags2 & MF2_OBJECTFLIP)) - { - goalpost->eflags |= MFE_VERTICALFLIP; - goalpost->flags2 |= MF2_OBJECTFLIP; - sparkle->eflags |= MFE_VERTICALFLIP; - sparkle->flags2 |= MF2_OBJECTFLIP; - droneman->eflags |= MFE_VERTICALFLIP; - droneman->flags2 |= MF2_OBJECTFLIP; - flipchanged = true; - } - else if ((goalpost->flags2 & MF2_OBJECTFLIP) && !(mobj->flags2 & MF2_OBJECTFLIP)) - { - goalpost->eflags &= ~MFE_VERTICALFLIP; - goalpost->flags2 &= ~MF2_OBJECTFLIP; - sparkle->eflags &= ~MFE_VERTICALFLIP; - sparkle->flags2 &= ~MF2_OBJECTFLIP; - droneman->eflags &= ~MFE_VERTICALFLIP; - droneman->flags2 &= ~MF2_OBJECTFLIP; - flipchanged = true; - } - - if (goalpost->destscale != mobj->destscale - || goalpost->movefactor != mobj->z - || goalpost->friction != mobj->height - || flipchanged - || goalpost->threshold != (INT32)(mobj->flags & (MF_SLIDEME|MF_GRENADEBOUNCE))) - { - goalpost->destscale = sparkle->destscale = droneman->destscale = mobj->destscale; - - // straight copy-pasta from P_SpawnMapThing, case MT_NIGHTSDRONE - if (!flip) + if (topaligned) // Align droneman to top of hitbox { - if (topaligned) // Align droneman to top of hitbox - { - dronemanoffset = droneboxmandiff; - goaloffset = dronemangoaldiff/2 + dronemanoffset; - } - else if (middlealigned) // Align droneman to center of hitbox - { - dronemanoffset = droneboxmandiff/2; - goaloffset = dronemangoaldiff/2 + dronemanoffset; - } - else if (bottomoffsetted) - { - dronemanoffset = 24*FRACUNIT; - goaloffset = dronemangoaldiff + dronemanoffset; - } - else - { - dronemanoffset = 0; - goaloffset = dronemangoaldiff/2 + dronemanoffset; - } - - sparkleoffset = goaloffset - FixedMul(15*FRACUNIT, mobj->scale); + dronemanoffset = droneboxmandiff; + goaloffset = dronemangoaldiff/2 + dronemanoffset; + } + else if (middlealigned) // Align droneman to center of hitbox + { + dronemanoffset = droneboxmandiff/2; + goaloffset = dronemangoaldiff/2 + dronemanoffset; + } + else if (bottomoffsetted) + { + dronemanoffset = 24*FRACUNIT; + goaloffset = dronemangoaldiff + dronemanoffset; } else { - if (topaligned) // Align droneman to top of hitbox - { - dronemanoffset = 0; - goaloffset = dronemangoaldiff/2 + dronemanoffset; - } - else if (middlealigned) // Align droneman to center of hitbox - { - dronemanoffset = droneboxmandiff/2; - goaloffset = dronemangoaldiff/2 + dronemanoffset; - } - else if (bottomoffsetted) - { - dronemanoffset = droneboxmandiff - FixedMul(24*FRACUNIT, mobj->scale); - goaloffset = dronemangoaldiff + dronemanoffset; - } - else - { - dronemanoffset = droneboxmandiff; - goaloffset = dronemangoaldiff/2 + dronemanoffset; - } - - sparkleoffset = goaloffset + FixedMul(15*FRACUNIT, mobj->scale); + dronemanoffset = 0; + goaloffset = dronemangoaldiff/2 + dronemanoffset; } - P_TeleportMove(goalpost, mobj->x, mobj->y, mobj->z + goaloffset); - P_TeleportMove(sparkle, mobj->x, mobj->y, mobj->z + sparkleoffset); - if (goalpost->movefactor != mobj->z || goalpost->friction != mobj->height) - { - P_TeleportMove(droneman, mobj->x, mobj->y, mobj->z + dronemanoffset); - goalpost->movefactor = mobj->z; - goalpost->friction = mobj->height; - } - goalpost->threshold = mobj->flags & (MF_SLIDEME|MF_GRENADEBOUNCE); + sparkleoffset = goaloffset - FixedMul(15*FRACUNIT, mobj->scale); } else { - if (goalpost->x != mobj->x || goalpost->y != mobj->y) + if (topaligned) // Align droneman to top of hitbox { - P_TeleportMove(goalpost, mobj->x, mobj->y, goalpost->z); - P_TeleportMove(sparkle, mobj->x, mobj->y, sparkle->z); + dronemanoffset = 0; + goaloffset = dronemangoaldiff/2 + dronemanoffset; } - - if (droneman->x != mobj->x || droneman->y != mobj->y) - P_TeleportMove(droneman, mobj->x, mobj->y, - droneman->z >= mobj->floorz && droneman->z <= mobj->ceilingz ? droneman->z : mobj->z); - } - - // now toggle states! - // GOAL mode? - if (sparkle->state >= &states[S_NIGHTSDRONE_SPARKLING1] && sparkle->state <= &states[S_NIGHTSDRONE_SPARKLING16]) - { - INT32 i; - boolean bonustime = false; - - for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i] && players[i].bonustime && players[i].powers[pw_carry] == CR_NIGHTSMODE) - { - bonustime = true; - break; - } - - if (!bonustime) + else if (middlealigned) // Align droneman to center of hitbox { - CONS_Debug(DBG_NIGHTSBASIC, "Removing goal post\n"); - if (goalpost && goalpost->state != &states[S_INVISIBLE]) - P_SetMobjState(goalpost, S_INVISIBLE); - if (sparkle && sparkle->state != &states[S_INVISIBLE]) - P_SetMobjState(sparkle, S_INVISIBLE); + dronemanoffset = droneboxmandiff/2; + goaloffset = dronemangoaldiff/2 + dronemanoffset; } - } - // Invisible/bouncing mode. - else - { - INT32 i; - boolean bonustime = false; - fixed_t zcomp; - - // Bouncy bouncy! - if (!flip) + else if (bottomoffsetted) { - if (topaligned) - zcomp = droneboxmandiff + mobj->z; - else if (middlealigned) - zcomp = (droneboxmandiff/2) + mobj->z; - else if (bottomoffsetted) - zcomp = mobj->z + FixedMul(24*FRACUNIT, mobj->scale); - else - zcomp = mobj->z; + dronemanoffset = droneboxmandiff - FixedMul(24*FRACUNIT, mobj->scale); + goaloffset = dronemangoaldiff + dronemanoffset; } else { - if (topaligned) - zcomp = mobj->z; - else if (middlealigned) - zcomp = (droneboxmandiff/2) + mobj->z; - else if (bottomoffsetted) - zcomp = mobj->z + droneboxmandiff - FixedMul(24*FRACUNIT, mobj->scale); - else - zcomp = mobj->z + droneboxmandiff; + dronemanoffset = droneboxmandiff; + goaloffset = dronemangoaldiff/2 + dronemanoffset; } - droneman->angle += ANG10; - if (!flip && droneman->z <= zcomp) - droneman->momz = FixedMul(5*FRACUNIT, droneman->scale); - else if (flip && droneman->z >= zcomp) - droneman->momz = FixedMul(-5*FRACUNIT, droneman->scale); + sparkleoffset = goaloffset + FixedMul(15*FRACUNIT, mobj->scale); + } - // state switching logic + P_TeleportMove(goalpost, mobj->x, mobj->y, mobj->z + goaloffset); + P_TeleportMove(sparkle, mobj->x, mobj->y, mobj->z + sparkleoffset); + if (goalpost->movefactor != mobj->z || goalpost->friction != mobj->height) + { + P_TeleportMove(droneman, mobj->x, mobj->y, mobj->z + dronemanoffset); + goalpost->movefactor = mobj->z; + goalpost->friction = mobj->height; + } + goalpost->threshold = mobj->flags & (MF_SLIDEME|MF_GRENADEBOUNCE); + } + else + { + if (goalpost->x != mobj->x || goalpost->y != mobj->y) + { + P_TeleportMove(goalpost, mobj->x, mobj->y, goalpost->z); + P_TeleportMove(sparkle, mobj->x, mobj->y, sparkle->z); + } + + if (droneman->x != mobj->x || droneman->y != mobj->y) + P_TeleportMove(droneman, mobj->x, mobj->y, + droneman->z >= mobj->floorz && droneman->z <= mobj->ceilingz ? droneman->z : mobj->z); + } + + // now toggle states! + // GOAL mode? + if (sparkle->state >= &states[S_NIGHTSDRONE_SPARKLING1] && sparkle->state <= &states[S_NIGHTSDRONE_SPARKLING16]) + { + INT32 i; + boolean bonustime = false; + + for (i = 0; i < MAXPLAYERS; i++) + if (playeringame[i] && players[i].bonustime && players[i].powers[pw_carry] == CR_NIGHTSMODE) + { + bonustime = true; + break; + } + + if (!bonustime) + { + CONS_Debug(DBG_NIGHTSBASIC, "Removing goal post\n"); + if (goalpost && goalpost->state != &states[S_INVISIBLE]) + P_SetMobjState(goalpost, S_INVISIBLE); + if (sparkle && sparkle->state != &states[S_INVISIBLE]) + P_SetMobjState(sparkle, S_INVISIBLE); + } + } + // Invisible/bouncing mode. + else + { + INT32 i; + boolean bonustime = false; + fixed_t zcomp; + + // Bouncy bouncy! + if (!flip) + { + if (topaligned) + zcomp = droneboxmandiff + mobj->z; + else if (middlealigned) + zcomp = (droneboxmandiff/2) + mobj->z; + else if (bottomoffsetted) + zcomp = mobj->z + FixedMul(24*FRACUNIT, mobj->scale); + else + zcomp = mobj->z; + } + else + { + if (topaligned) + zcomp = mobj->z; + else if (middlealigned) + zcomp = (droneboxmandiff/2) + mobj->z; + else if (bottomoffsetted) + zcomp = mobj->z + droneboxmandiff - FixedMul(24*FRACUNIT, mobj->scale); + else + zcomp = mobj->z + droneboxmandiff; + } + + droneman->angle += ANG10; + if (!flip && droneman->z <= zcomp) + droneman->momz = FixedMul(5*FRACUNIT, droneman->scale); + else if (flip && droneman->z >= zcomp) + droneman->momz = FixedMul(-5*FRACUNIT, droneman->scale); + + // state switching logic + for (i = 0; i < MAXPLAYERS; i++) + if (playeringame[i] && players[i].bonustime && players[i].powers[pw_carry] == CR_NIGHTSMODE) + { + bonustime = true; + break; + } + + if (bonustime) + { + CONS_Debug(DBG_NIGHTSBASIC, "Adding goal post\n"); + if (!(droneman->flags2 & MF2_DONTDRAW)) + droneman->flags2 |= MF2_DONTDRAW; + if (goalpost->state == &states[S_INVISIBLE]) + P_SetMobjState(goalpost, mobjinfo[goalpost->type].meleestate); + if (sparkle->state == &states[S_INVISIBLE]) + P_SetMobjState(sparkle, mobjinfo[sparkle->type].meleestate); + } + else if (!G_IsSpecialStage(gamemap)) + { for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i] && players[i].bonustime && players[i].powers[pw_carry] == CR_NIGHTSMODE) + if (playeringame[i] && players[i].powers[pw_carry] != CR_NIGHTSMODE) { - bonustime = true; + bonustime = true; // variable reuse break; } if (bonustime) { - CONS_Debug(DBG_NIGHTSBASIC, "Adding goal post\n"); + // show droneman if at least one player is non-nights + if (goalpost->state != &states[S_INVISIBLE]) + P_SetMobjState(goalpost, S_INVISIBLE); + if (sparkle->state != &states[S_INVISIBLE]) + P_SetMobjState(sparkle, S_INVISIBLE); + if (droneman->state != &states[mobjinfo[droneman->type].meleestate]) + P_SetMobjState(droneman, mobjinfo[droneman->type].meleestate); + if (droneman->flags2 & MF2_DONTDRAW) + droneman->flags2 &= ~MF2_DONTDRAW; + } + else + { + // else, hide it if (!(droneman->flags2 & MF2_DONTDRAW)) droneman->flags2 |= MF2_DONTDRAW; - if (goalpost->state == &states[S_INVISIBLE]) - P_SetMobjState(goalpost, mobjinfo[goalpost->type].meleestate); - if (sparkle->state == &states[S_INVISIBLE]) - P_SetMobjState(sparkle, mobjinfo[sparkle->type].meleestate); - } - else if (!G_IsSpecialStage(gamemap)) - { - for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i] && players[i].powers[pw_carry] != CR_NIGHTSMODE) - { - bonustime = true; // variable reuse - break; - } - - if (bonustime) - { - // show droneman if at least one player is non-nights - if (goalpost->state != &states[S_INVISIBLE]) - P_SetMobjState(goalpost, S_INVISIBLE); - if (sparkle->state != &states[S_INVISIBLE]) - P_SetMobjState(sparkle, S_INVISIBLE); - if (droneman->state != &states[mobjinfo[droneman->type].meleestate]) - P_SetMobjState(droneman, mobjinfo[droneman->type].meleestate); - if (droneman->flags2 & MF2_DONTDRAW) - droneman->flags2 &= ~MF2_DONTDRAW; - } - else - { - // else, hide it - if (!(droneman->flags2 & MF2_DONTDRAW)) - droneman->flags2 |= MF2_DONTDRAW; - } } } } @@ -9238,6 +9243,118 @@ static void P_DragonbomberThink(mobj_t *mobj) #undef DRAGONTURNSPEED } +static mobj_t *pushmobj; + +#define PUSH_FACTOR 7 + +static inline boolean PIT_PushThing(mobj_t *thing) +{ + if (thing->eflags & MFE_PUSHED) + return false; + + if (thing->player && thing->player->powers[pw_carry] == CR_ROPEHANG) + return false; + + if (!pushmobj) + return false; + + if (!pushmobj->spawnpoint) + return false; + + // Allow this to affect pushable objects at some point? + if (thing->player && !(thing->flags & (MF_NOGRAVITY|MF_NOCLIP))) + { + INT32 dist; + INT32 speed; + INT32 sx = pushmobj->x; + INT32 sy = pushmobj->y; + INT32 sz = pushmobj->z; + fixed_t radius = pushmobj->spawnpoint->args[0] << FRACBITS; + + if (pushmobj->spawnpoint->args[2] & TMPP_NOZFADE) + dist = P_AproxDistance(thing->x - sx, thing->y - sy); + else + { + // Make sure the Z is in range + if (thing->z < sz - radius || thing->z > sz + radius) + return false; + + dist = P_AproxDistance(P_AproxDistance(thing->x - sx, thing->y - sy), thing->z - sz); + } + + speed = (abs(pushmobj->spawnpoint->args[1]) - ((dist>>FRACBITS)>>1))<<(FRACBITS - PUSH_FACTOR - 1); + + // If speed <= 0, you're outside the effective radius. You also have + // to be able to see the push/pull source point. + + // Written with bits and pieces of P_HomingAttack + if ((speed > 0) && (P_CheckSight(thing, pushmobj))) + { + fixed_t tmpmomx, tmpmomy, tmpmomz; + + if (pushmobj->spawnpoint->args[2] & TMPP_PUSHZ) + { + tmpmomx = FixedMul(FixedDiv(sx - thing->x, dist), speed); + tmpmomy = FixedMul(FixedDiv(sy - thing->y, dist), speed); + tmpmomz = FixedMul(FixedDiv(sz - thing->z, dist), speed); + } + else + { + angle_t pushangle = R_PointToAngle2(thing->x, thing->y, sx, sy) >> ANGLETOFINESHIFT; + tmpmomx = FixedMul(speed, FINECOSINE(pushangle)); + tmpmomy = FixedMul(speed, FINESINE(pushangle)); + tmpmomz = 0; + } + + if (pushmobj->spawnpoint->args[1] > 0) // away! + { + tmpmomx *= -1; + tmpmomy *= -1; + tmpmomz *= -1; + } + + thing->momx += tmpmomx; + thing->momy += tmpmomy; + thing->momz += tmpmomz; + + if (thing->player) + { + thing->player->cmomx += tmpmomx; + thing->player->cmomy += tmpmomy; + thing->player->cmomx = FixedMul(thing->player->cmomx, 0xe800); + thing->player->cmomy = FixedMul(thing->player->cmomy, 0xe800); + } + } + } + + if (!(pushmobj->spawnpoint->args[2] & TMPP_NONEXCLUSIVE)) + thing->eflags |= MFE_PUSHED; + + return true; +} + +static void P_PointPushThink(mobj_t *mobj) +{ + INT32 xl, xh, yl, yh, bx, by; + fixed_t radius; + + if (!mobj->spawnpoint) + return; + + // Seek out all pushable things within the force radius of this + // point pusher. Crosses sectors, so use blockmap. + radius = mobj->spawnpoint->args[0] << FRACBITS; + + pushmobj = mobj; + xl = (unsigned)(mobj->x - radius - bmaporgx - MAXRADIUS)>>MAPBLOCKSHIFT; + xh = (unsigned)(mobj->x + radius - bmaporgx + MAXRADIUS)>>MAPBLOCKSHIFT; + yl = (unsigned)(mobj->y - radius - bmaporgy - MAXRADIUS)>>MAPBLOCKSHIFT; + yh = (unsigned)(mobj->y + radius - bmaporgy + MAXRADIUS)>>MAPBLOCKSHIFT; + for (bx = xl; bx <= xh; bx++) + for (by = yl; by <= yh; by++) + P_BlockThingsIterator(bx, by, PIT_PushThing); +} + static boolean P_MobjRegularThink(mobj_t *mobj) { if ((mobj->flags & MF_ENEMY) && (mobj->state->nextstate == mobj->info->spawnstate && mobj->tics == 1)) @@ -9249,7 +9366,8 @@ static boolean P_MobjRegularThink(mobj_t *mobj) switch (mobj->type) { case MT_WALLSPIKEBASE: - if (!mobj->target) { + if (!mobj->target) + { P_RemoveMobj(mobj); return false; } @@ -9616,13 +9734,9 @@ static boolean P_MobjRegularThink(mobj_t *mobj) break; case MT_BLUEFLAG: case MT_REDFLAG: - { - sector_t* sec2; - sec2 = P_ThingOnSpecial3DFloor(mobj); - if ((sec2 && GETSECSPECIAL(sec2->special, 4) == 2) || (GETSECSPECIAL(mobj->subsector->sector->special, 4) == 2)) + if (P_MobjTouchingSectorSpecialFlag(mobj, SSF_RETURNFLAG)) mobj->fuse = 1; // Return to base. break; - } case MT_SPINDUST: // Spindash dust mobj->momx = FixedMul(mobj->momx, (3*FRACUNIT)/4); // originally 50000 mobj->momy = FixedMul(mobj->momy, (3*FRACUNIT)/4); // same @@ -9729,6 +9843,9 @@ static boolean P_MobjRegularThink(mobj_t *mobj) else mobj->rollangle = R_PointToAngle2(0, 0, P_MobjFlip(mobj)*mobj->momz, (mobj->scale << 1) - min(abs(mobj->momz), mobj->scale << 1)); break; + case MT_PUSH: + P_PointPushThink(mobj); + break; case MT_SPINFIRE: if (mobj->flags & MF_NOGRAVITY) { @@ -9953,16 +10070,9 @@ static boolean P_FuseThink(mobj_t *mobj) case MT_METALSONIC_BATTLE: break; // don't remove case MT_SPIKE: - P_SetMobjState(mobj, mobj->state->nextstate); - mobj->fuse = mobj->info->speed; - if (mobj->spawnpoint) - mobj->fuse += mobj->spawnpoint->angle; - break; case MT_WALLSPIKE: P_SetMobjState(mobj, mobj->state->nextstate); - mobj->fuse = mobj->info->speed; - if (mobj->spawnpoint) - mobj->fuse += (mobj->spawnpoint->angle / 360); + mobj->fuse = mobj->spawnpoint ? mobj->spawnpoint->args[0] : mobj->info->speed; break; case MT_NIGHTSCORE: P_RemoveMobj(mobj); @@ -10035,7 +10145,7 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->flags & MF_NOTHINK) return; - if ((mobj->flags & MF_BOSS) && mobj->spawnpoint && (bossdisabled & (1<spawnpoint->extrainfo))) + if ((mobj->flags & MF_BOSS) && mobj->spawnpoint && (bossdisabled & (1<spawnpoint->args[0]))) return; // Remove dead target/tracer. @@ -10052,16 +10162,8 @@ void P_MobjThinker(mobj_t *mobj) tmfloorthing = tmhitthing = NULL; - // Sector special (2,8) allows ANY mobj to trigger a linedef exec - if (mobj->subsector && GETSECSPECIAL(mobj->subsector->sector->special, 2) == 8) - { - sector_t *sec2 = P_ThingOnSpecial3DFloor(mobj); - if (sec2 && GETSECSPECIAL(sec2->special, 2) == 1) - { - mtag_t tag = Tag_FGet(&sec2->tags); - P_LinedefExecute(tag, mobj, sec2); - } - } + // Sector flag MSF_TRIGGERLINE_MOBJ allows ANY mobj to trigger a linedef exec + P_CheckMobjTrigger(mobj, false); if (mobj->scale != mobj->destscale) P_MobjScaleThink(mobj); // Slowly scale up/down to reach your destscale. @@ -10131,10 +10233,12 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->flags2 & MF2_FIRING) P_FiringThink(mobj); - if (mobj->flags & MF_AMBIENT) + if (mobj->type == MT_AMBIENT) { - if (!(leveltime % mobj->health) && mobj->info->seesound) - S_StartSound(mobj, mobj->info->seesound); + if (leveltime % mobj->health) + return; + if (mobj->threshold) + S_StartSound(mobj, mobj->threshold); return; } @@ -10276,28 +10380,10 @@ boolean P_RailThinker(mobj_t *mobj) // Unquick, unoptimized function for pushables void P_PushableThinker(mobj_t *mobj) { - sector_t *sec; - I_Assert(mobj != NULL); I_Assert(!P_MobjWasRemoved(mobj)); - sec = mobj->subsector->sector; - - if (GETSECSPECIAL(sec->special, 2) == 1 && mobj->z == sec->floorheight) - { - mtag_t tag = Tag_FGet(&sec->tags); - P_LinedefExecute(tag, mobj, sec); - } - -// else if (GETSECSPECIAL(sec->special, 2) == 8) - { - sector_t *sec2 = P_ThingOnSpecial3DFloor(mobj); - if (sec2 && GETSECSPECIAL(sec2->special, 2) == 1) - { - mtag_t tag = Tag_FGet(&sec2->tags); - P_LinedefExecute(tag, mobj, sec2); - } - } + P_CheckMobjTrigger(mobj, true); // it has to be pushable RIGHT NOW for this part to happen if (mobj->flags & MF_PUSHABLE && !(mobj->momx || mobj->momy)) @@ -10939,8 +11025,8 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype if (mobj->floorz != starting_floorz) mobj->precipflags |= PCF_FOF; - else if (GETSECSPECIAL(mobj->subsector->sector->special, 1) == 7 - || GETSECSPECIAL(mobj->subsector->sector->special, 1) == 6 + else if (mobj->subsector->sector->damagetype == SD_DEATHPITNOTILT + || mobj->subsector->sector->damagetype == SD_DEATHPITTILT || mobj->subsector->sector->floorpic == skyflatnum) mobj->precipflags |= PCF_PIT; @@ -11167,7 +11253,7 @@ void P_SpawnPrecipitation(void) if (curWeather == PRECIP_SNOW) { // Not in a sector with visible sky -- exception for NiGHTS. - if ((!(maptol & TOL_NIGHTS) && (precipsector->sector->ceilingpic != skyflatnum)) == !(precipsector->sector->flags & SF_INVERTPRECIP)) + if ((!(maptol & TOL_NIGHTS) && (precipsector->sector->ceilingpic != skyflatnum)) == !(precipsector->sector->flags & MSF_INVERTPRECIP)) continue; rainmo = P_SpawnSnowMobj(x, y, height, MT_SNOWFLAKE); @@ -11180,7 +11266,7 @@ void P_SpawnPrecipitation(void) else // everything else. { // Not in a sector with visible sky. - if ((precipsector->sector->ceilingpic != skyflatnum) == !(precipsector->sector->flags & SF_INVERTPRECIP)) + if ((precipsector->sector->ceilingpic != skyflatnum) == !(precipsector->sector->flags & MSF_INVERTPRECIP)) continue; rainmo = P_SpawnRainMobj(x, y, height, MT_RAIN); @@ -11586,9 +11672,9 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) { fixed_t offset = mthing->z << FRACBITS; - // Flagging a player's ambush will make them start on the ceiling + // Setting the spawnpoint's args[0] will make the player start on the ceiling // Objectflip inverts - if (!!(mthing->options & MTF_AMBUSH) ^ !!(mthing->options & MTF_OBJECTFLIP)) + if (!!(mthing->args[0]) ^ !!(mthing->options & MTF_OBJECTFLIP)) z = ceilingspawn - offset; else z = floor + offset; @@ -11598,7 +11684,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing) mobj->eflags |= MFE_VERTICALFLIP; mobj->flags2 |= MF2_OBJECTFLIP; } - if (mthing->options & MTF_AMBUSH) + if (mthing->args[0]) P_SetPlayerMobjState(mobj, S_PLAY_FALL); else if (metalrecording) P_SetPlayerMobjState(mobj, S_PLAY_WAIT); @@ -11712,11 +11798,6 @@ fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mt switch (mobjtype) { - // Bumpers never spawn flipped. - case MT_NIGHTSBUMPER: - flip = false; - break; - // Objects with a non-zero default height. case MT_CRAWLACOMMANDER: case MT_DETON: @@ -11736,14 +11817,14 @@ fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mt dz = 288*FRACUNIT; break; - // Horizontal springs, may float additional units with MTF_AMBUSH. + // Horizontal springs, float additional units unless args[0] is set. case MT_YELLOWHORIZ: case MT_REDHORIZ: case MT_BLUEHORIZ: - offset += mthing->options & MTF_AMBUSH ? 16*FRACUNIT : 0; + offset += mthing->args[0] ? 0 : 16*FRACUNIT; break; - // Ring-like items, may float additional units with MTF_AMBUSH. + // Ring-like items, float additional units unless args[0] is set. case MT_SPIKEBALL: case MT_EMERHUNT: case MT_EMERALDSPAWN: @@ -11757,13 +11838,13 @@ fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mt case MT_BOMBSPHERE: case MT_NIGHTSCHIP: case MT_NIGHTSSTAR: - offset += mthing->options & MTF_AMBUSH ? 24*FRACUNIT : 0; + offset += mthing->args[0] ? 0 : 24*FRACUNIT; break; // Remaining objects. default: if (P_WeaponOrPanel(mobjtype)) - offset += mthing->options & MTF_AMBUSH ? 24*FRACUNIT : 0; + offset += mthing->args[0] ? 0 : 24*FRACUNIT; } if (!(dz + offset)) // Snap to the surfaces when there's no offset set. @@ -11825,8 +11906,8 @@ static boolean P_SpawnNonMobjMapThing(mapthing_t *mthing) return true; } else if (mthing->type == 750 // Slope vertex point (formerly chaos spawn) - || (mthing->type >= 600 && mthing->type <= 609) // Special placement patterns - || mthing->type == 1705 || mthing->type == 1713) // Hoops + || (mthing->type >= 600 && mthing->type <= 611) // Special placement patterns + || mthing->type == 1713) // Hoops return true; // These are handled elsewhere. else if (mthing->type == mobjinfo[MT_EMERHUNT].doomednum) { @@ -11870,7 +11951,7 @@ static boolean P_AllowMobjSpawn(mapthing_t* mthing, mobjtype_t i) runemeraldmanager = true; break; case MT_ROSY: - if (!(G_CoopGametype() || (mthing->options & MTF_EXTRA))) + if (!(G_CoopGametype() || mthing->args[0])) return false; // she doesn't hang out here if (!(netgame || multiplayer) && players[consoleplayer].skin == 3) @@ -11994,7 +12075,7 @@ static mobjtype_t P_GetMobjtypeSubstitute(mapthing_t *mthing, mobjtype_t i) case 2: // Unchanging if (i == MT_MYSTERY_BOX) return MT_NULL; // don't spawn - mthing->options &= ~(MTF_AMBUSH|MTF_OBJECTSPECIAL); // no random respawning! + mthing->args[1] = TMMR_SAME; // no random respawning! return i; case 3: // Don't spawn return MT_NULL; @@ -12024,8 +12105,7 @@ static mobjtype_t P_GetMobjtypeSubstitute(mapthing_t *mthing, mobjtype_t i) if (modeattacking && i == MT_1UP_BOX) // 1UPs -->> Score TVs { - // Either or, doesn't matter which. - if (mthing->options & (MTF_AMBUSH | MTF_OBJECTSPECIAL)) + if (mthing->args[2]) return MT_SCORE10K_BOX; // 10,000 else return MT_SCORE1K_BOX; // 1,000 @@ -12043,7 +12123,7 @@ static boolean P_SetupEmblem(mapthing_t *mthing, mobj_t *mobj) while (emblem) { - if ((emblem->type == ET_GLOBAL || emblem->type == ET_SKIN) && emblem->tag == mthing->angle) + if ((emblem->type == ET_GLOBAL || emblem->type == ET_SKIN) && emblem->tag == Tag_FGet(&mthing->tags)) break; emblem = M_GetLevelEmblems(-1); @@ -12051,7 +12131,7 @@ static boolean P_SetupEmblem(mapthing_t *mthing, mobj_t *mobj) if (!emblem) { - CONS_Debug(DBG_GAMELOGIC, "No map emblem for map %d with tag %d found!\n", gamemap, mthing->angle); + CONS_Debug(DBG_GAMELOGIC, "No map emblem for map %d with tag %d found!\n", gamemap, Tag_FGet(&mthing->tags)); return false; } @@ -12113,59 +12193,20 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj, boolean *doangle) mobjflag_t mflagsapply; mobjflag2_t mflags2apply; mobjeflag_t meflagsapply; - INT32 line; const size_t mthingi = (size_t)(mthing - mapthings); - // Find the corresponding linedef special, using angle as tag - line = Tag_FindLineSpecial(9, mthing->angle); - - if (line == -1) - { - CONS_Debug(DBG_GAMELOGIC, "Mace chain (mapthing #%s) needs to be tagged to a #9 parameter line (trying to find tag %d).\n", sizeu1(mthingi), mthing->angle); - return false; - } - /* - mapthing - - MTF_AMBUSH : - MT_SPRINGBALLPOINT - upgrade from yellow to red spring - anything else - bigger mace/chain theory - MTF_OBJECTSPECIAL - force silent - MTF_GRAVFLIP - flips objects, doesn't affect chain arrangements - Parameter value : number of "spokes" - - linedef - - ML_NOCLIMB : - MT_CHAINPOINT/MT_CHAINMACEPOINT with ML_EFFECT1 applied - Direction not controllable - anything else - no functionality - ML_EFFECT1 : Swings instead of spins - ML_EFFECT2 : Linktype is replaced with macetype for all spokes not ending in chains (inverted for MT_FIREBARPOINT) - ML_EFFECT3 : Spawn a bonus linktype at the hinge point - ML_EFFECT4 : Don't clip inside the ground - ML_EFFECT5 : Don't stop thinking when too far away - */ - mlength = abs(lines[line].dx >> FRACBITS); - mspeed = abs(lines[line].dy >> (FRACBITS - 4)); - mphase = (sides[lines[line].sidenum[0]].textureoffset >> FRACBITS) % 360; - if ((mminlength = -sides[lines[line].sidenum[0]].rowoffset >> FRACBITS) < 0) - mminlength = 0; - else if (mminlength > mlength - 1) - mminlength = mlength - 1; - mpitch = (lines[line].frontsector->floorheight >> FRACBITS) % 360; - myaw = (lines[line].frontsector->ceilingheight >> FRACBITS) % 360; - - mnumspokes = mthing->extrainfo + 1; + mlength = abs(mthing->args[0]); + mnumspokes = mthing->args[1] + 1; mspokeangle = FixedAngle((360*FRACUNIT)/mnumspokes) >> ANGLETOFINESHIFT; - - if (lines[line].backsector) - { - mpinch = (lines[line].backsector->floorheight >> FRACBITS) % 360; - mroll = (lines[line].backsector->ceilingheight >> FRACBITS) % 360; - mnumnospokes = (sides[lines[line].sidenum[1]].textureoffset >> FRACBITS); - if ((mwidth = sides[lines[line].sidenum[1]].rowoffset >> FRACBITS) < 0) - mwidth = 0; - } - else - mpinch = mroll = mnumnospokes = mwidth = 0; + mwidth = max(0, mthing->args[2]); + mspeed = abs(mthing->args[3] << 4); + mphase = mthing->args[4] % 360; + mpinch = mthing->args[5] % 360; + mnumnospokes = mthing->args[6]; + mminlength = max(0, min(mlength - 1, mthing->args[7])); + mpitch = mthing->pitch % 360; + myaw = mthing->angle % 360; + mroll = mthing->roll % 360; CONS_Debug(DBG_GAMELOGIC, "Mace/Chain (mapthing #%s):\n" "Length is %d (minus %d)\n" @@ -12196,26 +12237,23 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj, boolean *doangle) switch (mobj->type) { case MT_SPRINGBALLPOINT: - macetype = ((mthing->options & MTF_AMBUSH) + macetype = ((mthing->args[8] & TMM_DOUBLESIZE) ? MT_REDSPRINGBALL : MT_YELLOWSPRINGBALL); chainlink = MT_SMALLMACECHAIN; break; case MT_FIREBARPOINT: - macetype = ((mthing->options & MTF_AMBUSH) + macetype = ((mthing->args[8] & TMM_DOUBLESIZE) ? MT_BIGFIREBAR : MT_SMALLFIREBAR); chainlink = MT_NULL; break; case MT_CUSTOMMACEPOINT: - macetype = (mobjtype_t)sides[lines[line].sidenum[0]].toptexture; - if (lines[line].backsector) - chainlink = (mobjtype_t)sides[lines[line].sidenum[1]].toptexture; - else - chainlink = MT_NULL; + macetype = mthing->stringargs[0] ? get_number(mthing->stringargs[0]) : MT_NULL; + chainlink = mthing->stringargs[1] ? get_number(mthing->stringargs[1]) : MT_NULL; break; case MT_CHAINPOINT: - if (mthing->options & MTF_AMBUSH) + if (mthing->args[8] & TMM_DOUBLESIZE) { macetype = MT_BIGGRABCHAIN; chainlink = MT_BIGMACECHAIN; @@ -12228,7 +12266,7 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj, boolean *doangle) mchainlike = true; break; default: - if (mthing->options & MTF_AMBUSH) + if (mthing->args[8] & TMM_DOUBLESIZE) { macetype = MT_BIGMACE; chainlink = MT_BIGMACECHAIN; @@ -12255,11 +12293,11 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj, boolean *doangle) firsttype = macetype; // Adjustable direction - if (lines[line].flags & ML_NOCLIMB) + if (mthing->args[8] & TMM_ALLOWYAWCONTROL) mobj->flags |= MF_SLIDEME; // Swinging - if (lines[line].flags & ML_EFFECT1) + if (mthing->args[8] & TMM_SWING) { mobj->flags2 |= MF2_STRONGBOX; mmin = ((mnumnospokes > 1) ? 1 : 0); @@ -12268,11 +12306,11 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj, boolean *doangle) mmin = mnumspokes; // If over distance away, don't move UNLESS this flag is applied - if (lines[line].flags & ML_EFFECT5) + if (mthing->args[8] & TMM_ALWAYSTHINK) mobj->flags2 |= MF2_BOSSNOTRAP; // Make the links the same type as the end - repeated below - if ((mobj->type != MT_CHAINPOINT) && (((lines[line].flags & ML_EFFECT2) == ML_EFFECT2) != (mobj->type == MT_FIREBARPOINT))) // exclusive or + if ((mobj->type != MT_CHAINPOINT) && (((mthing->args[8] & TMM_MACELINKS) == TMM_MACELINKS) != (mobj->type == MT_FIREBARPOINT))) // exclusive or { linktype = macetype; radiusfactor = 2; // Double the radius. @@ -12284,7 +12322,7 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj, boolean *doangle) mchainlike = (firsttype == chainlink); widthfactor = (mchainlike ? 1 : 2); - mflagsapply = ((lines[line].flags & ML_EFFECT4) ? 0 : (MF_NOCLIP | MF_NOCLIPHEIGHT)); + mflagsapply = (mthing->args[8] & TMM_CLIP) ? 0 : (MF_NOCLIP|MF_NOCLIPHEIGHT); mflags2apply = ((mthing->options & MTF_OBJECTFLIP) ? MF2_OBJECTFLIP : 0); meflagsapply = ((mthing->options & MTF_OBJECTFLIP) ? MFE_VERTICALFLIP : 0); @@ -12310,14 +12348,14 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj, boolean *doangle) hprev = spawnee;\ } - mdosound = (mspeed && !(mthing->options & MTF_OBJECTSPECIAL)); - mdocenter = (macetype && (lines[line].flags & ML_EFFECT3)); + mdosound = (mspeed && !(mthing->args[8] & TMM_SILENT)); + mdocenter = (macetype && (mthing->args[8] & TMM_CENTERLINK)); // The actual spawning of spokes while (mnumspokes-- > 0) { // Offsets - if (lines[line].flags & ML_EFFECT1) // Swinging + if (mthing->args[8] & TMM_SWING) // Swinging mroll = (mroll - mspokeangle) & FINEMASK; else // Spinning mphase = (mphase - mspokeangle) & FINEMASK; @@ -12328,7 +12366,7 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj, boolean *doangle) continue; linktype = chainlink; - firsttype = ((mthing->options & MTF_AMBUSH) ? MT_BIGGRABCHAIN : MT_SMALLGRABCHAIN); + firsttype = ((mthing->args[8] & TMM_DOUBLESIZE) ? MT_BIGGRABCHAIN : MT_SMALLGRABCHAIN); mmaxlength = 1 + (mlength - 1) * radiusfactor; radiusfactor = widthfactor = 1; } @@ -12337,7 +12375,7 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj, boolean *doangle) if (mobj->type == MT_CHAINMACEPOINT) { // Make the links the same type as the end - repeated above - if (lines[line].flags & ML_EFFECT2) + if (mthing->args[8] & TMM_MACELINKS) { linktype = macetype; radiusfactor = 2; @@ -12420,50 +12458,43 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj, boolean *doangle) static boolean P_SetupParticleGen(mapthing_t *mthing, mobj_t *mobj) { - fixed_t radius, speed; + fixed_t radius, speed, zdist; INT32 type, numdivisions, anglespeed, ticcount; angle_t angledivision; INT32 line; const size_t mthingi = (size_t)(mthing - mapthings); - // Find the corresponding linedef special, using angle as tag - line = Tag_FindLineSpecial(15, mthing->angle); + // Find the corresponding linedef special, using args[6] as tag + line = mthing->args[6] ? Tag_FindLineSpecial(15, mthing->args[6]) : -1; - if (line == -1) - { - CONS_Debug(DBG_GAMELOGIC, "Particle generator (mapthing #%s) needs to be tagged to a #15 parameter line (trying to find tag %d).\n", sizeu1(mthingi), mthing->angle); - return false; - } + type = mthing->stringargs[0] ? get_number(mthing->stringargs[0]) : MT_PARTICLE; - if (sides[lines[line].sidenum[0]].toptexture) - type = sides[lines[line].sidenum[0]].toptexture; // Set as object type in p_setup.c... - else - type = (INT32)MT_PARTICLE; - - if (!lines[line].backsector - || (ticcount = (sides[lines[line].sidenum[1]].textureoffset >> FRACBITS)) < 1) + ticcount = mthing->args[4]; + if (ticcount < 1) ticcount = 3; - numdivisions = mthing->z; + numdivisions = mthing->args[0]; if (numdivisions) { - radius = R_PointToDist2(lines[line].v1->x, lines[line].v1->y, lines[line].v2->x, lines[line].v2->y); - anglespeed = (sides[lines[line].sidenum[0]].rowoffset >> FRACBITS) % 360; + radius = mthing->args[1] << FRACBITS; + anglespeed = (mthing->args[3]) % 360; angledivision = 360/numdivisions; } else { - numdivisions = 1; // Simple trick to make A_ParticleSpawn simpler. + numdivisions = 1; // Simple trick to make P_ParticleGenSceneryThink simpler. radius = 0; anglespeed = 0; angledivision = 0; } - speed = abs(sides[lines[line].sidenum[0]].textureoffset); + speed = abs(mthing->args[2]) << FRACBITS; if (mthing->options & MTF_OBJECTFLIP) speed *= -1; + zdist = abs(mthing->args[5]) << FRACBITS; + CONS_Debug(DBG_GAMELOGIC, "Particle Generator (mapthing #%s):\n" "Radius is %d\n" "Speed is %d\n" @@ -12471,9 +12502,14 @@ static boolean P_SetupParticleGen(mapthing_t *mthing, mobj_t *mobj) "Numdivisions is %d\n" "Angledivision is %d\n" "Type is %d\n" - "Tic seperation is %d\n", + "Tic separation is %d\n", sizeu1(mthingi), radius, speed, anglespeed, numdivisions, angledivision, type, ticcount); + if (line == -1) + CONS_Debug(DBG_GAMELOGIC, "Spawn Z is %d\nZ dist is %d\n", mobj->z, zdist); + else + CONS_Debug(DBG_GAMELOGIC, "Heights are taken from control sector\n"); + mobj->angle = 0; mobj->movefactor = speed; mobj->lastlook = numdivisions; @@ -12482,21 +12518,19 @@ static boolean P_SetupParticleGen(mapthing_t *mthing, mobj_t *mobj) mobj->friction = radius; mobj->threshold = type; mobj->reactiontime = ticcount; + mobj->extravalue1 = zdist; mobj->cvmem = line; mobj->watertop = mobj->waterbottom = 0; return true; } -static boolean P_SetupNiGHTSDrone(mapthing_t* mthing, mobj_t* mobj) +static boolean P_SetupNiGHTSDrone(mapthing_t *mthing, mobj_t *mobj) { boolean flip = mthing->options & MTF_OBJECTFLIP; - boolean topaligned = (mthing->options & MTF_OBJECTSPECIAL) && !(mthing->options & MTF_EXTRA); - boolean middlealigned = (mthing->options & MTF_EXTRA) && !(mthing->options & MTF_OBJECTSPECIAL); - boolean bottomoffsetted = !(mthing->options & MTF_OBJECTSPECIAL) && !(mthing->options & MTF_EXTRA); - - INT16 timelimit = mthing->angle & 0xFFF; - fixed_t hitboxradius = ((mthing->angle & 0xF000) >> 12)*32*FRACUNIT; - fixed_t hitboxheight = mthing->extrainfo*32*FRACUNIT; + INT16 timelimit = mthing->args[0]; + fixed_t hitboxheight = mthing->args[1] << FRACBITS; + fixed_t hitboxradius = mthing->args[2] << FRACBITS; + INT32 dronemanalignment = mthing->args[3]; fixed_t oldheight = mobj->height; fixed_t dronemanoffset, goaloffset, sparkleoffset, droneboxmandiff, dronemangoaldiff; @@ -12511,6 +12545,9 @@ static boolean P_SetupNiGHTSDrone(mapthing_t* mthing, mobj_t* mobj) else mobj->height = mobjinfo[MT_NIGHTSDRONE].height; + if (mthing->args[4]) + mobj->flags2 |= MF2_AMBUSH; //Kill player upon time up + droneboxmandiff = max(mobj->height - mobjinfo[MT_NIGHTSDRONE_MAN].height, 0); dronemangoaldiff = max(mobjinfo[MT_NIGHTSDRONE_MAN].height - mobjinfo[MT_NIGHTSDRONE_GOAL].height, 0); @@ -12519,25 +12556,25 @@ static boolean P_SetupNiGHTSDrone(mapthing_t* mthing, mobj_t* mobj) if (!flip) { - if (topaligned) // Align droneman to top of hitbox + switch (dronemanalignment) { - dronemanoffset = droneboxmandiff; - goaloffset = dronemangoaldiff/2 + dronemanoffset; - } - else if (middlealigned) // Align droneman to center of hitbox - { - dronemanoffset = droneboxmandiff/2; - goaloffset = dronemangoaldiff/2 + dronemanoffset; - } - else if (bottomoffsetted) - { - dronemanoffset = 24*FRACUNIT; - goaloffset = dronemangoaldiff + dronemanoffset; - } - else - { - dronemanoffset = 0; - goaloffset = dronemangoaldiff/2 + dronemanoffset; + case TMDA_BOTTOMOFFSET: + default: + dronemanoffset = FixedMul(24*FRACUNIT, mobj->scale); + goaloffset = dronemangoaldiff + dronemanoffset; + break; + case TMDA_BOTTOM: + dronemanoffset = 0; + goaloffset = dronemangoaldiff/2 + dronemanoffset; + break; + case TMDA_MIDDLE: + dronemanoffset = droneboxmandiff/2; + goaloffset = dronemangoaldiff/2 + dronemanoffset; + break; + case TMDA_TOP: + dronemanoffset = droneboxmandiff; + goaloffset = dronemangoaldiff/2 + dronemanoffset; + break; } sparkleoffset = goaloffset - FixedMul(15*FRACUNIT, mobj->scale); @@ -12547,25 +12584,25 @@ static boolean P_SetupNiGHTSDrone(mapthing_t* mthing, mobj_t* mobj) mobj->eflags |= MFE_VERTICALFLIP; mobj->flags2 |= MF2_OBJECTFLIP; - if (topaligned) // Align droneman to top of hitbox + switch (dronemanalignment) { - dronemanoffset = 0; - goaloffset = dronemangoaldiff/2 + dronemanoffset; - } - else if (middlealigned) // Align droneman to center of hitbox - { - dronemanoffset = droneboxmandiff/2; - goaloffset = dronemangoaldiff/2 + dronemanoffset; - } - else if (bottomoffsetted) - { - dronemanoffset = droneboxmandiff - FixedMul(24*FRACUNIT, mobj->scale); - goaloffset = dronemangoaldiff + dronemanoffset; - } - else - { - dronemanoffset = droneboxmandiff; - goaloffset = dronemangoaldiff/2 + dronemanoffset; + case TMDA_BOTTOMOFFSET: + default: + dronemanoffset = droneboxmandiff - FixedMul(24*FRACUNIT, mobj->scale); + goaloffset = dronemangoaldiff + dronemanoffset; + break; + case TMDA_BOTTOM: + dronemanoffset = droneboxmandiff; + goaloffset = dronemangoaldiff/2 + dronemanoffset; + break; + case TMDA_MIDDLE: + dronemanoffset = droneboxmandiff/2; + goaloffset = dronemangoaldiff/2 + dronemanoffset; + break; + case TMDA_TOP: + dronemanoffset = 0; + goaloffset = dronemangoaldiff/2 + dronemanoffset; + break; } sparkleoffset = goaloffset + FixedMul(15*FRACUNIT, mobj->scale); @@ -12573,9 +12610,9 @@ static boolean P_SetupNiGHTSDrone(mapthing_t* mthing, mobj_t* mobj) // spawn visual elements { - mobj_t* goalpost = P_SpawnMobjFromMobj(mobj, 0, 0, goaloffset, MT_NIGHTSDRONE_GOAL); - mobj_t* sparkle = P_SpawnMobjFromMobj(mobj, 0, 0, sparkleoffset, MT_NIGHTSDRONE_SPARKLING); - mobj_t* droneman = P_SpawnMobjFromMobj(mobj, 0, 0, dronemanoffset, MT_NIGHTSDRONE_MAN); + mobj_t *goalpost = P_SpawnMobjFromMobj(mobj, 0, 0, goaloffset, MT_NIGHTSDRONE_GOAL); + mobj_t *sparkle = P_SpawnMobjFromMobj(mobj, 0, 0, sparkleoffset, MT_NIGHTSDRONE_SPARKLING); + mobj_t *droneman = P_SpawnMobjFromMobj(mobj, 0, 0, dronemanoffset, MT_NIGHTSDRONE_MAN); P_SetTarget(&mobj->target, goalpost); P_SetTarget(&goalpost->target, sparkle); @@ -12591,12 +12628,21 @@ static boolean P_SetupNiGHTSDrone(mapthing_t* mthing, mobj_t* mobj) // Remember position preference for later mobj->flags &= ~(MF_SLIDEME|MF_GRENADEBOUNCE); - if (topaligned) - mobj->flags |= MF_SLIDEME; - else if (middlealigned) - mobj->flags |= MF_GRENADEBOUNCE; - else if (!bottomoffsetted) - mobj->flags |= MF_SLIDEME|MF_GRENADEBOUNCE; + switch (dronemanalignment) + { + case TMDA_BOTTOMOFFSET: + default: + mobj->flags |= MF_SLIDEME|MF_GRENADEBOUNCE; + break; + case TMDA_BOTTOM: + break; + case TMDA_MIDDLE: + mobj->flags |= MF_GRENADEBOUNCE; + break; + case TMDA_TOP: + mobj->flags |= MF_SLIDEME; + break; + } // Remember old Z position and flags for correction detection goalpost->movefactor = mobj->z; @@ -12647,6 +12693,37 @@ static boolean P_SetupBooster(mapthing_t* mthing, mobj_t* mobj, boolean strong) return true; } +static mobj_t *P_MakeSoftwareCorona(mobj_t *mo, INT32 height) +{ + mobj_t *corona = P_SpawnMobjFromMobj(mo, 0, 0, height<sprite = SPR_FLAM; + corona->frame = (FF_FULLBRIGHT|FF_TRANS90|12); + corona->tics = -1; + return corona; +} + +static boolean P_MapAlreadyHasStarPost(mobj_t *mobj) +{ + thinker_t *th; + mobj_t *mo2; + + for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) + { + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; + + mo2 = (mobj_t *)th; + + if (mo2 == mobj) + continue; + + if (mo2->type == MT_STARPOST && mo2->health == mobj->health) + return true; + } + + return false; +} + static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean *doangle) { boolean override = LUA_HookMapThingSpawn(mobj, mthing); @@ -12674,24 +12751,32 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean break; } - if (mthing->options & MTF_OBJECTSPECIAL) + if (mthing->args[0]) skyboxcenterpnts[tag] = mobj; else skyboxviewpnts[tag] = mobj; break; } case MT_EGGSTATUE: - if (mthing->options & MTF_EXTRA) + if (mthing->args[1]) { mobj->color = SKINCOLOR_GOLD; mobj->colorized = true; } break; + case MT_EGGMOBILE2: + if (!mthing->args[5]) + mobj->flags2 |= MF2_AMBUSH; + break; case MT_EGGMOBILE3: - mobj->cusval = mthing->extrainfo; + mobj->cusval = mthing->args[0]; + break; + case MT_BUBBLES: + if (mthing->args[0]) + mobj->flags2 |= MF2_AMBUSH; break; case MT_FAN: - if (mthing->options & MTF_OBJECTSPECIAL) + if (mthing->args[1] & TMF_INVISIBLE) { P_UnsetThingPosition(mobj); if (sector_list) @@ -12702,16 +12787,34 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean mobj->flags |= MF_NOSECTOR; // this flag basically turns it invisible P_SetThingPosition(mobj); } - if (mthing->angle) - mobj->health = mthing->angle; + if (mthing->args[1] & TMF_NODISTANCECHECK) + mobj->flags2 |= MF2_AMBUSH; + if (mthing->args[0]) + mobj->health = mthing->args[0]; else mobj->health = FixedMul(mobj->subsector->sector->ceilingheight - mobj->subsector->sector->floorheight, 3*(FRACUNIT/4)) >> FRACBITS; break; - case MT_METALSONIC_RACE: - case MT_METALSONIC_BATTLE: case MT_FANG: + if (mthing->args[5] & TMF_GRAYSCALE) + { + mobj->color = SKINCOLOR_SILVER; + mobj->colorized = true; + mobj->flags2 |= MF2_SLIDEPUSH; + } + if (mthing->args[5] & TMF_SKIPINTRO) + mobj->flags2 |= MF2_AMBUSH; + break; + case MT_METALSONIC_BATTLE: + if (mthing->args[5]) + { + mobj->color = SKINCOLOR_SILVER; + mobj->colorized = true; + mobj->flags2 |= MF2_SLIDEPUSH; + } + break; + case MT_METALSONIC_RACE: case MT_ROSY: - if (mthing->options & MTF_EXTRA) + if (mthing->args[0]) { mobj->color = SKINCOLOR_SILVER; mobj->colorized = true; @@ -12719,33 +12822,28 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean } break; case MT_BALLOON: - if (mthing->angle > 0) - mobj->color = ((mthing->angle - 1) % (numskincolors - 1)) + 1; + if (mthing->stringargs[0]) + mobj->color = get_number(mthing->stringargs[0]); + if (mthing->args[0]) + mobj->flags2 |= MF2_AMBUSH; break; -#define makesoftwarecorona(mo, h) \ - corona = P_SpawnMobjFromMobj(mo, 0, 0, h<sprite = SPR_FLAM;\ - corona->frame = (FF_FULLBRIGHT|FF_TRANS90|12);\ - corona->tics = -1 case MT_FLAME: - if (mthing->options & MTF_EXTRA) + if (mthing->args[0]) { - mobj_t *corona; - makesoftwarecorona(mobj, 20); + mobj_t *corona = P_MakeSoftwareCorona(mobj, 20); P_SetScale(corona, (corona->destscale = mobj->scale*3)); P_SetTarget(&mobj->tracer, corona); } break; case MT_FLAMEHOLDER: - if (!(mthing->options & MTF_OBJECTSPECIAL)) // Spawn the fire + if (!(mthing->args[0] & TMFH_NOFLAME)) // Spawn the fire { mobj_t *flame = P_SpawnMobjFromMobj(mobj, 0, 0, mobj->height, MT_FLAME); P_SetTarget(&flame->target, mobj); flame->flags2 |= MF2_BOSSNOTRAP; - if (mthing->options & MTF_EXTRA) + if (mthing->args[0] & TMFH_CORONA) { - mobj_t *corona; - makesoftwarecorona(flame, 20); + mobj_t *corona = P_MakeSoftwareCorona(flame, 20); P_SetScale(corona, (corona->destscale = flame->scale*3)); P_SetTarget(&flame->tracer, corona); } @@ -12753,17 +12851,13 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean break; case MT_CANDLE: case MT_CANDLEPRICKET: - if (mthing->options & MTF_EXTRA) - { - mobj_t *corona; - makesoftwarecorona(mobj, ((mobj->type == MT_CANDLE) ? 42 : 176)); - } + if (mthing->args[0]) + P_MakeSoftwareCorona(mobj, ((mobj->type == MT_CANDLE) ? 42 : 176)); break; -#undef makesoftwarecorona case MT_JACKO1: case MT_JACKO2: case MT_JACKO3: - if (!(mthing->options & MTF_EXTRA)) // take the torch out of the crafting recipe + if (!(mthing->args[0])) // take the torch out of the crafting recipe { mobj_t *overlay = P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_OVERLAY); P_SetTarget(&overlay->target, mobj); @@ -12771,17 +12865,15 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean } break; case MT_WATERDRIP: - mobj->tics = 3*TICRATE + mthing->angle; + mobj->tics = 3*TICRATE + mthing->args[0]; break; case MT_FLAMEJET: case MT_VERTICALFLAMEJET: - mobj->threshold = (mthing->angle >> 10) & 7; - mobj->movecount = (mthing->angle >> 13); - - mobj->threshold *= (TICRATE/2); - mobj->movecount *= (TICRATE/2); - - mobj->movedir = mthing->extrainfo; + mobj->movecount = mthing->args[0]; + mobj->threshold = mthing->args[1]; + mobj->movedir = mthing->args[2]; + if (mthing->args[3]) + mobj->flags2 |= MF2_AMBUSH; break; case MT_MACEPOINT: case MT_CHAINMACEPOINT: @@ -12796,60 +12888,50 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean if (!P_SetupParticleGen(mthing, mobj)) return false; break; - case MT_ROCKSPAWNER: - mobj->threshold = mthing->angle; - mobj->movecount = mthing->extrainfo; - break; case MT_POPUPTURRET: - if (mthing->angle) - mobj->threshold = mthing->angle; - else - mobj->threshold = (TICRATE*2)-1; + mobj->threshold = mthing->args[0] ? mthing->args[0] : (TICRATE*2)-1; break; case MT_NIGHTSBUMPER: - // Lower 4 bits specify the angle of - // the bumper in 30 degree increments. - mobj->threshold = (mthing->options & 15) % 12; // It loops over, etc + // Pitch of the bumper is set in 30 degree increments. + mobj->threshold = ((mthing->pitch/30) + 3) % 12; P_SetMobjState(mobj, mobj->info->spawnstate + mobj->threshold); break; case MT_EGGCAPSULE: - if (mthing->angle <= 0) - mthing->angle = 20; // prevent 0 health - - mobj->health = mthing->angle; - mobj->threshold = min(mthing->extrainfo, 7); + mobj->threshold = min(mthing->args[0], 7); + mobj->health = mthing->args[1]; + if (mobj->health <= 0) + mobj->health = 20; // prevent 0 health break; case MT_TUBEWAYPOINT: { - UINT8 sequence = mthing->angle >> 8; - UINT8 id = mthing->angle & 255; + UINT8 sequence = mthing->args[0]; + UINT8 id = mthing->args[1]; mobj->health = id; mobj->threshold = sequence; P_AddWaypoint(sequence, id, mobj); break; } case MT_IDEYAANCHOR: - mobj->health = mthing->extrainfo; + mobj->health = mthing->args[0]; break; case MT_NIGHTSDRONE: if (!P_SetupNiGHTSDrone(mthing, mobj)) return false; break; case MT_HIVEELEMENTAL: - if (mthing->extrainfo) - mobj->extravalue1 = mthing->extrainfo; + if (mthing->args[0]) + mobj->extravalue1 = mthing->args[0]; break; case MT_GLAREGOYLE: case MT_GLAREGOYLEUP: case MT_GLAREGOYLEDOWN: case MT_GLAREGOYLELONG: - if (mthing->angle >= 360) - mobj->tics += 7*(mthing->angle/360) + 1; // starting delay + mobj->tics += mthing->args[1]; // starting delay break; case MT_DSZSTALAGMITE: case MT_DSZ2STALAGMITE: case MT_KELP: - if (mthing->options & MTF_OBJECTSPECIAL) { // make mobj twice as big as normal + if (mthing->args[0]) { // make mobj twice as big as normal P_SetScale(mobj, 2*mobj->scale); // not 2*FRACUNIT in case of something like the old ERZ3 mode mobj->destscale = mobj->scale; } @@ -12870,15 +12952,15 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean { segment = P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_TUTORIALLEAF); segment->angle = mobj->angle + FixedAngle(i*60*FRACUNIT); - P_SetMobjState(segment, S_TUTORIALLEAF1 + mthing->extrainfo); + P_SetMobjState(segment, S_TUTORIALLEAF1 + mthing->args[0]); } for (i = 0; i < 3; i++) { segment = P_SpawnMobjFromMobj(mobj, 0, 0, 112*FRACUNIT, MT_TUTORIALFLOWER); segment->angle = mobj->angle + FixedAngle(i*120*FRACUNIT); - P_SetMobjState(segment, S_TUTORIALFLOWER1 + mthing->extrainfo); + P_SetMobjState(segment, S_TUTORIALFLOWER1 + mthing->args[0]); } - P_SetMobjState(P_SpawnMobjFromMobj(mobj, 0, 0, 112*FRACUNIT, MT_TUTORIALFLOWERF), S_TUTORIALFLOWERF1 + mthing->extrainfo); + P_SetMobjState(P_SpawnMobjFromMobj(mobj, 0, 0, 112*FRACUNIT, MT_TUTORIALFLOWERF), S_TUTORIALFLOWERF1 + mthing->args[0]); } break; case MT_CEZPOLE1: @@ -12908,20 +12990,20 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean } break; case MT_SMASHINGSPIKEBALL: - if (mthing->angle > 0) - mobj->tics += mthing->angle; + if (mthing->args[0] > 0) + mobj->tics += mthing->args[0]; break; case MT_LAVAFALL: - mobj->fuse = 30 + mthing->angle; - if (mthing->options & MTF_AMBUSH) + mobj->fuse = 30 + mthing->args[0]; + if (mthing->args[1]) { P_SetScale(mobj, 2*mobj->scale); mobj->destscale = mobj->scale; } break; case MT_PYREFLY: - //start on fire if Ambush flag is set, otherwise behave normally - if (mthing->options & MTF_AMBUSH) + //start on fire if args[0], otherwise behave normally + if (mthing->args[0]) { P_SetMobjState(mobj, mobj->info->meleestate); mobj->extravalue2 = 2; @@ -12949,20 +13031,19 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean return false; break; case MT_AXIS: - // Inverted if uppermost bit is set - if (mthing->angle & 16384) + // Inverted if args[3] is set + if (mthing->args[3]) mobj->flags2 |= MF2_AMBUSH; - if (mthing->angle > 0) - mobj->radius = (mthing->angle & 16383) << FRACBITS; + mobj->radius = abs(mthing->args[2]) << FRACBITS; // FALLTHRU case MT_AXISTRANSFER: case MT_AXISTRANSFERLINE: // Mare it belongs to - mobj->threshold = min(mthing->extrainfo, 7); + mobj->threshold = min(mthing->args[0], 7); // # in the mare - mobj->health = mthing->options; + mobj->health = mthing->args[1]; mobj->flags2 |= MF2_AXIS; break; @@ -12972,7 +13053,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean mobj->health = 1 << (tokenbits - 1); break; case MT_CYBRAKDEMON: - if (mthing->options & MTF_AMBUSH) + if (mthing->args[6] & TMB_BARRIER) { mobj_t* elecmobj; elecmobj = P_SpawnMobj(mobj->x, mobj->y, mobj->z, MT_CYBRAKDEMON_ELECTRIC_BARRIER); @@ -12983,54 +13064,21 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean } break; case MT_STARPOST: - { - thinker_t* th; - mobj_t* mo2; - boolean foundanother = false; - - if (mthing->extrainfo) - // Allow thing Parameter to define star post num too! - // For starposts above param 15 (the 16th), add 360 to the angle like before and start parameter from 1 (NOT 0)! - // So the 16th starpost is angle=0 param=15, the 17th would be angle=360 param=1. - // This seems more intuitive for mappers to use until UDMF is ready, since most SP maps won't have over 16 consecutive star posts. - mobj->health = mthing->extrainfo + (mthing->angle/360)*15 + 1; - else - // Old behavior if Parameter is 0; add 360 to the angle for each consecutive star post. - mobj->health = (mthing->angle/360) + 1; - - // See if other starposts exist in this level that have the same value. - for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) - { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) - continue; - - mo2 = (mobj_t*)th; - - if (mo2 == mobj) - continue; - - if (mo2->type == MT_STARPOST && mo2->health == mobj->health) - { - foundanother = true; - break; - } - } - - if (!foundanother) + mobj->health = mthing->args[0] + 1; + if (!P_MapAlreadyHasStarPost(mobj)) numstarposts++; break; - } case MT_SPIKE: // Pop up spikes! - if (mthing->options & MTF_OBJECTSPECIAL) + if (mthing->args[0]) { mobj->flags &= ~MF_SCENERY; - mobj->fuse = (16 - mthing->extrainfo)*(mthing->angle + mobj->info->speed)/16; - if (mthing->options & MTF_EXTRA) - P_SetMobjState(mobj, mobj->info->meleestate); + mobj->fuse = mthing->args[1]; } - // Use per-thing collision for spikes if the deaf flag isn't checked. - if (!(mthing->options & MTF_AMBUSH) && !metalrecording) + if (mthing->args[2] & TMSF_RETRACTED) + P_SetMobjState(mobj, mobj->info->meleestate); + // Use per-thing collision for spikes unless the intangible flag is checked. + if (!(mthing->args[2] & TMSF_INTANGIBLE) && !metalrecording) { P_UnsetThingPosition(mobj); mobj->flags &= ~(MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIPHEIGHT); @@ -13040,22 +13088,21 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean break; case MT_WALLSPIKE: // Pop up spikes! - if (mthing->options & MTF_OBJECTSPECIAL) + if (mthing->args[0]) { mobj->flags &= ~MF_SCENERY; - mobj->fuse = (16 - mthing->extrainfo)*((mthing->angle/360) + mobj->info->speed)/16; - if (mthing->options & MTF_EXTRA) - P_SetMobjState(mobj, mobj->info->meleestate); + mobj->fuse = mthing->args[1]; } - // Use per-thing collision for spikes if the deaf flag isn't checked. - if (!(mthing->options & MTF_AMBUSH) && !metalrecording) + if (mthing->args[2] & TMSF_RETRACTED) + P_SetMobjState(mobj, mobj->info->meleestate); + // Use per-thing collision for spikes unless the intangible flag is checked. + if (!(mthing->args[2] & TMSF_INTANGIBLE) && !metalrecording) { P_UnsetThingPosition(mobj); mobj->flags &= ~(MF_NOBLOCKMAP | MF_NOCLIPHEIGHT); mobj->flags |= MF_SOLID; P_SetThingPosition(mobj); } - // spawn base { const angle_t mobjangle = FixedAngle(mthing->angle << FRACBITS); // the mobj's own angle hasn't been set quite yet so... @@ -13078,12 +13125,13 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean break; case MT_BIGTUMBLEWEED: case MT_LITTLETUMBLEWEED: - if (mthing->options & MTF_AMBUSH) + if (mthing->args[0]) { fixed_t offset = FixedMul(16*FRACUNIT, mobj->scale); mobj->momx += P_RandomChance(FRACUNIT/2) ? offset : -offset; mobj->momy += P_RandomChance(FRACUNIT/2) ? offset : -offset; mobj->momz += offset; + mobj->flags2 |= MF2_AMBUSH; } break; case MT_REDFLAG: @@ -13094,89 +13142,121 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean blueflag = mobj; bflagpoint = mobj->spawnpoint; break; - case MT_PUSH: - case MT_PULL: - mobj->health = 0; // Default behaviour: pushing uses XY, fading uses XYZ - - if (mthing->options & MTF_AMBUSH) - mobj->health |= 1; // If ambush is set, push using XYZ - if (mthing->options & MTF_OBJECTSPECIAL) - mobj->health |= 2; // If object special is set, fade using XY - - if (G_IsSpecialStage(gamemap)) - P_SetMobjState(mobj, (mobj->type == MT_PUSH) ? S_GRAVWELLGREEN : S_GRAVWELLRED); - break; case MT_NIGHTSSTAR: if (maptol & TOL_XMAS) P_SetMobjState(mobj, mobj->info->seestate); break; + case MT_YELLOWDIAG: + case MT_REDDIAG: + case MT_BLUEDIAG: + mobj->angle = FixedAngle(mthing->angle << FRACBITS); + if (mthing->args[0] & TMDS_NOGRAVITY) + mobj->flags |= MF_NOGRAVITY; + if (mthing->args[0] & TMDS_ROTATEEXTRA) + mobj->angle += ANGLE_22h; + *doangle = false; + break; + case MT_AMBIENT: + if (mthing->stringargs[0]) + mobj->threshold = get_number(mthing->stringargs[0]); + mobj->health = mthing->args[0] ? mthing->args[0] : TICRATE; + break; + case MT_GOLDBUZZ: + case MT_REDBUZZ: + case MT_JETTBOMBER: + case MT_JETTGUNNER: + case MT_ROBOHOOD: + case MT_CRUSHSTACEAN: + case MT_BANPYURA: + case MT_BUMBLEBORE: + case MT_CACOLANTERN: + case MT_PIAN: + if (mthing->args[0]) + mobj->flags2 |= MF2_AMBUSH; + break; + case MT_EGGGUARD: + if (mthing->args[1]) + mobj->flags2 |= MF2_AMBUSH; + break; + case MT_STEAM: + if (mthing->args[0]) + mobj->flags2 |= MF2_AMBUSH; + break; + case MT_SALOONDOORCENTER: + if (mthing->args[0]) + mobj->flags2 |= MF2_AMBUSH; + break; + case MT_MINECARTSWITCHPOINT: + if (mthing->args[0]) + mobj->flags2 |= MF2_AMBUSH; + break; + case MT_ROLLOUTSPAWN: + if (mthing->args[0]) + mobj->flags2 |= MF2_AMBUSH; + break; default: break; } if (mobj->flags & MF_BOSS) { - if (mthing->options & MTF_OBJECTSPECIAL) // No egg trap for this boss + if (mthing->args[1]) // No egg trap for this boss mobj->flags2 |= MF2_BOSSNOTRAP; } + if (mobj->flags & MF_NIGHTSITEM) + { + // Requires you to be in bonus time to activate + if (mthing->args[0] & TMNI_BONUSONLY) + mobj->flags2 |= MF2_STRONGBOX; + // Spawn already displayed + if (mthing->args[0] & TMNI_REVEAL) + { + mobj->flags |= MF_SPECIAL; + mobj->flags &= ~MF_NIGHTSITEM; + } + } + if (mobj->flags & MF_PUSHABLE) + { + switch (mthing->args[0]) + { + case TMP_NORMAL: + default: + break; + case TMP_SLIDE: + mobj->flags2 |= MF2_SLIDEPUSH; + mobj->flags |= MF_BOUNCE; + break; + case TMP_IMMOVABLE: + mobj->flags &= ~MF_PUSHABLE; + break; + case TMP_CLASSIC: + mobj->flags2 |= MF2_CLASSICPUSH; + break; + } + } + if (mobj->flags & MF_SPRING && mobj->info->painchance == 3) + { + if (mthing->args[0]) + mobj->flags2 |= MF2_AMBUSH; + } + if ((mobj->flags & MF_MONITOR) && mobj->info->speed != 0) + { + switch (mthing->args[1]) + { + case TMMR_SAME: + default: + break; + case TMMR_WEAK: + mobj->flags2 |= MF2_AMBUSH; + break; + case TMMR_STRONG: + mobj->flags2 |= MF2_STRONGBOX; + } + } return true; } -static void P_SetAmbush(mobj_t *mobj) -{ - if (mobj->type == MT_YELLOWDIAG || mobj->type == MT_REDDIAG || mobj->type == MT_BLUEDIAG) - mobj->angle += ANGLE_22h; - - if (mobj->flags & MF_NIGHTSITEM) - { - // Spawn already displayed - mobj->flags |= MF_SPECIAL; - mobj->flags &= ~MF_NIGHTSITEM; - } - - if (mobj->flags & MF_PUSHABLE) - mobj->flags &= ~MF_PUSHABLE; - - if ((mobj->flags & MF_MONITOR) && mobj->info->speed != 0) - { - // flag for strong/weak random boxes - // any monitor with nonzero speed is allowed to respawn like this - mobj->flags2 |= MF2_AMBUSH; - } - - else if (mobj->type != MT_AXIS && - mobj->type != MT_AXISTRANSFER && - mobj->type != MT_AXISTRANSFERLINE && - mobj->type != MT_NIGHTSBUMPER && - mobj->type != MT_STARPOST) - mobj->flags2 |= MF2_AMBUSH; -} - -static void P_SetObjectSpecial(mobj_t *mobj) -{ - if (mobj->type == MT_YELLOWDIAG || mobj->type == MT_REDDIAG || mobj->type == MT_BLUEDIAG) - mobj->flags |= MF_NOGRAVITY; - - if ((mobj->flags & MF_MONITOR) && mobj->info->speed != 0) - { - // flag for strong/weak random boxes - // any monitor with nonzero speed is allowed to respawn like this - mobj->flags2 |= MF2_STRONGBOX; - } - - // Requires you to be in bonus time to activate - if (mobj->flags & MF_NIGHTSITEM) - mobj->flags2 |= MF2_STRONGBOX; - - // Pushables bounce and slide coolly with object special flag set - if (mobj->flags & MF_PUSHABLE) - { - mobj->flags2 |= MF2_SLIDEPUSH; - mobj->flags |= MF_BOUNCE; - } -} - static mobj_t *P_SpawnMobjFromMapThing(mapthing_t *mthing, fixed_t x, fixed_t y, fixed_t z, mobjtype_t i) { mobj_t *mobj = NULL; @@ -13199,23 +13279,6 @@ static mobj_t *P_SpawnMobjFromMapThing(mapthing_t *mthing, fixed_t x, fixed_t y, mthing->mobj = mobj; - // ignore MTF_ flags and return early - if (i == MT_NIGHTSBUMPER) - return mobj; - - if ((mthing->options & MTF_AMBUSH) - && (mthing->options & MTF_OBJECTSPECIAL) - && (mobj->flags & MF_PUSHABLE)) - mobj->flags2 |= MF2_CLASSICPUSH; - else - { - if (mthing->options & MTF_AMBUSH) - P_SetAmbush(mobj); - - if (mthing->options & MTF_OBJECTSPECIAL) - P_SetObjectSpecial(mobj); - } - // Generic reverse gravity for individual objects flag. if (mthing->options & MTF_OBJECTFLIP) { @@ -13223,16 +13286,6 @@ static mobj_t *P_SpawnMobjFromMapThing(mapthing_t *mthing, fixed_t x, fixed_t y, mobj->flags2 |= MF2_OBJECTFLIP; } - // Extra functionality - if (mthing->options & MTF_EXTRA) - { - if (mobj->flags & MF_MONITOR && (mthing->angle & 16384)) - { - // Store line exec tag to run upon popping - mobj->lastlook = (mthing->angle & 16383); - } - } - // Final set of not being able to draw nightsitems. if (mobj->flags & MF_NIGHTSITEM) mobj->flags2 |= MF2_DONTDRAW; @@ -13281,13 +13334,18 @@ mobj_t *P_SpawnMapThing(mapthing_t *mthing) return P_SpawnMobjFromMapThing(mthing, x, y, z, i); } -static void P_SpawnHoopInternal(mapthing_t *mthing, INT32 hoopsize, fixed_t sizefactor) +void P_SpawnHoop(mapthing_t *mthing) { + if (metalrecording) + return; + mobj_t *mobj = NULL; mobj_t *nextmobj = NULL; mobj_t *hoopcenter; TMatrix *pitchmatrix, *yawmatrix; - fixed_t radius = hoopsize*sizefactor; + fixed_t radius = mthing->args[0] << FRACBITS; + fixed_t sizefactor = 4*FRACUNIT; + fixed_t hoopsize = radius/sizefactor; INT32 i; angle_t fa; TVector v, *res; @@ -13304,10 +13362,9 @@ static void P_SpawnHoopInternal(mapthing_t *mthing, INT32 hoopsize, fixed_t size hoopcenter->y = y; P_SetThingPosition(hoopcenter); - // Scale 0-255 to 0-359 =( - hoopcenter->movedir = ((mthing->angle & 255)*360)/256; // Pitch + hoopcenter->movedir = mthing->pitch; pitchmatrix = RotateXMatrix(FixedAngle(hoopcenter->movedir << FRACBITS)); - hoopcenter->movecount = (((UINT16)mthing->angle >> 8)*360)/256; // Yaw + hoopcenter->movecount = mthing->angle; yawmatrix = RotateZMatrix(FixedAngle(hoopcenter->movecount << FRACBITS)); // For the hoop when it flies away @@ -13387,19 +13444,6 @@ static void P_SpawnHoopInternal(mapthing_t *mthing, INT32 hoopsize, fixed_t size } while (hoopsize >= 8); } -void P_SpawnHoop(mapthing_t *mthing) -{ - if (metalrecording) - return; - - if (mthing->type == 1705) // Generic hoop - P_SpawnHoopInternal(mthing, 24, 4*FRACUNIT); - else // Customizable hoop - // For each flag add 16 fracunits to the size - // Default (0 flags) is 32 fracunits - P_SpawnHoopInternal(mthing, 8 + (4*(mthing->options & 0xF)), 4*FRACUNIT); -} - void P_SetBonusTime(mobj_t *mobj) { if (!mobj) @@ -13411,7 +13455,7 @@ void P_SetBonusTime(mobj_t *mobj) P_SetMobjState(mobj, mobj->info->raisestate); } -static void P_SpawnItemRow(mapthing_t *mthing, mobjtype_t* itemtypes, UINT8 numitemtypes, INT32 numitems, fixed_t horizontalspacing, fixed_t verticalspacing, INT16 fixedangle, boolean bonustime) +static void P_SpawnItemRow(mapthing_t *mthing, mobjtype_t *itemtypes, UINT8 numitemtypes, INT32 numitems, fixed_t horizontalspacing, fixed_t verticalspacing, INT16 fixedangle, boolean bonustime) { mapthing_t dummything; mobj_t *mobj = NULL; @@ -13462,7 +13506,7 @@ static void P_SpawnItemRow(mapthing_t *mthing, mobjtype_t* itemtypes, UINT8 numi } } -static void P_SpawnSingularItemRow(mapthing_t* mthing, mobjtype_t itemtype, INT32 numitems, fixed_t horizontalspacing, fixed_t verticalspacing, INT16 fixedangle, boolean bonustime) +static void P_SpawnSingularItemRow(mapthing_t *mthing, mobjtype_t itemtype, INT32 numitems, fixed_t horizontalspacing, fixed_t verticalspacing, INT16 fixedangle, boolean bonustime) { mobjtype_t itemtypes[1] = { itemtype }; return P_SpawnItemRow(mthing, itemtypes, 1, numitems, horizontalspacing, verticalspacing, fixedangle, bonustime); @@ -13526,6 +13570,35 @@ static void P_SpawnItemCircle(mapthing_t *mthing, mobjtype_t *itemtypes, UINT8 n } } +static void P_ParseItemTypes(char *itemstring, mobjtype_t *itemtypes, UINT8 *numitemtypes) +{ + char *tok; + + *numitemtypes = 0; + if (itemstring) + { + char *stringcopy = Z_Malloc(strlen(itemstring) + 1, PU_LEVEL, NULL); + M_Memcpy(stringcopy, itemstring, strlen(itemstring)); + stringcopy[strlen(itemstring)] = '\0'; + + tok = strtok(stringcopy, " "); + while (tok && *numitemtypes < 128) + { + itemtypes[*numitemtypes] = get_number(tok); + tok = strtok(NULL, " "); + (*numitemtypes)++; + } + + Z_Free(stringcopy); + } + else + { + //If no types are supplied, default to ring + itemtypes[0] = MT_RING; + *numitemtypes = 1; + } +} + void P_SpawnItemPattern(mapthing_t *mthing, boolean bonustime) { switch (mthing->type) @@ -13563,6 +13636,27 @@ void P_SpawnItemPattern(mapthing_t *mthing, boolean bonustime) P_SpawnItemCircle(mthing, itemtypes, 2, numitems, size, bonustime); return; } + case 610: // Generic item row + { + mobjtype_t itemtypes[128]; //If you want to have a row with more than 128 different object types, you're crazy. + UINT8 numitemtypes; + if (!udmf) + return; + P_ParseItemTypes(mthing->stringargs[0], itemtypes, &numitemtypes); + P_SpawnItemRow(mthing, itemtypes, numitemtypes, mthing->args[0], mthing->args[1] << FRACBITS, mthing->args[2] << FRACBITS, mthing->angle, bonustime); + return; + } + case 611: // Generic item circle + { + mobjtype_t itemtypes[128]; //If you want to have a circle with more than 128 different object types, you're crazy. + UINT8 numitemtypes; + if (!udmf) + return; + CONS_Printf("Itemstring: %s\n", mthing->stringargs[0]); + P_ParseItemTypes(mthing->stringargs[0], itemtypes, &numitemtypes); + P_SpawnItemCircle(mthing, itemtypes, numitemtypes, mthing->args[0], mthing->args[1] << FRACBITS, bonustime); + return; + } default: return; } diff --git a/src/p_mobj.h b/src/p_mobj.h index b1b79fd82..da8d9ea2b 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -118,7 +118,7 @@ typedef enum // Don't apply gravity (every tic); object will float, keeping current height // or changing it actively. MF_NOGRAVITY = 1<<9, - // This object is an ambient sound. + // This object is an ambient sound. Obsolete, but keep this around for backwards compatibility. MF_AMBIENT = 1<<10, // Slide this object when it hits a wall. MF_SLIDEME = 1<<11, diff --git a/src/p_polyobj.c b/src/p_polyobj.c index 6d7ef3999..77e514bee 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -963,7 +963,7 @@ static INT32 Polyobj_clipThings(polyobj_t *po, line_t *line) else Polyobj_pushThing(po, line, mo); - if (mo->player && (po->lines[0]->backsector->flags & SF_TRIGGERSPECIAL_TOUCH) && !(po->flags & POF_NOSPECIALS)) + if (mo->player && (po->lines[0]->backsector->flags & MSF_TRIGGERSPECIAL_TOUCH) && !(po->flags & POF_NOSPECIALS)) P_ProcessSpecialSector(mo->player, mo->subsector->sector, po->lines[0]->backsector); hitflags |= 1; @@ -1091,7 +1091,7 @@ static void Polyobj_rotateLine(line_t *ld) } // Causes objects resting on top of the rotating polyobject to 'ride' with its movement. -static void Polyobj_rotateThings(polyobj_t *po, vector2_t origin, angle_t delta, UINT8 turnthings) +static void Polyobj_rotateThings(polyobj_t *po, vector2_t origin, angle_t delta, boolean turnplayers, boolean turnothers) { static INT32 pomovecount = 10000; INT32 x, y; @@ -1153,7 +1153,7 @@ static void Polyobj_rotateThings(polyobj_t *po, vector2_t origin, angle_t delta, Polyobj_slideThing(mo, newxoff, newyoff); - if (turnthings == 2 || (turnthings == 1 && !mo->player)) { + if ((turnplayers && mo->player) || (turnothers && !mo->player)) { mo->angle += delta; if (mo->player) P_SetPlayerAngle(mo->player, (angle_t)(mo->player->angleturn << 16) + delta); @@ -1165,7 +1165,7 @@ static void Polyobj_rotateThings(polyobj_t *po, vector2_t origin, angle_t delta, } // Rotates a polyobject around its start point. -boolean Polyobj_rotate(polyobj_t *po, angle_t delta, UINT8 turnthings, boolean checkmobjs) +boolean Polyobj_rotate(polyobj_t *po, angle_t delta, boolean turnplayers, boolean turnothers, boolean checkmobjs) { size_t i; angle_t angle; @@ -1203,7 +1203,7 @@ boolean Polyobj_rotate(polyobj_t *po, angle_t delta, UINT8 turnthings, boolean c for (i = 0; i < po->numLines; ++i) hitflags |= Polyobj_clipThings(po, po->lines[i]); - Polyobj_rotateThings(po, origin, delta, turnthings); + Polyobj_rotateThings(po, origin, delta, turnplayers, turnothers); } if (hitflags & 2) @@ -1411,7 +1411,7 @@ void Polyobj_MoveOnLoad(polyobj_t *po, angle_t angle, fixed_t x, fixed_t y) fixed_t dx, dy; // first, rotate to the saved angle - Polyobj_rotate(po, angle, false, false); + Polyobj_rotate(po, angle, false, false, false); // determine component distances to translate dx = x - po->spawnSpot.x; @@ -1454,7 +1454,7 @@ void T_PolyObjRotate(polyrotate_t *th) // rotate by 'speed' angle per frame // if distance == -1, this polyobject rotates perpetually - if (Polyobj_rotate(po, th->speed, th->turnobjs, true) && th->distance != -1) + if (Polyobj_rotate(po, th->speed, th->turnobjs & PTF_PLAYERS, th->turnobjs & PTF_OTHERS, true) && th->distance != -1) { INT32 avel = abs(th->speed); @@ -1856,7 +1856,7 @@ void T_PolyDoorSwing(polyswingdoor_t *th) // rotate by 'speed' angle per frame // if distance == -1, this polyobject rotates perpetually - if (Polyobj_rotate(po, th->speed, false, true) && th->distance != -1) + if (Polyobj_rotate(po, th->speed, false, false, true) && th->distance != -1) { INT32 avel = abs(th->speed); @@ -1987,7 +1987,7 @@ void T_PolyObjRotDisplace(polyrotdisplace_t *th) rotangle = FixedMul(th->rotscale, delta); - if (Polyobj_rotate(po, FixedAngle(rotangle), th->turnobjs, true)) + if (Polyobj_rotate(po, FixedAngle(rotangle), th->turnobjs & PTF_PLAYERS, th->turnobjs & PTF_OTHERS, true)) th->oldHeights = newheights; } @@ -2016,7 +2016,7 @@ boolean EV_DoPolyObjRotate(polyrotdata_t *prdata) return false; // check for override if this polyobj already has a thinker - if (po->thinker && !prdata->overRide) + if (po->thinker && !(prdata->flags & TMPR_OVERRIDE)) return false; // create a new thinker @@ -2031,10 +2031,10 @@ boolean EV_DoPolyObjRotate(polyrotdata_t *prdata) // use Hexen-style byte angles for speed and distance th->speed = Polyobj_AngSpeed(prdata->speed * prdata->direction); - if (prdata->distance == 360) // 360 means perpetual + if (prdata->flags & TMPR_CONTINUOUS) th->distance = -1; - else if (prdata->distance == 0) // 0 means 360 degrees - th->distance = 0xffffffff - 1; + else if (prdata->distance == 360) + th->distance = ANGLE_MAX - 1; else th->distance = FixedAngle(prdata->distance*FRACUNIT); @@ -2049,7 +2049,11 @@ boolean EV_DoPolyObjRotate(polyrotdata_t *prdata) oldpo = po; - th->turnobjs = prdata->turnobjs; + th->turnobjs = 0; + if (!(prdata->flags & TMPR_DONTROTATEOTHERS)) + th->turnobjs |= PTF_OTHERS; + if (prdata->flags & TMPR_ROTATEPLAYERS) + th->turnobjs |= PTF_PLAYERS; // apply action to mirroring polyobjects as well start = 0; diff --git a/src/p_polyobj.h b/src/p_polyobj.h index 4cc1221db..e9d246168 100644 --- a/src/p_polyobj.h +++ b/src/p_polyobj.h @@ -137,7 +137,7 @@ typedef struct polyrotate_s INT32 polyObjNum; // numeric id of polyobject (avoid C pointers here) INT32 speed; // speed of movement per frame INT32 distance; // distance to move - UINT8 turnobjs; // turn objects? 0=no, 1=everything but players, 2=everything + UINT8 turnobjs; // turn objects? PTF_ flags } polyrotate_t; typedef struct polymove_s @@ -247,14 +247,27 @@ typedef struct polyfade_s // Line Activation Data Structures // +typedef enum +{ + TMPR_DONTROTATEOTHERS = 1, + TMPR_ROTATEPLAYERS = 1<<1, + TMPR_CONTINUOUS = 1<<2, + TMPR_OVERRIDE = 1<<3, +} textmappolyrotate_t; + +typedef enum +{ + PTF_PLAYERS = 1, // Turn players with movement + PTF_OTHERS = 1<<1, // Turn other mobjs with movement +} polyturnflags_e; + typedef struct polyrotdata_s { INT32 polyObjNum; // numeric id of polyobject to affect INT32 direction; // direction of rotation INT32 speed; // angular speed INT32 distance; // distance to move - UINT8 turnobjs; // rotate objects being carried? - UINT8 overRide; // if true, will override any action on the object + UINT8 flags; // TMPR_ flags } polyrotdata_t; typedef struct polymovedata_s @@ -281,6 +294,20 @@ typedef struct polywaypointdata_s UINT8 flags; // PWF_ flags } polywaypointdata_t; +typedef enum +{ + TMPV_NOCHANGE = 1, + TMPV_VISIBLE = 1<<1, + TMPV_INVISIBLE = 1<<2, +} textmappolyvisibility_t; + +typedef enum +{ + TMPT_NOCHANGE = 1, + TMPT_TANGIBLE = 1<<1, + TMPT_INTANGIBLE = 1<<2, +} textmappolytangibility_t; + // polyobject door types typedef enum { @@ -322,6 +349,15 @@ typedef struct polyflagdata_s fixed_t momx; } polyflagdata_t; +typedef enum +{ + TMPF_RELATIVE = 1, + TMPF_OVERRIDE = 1<<1, + TMPF_TICBASED = 1<<2, + TMPF_IGNORECOLLISION = 1<<3, + TMPF_GHOSTFADE = 1<<4, +} textmappolyfade_t; + typedef struct polyfadedata_s { INT32 polyObjNum; @@ -337,7 +373,7 @@ typedef struct polyfadedata_s // boolean Polyobj_moveXY(polyobj_t *po, fixed_t x, fixed_t y, boolean checkmobjs); -boolean Polyobj_rotate(polyobj_t *po, angle_t delta, UINT8 turnthings, boolean checkmobjs); +boolean Polyobj_rotate(polyobj_t *po, angle_t delta, boolean turnplayers, boolean turnothers, boolean checkmobjs); polyobj_t *Polyobj_GetForNum(INT32 id); void Polyobj_InitLevel(void); void Polyobj_MoveOnLoad(polyobj_t *po, angle_t angle, fixed_t x, fixed_t y); diff --git a/src/p_saveg.c b/src/p_saveg.c index 99ec58bb9..668ca08f0 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -850,6 +850,17 @@ static void P_NetUnArchiveWaypoints(void) #define SD_TAGLIST 0x01 #define SD_COLORMAP 0x02 #define SD_CRUMBLESTATE 0x04 +#define SD_FLOORLIGHT 0x08 +#define SD_CEILLIGHT 0x10 +#define SD_FLAG 0x20 +#define SD_SPECIALFLAG 0x40 +#define SD_DIFF4 0x80 + +//diff4 flags +#define SD_DAMAGETYPE 0x01 +#define SD_TRIGGERTAG 0x02 +#define SD_TRIGGERER 0x04 +#define SD_GRAVITY 0x08 #define LD_FLAG 0x01 #define LD_SPECIAL 0x02 @@ -988,11 +999,11 @@ static void ArchiveSectors(void) size_t i, j; const sector_t *ss = sectors; const sector_t *spawnss = spawnsectors; - UINT8 diff, diff2, diff3; + UINT8 diff, diff2, diff3, diff4; for (i = 0; i < numsectors; i++, ss++, spawnss++) { - diff = diff2 = diff3 = 0; + diff = diff2 = diff3 = diff4 = 0; if (ss->floorheight != spawnss->floorheight) diff |= SD_FLOORHT; if (ss->ceilingheight != spawnss->ceilingheight) @@ -1031,9 +1042,29 @@ static void ArchiveSectors(void) if (ss->crumblestate) diff3 |= SD_CRUMBLESTATE; + if (ss->floorlightlevel != spawnss->floorlightlevel || ss->floorlightabsolute != spawnss->floorlightabsolute) + diff3 |= SD_FLOORLIGHT; + if (ss->ceilinglightlevel != spawnss->ceilinglightlevel || ss->ceilinglightabsolute != spawnss->ceilinglightabsolute) + diff3 |= SD_CEILLIGHT; + if (ss->flags != spawnss->flags) + diff3 |= SD_FLAG; + if (ss->specialflags != spawnss->specialflags) + diff3 |= SD_SPECIALFLAG; + if (ss->damagetype != spawnss->damagetype) + diff4 |= SD_DAMAGETYPE; + if (ss->triggertag != spawnss->triggertag) + diff4 |= SD_TRIGGERTAG; + if (ss->triggerer != spawnss->triggerer) + diff4 |= SD_TRIGGERER; + if (ss->gravity != spawnss->gravity) + diff4 |= SD_GRAVITY; + if (ss->ffloors && CheckFFloorDiff(ss)) diff |= SD_FFLOORS; + if (diff4) + diff3 |= SD_DIFF4; + if (diff3) diff2 |= SD_DIFF3; @@ -1048,6 +1079,8 @@ static void ArchiveSectors(void) WRITEUINT8(save_p, diff2); if (diff2 & SD_DIFF3) WRITEUINT8(save_p, diff3); + if (diff3 & SD_DIFF4) + WRITEUINT8(save_p, diff4); if (diff & SD_FLOORHT) WRITEFIXED(save_p, ss->floorheight); if (diff & SD_CEILHT) @@ -1084,6 +1117,28 @@ static void ArchiveSectors(void) // returns existing index if already added, or appends to net_colormaps and returns new index if (diff3 & SD_CRUMBLESTATE) WRITEINT32(save_p, ss->crumblestate); + if (diff3 & SD_FLOORLIGHT) + { + WRITEINT16(save_p, ss->floorlightlevel); + WRITEUINT8(save_p, ss->floorlightabsolute); + } + if (diff3 & SD_CEILLIGHT) + { + WRITEINT16(save_p, ss->ceilinglightlevel); + WRITEUINT8(save_p, ss->ceilinglightabsolute); + } + if (diff3 & SD_FLAG) + WRITEUINT32(save_p, ss->flags); + if (diff3 & SD_SPECIALFLAG) + WRITEUINT32(save_p, ss->specialflags); + if (diff4 & SD_DAMAGETYPE) + WRITEUINT8(save_p, ss->damagetype); + if (diff4 & SD_TRIGGERTAG) + WRITEINT16(save_p, ss->triggertag); + if (diff4 & SD_TRIGGERER) + WRITEUINT8(save_p, ss->triggerer); + if (diff4 & SD_GRAVITY) + WRITEFIXED(save_p, ss->gravity); if (diff & SD_FFLOORS) ArchiveFFloors(ss); } @@ -1095,7 +1150,7 @@ static void ArchiveSectors(void) static void UnArchiveSectors(void) { UINT16 i, j; - UINT8 diff, diff2, diff3; + UINT8 diff, diff2, diff3, diff4; for (;;) { i = READUINT16(save_p); @@ -1115,6 +1170,10 @@ static void UnArchiveSectors(void) diff3 = READUINT8(save_p); else diff3 = 0; + if (diff3 & SD_DIFF4) + diff4 = READUINT8(save_p); + else + diff4 = 0; if (diff & SD_FLOORHT) sectors[i].floorheight = READFIXED(save_p); @@ -1175,6 +1234,31 @@ static void UnArchiveSectors(void) sectors[i].extra_colormap = GetNetColormapFromList(READUINT32(save_p)); if (diff3 & SD_CRUMBLESTATE) sectors[i].crumblestate = READINT32(save_p); + if (diff3 & SD_FLOORLIGHT) + { + sectors[i].floorlightlevel = READINT16(save_p); + sectors[i].floorlightabsolute = READUINT8(save_p); + } + if (diff3 & SD_CEILLIGHT) + { + sectors[i].ceilinglightlevel = READINT16(save_p); + sectors[i].ceilinglightabsolute = READUINT8(save_p); + } + if (diff3 & SD_FLAG) + { + sectors[i].flags = READUINT32(save_p); + CheckForReverseGravity |= (sectors[i].flags & MSF_GRAVITYFLIP); + } + if (diff3 & SD_SPECIALFLAG) + sectors[i].specialflags = READUINT32(save_p); + if (diff4 & SD_DAMAGETYPE) + sectors[i].damagetype = READUINT8(save_p); + if (diff4 & SD_TRIGGERTAG) + sectors[i].triggertag = READINT16(save_p); + if (diff4 & SD_TRIGGERER) + sectors[i].triggerer = READUINT8(save_p); + if (diff4 & SD_GRAVITY) + sectors[i].gravity = READFIXED(save_p); if (diff & SD_FFLOORS) UnArchiveFFloors(§ors[i]); @@ -1985,7 +2069,6 @@ static void SaveEachTimeThinker(const thinker_t *th, const UINT8 type) for (i = 0; i < MAXPLAYERS; i++) { WRITECHAR(save_p, ht->playersInArea[i]); - WRITECHAR(save_p, ht->playersOnArea[i]); } WRITECHAR(save_p, ht->triggerOnExit); } @@ -2013,14 +2096,12 @@ static void SaveCeilingThinker(const thinker_t *th, const UINT8 type) WRITEFIXED(save_p, ht->bottomheight); WRITEFIXED(save_p, ht->topheight); WRITEFIXED(save_p, ht->speed); - WRITEFIXED(save_p, ht->oldspeed); WRITEFIXED(save_p, ht->delay); WRITEFIXED(save_p, ht->delaytimer); WRITEUINT8(save_p, ht->crush); WRITEINT32(save_p, ht->texture); WRITEINT32(save_p, ht->direction); - WRITEINT32(save_p, ht->tag); - WRITEINT32(save_p, ht->olddirection); + WRITEINT16(save_p, ht->tag); WRITEFIXED(save_p, ht->origspeed); WRITEFIXED(save_p, ht->sourceline); } @@ -2039,6 +2120,8 @@ static void SaveFloormoveThinker(const thinker_t *th, const UINT8 type) WRITEFIXED(save_p, ht->origspeed); WRITEFIXED(save_p, ht->delay); WRITEFIXED(save_p, ht->delaytimer); + WRITEINT16(save_p, ht->tag); + WRITEFIXED(save_p, ht->sourceline); } static void SaveLightflashThinker(const thinker_t *th, const UINT8 type) @@ -2056,8 +2139,8 @@ static void SaveStrobeThinker(const thinker_t *th, const UINT8 type) WRITEUINT8(save_p, type); WRITEUINT32(save_p, SaveSector(ht->sector)); WRITEINT32(save_p, ht->count); - WRITEINT32(save_p, ht->minlight); - WRITEINT32(save_p, ht->maxlight); + WRITEINT16(save_p, ht->minlight); + WRITEINT16(save_p, ht->maxlight); WRITEINT32(save_p, ht->darktime); WRITEINT32(save_p, ht->brighttime); } @@ -2067,10 +2150,10 @@ static void SaveGlowThinker(const thinker_t *th, const UINT8 type) const glow_t *ht = (const void *)th; WRITEUINT8(save_p, type); WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEINT32(save_p, ht->minlight); - WRITEINT32(save_p, ht->maxlight); - WRITEINT32(save_p, ht->direction); - WRITEINT32(save_p, ht->speed); + WRITEINT16(save_p, ht->minlight); + WRITEINT16(save_p, ht->maxlight); + WRITEINT16(save_p, ht->direction); + WRITEINT16(save_p, ht->speed); } static inline void SaveFireflickerThinker(const thinker_t *th, const UINT8 type) @@ -2080,8 +2163,8 @@ static inline void SaveFireflickerThinker(const thinker_t *th, const UINT8 type) WRITEUINT32(save_p, SaveSector(ht->sector)); WRITEINT32(save_p, ht->count); WRITEINT32(save_p, ht->resetcount); - WRITEINT32(save_p, ht->maxlight); - WRITEINT32(save_p, ht->minlight); + WRITEINT16(save_p, ht->maxlight); + WRITEINT16(save_p, ht->minlight); } static void SaveElevatorThinker(const thinker_t *th, const UINT8 type) @@ -2155,13 +2238,9 @@ static inline void SavePusherThinker(const thinker_t *th, const UINT8 type) const pusher_t *ht = (const void *)th; WRITEUINT8(save_p, type); WRITEUINT8(save_p, ht->type); - WRITEINT32(save_p, ht->x_mag); - WRITEINT32(save_p, ht->y_mag); - WRITEINT32(save_p, ht->magnitude); - WRITEINT32(save_p, ht->radius); - WRITEINT32(save_p, ht->x); - WRITEINT32(save_p, ht->y); - WRITEINT32(save_p, ht->z); + WRITEFIXED(save_p, ht->x_mag); + WRITEFIXED(save_p, ht->y_mag); + WRITEFIXED(save_p, ht->z_mag); WRITEINT32(save_p, ht->affectee); WRITEUINT8(save_p, ht->roverpusher); WRITEINT32(save_p, ht->referrer); @@ -2259,18 +2338,30 @@ static void SavePlaneDisplaceThinker(const thinker_t *th, const UINT8 type) WRITEUINT8(save_p, ht->type); } -static inline void SaveDynamicSlopeThinker(const thinker_t *th, const UINT8 type) +static inline void SaveDynamicLineSlopeThinker(const thinker_t *th, const UINT8 type) { - const dynplanethink_t* ht = (const void*)th; + const dynlineplanethink_t* ht = (const void*)th; WRITEUINT8(save_p, type); WRITEUINT8(save_p, ht->type); WRITEUINT32(save_p, SaveSlope(ht->slope)); WRITEUINT32(save_p, SaveLine(ht->sourceline)); WRITEFIXED(save_p, ht->extent); +} - WRITEMEM(save_p, ht->tags, sizeof(ht->tags)); - WRITEMEM(save_p, ht->vex, sizeof(ht->vex)); +static inline void SaveDynamicVertexSlopeThinker(const thinker_t *th, const UINT8 type) +{ + size_t i; + const dynvertexplanethink_t* ht = (const void*)th; + + WRITEUINT8(save_p, type); + WRITEUINT32(save_p, SaveSlope(ht->slope)); + for (i = 0; i < 3; i++) + WRITEUINT32(save_p, SaveSector(ht->secs[i])); + WRITEMEM(save_p, ht->vex, sizeof(ht->vex)); + WRITEMEM(save_p, ht->origsecheights, sizeof(ht->origsecheights)); + WRITEMEM(save_p, ht->origvecheights, sizeof(ht->origvecheights)); + WRITEUINT8(save_p, ht->relative); } static inline void SavePolyrotatetThinker(const thinker_t *th, const UINT8 type) @@ -2595,12 +2686,12 @@ static void P_NetArchiveThinkers(void) } else if (th->function.acp1 == (actionf_p1)T_DynamicSlopeLine) { - SaveDynamicSlopeThinker(th, tc_dynslopeline); + SaveDynamicLineSlopeThinker(th, tc_dynslopeline); continue; } else if (th->function.acp1 == (actionf_p1)T_DynamicSlopeVert) { - SaveDynamicSlopeThinker(th, tc_dynslopevert); + SaveDynamicVertexSlopeThinker(th, tc_dynslopevert); continue; } #ifdef PARANOIA @@ -2715,7 +2806,7 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) { UINT16 spawnpointnum = READUINT16(save_p); - if (mapthings[spawnpointnum].type == 1705 || mapthings[spawnpointnum].type == 1713) // NiGHTS Hoop special case + if (mapthings[spawnpointnum].type == 1713) // NiGHTS Hoop special case { P_SpawnHoop(&mapthings[spawnpointnum]); return NULL; @@ -3090,7 +3181,6 @@ static thinker_t* LoadEachTimeThinker(actionf_p1 thinker) for (i = 0; i < MAXPLAYERS; i++) { ht->playersInArea[i] = READCHAR(save_p); - ht->playersOnArea[i] = READCHAR(save_p); } ht->triggerOnExit = READCHAR(save_p); return &ht->thinker; @@ -3120,14 +3210,12 @@ static thinker_t* LoadCeilingThinker(actionf_p1 thinker) ht->bottomheight = READFIXED(save_p); ht->topheight = READFIXED(save_p); ht->speed = READFIXED(save_p); - ht->oldspeed = READFIXED(save_p); ht->delay = READFIXED(save_p); ht->delaytimer = READFIXED(save_p); ht->crush = READUINT8(save_p); ht->texture = READINT32(save_p); ht->direction = READINT32(save_p); - ht->tag = READINT32(save_p); - ht->olddirection = READINT32(save_p); + ht->tag = READINT16(save_p); ht->origspeed = READFIXED(save_p); ht->sourceline = READFIXED(save_p); if (ht->sector) @@ -3149,6 +3237,8 @@ static thinker_t* LoadFloormoveThinker(actionf_p1 thinker) ht->origspeed = READFIXED(save_p); ht->delay = READFIXED(save_p); ht->delaytimer = READFIXED(save_p); + ht->tag = READINT16(save_p); + ht->sourceline = READFIXED(save_p); if (ht->sector) ht->sector->floordata = ht; return &ht->thinker; @@ -3172,8 +3262,8 @@ static thinker_t* LoadStrobeThinker(actionf_p1 thinker) ht->thinker.function.acp1 = thinker; ht->sector = LoadSector(READUINT32(save_p)); ht->count = READINT32(save_p); - ht->minlight = READINT32(save_p); - ht->maxlight = READINT32(save_p); + ht->minlight = READINT16(save_p); + ht->maxlight = READINT16(save_p); ht->darktime = READINT32(save_p); ht->brighttime = READINT32(save_p); if (ht->sector) @@ -3186,10 +3276,10 @@ static thinker_t* LoadGlowThinker(actionf_p1 thinker) glow_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; ht->sector = LoadSector(READUINT32(save_p)); - ht->minlight = READINT32(save_p); - ht->maxlight = READINT32(save_p); - ht->direction = READINT32(save_p); - ht->speed = READINT32(save_p); + ht->minlight = READINT16(save_p); + ht->maxlight = READINT16(save_p); + ht->direction = READINT16(save_p); + ht->speed = READINT16(save_p); if (ht->sector) ht->sector->lightingdata = ht; return &ht->thinker; @@ -3202,8 +3292,8 @@ static thinker_t* LoadFireflickerThinker(actionf_p1 thinker) ht->sector = LoadSector(READUINT32(save_p)); ht->count = READINT32(save_p); ht->resetcount = READINT32(save_p); - ht->maxlight = READINT32(save_p); - ht->minlight = READINT32(save_p); + ht->maxlight = READINT16(save_p); + ht->minlight = READINT16(save_p); if (ht->sector) ht->sector->lightingdata = ht; return &ht->thinker; @@ -3295,19 +3385,14 @@ static thinker_t* LoadPusherThinker(actionf_p1 thinker) pusher_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; ht->type = READUINT8(save_p); - ht->x_mag = READINT32(save_p); - ht->y_mag = READINT32(save_p); - ht->magnitude = READINT32(save_p); - ht->radius = READINT32(save_p); - ht->x = READINT32(save_p); - ht->y = READINT32(save_p); - ht->z = READINT32(save_p); + ht->x_mag = READFIXED(save_p); + ht->y_mag = READFIXED(save_p); + ht->z_mag = READFIXED(save_p); ht->affectee = READINT32(save_p); ht->roverpusher = READUINT8(save_p); ht->referrer = READINT32(save_p); ht->exclusive = READINT32(save_p); ht->slider = READINT32(save_p); - ht->source = P_GetPushThing(ht->affectee); return &ht->thinker; } @@ -3431,17 +3516,31 @@ static inline thinker_t* LoadPlaneDisplaceThinker(actionf_p1 thinker) return &ht->thinker; } -static inline thinker_t* LoadDynamicSlopeThinker(actionf_p1 thinker) +static inline thinker_t* LoadDynamicLineSlopeThinker(actionf_p1 thinker) { - dynplanethink_t* ht = Z_Malloc(sizeof(*ht), PU_LEVSPEC, NULL); + dynlineplanethink_t* ht = Z_Malloc(sizeof(*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; ht->type = READUINT8(save_p); ht->slope = LoadSlope(READUINT32(save_p)); ht->sourceline = LoadLine(READUINT32(save_p)); ht->extent = READFIXED(save_p); - READMEM(save_p, ht->tags, sizeof(ht->tags)); + return &ht->thinker; +} + +static inline thinker_t* LoadDynamicVertexSlopeThinker(actionf_p1 thinker) +{ + size_t i; + dynvertexplanethink_t* ht = Z_Malloc(sizeof(*ht), PU_LEVSPEC, NULL); + ht->thinker.function.acp1 = thinker; + + ht->slope = LoadSlope(READUINT32(save_p)); + for (i = 0; i < 3; i++) + ht->secs[i] = LoadSector(READUINT32(save_p)); READMEM(save_p, ht->vex, sizeof(ht->vex)); + READMEM(save_p, ht->origsecheights, sizeof(ht->origsecheights)); + READMEM(save_p, ht->origvecheights, sizeof(ht->origvecheights)); + ht->relative = READUINT8(save_p); return &ht->thinker; } @@ -3754,11 +3853,11 @@ static void P_NetUnArchiveThinkers(void) break; case tc_dynslopeline: - th = LoadDynamicSlopeThinker((actionf_p1)T_DynamicSlopeLine); + th = LoadDynamicLineSlopeThinker((actionf_p1)T_DynamicSlopeLine); break; case tc_dynslopevert: - th = LoadDynamicSlopeThinker((actionf_p1)T_DynamicSlopeVert); + th = LoadDynamicVertexSlopeThinker((actionf_p1)T_DynamicSlopeVert); break; case tc_scroll: diff --git a/src/p_setup.c b/src/p_setup.c index b4675b27d..083b8f236 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -745,7 +745,7 @@ void P_ReloadRings(void) mt->mobj = NULL; P_SetBonusTime(P_SpawnMapThing(mt)); } - else if (mt->type >= 600 && mt->type <= 609) // Item patterns + else if (mt->type >= 600 && mt->type <= 611) // Item patterns { mt->mobj = NULL; P_SpawnItemPattern(mt, true); @@ -904,9 +904,9 @@ static void P_SpawnMapThings(boolean spawnemblems) mt->mobj = NULL; - if (mt->type >= 600 && mt->type <= 609) // item patterns + if (mt->type >= 600 && mt->type <= 611) // item patterns P_SpawnItemPattern(mt, false); - else if (mt->type == 1705 || mt->type == 1713) // hoops + else if (mt->type == 1713) // hoops P_SpawnHoop(mt); else // Everything else P_SpawnMapThing(mt); @@ -918,7 +918,7 @@ static void P_SpawnMapThings(boolean spawnemblems) } // Experimental groovy write function! -void P_WriteThings(void) +/*void P_WriteThings(void) { size_t i, length; mapthing_t *mt; @@ -953,7 +953,7 @@ void P_WriteThings(void) savebuf_p = NULL; CONS_Printf(M_GetText("newthings%d.lmp saved.\n"), gamemap); -} +}*/ // // MAP LOADING FUNCTIONS @@ -1010,9 +1010,7 @@ static void P_InitializeSector(sector_t *ss) ss->extra_colormap = NULL; - ss->gravity = NULL; - ss->verticalflip = false; - ss->flags = SF_FLIPSPECIAL_FLOOR; + ss->gravityptr = NULL; ss->cullheight = NULL; @@ -1054,8 +1052,21 @@ static void P_LoadSectors(UINT8 *data) ss->floorpic_angle = ss->ceilingpic_angle = 0; + ss->floorlightlevel = ss->ceilinglightlevel = 0; + ss->floorlightabsolute = ss->ceilinglightabsolute = false; + ss->colormap_protected = false; + ss->gravity = FRACUNIT; + + ss->flags = MSF_FLIPSPECIAL_FLOOR; + ss->specialflags = 0; + ss->damagetype = SD_NONE; + ss->triggertag = 0; + ss->triggerer = TO_PLAYER; + + ss->friction = ORIG_FRICTION; + P_InitializeSector(ss); } } @@ -1214,7 +1225,7 @@ static void P_LoadSidedefs(UINT8 *data) isfrontside = sd->line->sidenum[0] == i; // Repeat count for midtexture - if (((sd->line->flags & (ML_TWOSIDED|ML_EFFECT5)) == (ML_TWOSIDED|ML_EFFECT5)) + if (((sd->line->flags & (ML_TWOSIDED|ML_WRAPMIDTEX)) == (ML_TWOSIDED|ML_WRAPMIDTEX)) && !(sd->special >= 300 && sd->special < 500)) // exempt linedef exec specials { sd->repeatcnt = (INT16)(((UINT16)textureoffset) >> 12); @@ -1237,11 +1248,8 @@ static void P_LoadSidedefs(UINT8 *data) case 455: // Fade colormaps! mazmazz 9/12/2018 (:flag_us:) // SoM: R_CreateColormap will only create a colormap in software mode... // Perhaps we should just call it instead of doing the calculations here. - if (!udmf) - { - sd->colormap_data = R_CreateColormapFromLinedef(msd->toptexture, msd->midtexture, msd->bottomtexture); - sd->toptexture = sd->midtexture = sd->bottomtexture = 0; - } + sd->colormap_data = R_CreateColormapFromLinedef(msd->toptexture, msd->midtexture, msd->bottomtexture); + sd->toptexture = sd->midtexture = sd->bottomtexture = 0; break; case 413: // Change music @@ -1283,7 +1291,6 @@ static void P_LoadSidedefs(UINT8 *data) } case 4: // Speed pad parameters - case 414: // Play SFX { sd->toptexture = sd->midtexture = sd->bottomtexture = 0; if (msd->toptexture[0] != '-' || msd->toptexture[1] != '\0') @@ -1296,17 +1303,23 @@ static void P_LoadSidedefs(UINT8 *data) break; } + case 414: // Play SFX + { + sd->toptexture = sd->midtexture = sd->bottomtexture = 0; + if (msd->toptexture[0] != '-' || msd->toptexture[1] != '\0') + { + char process[8 + 1]; + M_Memcpy(process, msd->toptexture, 8); + process[8] = '\0'; + sd->text = Z_Malloc(strlen(process) + 1, PU_LEVEL, NULL); + M_Memcpy(sd->text, process, strlen(process) + 1); + } + break; + } + case 9: // Mace parameters case 14: // Bustable block parameters case 15: // Fan particle spawner parameters - case 334: // Trigger linedef executor: Object dye - Continuous - case 335: // Trigger linedef executor: Object dye - Each time - case 336: // Trigger linedef executor: Object dye - Once - case 425: // Calls P_SetMobjState on calling mobj - case 434: // Custom Power - case 442: // Calls P_SetMobjState on mobjs of a given type in the tagged sectors - case 461: // Spawns an object on the map based on texture offsets - case 463: // Colorizes an object { char process[8*3+1]; memset(process,0,8*3+1); @@ -1326,8 +1339,16 @@ static void P_LoadSidedefs(UINT8 *data) case 331: // Trigger linedef executor: Skin - Continuous case 332: // Trigger linedef executor: Skin - Each time case 333: // Trigger linedef executor: Skin - Once + case 334: // Trigger linedef executor: Object dye - Continuous + case 335: // Trigger linedef executor: Object dye - Each time + case 336: // Trigger linedef executor: Object dye - Once + case 425: // Calls P_SetMobjState on calling mobj + case 434: // Custom Power + case 442: // Calls P_SetMobjState on mobjs of a given type in the tagged sectors case 443: // Calls a named Lua function case 459: // Control text prompt (named tag) + case 461: // Spawns an object on the map based on texture offsets + case 463: // Colorizes an object { char process[8*3+1]; memset(process,0,8*3+1); @@ -1420,9 +1441,9 @@ UINT32 vertexesPos[UINT16_MAX]; UINT32 sectorsPos[UINT16_MAX]; // Determine total amount of map data in TEXTMAP. -static boolean TextmapCount(UINT8 *data, size_t size) +static boolean TextmapCount(size_t size) { - char *tkn = M_GetToken((char *)data); + const char *tkn = M_TokenizerRead(0); UINT8 brackets = 0; nummapthings = 0; @@ -1434,20 +1455,16 @@ static boolean TextmapCount(UINT8 *data, size_t size) // Look for namespace at the beginning. if (!fastcmp(tkn, "namespace")) { - Z_Free(tkn); CONS_Alert(CONS_ERROR, "No namespace at beginning of lump!\n"); return false; } - Z_Free(tkn); // Check if namespace is valid. - tkn = M_GetToken(NULL); + tkn = M_TokenizerRead(0); if (!fastcmp(tkn, "srb2")) CONS_Alert(CONS_WARNING, "Invalid namespace '%s', only 'srb2' is supported.\n", tkn); - Z_Free(tkn); - tkn = M_GetToken(NULL); - while (tkn && M_GetTokenPos() < size) + while ((tkn = M_TokenizerRead(0)) && M_TokenizerGetEndPos() < size) { // Avoid anything inside bracketed stuff, only look for external keywords. if (brackets) @@ -1459,24 +1476,19 @@ static boolean TextmapCount(UINT8 *data, size_t size) brackets++; // Check for valid fields. else if (fastcmp(tkn, "thing")) - mapthingsPos[nummapthings++] = M_GetTokenPos(); + mapthingsPos[nummapthings++] = M_TokenizerGetEndPos(); else if (fastcmp(tkn, "linedef")) - linesPos[numlines++] = M_GetTokenPos(); + linesPos[numlines++] = M_TokenizerGetEndPos(); else if (fastcmp(tkn, "sidedef")) - sidesPos[numsides++] = M_GetTokenPos(); + sidesPos[numsides++] = M_TokenizerGetEndPos(); else if (fastcmp(tkn, "vertex")) - vertexesPos[numvertexes++] = M_GetTokenPos(); + vertexesPos[numvertexes++] = M_TokenizerGetEndPos(); else if (fastcmp(tkn, "sector")) - sectorsPos[numsectors++] = M_GetTokenPos(); + sectorsPos[numsectors++] = M_TokenizerGetEndPos(); else CONS_Alert(CONS_NOTICE, "Unknown field '%s'.\n", tkn); - - Z_Free(tkn); - tkn = M_GetToken(NULL); } - Z_Free(tkn); - if (brackets) { CONS_Alert(CONS_ERROR, "Unclosed brackets detected in textmap lump.\n"); @@ -1486,7 +1498,7 @@ static boolean TextmapCount(UINT8 *data, size_t size) return true; } -static void ParseTextmapVertexParameter(UINT32 i, char *param, char *val) +static void ParseTextmapVertexParameter(UINT32 i, const char *param, const char *val) { if (fastcmp(param, "x")) vertexes[i].x = FLOAT_TO_FIXED(atof(val)); @@ -1533,7 +1545,7 @@ typedef struct textmap_plane_s { textmap_plane_t textmap_planefloor = {0, 0, 0, 0, 0}; textmap_plane_t textmap_planeceiling = {0, 0, 0, 0, 0}; -static void ParseTextmapSectorParameter(UINT32 i, char *param, char *val) +static void ParseTextmapSectorParameter(UINT32 i, const char *param, const char *val) { if (fastcmp(param, "heightfloor")) sectors[i].floorheight = atol(val) << FRACBITS; @@ -1545,13 +1557,19 @@ static void ParseTextmapSectorParameter(UINT32 i, char *param, char *val) sectors[i].ceilingpic = P_AddLevelFlat(val, foundflats); else if (fastcmp(param, "lightlevel")) sectors[i].lightlevel = atol(val); - else if (fastcmp(param, "special")) - sectors[i].special = atol(val); + else if (fastcmp(param, "lightfloor")) + sectors[i].floorlightlevel = atol(val); + else if (fastcmp(param, "lightfloorabsolute") && fastcmp("true", val)) + sectors[i].floorlightabsolute = true; + else if (fastcmp(param, "lightceiling")) + sectors[i].ceilinglightlevel = atol(val); + else if (fastcmp(param, "lightceilingabsolute") && fastcmp("true", val)) + sectors[i].ceilinglightabsolute = true; else if (fastcmp(param, "id")) Tag_FSet(§ors[i].tags, atol(val)); else if (fastcmp(param, "moreids")) { - char* id = val; + const char* id = val; while (id) { Tag_Add(§ors[i].tags, atol(id)); @@ -1653,9 +1671,94 @@ static void ParseTextmapSectorParameter(UINT32 i, char *param, char *val) } else if (fastcmp(param, "colormapprotected") && fastcmp("true", val)) sectors[i].colormap_protected = true; + else if (fastcmp(param, "flipspecial_nofloor") && fastcmp("true", val)) + sectors[i].flags &= ~MSF_FLIPSPECIAL_FLOOR; + else if (fastcmp(param, "flipspecial_ceiling") && fastcmp("true", val)) + sectors[i].flags |= MSF_FLIPSPECIAL_CEILING; + else if (fastcmp(param, "triggerspecial_touch") && fastcmp("true", val)) + sectors[i].flags |= MSF_TRIGGERSPECIAL_TOUCH; + else if (fastcmp(param, "triggerspecial_headbump") && fastcmp("true", val)) + sectors[i].flags |= MSF_TRIGGERSPECIAL_HEADBUMP; + else if (fastcmp(param, "triggerline_plane") && fastcmp("true", val)) + sectors[i].flags |= MSF_TRIGGERLINE_PLANE; + else if (fastcmp(param, "triggerline_mobj") && fastcmp("true", val)) + sectors[i].flags |= MSF_TRIGGERLINE_MOBJ; + else if (fastcmp(param, "invertprecip") && fastcmp("true", val)) + sectors[i].flags |= MSF_INVERTPRECIP; + else if (fastcmp(param, "gravityflip") && fastcmp("true", val)) + sectors[i].flags |= MSF_GRAVITYFLIP; + else if (fastcmp(param, "heatwave") && fastcmp("true", val)) + sectors[i].flags |= MSF_HEATWAVE; + else if (fastcmp(param, "noclipcamera") && fastcmp("true", val)) + sectors[i].flags |= MSF_NOCLIPCAMERA; + else if (fastcmp(param, "outerspace") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_OUTERSPACE; + else if (fastcmp(param, "doublestepup") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_DOUBLESTEPUP; + else if (fastcmp(param, "nostepdown") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_NOSTEPDOWN; + else if (fastcmp(param, "speedpad") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_SPEEDPAD; + else if (fastcmp(param, "starpostactivator") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_STARPOSTACTIVATOR; + else if (fastcmp(param, "exit") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_EXIT; + else if (fastcmp(param, "specialstagepit") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_SPECIALSTAGEPIT; + else if (fastcmp(param, "returnflag") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_RETURNFLAG; + else if (fastcmp(param, "redteambase") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_REDTEAMBASE; + else if (fastcmp(param, "blueteambase") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_BLUETEAMBASE; + else if (fastcmp(param, "fan") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_FAN; + else if (fastcmp(param, "supertransform") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_SUPERTRANSFORM; + else if (fastcmp(param, "forcespin") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_FORCESPIN; + else if (fastcmp(param, "zoomtubestart") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_ZOOMTUBESTART; + else if (fastcmp(param, "zoomtubeend") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_ZOOMTUBEEND; + else if (fastcmp(param, "finishline") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_FINISHLINE; + else if (fastcmp(param, "ropehang") && fastcmp("true", val)) + sectors[i].specialflags |= SSF_ROPEHANG; + else if (fastcmp(param, "friction")) + sectors[i].friction = FLOAT_TO_FIXED(atof(val)); + else if (fastcmp(param, "gravity")) + sectors[i].gravity = FLOAT_TO_FIXED(atof(val)); + else if (fastcmp(param, "damagetype")) + { + if (fastcmp(val, "Generic")) + sectors[i].damagetype = SD_GENERIC; + if (fastcmp(val, "Water")) + sectors[i].damagetype = SD_WATER; + if (fastcmp(val, "Fire")) + sectors[i].damagetype = SD_FIRE; + if (fastcmp(val, "Lava")) + sectors[i].damagetype = SD_LAVA; + if (fastcmp(val, "Electric")) + sectors[i].damagetype = SD_ELECTRIC; + if (fastcmp(val, "Spike")) + sectors[i].damagetype = SD_SPIKE; + if (fastcmp(val, "DeathPitTilt")) + sectors[i].damagetype = SD_DEATHPITTILT; + if (fastcmp(val, "DeathPitNoTilt")) + sectors[i].damagetype = SD_DEATHPITNOTILT; + if (fastcmp(val, "Instakill")) + sectors[i].damagetype = SD_INSTAKILL; + if (fastcmp(val, "SpecialStage")) + sectors[i].damagetype = SD_SPECIALSTAGE; + } + else if (fastcmp(param, "triggertag")) + sectors[i].triggertag = atol(val); + else if (fastcmp(param, "triggerer")) + sectors[i].triggerer = atol(val); } -static void ParseTextmapSidedefParameter(UINT32 i, char *param, char *val) +static void ParseTextmapSidedefParameter(UINT32 i, const char *param, const char *val) { if (fastcmp(param, "offsetx")) sides[i].textureoffset = atol(val)< 9) { - size_t argnum = param[3] - '0'; + size_t argnum = atol(param + 9); if (argnum >= NUMLINESTRINGARGS) return; lines[i].stringargs[argnum] = Z_Malloc(strlen(val) + 1, PU_LEVEL, NULL); @@ -1744,19 +1847,19 @@ static void ParseTextmapLinedefParameter(UINT32 i, char *param, char *val) else if (fastcmp(param, "dontpegbottom") && fastcmp("true", val)) lines[i].flags |= ML_DONTPEGBOTTOM; else if (fastcmp(param, "skewtd") && fastcmp("true", val)) - lines[i].flags |= ML_EFFECT1; + lines[i].flags |= ML_SKEWTD; else if (fastcmp(param, "noclimb") && fastcmp("true", val)) lines[i].flags |= ML_NOCLIMB; else if (fastcmp(param, "noskew") && fastcmp("true", val)) - lines[i].flags |= ML_EFFECT2; + lines[i].flags |= ML_NOSKEW; else if (fastcmp(param, "midpeg") && fastcmp("true", val)) - lines[i].flags |= ML_EFFECT3; + lines[i].flags |= ML_MIDPEG; else if (fastcmp(param, "midsolid") && fastcmp("true", val)) - lines[i].flags |= ML_EFFECT4; + lines[i].flags |= ML_MIDSOLID; else if (fastcmp(param, "wrapmidtex") && fastcmp("true", val)) - lines[i].flags |= ML_EFFECT5; - else if (fastcmp(param, "effect6") && fastcmp("true", val)) - lines[i].flags |= ML_EFFECT6; + lines[i].flags |= ML_WRAPMIDTEX; + /*else if (fastcmp(param, "effect6") && fastcmp("true", val)) + lines[i].flags |= ML_EFFECT6;*/ else if (fastcmp(param, "nonet") && fastcmp("true", val)) lines[i].flags |= ML_NONET; else if (fastcmp(param, "netonly") && fastcmp("true", val)) @@ -1767,13 +1870,13 @@ static void ParseTextmapLinedefParameter(UINT32 i, char *param, char *val) lines[i].flags |= ML_TFERLINE; } -static void ParseTextmapThingParameter(UINT32 i, char *param, char *val) +static void ParseTextmapThingParameter(UINT32 i, const char *param, const char *val) { if (fastcmp(param, "id")) Tag_FSet(&mapthings[i].tags, atol(val)); else if (fastcmp(param, "moreids")) { - char* id = val; + const char* id = val; while (id) { Tag_Add(&mapthings[i].tags, atol(id)); @@ -1798,18 +1901,12 @@ static void ParseTextmapThingParameter(UINT32 i, char *param, char *val) else if (fastcmp(param, "scale") || fastcmp(param, "scalex") || fastcmp(param, "scaley")) mapthings[i].scale = FLOAT_TO_FIXED(atof(val)); // Flags - else if (fastcmp(param, "extra") && fastcmp("true", val)) - mapthings[i].options |= MTF_EXTRA; else if (fastcmp(param, "flip") && fastcmp("true", val)) mapthings[i].options |= MTF_OBJECTFLIP; - else if (fastcmp(param, "objectspecial") && fastcmp("true", val)) - mapthings[i].options |= MTF_OBJECTSPECIAL; - else if (fastcmp(param, "ambush") && fastcmp("true", val)) - mapthings[i].options |= MTF_AMBUSH; - else if (strlen(param) == 7 && fastncmp(param, "arg", 3) && fastncmp(param + 4, "str", 3)) + else if (fastncmp(param, "stringarg", 9) && strlen(param) > 9) { - size_t argnum = param[3] - '0'; + size_t argnum = atol(param + 9); if (argnum >= NUMMAPTHINGSTRINGARGS) return; mapthings[i].stringargs[argnum] = Z_Malloc(strlen(val) + 1, PU_LEVEL, NULL); @@ -1830,32 +1927,25 @@ static void ParseTextmapThingParameter(UINT32 i, char *param, char *val) * \param Structure number (mapthings, sectors, ...). * \param Parser function pointer. */ -static void TextmapParse(UINT32 dataPos, size_t num, void (*parser)(UINT32, char *, char *)) +static void TextmapParse(UINT32 dataPos, size_t num, void (*parser)(UINT32, const char *, const char *)) { - char *param, *val; + const char *param, *val; - M_SetTokenPos(dataPos); - param = M_GetToken(NULL); + M_TokenizerSetEndPos(dataPos); + param = M_TokenizerRead(0); if (!fastcmp(param, "{")) { - Z_Free(param); CONS_Alert(CONS_WARNING, "Invalid UDMF data capsule!\n"); return; } - Z_Free(param); while (true) { - param = M_GetToken(NULL); + param = M_TokenizerRead(0); if (fastcmp(param, "}")) - { - Z_Free(param); break; - } - val = M_GetToken(NULL); + val = M_TokenizerRead(1); parser(num, param, val); - Z_Free(param); - Z_Free(val); } } @@ -1884,6 +1974,29 @@ static void TextmapFixFlatOffsets(sector_t *sec) } } +static void TextmapUnfixFlatOffsets(sector_t *sec) +{ + if (sec->floorpic_angle) + { + fixed_t pc = FINECOSINE(sec->floorpic_angle >> ANGLETOFINESHIFT); + fixed_t ps = FINESINE(sec->floorpic_angle >> ANGLETOFINESHIFT); + fixed_t xoffs = sec->floor_xoffs; + fixed_t yoffs = sec->floor_yoffs; + sec->floor_xoffs = (FixedMul(xoffs, ps) % MAXFLATSIZE) + (FixedMul(yoffs, pc) % MAXFLATSIZE); + sec->floor_yoffs = (FixedMul(xoffs, pc) % MAXFLATSIZE) - (FixedMul(yoffs, ps) % MAXFLATSIZE); + } + + if (sec->ceilingpic_angle) + { + fixed_t pc = FINECOSINE(sec->ceilingpic_angle >> ANGLETOFINESHIFT); + fixed_t ps = FINESINE(sec->ceilingpic_angle >> ANGLETOFINESHIFT); + fixed_t xoffs = sec->ceiling_xoffs; + fixed_t yoffs = sec->ceiling_yoffs; + sec->ceiling_xoffs = (FixedMul(xoffs, ps) % MAXFLATSIZE) + (FixedMul(yoffs, pc) % MAXFLATSIZE); + sec->ceiling_yoffs = (FixedMul(xoffs, pc) % MAXFLATSIZE) - (FixedMul(yoffs, ps) % MAXFLATSIZE); + } +} + static INT32 P_ColorToRGBA(INT32 color, UINT8 alpha) { UINT8 r = (color >> 16) & 0xFF; @@ -1892,6 +2005,651 @@ static INT32 P_ColorToRGBA(INT32 color, UINT8 alpha) return R_PutRgbaRGBA(r, g, b, alpha); } +static INT32 P_RGBAToColor(INT32 rgba) +{ + UINT8 r = R_GetRgbaR(rgba); + UINT8 g = R_GetRgbaG(rgba); + UINT8 b = R_GetRgbaB(rgba); + return (r << 16) | (g << 8) | b; +} + +typedef struct +{ + mapthing_t *teleport; + mapthing_t *altview; + mapthing_t *angleanchor; +} sectorspecialthings_t; + +static void P_WriteTextmap(void) +{ + size_t i, j; + FILE *f; + char *filepath = va(pandf, srb2home, "TEXTMAP"); + mtag_t firsttag; + mapthing_t *wmapthings; + vertex_t *wvertexes; + sector_t *wsectors; + line_t *wlines; + side_t *wsides; + mtag_t freetag; + sectorspecialthings_t *specialthings; + + f = fopen(filepath, "w"); + if (!f) + { + CONS_Alert(CONS_ERROR, M_GetText("Couldn't save map file %s\n"), filepath); + return; + } + + wmapthings = Z_Calloc(nummapthings * sizeof(*mapthings), PU_LEVEL, NULL); + wvertexes = Z_Calloc(numvertexes * sizeof(*vertexes), PU_LEVEL, NULL); + wsectors = Z_Calloc(numsectors * sizeof(*sectors), PU_LEVEL, NULL); + wlines = Z_Calloc(numlines * sizeof(*lines), PU_LEVEL, NULL); + wsides = Z_Calloc(numsides * sizeof(*sides), PU_LEVEL, NULL); + specialthings = Z_Calloc(numsectors * sizeof(*sectors), PU_LEVEL, NULL); + + memcpy(wmapthings, mapthings, nummapthings * sizeof(*mapthings)); + memcpy(wvertexes, vertexes, numvertexes * sizeof(*vertexes)); + memcpy(wsectors, sectors, numsectors * sizeof(*sectors)); + memcpy(wlines, lines, numlines * sizeof(*lines)); + memcpy(wsides, sides, numsides * sizeof(*sides)); + + for (i = 0; i < nummapthings; i++) + if (mapthings[i].tags.count) + wmapthings[i].tags.tags = memcpy(Z_Malloc(mapthings[i].tags.count * sizeof(mtag_t), PU_LEVEL, NULL), mapthings[i].tags.tags, mapthings[i].tags.count * sizeof(mtag_t)); + + for (i = 0; i < numsectors; i++) + if (sectors[i].tags.count) + wsectors[i].tags.tags = memcpy(Z_Malloc(sectors[i].tags.count*sizeof(mtag_t), PU_LEVEL, NULL), sectors[i].tags.tags, sectors[i].tags.count*sizeof(mtag_t)); + + for (i = 0; i < numlines; i++) + if (lines[i].tags.count) + wlines[i].tags.tags = memcpy(Z_Malloc(lines[i].tags.count * sizeof(mtag_t), PU_LEVEL, NULL), lines[i].tags.tags, lines[i].tags.count * sizeof(mtag_t)); + + freetag = Tag_NextUnused(0); + + for (i = 0; i < nummapthings; i++) + { + subsector_t *ss; + INT32 s; + + if (wmapthings[i].type != 751 && wmapthings[i].type != 752 && wmapthings[i].type != 758) + continue; + + ss = R_PointInSubsector(wmapthings[i].x << FRACBITS, wmapthings[i].y << FRACBITS); + + if (!ss) + continue; + + s = ss->sector - sectors; + + switch (wmapthings[i].type) + { + case 751: + if (!specialthings[s].teleport) + specialthings[s].teleport = &wmapthings[i]; + break; + case 752: + if (!specialthings[s].altview) + specialthings[s].altview = &wmapthings[i]; + break; + case 758: + if (!specialthings[s].angleanchor) + specialthings[s].angleanchor = &wmapthings[i]; + break; + default: + break; + } + } + + for (i = 0; i < numlines; i++) + { + INT32 s; + + switch (wlines[i].special) + { + case 1: + TAG_ITER_SECTORS(Tag_FGet(&wlines[i].tags), s) + { + CONS_Alert(CONS_WARNING, M_GetText("Linedef %d applies custom gravity to sector %d. Changes to this gravity at runtime will not be reflected in the converted map. Use linedef type 469 for this.\n"), i, s); + wsectors[s].gravity = FixedDiv(lines[i].frontsector->floorheight >> FRACBITS, 1000); + } + break; + case 2: + CONS_Alert(CONS_WARNING, M_GetText("Custom exit linedef %d detected. Changes to the next map at runtime will not be reflected in the converted map. Use linedef type 468 for this.\n"), i); + wlines[i].args[0] = lines[i].frontsector->floorheight >> FRACBITS; + wlines[i].args[2] = lines[i].frontsector->ceilingheight >> FRACBITS; + break; + case 5: + case 50: + case 51: + CONS_Alert(CONS_WARNING, M_GetText("Linedef %d has type %d, which is not supported in UDMF.\n"), i, wlines[i].special); + break; + case 61: + if (wlines[i].flags & ML_MIDSOLID) + continue; + if (!wlines[i].args[1]) + continue; + CONS_Alert(CONS_WARNING, M_GetText("Linedef %d with crusher type 61 rises twice as fast on spawn. This behavior is not supported in UDMF.\n"), i); + break; + case 76: + if (freetag == (mtag_t)MAXTAGS) + { + CONS_Alert(CONS_WARNING, M_GetText("No unused tag found. Linedef %d with type 76 cannot be converted.\n"), i); + break; + } + TAG_ITER_SECTORS(wlines[i].args[0], s) + for (j = 0; (unsigned)j < wsectors[s].linecount; j++) + { + line_t *line = wsectors[s].lines[j] - lines + wlines; + if (line->special < 100 || line->special >= 300) + continue; + Tag_Add(&line->tags, freetag); + } + wlines[i].args[0] = freetag; + freetag = Tag_NextUnused(freetag); + break; + case 259: + if (wlines[i].args[3] & FF_QUICKSAND) + CONS_Alert(CONS_WARNING, M_GetText("Quicksand properties of custom FOF on linedef %d cannot be converted. Use linedef type 75 instead.\n"), i); + if (wlines[i].args[3] & FF_BUSTUP) + CONS_Alert(CONS_WARNING, M_GetText("Bustable properties of custom FOF on linedef %d cannot be converted. Use linedef type 74 instead.\n"), i); + break; + case 412: + if ((s = Tag_Iterate_Sectors(wlines[i].args[0], 0)) < 0) + break; + if (!specialthings[s].teleport) + break; + if (freetag == (mtag_t)MAXTAGS) + { + CONS_Alert(CONS_WARNING, M_GetText("No unused tag found. Linedef %d with type 412 cannot be converted.\n"), i); + break; + } + Tag_Add(&specialthings[s].teleport->tags, freetag); + wlines[i].args[0] = freetag; + freetag = Tag_NextUnused(freetag); + break; + case 422: + if ((s = Tag_Iterate_Sectors(wlines[i].args[0], 0)) < 0) + break; + if (!specialthings[s].altview) + break; + if (freetag == (mtag_t)MAXTAGS) + { + CONS_Alert(CONS_WARNING, M_GetText("No unused tag found. Linedef %d with type 422 cannot be converted.\n"), i); + break; + } + Tag_Add(&specialthings[s].altview->tags, freetag); + wlines[i].args[0] = freetag; + specialthings[s].altview->pitch = wlines[i].args[2]; + freetag = Tag_NextUnused(freetag); + break; + case 447: + CONS_Alert(CONS_WARNING, M_GetText("Linedef %d has change colormap action, which cannot be converted automatically. Tag arg0 to a sector with the desired colormap.\n"), i); + if (wlines[i].flags & ML_TFERLINE) + CONS_Alert(CONS_WARNING, M_GetText("Linedef %d mixes front and back colormaps, which is not supported in UDMF. Copy one colormap to the target sector first, then mix in the second one.\n"), i); + break; + case 455: + CONS_Alert(CONS_WARNING, M_GetText("Linedef %d has fade colormap action, which cannot be converted automatically. Tag arg0 to a sector with the desired colormap.\n"), i); + if (wlines[i].flags & ML_TFERLINE) + CONS_Alert(CONS_WARNING, M_GetText("Linedef %d specifies starting colormap for the fade, which is not supported in UDMF. Change the colormap with linedef type 447 instead.\n"), i); + break; + case 457: + if ((s = Tag_Iterate_Sectors(wlines[i].args[0], 0)) < 0) + break; + if (!specialthings[s].angleanchor) + break; + if (freetag == (mtag_t)MAXTAGS) + { + CONS_Alert(CONS_WARNING, M_GetText("No unused tag found. Linedef %d with type 457 cannot be converted.\n"), i); + break; + } + Tag_Add(&specialthings[s].angleanchor->tags, freetag); + wlines[i].args[0] = freetag; + freetag = Tag_NextUnused(freetag); + break; + case 606: + if (wlines[i].args[0] == MTAG_GLOBAL) + { + sector_t *sec = wlines[i].frontsector - sectors + wsectors; + sec->extra_colormap = wsides[wlines[i].sidenum[0]].colormap_data; + } + else + { + TAG_ITER_SECTORS(wlines[i].args[0], s) + { + if (wsectors[s].colormap_protected) + continue; + + wsectors[s].extra_colormap = wsides[wlines[i].sidenum[0]].colormap_data; + if (freetag == (mtag_t)MAXTAGS) + { + CONS_Alert(CONS_WARNING, M_GetText("No unused tag found. Linedef %d with type 606 cannot be converted.\n"), i); + break; + } + Tag_Add(&wsectors[s].tags, freetag); + wlines[i].args[1] = freetag; + freetag = Tag_NextUnused(freetag); + break; + } + } + break; + default: + break; + } + + if (wlines[i].special >= 300 && wlines[i].special < 400 && wlines[i].flags & ML_WRAPMIDTEX) + CONS_Alert(CONS_WARNING, M_GetText("Linedef executor trigger linedef %d has disregard order flag, which is not supported in UDMF.\n"), i); + } + + for (i = 0; i < numsectors; i++) + { + if (Tag_Find(&wsectors[i].tags, LE_CAPSULE0)) + CONS_Alert(CONS_WARNING, M_GetText("Sector %d has reserved tag %d, which is not supported in UDMF. Use arg3 of the boss mapthing instead.\n"), i, LE_CAPSULE0); + if (Tag_Find(&wsectors[i].tags, LE_CAPSULE1)) + CONS_Alert(CONS_WARNING, M_GetText("Sector %d has reserved tag %d, which is not supported in UDMF. Use arg3 of the boss mapthing instead.\n"), i, LE_CAPSULE1); + if (Tag_Find(&wsectors[i].tags, LE_CAPSULE2)) + CONS_Alert(CONS_WARNING, M_GetText("Sector %d has reserved tag %d, which is not supported in UDMF. Use arg3 of the boss mapthing instead.\n"), i, LE_CAPSULE2); + + switch (GETSECSPECIAL(wsectors[i].special, 1)) + { + case 9: + case 10: + CONS_Alert(CONS_WARNING, M_GetText("Sector %d has ring drainer effect, which is not supported in UDMF. Use linedef type 462 instead.\n"), i); + break; + default: + break; + } + + switch (GETSECSPECIAL(wsectors[i].special, 2)) + { + case 6: + CONS_Alert(CONS_WARNING, M_GetText("Sector %d has emerald check trigger type, which is not supported in UDMF. Use linedef types 337-339 instead.\n"), i); + break; + case 7: + CONS_Alert(CONS_WARNING, M_GetText("Sector %d has NiGHTS mare trigger type, which is not supported in UDMF. Use linedef types 340-342 instead.\n"), i); + break; + case 9: + CONS_Alert(CONS_WARNING, M_GetText("Sector %d has Egg Capsule type, which is not supported in UDMF. Use linedef type 464 instead.\n"), i); + break; + default: + break; + } + } + + fprintf(f, "namespace = \"srb2\";\n"); + for (i = 0; i < nummapthings; i++) + { + fprintf(f, "thing // %d\n", i); + fprintf(f, "{\n"); + firsttag = Tag_FGet(&wmapthings[i].tags); + if (firsttag != 0) + fprintf(f, "id = %d;\n", firsttag); + if (wmapthings[i].tags.count > 1) + { + fprintf(f, "moreids = \""); + for (j = 1; j < wmapthings[i].tags.count; j++) + { + if (j > 1) + fprintf(f, " "); + fprintf(f, "%d", wmapthings[i].tags.tags[j]); + } + fprintf(f, "\";\n"); + } + fprintf(f, "x = %d;\n", wmapthings[i].x); + fprintf(f, "y = %d;\n", wmapthings[i].y); + if (wmapthings[i].z != 0) + fprintf(f, "height = %d;\n", wmapthings[i].z); + fprintf(f, "angle = %d;\n", wmapthings[i].angle); + if (wmapthings[i].pitch != 0) + fprintf(f, "pitch = %d;\n", wmapthings[i].pitch); + if (wmapthings[i].roll != 0) + fprintf(f, "roll = %d;\n", wmapthings[i].roll); + if (wmapthings[i].type != 0) + fprintf(f, "type = %d;\n", wmapthings[i].type); + if (wmapthings[i].scale != FRACUNIT) + fprintf(f, "scale = %f;\n", FIXED_TO_FLOAT(wmapthings[i].scale)); + if (wmapthings[i].options & MTF_OBJECTFLIP) + fprintf(f, "flip = true;\n"); + for (j = 0; j < NUMMAPTHINGARGS; j++) + if (wmapthings[i].args[j] != 0) + fprintf(f, "arg%d = %d;\n", j, wmapthings[i].args[j]); + for (j = 0; j < NUMMAPTHINGSTRINGARGS; j++) + if (mapthings[i].stringargs[j]) + fprintf(f, "stringarg%d = \"%s\";\n", j, mapthings[i].stringargs[j]); + fprintf(f, "}\n"); + fprintf(f, "\n"); + } + + for (i = 0; i < numvertexes; i++) + { + fprintf(f, "vertex // %d\n", i); + fprintf(f, "{\n"); + fprintf(f, "x = %f;\n", FIXED_TO_FLOAT(wvertexes[i].x)); + fprintf(f, "y = %f;\n", FIXED_TO_FLOAT(wvertexes[i].y)); + if (wvertexes[i].floorzset) + fprintf(f, "zfloor = %f;\n", FIXED_TO_FLOAT(wvertexes[i].floorz)); + if (wvertexes[i].ceilingzset) + fprintf(f, "zceiling = %f;\n", FIXED_TO_FLOAT(wvertexes[i].ceilingz)); + fprintf(f, "}\n"); + fprintf(f, "\n"); + } + + for (i = 0; i < numlines; i++) + { + fprintf(f, "linedef // %d\n", i); + fprintf(f, "{\n"); + fprintf(f, "v1 = %d;\n", wlines[i].v1 - vertexes); + fprintf(f, "v2 = %d;\n", wlines[i].v2 - vertexes); + fprintf(f, "sidefront = %d;\n", wlines[i].sidenum[0]); + if (wlines[i].sidenum[1] != 0xffff) + fprintf(f, "sideback = %d;\n", wlines[i].sidenum[1]); + firsttag = Tag_FGet(&wlines[i].tags); + if (firsttag != 0) + fprintf(f, "id = %d;\n", firsttag); + if (wlines[i].tags.count > 1) + { + fprintf(f, "moreids = \""); + for (j = 1; j < wlines[i].tags.count; j++) + { + if (j > 1) + fprintf(f, " "); + fprintf(f, "%d", wlines[i].tags.tags[j]); + } + fprintf(f, "\";\n"); + } + if (wlines[i].special != 0) + fprintf(f, "special = %d;\n", wlines[i].special); + for (j = 0; j < NUMLINEARGS; j++) + if (wlines[i].args[j] != 0) + fprintf(f, "arg%d = %d;\n", j, wlines[i].args[j]); + for (j = 0; j < NUMLINESTRINGARGS; j++) + if (lines[i].stringargs[j]) + fprintf(f, "stringarg%d = \"%s\";\n", j, lines[i].stringargs[j]); + if (wlines[i].alpha != FRACUNIT) + fprintf(f, "alpha = %f;\n", FIXED_TO_FLOAT(wlines[i].alpha)); + if (wlines[i].blendmode != AST_COPY) + { + switch (wlines[i].blendmode) + { + case AST_ADD: + fprintf(f, "renderstyle = \"add\";\n"); + break; + case AST_SUBTRACT: + fprintf(f, "renderstyle = \"subtract\";\n"); + break; + case AST_REVERSESUBTRACT: + fprintf(f, "renderstyle = \"reversesubtract\";\n"); + break; + case AST_MODULATE: + fprintf(f, "renderstyle = \"modulate\";\n"); + break; + case AST_FOG: + fprintf(f, "renderstyle = \"fog\";\n"); + break; + default: + break; + } + } + if (wlines[i].executordelay != 0 && wlines[i].backsector) + { + CONS_Alert(CONS_WARNING, M_GetText("Linedef %d has an executor delay. Changes to the delay at runtime will not be reflected in the converted map. Use linedef type 465 for this.\n"), i); + fprintf(f, "executordelay = %d;\n", (wlines[i].backsector->ceilingheight >> FRACBITS) + (wlines[i].backsector->floorheight >> FRACBITS)); + } + if (wlines[i].flags & ML_IMPASSIBLE) + fprintf(f, "blocking = true;\n"); + if (wlines[i].flags & ML_BLOCKMONSTERS) + fprintf(f, "blockmonsters = true;\n"); + if (wlines[i].flags & ML_TWOSIDED) + fprintf(f, "twosided = true;\n"); + if (wlines[i].flags & ML_DONTPEGTOP) + fprintf(f, "dontpegtop = true;\n"); + if (wlines[i].flags & ML_DONTPEGBOTTOM) + fprintf(f, "dontpegbottom = true;\n"); + if (wlines[i].flags & ML_SKEWTD) + fprintf(f, "skewtd = true;\n"); + if (wlines[i].flags & ML_NOCLIMB) + fprintf(f, "noclimb = true;\n"); + if (wlines[i].flags & ML_NOSKEW) + fprintf(f, "noskew = true;\n"); + if (wlines[i].flags & ML_MIDPEG) + fprintf(f, "midpeg = true;\n"); + if (wlines[i].flags & ML_MIDSOLID) + fprintf(f, "midsolid = true;\n"); + if (wlines[i].flags & ML_WRAPMIDTEX) + fprintf(f, "wrapmidtex = true;\n"); + if (wlines[i].flags & ML_NONET) + fprintf(f, "nonet = true;\n"); + if (wlines[i].flags & ML_NETONLY) + fprintf(f, "netonly = true;\n"); + if (wlines[i].flags & ML_BOUNCY) + fprintf(f, "bouncy = true;\n"); + if (wlines[i].flags & ML_TFERLINE) + fprintf(f, "transfer = true;\n"); + fprintf(f, "}\n"); + fprintf(f, "\n"); + } + + for (i = 0; i < numsides; i++) + { + fprintf(f, "sidedef // %d\n", i); + fprintf(f, "{\n"); + fprintf(f, "sector = %d;\n", wsides[i].sector - sectors); + if (wsides[i].textureoffset != 0) + fprintf(f, "offsetx = %d;\n", wsides[i].textureoffset >> FRACBITS); + if (wsides[i].rowoffset != 0) + fprintf(f, "offsety = %d;\n", wsides[i].rowoffset >> FRACBITS); + if (wsides[i].toptexture > 0 && wsides[i].toptexture < numtextures) + fprintf(f, "texturetop = \"%.*s\";\n", 8, textures[wsides[i].toptexture]->name); + if (wsides[i].bottomtexture > 0 && wsides[i].bottomtexture < numtextures) + fprintf(f, "texturebottom = \"%.*s\";\n", 8, textures[wsides[i].bottomtexture]->name); + if (wsides[i].midtexture > 0 && wsides[i].midtexture < numtextures) + fprintf(f, "texturemiddle = \"%.*s\";\n", 8, textures[wsides[i].midtexture]->name); + if (wsides[i].repeatcnt != 0) + fprintf(f, "repeatcnt = %d;\n", wsides[i].repeatcnt); + fprintf(f, "}\n"); + fprintf(f, "\n"); + } + + for (i = 0; i < numsectors; i++) + { + fprintf(f, "sector // %d\n", i); + fprintf(f, "{\n"); + fprintf(f, "heightfloor = %d;\n", wsectors[i].floorheight >> FRACBITS); + fprintf(f, "heightceiling = %d;\n", wsectors[i].ceilingheight >> FRACBITS); + if (wsectors[i].floorpic != -1) + fprintf(f, "texturefloor = \"%s\";\n", levelflats[wsectors[i].floorpic].name); + if (wsectors[i].ceilingpic != -1) + fprintf(f, "textureceiling = \"%s\";\n", levelflats[wsectors[i].ceilingpic].name); + fprintf(f, "lightlevel = %d;\n", wsectors[i].lightlevel); + if (wsectors[i].floorlightlevel != 0) + fprintf(f, "lightfloor = %d;\n", wsectors[i].floorlightlevel); + if (wsectors[i].floorlightabsolute) + fprintf(f, "lightfloorabsolute = true;\n"); + if (wsectors[i].ceilinglightlevel != 0) + fprintf(f, "lightceiling = %d;\n", wsectors[i].ceilinglightlevel); + if (wsectors[i].ceilinglightabsolute) + fprintf(f, "lightceilingabsolute = true;\n"); + firsttag = Tag_FGet(&wsectors[i].tags); + if (firsttag != 0) + fprintf(f, "id = %d;\n", firsttag); + if (wsectors[i].tags.count > 1) + { + fprintf(f, "moreids = \""); + for (j = 1; j < wsectors[i].tags.count; j++) + { + if (j > 1) + fprintf(f, " "); + fprintf(f, "%d", wsectors[i].tags.tags[j]); + } + fprintf(f, "\";\n"); + } + sector_t tempsec = wsectors[i]; + TextmapUnfixFlatOffsets(&tempsec); + if (tempsec.floor_xoffs != 0) + fprintf(f, "xpanningfloor = %f;\n", FIXED_TO_FLOAT(tempsec.floor_xoffs)); + if (tempsec.floor_yoffs != 0) + fprintf(f, "ypanningfloor = %f;\n", FIXED_TO_FLOAT(tempsec.floor_yoffs)); + if (tempsec.ceiling_xoffs != 0) + fprintf(f, "xpanningceiling = %f;\n", FIXED_TO_FLOAT(tempsec.ceiling_xoffs)); + if (tempsec.ceiling_yoffs != 0) + fprintf(f, "ypanningceiling = %f;\n", FIXED_TO_FLOAT(tempsec.ceiling_yoffs)); + if (wsectors[i].floorpic_angle != 0) + fprintf(f, "rotationfloor = %f;\n", FIXED_TO_FLOAT(AngleFixed(wsectors[i].floorpic_angle))); + if (wsectors[i].ceilingpic_angle != 0) + fprintf(f, "rotationceiling = %f;\n", FIXED_TO_FLOAT(AngleFixed(wsectors[i].ceilingpic_angle))); + if (wsectors[i].extra_colormap) + { + INT32 lightcolor = P_RGBAToColor(wsectors[i].extra_colormap->rgba); + UINT8 lightalpha = R_GetRgbaA(wsectors[i].extra_colormap->rgba); + INT32 fadecolor = P_RGBAToColor(wsectors[i].extra_colormap->fadergba); + UINT8 fadealpha = R_GetRgbaA(wsectors[i].extra_colormap->fadergba); + + if (lightcolor != 0) + fprintf(f, "lightcolor = %d;\n", lightcolor); + if (lightalpha != 25) + fprintf(f, "lightalpha = %d;\n", lightalpha); + if (fadecolor != 0) + fprintf(f, "fadecolor = %d;\n", fadecolor); + if (fadealpha != 25) + fprintf(f, "fadealpha = %d;\n", fadealpha); + if (wsectors[i].extra_colormap->fadestart != 0) + fprintf(f, "fadestart = %d;\n", wsectors[i].extra_colormap->fadestart); + if (wsectors[i].extra_colormap->fadeend != 31) + fprintf(f, "fadeend = %d;\n", wsectors[i].extra_colormap->fadeend); + if (wsectors[i].extra_colormap->flags & CMF_FOG) + fprintf(f, "colormapfog = true;\n"); + if (wsectors[i].extra_colormap->flags & CMF_FADEFULLBRIGHTSPRITES) + fprintf(f, "colormapfadesprites = true;\n"); + } + if (wsectors[i].colormap_protected) + fprintf(f, "colormapprotected = true;\n"); + if (!(wsectors[i].flags & MSF_FLIPSPECIAL_FLOOR)) + fprintf(f, "flipspecial_nofloor = true;\n"); + if (wsectors[i].flags & MSF_FLIPSPECIAL_CEILING) + fprintf(f, "flipspecial_ceiling = true;\n"); + if (wsectors[i].flags & MSF_TRIGGERSPECIAL_TOUCH) + fprintf(f, "triggerspecial_touch = true;\n"); + if (wsectors[i].flags & MSF_TRIGGERSPECIAL_HEADBUMP) + fprintf(f, "triggerspecial_headbump = true;\n"); + if (wsectors[i].flags & MSF_TRIGGERLINE_PLANE) + fprintf(f, "triggerline_plane = true;\n"); + if (wsectors[i].flags & MSF_TRIGGERLINE_MOBJ) + fprintf(f, "triggerline_mobj = true;\n"); + if (wsectors[i].flags & MSF_INVERTPRECIP) + fprintf(f, "invertprecip = true;\n"); + if (wsectors[i].flags & MSF_GRAVITYFLIP) + fprintf(f, "gravityflip = true;\n"); + if (wsectors[i].flags & MSF_HEATWAVE) + fprintf(f, "heatwave = true;\n"); + if (wsectors[i].flags & MSF_NOCLIPCAMERA) + fprintf(f, "noclipcamera = true;\n"); + if (wsectors[i].specialflags & SSF_OUTERSPACE) + fprintf(f, "outerspace = true;\n"); + if (wsectors[i].specialflags & SSF_DOUBLESTEPUP) + fprintf(f, "doublestepup = true;\n"); + if (wsectors[i].specialflags & SSF_NOSTEPDOWN) + fprintf(f, "nostepdown = true;\n"); + if (wsectors[i].specialflags & SSF_SPEEDPAD) + fprintf(f, "speedpad = true;\n"); + if (wsectors[i].specialflags & SSF_STARPOSTACTIVATOR) + fprintf(f, "starpostactivator = true;\n"); + if (wsectors[i].specialflags & SSF_EXIT) + fprintf(f, "exit = true;\n"); + if (wsectors[i].specialflags & SSF_SPECIALSTAGEPIT) + fprintf(f, "specialstagepit = true;\n"); + if (wsectors[i].specialflags & SSF_RETURNFLAG) + fprintf(f, "returnflag = true;\n"); + if (wsectors[i].specialflags & SSF_REDTEAMBASE) + fprintf(f, "redteambase = true;\n"); + if (wsectors[i].specialflags & SSF_BLUETEAMBASE) + fprintf(f, "blueteambase = true;\n"); + if (wsectors[i].specialflags & SSF_FAN) + fprintf(f, "fan = true;\n"); + if (wsectors[i].specialflags & SSF_SUPERTRANSFORM) + fprintf(f, "supertransform = true;\n"); + if (wsectors[i].specialflags & SSF_FORCESPIN) + fprintf(f, "forcespin = true;\n"); + if (wsectors[i].specialflags & SSF_ZOOMTUBESTART) + fprintf(f, "zoomtubestart = true;\n"); + if (wsectors[i].specialflags & SSF_ZOOMTUBEEND) + fprintf(f, "zoomtubeend = true;\n"); + if (wsectors[i].specialflags & SSF_FINISHLINE) + fprintf(f, "finishline = true;\n"); + if (wsectors[i].specialflags & SSF_ROPEHANG) + fprintf(f, "ropehang = true;\n"); + if (wsectors[i].friction != ORIG_FRICTION) + fprintf(f, "friction = %f;\n", FIXED_TO_FLOAT(wsectors[i].friction)); + if (wsectors[i].gravity != FRACUNIT) + fprintf(f, "gravity = %f;\n", FIXED_TO_FLOAT(wsectors[i].gravity)); + if (wsectors[i].damagetype != SD_NONE) + { + switch (wsectors[i].damagetype) + { + case SD_GENERIC: + fprintf(f, "damagetype = \"Generic\";\n"); + break; + case SD_WATER: + fprintf(f, "damagetype = \"Water\";\n"); + break; + case SD_FIRE: + fprintf(f, "damagetype = \"Fire\";\n"); + break; + case SD_LAVA: + fprintf(f, "damagetype = \"Lava\";\n"); + break; + case SD_ELECTRIC: + fprintf(f, "damagetype = \"Electric\";\n"); + break; + case SD_SPIKE: + fprintf(f, "damagetype = \"Spike\";\n"); + break; + case SD_DEATHPITTILT: + fprintf(f, "damagetype = \"DeathPitTilt\";\n"); + break; + case SD_DEATHPITNOTILT: + fprintf(f, "damagetype = \"DeathPitNoTilt\";\n"); + break; + case SD_INSTAKILL: + fprintf(f, "damagetype = \"Instakill\";\n"); + break; + case SD_SPECIALSTAGE: + fprintf(f, "damagetype = \"SpecialStage\";\n"); + break; + default: + break; + } + } + if (wsectors[i].triggertag != 0) + fprintf(f, "triggertag = %d;\n", wsectors[i].triggertag); + if (wsectors[i].triggerer != 0) + fprintf(f, "triggerer = %d;\n", wsectors[i].triggerer); + fprintf(f, "}\n"); + fprintf(f, "\n"); + } + + fclose(f); + + for (i = 0; i < nummapthings; i++) + if (wmapthings[i].tags.count) + Z_Free(wmapthings[i].tags.tags); + + for (i = 0; i < numsectors; i++) + if (wsectors[i].tags.count) + Z_Free(wsectors[i].tags.tags); + + for (i = 0; i < numlines; i++) + if (wlines[i].tags.count) + Z_Free(wlines[i].tags.tags); + + Z_Free(wmapthings); + Z_Free(wvertexes); + Z_Free(wsectors); + Z_Free(wlines); + Z_Free(wsides); + Z_Free(specialthings); +} + /** Loads the textmap data, after obtaining the elements count and allocating their respective space. */ static void P_LoadTextmap(void) @@ -1945,8 +2703,21 @@ static void P_LoadTextmap(void) sc->floorpic_angle = sc->ceilingpic_angle = 0; + sc->floorlightlevel = sc->ceilinglightlevel = 0; + sc->floorlightabsolute = sc->ceilinglightabsolute = false; + sc->colormap_protected = false; + sc->gravity = FRACUNIT; + + sc->flags = MSF_FLIPSPECIAL_FLOOR; + sc->specialflags = 0; + sc->damagetype = SD_NONE; + sc->triggertag = 0; + sc->triggerer = TO_PLAYER; + + sc->friction = ORIG_FRICTION; + textmap_colormap.used = false; textmap_colormap.lightcolor = 0; textmap_colormap.lightalpha = 25; @@ -2058,6 +2829,9 @@ static void P_ProcessLinedefsAfterSidedefs(void) ld->frontsector = sides[ld->sidenum[0]].sector; //e6y: Can't be -1 here ld->backsector = ld->sidenum[1] != 0xffff ? sides[ld->sidenum[1]].sector : 0; + if (udmf) + continue; + switch (ld->special) { // Compile linedef 'text' from both sidedefs 'text' for appropriate specials. @@ -2078,8 +2852,6 @@ static void P_ProcessLinedefsAfterSidedefs(void) break; case 447: // Change colormap case 455: // Fade colormap - if (udmf) - break; if (ld->flags & ML_DONTPEGBOTTOM) // alternate alpha (by texture offsets) { extracolormap_t *exc = R_CopyColormap(sides[ld->sidenum[0]].colormap_data, false); @@ -2123,8 +2895,12 @@ static boolean P_LoadMapData(const virtres_t *virt) if (udmf) // Count how many entries for each type we got in textmap. { virtlump_t *textmap = vres_Find(virt, "TEXTMAP"); - if (!TextmapCount(textmap->data, textmap->size)) + M_TokenizerOpen((char *)textmap->data); + if (!TextmapCount(textmap->size)) + { + M_TokenizerClose(); return false; + } } else { @@ -2178,7 +2954,10 @@ static boolean P_LoadMapData(const virtres_t *virt) // Load map data. if (udmf) + { P_LoadTextmap(); + M_TokenizerClose(); + } else { P_LoadVertices(virtvertexes->data); @@ -2484,11 +3263,17 @@ static boolean P_LoadExtendedSubsectorsAndSegs(UINT8 **data, nodetype_t nodetype linenum = (nodetype == NT_XGL3) ? READUINT32((*data)) : READUINT16((*data)); if (linenum != 0xFFFF && linenum >= numlines) - I_Error("P_LoadExtendedSubsectorsAndSegs: Seg %s in subsector %d has invalid linedef %d!\n", sizeu1(k), m, linenum); + I_Error("P_LoadExtendedSubsectorsAndSegs: Seg %s in subsector %d has invalid linedef %d!\n", sizeu1(k), i, linenum); segs[k].glseg = (linenum == 0xFFFF); segs[k].linedef = (linenum == 0xFFFF) ? NULL : &lines[linenum]; segs[k].side = READUINT8((*data)); } + while (segs[subsectors[i].firstline].glseg) + { + subsectors[i].firstline++; + if (subsectors[i].firstline == k) + I_Error("P_LoadExtendedSubsectorsAndSegs: Subsector %d does not have any valid segs!", i); + } break; case NT_XNOD: @@ -3117,7 +3902,7 @@ static void P_AddBinaryMapTags(void) boolean matches_target_tag = target_tag && Tag_Find(§ors[j].tags, target_tag); size_t k; for (k = 0; k < 4; k++) { - if (lines[i].flags & ML_EFFECT5) { + if (lines[i].flags & ML_WRAPMIDTEX) { if (matches_target_tag || (offset_tags[k] && Tag_Find(§ors[j].tags, offset_tags[k]))) { Tag_Add(§ors[j].tags, tag); break; @@ -3131,10 +3916,80 @@ static void P_AddBinaryMapTags(void) } } } + + for (i = 0; i < nummapthings; i++) + { + switch (mapthings[i].type) + { + case 291: + case 322: + case 750: + case 760: + case 761: + case 762: + Tag_FSet(&mapthings[i].tags, mapthings[i].angle); + break; + case 290: + case 292: + case 294: + case 780: + Tag_FSet(&mapthings[i].tags, mapthings[i].extrainfo); + break; + default: + break; + } + } } -//For maps in binary format, converts setup of specials to UDMF format. -static void P_ConvertBinaryMap(void) +static void P_WriteConstant(INT32 constant, char **target) +{ + char buffer[12]; + sprintf(buffer, "%d", constant); + *target = Z_Malloc(strlen(buffer) + 1, PU_LEVEL, NULL); + M_Memcpy(*target, buffer, strlen(buffer) + 1); +} + +static line_t *P_FindPointPushLine(taglist_t *list) +{ + INT32 i, l; + + for (i = 0; i < list->count; i++) + { + mtag_t tag = list->tags[i]; + TAG_ITER_LINES(tag, l) + { + if (Tag_FGet(&lines[l].tags) != tag) + continue; + + if (lines[l].special != 547) + continue; + + return &lines[l]; + } + } + + return NULL; +} + +static void P_SetBinaryFOFAlpha(line_t *line) +{ + if (sides[line->sidenum[0]].toptexture > 0) + { + line->args[1] = sides[line->sidenum[0]].toptexture; + if (sides[line->sidenum[0]].toptexture >= 1001) + { + line->args[2] = (sides[line->sidenum[0]].toptexture/1000); + line->args[1] %= 1000; + } + } + else + { + line->args[1] = 128; + line->args[2] = TMB_TRANSLUCENT; + } +} + +static void P_ConvertBinaryLinedefTypes(void) { size_t i; @@ -3144,6 +3999,114 @@ static void P_ConvertBinaryMap(void) switch (lines[i].special) { + case 2: //Custom exit + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[1] |= TMEF_SKIPTALLY; + if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[1] |= TMEF_EMERALDCHECK; + break; + case 3: //Zoom tube parameters + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[2] = !!(lines[i].flags & ML_MIDSOLID); + break; + case 4: //Speed pad parameters + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + if (lines[i].flags & ML_MIDSOLID) + lines[i].args[1] |= TMSP_NOTELEPORT; + if (lines[i].flags & ML_WRAPMIDTEX) + lines[i].args[1] |= TMSP_FORCESPIN; + P_WriteConstant(sides[lines[i].sidenum[0]].toptexture ? sides[lines[i].sidenum[0]].toptexture : sfx_spdpad, &lines[i].stringargs[0]); + break; + case 7: //Sector flat alignment + lines[i].args[0] = tag; + if ((lines[i].flags & (ML_NETONLY|ML_NONET)) == (ML_NETONLY|ML_NONET)) + { + CONS_Alert(CONS_WARNING, M_GetText("Flat alignment linedef (tag %d) doesn't have anything to do.\nConsider changing the linedef's flag configuration or removing it entirely.\n"), tag); + lines[i].special = 0; + } + else if (lines[i].flags & ML_NETONLY) + lines[i].args[1] = TMP_CEILING; + else if (lines[i].flags & ML_NONET) + lines[i].args[1] = TMP_FLOOR; + else + lines[i].args[1] = TMP_BOTH; + lines[i].flags &= ~(ML_NETONLY|ML_NONET); + + if (lines[i].flags & ML_EFFECT6) // Set offset through x and y texture offsets + { + angle_t flatangle = InvAngle(R_PointToAngle2(lines[i].v1->x, lines[i].v1->y, lines[i].v2->x, lines[i].v2->y)); + fixed_t xoffs = sides[lines[i].sidenum[0]].textureoffset; + fixed_t yoffs = sides[lines[i].sidenum[0]].rowoffset; + + //If no tag is given, apply to front sector + if (lines[i].args[0] == 0) + P_ApplyFlatAlignment(lines[i].frontsector, flatangle, xoffs, yoffs, lines[i].args[1] != TMP_CEILING, lines[i].args[1] != TMP_FLOOR); + else + { + INT32 s; + TAG_ITER_SECTORS(lines[i].args[0], s) + P_ApplyFlatAlignment(sectors + s, flatangle, xoffs, yoffs, lines[i].args[1] != TMP_CEILING, lines[i].args[1] != TMP_FLOOR); + } + lines[i].special = 0; + } + break; + case 8: //Special sector properties + { + INT32 s; + + lines[i].args[0] = tag; + TAG_ITER_SECTORS(tag, s) + { + if (lines[i].flags & ML_NOCLIMB) + { + sectors[s].flags &= ~MSF_FLIPSPECIAL_FLOOR; + sectors[s].flags |= MSF_FLIPSPECIAL_CEILING; + } + else if (lines[i].flags & ML_MIDSOLID) + sectors[s].flags |= MSF_FLIPSPECIAL_BOTH; + + if (lines[i].flags & ML_MIDPEG) + sectors[s].flags |= MSF_TRIGGERSPECIAL_TOUCH; + if (lines[i].flags & ML_NOSKEW) + sectors[s].flags |= MSF_TRIGGERSPECIAL_HEADBUMP; + + if (lines[i].flags & ML_SKEWTD) + sectors[s].flags |= MSF_INVERTPRECIP; + } + + if (GETSECSPECIAL(lines[i].frontsector->special, 4) != 12) + lines[i].special = 0; + + break; + } + case 10: //Culling plane + lines[i].args[0] = tag; + lines[i].args[1] = !!(lines[i].flags & ML_NOCLIMB); + break; + case 11: //Rope hang parameters + lines[i].args[0] = (lines[i].flags & ML_NOCLIMB) ? 0 : sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[2] = !!(lines[i].flags & ML_SKEWTD); + break; + case 13: //Heat wave effect + { + INT32 s; + + TAG_ITER_SECTORS(tag, s) + sectors[s].flags |= MSF_HEATWAVE; + + break; + } + case 14: //Bustable block parameters + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[2] = !!(lines[i].flags & ML_SKEWTD); + P_WriteConstant(sides[lines[i].sidenum[0]].toptexture, &lines[i].stringargs[0]); + break; + case 16: //Minecart parameters + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + break; case 20: //PolyObject first line { INT32 check = -1; @@ -3178,15 +4141,15 @@ static void P_ConvertBinaryMap(void) : ((lines[paramline].frontsector->floorheight >> FRACBITS) / 100); //Flags - if (lines[paramline].flags & ML_EFFECT1) + if (lines[paramline].flags & ML_SKEWTD) lines[i].args[3] |= TMPF_NOINSIDES; - if (lines[paramline].flags & ML_EFFECT2) + if (lines[paramline].flags & ML_NOSKEW) lines[i].args[3] |= TMPF_INTANGIBLE; - if (lines[paramline].flags & ML_EFFECT3) + if (lines[paramline].flags & ML_MIDPEG) lines[i].args[3] |= TMPF_PUSHABLESTOP; - if (lines[paramline].flags & ML_EFFECT4) + if (lines[paramline].flags & ML_MIDSOLID) lines[i].args[3] &= ~TMPF_INVISIBLEPLANES; - /*if (lines[paramline].flags & ML_EFFECT5) + /*if (lines[paramline].flags & ML_WRAPMIDTEX) lines[i].args[3] |= TMPF_DONTCLIPPLANES;*/ if (lines[paramline].flags & ML_EFFECT6) lines[i].args[3] |= TMPF_SPLAT; @@ -3195,6 +4158,1069 @@ static void P_ConvertBinaryMap(void) break; } + case 30: //Polyobject - waving flag + lines[i].args[0] = tag; + lines[i].args[1] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + lines[i].args[2] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + break; + case 31: //Polyobject - displacement by front sector + lines[i].args[0] = tag; + lines[i].args[1] = R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> FRACBITS; + break; + case 32: //Polyobject - angular displacement by front sector + lines[i].args[0] = tag; + lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset ? sides[lines[i].sidenum[0]].textureoffset >> FRACBITS : 128; + lines[i].args[2] = sides[lines[i].sidenum[0]].rowoffset ? sides[lines[i].sidenum[0]].rowoffset >> FRACBITS : 90; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[3] |= TMPR_DONTROTATEOTHERS; + else if (lines[i].flags & ML_MIDSOLID) + lines[i].args[3] |= TMPR_ROTATEPLAYERS; + break; + case 50: //Instantly lower floor on level load + case 51: //Instantly raise ceiling on level load + lines[i].args[0] = tag; + break; + case 52: //Continuously falling sector + lines[i].args[0] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + lines[i].args[1] = !!(lines[i].flags & ML_NOCLIMB); + break; + case 53: //Continuous floor/ceiling mover + case 54: //Continuous floor mover + case 55: //Continuous ceiling mover + lines[i].args[0] = tag; + lines[i].args[1] = (lines[i].special == 53) ? TMP_BOTH : lines[i].special - 54; + lines[i].args[2] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + lines[i].args[3] = lines[i].args[2]; + lines[i].args[4] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[5] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].special = 53; + break; + case 56: //Continuous two-speed floor/ceiling mover + case 57: //Continuous two-speed floor mover + case 58: //Continuous two-speed ceiling mover + lines[i].args[0] = tag; + lines[i].args[1] = (lines[i].special == 56) ? TMP_BOTH : lines[i].special - 57; + lines[i].args[2] = abs(lines[i].dx) >> FRACBITS; + lines[i].args[3] = abs(lines[i].dy) >> FRACBITS; + lines[i].args[4] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[5] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].special = 56; + break; + case 59: //Activate moving platform + case 60: //Activate moving platform (adjustable speed) + lines[i].args[0] = tag; + lines[i].args[1] = (lines[i].special == 60) ? P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS : 8; + lines[i].args[2] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[3] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[4] = (lines[i].flags & ML_NOCLIMB) ? 1 : 0; + lines[i].special = 60; + break; + case 61: //Crusher (Ceiling to floor) + case 62: //Crusher (Floor to ceiling) + lines[i].args[0] = tag; + lines[i].args[1] = lines[i].special - 61; + if (lines[i].flags & ML_MIDSOLID) + { + lines[i].args[2] = abs(lines[i].dx) >> FRACBITS; + lines[i].args[3] = lines[i].args[2]; + } + else + { + lines[i].args[2] = R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> (FRACBITS + 1); + lines[i].args[3] = lines[i].args[2] / 4; + } + lines[i].special = 61; + break; + case 63: //Fake floor/ceiling planes + lines[i].args[0] = tag; + break; + case 64: //Appearing/disappearing FOF + lines[i].args[0] = (lines[i].flags & ML_BLOCKMONSTERS) ? 0 : tag; + lines[i].args[1] = (lines[i].flags & ML_BLOCKMONSTERS) ? tag : Tag_FGet(&lines[i].frontsector->tags); + lines[i].args[2] = lines[i].dx >> FRACBITS; + lines[i].args[3] = lines[i].dy >> FRACBITS; + lines[i].args[4] = lines[i].frontsector->floorheight >> FRACBITS; + lines[i].args[5] = !!(lines[i].flags & ML_NOCLIMB); + break; + case 66: //Move floor by displacement + case 67: //Move ceiling by displacement + case 68: //Move floor and ceiling by displacement + lines[i].args[0] = tag; + lines[i].args[1] = lines[i].special - 66; + lines[i].args[2] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[2] *= -1; + lines[i].special = 66; + break; + case 76: //Make FOF bouncy + lines[i].args[0] = tag; + lines[i].args[1] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + break; + case 100: //FOF: solid, opaque, shadowcasting + case 101: //FOF: solid, opaque, non-shadowcasting + case 102: //FOF: solid, translucent + case 103: //FOF: solid, sides only + case 104: //FOF: solid, no sides + case 105: //FOF: solid, invisible + lines[i].args[0] = tag; + + //Alpha + if (lines[i].special == 102) + { + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[3] |= TMFA_INSIDES; + P_SetBinaryFOFAlpha(&lines[i]); + + //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels + if (lines[i].args[1] == 256) + lines[i].args[3] |= TMFA_SPLAT; + } + else + lines[i].args[1] = 255; + + //Appearance + if (lines[i].special == 105) + lines[i].args[3] |= TMFA_NOPLANES|TMFA_NOSIDES; + else if (lines[i].special == 104) + lines[i].args[3] |= TMFA_NOSIDES; + else if (lines[i].special == 103) + lines[i].args[3] |= TMFA_NOPLANES; + if (lines[i].special != 100 && (lines[i].special != 104 || !(lines[i].flags & ML_NOCLIMB))) + lines[i].args[3] |= TMFA_NOSHADE; + if (lines[i].flags & ML_EFFECT6) + lines[i].args[3] |= TMFA_SPLAT; + + //Tangibility + if (lines[i].flags & ML_SKEWTD) + lines[i].args[4] |= TMFT_DONTBLOCKOTHERS; + if (lines[i].flags & ML_NOSKEW) + lines[i].args[4] |= TMFT_DONTBLOCKPLAYER; + + lines[i].special = 100; + break; + case 120: //FOF: water, opaque + case 121: //FOF: water, translucent + case 122: //FOF: water, opaque, no sides + case 123: //FOF: water, translucent, no sides + case 124: //FOF: goo water, translucent + case 125: //FOF: goo water, translucent, no sides + lines[i].args[0] = tag; + + //Alpha + if (lines[i].special == 120 || lines[i].special == 122) + lines[i].args[1] = 255; + else + { + P_SetBinaryFOFAlpha(&lines[i]); + + //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels + if (lines[i].args[1] == 256) + lines[i].args[3] |= TMFW_SPLAT; + } + + //No sides? + if (lines[i].special == 122 || lines[i].special == 123 || lines[i].special == 125) + lines[i].args[3] |= TMFW_NOSIDES; + + //Flags + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[3] |= TMFW_DOUBLESHADOW; + if (lines[i].flags & ML_MIDSOLID) + lines[i].args[3] |= TMFW_COLORMAPONLY; + if (!(lines[i].flags & ML_WRAPMIDTEX)) + lines[i].args[3] |= TMFW_NORIPPLE; + + //Goo? + if (lines[i].special >= 124) + lines[i].args[3] |= TMFW_GOOWATER; + + //Splat rendering? + if (lines[i].flags & ML_EFFECT6) + lines[i].args[3] |= TMFW_SPLAT; + + lines[i].special = 120; + break; + case 140: //FOF: intangible from bottom, opaque + case 141: //FOF: intangible from bottom, translucent + case 142: //FOF: intangible from bottom, translucent, no sides + case 143: //FOF: intangible from top, opaque + case 144: //FOF: intangible from top, translucent + case 145: //FOF: intangible from top, translucent, no sides + case 146: //FOF: only tangible from sides + lines[i].args[0] = tag; + + //Alpha + if (lines[i].special == 141 || lines[i].special == 142 || lines[i].special == 144 || lines[i].special == 145) + { + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[3] |= TMFA_INSIDES; + P_SetBinaryFOFAlpha(&lines[i]); + + //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels + if (lines[i].args[1] == 256) + lines[i].args[3] |= TMFA_SPLAT; + } + else + lines[i].args[1] = 255; + + //Appearance + if (lines[i].special == 142 || lines[i].special == 145) + lines[i].args[3] |= TMFA_NOSIDES; + else if (lines[i].special == 146) + lines[i].args[3] |= TMFA_NOPLANES; + if (lines[i].special != 146 && (lines[i].flags & ML_NOCLIMB)) + lines[i].args[3] |= TMFA_NOSHADE; + if (lines[i].flags & ML_EFFECT6) + lines[i].args[3] |= TMFA_SPLAT; + + //Tangibility + if (lines[i].special <= 142) + lines[i].args[4] |= TMFT_INTANGIBLEBOTTOM; + else if (lines[i].special <= 145) + lines[i].args[4] |= TMFT_INTANGIBLETOP; + else + lines[i].args[4] |= TMFT_INTANGIBLEBOTTOM|TMFT_INTANGIBLETOP; + + if (lines[i].flags & ML_SKEWTD) + lines[i].args[4] |= TMFT_DONTBLOCKOTHERS; + if (lines[i].flags & ML_NOSKEW) + lines[i].args[4] |= TMFT_DONTBLOCKPLAYER; + + lines[i].special = 100; + break; + case 150: //FOF: Air bobbing + case 151: //FOF: Air bobbing (adjustable) + case 152: //FOF: Reverse air bobbing (adjustable) + case 153: //FOF: Dynamically sinking platform + lines[i].args[0] = tag; + lines[i].args[1] = (lines[i].special == 150) ? 16 : (P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS); + + //Flags + if (lines[i].special == 152) + lines[i].args[2] |= TMFB_REVERSE; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[2] |= TMFB_SPINDASH; + if (lines[i].special == 153) + lines[i].args[2] |= TMFB_DYNAMIC; + + lines[i].special = 150; + break; + case 160: //FOF: Water bobbing + lines[i].args[0] = tag; + break; + case 170: //FOF: Crumbling, respawn + case 171: //FOF: Crumbling, no respawn + case 172: //FOF: Crumbling, respawn, intangible from bottom + case 173: //FOF: Crumbling, no respawn, intangible from bottom + case 174: //FOF: Crumbling, respawn, intangible from bottom, translucent + case 175: //FOF: Crumbling, no respawn, intangible from bottom, translucent + case 176: //FOF: Crumbling, respawn, floating, bobbing + case 177: //FOF: Crumbling, no respawn, floating, bobbing + case 178: //FOF: Crumbling, respawn, floating + case 179: //FOF: Crumbling, no respawn, floating + case 180: //FOF: Crumbling, respawn, air bobbing + lines[i].args[0] = tag; + + //Alpha + if (lines[i].special >= 174 && lines[i].special <= 175) + { + P_SetBinaryFOFAlpha(&lines[i]); + + //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels + if (lines[i].args[1] == 256) + lines[i].args[4] |= TMFC_SPLAT; + } + else + lines[i].args[1] = 255; + + if (lines[i].special >= 172 && lines[i].special <= 175) + { + lines[i].args[3] |= TMFT_INTANGIBLEBOTTOM; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[4] |= TMFC_NOSHADE; + } + + if (lines[i].special % 2 == 1) + lines[i].args[4] |= TMFC_NORETURN; + if (lines[i].special == 176 || lines[i].special == 177 || lines[i].special == 180) + lines[i].args[4] |= TMFC_AIRBOB; + if (lines[i].special >= 176 && lines[i].special <= 179) + lines[i].args[4] |= TMFC_FLOATBOB; + if (lines[i].flags & ML_EFFECT6) + lines[i].args[4] |= TMFC_SPLAT; + + if (lines[i].flags & ML_SKEWTD) + lines[i].args[3] |= TMFT_DONTBLOCKOTHERS; + if (lines[i].flags & ML_NOSKEW) + lines[i].args[3] |= TMFT_DONTBLOCKPLAYER; + + lines[i].special = 170; + break; + case 190: // FOF: Rising, solid, opaque, shadowcasting + case 191: // FOF: Rising, solid, opaque, non-shadowcasting + case 192: // FOF: Rising, solid, translucent + case 193: // FOF: Rising, solid, invisible + case 194: // FOF: Rising, intangible from bottom, opaque + case 195: // FOF: Rising, intangible from bottom, translucent + lines[i].args[0] = tag; + + //Translucency + if (lines[i].special == 192 || lines[i].special == 195) + { + P_SetBinaryFOFAlpha(&lines[i]); + + //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels + if (lines[i].args[1] == 256) + lines[i].args[3] |= TMFA_SPLAT; + } + else + lines[i].args[1] = 255; + + //Appearance + if (lines[i].special == 193) + lines[i].args[3] |= TMFA_NOPLANES|TMFA_NOSIDES; + if (lines[i].special >= 194) + lines[i].args[3] |= TMFA_INSIDES; + if (lines[i].special != 190 && (lines[i].special <= 193 || lines[i].flags & ML_NOCLIMB)) + lines[i].args[3] |= TMFA_NOSHADE; + if (lines[i].flags & ML_EFFECT6) + lines[i].args[3] |= TMFA_SPLAT; + + //Tangibility + if (lines[i].flags & ML_SKEWTD) + lines[i].args[4] |= TMFT_DONTBLOCKOTHERS; + if (lines[i].flags & ML_NOSKEW) + lines[i].args[4] |= TMFT_DONTBLOCKPLAYER; + if (lines[i].special >= 194) + lines[i].args[4] |= TMFT_INTANGIBLEBOTTOM; + + //Speed + lines[i].args[5] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + + //Flags + if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[6] |= TMFR_REVERSE; + if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[6] |= TMFR_SPINDASH; + + lines[i].special = 190; + break; + case 200: //FOF: Light block + case 201: //FOF: Half light block + lines[i].args[0] = tag; + if (lines[i].special == 201) + lines[i].args[1] = 1; + lines[i].special = 200; + break; + case 202: //FOF: Fog block + case 223: //FOF: Intangible, invisible + lines[i].args[0] = tag; + break; + case 220: //FOF: Intangible, opaque + case 221: //FOF: Intangible, translucent + case 222: //FOF: Intangible, sides only + lines[i].args[0] = tag; + + //Alpha + if (lines[i].special == 221) + { + P_SetBinaryFOFAlpha(&lines[i]); + + //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels + if (lines[i].args[1] == 256) + lines[i].args[3] |= TMFA_SPLAT; + } + else + lines[i].args[1] = 255; + + //Appearance + if (lines[i].special == 222) + lines[i].args[3] |= TMFA_NOPLANES; + if (lines[i].special == 221) + lines[i].args[3] |= TMFA_INSIDES; + if (lines[i].special != 220 && !(lines[i].flags & ML_NOCLIMB)) + lines[i].args[3] |= TMFA_NOSHADE; + if (lines[i].flags & ML_EFFECT6) + lines[i].args[3] |= TMFA_SPLAT; + + lines[i].special = 220; + break; + case 250: //FOF: Mario block + lines[i].args[0] = tag; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[1] |= TMFM_BRICK; + if (lines[i].flags & ML_SKEWTD) + lines[i].args[1] |= TMFM_INVISIBLE; + break; + case 251: //FOF: Thwomp block + lines[i].args[0] = tag; + if (lines[i].flags & ML_WRAPMIDTEX) //Custom speeds + { + lines[i].args[1] = lines[i].dy >> FRACBITS; + lines[i].args[2] = lines[i].dx >> FRACBITS; + } + else + { + lines[i].args[1] = 80; + lines[i].args[2] = 16; + } + if (lines[i].flags & ML_MIDSOLID) + P_WriteConstant(sides[lines[i].sidenum[0]].textureoffset >> FRACBITS, &lines[i].stringargs[0]); + break; + case 252: //FOF: Shatter block + case 253: //FOF: Shatter block, translucent + case 254: //FOF: Bustable block + case 255: //FOF: Spin-bustable block + case 256: //FOF: Spin-bustable block, translucent + lines[i].args[0] = tag; + + //Alpha + if (lines[i].special == 253 || lines[i].special == 256) + { + P_SetBinaryFOFAlpha(&lines[i]); + + //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels + if (lines[i].args[1] == 256) + lines[i].args[4] |= TMFB_SPLAT; + } + else + lines[i].args[1] = 255; + + //Bustable type + if (lines[i].special <= 253) + lines[i].args[3] = TMFB_TOUCH; + else if (lines[i].special >= 255) + lines[i].args[3] = TMFB_SPIN; + else if (lines[i].flags & ML_NOCLIMB) + lines[i].args[3] = TMFB_STRONG; + else + lines[i].args[3] = TMFB_REGULAR; + + //Flags + if (lines[i].flags & ML_MIDSOLID) + lines[i].args[4] |= TMFB_PUSHABLES; + if (lines[i].flags & ML_WRAPMIDTEX) + { + lines[i].args[4] |= TMFB_EXECUTOR; + lines[i].args[5] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + } + if (lines[i].special == 252 && lines[i].flags & ML_NOCLIMB) + lines[i].args[4] |= TMFB_ONLYBOTTOM; + if (lines[i].flags & ML_EFFECT6) + lines[i].args[4] |= TMFB_SPLAT; + + lines[i].special = 254; + break; + case 257: //FOF: Quicksand + lines[i].args[0] = tag; + if (!(lines[i].flags & ML_WRAPMIDTEX)) + lines[i].args[1] = 1; //No ripple effect + lines[i].args[2] = lines[i].dx >> FRACBITS; //Sinking speed + lines[i].args[3] = lines[i].dy >> FRACBITS; //Friction + break; + case 258: //FOF: Laser + lines[i].args[0] = tag; + + //Alpha + P_SetBinaryFOFAlpha(&lines[i]); + + //Flags + if (lines[i].flags & ML_SKEWTD) + lines[i].args[3] |= TMFL_NOBOSSES; + //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels + if (lines[i].flags & ML_EFFECT6 || lines[i].args[1] == 256) + lines[i].args[3] |= TMFL_SPLAT; + + break; + case 259: //Custom FOF + if (lines[i].sidenum[1] == 0xffff) + I_Error("Custom FOF (tag %d) found without a linedef back side!", tag); + + lines[i].args[0] = tag; + lines[i].args[3] = sides[lines[i].sidenum[1]].toptexture; + if (lines[i].flags & ML_EFFECT6) + lines[i].args[3] |= FF_SPLAT; + lines[i].args[4] = sides[lines[i].sidenum[1]].midtexture; + if (lines[i].args[3] & FF_TRANSLUCENT) + { + P_SetBinaryFOFAlpha(&lines[i]); + + //Replicate old hack: Translucent FOFs set to full opacity cut cyan pixels + if (lines[i].args[1] == 256) + lines[i].args[3] |= FF_SPLAT; + } + else + lines[i].args[1] = 255; + break; + case 300: //Trigger linedef executor - Continuous + case 301: //Trigger linedef executor - Each time + case 302: //Trigger linedef executor - Once + if (lines[i].special == 302) + lines[i].args[0] = TMT_ONCE; + else if (lines[i].special == 301) + lines[i].args[0] = (lines[i].flags & ML_BOUNCY) ? TMT_EACHTIMEENTERANDEXIT : TMT_EACHTIMEENTER; + else + lines[i].args[0] = TMT_CONTINUOUS; + lines[i].special = 300; + break; + case 303: //Ring count - Continuous + case 304: //Ring count - Once + lines[i].args[0] = (lines[i].special == 304) ? TMT_ONCE : TMT_CONTINUOUS; + lines[i].args[1] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[2] = TMC_LTE; + else if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[2] = TMC_GTE; + else + lines[i].args[2] = TMC_EQUAL; + lines[i].args[3] = !!(lines[i].flags & ML_MIDSOLID); + lines[i].special = 303; + break; + case 305: //Character ability - Continuous + case 306: //Character ability - Each time + case 307: //Character ability - Once + if (lines[i].special == 307) + lines[i].args[0] = TMT_ONCE; + else if (lines[i].special == 306) + lines[i].args[0] = (lines[i].flags & ML_BOUNCY) ? TMT_EACHTIMEENTERANDEXIT : TMT_EACHTIMEENTER; + else + lines[i].args[0] = TMT_CONTINUOUS; + lines[i].args[1] = (P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS) / 10; + lines[i].special = 305; + break; + case 308: //Race only - once + lines[i].args[0] = TMT_ONCE; + lines[i].args[1] = GTR_RACE; + lines[i].args[2] = TMF_HASANY; + break; + case 309: //CTF red team - continuous + case 310: //CTF red team - each time + case 311: //CTF blue team - continuous + case 312: //CTF blue team - each time + if (lines[i].special % 2 == 0) + lines[i].args[0] = (lines[i].flags & ML_BOUNCY) ? TMT_EACHTIMEENTERANDEXIT : TMT_EACHTIMEENTER; + else + lines[i].args[0] = TMT_CONTINUOUS; + lines[i].args[1] = (lines[i].special > 310) ? TMT_BLUE : TMT_RED; + lines[i].special = 309; + break; + case 313: //No more enemies - once + lines[i].args[0] = tag; + break; + case 314: //Number of pushables - Continuous + case 315: //Number of pushables - Once + lines[i].args[0] = (lines[i].special == 315) ? TMT_ONCE : TMT_CONTINUOUS; + lines[i].args[1] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[2] = TMC_GTE; + else if (lines[i].flags & ML_MIDSOLID) + lines[i].args[2] = TMC_LTE; + else + lines[i].args[2] = TMC_EQUAL; + lines[i].special = 314; + break; + case 317: //Condition set trigger - Continuous + case 318: //Condition set trigger - Once + lines[i].args[0] = (lines[i].special == 318) ? TMT_ONCE : TMT_CONTINUOUS; + lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].special = 317; + break; + case 319: //Unlockable trigger - Continuous + case 320: //Unlockable trigger - Once + lines[i].args[0] = (lines[i].special == 320) ? TMT_ONCE : TMT_CONTINUOUS; + lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].special = 319; + break; + case 321: //Trigger after X calls - Continuous + case 322: //Trigger after X calls - Each time + if (lines[i].special % 2 == 0) + lines[i].args[0] = (lines[i].flags & ML_BOUNCY) ? TMXT_EACHTIMEENTERANDEXIT : TMXT_EACHTIMEENTER; + else + lines[i].args[0] = TMXT_CONTINUOUS; + lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + if (lines[i].flags & ML_NOCLIMB) + { + lines[i].args[2] = 1; + lines[i].args[3] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + } + else + lines[i].args[2] = lines[i].args[3] = 0; + lines[i].special = 321; + break; + case 323: //NiGHTSerize - Each time + case 324: //NiGHTSerize - Once + case 325: //DeNiGHTSerize - Each time + case 326: //DeNiGHTSerize - Once + case 327: //NiGHTS lap - Each time + case 328: //NiGHTS lap - Once + case 329: //Ideya capture touch - Each time + case 330: //Ideya capture touch - Once + lines[i].args[0] = (lines[i].special + 1) % 2; + lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[2] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[3] = TMC_LTE; + else if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[3] = TMC_GTE; + else + lines[i].args[3] = TMC_EQUAL; + if (lines[i].flags & ML_SKEWTD) + lines[i].args[4] = TMC_LTE; + else if (lines[i].flags & ML_NOSKEW) + lines[i].args[4] = TMC_GTE; + else + lines[i].args[4] = TMC_EQUAL; + if (lines[i].flags & ML_DONTPEGBOTTOM) + lines[i].args[5] = TMNP_SLOWEST; + else if (lines[i].flags & ML_MIDSOLID) + lines[i].args[5] = TMNP_TRIGGERER; + else + lines[i].args[5] = TMNP_FASTEST; + if (lines[i].special % 2 == 0) + lines[i].special--; + if (lines[i].special == 323) + { + if (lines[i].flags & ML_TFERLINE) + lines[i].args[6] = TMN_FROMNONIGHTS; + else if (lines[i].flags & ML_DONTPEGTOP) + lines[i].args[6] = TMN_FROMNIGHTS; + else + lines[i].args[6] = TMN_ALWAYS; + + if (lines[i].flags & ML_MIDPEG) + lines[i].args[7] |= TMN_BONUSLAPS; + if (lines[i].flags & ML_BOUNCY) + lines[i].args[7] |= TMN_LEVELCOMPLETION; + } + else if (lines[i].special == 325) + { + if (lines[i].flags & ML_TFERLINE) + lines[i].args[6] = TMD_NOBODYNIGHTS; + else if (lines[i].flags & ML_DONTPEGTOP) + lines[i].args[6] = TMD_SOMEBODYNIGHTS; + else + lines[i].args[6] = TMD_ALWAYS; + + lines[i].args[7] = !!(lines[i].flags & ML_MIDPEG); + } + else if (lines[i].special == 327) + lines[i].args[6] = !!(lines[i].flags & ML_MIDPEG); + else + { + if (lines[i].flags & ML_DONTPEGTOP) + lines[i].args[6] = TMS_ALWAYS; + else if (lines[i].flags & ML_BOUNCY) + lines[i].args[6] = TMS_IFNOTENOUGH; + else + lines[i].args[6] = TMS_IFENOUGH; + + if (lines[i].flags & ML_MIDPEG) + lines[i].args[7] |= TMI_BONUSLAPS; + if (lines[i].flags & ML_TFERLINE) + lines[i].args[7] |= TMI_ENTER; + } + break; + case 331: // Player skin - continuous + case 332: // Player skin - each time + case 333: // Player skin - once + if (lines[i].special == 303) + lines[i].args[0] = TMT_ONCE; + else if (lines[i].special == 302) + lines[i].args[0] = (lines[i].flags & ML_BOUNCY) ? TMT_EACHTIMEENTERANDEXIT : TMT_EACHTIMEENTER; + else + lines[i].args[0] = TMT_CONTINUOUS; + lines[i].args[1] = !!(lines[i].flags & ML_NOCLIMB); + if (lines[i].text) + { + lines[i].stringargs[0] = Z_Malloc(strlen(lines[i].text) + 1, PU_LEVEL, NULL); + M_Memcpy(lines[i].stringargs[0], lines[i].text, strlen(lines[i].text) + 1); + } + lines[i].special = 331; + break; + case 334: // Object dye - continuous + case 335: // Object dye - each time + case 336: // Object dye - once + if (lines[i].special == 336) + lines[i].args[0] = TMT_ONCE; + else if (lines[i].special == 335) + lines[i].args[0] = (lines[i].flags & ML_BOUNCY) ? TMT_EACHTIMEENTERANDEXIT : TMT_EACHTIMEENTER; + else + lines[i].args[0] = TMT_CONTINUOUS; + lines[i].args[1] = !!(lines[i].flags & ML_NOCLIMB); + if (sides[lines[i].sidenum[0]].text) + { + lines[i].stringargs[0] = Z_Malloc(strlen(sides[lines[i].sidenum[0]].text) + 1, PU_LEVEL, NULL); + M_Memcpy(lines[i].stringargs[0], sides[lines[i].sidenum[0]].text, strlen(sides[lines[i].sidenum[0]].text) + 1); + } + lines[i].special = 334; + break; + case 337: //Emerald check - continuous + case 338: //Emerald check - each time + case 339: //Emerald check - once + if (lines[i].special == 339) + lines[i].args[0] = TMT_ONCE; + else if (lines[i].special == 338) + lines[i].args[0] = (lines[i].flags & ML_BOUNCY) ? TMT_EACHTIMEENTERANDEXIT : TMT_EACHTIMEENTER; + else + lines[i].args[0] = TMT_CONTINUOUS; + lines[i].args[1] = EMERALD1|EMERALD2|EMERALD3|EMERALD4|EMERALD5|EMERALD6|EMERALD7; + lines[i].args[2] = TMF_HASALL; + lines[i].special = 337; + break; + case 340: //NiGHTS mare - continuous + case 341: //NiGHTS mare - each time + case 342: //NiGHTS mare - once + if (lines[i].special == 342) + lines[i].args[0] = TMT_ONCE; + else if (lines[i].special == 341) + lines[i].args[0] = (lines[i].flags & ML_BOUNCY) ? TMT_EACHTIMEENTERANDEXIT : TMT_EACHTIMEENTER; + else + lines[i].args[0] = TMT_CONTINUOUS; + lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[2] = TMC_LTE; + else if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[2] = TMC_GTE; + else + lines[i].args[2] = TMC_EQUAL; + lines[i].special = 340; + break; + case 400: //Set tagged sector's floor height/texture + case 401: //Set tagged sector's ceiling height/texture + lines[i].args[0] = tag; + lines[i].args[1] = lines[i].special - 400; + lines[i].args[2] = !(lines[i].flags & ML_NOCLIMB); + lines[i].special = 400; + break; + case 402: //Copy light level + lines[i].args[0] = tag; + lines[i].args[1] = 0; + break; + case 403: //Move tagged sector's floor + case 404: //Move tagged sector's ceiling + lines[i].args[0] = tag; + lines[i].args[1] = lines[i].special - 403; + lines[i].args[2] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + lines[i].args[3] = (lines[i].flags & ML_BLOCKMONSTERS) ? sides[lines[i].sidenum[0]].textureoffset >> FRACBITS : 0; + lines[i].args[4] = !!(lines[i].flags & ML_NOCLIMB); + lines[i].special = 403; + break; + case 405: //Move floor according to front texture offsets + case 407: //Move ceiling according to front texture offsets + lines[i].args[0] = tag; + lines[i].args[1] = (lines[i].special == 405) ? TMP_FLOOR : TMP_CEILING; + lines[i].args[2] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[3] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[4] = !!(lines[i].flags & ML_NOCLIMB); + lines[i].special = 405; + break; + case 408: //Set flats + lines[i].args[0] = tag; + if ((lines[i].flags & (ML_NOCLIMB|ML_MIDSOLID)) == (ML_NOCLIMB|ML_MIDSOLID)) + { + CONS_Alert(CONS_WARNING, M_GetText("Set flats linedef (tag %d) doesn't have anything to do.\nConsider changing the linedef's flag configuration or removing it entirely.\n"), tag); + lines[i].special = 0; + } + else if (lines[i].flags & ML_NOCLIMB) + lines[i].args[1] = TMP_CEILING; + else if (lines[i].flags & ML_MIDSOLID) + lines[i].args[1] = TMP_FLOOR; + else + lines[i].args[1] = TMP_BOTH; + break; + case 409: //Change tagged sector's tag + lines[i].args[0] = tag; + lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[2] = TMT_ADD; + else if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[2] = TMT_REMOVE; + else + lines[i].args[2] = TMT_REPLACEFIRST; + break; + case 410: //Change front sector's tag + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[1] = TMT_ADD; + else if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[1] = TMT_REMOVE; + else + lines[i].args[1] = TMT_REPLACEFIRST; + break; + case 411: //Stop plane movement + lines[i].args[0] = tag; + break; + case 412: //Teleporter + lines[i].args[0] = tag; + if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[1] |= TMT_SILENT; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[1] |= TMT_KEEPANGLE; + if (lines[i].flags & ML_MIDSOLID) + lines[i].args[1] |= TMT_KEEPMOMENTUM; + if (lines[i].flags & ML_MIDPEG) + lines[i].args[1] |= TMT_RELATIVE; + lines[i].args[2] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[3] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[4] = lines[i].frontsector->ceilingheight >> FRACBITS; + break; + case 413: //Change music + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[0] |= TMM_ALLPLAYERS; + if (lines[i].flags & ML_SKEWTD) + lines[i].args[0] |= TMM_OFFSET; + if (lines[i].flags & ML_NOSKEW) + lines[i].args[0] |= TMM_FADE; + if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[0] |= TMM_NORELOAD; + if (lines[i].flags & ML_BOUNCY) + lines[i].args[0] |= TMM_FORCERESET; + if (lines[i].flags & ML_MIDSOLID) + lines[i].args[0] |= TMM_NOLOOP; + lines[i].args[1] = sides[lines[i].sidenum[0]].midtexture; + lines[i].args[2] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[3] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[4] = (lines[i].sidenum[1] != 0xffff) ? sides[lines[i].sidenum[1]].textureoffset >> FRACBITS : 0; + lines[i].args[5] = (lines[i].sidenum[1] != 0xffff) ? sides[lines[i].sidenum[1]].rowoffset >> FRACBITS : -1; + lines[i].args[6] = sides[lines[i].sidenum[0]].bottomtexture; + if (sides[lines[i].sidenum[0]].text) + { + lines[i].stringargs[0] = Z_Malloc(strlen(sides[lines[i].sidenum[0]].text) + 1, PU_LEVEL, NULL); + M_Memcpy(lines[i].stringargs[0], sides[lines[i].sidenum[0]].text, strlen(sides[lines[i].sidenum[0]].text) + 1); + } + break; + case 414: //Play sound effect + lines[i].args[2] = tag; + if (tag != 0) + { + if (lines[i].flags & ML_WRAPMIDTEX) + { + lines[i].args[0] = TMSS_TAGGEDSECTOR; + lines[i].args[1] = TMSL_EVERYONE; + } + else + { + lines[i].args[0] = TMSS_NOWHERE; + lines[i].args[1] = TMSL_TAGGEDSECTOR; + } + } + else + { + if (lines[i].flags & ML_NOCLIMB) + { + lines[i].args[0] = TMSS_NOWHERE; + lines[i].args[1] = TMSL_TRIGGERER; + } + else if (lines[i].flags & ML_MIDSOLID) + { + lines[i].args[0] = TMSS_NOWHERE; + lines[i].args[1] = TMSL_EVERYONE; + } + else if (lines[i].flags & ML_BLOCKMONSTERS) + { + lines[i].args[0] = TMSS_TRIGGERSECTOR; + lines[i].args[1] = TMSL_EVERYONE; + } + else + { + lines[i].args[0] = TMSS_TRIGGERMOBJ; + lines[i].args[1] = TMSL_EVERYONE; + } + } + if (sides[lines[i].sidenum[0]].text) + { + lines[i].stringargs[0] = Z_Malloc(strlen(sides[lines[i].sidenum[0]].text) + 1, PU_LEVEL, NULL); + M_Memcpy(lines[i].stringargs[0], sides[lines[i].sidenum[0]].text, strlen(sides[lines[i].sidenum[0]].text) + 1); + } + break; + case 415: //Run script + { + INT32 scrnum; + + lines[i].stringargs[0] = Z_Malloc(9, PU_LEVEL, NULL); + strcpy(lines[i].stringargs[0], G_BuildMapName(gamemap)); + lines[i].stringargs[0][0] = 'S'; + lines[i].stringargs[0][1] = 'C'; + lines[i].stringargs[0][2] = 'R'; + + scrnum = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + if (scrnum < 0 || scrnum > 999) + { + scrnum = 0; + lines[i].stringargs[0][5] = lines[i].stringargs[0][6] = lines[i].stringargs[0][7] = '0'; + } + else + { + lines[i].stringargs[0][5] = (char)('0' + (char)((scrnum / 100))); + lines[i].stringargs[0][6] = (char)('0' + (char)((scrnum % 100) / 10)); + lines[i].stringargs[0][7] = (char)('0' + (char)(scrnum % 10)); + } + lines[i].stringargs[0][8] = '\0'; + break; + } + case 416: //Start adjustable flickering light + case 417: //Start adjustable pulsating light + case 602: //Adjustable pulsating light + case 603: //Adjustable flickering light + lines[i].args[0] = tag; + lines[i].args[1] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + lines[i].args[2] = lines[i].frontsector->lightlevel; + if ((lines[i].flags & ML_NOCLIMB) && lines[i].backsector) + lines[i].args[4] = lines[i].backsector->lightlevel; + else + lines[i].args[3] = 1; + break; + case 418: //Start adjustable blinking light (unsynchronized) + case 419: //Start adjustable blinking light (synchronized) + case 604: //Adjustable blinking light (unsynchronized) + case 605: //Adjustable blinking light (synchronized) + lines[i].args[0] = tag; + lines[i].args[1] = abs(lines[i].dx) >> FRACBITS; + lines[i].args[2] = abs(lines[i].dy) >> FRACBITS; + lines[i].args[3] = lines[i].frontsector->lightlevel; + if ((lines[i].flags & ML_NOCLIMB) && lines[i].backsector) + lines[i].args[5] = lines[i].backsector->lightlevel; + else + lines[i].args[4] |= TMB_USETARGET; + if (lines[i].special % 2 == 1) + { + lines[i].args[4] |= TMB_SYNC; + lines[i].special--; + } + break; + case 420: //Fade light level + lines[i].args[0] = tag; + if (lines[i].flags & ML_DONTPEGBOTTOM) + { + lines[i].args[1] = max(sides[lines[i].sidenum[0]].textureoffset >> FRACBITS, 0); + // failsafe: if user specifies Back Y Offset and NOT Front Y Offset, use the Back Offset + // to be consistent with other light and fade specials + lines[i].args[2] = ((lines[i].sidenum[1] != 0xFFFF && !(sides[lines[i].sidenum[0]].rowoffset >> FRACBITS)) ? + max(min(sides[lines[i].sidenum[1]].rowoffset >> FRACBITS, 255), 0) + : max(min(sides[lines[i].sidenum[0]].rowoffset >> FRACBITS, 255), 0)); + } + else + { + lines[i].args[1] = lines[i].frontsector->lightlevel; + lines[i].args[2] = abs(P_AproxDistance(lines[i].dx, lines[i].dy)) >> FRACBITS; + } + if (lines[i].flags & ML_MIDSOLID) + lines[i].args[3] |= TMF_TICBASED; + if (lines[i].flags & ML_WRAPMIDTEX) + lines[i].args[3] |= TMF_OVERRIDE; + break; + case 421: //Stop lighting effect + lines[i].args[0] = tag; + break; + case 422: //Switch to cut-away view + lines[i].args[0] = tag; + lines[i].args[1] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + lines[i].args[2] = (lines[i].flags & ML_NOCLIMB) ? sides[lines[i].sidenum[0]].textureoffset >> FRACBITS : 0; + break; + case 423: //Change sky + case 424: //Change weather + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = !!(lines[i].flags & ML_NOCLIMB); + break; + case 425: //Change object state + if (sides[lines[i].sidenum[0]].text) + { + lines[i].stringargs[0] = Z_Malloc(strlen(sides[lines[i].sidenum[0]].text) + 1, PU_LEVEL, NULL); + M_Memcpy(lines[i].stringargs[0], sides[lines[i].sidenum[0]].text, strlen(sides[lines[i].sidenum[0]].text) + 1); + } + break; + case 426: //Stop object + lines[i].args[0] = !!(lines[i].flags & ML_NOCLIMB); + break; + case 427: //Award score + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + break; + case 428: //Start platform movement + lines[i].args[0] = tag; + lines[i].args[1] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + lines[i].args[2] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[3] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[4] = (lines[i].flags & ML_NOCLIMB) ? 1 : 0; + break; + case 429: //Crush ceiling once + case 430: //Crush floor once + case 431: //Crush floor and ceiling once + lines[i].args[0] = tag; + lines[i].args[1] = (lines[i].special == 429) ? TMP_CEILING : ((lines[i].special == 430) ? TMP_FLOOR : TMP_BOTH); + if (lines[i].special == 430 || lines[i].flags & ML_MIDSOLID) + { + lines[i].args[2] = abs(lines[i].dx) >> FRACBITS; + lines[i].args[3] = lines[i].args[2]; + } + else + { + lines[i].args[2] = R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> (FRACBITS + 1); + lines[i].args[3] = lines[i].args[2] / 4; + } + lines[i].special = 429; + break; + case 432: //Enable/disable 2D mode + lines[i].args[0] = !!(lines[i].flags & ML_NOCLIMB); + break; + case 433: //Enable/disable gravity flip + lines[i].args[0] = !!(lines[i].flags & ML_NOCLIMB); + break; + case 434: //Award power-up + if (sides[lines[i].sidenum[0]].text) + { + lines[i].stringargs[0] = Z_Malloc(strlen(sides[lines[i].sidenum[0]].text) + 1, PU_LEVEL, NULL); + M_Memcpy(lines[i].stringargs[0], sides[lines[i].sidenum[0]].text, strlen(sides[lines[i].sidenum[0]].text) + 1); + } + if (lines[i].sidenum[1] != 0xffff && lines[i].flags & ML_BLOCKMONSTERS) // read power from back sidedef + { + lines[i].stringargs[1] = Z_Malloc(strlen(sides[lines[i].sidenum[1]].text) + 1, PU_LEVEL, NULL); + M_Memcpy(lines[i].stringargs[1], sides[lines[i].sidenum[1]].text, strlen(sides[lines[i].sidenum[1]].text) + 1); + } + else + P_WriteConstant((lines[i].flags & ML_NOCLIMB) ? -1 : (sides[lines[i].sidenum[0]].textureoffset >> FRACBITS), &lines[i].stringargs[1]); + break; + case 435: //Change plane scroller direction + lines[i].args[0] = tag; + lines[i].args[1] = R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> FRACBITS; + break; + case 436: //Shatter FOF + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + break; + case 437: //Disable player control + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = !!(lines[i].flags & ML_NOCLIMB); + break; + case 438: //Change object size + lines[i].args[0] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + break; + case 439: //Change tagged linedef's textures + lines[i].args[0] = tag; + lines[i].args[1] = TMSD_FRONTBACK; + lines[i].args[2] = !!(lines[i].flags & ML_NOCLIMB); + break; + case 441: //Condition set trigger + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + break; + case 442: //Change object type state + lines[i].args[0] = tag; + if (sides[lines[i].sidenum[0]].text) + { + lines[i].stringargs[0] = Z_Malloc(strlen(sides[lines[i].sidenum[0]].text) + 1, PU_LEVEL, NULL); + M_Memcpy(lines[i].stringargs[0], sides[lines[i].sidenum[0]].text, strlen(sides[lines[i].sidenum[0]].text) + 1); + } + if (lines[i].sidenum[1] == 0xffff) + lines[i].args[1] = 1; + else + { + lines[i].args[1] = 0; + if (sides[lines[i].sidenum[1]].text) + { + lines[i].stringargs[1] = Z_Malloc(strlen(sides[lines[i].sidenum[1]].text) + 1, PU_LEVEL, NULL); + M_Memcpy(lines[i].stringargs[1], sides[lines[i].sidenum[1]].text, strlen(sides[lines[i].sidenum[1]].text) + 1); + } + } + break; case 443: //Call Lua function if (lines[i].text) { @@ -3204,47 +5230,444 @@ static void P_ConvertBinaryMap(void) else CONS_Alert(CONS_WARNING, "Linedef %s is missing the hook name of the Lua function to call! (This should be given in the front texture fields)\n", sizeu1(i)); break; + case 444: //Earthquake + lines[i].args[0] = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[2] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + break; + case 445: //Make FOF disappear/reappear + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[2] = !!(lines[i].flags & ML_NOCLIMB); + break; + case 446: //Make FOF crumble + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[2] |= TMFR_NORETURN; + if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[2] |= TMFR_CHECKFLAG; + break; case 447: //Change colormap - lines[i].args[0] = Tag_FGet(&lines[i].tags); - if (lines[i].flags & ML_EFFECT3) + lines[i].args[0] = tag; + if (lines[i].flags & ML_MIDPEG) lines[i].args[2] |= TMCF_RELATIVE; - if (lines[i].flags & ML_EFFECT1) + if (lines[i].flags & ML_SKEWTD) lines[i].args[2] |= TMCF_SUBLIGHTR|TMCF_SUBFADER; if (lines[i].flags & ML_NOCLIMB) lines[i].args[2] |= TMCF_SUBLIGHTG|TMCF_SUBFADEG; - if (lines[i].flags & ML_EFFECT2) + if (lines[i].flags & ML_NOSKEW) lines[i].args[2] |= TMCF_SUBLIGHTB|TMCF_SUBFADEB; break; + case 448: //Change skybox + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + if ((lines[i].flags & (ML_MIDSOLID|ML_BLOCKMONSTERS)) == ML_MIDSOLID) // Solid Midtexture is on but Block Enemies is off? + { + CONS_Alert(CONS_WARNING, + M_GetText("Skybox switch linedef (tag %d) doesn't have anything to do.\nConsider changing the linedef's flag configuration or removing it entirely.\n"), + tag); + lines[i].special = 0; + break; + } + else if ((lines[i].flags & (ML_MIDSOLID|ML_BLOCKMONSTERS)) == (ML_MIDSOLID|ML_BLOCKMONSTERS)) + lines[i].args[2] = TMS_CENTERPOINT; + else if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[2] = TMS_BOTH; + else + lines[i].args[2] = TMS_VIEWPOINT; + lines[i].args[3] = !!(lines[i].flags & ML_NOCLIMB); + break; + case 449: //Enable bosses with parameters + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = !!(lines[i].flags & ML_NOCLIMB); + break; + case 450: //Execute linedef executor (specific tag) + lines[i].args[0] = tag; + break; + case 451: //Execute linedef executor (random tag in range) + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + break; + case 452: //Set FOF translucency + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[2] = lines[i].sidenum[1] != 0xffff ? (sides[lines[i].sidenum[1]].textureoffset >> FRACBITS) : (P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS); + if (lines[i].flags & ML_MIDPEG) + lines[i].args[3] |= TMST_RELATIVE; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[3] |= TMST_DONTDOTRANSLUCENT; + break; + case 453: //Fade FOF + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[2] = lines[i].sidenum[1] != 0xffff ? (sides[lines[i].sidenum[1]].textureoffset >> FRACBITS) : (lines[i].dx >> FRACBITS); + lines[i].args[3] = lines[i].sidenum[1] != 0xffff ? (sides[lines[i].sidenum[1]].rowoffset >> FRACBITS) : (abs(lines[i].dy) >> FRACBITS); + if (lines[i].flags & ML_MIDPEG) + lines[i].args[4] |= TMFT_RELATIVE; + if (lines[i].flags & ML_WRAPMIDTEX) + lines[i].args[4] |= TMFT_OVERRIDE; + if (lines[i].flags & ML_MIDSOLID) + lines[i].args[4] |= TMFT_TICBASED; + if (lines[i].flags & ML_BOUNCY) + lines[i].args[4] |= TMFT_IGNORECOLLISION; + if (lines[i].flags & ML_SKEWTD) + lines[i].args[4] |= TMFT_GHOSTFADE; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[4] |= TMFT_DONTDOTRANSLUCENT; + if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[4] |= TMFT_DONTDOEXISTS; + if (lines[i].flags & ML_NOSKEW) + lines[i].args[4] |= (TMFT_DONTDOLIGHTING|TMFT_DONTDOCOLORMAP); + if (lines[i].flags & ML_TFERLINE) + lines[i].args[4] |= TMFT_USEEXACTALPHA; + break; + case 454: //Stop fading FOF + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[2] = !!(lines[i].flags & ML_BLOCKMONSTERS); + break; case 455: //Fade colormap { INT32 speed = (INT32)((((lines[i].flags & ML_DONTPEGBOTTOM) || !sides[lines[i].sidenum[0]].rowoffset) && lines[i].sidenum[1] != 0xFFFF) ? abs(sides[lines[i].sidenum[1]].rowoffset >> FRACBITS) : abs(sides[lines[i].sidenum[0]].rowoffset >> FRACBITS)); - lines[i].args[0] = Tag_FGet(&lines[i].tags); - if (lines[i].flags & ML_EFFECT4) + lines[i].args[0] = tag; + if (lines[i].flags & ML_MIDSOLID) lines[i].args[2] = speed; else lines[i].args[2] = (256 + speed - 1)/speed; - if (lines[i].flags & ML_EFFECT3) + if (lines[i].flags & ML_MIDPEG) lines[i].args[3] |= TMCF_RELATIVE; - if (lines[i].flags & ML_EFFECT1) + if (lines[i].flags & ML_SKEWTD) lines[i].args[3] |= TMCF_SUBLIGHTR|TMCF_SUBFADER; if (lines[i].flags & ML_NOCLIMB) lines[i].args[3] |= TMCF_SUBLIGHTG|TMCF_SUBFADEG; - if (lines[i].flags & ML_EFFECT2) + if (lines[i].flags & ML_NOSKEW) lines[i].args[3] |= TMCF_SUBLIGHTB|TMCF_SUBFADEB; if (lines[i].flags & ML_BOUNCY) lines[i].args[3] |= TMCF_FROMBLACK; - if (lines[i].flags & ML_EFFECT5) + if (lines[i].flags & ML_WRAPMIDTEX) lines[i].args[3] |= TMCF_OVERRIDE; break; } case 456: //Stop fading colormap - lines[i].args[0] = Tag_FGet(&lines[i].tags); + lines[i].args[0] = tag; + break; + case 457: //Track object's angle + lines[i].args[0] = tag; + lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[2] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[3] = (lines[i].sidenum[1] != 0xffff) ? sides[lines[i].sidenum[1]].rowoffset >> FRACBITS : 0; + lines[i].args[4] = !!(lines[i].flags & ML_NOSKEW); + break; + case 459: //Control text prompt + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + if (lines[i].flags & ML_BLOCKMONSTERS) + lines[i].args[2] |= TMP_CLOSE; + if (lines[i].flags & ML_SKEWTD) + lines[i].args[2] |= TMP_RUNPOSTEXEC; + if (lines[i].flags & ML_TFERLINE) + lines[i].args[2] |= TMP_CALLBYNAME; + if (lines[i].flags & ML_NOSKEW) + lines[i].args[2] |= TMP_KEEPCONTROLS; + if (lines[i].flags & ML_MIDPEG) + lines[i].args[2] |= TMP_KEEPREALTIME; + /*if (lines[i].flags & ML_NOCLIMB) + lines[i].args[2] |= TMP_ALLPLAYERS; + if (lines[i].flags & ML_MIDSOLID) + lines[i].args[2] |= TMP_FREEZETHINKERS;*/ + lines[i].args[3] = (lines[i].sidenum[1] != 0xFFFF) ? sides[lines[i].sidenum[1]].textureoffset >> FRACBITS : tag; + if (sides[lines[i].sidenum[0]].text) + { + lines[i].stringargs[0] = Z_Malloc(strlen(sides[lines[i].sidenum[0]].text) + 1, PU_LEVEL, NULL); + M_Memcpy(lines[i].stringargs[0], sides[lines[i].sidenum[0]].text, strlen(sides[lines[i].sidenum[0]].text) + 1); + } + break; + case 460: //Award rings + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + break; + case 461: //Spawn object + lines[i].args[0] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[2] = lines[i].frontsector->floorheight >> FRACBITS; + lines[i].args[3] = (lines[i].flags & ML_SKEWTD) ? AngleFixed(R_PointToAngle2(lines[i].v1->x, lines[i].v1->y, lines[i].v2->x, lines[i].v2->y)) >> FRACBITS : 0; + if (lines[i].flags & ML_NOCLIMB) + { + if (lines[i].sidenum[1] != 0xffff) // Make sure the linedef has a back side + { + lines[i].args[4] = 1; + lines[i].args[5] = sides[lines[i].sidenum[1]].textureoffset >> FRACBITS; + lines[i].args[6] = sides[lines[i].sidenum[1]].rowoffset >> FRACBITS; + lines[i].args[7] = lines[i].frontsector->ceilingheight >> FRACBITS; + } + else + { + CONS_Alert(CONS_WARNING, "Linedef Type %d - Spawn Object: Linedef is set for random range but has no back side.\n", lines[i].special); + lines[i].args[4] = 0; + } + } + else + lines[i].args[4] = 0; + if (sides[lines[i].sidenum[0]].text) + { + lines[i].stringargs[0] = Z_Malloc(strlen(sides[lines[i].sidenum[0]].text) + 1, PU_LEVEL, NULL); + M_Memcpy(lines[i].stringargs[0], sides[lines[i].sidenum[0]].text, strlen(sides[lines[i].sidenum[0]].text) + 1); + } + break; + case 463: //Dye object + if (sides[lines[i].sidenum[0]].text) + { + lines[i].stringargs[0] = Z_Malloc(strlen(sides[lines[i].sidenum[0]].text) + 1, PU_LEVEL, NULL); + M_Memcpy(lines[i].stringargs[0], sides[lines[i].sidenum[0]].text, strlen(sides[lines[i].sidenum[0]].text) + 1); + } + break; + case 464: //Trigger egg capsule + lines[i].args[0] = tag; + lines[i].args[1] = !!(lines[i].flags & ML_NOCLIMB); + break; + case 466: //Set level failure state + lines[i].args[0] = !!(lines[i].flags & ML_NOCLIMB); + break; + case 467: //Set light level + lines[i].args[0] = tag; + lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[2] = TML_SECTOR; + lines[i].args[3] = !!(lines[i].flags & ML_MIDPEG); + break; + case 480: //Polyobject - door slide + case 481: //Polyobject - door move + lines[i].args[0] = tag; + lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[2] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + if (lines[i].sidenum[1] != 0xffff) + lines[i].args[3] = sides[lines[i].sidenum[1]].textureoffset >> FRACBITS; + break; + case 482: //Polyobject - move + case 483: //Polyobject - move, override + lines[i].args[0] = tag; + lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[2] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[3] = lines[i].special == 483; + lines[i].special = 482; + break; + case 484: //Polyobject - rotate right + case 485: //Polyobject - rotate right, override + case 486: //Polyobject - rotate left + case 487: //Polyobject - rotate left, override + lines[i].args[0] = tag; + lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[2] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + if (lines[i].args[2] == 360) + lines[i].args[3] |= TMPR_CONTINUOUS; + else if (lines[i].args[2] == 0) + lines[i].args[2] = 360; + if (lines[i].special < 486) + lines[i].args[2] *= -1; + if (lines[i].flags & ML_NOCLIMB) + lines[i].args[3] |= TMPR_DONTROTATEOTHERS; + else if (lines[i].flags & ML_MIDSOLID) + lines[i].args[3] |= TMPR_ROTATEPLAYERS; + if (lines[i].special % 2 == 1) + lines[i].args[3] |= TMPR_OVERRIDE; + lines[i].special = 484; + break; + case 488: //Polyobject - move by waypoints + lines[i].args[0] = tag; + lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[2] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + if (lines[i].flags & ML_MIDPEG) + lines[i].args[3] = PWR_WRAP; + else if (lines[i].flags & ML_NOSKEW) + lines[i].args[3] = PWR_COMEBACK; + else + lines[i].args[3] = PWR_STOP; + if (lines[i].flags & ML_SKEWTD) + lines[i].args[4] |= PWF_REVERSE; + if (lines[i].flags & ML_MIDSOLID) + lines[i].args[4] |= PWF_LOOP; + break; + case 489: //Polyobject - turn invisible, intangible + case 490: //Polyobject - turn visible, tangible + lines[i].args[0] = tag; + lines[i].args[1] = 491 - lines[i].special; + if (!(lines[i].flags & ML_NOCLIMB)) + lines[i].args[2] = lines[i].args[1]; + lines[i].special = 489; + break; + case 491: //Polyobject - set translucency + lines[i].args[0] = tag; + // If Front X Offset is specified, use that. Else, use floorheight. + lines[i].args[1] = (sides[lines[i].sidenum[0]].textureoffset ? sides[lines[i].sidenum[0]].textureoffset : lines[i].frontsector->floorheight) >> FRACBITS; + // If DONTPEGBOTTOM, specify raw translucency value. Else, take it out of 1000. + if (!(lines[i].flags & ML_DONTPEGBOTTOM)) + lines[i].args[1] /= 100; + lines[i].args[2] = !!(lines[i].flags & ML_MIDPEG); + break; + case 492: //Polyobject - fade translucency + lines[i].args[0] = tag; + // If Front X Offset is specified, use that. Else, use floorheight. + lines[i].args[1] = (sides[lines[i].sidenum[0]].textureoffset ? sides[lines[i].sidenum[0]].textureoffset : lines[i].frontsector->floorheight) >> FRACBITS; + // If DONTPEGBOTTOM, specify raw translucency value. Else, take it out of 1000. + if (!(lines[i].flags & ML_DONTPEGBOTTOM)) + lines[i].args[1] /= 100; + // allow Back Y Offset to be consistent with other fade specials + lines[i].args[2] = (lines[i].sidenum[1] != 0xffff && !sides[lines[i].sidenum[0]].rowoffset) ? + abs(sides[lines[i].sidenum[1]].rowoffset >> FRACBITS) + : abs(sides[lines[i].sidenum[0]].rowoffset >> FRACBITS); + if (lines[i].flags & ML_MIDPEG) + lines[i].args[3] |= TMPF_RELATIVE; + if (lines[i].flags & ML_WRAPMIDTEX) + lines[i].args[3] |= TMPF_OVERRIDE; + if (lines[i].flags & ML_MIDSOLID) + lines[i].args[3] |= TMPF_TICBASED; + if (lines[i].flags & ML_BOUNCY) + lines[i].args[3] |= TMPF_IGNORECOLLISION; + if (lines[i].flags & ML_SKEWTD) + lines[i].args[3] |= TMPF_GHOSTFADE; + break; + case 500: //Scroll front wall left + case 501: //Scroll front wall right + lines[i].args[0] = 0; + lines[i].args[1] = (lines[i].special == 500) ? -1 : 1; + lines[i].args[2] = 0; + lines[i].special = 500; + break; + case 502: //Scroll tagged wall + case 503: //Scroll tagged wall (accelerative) + case 504: //Scroll tagged wall (displacement) + lines[i].args[0] = tag; + if (lines[i].flags & ML_MIDPEG) + { + if (lines[i].sidenum[1] == 0xffff) + { + CONS_Debug(DBG_GAMELOGIC, "Line special %d (line #%s) missing back side!\n", lines[i].special, sizeu1(i)); + lines[i].special = 0; + break; + } + lines[i].args[1] = 1; + } + else + lines[i].args[1] = 0; + if (lines[i].flags & ML_NOSKEW) + { + lines[i].args[2] = sides[lines[i].sidenum[0]].textureoffset >> (FRACBITS - SCROLL_SHIFT); + lines[i].args[3] = sides[lines[i].sidenum[0]].rowoffset >> (FRACBITS - SCROLL_SHIFT); + } + else + { + lines[i].args[2] = lines[i].dx >> FRACBITS; + lines[i].args[3] = lines[i].dy >> FRACBITS; + } + lines[i].args[4] = lines[i].special - 502; + lines[i].special = 502; + break; + case 505: //Scroll front wall by front side offsets + case 506: //Scroll front wall by back side offsets + case 507: //Scroll back wall by front side offsets + case 508: //Scroll back wall by back side offsets + lines[i].args[0] = lines[i].special >= 507; + if (lines[i].special % 2 == 0) + { + if (lines[i].sidenum[1] == 0xffff) + { + CONS_Debug(DBG_GAMELOGIC, "Line special %d (line #%s) missing back side!\n", lines[i].special, sizeu1(i)); + lines[i].special = 0; + break; + } + lines[i].args[1] = sides[lines[i].sidenum[1]].textureoffset >> FRACBITS; + lines[i].args[2] = sides[lines[i].sidenum[1]].rowoffset >> FRACBITS; + } + else + { + lines[i].args[1] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[2] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + } + lines[i].special = 500; + break; + case 510: //Scroll floor texture + case 511: //Scroll floor texture (accelerative) + case 512: //Scroll floor texture (displacement) + case 513: //Scroll ceiling texture + case 514: //Scroll ceiling texture (accelerative) + case 515: //Scroll ceiling texture (displacement) + case 520: //Carry objects on floor + case 521: //Carry objects on floor (accelerative) + case 522: //Carry objects on floor (displacement) + case 523: //Carry objects on ceiling + case 524: //Carry objects on ceiling (accelerative) + case 525: //Carry objects on ceiling (displacement) + case 530: //Scroll floor texture and carry objects + case 531: //Scroll floor texture and carry objects (accelerative) + case 532: //Scroll floor texture and carry objects (displacement) + case 533: //Scroll ceiling texture and carry objects + case 534: //Scroll ceiling texture and carry objects (accelerative) + case 535: //Scroll ceiling texture and carry objects (displacement) + lines[i].args[0] = tag; + lines[i].args[1] = ((lines[i].special % 10) < 3) ? TMP_FLOOR : TMP_CEILING; + lines[i].args[2] = ((lines[i].special - 510)/10 + 1) % 3; + lines[i].args[3] = R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> FRACBITS; + lines[i].args[4] = (lines[i].special % 10) % 3; + if (lines[i].args[2] != TMS_SCROLLONLY && !(lines[i].flags & ML_NOCLIMB)) + lines[i].args[4] |= TMST_NONEXCLUSIVE; + lines[i].special = 510; + break; + case 540: //Floor friction + { + INT32 s; + fixed_t strength; // friction value of sector + fixed_t friction; // friction value to be applied during movement + + strength = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + if (strength > 0) // sludge + strength = strength*2; // otherwise, the maximum sludginess value is +967... + + // The following might seem odd. At the time of movement, + // the move distance is multiplied by 'friction/0x10000', so a + // higher friction value actually means 'less friction'. + friction = ORIG_FRICTION - (0x1EB8*strength)/0x80; // ORIG_FRICTION is 0xE800 + + TAG_ITER_SECTORS(tag, s) + sectors[s].friction = friction; + break; + } + case 541: //Wind + case 542: //Upwards wind + case 543: //Downwards wind + case 544: //Current + case 545: //Upwards current + case 546: //Downwards current + lines[i].args[0] = tag; + switch ((lines[i].special - 541) % 3) + { + case 0: + lines[i].args[1] = R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> FRACBITS; + break; + case 1: + lines[i].args[2] = R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> FRACBITS; + break; + case 2: + lines[i].args[2] = -R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> FRACBITS; + break; + } + lines[i].args[3] = (lines[i].special >= 544) ? p_current : p_wind; + if (lines[i].flags & ML_MIDSOLID) + lines[i].args[4] |= TMPF_SLIDE; + if (!(lines[i].flags & ML_NOCLIMB)) + lines[i].args[4] |= TMPF_NONEXCLUSIVE; + lines[i].special = 541; + break; + case 600: //Floor lighting + case 601: //Ceiling lighting + lines[i].args[0] = tag; + lines[i].args[1] = (lines[i].special == 601) ? TMP_CEILING : TMP_FLOOR; + lines[i].special = 600; break; case 606: //Colormap - lines[i].args[0] = Tag_FGet(&lines[i].tags); + lines[i].args[0] = tag; break; case 700: //Slope front sector floor case 701: //Slope front sector ceiling @@ -3267,12 +5690,8 @@ static void P_ConvertBinaryMap(void) lines[i].args[2] |= TMSL_NOPHYSICS; if (lines[i].flags & ML_NONET) lines[i].args[2] |= TMSL_DYNAMIC; - if (lines[i].flags & ML_TFERLINE) - { - lines[i].args[4] |= backfloor ? TMSC_BACKTOFRONTFLOOR : (frontfloor ? TMSC_FRONTTOBACKFLOOR : 0); - lines[i].args[4] |= backceil ? TMSC_BACKTOFRONTCEILING : (frontceil ? TMSC_FRONTTOBACKCEILING : 0); - } + lines[i].args[2] |= TMSL_COPY; lines[i].special = 700; break; @@ -3355,6 +5774,9 @@ static void P_ConvertBinaryMap(void) lines[i].args[4] |= TMSC_BACKTOFRONTCEILING; lines[i].special = 720; break; + case 799: //Set dynamic slope vertex to front sector height + lines[i].args[0] = !!(lines[i].flags & ML_NOCLIMB); + break; case 909: //Fog wall lines[i].blendmode = AST_FOG; break; @@ -3391,25 +5813,529 @@ static void P_ConvertBinaryMap(void) lines[i].executordelay = 1; } } +} + +static void P_ConvertBinarySectorTypes(void) +{ + size_t i; + + for (i = 0; i < numsectors; i++) + { + mtag_t tag = Tag_FGet(§ors[i].tags); + + switch(GETSECSPECIAL(sectors[i].special, 1)) + { + case 1: //Damage + sectors[i].damagetype = SD_GENERIC; + break; + case 2: //Damage (Water) + sectors[i].damagetype = SD_WATER; + break; + case 3: //Damage (Fire) + { + size_t j; + boolean isLava = false; + + for (j = 0; j < sectors[i].linecount; j++) + { + line_t *line = sectors[i].lines[j]; + + if (line->frontsector != §ors[i]) + continue; + + if (line->flags & ML_BLOCKMONSTERS) + continue; + + if (line->special == 120 || (line->special == 259 && (line->args[2] & FF_SWIMMABLE))) + { + isLava = true; + break; + } + } + sectors[i].damagetype = isLava ? SD_LAVA : SD_FIRE; + break; + } + case 4: //Damage (Electric) + sectors[i].damagetype = SD_ELECTRIC; + break; + case 5: //Spikes + sectors[i].damagetype = SD_SPIKE; + break; + case 6: //Death pit (camera tilt) + sectors[i].damagetype = SD_DEATHPITTILT; + break; + case 7: //Death pit (no camera tilt) + sectors[i].damagetype = SD_DEATHPITNOTILT; + break; + case 8: //Instakill + sectors[i].damagetype = SD_INSTAKILL; + break; + case 11: //Special stage damage + sectors[i].damagetype = SD_SPECIALSTAGE; + break; + case 12: //Space countdown + sectors[i].specialflags |= SSF_OUTERSPACE; + break; + case 13: //Ramp sector + sectors[i].specialflags |= SSF_DOUBLESTEPUP; + break; + case 14: //Non-ramp sector + sectors[i].specialflags |= SSF_NOSTEPDOWN; + break; + default: + break; + } + + switch(GETSECSPECIAL(sectors[i].special, 2)) + { + case 1: //Trigger linedef executor (pushable objects) + sectors[i].triggertag = tag; + sectors[i].flags |= MSF_TRIGGERLINE_PLANE; + sectors[i].triggerer = TO_MOBJ; + break; + case 2: //Trigger linedef executor (Anywhere in sector, all players) + sectors[i].triggertag = tag; + sectors[i].flags &= ~MSF_TRIGGERLINE_PLANE; + sectors[i].triggerer = TO_ALLPLAYERS; + break; + case 3: //Trigger linedef executor (Floor touch, all players) + sectors[i].triggertag = tag; + sectors[i].flags |= MSF_TRIGGERLINE_PLANE; + sectors[i].triggerer = TO_ALLPLAYERS; + break; + case 4: //Trigger linedef executor (Anywhere in sector) + sectors[i].triggertag = tag; + sectors[i].flags &= ~MSF_TRIGGERLINE_PLANE; + sectors[i].triggerer = TO_PLAYER; + break; + case 5: //Trigger linedef executor (Floor touch) + sectors[i].triggertag = tag; + sectors[i].flags |= MSF_TRIGGERLINE_PLANE; + sectors[i].triggerer = TO_PLAYER; + break; + case 6: //Trigger linedef executor (Emerald check) + sectors[i].triggertag = tag; + sectors[i].flags &= ~MSF_TRIGGERLINE_PLANE; + sectors[i].triggerer = TO_PLAYEREMERALDS; + break; + case 7: //Trigger linedef executor (NiGHTS mare) + sectors[i].triggertag = tag; + sectors[i].flags &= ~MSF_TRIGGERLINE_PLANE; + sectors[i].triggerer = TO_PLAYERNIGHTS; + break; + case 8: //Check for linedef executor on FOFs + sectors[i].flags |= MSF_TRIGGERLINE_MOBJ; + break; + default: + break; + } + + switch(GETSECSPECIAL(sectors[i].special, 3)) + { + case 5: //Speed pad + sectors[i].specialflags |= SSF_SPEEDPAD; + break; + default: + break; + } + + switch(GETSECSPECIAL(sectors[i].special, 4)) + { + case 1: //Star post activator + sectors[i].specialflags |= SSF_STARPOSTACTIVATOR; + break; + case 2: //Exit/Special Stage pit/Return flag + sectors[i].specialflags |= SSF_EXIT|SSF_SPECIALSTAGEPIT|SSF_RETURNFLAG; + break; + case 3: //Red team base + sectors[i].specialflags |= SSF_REDTEAMBASE; + break; + case 4: //Blue team base + sectors[i].specialflags |= SSF_BLUETEAMBASE; + break; + case 5: //Fan sector + sectors[i].specialflags |= SSF_FAN; + break; + case 6: //Super Sonic transform + sectors[i].specialflags |= SSF_SUPERTRANSFORM; + break; + case 7: //Force spin + sectors[i].specialflags |= SSF_FORCESPIN; + break; + case 8: //Zoom tube start + sectors[i].specialflags |= SSF_ZOOMTUBESTART; + break; + case 9: //Zoom tube end + sectors[i].specialflags |= SSF_ZOOMTUBEEND; + break; + case 10: //Circuit finish line + sectors[i].specialflags |= SSF_FINISHLINE; + break; + case 11: //Rope hang + sectors[i].specialflags |= SSF_ROPEHANG; + break; + case 12: //Intangible to the camera + sectors[i].flags |= MSF_NOCLIPCAMERA; + break; + default: + break; + } + } +} + +static void P_ConvertBinaryThingTypes(void) +{ + size_t i; + mobjtype_t mobjtypeofthing[4096] = {0}; + mobjtype_t mobjtype; + + for (i = 0; i < NUMMOBJTYPES; i++) + { + if (mobjinfo[i].doomednum < 0 || mobjinfo[i].doomednum >= 4096) + continue; + + mobjtypeofthing[mobjinfo[i].doomednum] = (mobjtype_t)i; + } for (i = 0; i < nummapthings; i++) { + mobjtype = mobjtypeofthing[mapthings[i].type]; + if (mobjtype) + { + if (mobjinfo[mobjtype].flags & MF_BOSS) + { + INT32 paramoffset = mapthings[i].extrainfo*LE_PARAMWIDTH; + mapthings[i].args[0] = mapthings[i].extrainfo; + mapthings[i].args[1] = !!(mapthings[i].options & MTF_OBJECTSPECIAL); + mapthings[i].args[2] = LE_BOSSDEAD + paramoffset; + mapthings[i].args[3] = LE_ALLBOSSESDEAD + paramoffset; + mapthings[i].args[4] = LE_PINCHPHASE + paramoffset; + } + if (mobjinfo[mobjtype].flags & MF_NIGHTSITEM) + { + if (mapthings[i].options & MTF_OBJECTSPECIAL) + mapthings[i].args[0] |= TMNI_BONUSONLY; + if (mapthings[i].options & MTF_AMBUSH) + mapthings[i].args[0] |= TMNI_REVEAL; + } + if (mobjinfo[mobjtype].flags & MF_PUSHABLE) + { + if ((mapthings[i].options & (MTF_OBJECTSPECIAL|MTF_AMBUSH)) == (MTF_OBJECTSPECIAL|MTF_AMBUSH)) + mapthings[i].args[0] = TMP_CLASSIC; + else if (mapthings[i].options & MTF_OBJECTSPECIAL) + mapthings[i].args[0] = TMP_SLIDE; + else if (mapthings[i].options & MTF_AMBUSH) + mapthings[i].args[0] = TMP_IMMOVABLE; + else + mapthings[i].args[0] = TMP_NORMAL; + } + if ((mobjinfo[mobjtype].flags & MF_SPRING) && mobjinfo[mobjtype].painchance == 3) + mapthings[i].args[0] = !!(mapthings[i].options & MTF_AMBUSH); + if (mobjinfo[mobjtype].flags & MF_MONITOR) + { + if ((mapthings[i].options & MTF_EXTRA) && mapthings[i].angle & 16384) + mapthings[i].args[0] = mapthings[i].angle & 16383; + + if (mobjinfo[mobjtype].speed != 0) + { + if (mapthings[i].options & MTF_OBJECTSPECIAL) + mapthings[i].args[1] = TMMR_STRONG; + else if (mapthings[i].options & MTF_AMBUSH) + mapthings[i].args[1] = TMMR_WEAK; + else + mapthings[i].args[1] = TMMR_SAME; + } + } + } + + if (mapthings[i].type >= 1 && mapthings[i].type <= 35) //Player starts + { + mapthings[i].args[0] = !!(mapthings[i].options & MTF_AMBUSH); + continue; + } + else if (mapthings[i].type >= 2200 && mapthings[i].type <= 2217) //Flickies + { + mapthings[i].args[0] = mapthings[i].angle; + if (mapthings[i].options & MTF_EXTRA) + mapthings[i].args[1] |= TMFF_AIMLESS; + if (mapthings[i].options & MTF_OBJECTSPECIAL) + mapthings[i].args[1] |= TMFF_STATIONARY; + if (mapthings[i].options & MTF_AMBUSH) + mapthings[i].args[1] |= TMFF_HOP; + if (mapthings[i].type == 2207) + mapthings[i].args[2] = mapthings[i].extrainfo; + continue; + } + switch (mapthings[i].type) { - case 750: - Tag_FSet(&mapthings[i].tags, mapthings[i].angle); + case 102: //SDURF + case 1805: //Puma + mapthings[i].args[0] = mapthings[i].angle; break; - case 760: - case 761: - Tag_FSet(&mapthings[i].tags, mapthings[i].angle); + case 110: //THZ Turret + mapthings[i].args[0] = LE_TURRET; break; - case 762: + case 111: //Pop-up Turret + mapthings[i].args[0] = mapthings[i].angle; + break; + case 103: //Buzz (Gold) + case 104: //Buzz (Red) + case 105: //Jetty-syn Bomber + case 106: //Jetty-syn Gunner + case 117: //Robo-Hood + case 126: //Crushstacean + case 128: //Bumblebore + case 132: //Cacolantern + case 138: //Banpyura + case 1602: //Pian + mapthings[i].args[0] = !!(mapthings[i].options & MTF_AMBUSH); + break; + case 119: //Egg Guard + if ((mapthings[i].options & (MTF_EXTRA|MTF_OBJECTSPECIAL)) == MTF_OBJECTSPECIAL) + mapthings[i].args[0] = TMGD_LEFT; + else if ((mapthings[i].options & (MTF_EXTRA|MTF_OBJECTSPECIAL)) == MTF_EXTRA) + mapthings[i].args[0] = TMGD_RIGHT; + else + mapthings[i].args[0] = TMGD_BACK; + mapthings[i].args[1] = !!(mapthings[i].options & MTF_AMBUSH); + break; + case 127: //Hive Elemental + mapthings[i].args[0] = mapthings[i].extrainfo; + break; + case 135: //Pterabyte Spawner + mapthings[i].args[0] = mapthings[i].extrainfo + 1; + break; + case 136: //Pyre Fly + mapthings[i].args[0] = !!(mapthings[i].options & MTF_AMBUSH); + break; + case 201: //Egg Slimer + mapthings[i].args[5] = !(mapthings[i].options & MTF_AMBUSH); + break; + case 203: //Egg Colosseum + mapthings[i].args[5] = LE_BOSS4DROP + mapthings[i].extrainfo * LE_PARAMWIDTH; + break; + case 204: //Fang + mapthings[i].args[4] = LE_BOSS4DROP + mapthings[i].extrainfo*LE_PARAMWIDTH; + if (mapthings[i].options & MTF_EXTRA) + mapthings[i].args[5] |= TMF_GRAYSCALE; + if (mapthings[i].options & MTF_AMBUSH) + mapthings[i].args[5] |= TMF_SKIPINTRO; + break; + case 206: //Brak Eggman (Old) + mapthings[i].args[5] = LE_BRAKPLATFORM + mapthings[i].extrainfo*LE_PARAMWIDTH; + break; + case 207: //Metal Sonic (Race) + case 2104: //Amy Cameo + mapthings[i].args[0] = !!(mapthings[i].options & MTF_EXTRA); + break; + case 208: //Metal Sonic (Battle) + mapthings[i].args[5] = !!(mapthings[i].options & MTF_EXTRA); + break; + case 209: //Brak Eggman + mapthings[i].args[5] = LE_BRAKVILEATACK + mapthings[i].extrainfo*LE_PARAMWIDTH; + if (mapthings[i].options & MTF_EXTRA) + mapthings[i].args[6] |= TMB_NODEATHFLING; + if (mapthings[i].options & MTF_AMBUSH) + mapthings[i].args[6] |= TMB_BARRIER; + break; + case 292: //Boss waypoint + mapthings[i].args[0] = mapthings[i].angle; + mapthings[i].args[1] = mapthings[i].options & 7; + break; + case 294: //Fang waypoint + mapthings[i].args[0] = !!(mapthings[i].options & MTF_AMBUSH); + break; + case 300: //Ring + case 301: //Bounce ring + case 302: //Rail ring + case 303: //Infinity ring + case 304: //Automatic ring + case 305: //Explosion ring + case 306: //Scatter ring + case 307: //Grenade ring + case 308: //Red team ring + case 309: //Blue team ring + case 312: //Emerald token + case 320: //Emerald hunt location + case 321: //Match chaos emerald spawn + case 322: //Emblem + case 330: //Bounce ring panel + case 331: //Rail ring panel + case 332: //Automatic ring panel + case 333: //Explosion ring panel + case 334: //Scatter ring panel + case 335: //Grenade ring panel + case 520: //Bomb sphere + case 521: //Spikeball + case 1706: //Blue sphere + case 1800: //Coin + mapthings[i].args[0] = !(mapthings[i].options & MTF_AMBUSH); + break; + case 409: //Extra life monitor + mapthings[i].args[2] = !(mapthings[i].options & (MTF_AMBUSH|MTF_OBJECTSPECIAL)); + break; + case 500: //Air bubble patch + mapthings[i].args[0] = !!(mapthings[i].options & MTF_AMBUSH); + break; + case 502: //Star post + if (mapthings[i].extrainfo) + // Allow thing Parameter to define star post num too! + // For starposts above param 15 (the 16th), add 360 to the angle like before and start parameter from 1 (NOT 0)! + // So the 16th starpost is angle=0 param=15, the 17th would be angle=360 param=1. + // This seems more intuitive for mappers to use, since most SP maps won't have over 16 consecutive star posts. + mapthings[i].args[0] = mapthings[i].extrainfo + (mapthings[i].angle/360) * 15; + else + // Old behavior if Parameter is 0; add 360 to the angle for each consecutive star post. + mapthings[i].args[0] = (mapthings[i].angle/360); + mapthings[i].args[1] = !!(mapthings[i].options & MTF_OBJECTSPECIAL); + break; + case 522: //Wall spike + if (mapthings[i].options & MTF_OBJECTSPECIAL) + { + mapthings[i].args[0] = mobjinfo[MT_WALLSPIKE].speed + mapthings[i].angle/360; + mapthings[i].args[1] = (16 - mapthings[i].extrainfo) * mapthings[i].args[0]/16; + if (mapthings[i].options & MTF_EXTRA) + mapthings[i].args[2] |= TMSF_RETRACTED; + } + if (mapthings[i].options & MTF_AMBUSH) + mapthings[i].args[2] |= TMSF_INTANGIBLE; + break; + case 523: //Spike + if (mapthings[i].options & MTF_OBJECTSPECIAL) + { + mapthings[i].args[0] = mobjinfo[MT_SPIKE].speed + mapthings[i].angle; + mapthings[i].args[1] = (16 - mapthings[i].extrainfo) * mapthings[i].args[0]/16; + if (mapthings[i].options & MTF_EXTRA) + mapthings[i].args[2] |= TMSF_RETRACTED; + } + if (mapthings[i].options & MTF_AMBUSH) + mapthings[i].args[2] |= TMSF_INTANGIBLE; + break; + case 540: //Fan + mapthings[i].args[0] = mapthings[i].angle; + if (mapthings[i].options & MTF_OBJECTSPECIAL) + mapthings[i].args[1] |= TMF_INVISIBLE; + if (mapthings[i].options & MTF_AMBUSH) + mapthings[i].args[1] |= TMF_NODISTANCECHECK; + break; + case 541: //Gas jet + mapthings[i].args[0] = !!(mapthings[i].options & MTF_AMBUSH); + break; + case 543: //Balloon + if (mapthings[i].angle > 0) + P_WriteConstant(((mapthings[i].angle - 1) % (numskincolors - 1)) + 1, &mapthings[i].stringargs[0]); + mapthings[i].args[0] = !!(mapthings[i].options & MTF_AMBUSH); + break; + case 555: //Diagonal yellow spring + case 556: //Diagonal red spring + case 557: //Diagonal blue spring + if (mapthings[i].options & MTF_OBJECTSPECIAL) + mapthings[i].args[0] |= TMDS_NOGRAVITY; + if (mapthings[i].options & MTF_AMBUSH) + mapthings[i].args[0] |= TMDS_ROTATEEXTRA; + break; + case 558: //Horizontal yellow spring + case 559: //Horizontal red spring + case 560: //Horizontal blue spring + mapthings[i].args[0] = !(mapthings[i].options & MTF_AMBUSH); + break; + case 700: //Water ambience A + case 701: //Water ambience B + case 702: //Water ambience C + case 703: //Water ambience D + case 704: //Water ambience E + case 705: //Water ambience F + case 706: //Water ambience G + case 707: //Water ambience H + mapthings[i].args[0] = 35; + P_WriteConstant(sfx_amwtr1 + mapthings[i].type - 700, &mapthings[i].stringargs[0]); + mapthings[i].type = 700; + break; + case 708: //Disco ambience + mapthings[i].args[0] = 512; + P_WriteConstant(sfx_ambint, &mapthings[i].stringargs[0]); + mapthings[i].type = 700; + break; + case 709: //Volcano ambience + mapthings[i].args[0] = 220; + P_WriteConstant(sfx_ambin2, &mapthings[i].stringargs[0]); + mapthings[i].type = 700; + break; + case 710: //Machine ambience + mapthings[i].args[0] = 24; + P_WriteConstant(sfx_ambmac, &mapthings[i].stringargs[0]); + mapthings[i].type = 700; + break; + case 750: //Slope vertex + mapthings[i].args[0] = mapthings[i].extrainfo; + break; + case 753: //Zoom tube waypoint + mapthings[i].args[0] = mapthings[i].angle >> 8; + mapthings[i].args[1] = mapthings[i].angle & 255; + break; + case 754: //Push point + case 755: //Pull point + { + subsector_t *ss = R_PointInSubsector(mapthings[i].x << FRACBITS, mapthings[i].y << FRACBITS); + sector_t *s; + line_t *line; + + if (!ss) + { + CONS_Debug(DBG_GAMELOGIC, "Push/pull point: Placed outside of map bounds!\n"); + break; + } + + s = ss->sector; + line = P_FindPointPushLine(&s->tags); + + if (!line) + { + CONS_Debug(DBG_GAMELOGIC, "Push/pull point: Unable to find line of type 547 tagged to sector %s!\n", sizeu1((size_t)(s - sectors))); + break; + } + + mapthings[i].args[0] = mapthings[i].angle; + mapthings[i].args[1] = P_AproxDistance(line->dx >> FRACBITS, line->dy >> FRACBITS); + if (mapthings[i].type == 755) + mapthings[i].args[1] *= -1; + if (mapthings[i].options & MTF_OBJECTSPECIAL) + mapthings[i].args[2] |= TMPP_NOZFADE; + if (mapthings[i].options & MTF_AMBUSH) + mapthings[i].args[2] |= TMPP_PUSHZ; + if (!(line->flags & ML_NOCLIMB)) + mapthings[i].args[2] |= TMPP_NONEXCLUSIVE; + mapthings[i].type = 754; + break; + } + case 756: //Blast linedef executor + mapthings[i].args[0] = mapthings[i].angle; + break; + case 757: //Fan particle generator + { + INT32 j = Tag_FindLineSpecial(15, mapthings[i].angle); + + if (j == -1) + { + CONS_Debug(DBG_GAMELOGIC, "Particle generator (mapthing #%d) needs to be tagged to a #15 parameter line (trying to find tag %d).\n", i, mapthings[i].angle); + break; + } + mapthings[i].args[0] = mapthings[i].z; + mapthings[i].args[1] = R_PointToDist2(lines[j].v1->x, lines[j].v1->y, lines[j].v2->x, lines[j].v2->y) >> FRACBITS; + mapthings[i].args[2] = sides[lines[j].sidenum[0]].textureoffset >> FRACBITS; + mapthings[i].args[3] = sides[lines[j].sidenum[0]].rowoffset >> FRACBITS; + mapthings[i].args[4] = lines[j].backsector ? sides[lines[j].sidenum[1]].textureoffset >> FRACBITS : 0; + mapthings[i].args[6] = mapthings[i].angle; + if (sides[lines[j].sidenum[0]].toptexture) + P_WriteConstant(sides[lines[j].sidenum[0]].toptexture, &mapthings[i].stringargs[0]); + break; + } + case 762: //PolyObject spawn point (crush) { INT32 check = -1; INT32 firstline = -1; - mtag_t tag = mapthings[i].angle; - - Tag_FSet(&mapthings[i].tags, tag); + mtag_t tag = Tag_FGet(&mapthings[i].tags); TAG_ITER_LINES(tag, check) { @@ -3426,8 +6352,201 @@ static void P_ConvertBinaryMap(void) mapthings[i].type = 761; break; } - case 780: - Tag_FSet(&mapthings[i].tags, mapthings[i].extrainfo); + case 780: //Skybox + mapthings[i].args[0] = !!(mapthings[i].options & MTF_OBJECTSPECIAL); + break; + case 799: //Tutorial plant + mapthings[i].args[0] = mapthings[i].extrainfo; + break; + case 1002: //Dripping water + mapthings[i].args[0] = mapthings[i].angle; + break; + case 1007: //Kelp + case 1008: //Stalagmite (DSZ1) + case 1011: //Stalagmite (DSZ2) + mapthings[i].args[0] = !!(mapthings[i].options & MTF_OBJECTSPECIAL); + break; + case 1102: //Eggman Statue + mapthings[i].args[1] = !!(mapthings[i].options & MTF_EXTRA); + break; + case 1104: //Mace spawnpoint + case 1105: //Chain with maces spawnpoint + case 1106: //Chained spring spawnpoint + case 1107: //Chain spawnpoint + case 1109: //Firebar spawnpoint + case 1110: //Custom mace spawnpoint + { + mtag_t tag = (mtag_t)mapthings[i].angle; + INT32 j = Tag_FindLineSpecial(9, tag); + + if (j == -1) + { + CONS_Debug(DBG_GAMELOGIC, "Chain/mace setup: Unable to find parameter line 9 (tag %d)!\n", tag); + break; + } + + mapthings[i].angle = lines[j].frontsector->ceilingheight >> FRACBITS; + mapthings[i].pitch = lines[j].frontsector->floorheight >> FRACBITS; + mapthings[i].args[0] = lines[j].dx >> FRACBITS; + mapthings[i].args[1] = mapthings[i].extrainfo; + mapthings[i].args[3] = lines[j].dy >> FRACBITS; + mapthings[i].args[4] = sides[lines[j].sidenum[0]].textureoffset >> FRACBITS; + mapthings[i].args[7] = -sides[lines[j].sidenum[0]].rowoffset >> FRACBITS; + if (lines[j].backsector) + { + mapthings[i].roll = lines[j].backsector->ceilingheight >> FRACBITS; + mapthings[i].args[2] = sides[lines[j].sidenum[1]].rowoffset >> FRACBITS; + mapthings[i].args[5] = lines[j].backsector->floorheight >> FRACBITS; + mapthings[i].args[6] = sides[lines[j].sidenum[1]].textureoffset >> FRACBITS; + } + if (mapthings[i].options & MTF_AMBUSH) + mapthings[i].args[8] |= TMM_DOUBLESIZE; + if (mapthings[i].options & MTF_OBJECTSPECIAL) + mapthings[i].args[8] |= TMM_SILENT; + if (lines[j].flags & ML_NOCLIMB) + mapthings[i].args[8] |= TMM_ALLOWYAWCONTROL; + if (lines[j].flags & ML_SKEWTD) + mapthings[i].args[8] |= TMM_SWING; + if (lines[j].flags & ML_NOSKEW) + mapthings[i].args[8] |= TMM_MACELINKS; + if (lines[j].flags & ML_MIDPEG) + mapthings[i].args[8] |= TMM_CENTERLINK; + if (lines[j].flags & ML_MIDSOLID) + mapthings[i].args[8] |= TMM_CLIP; + if (lines[j].flags & ML_WRAPMIDTEX) + mapthings[i].args[8] |= TMM_ALWAYSTHINK; + if (mapthings[i].type == 1110) + { + P_WriteConstant(sides[lines[j].sidenum[0]].toptexture, &mapthings[i].stringargs[0]); + P_WriteConstant(lines[j].backsector ? sides[lines[j].sidenum[1]].toptexture : MT_NULL, &mapthings[i].stringargs[1]); + } + break; + } + case 1101: //Torch + case 1119: //Candle + case 1120: //Candle pricket + mapthings[i].args[0] = !!(mapthings[i].options & MTF_EXTRA); + break; + case 1121: //Flame holder + if (mapthings[i].options & MTF_OBJECTSPECIAL) + mapthings[i].args[0] |= TMFH_NOFLAME; + if (mapthings[i].options & MTF_EXTRA) + mapthings[i].args[0] |= TMFH_CORONA; + break; + case 1127: //Spectator EggRobo + if (mapthings[i].options & MTF_AMBUSH) + mapthings[i].args[0] = TMED_LEFT; + else if (mapthings[i].options & MTF_OBJECTSPECIAL) + mapthings[i].args[0] = TMED_RIGHT; + else + mapthings[i].args[0] = TMED_NONE; + break; + case 1200: //Tumbleweed (Big) + case 1201: //Tumbleweed (Small) + mapthings[i].args[0] = !!(mapthings[i].options & MTF_AMBUSH); + break; + case 1202: //Rock spawner + { + mtag_t tag = (mtag_t)mapthings[i].angle; + INT32 j = Tag_FindLineSpecial(12, tag); + + if (j == -1) + { + CONS_Debug(DBG_GAMELOGIC, "Rock spawner: Unable to find parameter line 12 (tag %d)!\n", tag); + break; + } + mapthings[i].angle = AngleFixed(R_PointToAngle2(lines[j].v2->x, lines[j].v2->y, lines[j].v1->x, lines[j].v1->y)) >> FRACBITS; + mapthings[i].args[0] = P_AproxDistance(lines[j].dx, lines[j].dy) >> FRACBITS; + mapthings[i].args[1] = sides[lines[j].sidenum[0]].textureoffset >> FRACBITS; + mapthings[i].args[2] = !!(lines[j].flags & ML_NOCLIMB); + P_WriteConstant(MT_ROCKCRUMBLE1 + (sides[lines[j].sidenum[0]].rowoffset >> FRACBITS), &mapthings[i].stringargs[0]); + break; + } + case 1221: //Minecart saloon door + mapthings[i].args[0] = !!(mapthings[i].options & MTF_AMBUSH); + break; + case 1229: //Minecart switch point + mapthings[i].args[0] = !!(mapthings[i].options & MTF_AMBUSH); + break; + case 1300: //Flame jet (horizontal) + case 1301: //Flame jet (vertical) + mapthings[i].args[0] = (mapthings[i].angle >> 13)*TICRATE/2; + mapthings[i].args[1] = ((mapthings[i].angle >> 10) & 7)*TICRATE/2; + mapthings[i].args[2] = 80 - 5*mapthings[i].extrainfo; + mapthings[i].args[3] = !!(mapthings[i].options & MTF_AMBUSH); + break; + case 1304: //Lavafall + mapthings[i].args[0] = mapthings[i].angle; + mapthings[i].args[1] = !!(mapthings[i].options & MTF_AMBUSH); + break; + case 1305: //Rollout Rock + mapthings[i].args[0] = !!(mapthings[i].options & MTF_AMBUSH); + break; + case 1500: //Glaregoyle + case 1501: //Glaregoyle (Up) + case 1502: //Glaregoyle (Down) + case 1503: //Glaregoyle (Long) + if (mapthings[i].angle >= 360) + mapthings[i].args[1] = 7*(mapthings[i].angle/360) + 1; + break; + case 1700: //Axis + mapthings[i].args[2] = mapthings[i].angle & 16383; + mapthings[i].args[3] = !!(mapthings[i].angle & 16384); + /* FALLTHRU */ + case 1701: //Axis transfer + case 1702: //Axis transfer line + mapthings[i].args[0] = mapthings[i].extrainfo; + mapthings[i].args[1] = mapthings[i].options; + break; + case 1703: //Ideya drone + mapthings[i].args[0] = mapthings[i].angle & 0xFFF; + mapthings[i].args[1] = mapthings[i].extrainfo*32; + mapthings[i].args[2] = ((mapthings[i].angle & 0xF000) >> 12)*32; + if ((mapthings[i].options & (MTF_OBJECTSPECIAL|MTF_EXTRA)) == (MTF_OBJECTSPECIAL|MTF_EXTRA)) + mapthings[i].args[3] = TMDA_BOTTOM; + else if ((mapthings[i].options & (MTF_OBJECTSPECIAL|MTF_EXTRA)) == MTF_OBJECTSPECIAL) + mapthings[i].args[3] = TMDA_TOP; + else if ((mapthings[i].options & (MTF_OBJECTSPECIAL|MTF_EXTRA)) == MTF_EXTRA) + mapthings[i].args[3] = TMDA_MIDDLE; + else + mapthings[i].args[3] = TMDA_BOTTOMOFFSET; + mapthings[i].args[4] = !!(mapthings[i].options & MTF_AMBUSH); + break; + case 1704: //NiGHTS bumper + mapthings[i].pitch = 30 * (((mapthings[i].options & 15) + 9) % 12); + mapthings[i].options &= ~0xF; + break; + case 1705: //Hoop + case 1713: //Hoop (Customizable) + { + UINT16 oldangle = mapthings[i].angle; + mapthings[i].angle = ((oldangle >> 8)*360)/256; + mapthings[i].pitch = ((oldangle & 255)*360)/256; + mapthings[i].args[0] = (mapthings[i].type == 1705) ? 96 : (mapthings[i].options & 0xF)*16 + 32; + mapthings[i].options &= ~0xF; + mapthings[i].type = 1713; + break; + } + case 1710: //Ideya capture + mapthings[i].args[0] = mapthings[i].extrainfo; + mapthings[i].args[1] = mapthings[i].angle; + break; + case 1714: //Ideya anchor point + mapthings[i].args[0] = mapthings[i].extrainfo; + break; + case 1806: //King Bowser + mapthings[i].args[0] = LE_KOOPA; + break; + case 1807: //Axe + mapthings[i].args[0] = LE_AXE; + break; + case 2000: //Smashing spikeball + mapthings[i].args[0] = mapthings[i].angle; + break; + case 2006: //Jack-o'-lantern 1 + case 2007: //Jack-o'-lantern 2 + case 2008: //Jack-o'-lantern 3 + mapthings[i].args[0] = !!(mapthings[i].options & MTF_EXTRA); break; default: break; @@ -3435,6 +6554,52 @@ static void P_ConvertBinaryMap(void) } } +static void P_ConvertBinaryLinedefFlags(void) +{ + size_t i; + + for (i = 0; i < numlines; i++) + { + if (!!(lines[i].flags & ML_DONTPEGBOTTOM) ^ !!(lines[i].flags & ML_MIDPEG)) + lines[i].flags |= ML_MIDPEG; + else + lines[i].flags &= ~ML_MIDPEG; + + if (lines[i].special >= 100 && lines[i].special < 300) + { + if (lines[i].flags & ML_DONTPEGTOP) + lines[i].flags |= ML_SKEWTD; + else + lines[i].flags &= ~ML_SKEWTD; + + if ((lines[i].flags & ML_TFERLINE) && lines[i].frontsector) + { + size_t j; + + for (j = 0; j < lines[i].frontsector->linecount; j++) + { + if (lines[i].frontsector->lines[j]->flags & ML_DONTPEGTOP) + lines[i].frontsector->lines[j]->flags |= ML_SKEWTD; + else + lines[i].frontsector->lines[j]->flags &= ~ML_SKEWTD; + } + } + } + + } +} + +//For maps in binary format, converts setup of specials to UDMF format. +static void P_ConvertBinaryMap(void) +{ + P_ConvertBinaryLinedefTypes(); + P_ConvertBinarySectorTypes(); + P_ConvertBinaryThingTypes(); + P_ConvertBinaryLinedefFlags(); + if (M_CheckParm("-writetextmap")) + P_WriteTextmap(); +} + /** Compute MD5 message digest for bytes read from memory source * * The resulting message digest number will be written into the 16 bytes diff --git a/src/p_setup.h b/src/p_setup.h index d0c47a521..36d19f66d 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -107,7 +107,7 @@ boolean P_AddFolder(const char *folderpath); boolean P_RunSOC(const char *socfilename); void P_LoadSoundsRange(UINT16 wadnum, UINT16 first, UINT16 num); void P_LoadMusicsRange(UINT16 wadnum, UINT16 first, UINT16 num); -void P_WriteThings(void); +//void P_WriteThings(void); size_t P_PrecacheLevelFlats(void); void P_AllocMapHeader(INT16 i); diff --git a/src/p_slopes.c b/src/p_slopes.c index ffbfef2d3..7fa51452e 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -121,7 +121,7 @@ static void ReconfigureViaConstants (pslope_t *slope, const fixed_t a, const fix } /// Recalculate dynamic slopes. -void T_DynamicSlopeLine (dynplanethink_t* th) +void T_DynamicSlopeLine (dynlineplanethink_t* th) { pslope_t* slope = th->slope; line_t* srcline = th->sourceline; @@ -161,47 +161,56 @@ void T_DynamicSlopeLine (dynplanethink_t* th) } /// Mapthing-defined -void T_DynamicSlopeVert (dynplanethink_t* th) +void T_DynamicSlopeVert (dynvertexplanethink_t* th) { - pslope_t* slope = th->slope; - size_t i; - INT32 l; - for (i = 0; i < 3; i++) { - l = Tag_FindLineSpecial(799, th->tags[i]); - if (l != -1) { - th->vex[i].z = lines[l].frontsector->floorheight; - } + for (i = 0; i < 3; i++) + { + if (th->relative & (1 << i)) + th->vex[i].z = th->origvecheights[i] + (th->secs[i]->floorheight - th->origsecheights[i]); else - th->vex[i].z = 0; + th->vex[i].z = th->secs[i]->floorheight; } - ReconfigureViaVertexes(slope, th->vex[0], th->vex[1], th->vex[2]); + ReconfigureViaVertexes(th->slope, th->vex[0], th->vex[1], th->vex[2]); } -static inline void P_AddDynSlopeThinker (pslope_t* slope, dynplanetype_t type, line_t* sourceline, fixed_t extent, const INT16 tags[3], const vector3_t vx[3]) +static inline void P_AddDynLineSlopeThinker (pslope_t* slope, dynplanetype_t type, line_t* sourceline, fixed_t extent) { - dynplanethink_t* th = Z_Calloc(sizeof (*th), PU_LEVSPEC, NULL); - switch (type) - { - case DP_VERTEX: - th->thinker.function.acp1 = (actionf_p1)T_DynamicSlopeVert; - memcpy(th->tags, tags, sizeof(th->tags)); - memcpy(th->vex, vx, sizeof(th->vex)); - break; - default: - th->thinker.function.acp1 = (actionf_p1)T_DynamicSlopeLine; - th->sourceline = sourceline; - th->extent = extent; - } - + dynlineplanethink_t* th = Z_Calloc(sizeof (*th), PU_LEVSPEC, NULL); + th->thinker.function.acp1 = (actionf_p1)T_DynamicSlopeLine; th->slope = slope; th->type = type; - + th->sourceline = sourceline; + th->extent = extent; P_AddThinker(THINK_DYNSLOPE, &th->thinker); } +static inline void P_AddDynVertexSlopeThinker (pslope_t* slope, const INT16 tags[3], const vector3_t vx[3]) +{ + dynvertexplanethink_t* th = Z_Calloc(sizeof (*th), PU_LEVSPEC, NULL); + size_t i; + INT32 l; + th->thinker.function.acp1 = (actionf_p1)T_DynamicSlopeVert; + th->slope = slope; + + for (i = 0; i < 3; i++) { + l = Tag_FindLineSpecial(799, tags[i]); + if (l == -1) + { + Z_Free(th); + return; + } + th->secs[i] = lines[l].frontsector; + th->vex[i] = vx[i]; + th->origsecheights[i] = lines[l].frontsector->floorheight; + th->origvecheights[i] = vx[i].z; + if (lines[l].args[0]) + th->relative |= 1<thinker); +} /// Create a new slope and add it to the slope list. static inline pslope_t* Slope_Add (const UINT8 flags) @@ -268,6 +277,27 @@ static fixed_t GetExtent(sector_t *sector, line_t *line) return fardist; } +static boolean P_CopySlope(pslope_t** toslope, pslope_t* fromslope) +{ + if (*toslope || !fromslope) + return true; + + *toslope = fromslope; + return true; +} + +static void P_UpdateHasSlope(sector_t *sec) +{ + size_t i; + + sec->hasslope = true; + + // if this is an FOF control sector, make sure any target sectors also are marked as having slopes + if (sec->numattached) + for (i = 0; i < sec->numattached; i++) + sectors[sec->attached[i]].hasslope = true; +} + /// Creates one or more slopes based on the given line type and front/back sectors. static void line_SpawnViaLine(const int linenum, const boolean spawnthinker) { @@ -358,7 +388,7 @@ static void line_SpawnViaLine(const int linenum, const boolean spawnthinker) P_CalculateSlopeNormal(fslope); if (spawnthinker && (flags & SL_DYNAMIC)) - P_AddDynSlopeThinker(fslope, DP_FRONTFLOOR, line, extent, NULL, NULL); + P_AddDynLineSlopeThinker(fslope, DP_FRONTFLOOR, line, extent); } if(frontceil) { @@ -375,7 +405,7 @@ static void line_SpawnViaLine(const int linenum, const boolean spawnthinker) P_CalculateSlopeNormal(cslope); if (spawnthinker && (flags & SL_DYNAMIC)) - P_AddDynSlopeThinker(cslope, DP_FRONTCEIL, line, extent, NULL, NULL); + P_AddDynLineSlopeThinker(cslope, DP_FRONTCEIL, line, extent); } } if(backfloor || backceil) @@ -415,7 +445,7 @@ static void line_SpawnViaLine(const int linenum, const boolean spawnthinker) P_CalculateSlopeNormal(fslope); if (spawnthinker && (flags & SL_DYNAMIC)) - P_AddDynSlopeThinker(fslope, DP_BACKFLOOR, line, extent, NULL, NULL); + P_AddDynLineSlopeThinker(fslope, DP_BACKFLOOR, line, extent); } if(backceil) { @@ -432,9 +462,26 @@ static void line_SpawnViaLine(const int linenum, const boolean spawnthinker) P_CalculateSlopeNormal(cslope); if (spawnthinker && (flags & SL_DYNAMIC)) - P_AddDynSlopeThinker(cslope, DP_BACKCEIL, line, extent, NULL, NULL); + P_AddDynLineSlopeThinker(cslope, DP_BACKCEIL, line, extent); } } + + if (line->args[2] & TMSL_COPY) + { + if (frontfloor) + P_CopySlope(&line->backsector->f_slope, line->frontsector->f_slope); + if (backfloor) + P_CopySlope(&line->frontsector->f_slope, line->backsector->f_slope); + if (frontceil) + P_CopySlope(&line->backsector->c_slope, line->frontsector->c_slope); + if (backceil) + P_CopySlope(&line->frontsector->c_slope, line->backsector->c_slope); + + if (backfloor || backceil) + P_UpdateHasSlope(line->frontsector); + if (frontfloor || frontceil) + P_UpdateHasSlope(line->backsector); + } } /// Creates a new slope from three mapthings with the specified IDs @@ -469,14 +516,14 @@ static pslope_t *MakeViaMapthings(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag vx[i].x = mt->x << FRACBITS; vx[i].y = mt->y << FRACBITS; vx[i].z = mt->z << FRACBITS; - if (!mt->extrainfo) + if (!mt->args[0]) vx[i].z += R_PointInSubsector(vx[i].x, vx[i].y)->sector->floorheight; } ReconfigureViaVertexes(ret, vx[0], vx[1], vx[2]); if (spawnthinker && (flags & SL_DYNAMIC)) - P_AddDynSlopeThinker(ret, DP_VERTEX, NULL, 0, tags, vx); + P_AddDynVertexSlopeThinker(ret, tags, vx); return ret; } @@ -591,27 +638,6 @@ static boolean P_SetSlopeFromTag(sector_t *sec, INT32 tag, boolean ceiling) return false; } -static boolean P_CopySlope(pslope_t **toslope, pslope_t *fromslope) -{ - if (*toslope || !fromslope) - return true; - - *toslope = fromslope; - return true; -} - -static void P_UpdateHasSlope(sector_t *sec) -{ - size_t i; - - sec->hasslope = true; - - // if this is an FOF control sector, make sure any target sectors also are marked as having slopes - if (sec->numattached) - for (i = 0; i < sec->numattached; i++) - sectors[sec->attached[i]].hasslope = true; -} - // // P_CopySectorSlope // @@ -701,9 +727,6 @@ void P_SpawnSlopes(const boolean fromsave) { for (i = 0; i < numlines; i++) switch (lines[i].special) { - case 700: - if (lines[i].flags & ML_TFERLINE) P_CopySectorSlope(&lines[i]); - break; case 720: P_CopySectorSlope(&lines[i]); default: diff --git a/src/p_slopes.h b/src/p_slopes.h index d1a053d28..f4b0535e7 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -44,7 +44,8 @@ typedef enum typedef enum { TMSL_NOPHYSICS = 1, - TMSL_DYNAMIC = 2, + TMSL_DYNAMIC = 1<<1, + TMSL_COPY = 1<<2, } textmapslopeflags_t; void P_LinkSlopeThinkers (void); @@ -95,26 +96,29 @@ typedef enum { DP_FRONTCEIL, DP_BACKFLOOR, DP_BACKCEIL, - DP_VERTEX } dynplanetype_t; /// Permit slopes to be dynamically altered through a thinker. typedef struct { thinker_t thinker; - - pslope_t* slope; + pslope_t *slope; dynplanetype_t type; - - // Used by line slopes. - line_t* sourceline; + line_t *sourceline; fixed_t extent; +} dynlineplanethink_t; - // Used by mapthing vertex slopes. - INT16 tags[3]; +typedef struct +{ + thinker_t thinker; + pslope_t *slope; + sector_t *secs[3]; vector3_t vex[3]; -} dynplanethink_t; + fixed_t origsecheights[3]; + fixed_t origvecheights[3]; + UINT8 relative; +} dynvertexplanethink_t; -void T_DynamicSlopeLine (dynplanethink_t* th); -void T_DynamicSlopeVert (dynplanethink_t* th); +void T_DynamicSlopeLine (dynlineplanethink_t* th); +void T_DynamicSlopeVert (dynvertexplanethink_t* th); #endif // #ifndef P_SLOPES_H__ diff --git a/src/p_spec.c b/src/p_spec.c index 3fe77d7a2..78878de1d 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -15,6 +15,7 @@ /// utility functions, etc. /// Line Tag handling. Line and Sector triggers. +#include "dehacked.h" #include "doomdef.h" #include "g_game.h" #include "p_local.h" @@ -50,9 +51,6 @@ mobj_t *skyboxmo[2]; // current skybox mobjs: 0 = viewpoint, 1 = centerpoint mobj_t *skyboxviewpnts[16]; // array of MT_SKYBOX viewpoint mobjs mobj_t *skyboxcenterpnts[16]; // array of MT_SKYBOX centerpoint mobjs -// Amount (dx, dy) vector linedef is shifted right to get scroll amount -#define SCROLL_SHIFT 5 - /** Animated texture descriptor * This keeps track of an animated texture or an animated flat. * \sa P_UpdateSpecials, P_InitPicAnims, animdef_t @@ -100,7 +98,7 @@ typedef struct static void P_SpawnScrollers(void); static void P_SpawnFriction(void); static void P_SpawnPushers(void); -static void Add_Pusher(pushertype_e type, fixed_t x_mag, fixed_t y_mag, mobj_t *source, INT32 affectee, INT32 referrer, INT32 exclusive, INT32 slider); //SoM: 3/9/2000 +static void Add_Pusher(pushertype_e type, fixed_t x_mag, fixed_t y_mag, fixed_t z_mag, INT32 affectee, INT32 referrer, INT32 exclusive, INT32 slider); //SoM: 3/9/2000 static void Add_MasterDisappearer(tic_t appeartime, tic_t disappeartime, tic_t offset, INT32 line, INT32 sourceline); static void P_ResetFakeFloorFader(ffloor_t *rover, fade_t *data, boolean finalize); #define P_RemoveFakeFloorFader(l) P_ResetFakeFloorFader(l, NULL, false); @@ -117,7 +115,7 @@ static void Add_ColormapFader(sector_t *sector, extracolormap_t *source_exc, ext static void P_AddBlockThinker(sector_t *sec, line_t *sourceline); static void P_AddFloatThinker(sector_t *sec, UINT16 tag, line_t *sourceline); //static void P_AddBridgeThinker(line_t *sourceline, sector_t *sec); -static void P_AddFakeFloorsByLine(size_t line, ffloortype_e ffloorflags, thinkerlist_t *secthinkers); +static void P_AddFakeFloorsByLine(size_t line, INT32 alpha, UINT8 blendmode, ffloortype_e ffloorflags, thinkerlist_t *secthinkers); static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec); static void Add_Friction(INT32 friction, INT32 movefactor, INT32 affectee, INT32 referrer); static void P_AddPlaneDisplaceThinker(INT32 type, fixed_t speed, INT32 control, INT32 affectee, UINT8 reverse); @@ -993,30 +991,22 @@ static boolean PolyDoor(line_t *line) { polydoordata_t pdd; - pdd.polyObjNum = Tag_FGet(&line->tags); // polyobject id + pdd.polyObjNum = line->args[0]; // polyobject id switch(line->special) { case 480: // Polyobj_DoorSlide pdd.doorType = POLY_DOOR_SLIDE; - pdd.speed = sides[line->sidenum[0]].textureoffset / 8; + pdd.speed = line->args[1] << (FRACBITS - 3); pdd.angle = R_PointToAngle2(line->v1->x, line->v1->y, line->v2->x, line->v2->y); // angle of motion - pdd.distance = sides[line->sidenum[0]].rowoffset; - - if (line->sidenum[1] != 0xffff) - pdd.delay = sides[line->sidenum[1]].textureoffset >> FRACBITS; // delay in tics - else - pdd.delay = 0; + pdd.distance = line->args[2] << FRACBITS; + pdd.delay = line->args[3]; // delay in tics break; case 481: // Polyobj_DoorSwing pdd.doorType = POLY_DOOR_SWING; - pdd.speed = sides[line->sidenum[0]].textureoffset >> FRACBITS; // angular speed - pdd.distance = sides[line->sidenum[0]].rowoffset >> FRACBITS; // angular distance - - if (line->sidenum[1] != 0xffff) - pdd.delay = sides[line->sidenum[1]].textureoffset >> FRACBITS; // delay in tics - else - pdd.delay = 0; + pdd.speed = line->args[1]; // angular speed + pdd.distance = line->args[2]; // angular distance + pdd.delay = line->args[3]; // delay in tics break; default: return 0; // ??? @@ -1025,31 +1015,29 @@ static boolean PolyDoor(line_t *line) return EV_DoPolyDoor(&pdd); } -// Parses arguments for parameterized polyobject move specials +// Parses arguments for parameterized polyobject move special static boolean PolyMove(line_t *line) { polymovedata_t pmd; - pmd.polyObjNum = Tag_FGet(&line->tags); - pmd.speed = sides[line->sidenum[0]].textureoffset / 8; + pmd.polyObjNum = line->args[0]; + pmd.speed = line->args[1] << (FRACBITS - 3); pmd.angle = R_PointToAngle2(line->v1->x, line->v1->y, line->v2->x, line->v2->y); - pmd.distance = sides[line->sidenum[0]].rowoffset; + pmd.distance = line->args[2] << FRACBITS; - pmd.overRide = (line->special == 483); // Polyobj_OR_Move + pmd.overRide = !!line->args[3]; // Polyobj_OR_Move return EV_DoPolyObjMove(&pmd); } -// Makes a polyobject invisible and intangible -// If NOCLIMB is ticked, the polyobject will still be tangible, just not visible. -static void PolyInvisible(line_t *line) +static void PolySetVisibilityTangibility(line_t *line) { - INT32 polyObjNum = Tag_FGet(&line->tags); - polyobj_t *po; + INT32 polyObjNum = line->args[0]; + polyobj_t* po; if (!(po = Polyobj_GetForNum(polyObjNum))) { - CONS_Debug(DBG_POLYOBJ, "PolyInvisible: bad polyobj %d\n", polyObjNum); + CONS_Debug(DBG_POLYOBJ, "PolySetVisibilityTangibility: bad polyobj %d\n", polyObjNum); return; } @@ -1057,49 +1045,32 @@ static void PolyInvisible(line_t *line) if (po->isBad) return; - if (!(line->flags & ML_NOCLIMB)) - po->flags &= ~POF_SOLID; - - po->flags |= POF_NOSPECIALS; - po->flags &= ~POF_RENDERALL; -} - -// Makes a polyobject visible and tangible -// If NOCLIMB is ticked, the polyobject will not be tangible, just visible. -static void PolyVisible(line_t *line) -{ - INT32 polyObjNum = Tag_FGet(&line->tags); - polyobj_t *po; - - if (!(po = Polyobj_GetForNum(polyObjNum))) + if (line->args[1] == TMPV_VISIBLE) { - CONS_Debug(DBG_POLYOBJ, "PolyVisible: bad polyobj %d\n", polyObjNum); - return; + po->flags &= ~POF_NOSPECIALS; + po->flags |= (po->spawnflags & POF_RENDERALL); + } + else if (line->args[1] == TMPV_INVISIBLE) + { + po->flags |= POF_NOSPECIALS; + po->flags &= ~POF_RENDERALL; } - // don't allow line actions to affect bad polyobjects - if (po->isBad) - return; - - if (!(line->flags & ML_NOCLIMB)) + if (line->args[2] == TMPT_TANGIBLE) po->flags |= POF_SOLID; - - po->flags &= ~POF_NOSPECIALS; - po->flags |= (po->spawnflags & POF_RENDERALL); + else if (line->args[2] == TMPT_INTANGIBLE) + po->flags &= ~POF_SOLID; } - // Sets the translucency of a polyobject -// Frontsector floor / 100 = translevel static void PolyTranslucency(line_t *line) { - INT32 polyObjNum = Tag_FGet(&line->tags); + INT32 polyObjNum = line->args[0]; polyobj_t *po; - INT32 value; if (!(po = Polyobj_GetForNum(polyObjNum))) { - CONS_Debug(DBG_POLYOBJ, "EV_DoPolyObjWaypoint: bad polyobj %d\n", polyObjNum); + CONS_Debug(DBG_POLYOBJ, "PolyTranslucency: bad polyobj %d\n", polyObjNum); return; } @@ -1107,17 +1078,10 @@ static void PolyTranslucency(line_t *line) if (po->isBad) return; - // If Front X Offset is specified, use that. Else, use floorheight. - value = (sides[line->sidenum[0]].textureoffset ? sides[line->sidenum[0]].textureoffset : line->frontsector->floorheight) >> FRACBITS; - - // If DONTPEGBOTTOM, specify raw translucency value. Else, take it out of 1000. - if (!(line->flags & ML_DONTPEGBOTTOM)) - value /= 100; - - if (line->flags & ML_EFFECT3) // relative calc - po->translucency += value; + if (lines->args[2]) // relative calc + po->translucency += line->args[1]; else - po->translucency = value; + po->translucency = line->args[1]; po->translucency = max(min(po->translucency, NUMTRANSMAPS), 0); } @@ -1125,10 +1089,9 @@ static void PolyTranslucency(line_t *line) // Makes a polyobject translucency fade and applies tangibility static boolean PolyFade(line_t *line) { - INT32 polyObjNum = Tag_FGet(&line->tags); + INT32 polyObjNum = line->args[0]; polyobj_t *po; polyfadedata_t pfd; - INT32 value; if (!(po = Polyobj_GetForNum(polyObjNum))) { @@ -1141,7 +1104,7 @@ static boolean PolyFade(line_t *line) return 0; // Prevent continuous execs from interfering on an existing fade - if (!(line->flags & ML_EFFECT5) + if (!(line->args[3] & TMPF_OVERRIDE) && po->thinker && po->thinker->function.acp1 == (actionf_p1)T_PolyObjFade) { @@ -1151,17 +1114,10 @@ static boolean PolyFade(line_t *line) pfd.polyObjNum = polyObjNum; - // If Front X Offset is specified, use that. Else, use floorheight. - value = (sides[line->sidenum[0]].textureoffset ? sides[line->sidenum[0]].textureoffset : line->frontsector->floorheight) >> FRACBITS; - - // If DONTPEGBOTTOM, specify raw translucency value. Else, take it out of 1000. - if (!(line->flags & ML_DONTPEGBOTTOM)) - value /= 100; - - if (line->flags & ML_EFFECT3) // relative calc - pfd.destvalue = po->translucency + value; + if (line->args[3] & TMPF_RELATIVE) // relative calc + pfd.destvalue = po->translucency + line->args[1]; else - pfd.destvalue = value; + pfd.destvalue = line->args[1]; pfd.destvalue = max(min(pfd.destvalue, NUMTRANSMAPS), 0); @@ -1169,15 +1125,11 @@ static boolean PolyFade(line_t *line) if (po->translucency == pfd.destvalue) return 1; - pfd.docollision = !(line->flags & ML_BOUNCY); // do not handle collision flags - pfd.doghostfade = (line->flags & ML_EFFECT1); // do ghost fade (no collision flags during fade) - pfd.ticbased = (line->flags & ML_EFFECT4); // Speed = Tic Duration - - // allow Back Y Offset to be consistent with other fade specials - pfd.speed = (line->sidenum[1] != 0xFFFF && !sides[line->sidenum[0]].rowoffset) ? - abs(sides[line->sidenum[1]].rowoffset>>FRACBITS) - : abs(sides[line->sidenum[0]].rowoffset>>FRACBITS); + pfd.docollision = !(line->args[3] & TMPF_IGNORECOLLISION); // do not handle collision flags + pfd.doghostfade = (line->args[3] & TMPF_GHOSTFADE); // do ghost fade (no collision flags during fade) + pfd.ticbased = (line->args[3] & TMPF_TICBASED); // Speed = Tic Duration + pfd.speed = line->args[2]; return EV_DoPolyObjFade(&pfd); } @@ -1187,49 +1139,25 @@ static boolean PolyWaypoint(line_t *line) { polywaypointdata_t pwd; - pwd.polyObjNum = Tag_FGet(&line->tags); - pwd.speed = sides[line->sidenum[0]].textureoffset / 8; - pwd.sequence = sides[line->sidenum[0]].rowoffset >> FRACBITS; // Sequence # - - // Behavior after reaching the last waypoint? - if (line->flags & ML_EFFECT3) - pwd.returnbehavior = PWR_WRAP; // Wrap back to first waypoint - else if (line->flags & ML_EFFECT2) - pwd.returnbehavior = PWR_COMEBACK; // Go through sequence in reverse - else - pwd.returnbehavior = PWR_STOP; // Stop - - // Flags - pwd.flags = 0; - if (line->flags & ML_EFFECT1) - pwd.flags |= PWF_REVERSE; - if (line->flags & ML_EFFECT4) - pwd.flags |= PWF_LOOP; + pwd.polyObjNum = line->args[0]; + pwd.speed = line->args[1] << (FRACBITS - 3); + pwd.sequence = line->args[2]; + pwd.returnbehavior = line->args[3]; + pwd.flags = line->args[4]; return EV_DoPolyObjWaypoint(&pwd); } -// Parses arguments for parameterized polyobject rotate specials +// Parses arguments for parameterized polyobject rotate special static boolean PolyRotate(line_t *line) { polyrotdata_t prd; - prd.polyObjNum = Tag_FGet(&line->tags); - prd.speed = sides[line->sidenum[0]].textureoffset >> FRACBITS; // angular speed - prd.distance = sides[line->sidenum[0]].rowoffset >> FRACBITS; // angular distance - - // Polyobj_(OR_)RotateRight have dir == -1 - prd.direction = (line->special == 484 || line->special == 485) ? -1 : 1; - - // Polyobj_OR types have override set to true - prd.overRide = (line->special == 485 || line->special == 487); - - if (line->flags & ML_NOCLIMB) - prd.turnobjs = 0; - else if (line->flags & ML_EFFECT4) - prd.turnobjs = 2; - else - prd.turnobjs = 1; + prd.polyObjNum = line->args[0]; + prd.speed = line->args[1]; // angular speed + prd.distance = abs(line->args[2]); // angular distance + prd.direction = (line->args[2] < 0) ? -1 : 1; + prd.flags = line->args[3]; return EV_DoPolyObjRotate(&prd); } @@ -1239,10 +1167,10 @@ static boolean PolyFlag(line_t *line) { polyflagdata_t pfd; - pfd.polyObjNum = Tag_FGet(&line->tags); - pfd.speed = P_AproxDistance(line->dx, line->dy) >> FRACBITS; + pfd.polyObjNum = line->args[0]; + pfd.speed = line->args[1]; pfd.angle = line->angle >> ANGLETOFINESHIFT; - pfd.momx = sides[line->sidenum[0]].textureoffset >> FRACBITS; + pfd.momx = line->args[2]; return EV_DoPolyObjFlag(&pfd); } @@ -1251,12 +1179,14 @@ static boolean PolyFlag(line_t *line) static boolean PolyDisplace(line_t *line) { polydisplacedata_t pdd; + fixed_t length = R_PointToDist2(line->v2->x, line->v2->y, line->v1->x, line->v1->y); + fixed_t speed = line->args[1] << FRACBITS; - pdd.polyObjNum = Tag_FGet(&line->tags); + pdd.polyObjNum = line->args[0]; pdd.controlSector = line->frontsector; - pdd.dx = line->dx>>8; - pdd.dy = line->dy>>8; + pdd.dx = FixedMul(FixedDiv(line->dx, length), speed) >> 8; + pdd.dy = FixedMul(FixedDiv(line->dy, length), speed) >> 8; return EV_DoPolyObjDisplace(&pdd); } @@ -1268,22 +1198,16 @@ static boolean PolyRotDisplace(line_t *line) polyrotdisplacedata_t pdd; fixed_t anginter, distinter; - pdd.polyObjNum = Tag_FGet(&line->tags); + pdd.polyObjNum = line->args[0]; pdd.controlSector = line->frontsector; // Rotate 'anginter' interval for each 'distinter' interval from the control sector. - // Use default values if not provided as fallback. - anginter = sides[line->sidenum[0]].rowoffset ? sides[line->sidenum[0]].rowoffset : 90*FRACUNIT; - distinter = sides[line->sidenum[0]].textureoffset ? sides[line->sidenum[0]].textureoffset : 128*FRACUNIT; + anginter = line->args[2] << FRACBITS; + distinter = line->args[1] << FRACBITS; pdd.rotscale = FixedDiv(anginter, distinter); // Same behavior as other rotators when carrying things. - if (line->flags & ML_NOCLIMB) - pdd.turnobjs = 0; - else if (line->flags & ML_EFFECT4) - pdd.turnobjs = 2; - else - pdd.turnobjs = 1; + pdd.turnobjs = line->args[3]; return EV_DoPolyObjRotDisplace(&pdd); } @@ -1298,7 +1222,7 @@ void P_RunNightserizeExecutors(mobj_t *actor) for (i = 0; i < numlines; i++) { - if (lines[i].special == 323 || lines[i].special == 324) + if (lines[i].special == 323) P_RunTriggerLinedef(&lines[i], actor, NULL); } } @@ -1312,7 +1236,7 @@ void P_RunDeNightserizeExecutors(mobj_t *actor) for (i = 0; i < numlines; i++) { - if (lines[i].special == 325 || lines[i].special == 326) + if (lines[i].special == 325) P_RunTriggerLinedef(&lines[i], actor, NULL); } } @@ -1326,7 +1250,7 @@ void P_RunNightsLapExecutors(mobj_t *actor) for (i = 0; i < numlines; i++) { - if (lines[i].special == 327 || lines[i].special == 328) + if (lines[i].special == 327) P_RunTriggerLinedef(&lines[i], actor, NULL); } } @@ -1340,13 +1264,19 @@ void P_RunNightsCapsuleTouchExecutors(mobj_t *actor, boolean entering, boolean e for (i = 0; i < numlines; i++) { - if ((lines[i].special == 329 || lines[i].special == 330) - && ((entering && (lines[i].flags & ML_TFERLINE)) - || (!entering && !(lines[i].flags & ML_TFERLINE))) - && ((lines[i].flags & ML_DONTPEGTOP) - || (enoughspheres && !(lines[i].flags & ML_BOUNCY)) - || (!enoughspheres && (lines[i].flags & ML_BOUNCY)))) - P_RunTriggerLinedef(&lines[i], actor, NULL); + if (lines[i].special != 329) + continue; + + if (!!(lines[i].args[7] & TMI_ENTER) != entering) + continue; + + if (lines[i].args[6] == TMS_IFENOUGH && !enoughspheres) + continue; + + if (lines[i].args[6] == TMS_IFNOTENOUGH && enoughspheres) + continue; + + P_RunTriggerLinedef(&lines[i], actor, NULL); } } @@ -1426,27 +1356,42 @@ static boolean P_CheckNightsTriggerLine(line_t *triggerline, mobj_t *actor) INT16 specialtype = triggerline->special; size_t i; - UINT8 inputmare = max(0, min(255, sides[triggerline->sidenum[0]].textureoffset>>FRACBITS)); - UINT8 inputlap = max(0, min(255, sides[triggerline->sidenum[0]].rowoffset>>FRACBITS)); + UINT8 inputmare = max(0, min(255, triggerline->args[1])); + UINT8 inputlap = max(0, min(255, triggerline->args[2])); - boolean ltemare = triggerline->flags & ML_NOCLIMB; - boolean gtemare = triggerline->flags & ML_BLOCKMONSTERS; - boolean ltelap = triggerline->flags & ML_EFFECT1; - boolean gtelap = triggerline->flags & ML_EFFECT2; + textmapcomparison_t marecomp = triggerline->args[3]; + textmapcomparison_t lapcomp = triggerline->args[4]; + textmapnightsplayer_t checkplayer = triggerline->args[5]; - boolean lapfrombonustime = triggerline->flags & ML_EFFECT3; - boolean perglobalinverse = triggerline->flags & ML_DONTPEGBOTTOM; - boolean perglobal = !(triggerline->flags & ML_EFFECT4) && !perglobalinverse; + boolean lapfrombonustime; - boolean donomares = triggerline->flags & ML_BOUNCY; // nightserize: run at end of level (no mares) - boolean fromnonights = triggerline->flags & ML_TFERLINE; // nightserize: from non-nights // denightserize: all players no nights - boolean fromnights = triggerline->flags & ML_DONTPEGTOP; // nightserize: from nights // denightserize: >0 players are nights + boolean donomares = (specialtype == 323) && (triggerline->args[7] & TMN_LEVELCOMPLETION); // nightserize: run at end of level (no mares) UINT8 currentmare = UINT8_MAX; UINT8 currentlap = UINT8_MAX; + // Set lapfrombonustime + switch (specialtype) + { + case 323: + lapfrombonustime = !!(triggerline->args[7] & TMN_BONUSLAPS); + break; + case 325: + lapfrombonustime = !!(triggerline->args[7]); + break; + case 327: + lapfrombonustime = !!(triggerline->args[6]); + break; + case 329: + lapfrombonustime = !!(triggerline->args[7] & TMI_BONUSLAPS); + break; + default: + lapfrombonustime = false; + break; + } + // Do early returns for Nightserize - if (specialtype >= 323 && specialtype <= 324) + if (specialtype == 323) { // run only when no mares are found if (donomares && P_FindLowestMare() != UINT8_MAX) @@ -1457,7 +1402,7 @@ static boolean P_CheckNightsTriggerLine(line_t *triggerline, mobj_t *actor) return false; // run only if player is nightserizing from non-nights - if (fromnonights) + if (triggerline->args[6] == TMN_FROMNONIGHTS) { if (!actor->player) return false; @@ -1465,7 +1410,7 @@ static boolean P_CheckNightsTriggerLine(line_t *triggerline, mobj_t *actor) return false; } // run only if player is nightserizing from nights - else if (fromnights) + else if (triggerline->args[6] == TMN_FROMNIGHTS) { if (!actor->player) return false; @@ -1475,8 +1420,8 @@ static boolean P_CheckNightsTriggerLine(line_t *triggerline, mobj_t *actor) } // Get current mare and lap (and check early return for DeNightserize) - if (perglobal || perglobalinverse - || (specialtype >= 325 && specialtype <= 326 && (fromnonights || fromnights))) + if (checkplayer != TMNP_TRIGGERER + || (specialtype == 325 && triggerline->args[6] != TMD_ALWAYS)) { UINT8 playersarenights = 0; @@ -1487,19 +1432,19 @@ static boolean P_CheckNightsTriggerLine(line_t *triggerline, mobj_t *actor) continue; // denightserize: run only if all players are not nights - if (specialtype >= 325 && specialtype <= 326 && fromnonights + if (specialtype == 325 && triggerline->args[6] == TMD_NOBODYNIGHTS && players[i].powers[pw_carry] == CR_NIGHTSMODE) return false; // count number of nights players for denightserize return - if (specialtype >= 325 && specialtype <= 326 && fromnights + if (specialtype == 325 && triggerline->args[6] == TMD_SOMEBODYNIGHTS && players[i].powers[pw_carry] == CR_NIGHTSMODE) playersarenights++; lap = lapfrombonustime ? players[i].marebonuslap : players[i].marelap; // get highest mare/lap of players - if (perglobal) + if (checkplayer == TMNP_FASTEST) { if (players[i].mare > currentmare || currentmare == UINT8_MAX) { @@ -1511,7 +1456,7 @@ static boolean P_CheckNightsTriggerLine(line_t *triggerline, mobj_t *actor) currentlap = lap; } // get lowest mare/lap of players - else if (perglobalinverse) + else if (checkplayer == TMNP_SLOWEST) { if (players[i].mare < currentmare || currentmare == UINT8_MAX) { @@ -1525,12 +1470,12 @@ static boolean P_CheckNightsTriggerLine(line_t *triggerline, mobj_t *actor) } // denightserize: run only if >0 players are nights - if (specialtype >= 325 && specialtype <= 326 && fromnights + if (specialtype == 325 && triggerline->args[6] == TMD_SOMEBODYNIGHTS && playersarenights < 1) return false; } // get current mare/lap from triggering player - else if (!perglobal && !perglobalinverse) + else if (checkplayer == TMNP_TRIGGERER) { if (!actor->player) return false; @@ -1542,280 +1487,170 @@ static boolean P_CheckNightsTriggerLine(line_t *triggerline, mobj_t *actor) return false; // special case: player->marebonuslap is 0 until passing through on bonus time. Don't trigger lines looking for inputlap 0. // Compare current mare/lap to input mare/lap based on rules - if (!(specialtype >= 323 && specialtype <= 324 && donomares) // don't return false if donomares and we got this far - && ((ltemare && currentmare > inputmare) - || (gtemare && currentmare < inputmare) - || (!ltemare && !gtemare && currentmare != inputmare) - || (ltelap && currentlap > inputlap) - || (gtelap && currentlap < inputlap) - || (!ltelap && !gtelap && currentlap != inputlap)) + if (!donomares // don't return false if donomares and we got this far + && ((marecomp == TMC_LTE && currentmare > inputmare) + || (marecomp == TMC_GTE && currentmare < inputmare) + || (marecomp == TMC_EQUAL && currentmare != inputmare) + || (lapcomp == TMC_LTE && currentlap > inputlap) + || (lapcomp == TMC_GTE && currentlap < inputlap) + || (lapcomp == TMC_EQUAL && currentlap != inputlap)) ) return false; return true; } -/** Used by P_LinedefExecute to check a trigger linedef's conditions - * The linedef executor specials in the trigger linedef's sector are run if all conditions are met. - * Return false cancels P_LinedefExecute, this happens if a condition is not met. - * - * \param triggerline Trigger linedef to check conditions for; should NEVER be NULL. - * \param actor Object initiating the action; should not be NULL. - * \param caller Sector in which the action was started. May be NULL. - * \sa P_ProcessLineSpecial, P_LinedefExecute - */ -boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller) +static boolean P_CheckPlayerMareOld(line_t *triggerline) { - sector_t *ctlsector; - fixed_t dist = P_AproxDistance(triggerline->dx, triggerline->dy)>>FRACBITS; - size_t i, linecnt, sectori; - INT16 specialtype = triggerline->special; + UINT8 mare; + INT32 targetmare = P_AproxDistance(triggerline->dx, triggerline->dy) >> FRACBITS; - ///////////////////////////////////////////////// - // Distance-checking/sector trigger conditions // - ///////////////////////////////////////////////// + if (!(maptol & TOL_NIGHTS)) + return false; - // Linetypes 303 and 304 require a specific - // number, or minimum or maximum, of rings. - if (specialtype == 303 || specialtype == 304) + mare = P_FindLowestMare(); + + if (triggerline->flags & ML_NOCLIMB) + return mare <= targetmare; + + if (triggerline->flags & ML_BLOCKMONSTERS) + return mare >= targetmare; + + return mare == targetmare; +} + +static boolean P_CheckPlayerMare(line_t *triggerline) +{ + UINT8 mare; + INT32 targetmare = triggerline->args[1]; + + if (!(maptol & TOL_NIGHTS)) + return false; + + mare = P_FindLowestMare(); + + switch (triggerline->args[2]) { - fixed_t rings = 0; - - // With the passuse flag, count all player's - // rings. - if (triggerline->flags & ML_EFFECT4) - { - for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i] || players[i].spectator) - continue; - - if (!players[i].mo || ((maptol & TOL_NIGHTS) ? players[i].spheres : players[i].rings) <= 0) - continue; - - rings += (maptol & TOL_NIGHTS) ? players[i].spheres : players[i].rings; - } - } - else - { - if (!(actor && actor->player)) - return false; // no player to count rings from here, sorry - - rings = (maptol & TOL_NIGHTS) ? actor->player->spheres : actor->player->rings; - } - - if (triggerline->flags & ML_NOCLIMB) - { - if (rings > dist) - return false; - } - else if (triggerline->flags & ML_BLOCKMONSTERS) - { - if (rings < dist) - return false; - } - else - { - if (rings != dist) - return false; - } - } - else if (specialtype >= 314 && specialtype <= 315) - { - msecnode_t *node; - mobj_t *mo; - INT32 numpush = 0; - INT32 numneeded = dist; - - if (!caller) - return false; // we need a calling sector to find pushables in, silly! - - // Count the pushables in this sector - node = caller->touching_thinglist; // things touching this sector - while (node) - { - mo = node->m_thing; - if ((mo->flags & MF_PUSHABLE) || ((mo->info->flags & MF_PUSHABLE) && mo->fuse)) - numpush++; - node = node->m_thinglist_next; - } - - if (triggerline->flags & ML_NOCLIMB) // Need at least or more - { - if (numpush < numneeded) - return false; - } - else if (triggerline->flags & ML_EFFECT4) // Need less than - { - if (numpush >= numneeded) - return false; - } - else // Need exact - { - if (numpush != numneeded) - return false; - } - } - else if (caller) - { - if (GETSECSPECIAL(caller->special, 2) == 6) - { - if (!(ALL7EMERALDS(emeralds))) - return false; - } - else if (GETSECSPECIAL(caller->special, 2) == 7) - { - UINT8 mare; - - if (!(maptol & TOL_NIGHTS)) - return false; - - mare = P_FindLowestMare(); - - if (triggerline->flags & ML_NOCLIMB) - { - if (!(mare <= dist)) - return false; - } - else if (triggerline->flags & ML_BLOCKMONSTERS) - { - if (!(mare >= dist)) - return false; - } - else - { - if (!(mare == dist)) - return false; - } - } - // If we were not triggered by a sector type especially for the purpose, - // a Linedef Executor linedef trigger is not handling sector triggers properly, return. - - else if ((!GETSECSPECIAL(caller->special, 2) || GETSECSPECIAL(caller->special, 2) > 7) && (specialtype > 322)) - { - CONS_Alert(CONS_WARNING, - M_GetText("Linedef executor trigger isn't handling sector triggers properly!\nspecialtype = %d, if you are not a dev, report this warning instance\nalong with the wad that caused it!\n"), - specialtype); - return false; - } - } - - ////////////////////////////////////// - // Miscellaneous trigger conditions // - ////////////////////////////////////// - - switch (specialtype) - { - case 305: // continuous - case 306: // each time - case 307: // once - if (!(actor && actor->player && actor->player->charability == dist/10)) - return false; - break; - case 309: // continuous - case 310: // each time - // Only red team members can activate this. - if (!(actor && actor->player && actor->player->ctfteam == 1)) - return false; - break; - case 311: // continuous - case 312: // each time - // Only blue team members can activate this. - if (!(actor && actor->player && actor->player->ctfteam == 2)) - return false; - break; - case 317: // continuous - case 318: // once - { // Unlockable triggers required - INT32 trigid = (INT32)(sides[triggerline->sidenum[0]].textureoffset>>FRACBITS); - - if ((modifiedgame && !savemoddata) || (netgame || multiplayer)) - return false; - else if (trigid < 0 || trigid > 31) // limited by 32 bit variable - { - CONS_Debug(DBG_GAMELOGIC, "Unlockable trigger (sidedef %hu): bad trigger ID %d\n", triggerline->sidenum[0], trigid); - return false; - } - else if (!(unlocktriggers & (1 << trigid))) - return false; - } - break; - case 319: // continuous - case 320: // once - { // An unlockable itself must be unlocked! - INT32 unlockid = (INT32)(sides[triggerline->sidenum[0]].textureoffset>>FRACBITS); - - if ((modifiedgame && !savemoddata) || (netgame || multiplayer)) - return false; - else if (unlockid < 0 || unlockid >= MAXUNLOCKABLES) // limited by unlockable count - { - CONS_Debug(DBG_GAMELOGIC, "Unlockable check (sidedef %hu): bad unlockable ID %d\n", triggerline->sidenum[0], unlockid); - return false; - } - else if (!(unlockables[unlockid-1].unlocked)) - return false; - } - break; - case 321: // continuous - case 322: // each time - // decrement calls left before triggering - if (triggerline->callcount > 0) - { - if (--triggerline->callcount > 0) - return false; - } - break; - case 323: // nightserize - each time - case 324: // nightserize - once - case 325: // denightserize - each time - case 326: // denightserize - once - case 327: // nights lap - each time - case 328: // nights lap - once - case 329: // nights egg capsule touch - each time - case 330: // nights egg capsule touch - once - if (!P_CheckNightsTriggerLine(triggerline, actor)) - return false; - break; - case 331: // continuous - case 332: // each time - case 333: // once - if (!(actor && actor->player && ((stricmp(triggerline->text, skins[actor->player->skin].name) == 0) ^ ((triggerline->flags & ML_NOCLIMB) == ML_NOCLIMB)))) - return false; - break; - case 334: // object dye - continuous - case 335: // object dye - each time - case 336: // object dye - once - { - INT32 triggercolor = (INT32)sides[triggerline->sidenum[0]].toptexture; - UINT16 color = (actor->player ? actor->player->powers[pw_dye] : actor->color); - boolean invert = (triggerline->flags & ML_NOCLIMB ? true : false); - - if (invert ^ (triggercolor != color)) - return false; - } + case TMC_EQUAL: default: - break; + return mare == targetmare; + case TMC_GTE: + return mare >= targetmare; + case TMC_LTE: + return mare <= targetmare; + } +} + +static boolean P_CheckPlayerRings(line_t *triggerline, mobj_t *actor) +{ + INT32 rings = 0; + INT32 targetrings = triggerline->args[1]; + size_t i; + + // Count all players' rings. + if (triggerline->args[3]) + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i] || players[i].spectator) + continue; + + if (!players[i].mo || ((maptol & TOL_NIGHTS) ? players[i].spheres : players[i].rings) <= 0) + continue; + + rings += (maptol & TOL_NIGHTS) ? players[i].spheres : players[i].rings; + } + } + else + { + if (!(actor && actor->player)) + return false; // no player to count rings from here, sorry + + rings = (maptol & TOL_NIGHTS) ? actor->player->spheres : actor->player->rings; } - ///////////////////////////////// - // Processing linedef specials // - ///////////////////////////////// + switch (triggerline->args[2]) + { + case TMC_EQUAL: + default: + return rings == targetrings; + case TMC_GTE: + return rings >= targetrings; + case TMC_LTE: + return rings <= targetrings; + } +} - ctlsector = triggerline->frontsector; - sectori = (size_t)(ctlsector - sectors); - linecnt = ctlsector->linecount; +static boolean P_CheckPushables(line_t *triggerline, sector_t *caller) +{ + msecnode_t *node; + mobj_t *mo; + INT32 numpushables = 0; + INT32 targetpushables = triggerline->args[1]; - if (triggerline->flags & ML_EFFECT5) // disregard order for efficiency + if (!caller) + return false; // we need a calling sector to find pushables in, silly! + + // Count the pushables in this sector + for (node = caller->touching_thinglist; node; node = node->m_thinglist_next) + { + mo = node->m_thing; + if ((mo->flags & MF_PUSHABLE) || ((mo->info->flags & MF_PUSHABLE) && mo->fuse)) + numpushables++; + } + + switch (triggerline->args[2]) + { + case TMC_EQUAL: + default: + return numpushables == targetpushables; + case TMC_GTE: + return numpushables >= targetpushables; + case TMC_LTE: + return numpushables <= targetpushables; + } +} + +static boolean P_CheckEmeralds(INT32 checktype, UINT16 target) +{ + switch (checktype) + { + case TMF_HASALL: + default: + return (emeralds & target) == target; + case TMF_HASANY: + return !!(emeralds & target); + case TMF_HASEXACTLY: + return emeralds == target; + case TMF_DOESNTHAVEALL: + return (emeralds & target) != target; + case TMF_DOESNTHAVEANY: + return !(emeralds & target); + } +} + +static void P_ActivateLinedefExecutor(line_t *line, mobj_t *actor, sector_t *caller) +{ + if (line->special < 400 || line->special >= 500) + return; + + if (line->executordelay) + P_AddExecutorDelay(line, actor, caller); + else + P_ProcessLineSpecial(line, actor, caller); +} + +static boolean P_ActivateLinedefExecutorsInSector(line_t *triggerline, mobj_t *actor, sector_t *caller) +{ + sector_t *ctlsector = triggerline->frontsector; + size_t sectori = (size_t)(ctlsector - sectors); + size_t linecnt = ctlsector->linecount; + size_t i; + + if (!udmf && triggerline->flags & ML_WRAPMIDTEX) // disregard order for efficiency { for (i = 0; i < linecnt; i++) - if (ctlsector->lines[i]->special >= 400 - && ctlsector->lines[i]->special < 500) - { - if (ctlsector->lines[i]->executordelay) - P_AddExecutorDelay(ctlsector->lines[i], actor, caller); - else - P_ProcessLineSpecial(ctlsector->lines[i], actor, caller); - } + P_ActivateLinedefExecutor(ctlsector->lines[i], actor, caller); } else // walk around the sector in a defined order { @@ -1896,39 +1731,178 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller if (i == masterlineindex) break; - if (ctlsector->lines[i]->special >= 400 - && ctlsector->lines[i]->special < 500) - { - if (ctlsector->lines[i]->executordelay) - P_AddExecutorDelay(ctlsector->lines[i], actor, caller); - else - P_ProcessLineSpecial(ctlsector->lines[i], actor, caller); - } + P_ActivateLinedefExecutor(ctlsector->lines[i], actor, caller); } } - // "Trigger on X calls" linedefs reset if noclimb is set - if ((specialtype == 321 || specialtype == 322) && triggerline->flags & ML_NOCLIMB) - triggerline->callcount = sides[triggerline->sidenum[0]].textureoffset>>FRACBITS; + return true; +} + +/** Used by P_LinedefExecute to check a trigger linedef's conditions + * The linedef executor specials in the trigger linedef's sector are run if all conditions are met. + * Return false cancels P_LinedefExecute, this happens if a condition is not met. + * + * \param triggerline Trigger linedef to check conditions for; should NEVER be NULL. + * \param actor Object initiating the action; should not be NULL. + * \param caller Sector in which the action was started. May be NULL. + * \sa P_ProcessLineSpecial, P_LinedefExecute + */ +boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller) +{ + INT16 specialtype = triggerline->special; + + //////////////////////// + // Trigger conditions // + //////////////////////// + + if (caller && !udmf) + { + if (caller->triggerer == TO_PLAYEREMERALDS) + { + CONS_Alert(CONS_WARNING, M_GetText("Deprecated emerald check sector type detected. Please use linedef types 337-339 instead.\n")); + if (!(ALL7EMERALDS(emeralds))) + return false; + } + else if (caller->triggerer == TO_PLAYERNIGHTS) + { + CONS_Alert(CONS_WARNING, M_GetText("Deprecated NiGHTS mare sector type detected. Please use linedef types 340-342 instead.\n")); + if (!P_CheckPlayerMareOld(triggerline)) + return false; + } + } + + switch (specialtype) + { + case 303: + if (!P_CheckPlayerRings(triggerline, actor)) + return false; + break; + case 305: + if (!(actor && actor->player && actor->player->charability == triggerline->args[1])) + return false; + break; + case 309: + // Only red/blue team members can activate this. + if (!(actor && actor->player)) + return false; + if (actor->player->ctfteam != ((triggerline->args[1] == TMT_RED) ? 1 : 2)) + return false; + break; + case 314: + if (!P_CheckPushables(triggerline, caller)) + return false; + break; + case 317: + { // Unlockable triggers required + INT32 trigid = triggerline->args[1]; + + if ((modifiedgame && !savemoddata) || (netgame || multiplayer)) + return false; + else if (trigid < 0 || trigid > 31) // limited by 32 bit variable + { + CONS_Debug(DBG_GAMELOGIC, "Unlockable trigger (sidedef %hu): bad trigger ID %d\n", triggerline->sidenum[0], trigid); + return false; + } + else if (!(unlocktriggers & (1 << trigid))) + return false; + } + break; + case 319: + { // An unlockable itself must be unlocked! + INT32 unlockid = triggerline->args[1]; + + if ((modifiedgame && !savemoddata) || (netgame || multiplayer)) + return false; + else if (unlockid < 0 || unlockid >= MAXUNLOCKABLES) // limited by unlockable count + { + CONS_Debug(DBG_GAMELOGIC, "Unlockable check (sidedef %hu): bad unlockable ID %d\n", triggerline->sidenum[0], unlockid); + return false; + } + else if (!(unlockables[unlockid-1].unlocked)) + return false; + } + break; + case 321: + // decrement calls left before triggering + if (triggerline->callcount > 0) + { + if (--triggerline->callcount > 0) + return false; + } + break; + case 323: // nightserize + case 325: // denightserize + case 327: // nights lap + case 329: // nights egg capsule touch + if (!P_CheckNightsTriggerLine(triggerline, actor)) + return false; + break; + case 331: + if (!(actor && actor->player)) + return false; + if (!triggerline->stringargs[0]) + return false; + if (!(stricmp(triggerline->stringargs[0], skins[actor->player->skin].name) == 0) ^ !!(triggerline->args[1])) + return false; + break; + case 334: // object dye + { + INT32 triggercolor = triggerline->stringargs[0] ? get_number(triggerline->stringargs[0]) : SKINCOLOR_NONE; + UINT16 color = (actor->player ? actor->player->powers[pw_dye] : actor->color); + + if (!!(triggerline->args[1]) ^ (triggercolor != color)) + return false; + } + break; + case 337: // emerald check + if (!P_CheckEmeralds(triggerline->args[2], (UINT16)triggerline->args[1])) + return false; + break; + case 340: // NiGHTS mare + if (!P_CheckPlayerMare(triggerline)) + return false; + break; + default: + break; + } + + ///////////////////////////////// + // Processing linedef specials // + ///////////////////////////////// + + if (!P_ActivateLinedefExecutorsInSector(triggerline, actor, caller)) + return false; + + // "Trigger on X calls" linedefs reset if args[2] is set + if (specialtype == 321 && triggerline->args[2]) + triggerline->callcount = triggerline->args[3]; else - // These special types work only once - if (specialtype == 302 // Once - || specialtype == 304 // Ring count - Once - || specialtype == 307 // Character ability - Once - || specialtype == 308 // Race only - Once - || specialtype == 313 // No More Enemies - Once - || specialtype == 315 // No of pushables - Once - || specialtype == 318 // Unlockable trigger - Once - || specialtype == 320 // Unlockable - Once - || specialtype == 321 || specialtype == 322 // Trigger on X calls - Continuous + Each Time - || specialtype == 324 // Nightserize - Once - || specialtype == 326 // DeNightserize - Once - || specialtype == 328 // Nights lap - Once - || specialtype == 330 // Nights Bonus Time - Once - || specialtype == 333 // Skin - Once - || specialtype == 336 // Dye - Once - || specialtype == 399) // Level Load - triggerline->special = 0; // Clear it out + { + // These special types work only once + if (specialtype == 313 // No more enemies + || specialtype == 321 // Trigger on X calls + || specialtype == 399) // Level Load + triggerline->special = 0; + else if ((specialtype == 323 // Nightserize + || specialtype == 325 // DeNightserize + || specialtype == 327 // Nights lap + || specialtype == 329) // Nights bonus time + && triggerline->args[0]) + triggerline->special = 0; + else if ((specialtype == 300 // Basic + || specialtype == 303 // Ring count + || specialtype == 305 // Character ability + || specialtype == 308 // Gametype + || specialtype == 309 // CTF team + || specialtype == 314 // No of pushables + || specialtype == 317 // Unlockable trigger + || specialtype == 319 // Unlockable + || specialtype == 331 // Player skin + || specialtype == 334 // Object dye + || specialtype == 337) // Emerald check + && triggerline->args[0] == TMT_ONCE) + triggerline->special = 0; + } return true; } @@ -1948,39 +1922,144 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller */ void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller) { - size_t masterline; + INT32 masterline; CONS_Debug(DBG_GAMELOGIC, "P_LinedefExecute: Executing trigger linedefs of tag %d\n", tag); I_Assert(!actor || !P_MobjWasRemoved(actor)); // If actor is there, it must be valid. - for (masterline = 0; masterline < numlines; masterline++) + TAG_ITER_LINES(tag, masterline) { - if (Tag_FGet(&lines[masterline].tags) != tag) - continue; - - // "No More Enemies" and "Level Load" take care of themselves. - if (lines[masterline].special == 313 - || lines[masterline].special == 399 - // Each-time executors handle themselves, too - || lines[masterline].special == 301 // Each time - || lines[masterline].special == 306 // Character ability - Each time - || lines[masterline].special == 310 // CTF Red team - Each time - || lines[masterline].special == 312 // CTF Blue team - Each time - || lines[masterline].special == 322 // Trigger on X calls - Each Time - || lines[masterline].special == 332 // Skin - Each time - || lines[masterline].special == 335)// Dye - Each time - continue; - if (lines[masterline].special < 300 || lines[masterline].special > 399) continue; + // "No More Enemies" and "Level Load" take care of themselves. + if (lines[masterline].special == 313 || lines[masterline].special == 399) + continue; + + // Each-time executors handle themselves, too + if ((lines[masterline].special == 300 // Basic + || lines[masterline].special == 303 // Ring count + || lines[masterline].special == 305 // Character ability + || lines[masterline].special == 308 // Gametype + || lines[masterline].special == 309 // CTF team + || lines[masterline].special == 314 // Number of pushables + || lines[masterline].special == 317 // Condition set trigger + || lines[masterline].special == 319 // Unlockable trigger + || lines[masterline].special == 331 // Player skin + || lines[masterline].special == 334 // Object dye + || lines[masterline].special == 337) // Emerald check + && lines[masterline].args[0] > TMT_EACHTIMEMASK) + continue; + + if (lines[masterline].special == 321 && lines[masterline].args[0] > TMXT_EACHTIMEMASK) // Trigger after X calls + continue; + if (!P_RunTriggerLinedef(&lines[masterline], actor, caller)) return; // cancel P_LinedefExecute if function returns false } } +static void P_PlaySFX(INT32 sfxnum, mobj_t *mo, sector_t *callsec, INT16 tag, textmapsoundsource_t source, textmapsoundlistener_t listener) +{ + if (sfxnum == sfx_None) + return; // Do nothing! + + if (sfxnum < sfx_None || sfxnum >= NUMSFX) + { + CONS_Debug(DBG_GAMELOGIC, "Line type 414 Executor: sfx number %d is invalid!\n", sfxnum); + return; + } + + // Check if you can hear the sound + switch (listener) + { + case TMSL_TRIGGERER: // only play sound if displayplayer + if (!mo) + return; + + if (!mo->player) + return; + + if (mo->player != &players[displayplayer] && mo->player != &players[secondarydisplayplayer]) + return; + + break; + case TMSL_TAGGEDSECTOR: // only play if touching tagged sectors + { + UINT8 i = 0; + mobj_t *camobj = players[displayplayer].mo; + ffloor_t *rover; + boolean foundit = false; + + for (i = 0; i < 2; camobj = players[secondarydisplayplayer].mo, i++) + { + if (!camobj) + continue; + + if (foundit || Tag_Find(&camobj->subsector->sector->tags, tag)) + { + foundit = true; + break; + } + + // Only trigger if mobj is touching the tag + for (rover = camobj->subsector->sector->ffloors; rover; rover = rover->next) + { + if (!Tag_Find(&rover->master->frontsector->tags, tag)) + continue; + + if (camobj->z > P_GetSpecialTopZ(camobj, sectors + rover->secnum, camobj->subsector->sector)) + continue; + + if (camobj->z + camobj->height < P_GetSpecialBottomZ(camobj, sectors + rover->secnum, camobj->subsector->sector)) + continue; + + foundit = true; + break; + } + } + + if (!foundit) + return; + + break; + } + case TMSL_EVERYONE: // no additional check + default: + break; + } + + // Play the sound from the specified source + switch (source) + { + case TMSS_TRIGGERMOBJ: // play the sound from mobj that triggered it + if (mo) + S_StartSound(mo, sfxnum); + break; + case TMSS_TRIGGERSECTOR: // play the sound from calling sector's soundorg + if (callsec) + S_StartSound(&callsec->soundorg, sfxnum); + else if (mo) + S_StartSound(&mo->subsector->sector->soundorg, sfxnum); + break; + case TMSS_NOWHERE: // play the sound from nowhere + S_StartSound(NULL, sfxnum); + break; + case TMSS_TAGGEDSECTOR: // play the sound from tagged sectors' soundorgs + { + INT32 secnum; + + TAG_ITER_SECTORS(tag, secnum) + S_StartSound(§ors[secnum].soundorg, sfxnum); + break; + } + default: + break; + } +} + static boolean is_rain_type (INT32 weathernum) { switch (weathernum) @@ -2163,6 +2242,39 @@ static mobj_t *P_GetObjectTypeInSectorNum(mobjtype_t type, size_t s) return NULL; } +static mobj_t* P_FindObjectTypeFromTag(mobjtype_t type, mtag_t tag) +{ + if (udmf) + { + INT32 mtnum; + mobj_t *mo; + + TAG_ITER_THINGS(tag, mtnum) + { + mo = mapthings[mtnum].mobj; + + if (!mo) + continue; + + if (mo->type != type) + continue; + + return mo; + } + + return NULL; + } + else + { + INT32 secnum; + + if ((secnum = Tag_Iterate_Sectors(tag, 0)) < 0) + return NULL; + + return P_GetObjectTypeInSectorNum(type, secnum); + } +} + /** Processes the line special triggered by an object. * * \param line Line with the special command on it. @@ -2181,7 +2293,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) { INT32 secnum = -1; mobj_t *bot = NULL; - mtag_t tag = Tag_FGet(&line->tags); I_Assert(!mo || !P_MobjWasRemoved(mo)); // If mo is there, mo must be valid! @@ -2191,90 +2302,134 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) // note: only commands with linedef types >= 400 && < 500 can be used switch (line->special) { - case 400: // Set tagged sector's floor height/pic - EV_DoFloor(line, instantMoveFloorByFrontSector); + case 400: // Set tagged sector's heights/flats + if (line->args[1] != TMP_CEILING) + EV_DoFloor(line->args[0], line, instantMoveFloorByFrontSector); + if (line->args[1] != TMP_FLOOR) + EV_DoCeiling(line->args[0], line, instantMoveCeilingByFrontSector); break; - case 401: // Set tagged sector's ceiling height/pic - EV_DoCeiling(line, instantMoveCeilingByFrontSector); - break; - - case 402: // Set tagged sector's light level + case 402: // Copy light level to tagged sectors { INT16 newlightlevel; + INT16 newfloorlightlevel, newceilinglightlevel; + boolean newfloorlightabsolute, newceilinglightabsolute; INT32 newfloorlightsec, newceilinglightsec; newlightlevel = line->frontsector->lightlevel; + newfloorlightlevel = line->frontsector->floorlightlevel; + newfloorlightabsolute = line->frontsector->floorlightabsolute; + newceilinglightlevel = line->frontsector->ceilinglightlevel; + newceilinglightabsolute = line->frontsector->ceilinglightabsolute; newfloorlightsec = line->frontsector->floorlightsec; newceilinglightsec = line->frontsector->ceilinglightsec; - // act on all sectors with the same tag as the triggering linedef - TAG_ITER_SECTORS(tag, secnum) + TAG_ITER_SECTORS(line->args[0], secnum) { if (sectors[secnum].lightingdata) { // Stop the lighting madness going on in this sector! - P_RemoveThinker(&((elevator_t *)sectors[secnum].lightingdata)->thinker); + P_RemoveThinker(&((thinkerdata_t *)sectors[secnum].lightingdata)->thinker); sectors[secnum].lightingdata = NULL; - - // No, it's not an elevator_t, but any struct with a thinker_t named - // 'thinker' at the beginning will do here. (We don't know what it - // actually is: could be lightlevel_t, fireflicker_t, glow_t, etc.) } - sectors[secnum].lightlevel = newlightlevel; - sectors[secnum].floorlightsec = newfloorlightsec; - sectors[secnum].ceilinglightsec = newceilinglightsec; + if (!(line->args[1] & TMLC_NOSECTOR)) + sectors[secnum].lightlevel = newlightlevel; + if (!(line->args[1] & TMLC_NOFLOOR)) + { + sectors[secnum].floorlightlevel = newfloorlightlevel; + sectors[secnum].floorlightabsolute = newfloorlightabsolute; + sectors[secnum].floorlightsec = newfloorlightsec; + } + if (!(line->args[1] & TMLC_NOCEILING)) + { + sectors[secnum].ceilinglightlevel = newceilinglightlevel; + sectors[secnum].ceilinglightabsolute = newceilinglightabsolute; + sectors[secnum].ceilinglightsec = newceilinglightsec; + } } } break; - case 403: // Move floor, linelen = speed, frontsector floor = dest height - EV_DoFloor(line, moveFloorByFrontSector); + case 403: // Move planes by front sector + if (line->args[1] != TMP_CEILING) + EV_DoFloor(line->args[0], line, moveFloorByFrontSector); + if (line->args[1] != TMP_FLOOR) + EV_DoCeiling(line->args[0], line, moveCeilingByFrontSector); break; - case 404: // Move ceiling, linelen = speed, frontsector ceiling = dest height - EV_DoCeiling(line, moveCeilingByFrontSector); + case 405: // Move planes by distance + if (line->args[1] != TMP_CEILING) + EV_DoFloor(line->args[0], line, moveFloorByDistance); + if (line->args[1] != TMP_FLOOR) + EV_DoCeiling(line->args[0], line, moveCeilingByDistance); break; - case 405: // Move floor by front side texture offsets, offset x = speed, offset y = amount to raise/lower - EV_DoFloor(line, moveFloorByFrontTexture); + case 408: // Set flats + { + TAG_ITER_SECTORS(line->args[0], secnum) + { + if (line->args[1] != TMP_CEILING) + sectors[secnum].floorpic = line->frontsector->floorpic; + if (line->args[1] != TMP_FLOOR) + sectors[secnum].ceilingpic = line->frontsector->ceilingpic; + } break; - - case 407: // Move ceiling by front side texture offsets, offset x = speed, offset y = amount to raise/lower - EV_DoCeiling(line, moveCeilingByFrontTexture); - break; - -/* case 405: // Lower floor by line, dx = speed, dy = amount to lower - EV_DoFloor(line, lowerFloorByLine); - break; - - case 406: // Raise floor by line, dx = speed, dy = amount to raise - EV_DoFloor(line, raiseFloorByLine); - break; - - case 407: // Lower ceiling by line, dx = speed, dy = amount to lower - EV_DoCeiling(line, lowerCeilingByLine); - break; - - case 408: // Raise ceiling by line, dx = speed, dy = amount to raise - EV_DoCeiling(line, raiseCeilingByLine); - break;*/ + } case 409: // Change tagged sectors' tag // (formerly "Change calling sectors' tag", but behavior was changed) { - TAG_ITER_SECTORS(tag, secnum) - Tag_SectorFSet(secnum,(INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS)); + mtag_t newtag = line->args[1]; + + TAG_ITER_SECTORS(line->args[0], secnum) + { + switch (line->args[2]) + { + case TMT_ADD: + Tag_SectorAdd(secnum, newtag); + break; + case TMT_REMOVE: + Tag_SectorRemove(secnum, newtag); + break; + case TMT_REPLACEFIRST: + default: + Tag_SectorFSet(secnum, newtag); + break; + case TMT_TRIGGERTAG: + sectors[secnum].triggertag = newtag; + break; + } + } break; } case 410: // Change front sector's tag - Tag_SectorFSet((UINT32)(line->frontsector - sectors), (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS)); + { + mtag_t newtag = line->args[1]; + secnum = (UINT32)(line->frontsector - sectors); + + switch (line->args[2]) + { + case TMT_ADD: + Tag_SectorAdd(secnum, newtag); + break; + case TMT_REMOVE: + Tag_SectorRemove(secnum, newtag); + break; + case TMT_REPLACEFIRST: + default: + Tag_SectorFSet(secnum, newtag); + break; + case TMT_TRIGGERTAG: + sectors[secnum].triggertag = newtag; + break; + } break; + } case 411: // Stop floor/ceiling movement in tagged sector(s) - TAG_ITER_SECTORS(tag, secnum) + TAG_ITER_SECTORS(line->args[0], secnum) { if (sectors[secnum].floordata) { @@ -2308,13 +2463,13 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) if (!mo) // nothing to teleport return; - if (line->flags & ML_EFFECT3) // Relative silent teleport + if (line->args[1] & TMT_RELATIVE) // Relative silent teleport { fixed_t x, y, z; - x = sides[line->sidenum[0]].textureoffset; - y = sides[line->sidenum[0]].rowoffset; - z = line->frontsector->ceilingheight; + x = line->args[2] << FRACBITS; + y = line->args[3] << FRACBITS; + z = line->args[4] << FRACBITS; P_UnsetThingPosition(mo); mo->x += x; @@ -2344,41 +2499,40 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) } else { - if ((secnum = Tag_Iterate_Sectors(tag, 0)) < 0) - return; + angle_t angle; + boolean silent, keepmomentum; - dest = P_GetObjectTypeInSectorNum(MT_TELEPORTMAN, secnum); + dest = P_FindObjectTypeFromTag(MT_TELEPORTMAN, line->args[0]); if (!dest) return; + angle = (line->args[1] & TMT_KEEPANGLE) ? mo->angle : dest->angle; + silent = !!(line->args[1] & TMT_SILENT); + keepmomentum = !!(line->args[1] & TMT_KEEPMOMENTUM); + if (bot) - P_Teleport(bot, dest->x, dest->y, dest->z, (line->flags & ML_NOCLIMB) ? mo->angle : dest->angle, (line->flags & ML_BLOCKMONSTERS) == 0, (line->flags & ML_EFFECT4) == ML_EFFECT4); - if (line->flags & ML_BLOCKMONSTERS) - P_Teleport(mo, dest->x, dest->y, dest->z, (line->flags & ML_NOCLIMB) ? mo->angle : dest->angle, false, (line->flags & ML_EFFECT4) == ML_EFFECT4); - else - { - P_Teleport(mo, dest->x, dest->y, dest->z, (line->flags & ML_NOCLIMB) ? mo->angle : dest->angle, true, (line->flags & ML_EFFECT4) == ML_EFFECT4); - // Play the 'bowrwoosh!' sound - S_StartSound(dest, sfx_mixup); - } + P_Teleport(bot, dest->x, dest->y, dest->z, angle, !silent, keepmomentum); + P_Teleport(mo, dest->x, dest->y, dest->z, angle, !silent, keepmomentum); + if (!silent) + S_StartSound(dest, sfx_mixup); // Play the 'bowrwoosh!' sound } } break; case 413: // Change music - // console player only unless NOCLIMB is set - if ((line->flags & ML_NOCLIMB) || (mo && mo->player && P_IsLocalPlayer(mo->player)) || titlemapinaction) + // console player only unless TMM_ALLPLAYERS is set + if ((line->args[0] & TMM_ALLPLAYERS) || (mo && mo->player && P_IsLocalPlayer(mo->player)) || titlemapinaction) { - boolean musicsame = (!sides[line->sidenum[0]].text[0] || !strnicmp(sides[line->sidenum[0]].text, S_MusicName(), 7)); - UINT16 tracknum = (UINT16)max(sides[line->sidenum[0]].bottomtexture, 0); - INT32 position = (INT32)max(sides[line->sidenum[0]].midtexture, 0); - UINT32 prefadems = (UINT32)max(sides[line->sidenum[0]].textureoffset >> FRACBITS, 0); - UINT32 postfadems = (UINT32)max(sides[line->sidenum[0]].rowoffset >> FRACBITS, 0); - UINT8 fadetarget = (UINT8)max((line->sidenum[1] != 0xffff) ? sides[line->sidenum[1]].textureoffset >> FRACBITS : 0, 0); - INT16 fadesource = (INT16)max((line->sidenum[1] != 0xffff) ? sides[line->sidenum[1]].rowoffset >> FRACBITS : -1, -1); + boolean musicsame = (!line->stringargs[0] || !line->stringargs[0][0] || !strnicmp(line->stringargs[0], S_MusicName(), 7)); + UINT16 tracknum = (UINT16)max(line->args[6], 0); + INT32 position = (INT32)max(line->args[1], 0); + UINT32 prefadems = (UINT32)max(line->args[2], 0); + UINT32 postfadems = (UINT32)max(line->args[3], 0); + UINT8 fadetarget = (UINT8)max(line->args[4], 0); + INT16 fadesource = (INT16)max(line->args[5], -1); // Seek offset from current song position - if (line->flags & ML_EFFECT1) + if (line->args[0] & TMM_OFFSET) { // adjust for loop point if subtracting if (position < 0 && S_GetMusicLength() && @@ -2390,7 +2544,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) } // Fade current music to target volume (if music won't be changed) - if ((line->flags & ML_EFFECT2) && fadetarget && musicsame) + if ((line->args[0] & TMM_FADE) && fadetarget && musicsame) { // 0 fadesource means fade from current volume. // meaning that we can't specify volume 0 as the source volume -- this starts at 1. @@ -2408,22 +2562,25 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) // Change the music and apply position/fade operations else { - strncpy(mapmusname, sides[line->sidenum[0]].text, 7); + if (!line->stringargs[0]) + break; + + strncpy(mapmusname, line->stringargs[0], 7); mapmusname[6] = 0; mapmusflags = tracknum & MUSIC_TRACKMASK; - if (!(line->flags & ML_BLOCKMONSTERS)) + if (!(line->args[0] & TMM_NORELOAD)) mapmusflags |= MUSIC_RELOADRESET; - if (line->flags & ML_BOUNCY) + if (line->args[0] & TMM_FORCERESET) mapmusflags |= MUSIC_FORCERESET; mapmusposition = position; - S_ChangeMusicEx(mapmusname, mapmusflags, !(line->flags & ML_EFFECT4), position, - !(line->flags & ML_EFFECT2) ? prefadems : 0, - !(line->flags & ML_EFFECT2) ? postfadems : 0); + S_ChangeMusicEx(mapmusname, mapmusflags, !(line->args[0] & TMM_NOLOOP), position, + !(line->args[0] & TMM_FADE) ? prefadems : 0, + !(line->args[0] & TMM_FADE) ? postfadems : 0); - if ((line->flags & ML_EFFECT2) && fadetarget) + if ((line->args[0] & TMM_FADE) && fadetarget) { if (!postfadems) S_SetInternalMusicVolume(fadetarget); @@ -2432,302 +2589,55 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) } } - // Except, you can use the ML_BLOCKMONSTERS flag to change this behavior. + // Except, you can use the TMM_NORELOAD flag to change this behavior. // if (mapmusflags & MUSIC_RELOADRESET) then it will reset the music in G_PlayerReborn. } break; case 414: // Play SFX - { - INT32 sfxnum; - - sfxnum = sides[line->sidenum[0]].toptexture; - - if (sfxnum == sfx_None) - return; // Do nothing! - if (sfxnum < sfx_None || sfxnum >= NUMSFX) - { - CONS_Debug(DBG_GAMELOGIC, "Line type 414 Executor: sfx number %d is invalid!\n", sfxnum); - return; - } - - if (tag != 0) // Do special stuff only if a non-zero linedef tag is set - { - // Play sounds from tagged sectors' origins. - if (line->flags & ML_EFFECT5) // Repeat Midtexture - { - // Additionally play the sound from tagged sectors' soundorgs - sector_t *sec; - - TAG_ITER_SECTORS(tag, secnum) - { - sec = §ors[secnum]; - S_StartSound(&sec->soundorg, sfxnum); - } - } - - // Play the sound without origin for anyone, as long as they're inside tagged areas. - else - { - UINT8 i = 0; - mobj_t* camobj = players[displayplayer].mo; - ffloor_t *rover; - boolean foundit = false; - - for (i = 0; i < 2; camobj = players[secondarydisplayplayer].mo, i++) - { - if (!camobj) - continue; - - if (foundit || Tag_Find(&camobj->subsector->sector->tags, tag)) - { - foundit = true; - break; - } - - // Only trigger if mobj is touching the tag - for(rover = camobj->subsector->sector->ffloors; rover; rover = rover->next) - { - if (!Tag_Find(&rover->master->frontsector->tags, tag)) - continue; - - if (camobj->z > P_GetSpecialTopZ(camobj, sectors + rover->secnum, camobj->subsector->sector)) - continue; - - if (camobj->z + camobj->height < P_GetSpecialBottomZ(camobj, sectors + rover->secnum, camobj->subsector->sector)) - continue; - - foundit = true; - break; - } - } - - if (foundit) - S_StartSound(NULL, sfxnum); - } - } - else - { - if (line->flags & ML_NOCLIMB) - { - // play the sound from nowhere, but only if display player triggered it - if (mo && mo->player && (mo->player == &players[displayplayer] || mo->player == &players[secondarydisplayplayer])) - S_StartSound(NULL, sfxnum); - } - else if (line->flags & ML_EFFECT4) - { - // play the sound from nowhere - S_StartSound(NULL, sfxnum); - } - else if (line->flags & ML_BLOCKMONSTERS) - { - // play the sound from calling sector's soundorg - if (callsec) - S_StartSound(&callsec->soundorg, sfxnum); - else if (mo) - S_StartSound(&mo->subsector->sector->soundorg, sfxnum); - } - else if (mo) - { - // play the sound from mobj that triggered it - S_StartSound(mo, sfxnum); - } - } - } + P_PlaySFX(line->stringargs[0] ? get_number(line->stringargs[0]) : sfx_None, mo, callsec, line->args[2], line->args[0], line->args[1]); break; case 415: // Run a script if (cv_runscripts.value) { - INT32 scrnum; - lumpnum_t lumpnum; - char newname[9]; - - strcpy(newname, G_BuildMapName(gamemap)); - newname[0] = 'S'; - newname[1] = 'C'; - newname[2] = 'R'; - - scrnum = sides[line->sidenum[0]].textureoffset>>FRACBITS; - if (scrnum < 0 || scrnum > 999) - { - scrnum = 0; - newname[5] = newname[6] = newname[7] = '0'; - } - else - { - newname[5] = (char)('0' + (char)((scrnum/100))); - newname[6] = (char)('0' + (char)((scrnum%100)/10)); - newname[7] = (char)('0' + (char)(scrnum%10)); - } - newname[8] = '\0'; - - lumpnum = W_CheckNumForName(newname); + lumpnum_t lumpnum = W_CheckNumForName(line->stringargs[0]); if (lumpnum == LUMPERROR || W_LumpLength(lumpnum) == 0) - { - CONS_Debug(DBG_SETUP, "SOC Error: script lump %s not found/not valid.\n", newname); - } + CONS_Debug(DBG_SETUP, "Line type 415 Executor: script lump %s not found/not valid.\n", line->stringargs[0]); else COM_BufInsertText(W_CacheLumpNum(lumpnum, PU_CACHE)); } break; case 416: // Spawn adjustable fire flicker - TAG_ITER_SECTORS(tag, secnum) - { - if (line->flags & ML_NOCLIMB && line->backsector) - { - // Use front sector for min light level, back sector for max. - // This is tricky because P_SpawnAdjustableFireFlicker expects - // the maxsector (second argument) to also be the target - // sector, so we have to do some light level twiddling. - fireflicker_t *flick; - INT16 reallightlevel = sectors[secnum].lightlevel; - sectors[secnum].lightlevel = line->backsector->lightlevel; - - flick = P_SpawnAdjustableFireFlicker(line->frontsector, §ors[secnum], - P_AproxDistance(line->dx, line->dy)>>FRACBITS); - - // Make sure the starting light level is in range. - if (reallightlevel < flick->minlight) - reallightlevel = (INT16)flick->minlight; - else if (reallightlevel > flick->maxlight) - reallightlevel = (INT16)flick->maxlight; - - sectors[secnum].lightlevel = reallightlevel; - } - else - { - // Use front sector for min, target sector for max, - // the same way linetype 61 does it. - P_SpawnAdjustableFireFlicker(line->frontsector, §ors[secnum], - P_AproxDistance(line->dx, line->dy)>>FRACBITS); - } - } + TAG_ITER_SECTORS(line->args[0], secnum) + P_SpawnAdjustableFireFlicker(§ors[secnum], line->args[2], + line->args[3] ? sectors[secnum].lightlevel : line->args[4], line->args[1]); break; case 417: // Spawn adjustable glowing light - TAG_ITER_SECTORS(tag, secnum) - { - if (line->flags & ML_NOCLIMB && line->backsector) - { - // Use front sector for min light level, back sector for max. - // This is tricky because P_SpawnAdjustableGlowingLight expects - // the maxsector (second argument) to also be the target - // sector, so we have to do some light level twiddling. - glow_t *glow; - INT16 reallightlevel = sectors[secnum].lightlevel; - sectors[secnum].lightlevel = line->backsector->lightlevel; - - glow = P_SpawnAdjustableGlowingLight(line->frontsector, §ors[secnum], - P_AproxDistance(line->dx, line->dy)>>FRACBITS); - - // Make sure the starting light level is in range. - if (reallightlevel < glow->minlight) - reallightlevel = (INT16)glow->minlight; - else if (reallightlevel > glow->maxlight) - reallightlevel = (INT16)glow->maxlight; - - sectors[secnum].lightlevel = reallightlevel; - } - else - { - // Use front sector for min, target sector for max, - // the same way linetype 602 does it. - P_SpawnAdjustableGlowingLight(line->frontsector, §ors[secnum], - P_AproxDistance(line->dx, line->dy)>>FRACBITS); - } - } + TAG_ITER_SECTORS(line->args[0], secnum) + P_SpawnAdjustableGlowingLight(§ors[secnum], line->args[2], + line->args[3] ? sectors[secnum].lightlevel : line->args[4], line->args[1]); break; - case 418: // Spawn adjustable strobe flash (unsynchronized) - TAG_ITER_SECTORS(tag, secnum) - { - if (line->flags & ML_NOCLIMB && line->backsector) - { - // Use front sector for min light level, back sector for max. - // This is tricky because P_SpawnAdjustableGlowingLight expects - // the maxsector (second argument) to also be the target - // sector, so we have to do some light level twiddling. - strobe_t *flash; - INT16 reallightlevel = sectors[secnum].lightlevel; - sectors[secnum].lightlevel = line->backsector->lightlevel; - - flash = P_SpawnAdjustableStrobeFlash(line->frontsector, §ors[secnum], - abs(line->dx)>>FRACBITS, abs(line->dy)>>FRACBITS, false); - - // Make sure the starting light level is in range. - if (reallightlevel < flash->minlight) - reallightlevel = (INT16)flash->minlight; - else if (reallightlevel > flash->maxlight) - reallightlevel = (INT16)flash->maxlight; - - sectors[secnum].lightlevel = reallightlevel; - } - else - { - // Use front sector for min, target sector for max, - // the same way linetype 602 does it. - P_SpawnAdjustableStrobeFlash(line->frontsector, §ors[secnum], - abs(line->dx)>>FRACBITS, abs(line->dy)>>FRACBITS, false); - } - } - break; - - case 419: // Spawn adjustable strobe flash (synchronized) - TAG_ITER_SECTORS(tag, secnum) - { - if (line->flags & ML_NOCLIMB && line->backsector) - { - // Use front sector for min light level, back sector for max. - // This is tricky because P_SpawnAdjustableGlowingLight expects - // the maxsector (second argument) to also be the target - // sector, so we have to do some light level twiddling. - strobe_t *flash; - INT16 reallightlevel = sectors[secnum].lightlevel; - sectors[secnum].lightlevel = line->backsector->lightlevel; - - flash = P_SpawnAdjustableStrobeFlash(line->frontsector, §ors[secnum], - abs(line->dx)>>FRACBITS, abs(line->dy)>>FRACBITS, true); - - // Make sure the starting light level is in range. - if (reallightlevel < flash->minlight) - reallightlevel = (INT16)flash->minlight; - else if (reallightlevel > flash->maxlight) - reallightlevel = (INT16)flash->maxlight; - - sectors[secnum].lightlevel = reallightlevel; - } - else - { - // Use front sector for min, target sector for max, - // the same way linetype 602 does it. - P_SpawnAdjustableStrobeFlash(line->frontsector, §ors[secnum], - abs(line->dx)>>FRACBITS, abs(line->dy)>>FRACBITS, true); - } - } + case 418: // Spawn adjustable strobe flash + TAG_ITER_SECTORS(line->args[0], secnum) + P_SpawnAdjustableStrobeFlash(§ors[secnum], line->args[3], + (line->args[4] & TMB_USETARGET) ? sectors[secnum].lightlevel : line->args[5], + line->args[1], line->args[2], line->args[4] & TMB_SYNC); break; case 420: // Fade light levels in tagged sectors to new value - P_FadeLight(tag, - (line->flags & ML_DONTPEGBOTTOM) ? max(sides[line->sidenum[0]].textureoffset>>FRACBITS, 0) : line->frontsector->lightlevel, - // failsafe: if user specifies Back Y Offset and NOT Front Y Offset, use the Back Offset - // to be consistent with other light and fade specials - (line->flags & ML_DONTPEGBOTTOM) ? - ((line->sidenum[1] != 0xFFFF && !(sides[line->sidenum[0]].rowoffset>>FRACBITS)) ? - max(min(sides[line->sidenum[1]].rowoffset>>FRACBITS, 255), 0) - : max(min(sides[line->sidenum[0]].rowoffset>>FRACBITS, 255), 0)) - : abs(P_AproxDistance(line->dx, line->dy))>>FRACBITS, - (line->flags & ML_EFFECT4), - (line->flags & ML_EFFECT5)); + P_FadeLight(line->args[0], line->args[1], line->args[2], line->args[3] & TMF_TICBASED, line->args[3] & TMF_OVERRIDE, line->args[3] & TMF_RELATIVE); break; case 421: // Stop lighting effect in tagged sectors - TAG_ITER_SECTORS(tag, secnum) + TAG_ITER_SECTORS(line->args[0], secnum) if (sectors[secnum].lightingdata) { - P_RemoveThinker(&((elevator_t *)sectors[secnum].lightingdata)->thinker); + P_RemoveThinker(&((thinkerdata_t *)sectors[secnum].lightingdata)->thinker); sectors[secnum].lightingdata = NULL; } break; @@ -2735,15 +2645,13 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 422: // Cut away to another view { mobj_t *altview; + INT32 aim; if ((!mo || !mo->player) && !titlemapinaction) // only players have views, and title screens return; - if ((secnum = Tag_Iterate_Sectors(tag, 0)) < 0) - return; - - altview = P_GetObjectTypeInSectorNum(MT_ALTVIEWMAN, secnum); - if (!altview) + altview = P_FindObjectTypeFromTag(MT_ALTVIEWMAN, line->args[0]); + if (!altview || !altview->spawnpoint) return; // If titlemap, set the camera ref for title's thinker @@ -2753,59 +2661,50 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) else { P_SetTarget(&mo->player->awayviewmobj, altview); - mo->player->awayviewtics = P_AproxDistance(line->dx, line->dy)>>FRACBITS; + mo->player->awayviewtics = line->args[1]; } - - if (line->flags & ML_NOCLIMB) // lets you specify a vertical angle - { - INT32 aim; - - aim = sides[line->sidenum[0]].textureoffset>>FRACBITS; - aim = (aim + 360) % 360; - aim *= (ANGLE_90>>8); - aim /= 90; - aim <<= 8; - if (titlemapinaction) - titlemapcameraref->cusval = (angle_t)aim; - else - mo->player->awayviewaiming = (angle_t)aim; - } + aim = udmf ? altview->spawnpoint->pitch : line->args[2]; + aim = (aim + 360) % 360; + aim *= (ANGLE_90>>8); + aim /= 90; + aim <<= 8; + if (titlemapinaction) + titlemapcameraref->cusval = (angle_t)aim; else - { - // straight ahead - if (!titlemapinaction) - mo->player->awayviewaiming = 0; - // don't do cusval cause that's annoying - } + mo->player->awayviewaiming = (angle_t)aim; } break; case 423: // Change Sky - if ((mo && mo->player && P_IsLocalPlayer(mo->player)) || (line->flags & ML_NOCLIMB)) - P_SetupLevelSky(sides[line->sidenum[0]].textureoffset>>FRACBITS, (line->flags & ML_NOCLIMB)); + if ((mo && mo->player && P_IsLocalPlayer(mo->player)) || line->args[1]) + P_SetupLevelSky(line->args[0], line->args[1]); break; case 424: // Change Weather - if (line->flags & ML_NOCLIMB) + if (line->args[1]) { - globalweather = (UINT8)(sides[line->sidenum[0]].textureoffset>>FRACBITS); + globalweather = (UINT8)(line->args[0]); P_SwitchWeather(globalweather); } else if (mo && mo->player && P_IsLocalPlayer(mo->player)) - P_SwitchWeather(sides[line->sidenum[0]].textureoffset>>FRACBITS); + P_SwitchWeather(line->args[0]); break; case 425: // Calls P_SetMobjState on calling mobj if (mo && !mo->player) - P_SetMobjState(mo, sides[line->sidenum[0]].toptexture); //P_AproxDistance(line->dx, line->dy)>>FRACBITS); + { + statenum_t state = line->stringargs[0] ? get_number(line->stringargs[0]) : S_NULL; + if (state >= 0 && state < NUMSTATES) + P_SetMobjState(mo, state); + } break; case 426: // Moves the mobj to its sector's soundorg and on the floor, and stops it if (!mo) return; - if (line->flags & ML_NOCLIMB) + if (line->args[0]) { P_UnsetThingPosition(mo); mo->x = mo->subsector->sector->soundorg.x; @@ -2826,7 +2725,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) // Reset bot too. if (bot) { - if (line->flags & ML_NOCLIMB) + if (line->args[0]) P_TeleportMove(bot, mo->x, mo->y, mo->z); bot->momx = bot->momy = bot->momz = 1; bot->pmomz = 0; @@ -2840,29 +2739,26 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 427: // Awards points if the mobj is a player if (mo && mo->player) - P_AddPlayerScore(mo->player, sides[line->sidenum[0]].textureoffset>>FRACBITS); + P_AddPlayerScore(mo->player, line->args[0]); break; case 428: // Start floating platform movement - EV_DoElevator(line, elevateContinuous, true); + EV_DoElevator(line->args[0], line, elevateContinuous); break; - case 429: // Crush Ceiling Down Once - EV_DoCrush(line, crushCeilOnce); + case 429: // Crush planes once + if (line->args[1] == TMP_FLOOR) + EV_DoFloor(line->args[0], line, crushFloorOnce); + else if (line->args[1] == TMP_CEILING) + EV_DoCrush(line->args[0], line, crushCeilOnce); + else + EV_DoCrush(line->args[0], line, crushBothOnce); break; - case 430: // Crush Floor Up Once - EV_DoFloor(line, crushFloorOnce); - break; - - case 431: // Crush Floor & Ceiling to middle Once - EV_DoCrush(line, crushBothOnce); - break; - - case 432: // Enable 2D Mode (Disable if noclimb) + case 432: // Enable/Disable 2D Mode if (mo && mo->player) { - if (line->flags & ML_NOCLIMB) + if (line->args[0]) mo->flags2 &= ~MF2_TWOD; else mo->flags2 |= MF2_TWOD; @@ -2876,8 +2772,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) } break; - case 433: // Flip gravity (Flop gravity if noclimb) Works on pushables, too! - if (line->flags & ML_NOCLIMB) + case 433: // Flip/flop gravity. Works on pushables, too! + if (line->args[0]) mo->flags2 &= ~MF2_OBJECTFLIP; else mo->flags2 |= MF2_OBJECTFLIP; @@ -2888,15 +2784,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 434: // Custom Power if (mo && mo->player) { - powertype_t power = sides[line->sidenum[0]].toptexture; //(line->dx>>FRACBITS)-1; - UINT16 value; - - if (line->sidenum[1] != 0xffff && line->flags & ML_BLOCKMONSTERS) // read power from back sidedef - value = sides[line->sidenum[1]].toptexture; - else if (line->flags & ML_NOCLIMB) // 'Infinite' + powertype_t power = line->stringargs[0] ? get_number(line->stringargs[0]) : 0; + INT32 value = line->stringargs[1] ? get_number(line->stringargs[1]) : 0; + if (value == -1) // 'Infinite' value = UINT16_MAX; - else - value = sides[line->sidenum[0]].textureoffset>>FRACBITS; P_SetPower(mo->player, power, value); @@ -2910,25 +2801,30 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) scroll_t *scroller; thinker_t *th; + fixed_t length = R_PointToDist2(line->v2->x, line->v2->y, line->v1->x, line->v1->y); + fixed_t speed = line->args[1] << FRACBITS; + fixed_t dx = FixedMul(FixedMul(FixedDiv(line->dx, length), speed) >> SCROLL_SHIFT, CARRYFACTOR); + fixed_t dy = FixedMul(FixedMul(FixedDiv(line->dy, length), speed) >> SCROLL_SHIFT, CARRYFACTOR); + for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next) { if (th->function.acp1 != (actionf_p1)T_Scroll) continue; scroller = (scroll_t *)th; - if (!Tag_Find(§ors[scroller->affectee].tags, tag)) + if (!Tag_Find(§ors[scroller->affectee].tags, line->args[0])) continue; - scroller->dx = FixedMul(line->dx>>SCROLL_SHIFT, CARRYFACTOR); - scroller->dy = FixedMul(line->dy>>SCROLL_SHIFT, CARRYFACTOR); + scroller->dx = dx; + scroller->dy = dy; } } break; case 436: // Shatter block remotely { - INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); - INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); + INT16 sectag = (INT16)(line->args[0]); + INT16 foftag = (INT16)(line->args[1]); sector_t *sec; // Sector that the FOF is visible in ffloor_t *rover; // FOF that we are going to crumble boolean foundrover = false; // for debug, "Can't find a FOF" message @@ -2965,10 +2861,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 437: // Disable Player Controls if (mo && mo->player) { - UINT16 fractime = (UINT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); + UINT16 fractime = (UINT16)(line->args[0]); if (fractime < 1) fractime = 1; //instantly wears off upon leaving - if (line->flags & ML_NOCLIMB) + if (line->args[1]) fractime |= 1<<15; //more crazy &ing, as if music stuff wasn't enough mo->player->powers[pw_nocontrol] = fractime; if (bot) @@ -2979,7 +2875,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 438: // Set player scale if (mo) { - mo->destscale = FixedDiv(P_AproxDistance(line->dx, line->dy), 100<destscale = FixedDiv(line->args[0]<destscale < FRACUNIT/100) mo->destscale = FRACUNIT/100; if (mo->player && bot) @@ -2991,30 +2887,33 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) { size_t linenum; side_t *set = &sides[line->sidenum[0]], *this; - boolean always = !(line->flags & ML_NOCLIMB); // If noclimb: Only change mid texture if mid texture already exists on tagged lines, etc. + boolean always = !(line->args[2]); // If args[2] is set: Only change mid texture if mid texture already exists on tagged lines, etc. for (linenum = 0; linenum < numlines; linenum++) { if (lines[linenum].special == 439) continue; // Don't override other set texture lines! - if (!Tag_Find(&lines[linenum].tags, tag)) + if (!Tag_Find(&lines[linenum].tags, line->args[0])) continue; // Find tagged lines // Front side - this = &sides[lines[linenum].sidenum[0]]; - if (always || this->toptexture) this->toptexture = set->toptexture; - if (always || this->midtexture) this->midtexture = set->midtexture; - if (always || this->bottomtexture) this->bottomtexture = set->bottomtexture; - - if (lines[linenum].sidenum[1] == 0xffff) - continue; // One-sided stops here. + if (line->args[1] != TMSD_BACK) + { + this = &sides[lines[linenum].sidenum[0]]; + if (always || this->toptexture) this->toptexture = set->toptexture; + if (always || this->midtexture) this->midtexture = set->midtexture; + if (always || this->bottomtexture) this->bottomtexture = set->bottomtexture; + } // Back side - this = &sides[lines[linenum].sidenum[1]]; - if (always || this->toptexture) this->toptexture = set->toptexture; - if (always || this->midtexture) this->midtexture = set->midtexture; - if (always || this->bottomtexture) this->bottomtexture = set->bottomtexture; + if (line->args[1] != TMSD_FRONT && lines[linenum].sidenum[1] != 0xffff) + { + this = &sides[lines[linenum].sidenum[1]]; + if (always || this->toptexture) this->toptexture = set->toptexture; + if (always || this->midtexture) this->midtexture = set->midtexture; + if (always || this->bottomtexture) this->bottomtexture = set->bottomtexture; + } } } break; @@ -3027,7 +2926,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 441: // Trigger unlockable if ((!modifiedgame || savemoddata) && !(netgame || multiplayer)) { - INT32 trigid = (INT32)(sides[line->sidenum[0]].textureoffset>>FRACBITS); + INT32 trigid = line->args[0]; if (trigid < 0 || trigid > 31) // limited by 32 bit variable CONS_Debug(DBG_GAMELOGIC, "Unlockable trigger (sidedef %hu): bad trigger ID %d\n", line->sidenum[0], trigid); @@ -3050,37 +2949,37 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 442: // Calls P_SetMobjState on mobjs of a given type in the tagged sectors { - const mobjtype_t type = (mobjtype_t)sides[line->sidenum[0]].toptexture; + const mobjtype_t type = line->stringargs[0] ? get_number(line->stringargs[0]) : MT_NULL; statenum_t state = NUMSTATES; - sector_t *sec; mobj_t *thing; - if (line->sidenum[1] != 0xffff) - state = (statenum_t)sides[line->sidenum[1]].toptexture; + if (type < 0 || type >= NUMMOBJTYPES) + break; - TAG_ITER_SECTORS(tag, secnum) + if (!line->args[1]) + { + state = line->stringargs[1] ? get_number(line->stringargs[1]) : S_NULL; + + if (state < 0 || state >= NUMSTATES) + break; + } + + TAG_ITER_SECTORS(line->args[0], secnum) { boolean tryagain; - sec = sectors + secnum; do { tryagain = false; - for (thing = sec->thinglist; thing; thing = thing->snext) - if (thing->type == type) - { - if (state != NUMSTATES) - { - if (!P_SetMobjState(thing, state)) // set state to specific state - { // mobj was removed - tryagain = true; // snext is corrupt, we'll have to start over. - break; - } - } - else if (!P_SetMobjState(thing, thing->state->nextstate)) // set state to nextstate - { // mobj was removed - tryagain = true; // snext is corrupt, we'll have to start over. - break; - } + for (thing = sectors[secnum].thinglist; thing; thing = thing->snext) + { + if (thing->type != type) + continue; + + if (!P_SetMobjState(thing, line->args[1] ? thing->state->nextstate : state)) + { // mobj was removed + tryagain = true; // snext is corrupt, we'll have to start over. + break; } + } } while (tryagain); } break; @@ -3090,14 +2989,14 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) if (line->stringargs[0]) LUA_HookLinedefExecute(line, mo, callsec); else - CONS_Alert(CONS_WARNING, "Linedef %s is missing the hook name of the Lua function to call! (This should be given in arg0str)\n", sizeu1(line-lines)); + CONS_Alert(CONS_WARNING, "Linedef %s is missing the hook name of the Lua function to call! (This should be given in stringarg0)\n", sizeu1(line-lines)); break; case 444: // Earthquake camera { - quake.intensity = sides[line->sidenum[0]].textureoffset; - quake.radius = sides[line->sidenum[0]].rowoffset; - quake.time = P_AproxDistance(line->dx, line->dy)>>FRACBITS; + quake.intensity = line->args[1] << FRACBITS; + quake.radius = line->args[2] << FRACBITS; + quake.time = line->args[0]; quake.epicenter = NULL; /// \todo @@ -3109,10 +3008,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; } - case 445: // Force block disappear remotely (reappear if noclimb) + case 445: // Force block disappear remotely (reappear if args[2] is set) { - INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); - INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); + INT16 sectag = (INT16)(line->args[0]); + INT16 foftag = (INT16)(line->args[1]); sector_t *sec; // Sector that the FOF is visible (or not visible) in ffloor_t *rover; // FOF to vanish/un-vanish boolean foundrover = false; // for debug, "Can't find a FOF" message @@ -3137,7 +3036,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) oldflags = rover->flags; // Abracadabra! - if (line->flags & ML_NOCLIMB) + if (line->args[2]) rover->flags |= FF_EXISTS; else rover->flags &= ~FF_EXISTS; @@ -3162,8 +3061,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 446: // Make block fall remotely (acts like FF_CRUMBLE) { - INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); - INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); + INT16 sectag = (INT16)(line->args[0]); + INT16 foftag = (INT16)(line->args[1]); sector_t *sec; // Sector that the FOF is visible in ffloor_t *rover; // FOF that we are going to make fall down boolean foundrover = false; // for debug, "Can't find a FOF" message @@ -3173,7 +3072,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) if (mo) // NULL check player = mo->player; - if (line->flags & ML_NOCLIMB) // don't respawn! + if (line->args[2] & TMFR_NORETURN) // don't respawn! respawn = false; TAG_ITER_SECTORS(sectag, secnum) @@ -3192,8 +3091,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) { foundrover = true; - if (line->flags & ML_BLOCKMONSTERS) // FOF flags determine respawn ability instead? - respawn = !(rover->flags & FF_NORETURN) ^ !!(line->flags & ML_NOCLIMB); // no climb inverts + if (line->args[2] & TMFR_CHECKFLAG) // FOF flags determine respawn ability instead? + respawn = !(rover->flags & FF_NORETURN) ^ !!(line->args[2] & TMFR_NORETURN); // TMFR_NORETURN inverts EV_StartCrumble(rover->master->frontsector, rover, (rover->flags & FF_FLOATBOB), player, rover->alpha, respawn); } @@ -3275,57 +3174,48 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; } case 448: // Change skybox viewpoint/centerpoint - if ((mo && mo->player && P_IsLocalPlayer(mo->player)) || (line->flags & ML_NOCLIMB)) + if ((mo && mo->player && P_IsLocalPlayer(mo->player)) || line->args[3]) { - INT32 viewid = sides[line->sidenum[0]].textureoffset>>FRACBITS; - INT32 centerid = sides[line->sidenum[0]].rowoffset>>FRACBITS; + INT32 viewid = line->args[0]; + INT32 centerid = line->args[1]; - if ((line->flags & (ML_EFFECT4|ML_BLOCKMONSTERS)) == ML_EFFECT4) // Solid Midtexture is on but Block Enemies is off? + // set viewpoint mobj + if (line->args[2] != TMS_CENTERPOINT) { - CONS_Alert(CONS_WARNING, - M_GetText("Skybox switch linedef (tag %d) doesn't have anything to do.\nConsider changing the linedef's flag configuration or removing it entirely.\n"), - tag); + if (viewid >= 0 && viewid < 16) + skyboxmo[0] = skyboxviewpnts[viewid]; + else + skyboxmo[0] = NULL; } - else - { - // set viewpoint mobj - if (!(line->flags & ML_EFFECT4)) // Solid Midtexture turns off viewpoint setting - { - if (viewid >= 0 && viewid < 16) - skyboxmo[0] = skyboxviewpnts[viewid]; - else - skyboxmo[0] = NULL; - } - // set centerpoint mobj - if (line->flags & ML_BLOCKMONSTERS) // Block Enemies turns ON centerpoint setting - { - if (centerid >= 0 && centerid < 16) - skyboxmo[1] = skyboxcenterpnts[centerid]; - else - skyboxmo[1] = NULL; - } + // set centerpoint mobj + if (line->args[2] != TMS_VIEWPOINT) + { + if (centerid >= 0 && centerid < 16) + skyboxmo[1] = skyboxcenterpnts[centerid]; + else + skyboxmo[1] = NULL; } CONS_Debug(DBG_GAMELOGIC, "Line type 448 Executor: viewid = %d, centerid = %d, viewpoint? = %s, centerpoint? = %s\n", viewid, centerid, - ((line->flags & ML_EFFECT4) ? "no" : "yes"), - ((line->flags & ML_BLOCKMONSTERS) ? "yes" : "no")); + ((line->args[2] == TMS_CENTERPOINT) ? "no" : "yes"), + ((line->args[2] == TMS_VIEWPOINT) ? "no" : "yes")); } break; case 449: // Enable bosses with parameter { - INT32 bossid = sides[line->sidenum[0]].textureoffset>>FRACBITS; + INT32 bossid = line->args[0]; if (bossid & ~15) // if any bits other than first 16 are set { CONS_Alert(CONS_WARNING, - M_GetText("Boss enable linedef (tag %d) has an invalid texture x offset.\nConsider changing it or removing it entirely.\n"), - tag); + M_GetText("Boss enable linedef has an invalid boss ID (%d).\nConsider changing it or removing it entirely.\n"), + bossid); break; } - if (line->flags & ML_NOCLIMB) + if (line->args[1]) { bossdisabled |= (1<args[0], mo, NULL); break; case 451: // Execute Random Linedef Executor { - INT32 rvalue1 = sides[line->sidenum[0]].textureoffset>>FRACBITS; - INT32 rvalue2 = sides[line->sidenum[0]].rowoffset>>FRACBITS; + INT32 rvalue1 = line->args[0]; + INT32 rvalue2 = line->args[1]; INT32 result; if (rvalue1 <= rvalue2) @@ -3359,10 +3249,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 452: // Set FOF alpha { - INT16 destvalue = line->sidenum[1] != 0xffff ? - (INT16)(sides[line->sidenum[1]].textureoffset>>FRACBITS) : (INT16)(P_AproxDistance(line->dx, line->dy)>>FRACBITS); - INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); - INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); + INT16 destvalue = (INT16)(line->args[2]); + INT16 sectag = (INT16)(line->args[0]); + INT16 foftag = (INT16)(line->args[1]); sector_t *sec; // Sector that the FOF is visible in ffloor_t *rover; // FOF that we are going to operate boolean foundrover = false; // for debug, "Can't find a FOF" message @@ -3386,7 +3275,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) // If fading an invisible FOF whose render flags we did not yet set, // initialize its alpha to 1 // for relative alpha calc - if (!(line->flags & ML_NOCLIMB) && // do translucent + if (!(line->args[3] & TMST_DONTDOTRANSLUCENT) && // do translucent (rover->spawnflags & FF_NOSHADE) && // do not include light blocks, which don't set FF_NOSHADE !(rover->spawnflags & FF_RENDERSIDES) && !(rover->spawnflags & FF_RENDERPLANES) && @@ -3396,16 +3285,16 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) P_RemoveFakeFloorFader(rover); P_FadeFakeFloor(rover, rover->alpha, - max(1, min(256, (line->flags & ML_EFFECT3) ? rover->alpha + destvalue : destvalue)), - 0, // set alpha immediately - false, NULL, // tic-based logic - false, // do not handle FF_EXISTS - !(line->flags & ML_NOCLIMB), // handle FF_TRANSLUCENT - false, // do not handle lighting - false, // do not handle colormap - false, // do not handle collision - false, // do not do ghost fade (no collision during fade) - true); // use exact alpha values (for opengl) + max(1, min(256, (line->args[3] & TMST_RELATIVE) ? rover->alpha + destvalue : destvalue)), + 0, // set alpha immediately + false, NULL, // tic-based logic + false, // do not handle FF_EXISTS + !(line->args[3] & TMST_DONTDOTRANSLUCENT), // handle FF_TRANSLUCENT + false, // do not handle lighting + false, // do not handle colormap + false, // do not handle collision + false, // do not do ghost fade (no collision during fade) + true); // use exact alpha values (for opengl) } } @@ -3420,12 +3309,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 453: // Fade FOF { - INT16 destvalue = line->sidenum[1] != 0xffff ? - (INT16)(sides[line->sidenum[1]].textureoffset>>FRACBITS) : (INT16)(line->dx>>FRACBITS); - INT16 speed = line->sidenum[1] != 0xffff ? - (INT16)(abs(sides[line->sidenum[1]].rowoffset>>FRACBITS)) : (INT16)(abs(line->dy)>>FRACBITS); - INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); - INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); + INT16 destvalue = (INT16)(line->args[2]); + INT16 speed = (INT16)(line->args[3]); + INT16 sectag = (INT16)(line->args[0]); + INT16 foftag = (INT16)(line->args[1]); sector_t *sec; // Sector that the FOF is visible in ffloor_t *rover; // FOF that we are going to operate boolean foundrover = false; // for debug, "Can't find a FOF" message @@ -3448,7 +3335,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) foundrover = true; // Prevent continuous execs from interfering on an existing fade - if (!(line->flags & ML_EFFECT5) + if (!(line->args[4] & TMFT_OVERRIDE) && rover->fadingdata) //&& ((fade_t*)rover->fadingdata)->timer > (ticbased ? 2 : speed*2)) { @@ -3460,21 +3347,21 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) P_AddFakeFloorFader(rover, secnum, j, destvalue, speed, - (line->flags & ML_EFFECT4), // tic-based logic - (line->flags & ML_EFFECT3), // Relative destvalue - !(line->flags & ML_BLOCKMONSTERS), // do not handle FF_EXISTS - !(line->flags & ML_NOCLIMB), // do not handle FF_TRANSLUCENT - !(line->flags & ML_EFFECT2), // do not handle lighting - !(line->flags & ML_EFFECT2), // do not handle colormap (ran out of flags) - !(line->flags & ML_BOUNCY), // do not handle collision - (line->flags & ML_EFFECT1), // do ghost fade (no collision during fade) - (line->flags & ML_TFERLINE)); // use exact alpha values (for opengl) + (line->args[4] & TMFT_TICBASED), // tic-based logic + (line->args[4] & TMFT_RELATIVE), // Relative destvalue + !(line->args[4] & TMFT_DONTDOEXISTS), // do not handle FF_EXISTS + !(line->args[4] & TMFT_DONTDOTRANSLUCENT), // do not handle FF_TRANSLUCENT + !(line->args[4] & TMFT_DONTDOLIGHTING), // do not handle lighting + !(line->args[4] & TMFT_DONTDOCOLORMAP), // do not handle colormap + !(line->args[4] & TMFT_IGNORECOLLISION), // do not handle collision + (line->args[4] & TMFT_GHOSTFADE), // do ghost fade (no collision during fade) + (line->args[4] & TMFT_USEEXACTALPHA)); // use exact alpha values (for opengl) else { // If fading an invisible FOF whose render flags we did not yet set, // initialize its alpha to 1 // for relative alpha calc - if (!(line->flags & ML_NOCLIMB) && // do translucent + if (!(line->args[4] & TMFT_DONTDOTRANSLUCENT) && // do translucent (rover->spawnflags & FF_NOSHADE) && // do not include light blocks, which don't set FF_NOSHADE !(rover->spawnflags & FF_RENDERSIDES) && !(rover->spawnflags & FF_RENDERPLANES) && @@ -3484,16 +3371,16 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) P_RemoveFakeFloorFader(rover); P_FadeFakeFloor(rover, rover->alpha, - max(1, min(256, (line->flags & ML_EFFECT3) ? rover->alpha + destvalue : destvalue)), - 0, // set alpha immediately - false, NULL, // tic-based logic - !(line->flags & ML_BLOCKMONSTERS), // do not handle FF_EXISTS - !(line->flags & ML_NOCLIMB), // do not handle FF_TRANSLUCENT - !(line->flags & ML_EFFECT2), // do not handle lighting - !(line->flags & ML_EFFECT2), // do not handle colormap (ran out of flags) - !(line->flags & ML_BOUNCY), // do not handle collision - (line->flags & ML_EFFECT1), // do ghost fade (no collision during fade) - (line->flags & ML_TFERLINE)); // use exact alpha values (for opengl) + max(1, min(256, (line->args[4] & TMFT_RELATIVE) ? rover->alpha + destvalue : destvalue)), + 0, // set alpha immediately + false, NULL, // tic-based logic + !(line->args[4] & TMFT_DONTDOEXISTS), // do not handle FF_EXISTS + !(line->args[4] & TMFT_DONTDOTRANSLUCENT), // do not handle FF_TRANSLUCENT + !(line->args[4] & TMFT_DONTDOLIGHTING), // do not handle lighting + !(line->args[4] & TMFT_DONTDOCOLORMAP), // do not handle colormap + !(line->args[4] & TMFT_IGNORECOLLISION), // do not handle collision + (line->args[4] & TMFT_GHOSTFADE), // do ghost fade (no collision during fade) + (line->args[4] & TMFT_USEEXACTALPHA)); // use exact alpha values (for opengl) } } j++; @@ -3510,8 +3397,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 454: // Stop fading FOF { - INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); - INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); + INT16 sectag = (INT16)(line->args[0]); + INT16 foftag = (INT16)(line->args[1]); sector_t *sec; // Sector that the FOF is visible in ffloor_t *rover; // FOF that we are going to operate boolean foundrover = false; // for debug, "Can't find a FOF" message @@ -3533,7 +3420,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) foundrover = true; P_ResetFakeFloorFader(rover, NULL, - !(line->flags & ML_BLOCKMONSTERS)); // do not finalize collision flags + !(line->args[2])); // do not finalize collision flags } } @@ -3654,17 +3541,13 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 457: // Track mobj angle to point if (mo) { - INT32 failureangle = FixedAngle((min(max(abs(sides[line->sidenum[0]].textureoffset>>FRACBITS), 0), 360))*FRACUNIT); - INT32 failuredelay = abs(sides[line->sidenum[0]].rowoffset>>FRACBITS); - INT32 failureexectag = line->sidenum[1] != 0xffff ? - (INT32)(sides[line->sidenum[1]].textureoffset>>FRACBITS) : 0; - boolean persist = (line->flags & ML_EFFECT2); + INT32 failureangle = FixedAngle((min(max(abs(line->args[1]), 0), 360))*FRACUNIT); + INT32 failuredelay = abs(line->args[2]); + INT32 failureexectag = line->args[3]; + boolean persist = !!(line->args[4]); mobj_t *anchormo; - if ((secnum = Tag_Iterate_Sectors(tag, 0)) < 0) - return; - - anchormo = P_GetObjectTypeInSectorNum(MT_ANGLEMAN, secnum); + anchormo = P_FindObjectTypeFromTag(MT_ANGLEMAN, line->args[0]); if (!anchormo) return; @@ -3687,27 +3570,27 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; case 459: // Control Text Prompt - // console player only unless NOCLIMB is set + // console player only if (mo && mo->player && P_IsLocalPlayer(mo->player) && (!bot || bot != mo)) { - INT32 promptnum = max(0, (sides[line->sidenum[0]].textureoffset>>FRACBITS)-1); - INT32 pagenum = max(0, (sides[line->sidenum[0]].rowoffset>>FRACBITS)-1); - INT32 postexectag = abs((line->sidenum[1] != 0xFFFF) ? sides[line->sidenum[1]].textureoffset>>FRACBITS : tag); + INT32 promptnum = max(0, line->args[0] - 1); + INT32 pagenum = max(0, line->args[1] - 1); + INT32 postexectag = abs(line->args[3]); - boolean closetextprompt = (line->flags & ML_BLOCKMONSTERS); - //boolean allplayers = (line->flags & ML_NOCLIMB); - boolean runpostexec = (line->flags & ML_EFFECT1); - boolean blockcontrols = !(line->flags & ML_EFFECT2); - boolean freezerealtime = !(line->flags & ML_EFFECT3); - //boolean freezethinkers = (line->flags & ML_EFFECT4); - boolean callbynamedtag = (line->flags & ML_TFERLINE); + boolean closetextprompt = (line->args[2] & TMP_CLOSE); + //boolean allplayers = (line->args[2] & TMP_ALLPLAYERS); + boolean runpostexec = (line->args[2] & TMP_RUNPOSTEXEC); + boolean blockcontrols = !(line->args[2] & TMP_KEEPCONTROLS); + boolean freezerealtime = !(line->args[2] & TMP_KEEPREALTIME); + //boolean freezethinkers = (line->args[2] & TMP_FREEZETHINKERS); + boolean callbynamedtag = (line->args[2] & TMP_CALLBYNAME); if (closetextprompt) F_EndTextPrompt(false, false); else { - if (callbynamedtag && sides[line->sidenum[0]].text && sides[line->sidenum[0]].text[0]) - F_GetPromptPageByNamedTag(sides[line->sidenum[0]].text, &promptnum, &pagenum); + if (callbynamedtag && line->stringargs[0] && line->stringargs[0][0]) + F_GetPromptPageByNamedTag(line->stringargs[0], &promptnum, &pagenum); F_StartTextPrompt(promptnum, pagenum, mo, runpostexec ? postexectag : 0, blockcontrols, freezerealtime); } } @@ -3715,8 +3598,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 460: // Award rings { - INT16 rings = (sides[line->sidenum[0]].textureoffset>>FRACBITS); - INT32 delay = (sides[line->sidenum[0]].rowoffset>>FRACBITS); + INT16 rings = line->args[0]; + INT32 delay = line->args[1]; if (mo && mo->player) { if (delay <= 0 || !(leveltime % delay)) @@ -3727,34 +3610,28 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 461: // Spawns an object on the map based on texture offsets { - const mobjtype_t type = (mobjtype_t)(sides[line->sidenum[0]].toptexture); + const mobjtype_t type = line->stringargs[0] ? get_number(line->stringargs[0]) : MT_NULL; mobj_t *mobj; fixed_t x, y, z; - x = sides[line->sidenum[0]].textureoffset; - y = sides[line->sidenum[0]].rowoffset; - z = line->frontsector->floorheight; - if (line->flags & ML_NOCLIMB) // If noclimb is set, spawn randomly within a range + if (line->args[4]) // If args[4] is set, spawn randomly within a range { - if (line->sidenum[1] != 0xffff) // Make sure the linedef has a back side - { - x = P_RandomRange(sides[line->sidenum[0]].textureoffset>>FRACBITS, sides[line->sidenum[1]].textureoffset>>FRACBITS)<sidenum[0]].rowoffset>>FRACBITS, sides[line->sidenum[1]].rowoffset>>FRACBITS)<frontsector->floorheight>>FRACBITS, line->frontsector->ceilingheight>>FRACBITS)<special); - break; - } + x = P_RandomRange(line->args[0], line->args[5])<args[1], line->args[6])<args[2], line->args[7])<args[0] << FRACBITS; + y = line->args[1] << FRACBITS; + z = line->args[2] << FRACBITS; } mobj = P_SpawnMobj(x, y, z, type); if (mobj) { - if (line->flags & ML_EFFECT1) - mobj->angle = R_PointToAngle2(line->v1->x, line->v1->y, line->v2->x, line->v2->y); + mobj->angle = FixedAngle(line->args[3] << FRACBITS); CONS_Debug(DBG_GAMELOGIC, "Linedef Type %d - Spawn Object: %d spawned at (%d, %d, %d)\n", line->special, mobj->type, mobj->x>>FRACBITS, mobj->y>>FRACBITS, mobj->z>>FRACBITS); //TODO: Convert mobj->type to a string somehow. } else @@ -3782,10 +3659,10 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 463: // Dye object { - INT32 color = sides[line->sidenum[0]].toptexture; - if (mo) { + INT32 color = line->stringargs[0] ? get_number(line->stringargs[0]) : SKINCOLOR_NONE; + if (color < 0 || color >= numskincolors) return; @@ -3798,31 +3675,28 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 464: // Trigger Egg Capsule { - thinker_t *th; + INT32 mtnum; mobj_t *mo2; // Find the center of the Eggtrap and release all the pretty animals! // The chimps are my friends.. heeheeheheehehee..... - LouisJM - for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) + TAG_ITER_THINGS(line->args[0], mtnum) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) - continue; + mo2 = mapthings[mtnum].mobj; - mo2 = (mobj_t *)th; + if (!mo2) + continue; if (mo2->type != MT_EGGTRAP) continue; - if (!mo2->spawnpoint) - continue; - - if (mo2->spawnpoint->angle != tag) + if (mo2->thinker.function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) continue; P_KillMobj(mo2, NULL, mo, 0); } - if (!(line->flags & ML_NOCLIMB)) + if (!(line->args[1])) { INT32 i; @@ -3856,7 +3730,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 466: // Set level failure state { - if (line->flags & ML_NOCLIMB) + if (line->args[1]) { stagefailed = false; CONS_Debug(DBG_GAMELOGIC, "Stage can be completed successfully!\n"); @@ -3869,28 +3743,106 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) } break; + case 467: // Set light level + TAG_ITER_SECTORS(line->args[0], secnum) + { + if (sectors[secnum].lightingdata) + { + // Stop any lighting effects going on in the sector + P_RemoveThinker(&((thinkerdata_t *)sectors[secnum].lightingdata)->thinker); + sectors[secnum].lightingdata = NULL; + } + + if (line->args[2] == TML_FLOOR) + { + if (line->args[3]) + sectors[secnum].floorlightlevel += line->args[1]; + else + sectors[secnum].floorlightlevel = line->args[1]; + } + else if (line->args[2] == TML_CEILING) + { + if (line->args[3]) + sectors[secnum].ceilinglightlevel += line->args[1]; + else + sectors[secnum].ceilinglightlevel = line->args[1]; + } + else + { + if (line->args[3]) + sectors[secnum].lightlevel += line->args[1]; + else + sectors[secnum].lightlevel = line->args[1]; + sectors[secnum].lightlevel = max(0, min(255, sectors[secnum].lightlevel)); + } + } + break; + + case 468: // Change linedef executor argument + { + INT32 linenum; + + if (!udmf) + break; + + if (line->args[1] < 0 || line->args[1] >= NUMLINEARGS) + { + CONS_Debug(DBG_GAMELOGIC, "Linedef type 468: Invalid linedef arg %d\n", line->args[1]); + break; + } + + TAG_ITER_LINES(line->args[0], linenum) + { + if (line->args[3]) + lines[linenum].args[line->args[1]] += line->args[2]; + else + lines[linenum].args[line->args[1]] = line->args[2]; + } + } + break; + + case 469: // Change sector gravity + { + fixed_t gravityvalue; + + if (!udmf) + break; + + if (!line->stringargs[0]) + break; + + gravityvalue = FloatToFixed(atof(line->stringargs[0])); + + TAG_ITER_SECTORS(line->args[0], secnum) + { + if (line->args[1]) + sectors[secnum].gravity = FixedMul(sectors[secnum].gravity, gravityvalue); + else + sectors[secnum].gravity = gravityvalue; + + if (line->args[2] == TMF_ADD) + sectors[secnum].flags |= MSF_GRAVITYFLIP; + else if (line->args[2] == TMF_REMOVE) + sectors[secnum].flags &= ~MSF_GRAVITYFLIP; + } + } + break; + case 480: // Polyobj_DoorSlide case 481: // Polyobj_DoorSwing PolyDoor(line); break; case 482: // Polyobj_Move - case 483: // Polyobj_OR_Move PolyMove(line); break; case 484: // Polyobj_RotateRight - case 485: // Polyobj_OR_RotateRight - case 486: // Polyobj_RotateLeft - case 487: // Polyobj_OR_RotateLeft PolyRotate(line); break; case 488: // Polyobj_Waypoint PolyWaypoint(line); break; case 489: - PolyInvisible(line); - break; - case 490: - PolyVisible(line); + PolySetVisibilityTangibility(line); break; case 491: PolyTranslucency(line); @@ -3981,7 +3933,7 @@ boolean P_IsFlagAtBase(mobjtype_t flag) { thinker_t *think; mobj_t *mo; - INT32 specialnum = (flag == MT_REDFLAG) ? 3 : 4; + sectorspecialflags_t specialflag = (flag == MT_REDFLAG) ? SSF_REDTEAMBASE : SSF_BLUETEAMBASE; for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next) { @@ -3993,7 +3945,7 @@ boolean P_IsFlagAtBase(mobjtype_t flag) if (mo->type != flag) continue; - if (GETSECSPECIAL(mo->subsector->sector->special, 4) == specialnum) + if (mo->subsector->sector->specialflags & specialflag) return true; else if (mo->subsector->sector->ffloors) // Check the 3D floors { @@ -4004,7 +3956,7 @@ boolean P_IsFlagAtBase(mobjtype_t flag) if (!(rover->flags & FF_EXISTS)) continue; - if (GETSECSPECIAL(rover->master->frontsector->special, 4) != specialnum) + if (!(rover->master->frontsector->specialflags & specialflag)) continue; if (!(mo->z <= P_GetSpecialTopZ(mo, sectors + rover->secnum, mo->subsector->sector) @@ -4018,6 +3970,235 @@ boolean P_IsFlagAtBase(mobjtype_t flag) return false; } +static boolean P_IsMobjTouchingPlane(mobj_t *mo, sector_t *sec, fixed_t floorz, fixed_t ceilingz) +{ + boolean floorallowed = ((sec->flags & MSF_FLIPSPECIAL_FLOOR) && ((sec->flags & MSF_TRIGGERSPECIAL_HEADBUMP) || !(mo->eflags & MFE_VERTICALFLIP)) && (mo->z == floorz)); + boolean ceilingallowed = ((sec->flags & MSF_FLIPSPECIAL_CEILING) && ((sec->flags & MSF_TRIGGERSPECIAL_HEADBUMP) || (mo->eflags & MFE_VERTICALFLIP)) && (mo->z + mo->height == ceilingz)); + return (floorallowed || ceilingallowed); +} + +boolean P_IsMobjTouchingSectorPlane(mobj_t *mo, sector_t *sec) +{ + return P_IsMobjTouchingPlane(mo, sec, P_GetSpecialBottomZ(mo, sec, sec), P_GetSpecialTopZ(mo, sec, sec)); +} + +boolean P_IsMobjTouching3DFloor(mobj_t *mo, ffloor_t *ffloor, sector_t *sec) +{ + fixed_t topheight = P_GetSpecialTopZ(mo, sectors + ffloor->secnum, sec); + fixed_t bottomheight = P_GetSpecialBottomZ(mo, sectors + ffloor->secnum, sec); + + if (((ffloor->flags & FF_BLOCKPLAYER) && mo->player) + || ((ffloor->flags & FF_BLOCKOTHERS) && !mo->player)) + { + // Solid 3D floor: Mobj must touch the top or bottom + return P_IsMobjTouchingPlane(mo, ffloor->master->frontsector, topheight, bottomheight); + } + else + { + // Water or intangible 3D floor: Mobj must be inside + return mo->z <= topheight && (mo->z + mo->height) >= bottomheight; + } +} + +boolean P_IsMobjTouchingPolyobj(mobj_t *mo, polyobj_t *po, sector_t *polysec) +{ + if (!(po->flags & POF_TESTHEIGHT)) // Don't do height checking + return true; + + if (po->flags & POF_SOLID) + { + // Solid polyobject: Player must touch the top or bottom + return P_IsMobjTouchingPlane(mo, polysec, polysec->ceilingheight, polysec->floorheight); + } + else + { + // Water or intangible polyobject: Player must be inside + return mo->z <= polysec->ceilingheight && (mo->z + mo->height) >= polysec->floorheight; + } +} + +static sector_t *P_MobjTouching3DFloorSpecial(mobj_t *mo, sector_t *sector, INT32 section, INT32 number) +{ + ffloor_t *rover; + + for (rover = sector->ffloors; rover; rover = rover->next) + { + if (GETSECSPECIAL(rover->master->frontsector->special, section) != number) + continue; + + if (!(rover->flags & FF_EXISTS)) + continue; + + if (!P_IsMobjTouching3DFloor(mo, rover, sector)) + continue; + + // This FOF has the special we're looking for, but are we allowed to touch it? + if (sector == mo->subsector->sector + || (rover->master->frontsector->flags & MSF_TRIGGERSPECIAL_TOUCH)) + return rover->master->frontsector; + } + + return NULL; +} + +static sector_t *P_MobjTouching3DFloorSpecialFlag(mobj_t *mo, sector_t *sector, sectorspecialflags_t flag) +{ + ffloor_t *rover; + + for (rover = sector->ffloors; rover; rover = rover->next) + { + if (!(rover->master->frontsector->specialflags & flag)) + continue; + + if (!(rover->flags & FF_EXISTS)) + continue; + + if (!P_IsMobjTouching3DFloor(mo, rover, sector)) + continue; + + // This FOF has the special we're looking for, but are we allowed to touch it? + if (sector == mo->subsector->sector + || (rover->master->frontsector->flags & MSF_TRIGGERSPECIAL_TOUCH)) + return rover->master->frontsector; + } + + return NULL; +} + +static sector_t *P_MobjTouchingPolyobjSpecial(mobj_t *mo, INT32 section, INT32 number) +{ + polyobj_t *po; + sector_t *polysec; + boolean touching = false; + boolean inside = false; + + for (po = mo->subsector->polyList; po; po = (polyobj_t *)(po->link.next)) + { + if (po->flags & POF_NOSPECIALS) + continue; + + polysec = po->lines[0]->backsector; + + if (GETSECSPECIAL(polysec->special, section) != number) + continue; + + touching = (polysec->flags & MSF_TRIGGERSPECIAL_TOUCH) && P_MobjTouchingPolyobj(po, mo); + inside = P_MobjInsidePolyobj(po, mo); + + if (!(inside || touching)) + continue; + + if (!P_IsMobjTouchingPolyobj(mo, po, polysec)) + continue; + + return polysec; + } + + return NULL; +} + +static sector_t *P_MobjTouchingPolyobjSpecialFlag(mobj_t *mo, sectorspecialflags_t flag) +{ + polyobj_t *po; + sector_t *polysec; + boolean touching = false; + boolean inside = false; + + for (po = mo->subsector->polyList; po; po = (polyobj_t *)(po->link.next)) + { + if (po->flags & POF_NOSPECIALS) + continue; + + polysec = po->lines[0]->backsector; + + if (!(polysec->specialflags & flag)) + continue; + + touching = (polysec->flags & MSF_TRIGGERSPECIAL_TOUCH) && P_MobjTouchingPolyobj(po, mo); + inside = P_MobjInsidePolyobj(po, mo); + + if (!(inside || touching)) + continue; + + if (!P_IsMobjTouchingPolyobj(mo, po, polysec)) + continue; + + return polysec; + } + + return NULL; +} + +sector_t *P_MobjTouchingSectorSpecial(mobj_t *mo, INT32 section, INT32 number) +{ + msecnode_t *node; + sector_t *result; + + result = P_MobjTouching3DFloorSpecial(mo, mo->subsector->sector, section, number); + if (result) + return result; + + result = P_MobjTouchingPolyobjSpecial(mo, section, number); + if (result) + return result; + + if (GETSECSPECIAL(mo->subsector->sector->special, section) == number) + return mo->subsector->sector; + + for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next) + { + if (node->m_sector == mo->subsector->sector) // Don't duplicate + continue; + + result = P_MobjTouching3DFloorSpecial(mo, node->m_sector, section, number); + if (result) + return result; + + if (!(node->m_sector->flags & MSF_TRIGGERSPECIAL_TOUCH)) + continue; + + if (GETSECSPECIAL(node->m_sector->special, section) == number) + return node->m_sector; + } + + return NULL; +} + +sector_t *P_MobjTouchingSectorSpecialFlag(mobj_t *mo, sectorspecialflags_t flag) +{ + msecnode_t *node; + sector_t *result; + + result = P_MobjTouching3DFloorSpecialFlag(mo, mo->subsector->sector, flag); + if (result) + return result; + + result = P_MobjTouchingPolyobjSpecialFlag(mo, flag); + if (result) + return result; + + if (mo->subsector->sector->specialflags & flag) + return mo->subsector->sector; + + for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next) + { + if (node->m_sector == mo->subsector->sector) // Don't duplicate + continue; + + result = P_MobjTouching3DFloorSpecialFlag(mo, node->m_sector, flag); + if (result) + return result; + + if (!(node->m_sector->flags & MSF_TRIGGERSPECIAL_TOUCH)) + continue; + + if (node->m_sector->specialflags & flag) + return node->m_sector; + } + + return NULL; +} + // // P_PlayerTouchingSectorSpecial // @@ -4031,163 +4212,891 @@ boolean P_IsFlagAtBase(mobjtype_t flag) // sector_t *P_PlayerTouchingSectorSpecial(player_t *player, INT32 section, INT32 number) { - msecnode_t *node; - ffloor_t *rover; - if (!player->mo) return NULL; - // Check default case first - if (GETSECSPECIAL(player->mo->subsector->sector->special, section) == number) - return player->mo->subsector->sector; + return P_MobjTouchingSectorSpecial(player->mo, section, number); +} - // Hmm.. maybe there's a FOF that has it... - for (rover = player->mo->subsector->sector->ffloors; rover; rover = rover->next) +sector_t *P_PlayerTouchingSectorSpecialFlag(player_t *player, sectorspecialflags_t flag) +{ + if (!player->mo) + return NULL; + + return P_MobjTouchingSectorSpecialFlag(player->mo, flag); +} + +static sector_t *P_CheckPlayer3DFloorTrigger(player_t *player, sector_t *sector, line_t *sourceline) +{ + ffloor_t *rover; + + for (rover = sector->ffloors; rover; rover = rover->next) { - fixed_t topheight, bottomheight; + if (!rover->master->frontsector->triggertag) + continue; - if (GETSECSPECIAL(rover->master->frontsector->special, section) != number) + if (rover->master->frontsector->triggerer == TO_MOBJ) continue; if (!(rover->flags & FF_EXISTS)) continue; - topheight = P_GetSpecialTopZ(player->mo, sectors + rover->secnum, player->mo->subsector->sector); - bottomheight = P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, player->mo->subsector->sector); + if (!Tag_Find(&sourceline->tags, rover->master->frontsector->triggertag)) + continue; - // Check the 3D floor's type... - if (rover->flags & FF_BLOCKPLAYER) - { - boolean floorallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || !(player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z == topheight)); - boolean ceilingallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || (player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z + player->mo->height == bottomheight)); - // Thing must be on top of the floor to be affected... - if (!(floorallowed || ceilingallowed)) - continue; - } - else - { - // Water and DEATH FOG!!! heh - if (player->mo->z > topheight || (player->mo->z + player->mo->height) < bottomheight) - continue; - } + if (!P_IsMobjTouching3DFloor(player->mo, rover, sector)) + continue; - // This FOF has the special we're looking for! - return rover->master->frontsector; - } - - for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next) - { - if (GETSECSPECIAL(node->m_sector->special, section) == number) - { - // This sector has the special we're looking for, but - // are we allowed to touch it? - if (node->m_sector == player->mo->subsector->sector - || (node->m_sector->flags & SF_TRIGGERSPECIAL_TOUCH)) - return node->m_sector; - } - - // Hmm.. maybe there's a FOF that has it... - for (rover = node->m_sector->ffloors; rover; rover = rover->next) - { - fixed_t topheight, bottomheight; - - if (GETSECSPECIAL(rover->master->frontsector->special, section) != number) - continue; - - if (!(rover->flags & FF_EXISTS)) - continue; - - topheight = P_GetSpecialTopZ(player->mo, sectors + rover->secnum, player->mo->subsector->sector); - bottomheight = P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, player->mo->subsector->sector); - - // Check the 3D floor's type... - if (rover->flags & FF_BLOCKPLAYER) - { - boolean floorallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || !(player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z == topheight)); - boolean ceilingallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || (player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z + player->mo->height == bottomheight)); - // Thing must be on top of the floor to be affected... - if (!(floorallowed || ceilingallowed)) - continue; - } - else - { - // Water and DEATH FOG!!! heh - if (player->mo->z > topheight || (player->mo->z + player->mo->height) < bottomheight) - continue; - } - - // This FOF has the special we're looking for, but are we allowed to touch it? - if (node->m_sector == player->mo->subsector->sector - || (rover->master->frontsector->flags & SF_TRIGGERSPECIAL_TOUCH)) - return rover->master->frontsector; - } + // This FOF has the special we're looking for, but are we allowed to touch it? + if (sector == player->mo->subsector->sector + || (rover->master->frontsector->flags & MSF_TRIGGERSPECIAL_TOUCH)) + return rover->master->frontsector; } return NULL; } -// -// P_ThingIsOnThe3DFloor -// -// This checks whether the mobj is on/in the FOF we want it to be at -// Needed for the "All players" trigger sector specials only -// -static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *targetsec) +static sector_t *P_CheckPlayerPolyobjTrigger(player_t *player, line_t *sourceline) { - ffloor_t *rover; - fixed_t top, bottom; + polyobj_t *po; + sector_t *polysec; + boolean touching = false; + boolean inside = false; - if (!mo->player) // should NEVER happen - return false; - - if (!targetsec->ffloors) // also should NEVER happen - return false; - - for (rover = targetsec->ffloors; rover; rover = rover->next) + for (po = player->mo->subsector->polyList; po; po = (polyobj_t *)(po->link.next)) { - if (rover->master->frontsector != sector) + if (po->flags & POF_NOSPECIALS) continue; - // we're assuming the FOF existed when the first player touched it - //if (!(rover->flags & FF_EXISTS)) - // return false; + polysec = po->lines[0]->backsector; - top = P_GetSpecialTopZ(mo, sector, targetsec); - bottom = P_GetSpecialBottomZ(mo, sector, targetsec); + if (!polysec->triggertag) + continue; - // Check the 3D floor's type... - if (rover->flags & FF_BLOCKPLAYER) - { - boolean floorallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || !(mo->eflags & MFE_VERTICALFLIP)) && (mo->z == top)); - boolean ceilingallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || (mo->eflags & MFE_VERTICALFLIP)) && (mo->z + mo->height == bottom)); - // Thing must be on top of the floor to be affected... - if (!(floorallowed || ceilingallowed)) - continue; - } - else - { - // Water and intangible FOFs - if (mo->z > top || (mo->z + mo->height) < bottom) - return false; - } + if (polysec->triggerer == TO_MOBJ) + continue; - return true; + if (!Tag_Find(&sourceline->tags, polysec->triggertag)) + continue; + + touching = (polysec->flags & MSF_TRIGGERSPECIAL_TOUCH) && P_MobjTouchingPolyobj(po, player->mo); + inside = P_MobjInsidePolyobj(po, player->mo); + + if (!(inside || touching)) + continue; + + if (!P_IsMobjTouchingPolyobj(player->mo, po, polysec)) + continue; + + return polysec; + } + + return NULL; +} + +static boolean P_CheckPlayerSectorTrigger(player_t *player, sector_t *sector, line_t *sourceline) +{ + if (!sector->triggertag) + return false; + + if (sector->triggerer == TO_MOBJ) + return false; + + if (!Tag_Find(&sourceline->tags, sector->triggertag)) + return false; + + if (!(sector->flags & MSF_TRIGGERLINE_PLANE)) + return true; // Don't require plane touch + + return P_IsMobjTouchingSectorPlane(player->mo, sector); + +} + +sector_t *P_FindPlayerTrigger(player_t *player, line_t *sourceline) +{ + sector_t *originalsector; + sector_t *loopsector; + msecnode_t *node; + sector_t *caller; + + if (!player->mo) + return NULL; + + originalsector = player->mo->subsector->sector; + + caller = P_CheckPlayer3DFloorTrigger(player, originalsector, sourceline); // Handle FOFs first. + + if (caller) + return caller; + + // Allow sector specials to be applied to polyobjects! + caller = P_CheckPlayerPolyobjTrigger(player, sourceline); + + if (caller) + return caller; + + if (P_CheckPlayerSectorTrigger(player, originalsector, sourceline)) + return originalsector; + + // Iterate through touching_sectorlist for SF_TRIGGERSPECIAL_TOUCH + for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next) + { + loopsector = node->m_sector; + + if (loopsector == originalsector) // Don't duplicate + continue; + + // Check 3D floors... + caller = P_CheckPlayer3DFloorTrigger(player, loopsector, sourceline); // Handle FOFs first. + + if (caller) + return caller; + + if (!(loopsector->flags & MSF_TRIGGERSPECIAL_TOUCH)) + continue; + + if (P_CheckPlayerSectorTrigger(player, loopsector, sourceline)) + return loopsector; } return false; } -// -// P_MobjReadyToTrigger -// -// Is player standing on the sector's "ground"? -// -static boolean P_MobjReadyToTrigger(mobj_t *mo, sector_t *sec) +boolean P_IsPlayerValid(size_t playernum) { - boolean floorallowed = ((sec->flags & SF_FLIPSPECIAL_FLOOR) && ((sec->flags & SF_TRIGGERSPECIAL_HEADBUMP) || !(mo->eflags & MFE_VERTICALFLIP)) && (mo->z == P_GetSpecialBottomZ(mo, sec, sec))); - boolean ceilingallowed = ((sec->flags & SF_FLIPSPECIAL_CEILING) && ((sec->flags & SF_TRIGGERSPECIAL_HEADBUMP) || (mo->eflags & MFE_VERTICALFLIP)) && (mo->z + mo->height == P_GetSpecialTopZ(mo, sec, sec))); - // Thing must be on top of the floor to be affected... - return (floorallowed || ceilingallowed); + if (!playeringame[playernum]) + return false; + + if (!players[playernum].mo) + return false; + + if (players[playernum].mo->health <= 0) + return false; + + if (players[playernum].spectator) + return false; + + return true; +} + +boolean P_CanPlayerTrigger(size_t playernum) +{ + return P_IsPlayerValid(playernum) && !players[playernum].bot; +} + +/// \todo check continues for proper splitscreen support? +static boolean P_DoAllPlayersTrigger(mtag_t triggertag) +{ + INT32 i; + line_t dummyline; + dummyline.tags.count = 1; + dummyline.tags.tags = &triggertag; + + for (i = 0; i < MAXPLAYERS; i++) + { + if (!P_CanPlayerTrigger(i)) + continue; + if (!P_FindPlayerTrigger(&players[i], &dummyline)) + return false; + } + + return true; +} + +static void P_ProcessEggCapsule(player_t *player, sector_t *sector) +{ + thinker_t *th; + mobj_t *mo2; + INT32 i; + + if (player->bot || sector->ceilingdata || sector->floordata) + return; + + // Find the center of the Eggtrap and release all the pretty animals! + // The chimps are my friends.. heeheeheheehehee..... - LouisJM + for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) + { + if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + continue; + mo2 = (mobj_t *)th; + if (mo2->type != MT_EGGTRAP) + continue; + P_KillMobj(mo2, NULL, player->mo, 0); + } + + // clear the special so you can't push the button twice. + sector->special = 0; + + // Move the button down + EV_DoElevator(LE_CAPSULE0, NULL, elevateDown); + + // Open the top FOF + EV_DoFloor(LE_CAPSULE1, NULL, raiseFloorToNearestFast); + // Open the bottom FOF + EV_DoCeiling(LE_CAPSULE2, NULL, lowerToLowestFast); + + // Mark all players with the time to exit thingy! + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i]) + continue; + P_DoPlayerExit(&players[i]); + } +} + +static void P_ProcessSpeedPad(player_t *player, sector_t *sector, sector_t *roversector, mtag_t sectag) +{ + INT32 lineindex = -1; + angle_t lineangle; + fixed_t linespeed; + fixed_t sfxnum; + size_t i; + + if (player->powers[pw_flashing] != 0 && player->powers[pw_flashing] < TICRATE/2) + return; + + // Try for lines facing the sector itself, with tag 0. + for (i = 0; i < sector->linecount; i++) + { + line_t *li = sector->lines[i]; + + if (li->frontsector != sector) + continue; + + if (li->special != 4) + continue; + + if (!Tag_Find(&li->tags, 0)) + continue; + + lineindex = li - lines; + break; + } + + // Nothing found? Look via tag. + if (lineindex == -1) + lineindex = Tag_FindLineSpecial(4, sectag); + + if (lineindex == -1) + { + CONS_Debug(DBG_GAMELOGIC, "ERROR: Speed pad missing line special #4.\n"); + return; + } + + lineangle = R_PointToAngle2(lines[lineindex].v1->x, lines[lineindex].v1->y, lines[lineindex].v2->x, lines[lineindex].v2->y); + linespeed = lines[lineindex].args[0] << FRACBITS; + + if (linespeed == 0) + { + CONS_Debug(DBG_GAMELOGIC, "ERROR: Speed pad (tag %d) at zero speed.\n", sectag); + return; + } + + player->mo->angle = player->drawangle = lineangle; + + if (!demoplayback || P_ControlStyle(player) == CS_LMAOGALOG) + P_SetPlayerAngle(player, player->mo->angle); + + if (!(lines[lineindex].args[1] & TMSP_NOTELEPORT)) + { + P_UnsetThingPosition(player->mo); + if (roversector) // make FOF speed pads work + { + player->mo->x = roversector->soundorg.x; + player->mo->y = roversector->soundorg.y; + } + else + { + player->mo->x = sector->soundorg.x; + player->mo->y = sector->soundorg.y; + } + P_SetThingPosition(player->mo); + } + + P_InstaThrust(player->mo, player->mo->angle, linespeed); + + if (lines[lineindex].args[1] & TMSP_FORCESPIN) // Roll! + { + if (!(player->pflags & PF_SPINNING)) + player->pflags |= PF_SPINNING; + + P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); + } + + player->powers[pw_flashing] = TICRATE/3; + + sfxnum = lines[lineindex].stringargs[0] ? get_number(lines[lineindex].stringargs[0]) : sfx_spdpad; + + if (!sfxnum) + sfxnum = sfx_spdpad; + + S_StartSound(player->mo, sfxnum); +} + +static void P_ProcessSpecialStagePit(player_t* player) +{ + if (!(gametyperules & GTR_ALLOWEXIT)) + return; + + if (player->bot) + return; + + if (!G_IsSpecialStage(gamemap)) + return; + + if (maptol & TOL_NIGHTS) + return; + + if (player->nightstime <= 6) + return; + + player->nightstime = 6; // Just let P_Ticker take care of the rest. +} + +static void P_ProcessExitSector(player_t *player, mtag_t sectag) +{ + INT32 lineindex; + + if (!(gametyperules & GTR_ALLOWEXIT)) + return; + + if (player->bot) + return; + + // Exit (for FOF exits; others are handled in P_PlayerThink in p_user.c) + P_DoPlayerFinish(player); + + P_SetupSignExit(player); + + if (!G_CoopGametype()) + return; + + // Custom exit! + // important: use sectag on next line instead of player->mo->subsector->tag + // this part is different from in P_PlayerThink, this is what was causing + // FOF custom exits not to work. + lineindex = Tag_FindLineSpecial(2, sectag); + + if (lineindex == -1) + { + CONS_Debug(DBG_GAMELOGIC, "ERROR: Exit sector missing line special #2.\n"); + return; + } + + // Special goodies depending on emeralds collected + if ((lines[lineindex].args[1] & TMEF_EMERALDCHECK) && ALL7EMERALDS(emeralds)) + nextmapoverride = (INT16)(udmf ? lines[lineindex].args[2] : lines[lineindex].frontsector->ceilingheight>>FRACBITS); + else + nextmapoverride = (INT16)(udmf ? lines[lineindex].args[0] : lines[lineindex].frontsector->floorheight>>FRACBITS); + + if (lines[lineindex].args[1] & TMEF_SKIPTALLY) + skipstats = 1; +} + +static void P_ProcessTeamBase(player_t *player, boolean redteam) +{ + mobj_t *mo; + + if (!(gametyperules & GTR_TEAMFLAGS)) + return; + + if (!P_IsObjectOnGround(player->mo)) + return; + + if (player->ctfteam != (redteam ? 1 : 2)) + return; + + if (!(player->gotflag & (redteam ? GF_BLUEFLAG : GF_REDFLAG))) + return; + + // Make sure the team still has their own + // flag at their base so they can score. + if (!P_IsFlagAtBase(redteam ? MT_BLUEFLAG : MT_REDFLAG)) + return; + + HU_SetCEchoFlags(V_AUTOFADEOUT|V_ALLOWLOWERCASE); + HU_SetCEchoDuration(5); + HU_DoCEcho(va(M_GetText("%s%s\200\\CAPTURED THE %s%s FLAG\200.\\\\\\\\"), redteam ? "\205" : "\204", player_names[player-players], redteam ? "\204" : "\205", redteam ? "BLUE" : "RED")); + + if (splitscreen || players[consoleplayer].ctfteam == (redteam ? 1 : 2)) + S_StartSound(NULL, sfx_flgcap); + else if (players[consoleplayer].ctfteam == (redteam ? 2 : 1)) + S_StartSound(NULL, sfx_lose); + + mo = P_SpawnMobj(player->mo->x,player->mo->y,player->mo->z, redteam ? MT_BLUEFLAG : MT_REDFLAG); + player->gotflag &= ~(redteam ? GF_BLUEFLAG : GF_REDFLAG); + mo->flags &= ~MF_SPECIAL; + mo->fuse = TICRATE; + mo->spawnpoint = redteam ? bflagpoint : rflagpoint; + mo->flags2 |= MF2_JUSTATTACKED; + if (redteam) + redscore += 1; + else + bluescore += 1; + P_AddPlayerScore(player, 250); +} + +static void P_ProcessZoomTube(player_t *player, mtag_t sectag, boolean end) +{ + INT32 sequence; + fixed_t speed; + INT32 lineindex; + mobj_t *waypoint = NULL; + angle_t an; + + if (player->mo->tracer && player->mo->tracer->type == MT_TUBEWAYPOINT && player->powers[pw_carry] == CR_ZOOMTUBE) + return; + + if (player->powers[pw_ignorelatch] & (1<<15)) + return; + + // Find line #3 tagged to this sector + lineindex = Tag_FindLineSpecial(3, sectag); + + if (lineindex == -1) + { + CONS_Debug(DBG_GAMELOGIC, "ERROR: Zoom tube missing line special #3.\n"); + return; + } + + // Grab speed and sequence values + speed = abs(lines[lineindex].args[0])<<(FRACBITS-3); + if (end) + speed *= -1; + sequence = abs(lines[lineindex].args[1]); + + if (speed == 0) + { + CONS_Debug(DBG_GAMELOGIC, "ERROR: Waypoint sequence %d at zero speed.\n", sequence); + return; + } + + waypoint = end ? P_GetLastWaypoint(sequence) : P_GetFirstWaypoint(sequence); + + if (!waypoint) + { + CONS_Debug(DBG_GAMELOGIC, "ERROR: %s WAYPOINT IN SEQUENCE %d NOT FOUND.\n", end ? "LAST" : "FIRST", sequence); + return; + } + + CONS_Debug(DBG_GAMELOGIC, "Waypoint %d found in sequence %d - speed = %d\n", waypoint->health, sequence, speed); + + an = R_PointToAngle2(player->mo->x, player->mo->y, waypoint->x, waypoint->y) - player->mo->angle; + + if (an > ANGLE_90 && an < ANGLE_270 && !(lines[lineindex].args[2])) + return; // behind back + + P_SetTarget(&player->mo->tracer, waypoint); + player->powers[pw_carry] = CR_ZOOMTUBE; + player->speed = speed; + player->pflags |= PF_SPINNING; + player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_GLIDING|PF_BOUNCING|PF_SLIDING|PF_CANCARRY); + player->climbing = 0; + + if (player->mo->state-states != S_PLAY_ROLL) + { + P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); + S_StartSound(player->mo, sfx_spin); + } +} + +static void P_ProcessFinishLine(player_t *player) +{ + if ((gametyperules & (GTR_RACE|GTR_LIVES)) != GTR_RACE) + return; + + if (player->exiting) + return; + + if (player->starpostnum == numstarposts) // Must have touched all the starposts + { + player->laps++; + + if (player->powers[pw_carry] == CR_NIGHTSMODE) + player->drillmeter += 48*20; + + if (player->laps >= (UINT8)cv_numlaps.value) + CONS_Printf(M_GetText("%s has finished the race.\n"), player_names[player-players]); + else if (player->laps == (UINT8)cv_numlaps.value-1) + CONS_Printf(M_GetText("%s started the \205final lap\200!\n"), player_names[player-players]); + else + CONS_Printf(M_GetText("%s started lap %u\n"), player_names[player-players], (UINT32)player->laps+1); + + // Reset starposts (checkpoints) info + player->starpostscale = player->starpostangle = player->starposttime = player->starpostnum = 0; + player->starpostx = player->starposty = player->starpostz = 0; + P_ResetStarposts(); + + // Play the starpost sound for 'consistency' + S_StartSound(player->mo, sfx_strpst); + } + else if (player->starpostnum) + { + // blatant reuse of a variable that's normally unused in circuit + if (!player->tossdelay) + S_StartSound(player->mo, sfx_lose); + player->tossdelay = 3; + } + + if (player->laps >= (unsigned)cv_numlaps.value) + { + if (P_IsLocalPlayer(player)) + { + HU_SetCEchoFlags(0); + HU_SetCEchoDuration(5); + HU_DoCEcho("FINISHED!"); + } + + P_DoPlayerExit(player); + } +} + +static void P_ProcessRopeHang(player_t *player, mtag_t sectag) +{ + INT32 sequence; + fixed_t speed; + INT32 lineindex; + mobj_t *waypointmid = NULL; + mobj_t *waypointhigh = NULL; + mobj_t *waypointlow = NULL; + mobj_t *closest = NULL; + vector3_t p, line[2], resulthigh, resultlow; + + if (player->mo->tracer && player->mo->tracer->type == MT_TUBEWAYPOINT && player->powers[pw_carry] == CR_ROPEHANG) + return; + + if (player->powers[pw_ignorelatch] & (1<<15)) + return; + + if (player->mo->momz > 0) + return; + + if (player->cmd.buttons & BT_SPIN) + return; + + if (!(player->pflags & PF_SLIDING) && player->mo->state == &states[player->mo->info->painstate]) + return; + + if (player->exiting) + return; + + //initialize resulthigh and resultlow with 0 + memset(&resultlow, 0x00, sizeof(resultlow)); + memset(&resulthigh, 0x00, sizeof(resulthigh)); + + // Find line #11 tagged to this sector + lineindex = Tag_FindLineSpecial(11, sectag); + + if (lineindex == -1) + { + CONS_Debug(DBG_GAMELOGIC, "ERROR: Rope hang missing line special #11.\n"); + return; + } + + // Grab speed and sequence values + speed = abs(lines[lineindex].args[0]) << (FRACBITS - 3); + sequence = abs(lines[lineindex].args[1]); + + // Find the closest waypoint + // Find the preceding waypoint + // Find the proceeding waypoint + // Determine the closest spot on the line between the three waypoints + // Put player at that location. + + waypointmid = P_GetClosestWaypoint(sequence, player->mo); + + if (!waypointmid) + { + CONS_Debug(DBG_GAMELOGIC, "ERROR: WAYPOINT(S) IN SEQUENCE %d NOT FOUND.\n", sequence); + return; + } + + waypointlow = P_GetPreviousWaypoint(waypointmid, true); + waypointhigh = P_GetNextWaypoint(waypointmid, true); + + CONS_Debug(DBG_GAMELOGIC, "WaypointMid: %d; WaypointLow: %d; WaypointHigh: %d\n", + waypointmid->health, waypointlow ? waypointlow->health : -1, waypointhigh ? waypointhigh->health : -1); + + // Now we have three waypoints... the closest one we're near, and the one that comes before, and after. + // Next, we need to find the closest point on the line between each set, and determine which one we're + // closest to. + + p.x = player->mo->x; + p.y = player->mo->y; + p.z = player->mo->z; + + // Waypointmid and Waypointlow: + if (waypointlow) + { + line[0].x = waypointmid->x; + line[0].y = waypointmid->y; + line[0].z = waypointmid->z; + line[1].x = waypointlow->x; + line[1].y = waypointlow->y; + line[1].z = waypointlow->z; + + P_ClosestPointOnLine3D(&p, line, &resultlow); + } + + // Waypointmid and Waypointhigh: + if (waypointhigh) + { + line[0].x = waypointmid->x; + line[0].y = waypointmid->y; + line[0].z = waypointmid->z; + line[1].x = waypointhigh->x; + line[1].y = waypointhigh->y; + line[1].z = waypointhigh->z; + + P_ClosestPointOnLine3D(&p, line, &resulthigh); + } + + // 3D support now available. Disregard the previous notice here. -Red + + P_UnsetThingPosition(player->mo); + P_ResetPlayer(player); + player->mo->momx = player->mo->momy = player->mo->momz = 0; + + if (lines[lineindex].args[2]) // Don't wrap + { + mobj_t *highest = P_GetLastWaypoint(sequence); + highest->flags |= MF_SLIDEME; + } + + // Changing the conditions on these ifs to fix issues with snapping to the wrong spot -Red + if ((lines[lineindex].args[2]) && waypointmid->health == 0) + { + closest = waypointhigh; + player->mo->x = resulthigh.x; + player->mo->y = resulthigh.y; + player->mo->z = resulthigh.z - P_GetPlayerHeight(player); + } + else if ((lines[lineindex].args[2]) && waypointmid->health == numwaypoints[sequence] - 1) + { + closest = waypointmid; + player->mo->x = resultlow.x; + player->mo->y = resultlow.y; + player->mo->z = resultlow.z - P_GetPlayerHeight(player); + } + else + { + if (P_AproxDistance(P_AproxDistance(player->mo->x-resultlow.x, player->mo->y-resultlow.y), + player->mo->z-resultlow.z) < P_AproxDistance(P_AproxDistance(player->mo->x-resulthigh.x, + player->mo->y-resulthigh.y), player->mo->z-resulthigh.z)) + { + // Line between Mid and Low is closer + closest = waypointmid; + player->mo->x = resultlow.x; + player->mo->y = resultlow.y; + player->mo->z = resultlow.z - P_GetPlayerHeight(player); + } + else + { + // Line between Mid and High is closer + closest = waypointhigh; + player->mo->x = resulthigh.x; + player->mo->y = resulthigh.y; + player->mo->z = resulthigh.z - P_GetPlayerHeight(player); + } + } + + P_SetTarget(&player->mo->tracer, closest); + player->powers[pw_carry] = CR_ROPEHANG; + player->speed = speed; + + S_StartSound(player->mo, sfx_s3k4a); + + player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_GLIDING|PF_BOUNCING|PF_SLIDING|PF_CANCARRY); + player->climbing = 0; + P_SetThingPosition(player->mo); + P_SetPlayerMobjState(player->mo, S_PLAY_RIDE); +} + +static boolean P_SectorHasSpecial(sector_t *sec) +{ + if (sec->specialflags) + return true; + + if (sec->damagetype != SD_NONE) + return true; + + if (sec->triggertag) + return true; + + if (sec->special) + return true; + + return false; +} + +static void P_EvaluateSpecialFlags(player_t *player, sector_t *sector, sector_t *roversector, boolean isTouching) +{ + mtag_t sectag = Tag_FGet(§or->tags); + + if (sector->specialflags & SSF_OUTERSPACE) + { + if (!(player->powers[pw_shield] & SH_PROTECTWATER) && !player->powers[pw_spacetime]) + player->powers[pw_spacetime] = spacetimetics + 1; + } + if (sector->specialflags & SSF_WINDCURRENT) + player->onconveyor = 2; + if (sector->specialflags & SSF_CONVEYOR) + player->onconveyor = 4; + if ((sector->specialflags & SSF_SPEEDPAD) && isTouching) + P_ProcessSpeedPad(player, sector, roversector, sectag); + if (sector->specialflags & SSF_STARPOSTACTIVATOR) + { + mobj_t *post = P_GetObjectTypeInSectorNum(MT_STARPOST, sector - sectors); + if (post) + P_TouchStarPost(post, player, false); + } + if (sector->specialflags & SSF_EXIT) + P_ProcessExitSector(player, sectag); + if ((sector->specialflags & SSF_SPECIALSTAGEPIT) && isTouching) + P_ProcessSpecialStagePit(player); + if ((sector->specialflags & SSF_REDTEAMBASE) && isTouching) + P_ProcessTeamBase(player, true); + if ((sector->specialflags & SSF_BLUETEAMBASE) && isTouching) + P_ProcessTeamBase(player, false); + if (sector->specialflags & SSF_FAN) + { + player->mo->momz += mobjinfo[MT_FAN].mass/4; + + if (player->mo->momz > mobjinfo[MT_FAN].mass) + player->mo->momz = mobjinfo[MT_FAN].mass; + + P_ResetPlayer(player); + if (player->panim != PA_FALL) + P_SetPlayerMobjState(player->mo, S_PLAY_FALL); + } + if (sector->specialflags & SSF_SUPERTRANSFORM) + { + if (player->mo->health > 0 && !player->bot && (player->charflags & SF_SUPER) && !player->powers[pw_super] && ALL7EMERALDS(emeralds)) + P_DoSuperTransformation(player, true); + } + if ((sector->specialflags & SSF_FORCESPIN) && isTouching) + { + if (!(player->pflags & PF_SPINNING)) + { + player->pflags |= PF_SPINNING; + P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); + S_StartAttackSound(player->mo, sfx_spin); + + if (abs(player->rmomx) < FixedMul(5*FRACUNIT, player->mo->scale) + && abs(player->rmomy) < FixedMul(5*FRACUNIT, player->mo->scale)) + P_InstaThrust(player->mo, player->mo->angle, FixedMul(10*FRACUNIT, player->mo->scale)); + } + } + if (sector->specialflags & SSF_ZOOMTUBESTART) + P_ProcessZoomTube(player, sectag, false); + if (sector->specialflags & SSF_ZOOMTUBEEND) + P_ProcessZoomTube(player, sectag, true); + if (sector->specialflags & SSF_FINISHLINE) + P_ProcessFinishLine(player); + if ((sector->specialflags & SSF_ROPEHANG) && isTouching) + P_ProcessRopeHang(player, sectag); +} + +static void P_EvaluateDamageType(player_t *player, sector_t *sector, boolean isTouching) +{ + switch (sector->damagetype) + { + case SD_GENERIC: + if (isTouching) + P_DamageMobj(player->mo, NULL, NULL, 1, 0); + break; + case SD_WATER: + if (isTouching && (player->powers[pw_underwater] || player->powers[pw_carry] == CR_NIGHTSMODE)) + P_DamageMobj(player->mo, NULL, NULL, 1, DMG_WATER); + break; + case SD_FIRE: + case SD_LAVA: + if (isTouching) + P_DamageMobj(player->mo, NULL, NULL, 1, DMG_FIRE); + break; + case SD_ELECTRIC: + if (isTouching) + P_DamageMobj(player->mo, NULL, NULL, 1, DMG_ELECTRIC); + break; + case SD_SPIKE: + if (isTouching) + P_DamageMobj(player->mo, NULL, NULL, 1, DMG_SPIKE); + break; + case SD_DEATHPITTILT: + case SD_DEATHPITNOTILT: + if (!isTouching) + break; + if (player->quittime) + G_MovePlayerToSpawnOrStarpost(player - players); + else + P_DamageMobj(player->mo, NULL, NULL, 1, DMG_DEATHPIT); + break; + case SD_INSTAKILL: + if (player->quittime) + G_MovePlayerToSpawnOrStarpost(player - players); + else + P_DamageMobj(player->mo, NULL, NULL, 1, DMG_INSTAKILL); + break; + case SD_SPECIALSTAGE: + if (!isTouching) + break; + + if (player->exiting || player->bot) // Don't do anything for bots or players who have just finished + break; + + if (!(player->powers[pw_shield] || player->spheres > 0)) // Don't do anything if no shield or spheres anyway + break; + + P_SpecialStageDamage(player, NULL, NULL); + break; + default: + break; + } +} + +static void P_EvaluateLinedefExecutorTrigger(player_t *player, sector_t *sector, boolean isTouching) +{ + if (player->bot) + return; + + if (!sector->triggertag) + return; + + if (sector->triggerer == TO_MOBJ) + return; + else if (sector->triggerer == TO_ALLPLAYERS && !P_DoAllPlayersTrigger(sector->triggertag)) + return; + + if ((sector->flags & MSF_TRIGGERLINE_PLANE) && !isTouching) + return; + + P_LinedefExecute(sector->triggertag, player->mo, sector); +} + +static void P_EvaluateOldSectorSpecial(player_t *player, sector_t *sector, sector_t *roversector, boolean isTouching) +{ + switch (GETSECSPECIAL(sector->special, 1)) + { + case 9: // Ring Drainer (Floor Touch) + if (!isTouching) + break; + /* FALLTHRU */ + case 10: // Ring Drainer (No Floor Touch) + if (leveltime % (TICRATE/2) == 0 && player->rings > 0) + { + player->rings--; + S_StartSound(player->mo, sfx_antiri); + } + break; + } + + switch (GETSECSPECIAL(sector->special, 2)) + { + case 9: // Egg trap capsule + if (roversector) + P_ProcessEggCapsule(player, sector); + break; + } } /** Applies a sector special to a player. @@ -4196,20 +5105,14 @@ static boolean P_MobjReadyToTrigger(mobj_t *mo, sector_t *sec) * \param sector Sector with the special. * \param roversector If !NULL, sector is actually an FOF; otherwise, sector * is being physically contacted by the player. - * \todo Split up into multiple functions. * \sa P_PlayerInSpecialSector, P_PlayerOnSpecial3DFloor */ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *roversector) { - INT32 i = 0; - INT32 section1, section2, section3, section4; - INT32 special; - mtag_t sectag = Tag_FGet(§or->tags); + boolean isTouching; - section1 = GETSECSPECIAL(sector->special, 1); - section2 = GETSECSPECIAL(sector->special, 2); - section3 = GETSECSPECIAL(sector->special, 3); - section4 = GETSECSPECIAL(sector->special, 4); + if (!P_SectorHasSpecial(sector)) + return; // Ignore spectators if (player->spectator) @@ -4221,847 +5124,17 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers if (player->playerstate != PST_LIVE) return; - // Conveyor stuff - if (section3 == 2 || section3 == 4) - player->onconveyor = section3; + isTouching = roversector || P_IsMobjTouchingSectorPlane(player->mo, sector); - special = section1; + P_EvaluateSpecialFlags(player, sector, roversector, isTouching); + P_EvaluateDamageType(player, sector, isTouching); + P_EvaluateLinedefExecutorTrigger(player, sector, isTouching); - // Process Section 1 - switch (special) - { - case 1: // Damage (Generic) - if (roversector || P_MobjReadyToTrigger(player->mo, sector)) - P_DamageMobj(player->mo, NULL, NULL, 1, 0); - break; - case 2: // Damage (Water) - if ((roversector || P_MobjReadyToTrigger(player->mo, sector)) && (player->powers[pw_underwater] || player->powers[pw_carry] == CR_NIGHTSMODE)) - P_DamageMobj(player->mo, NULL, NULL, 1, DMG_WATER); - break; - case 3: // Damage (Fire) - if (roversector || P_MobjReadyToTrigger(player->mo, sector)) - P_DamageMobj(player->mo, NULL, NULL, 1, DMG_FIRE); - break; - case 4: // Damage (Electrical) - if (roversector || P_MobjReadyToTrigger(player->mo, sector)) - P_DamageMobj(player->mo, NULL, NULL, 1, DMG_ELECTRIC); - break; - case 5: // Spikes - if (roversector || P_MobjReadyToTrigger(player->mo, sector)) - P_DamageMobj(player->mo, NULL, NULL, 1, DMG_SPIKE); - break; - case 6: // Death Pit (Camera Mod) - case 7: // Death Pit (No Camera Mod) - if (roversector || P_MobjReadyToTrigger(player->mo, sector)) - { - if (player->quittime) - G_MovePlayerToSpawnOrStarpost(player - players); - else - P_DamageMobj(player->mo, NULL, NULL, 1, DMG_DEATHPIT); - } - break; - case 8: // Instant Kill - if (player->quittime) - G_MovePlayerToSpawnOrStarpost(player - players); - else - P_DamageMobj(player->mo, NULL, NULL, 1, DMG_INSTAKILL); - break; - case 9: // Ring Drainer (Floor Touch) - case 10: // Ring Drainer (No Floor Touch) - if (leveltime % (TICRATE/2) == 0 && player->rings > 0) - { - player->rings--; - S_StartSound(player->mo, sfx_antiri); - } - break; - case 11: // Special Stage Damage - if (player->exiting || player->bot) // Don't do anything for bots or players who have just finished - break; - - if (!(player->powers[pw_shield] || player->spheres > 0)) // Don't do anything if no shield or spheres anyway - break; - - P_SpecialStageDamage(player, NULL, NULL); - break; - case 12: // Space Countdown - if (!(player->powers[pw_shield] & SH_PROTECTWATER) && !player->powers[pw_spacetime]) - player->powers[pw_spacetime] = spacetimetics + 1; - break; - case 13: // Ramp Sector (Increase step-up/down) - case 14: // Non-Ramp Sector (Don't step-down) - case 15: // Bouncy Sector (FOF Control Only) - break; - } - - special = section2; - - // Process Section 2 - switch (special) - { - case 1: // Trigger Linedef Exec (Pushable Objects) - break; - case 2: // Linedef executor requires all players present+doesn't require touching floor - case 3: // Linedef executor requires all players present - /// \todo check continues for proper splitscreen support? - for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i]) - continue; - if (!players[i].mo) - continue; - if (players[i].spectator) - continue; - if (players[i].bot) - continue; - if (G_CoopGametype() && players[i].lives <= 0) - continue; - if (roversector) - { - if (sector->flags & SF_TRIGGERSPECIAL_TOUCH) - { - msecnode_t *node; - for (node = players[i].mo->touching_sectorlist; node; node = node->m_sectorlist_next) - { - if (P_ThingIsOnThe3DFloor(players[i].mo, sector, node->m_sector)) - break; - } - if (!node) - goto DoneSection2; - } - else if (players[i].mo->subsector && !P_ThingIsOnThe3DFloor(players[i].mo, sector, players[i].mo->subsector->sector)) // this function handles basically everything for us lmao - goto DoneSection2; - } - else - { - if (players[i].mo->subsector->sector == sector) - ; - else if (sector->flags & SF_TRIGGERSPECIAL_TOUCH) - { - msecnode_t *node; - for (node = players[i].mo->touching_sectorlist; node; node = node->m_sectorlist_next) - { - if (node->m_sector == sector) - break; - } - if (!node) - goto DoneSection2; - } - else - goto DoneSection2; - - if (special == 3 && !P_MobjReadyToTrigger(players[i].mo, sector)) - goto DoneSection2; - } - } - /* FALLTHRU */ - case 4: // Linedef executor that doesn't require touching floor - case 5: // Linedef executor - case 6: // Linedef executor (7 Emeralds) - case 7: // Linedef executor (NiGHTS Mare) - if (!player->bot) - P_LinedefExecute(sectag, player->mo, sector); - break; - case 8: // Tells pushable things to check FOFs - break; - case 9: // Egg trap capsule - { - thinker_t *th; - mobj_t *mo2; - line_t junk; - - if (player->bot || sector->ceilingdata || sector->floordata) - return; - - // Find the center of the Eggtrap and release all the pretty animals! - // The chimps are my friends.. heeheeheheehehee..... - LouisJM - for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) - { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) - continue; - mo2 = (mobj_t *)th; - if (mo2->type != MT_EGGTRAP) - continue; - P_KillMobj(mo2, NULL, player->mo, 0); - } - - // clear the special so you can't push the button twice. - sector->special = 0; - - // Initialize my junk - junk.tags.tags = NULL; - junk.tags.count = 0; - - // Move the button down - Tag_FSet(&junk.tags, LE_CAPSULE0); - EV_DoElevator(&junk, elevateDown, false); - - // Open the top FOF - Tag_FSet(&junk.tags, LE_CAPSULE1); - EV_DoFloor(&junk, raiseFloorToNearestFast); - // Open the bottom FOF - Tag_FSet(&junk.tags, LE_CAPSULE2); - EV_DoCeiling(&junk, lowerToLowestFast); - - // Mark all players with the time to exit thingy! - for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i]) - continue; - P_DoPlayerExit(&players[i]); - } - break; - } - case 10: // Special Stage Time/Rings - case 11: // Custom Gravity - break; - case 12: // Lua sector special - break; - } -DoneSection2: - - special = section3; - - // Process Section 3 - switch (special) - { - case 1: // Unused - case 2: // Wind/Current - case 3: // Unused - case 4: // Conveyor Belt - break; - - case 5: // Speed pad - if (player->powers[pw_flashing] != 0 && player->powers[pw_flashing] < TICRATE/2) - break; - - i = Tag_FindLineSpecial(4, sectag); - - if (i != -1) - { - angle_t lineangle; - fixed_t linespeed; - fixed_t sfxnum; - - lineangle = R_PointToAngle2(lines[i].v1->x, lines[i].v1->y, lines[i].v2->x, lines[i].v2->y); - linespeed = sides[lines[i].sidenum[0]].textureoffset; - - if (linespeed == 0) - { - CONS_Debug(DBG_GAMELOGIC, "ERROR: Speed pad (tag %d) at zero speed.\n", sectag); - break; - } - - player->mo->angle = player->drawangle = lineangle; - - if (!demoplayback || P_ControlStyle(player) == CS_LMAOGALOG) - P_SetPlayerAngle(player, player->mo->angle); - - if (!(lines[i].flags & ML_EFFECT4)) - { - P_UnsetThingPosition(player->mo); - if (roversector) // make FOF speed pads work - { - player->mo->x = roversector->soundorg.x; - player->mo->y = roversector->soundorg.y; - } - else - { - player->mo->x = sector->soundorg.x; - player->mo->y = sector->soundorg.y; - } - P_SetThingPosition(player->mo); - } - - P_InstaThrust(player->mo, player->mo->angle, linespeed); - - if (lines[i].flags & ML_EFFECT5) // Roll! - { - if (!(player->pflags & PF_SPINNING)) - player->pflags |= PF_SPINNING; - - P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); - } - - player->powers[pw_flashing] = TICRATE/3; - - sfxnum = sides[lines[i].sidenum[0]].toptexture; - - if (!sfxnum) - sfxnum = sfx_spdpad; - - S_StartSound(player->mo, sfxnum); - } - break; - - case 6: // Unused - case 7: // Unused - case 8: // Unused - case 9: // Unused - case 10: // Unused - case 11: // Unused - case 12: // Unused - case 13: // Unused - case 14: // Unused - case 15: // Unused - break; - } - - special = section4; - - // Process Section 4 - switch (special) - { - case 1: // Starpost Activator - { - mobj_t *post = P_GetObjectTypeInSectorNum(MT_STARPOST, sector - sectors); - - if (!post) - break; - - P_TouchStarPost(post, player, false); - break; - } - - case 2: // Special stage GOAL sector / Exit Sector / CTF Flag Return - if (player->bot || !(gametyperules & GTR_ALLOWEXIT)) - break; - if (!(maptol & TOL_NIGHTS) && G_IsSpecialStage(gamemap) && player->nightstime > 6) - { - player->nightstime = 6; // Just let P_Ticker take care of the rest. - return; - } - - // Exit (for FOF exits; others are handled in P_PlayerThink in p_user.c) - { - INT32 lineindex; - - P_DoPlayerFinish(player); - - P_SetupSignExit(player); - // important: use sector->tag on next line instead of player->mo->subsector->tag - // this part is different from in P_PlayerThink, this is what was causing - // FOF custom exits not to work. - lineindex = Tag_FindLineSpecial(2, sectag); - - if (G_CoopGametype() && lineindex != -1) // Custom exit! - { - // Special goodies with the block monsters flag depending on emeralds collected - if ((lines[lineindex].flags & ML_BLOCKMONSTERS) && ALL7EMERALDS(emeralds)) - nextmapoverride = (INT16)(lines[lineindex].frontsector->ceilingheight>>FRACBITS); - else - nextmapoverride = (INT16)(lines[lineindex].frontsector->floorheight>>FRACBITS); - - if (lines[lineindex].flags & ML_NOCLIMB) - skipstats = 1; - } - } - break; - - case 3: // Red Team's Base - if ((gametyperules & GTR_TEAMFLAGS) && P_IsObjectOnGround(player->mo)) - { - if (player->ctfteam == 1 && (player->gotflag & GF_BLUEFLAG)) - { - mobj_t *mo; - - // Make sure the red team still has their own - // flag at their base so they can score. - if (!P_IsFlagAtBase(MT_REDFLAG)) - break; - - HU_SetCEchoFlags(V_AUTOFADEOUT|V_ALLOWLOWERCASE); - HU_SetCEchoDuration(5); - HU_DoCEcho(va(M_GetText("\205%s\200\\CAPTURED THE \204BLUE FLAG\200.\\\\\\\\"), player_names[player-players])); - - if (splitscreen || players[consoleplayer].ctfteam == 1) - S_StartSound(NULL, sfx_flgcap); - else if (players[consoleplayer].ctfteam == 2) - S_StartSound(NULL, sfx_lose); - - mo = P_SpawnMobj(player->mo->x,player->mo->y,player->mo->z,MT_BLUEFLAG); - player->gotflag &= ~GF_BLUEFLAG; - mo->flags &= ~MF_SPECIAL; - mo->fuse = TICRATE; - mo->spawnpoint = bflagpoint; - mo->flags2 |= MF2_JUSTATTACKED; - redscore += 1; - P_AddPlayerScore(player, 250); - } - } - break; - - case 4: // Blue Team's Base - if ((gametyperules & GTR_TEAMFLAGS) && P_IsObjectOnGround(player->mo)) - { - if (player->ctfteam == 2 && (player->gotflag & GF_REDFLAG)) - { - mobj_t *mo; - - // Make sure the blue team still has their own - // flag at their base so they can score. - if (!P_IsFlagAtBase(MT_BLUEFLAG)) - break; - - HU_SetCEchoFlags(V_AUTOFADEOUT|V_ALLOWLOWERCASE); - HU_SetCEchoDuration(5); - HU_DoCEcho(va(M_GetText("\204%s\200\\CAPTURED THE \205RED FLAG\200.\\\\\\\\"), player_names[player-players])); - - if (splitscreen || players[consoleplayer].ctfteam == 2) - S_StartSound(NULL, sfx_flgcap); - else if (players[consoleplayer].ctfteam == 1) - S_StartSound(NULL, sfx_lose); - - mo = P_SpawnMobj(player->mo->x,player->mo->y,player->mo->z,MT_REDFLAG); - player->gotflag &= ~GF_REDFLAG; - mo->flags &= ~MF_SPECIAL; - mo->fuse = TICRATE; - mo->spawnpoint = rflagpoint; - mo->flags2 |= MF2_JUSTATTACKED; - bluescore += 1; - P_AddPlayerScore(player, 250); - } - } - break; - - case 5: // Fan sector - player->mo->momz += mobjinfo[MT_FAN].mass/4; - - if (player->mo->momz > mobjinfo[MT_FAN].mass) - player->mo->momz = mobjinfo[MT_FAN].mass; - - P_ResetPlayer(player); - if (player->panim != PA_FALL) - P_SetPlayerMobjState(player->mo, S_PLAY_FALL); - break; - - case 6: // Super Sonic transformer - if (player->mo->health > 0 && !player->bot && (player->charflags & SF_SUPER) && !player->powers[pw_super] && ALL7EMERALDS(emeralds)) - P_DoSuperTransformation(player, true); - break; - - case 7: // Make player spin - if (!(player->pflags & PF_SPINNING)) - { - player->pflags |= PF_SPINNING; - P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); - S_StartAttackSound(player->mo, sfx_spin); - - if (abs(player->rmomx) < FixedMul(5*FRACUNIT, player->mo->scale) - && abs(player->rmomy) < FixedMul(5*FRACUNIT, player->mo->scale)) - P_InstaThrust(player->mo, player->mo->angle, FixedMul(10*FRACUNIT, player->mo->scale)); - } - break; - - case 8: // Zoom Tube Start - { - INT32 sequence; - fixed_t speed; - INT32 lineindex; - mobj_t *waypoint = NULL; - angle_t an; - - if (player->mo->tracer && player->mo->tracer->type == MT_TUBEWAYPOINT && player->powers[pw_carry] == CR_ZOOMTUBE) - break; - - if (player->powers[pw_ignorelatch] & (1<<15)) - break; - - // Find line #3 tagged to this sector - lineindex = Tag_FindLineSpecial(3, sectag); - - if (lineindex == -1) - { - CONS_Debug(DBG_GAMELOGIC, "ERROR: Sector special %d missing line special #3.\n", sector->special); - break; - } - - // Grab speed and sequence values - speed = abs(sides[lines[lineindex].sidenum[0]].textureoffset)/8; - sequence = abs(sides[lines[lineindex].sidenum[0]].rowoffset)>>FRACBITS; - - if (speed == 0) - { - CONS_Debug(DBG_GAMELOGIC, "ERROR: Waypoint sequence %d at zero speed.\n", sequence); - break; - } - - waypoint = P_GetFirstWaypoint(sequence); - - if (!waypoint) - { - CONS_Debug(DBG_GAMELOGIC, "ERROR: FIRST WAYPOINT IN SEQUENCE %d NOT FOUND.\n", sequence); - break; - } - else - { - CONS_Debug(DBG_GAMELOGIC, "Waypoint %d found in sequence %d - speed = %d\n", waypoint->health, sequence, speed); - } - - an = R_PointToAngle2(player->mo->x, player->mo->y, waypoint->x, waypoint->y) - player->mo->angle; - - if (an > ANGLE_90 && an < ANGLE_270 && !(lines[lineindex].flags & ML_EFFECT4)) - break; // behind back - - P_SetTarget(&player->mo->tracer, waypoint); - player->powers[pw_carry] = CR_ZOOMTUBE; - player->speed = speed; - player->pflags |= PF_SPINNING; - player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_GLIDING|PF_BOUNCING|PF_SLIDING|PF_CANCARRY); - player->climbing = 0; - - if (player->mo->state-states != S_PLAY_ROLL) - { - P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); - S_StartSound(player->mo, sfx_spin); - } - } - break; - - case 9: // Zoom Tube End - { - INT32 sequence; - fixed_t speed; - INT32 lineindex; - mobj_t *waypoint = NULL; - angle_t an; - - if (player->mo->tracer && player->mo->tracer->type == MT_TUBEWAYPOINT && player->powers[pw_carry] == CR_ZOOMTUBE) - break; - - if (player->powers[pw_ignorelatch] & (1<<15)) - break; - - // Find line #3 tagged to this sector - lineindex = Tag_FindLineSpecial(3, sectag); - - if (lineindex == -1) - { - CONS_Debug(DBG_GAMELOGIC, "ERROR: Sector special %d missing line special #3.\n", sector->special); - break; - } - - // Grab speed and sequence values - speed = -abs(sides[lines[lineindex].sidenum[0]].textureoffset)/8; // Negative means reverse - sequence = abs(sides[lines[lineindex].sidenum[0]].rowoffset)>>FRACBITS; - - if (speed == 0) - { - CONS_Debug(DBG_GAMELOGIC, "ERROR: Waypoint sequence %d at zero speed.\n", sequence); - break; - } - - waypoint = P_GetLastWaypoint(sequence); - - if (!waypoint) - { - CONS_Debug(DBG_GAMELOGIC, "ERROR: LAST WAYPOINT IN SEQUENCE %d NOT FOUND.\n", sequence); - break; - } - else - { - CONS_Debug(DBG_GAMELOGIC, "Waypoint %d found in sequence %d - speed = %d\n", waypoint->health, sequence, speed); - } - - an = R_PointToAngle2(player->mo->x, player->mo->y, waypoint->x, waypoint->y) - player->mo->angle; - - if (an > ANGLE_90 && an < ANGLE_270 && !(lines[lineindex].flags & ML_EFFECT4)) - break; // behind back - - P_SetTarget(&player->mo->tracer, waypoint); - player->powers[pw_carry] = CR_ZOOMTUBE; - player->speed = speed; - player->pflags |= PF_SPINNING; - player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_GLIDING|PF_BOUNCING|PF_SLIDING|PF_CANCARRY); - player->climbing = 0; - - if (player->mo->state-states != S_PLAY_ROLL) - { - P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); - S_StartSound(player->mo, sfx_spin); - } - } - break; - - case 10: // Finish Line - if (((gametyperules & (GTR_RACE|GTR_LIVES)) == GTR_RACE) && !player->exiting) - { - if (player->starpostnum == numstarposts) // Must have touched all the starposts - { - player->laps++; - - if (player->powers[pw_carry] == CR_NIGHTSMODE) - player->drillmeter += 48*20; - - if (player->laps >= (UINT8)cv_numlaps.value) - CONS_Printf(M_GetText("%s has finished the race.\n"), player_names[player-players]); - else if (player->laps == (UINT8)cv_numlaps.value-1) - CONS_Printf(M_GetText("%s started the \205final lap\200!\n"), player_names[player-players]); - else - CONS_Printf(M_GetText("%s started lap %u\n"), player_names[player-players], (UINT32)player->laps+1); - - // Reset starposts (checkpoints) info - player->starpostscale = player->starpostangle = player->starposttime = player->starpostnum = 0; - player->starpostx = player->starposty = player->starpostz = 0; - P_ResetStarposts(); - - // Play the starpost sound for 'consistency' - S_StartSound(player->mo, sfx_strpst); - } - else if (player->starpostnum) - { - // blatant reuse of a variable that's normally unused in circuit - if (!player->tossdelay) - S_StartSound(player->mo, sfx_lose); - player->tossdelay = 3; - } - - if (player->laps >= (unsigned)cv_numlaps.value) - { - if (P_IsLocalPlayer(player)) - { - HU_SetCEchoFlags(0); - HU_SetCEchoDuration(5); - HU_DoCEcho("FINISHED!"); - } - - P_DoPlayerExit(player); - } - } - break; - - case 11: // Rope hang - { - INT32 sequence; - fixed_t speed; - INT32 lineindex; - mobj_t *waypointmid = NULL; - mobj_t *waypointhigh = NULL; - mobj_t *waypointlow = NULL; - mobj_t *closest = NULL; - vector3_t p, line[2], resulthigh, resultlow; - - if (player->mo->tracer && player->mo->tracer->type == MT_TUBEWAYPOINT && player->powers[pw_carry] == CR_ROPEHANG) - break; - - if (player->powers[pw_ignorelatch] & (1<<15)) - break; - - if (player->mo->momz > 0) - break; - - if (player->cmd.buttons & BT_SPIN) - break; - - if (!(player->pflags & PF_SLIDING) && player->mo->state == &states[player->mo->info->painstate]) - break; - - if (player->exiting) - break; - - //initialize resulthigh and resultlow with 0 - memset(&resultlow, 0x00, sizeof(resultlow)); - memset(&resulthigh, 0x00, sizeof(resulthigh)); - - // Find line #11 tagged to this sector - lineindex = Tag_FindLineSpecial(11, sectag); - - if (lineindex == -1) - { - CONS_Debug(DBG_GAMELOGIC, "ERROR: Sector special %d missing line special #11.\n", sector->special); - break; - } - - // Grab speed and sequence values - speed = abs(sides[lines[lineindex].sidenum[0]].textureoffset)/8; - sequence = abs(sides[lines[lineindex].sidenum[0]].rowoffset)>>FRACBITS; - - if (speed == 0) - { - CONS_Debug(DBG_GAMELOGIC, "ERROR: Waypoint sequence %d at zero speed.\n", sequence); - break; - } - - // Find the closest waypoint - // Find the preceding waypoint - // Find the proceeding waypoint - // Determine the closest spot on the line between the three waypoints - // Put player at that location. - - waypointmid = P_GetClosestWaypoint(sequence, player->mo); - - if (!waypointmid) - { - CONS_Debug(DBG_GAMELOGIC, "ERROR: WAYPOINT(S) IN SEQUENCE %d NOT FOUND.\n", sequence); - break; - } - - waypointlow = P_GetPreviousWaypoint(waypointmid, true); - waypointhigh = P_GetNextWaypoint(waypointmid, true); - - CONS_Debug(DBG_GAMELOGIC, "WaypointMid: %d; WaypointLow: %d; WaypointHigh: %d\n", - waypointmid->health, waypointlow ? waypointlow->health : -1, waypointhigh ? waypointhigh->health : -1); - - // Now we have three waypoints... the closest one we're near, and the one that comes before, and after. - // Next, we need to find the closest point on the line between each set, and determine which one we're - // closest to. - - p.x = player->mo->x; - p.y = player->mo->y; - p.z = player->mo->z; - - // Waypointmid and Waypointlow: - if (waypointlow) - { - line[0].x = waypointmid->x; - line[0].y = waypointmid->y; - line[0].z = waypointmid->z; - line[1].x = waypointlow->x; - line[1].y = waypointlow->y; - line[1].z = waypointlow->z; - - P_ClosestPointOnLine3D(&p, line, &resultlow); - } - - // Waypointmid and Waypointhigh: - if (waypointhigh) - { - line[0].x = waypointmid->x; - line[0].y = waypointmid->y; - line[0].z = waypointmid->z; - line[1].x = waypointhigh->x; - line[1].y = waypointhigh->y; - line[1].z = waypointhigh->z; - - P_ClosestPointOnLine3D(&p, line, &resulthigh); - } - - // 3D support now available. Disregard the previous notice here. -Red - - P_UnsetThingPosition(player->mo); - P_ResetPlayer(player); - player->mo->momx = player->mo->momy = player->mo->momz = 0; - - if (lines[lineindex].flags & ML_EFFECT1) // Don't wrap - { - mobj_t *highest = P_GetLastWaypoint(sequence); - highest->flags |= MF_SLIDEME; - } - - // Changing the conditions on these ifs to fix issues with snapping to the wrong spot -Red - if ((lines[lineindex].flags & ML_EFFECT1) && waypointmid->health == 0) - { - closest = waypointhigh; - player->mo->x = resulthigh.x; - player->mo->y = resulthigh.y; - player->mo->z = resulthigh.z - P_GetPlayerHeight(player); - } - else if ((lines[lineindex].flags & ML_EFFECT1) && waypointmid->health == numwaypoints[sequence] - 1) - { - closest = waypointmid; - player->mo->x = resultlow.x; - player->mo->y = resultlow.y; - player->mo->z = resultlow.z - P_GetPlayerHeight(player); - } - else - { - if (P_AproxDistance(P_AproxDistance(player->mo->x-resultlow.x, player->mo->y-resultlow.y), - player->mo->z-resultlow.z) < P_AproxDistance(P_AproxDistance(player->mo->x-resulthigh.x, - player->mo->y-resulthigh.y), player->mo->z-resulthigh.z)) - { - // Line between Mid and Low is closer - closest = waypointmid; - player->mo->x = resultlow.x; - player->mo->y = resultlow.y; - player->mo->z = resultlow.z - P_GetPlayerHeight(player); - } - else - { - // Line between Mid and High is closer - closest = waypointhigh; - player->mo->x = resulthigh.x; - player->mo->y = resulthigh.y; - player->mo->z = resulthigh.z - P_GetPlayerHeight(player); - } - } - - P_SetTarget(&player->mo->tracer, closest); - player->powers[pw_carry] = CR_ROPEHANG; - - // Option for static ropes. - if (lines[lineindex].flags & ML_NOCLIMB) - player->speed = 0; - else - player->speed = speed; - - S_StartSound(player->mo, sfx_s3k4a); - - player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_GLIDING|PF_BOUNCING|PF_SLIDING|PF_CANCARRY); - player->climbing = 0; - P_SetThingPosition(player->mo); - P_SetPlayerMobjState(player->mo, S_PLAY_RIDE); - } - break; - case 12: // Camera noclip - case 13: // Unused - case 14: // Unused - case 15: // Unused - break; - } + if (!udmf) + P_EvaluateOldSectorSpecial(player, sector, roversector, isTouching); } -/** Checks if an object is standing on or is inside a special 3D floor. - * If so, the sector is returned. - * - * \param mo Object to check. - * \return Pointer to the sector with a special type, or NULL if no special 3D - * floors are being contacted. - * \sa P_PlayerOnSpecial3DFloor - */ -sector_t *P_ThingOnSpecial3DFloor(mobj_t *mo) -{ - sector_t *sector; - ffloor_t *rover; - fixed_t topheight, bottomheight; - - sector = mo->subsector->sector; - if (!sector->ffloors) - return NULL; - - for (rover = sector->ffloors; rover; rover = rover->next) - { - if (!rover->master->frontsector->special) - continue; - - if (!(rover->flags & FF_EXISTS)) - continue; - - topheight = P_GetSpecialTopZ(mo, sectors + rover->secnum, sector); - bottomheight = P_GetSpecialBottomZ(mo, sectors + rover->secnum, sector); - - // Check the 3D floor's type... - if (((rover->flags & FF_BLOCKPLAYER) && mo->player) - || ((rover->flags & FF_BLOCKOTHERS) && !mo->player)) - { - boolean floorallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || !(mo->eflags & MFE_VERTICALFLIP)) && (mo->z == topheight)); - boolean ceilingallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || (mo->eflags & MFE_VERTICALFLIP)) && (mo->z + mo->height == bottomheight)); - // Thing must be on top of the floor to be affected... - if (!(floorallowed || ceilingallowed)) - continue; - } - else - { - // Water and intangible FOFs - if (mo->z > topheight || (mo->z + mo->height) < bottomheight) - continue; - } - - return rover->master->frontsector; - } - - return NULL; -} - -#define TELEPORTED (player->mo->subsector->sector != originalsector) +#define TELEPORTED(mo) (mo->subsector->sector != originalsector) /** Checks if a player is standing on or is inside a 3D floor (e.g. water) and * applies any specials. @@ -5073,200 +5146,58 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector) { sector_t *originalsector = player->mo->subsector->sector; ffloor_t *rover; - fixed_t topheight, bottomheight; for (rover = sector->ffloors; rover; rover = rover->next) { - if (!rover->master->frontsector->special) + if (!P_SectorHasSpecial(rover->master->frontsector)) continue; if (!(rover->flags & FF_EXISTS)) continue; - topheight = P_GetSpecialTopZ(player->mo, sectors + rover->secnum, sector); - bottomheight = P_GetSpecialBottomZ(player->mo, sectors + rover->secnum, sector); - - // Check the 3D floor's type... - if (rover->flags & FF_BLOCKPLAYER) - { - boolean floorallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || !(player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z == topheight)); - boolean ceilingallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || (player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z + player->mo->height == bottomheight)); - // Thing must be on top of the floor to be affected... - if (!(floorallowed || ceilingallowed)) - continue; - } - else - { - // Water and DEATH FOG!!! heh - if (player->mo->z > topheight || (player->mo->z + player->mo->height) < bottomheight) - continue; - } + if (!P_IsMobjTouching3DFloor(player->mo, rover, sector)) + continue; // This FOF has the special we're looking for, but are we allowed to touch it? if (sector == player->mo->subsector->sector - || (rover->master->frontsector->flags & SF_TRIGGERSPECIAL_TOUCH)) + || (rover->master->frontsector->flags & MSF_TRIGGERSPECIAL_TOUCH)) { P_ProcessSpecialSector(player, rover->master->frontsector, sector); - if TELEPORTED return; - } - } - - // Allow sector specials to be applied to polyobjects! - if (player->mo->subsector->polyList) - { - polyobj_t *po = player->mo->subsector->polyList; - sector_t *polysec; - boolean touching = false; - boolean inside = false; - - while (po) - { - if (po->flags & POF_NOSPECIALS) - { - po = (polyobj_t *)(po->link.next); - continue; - } - - polysec = po->lines[0]->backsector; - - if ((polysec->flags & SF_TRIGGERSPECIAL_TOUCH)) - touching = P_MobjTouchingPolyobj(po, player->mo); - else - touching = false; - - inside = P_MobjInsidePolyobj(po, player->mo); - - if (!(inside || touching)) - { - po = (polyobj_t *)(po->link.next); - continue; - } - - // We're inside it! Yess... - if (!polysec->special) - { - po = (polyobj_t *)(po->link.next); - continue; - } - - if (!(po->flags & POF_TESTHEIGHT)) // Don't do height checking - ; - else if (po->flags & POF_SOLID) - { - boolean floorallowed = ((polysec->flags & SF_FLIPSPECIAL_FLOOR) && ((polysec->flags & SF_TRIGGERSPECIAL_HEADBUMP) || !(player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z == polysec->ceilingheight)); - boolean ceilingallowed = ((polysec->flags & SF_FLIPSPECIAL_CEILING) && ((polysec->flags & SF_TRIGGERSPECIAL_HEADBUMP) || (player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z + player->mo->height == polysec->floorheight)); - // Thing must be on top of the floor to be affected... - if (!(floorallowed || ceilingallowed)) - { - po = (polyobj_t *)(po->link.next); - continue; - } - } - else - { - // Water and DEATH FOG!!! heh - if (player->mo->z > polysec->ceilingheight || (player->mo->z + player->mo->height) < polysec->floorheight) - { - po = (polyobj_t *)(po->link.next); - continue; - } - } - - P_ProcessSpecialSector(player, polysec, sector); - if TELEPORTED return; - - po = (polyobj_t *)(po->link.next); + if TELEPORTED(player->mo) return; } } } -#define VDOORSPEED (FRACUNIT*2) - -// -// P_RunSpecialSectorCheck -// -// Helper function to P_PlayerInSpecialSector -// -static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector) +static void P_PlayerOnSpecialPolyobj(player_t *player) { - boolean nofloorneeded = false; - fixed_t f_affectpoint, c_affectpoint; + sector_t *originalsector = player->mo->subsector->sector; + polyobj_t *po; + sector_t *polysec; + boolean touching = false; + boolean inside = false; - if (!sector->special) // nothing special, exit - return; - - if (GETSECSPECIAL(sector->special, 2) == 9) // Egg trap capsule -- should only be for 3dFloors! - return; - - // The list of specials that activate without floor touch - // Check Section 1 - switch(GETSECSPECIAL(sector->special, 1)) + for (po = player->mo->subsector->polyList; po; po = (polyobj_t *)(po->link.next)) { - case 2: // Damage (water) - case 8: // Instant kill - case 10: // Ring drainer that doesn't require floor touch - case 12: // Space countdown - nofloorneeded = true; - break; + if (po->flags & POF_NOSPECIALS) + continue; + + polysec = po->lines[0]->backsector; + + if (!P_SectorHasSpecial(polysec)) + continue; + + touching = (polysec->flags & MSF_TRIGGERSPECIAL_TOUCH) && P_MobjTouchingPolyobj(po, player->mo); + inside = P_MobjInsidePolyobj(po, player->mo); + + if (!(inside || touching)) + continue; + + if (!P_IsMobjTouchingPolyobj(player->mo, po, polysec)) + continue; + + P_ProcessSpecialSector(player, polysec, originalsector); + if TELEPORTED(player->mo) return; } - - // Check Section 2 - switch(GETSECSPECIAL(sector->special, 2)) - { - case 2: // Linedef executor (All players needed) - case 4: // Linedef executor - case 6: // Linedef executor (7 Emeralds) - case 7: // Linedef executor (NiGHTS Mare) - nofloorneeded = true; - break; - } - - // Check Section 3 -/* switch(GETSECSPECIAL(sector->special, 3)) - { - - }*/ - - // Check Section 4 - switch(GETSECSPECIAL(sector->special, 4)) - { - case 2: // Level Exit / GOAL Sector / Flag Return - if (!(maptol & TOL_NIGHTS) && G_IsSpecialStage(gamemap)) - { - // Special stage GOAL sector - // requires touching floor. - break; - } - /* FALLTHRU */ - - case 1: // Starpost activator - case 5: // Fan sector - case 6: // Super Sonic Transform - case 8: // Zoom Tube Start - case 9: // Zoom Tube End - case 10: // Finish line - nofloorneeded = true; - break; - } - - if (nofloorneeded) - { - P_ProcessSpecialSector(player, sector, NULL); - return; - } - - f_affectpoint = P_GetSpecialBottomZ(player->mo, sector, sector); - c_affectpoint = P_GetSpecialTopZ(player->mo, sector, sector); - - { - boolean floorallowed = ((sector->flags & SF_FLIPSPECIAL_FLOOR) && ((sector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || !(player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z == f_affectpoint)); - boolean ceilingallowed = ((sector->flags & SF_FLIPSPECIAL_CEILING) && ((sector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || (player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z + player->mo->height == c_affectpoint)); - // Thing must be on top of the floor to be affected... - if (!(floorallowed || ceilingallowed)) - return; - } - - P_ProcessSpecialSector(player, sector, NULL); } /** Checks if the player is in a special sector or FOF and apply any specials. @@ -5286,10 +5217,14 @@ void P_PlayerInSpecialSector(player_t *player) originalsector = player->mo->subsector->sector; P_PlayerOnSpecial3DFloor(player, originalsector); // Handle FOFs first. - if TELEPORTED return; + if TELEPORTED(player->mo) return; - P_RunSpecialSectorCheck(player, originalsector); - if TELEPORTED return; + // Allow sector specials to be applied to polyobjects! + P_PlayerOnSpecialPolyobj(player); + if TELEPORTED(player->mo) return; + + P_ProcessSpecialSector(player, originalsector, NULL); + if TELEPORTED(player->mo) return; // Iterate through touching_sectorlist for SF_TRIGGERSPECIAL_TOUCH for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next) @@ -5301,16 +5236,110 @@ void P_PlayerInSpecialSector(player_t *player) // Check 3D floors... P_PlayerOnSpecial3DFloor(player, loopsector); - if TELEPORTED return; + if TELEPORTED(player->mo) return; - if (!(loopsector->flags & SF_TRIGGERSPECIAL_TOUCH)) + if (!(loopsector->flags & MSF_TRIGGERSPECIAL_TOUCH)) continue; - P_RunSpecialSectorCheck(player, loopsector); - if TELEPORTED return; + P_ProcessSpecialSector(player, loopsector, NULL); + if TELEPORTED(player->mo) return; } } +static void P_CheckMobj3DFloorTrigger(mobj_t *mo, sector_t *sec) +{ + sector_t *originalsector = mo->subsector->sector; + ffloor_t *rover; + + for (rover = sec->ffloors; rover; rover = rover->next) + { + if (!rover->master->frontsector->triggertag) + continue; + + if (rover->master->frontsector->triggerer != TO_MOBJ) + continue; + + if (!(rover->flags & FF_EXISTS)) + continue; + + if (!P_IsMobjTouching3DFloor(mo, rover, sec)) + continue; + + P_LinedefExecute(rover->master->frontsector->triggertag, mo, rover->master->frontsector); + if TELEPORTED(mo) return; + } +} + +static void P_CheckMobjPolyobjTrigger(mobj_t *mo) +{ + sector_t *originalsector = mo->subsector->sector; + polyobj_t *po; + sector_t *polysec; + boolean touching = false; + boolean inside = false; + + for (po = mo->subsector->polyList; po; po = (polyobj_t *)(po->link.next)) + { + if (po->flags & POF_NOSPECIALS) + continue; + + polysec = po->lines[0]->backsector; + + if (!polysec->triggertag) + continue; + + if (polysec->triggerer != TO_MOBJ) + continue; + + touching = (polysec->flags & MSF_TRIGGERSPECIAL_TOUCH) && P_MobjTouchingPolyobj(po, mo); + inside = P_MobjInsidePolyobj(po, mo); + + if (!(inside || touching)) + continue; + + if (!P_IsMobjTouchingPolyobj(mo, po, polysec)) + continue; + + P_LinedefExecute(polysec->triggertag, mo, polysec); + if TELEPORTED(mo) return; + } +} + +static void P_CheckMobjSectorTrigger(mobj_t *mo, sector_t *sec) +{ + if (!sec->triggertag) + return; + + if (sec->triggerer != TO_MOBJ) + return; + + if ((sec->flags & MSF_TRIGGERLINE_PLANE) && !P_IsMobjTouchingSectorPlane(mo, sec)) + return; + + P_LinedefExecute(sec->triggertag, mo, sec); +} + +void P_CheckMobjTrigger(mobj_t *mobj, boolean pushable) +{ + sector_t *originalsector; + + if (!mobj->subsector) + return; + + originalsector = mobj->subsector->sector; + + if (!pushable && !(originalsector->flags & MSF_TRIGGERLINE_MOBJ)) + return; + + P_CheckMobj3DFloorTrigger(mobj, originalsector); + if TELEPORTED(mobj) return; + + P_CheckMobjPolyobjTrigger(mobj); + if TELEPORTED(mobj) return; + + P_CheckMobjSectorTrigger(mobj, originalsector); +} + #undef TELEPORTED /** Animate planes, scroll walls, etc. and keeps track of level timelimit and exits if time is up. @@ -5460,12 +5489,14 @@ static inline void P_AddFFloorToList(sector_t *sec, ffloor_t *fflr) * \param sec Target sector. * \param sec2 Control sector. * \param master Control linedef. + * \param alpha Alpha value (0-255). + * \param blendmode Blending mode. * \param flags Options affecting this 3Dfloor. * \param secthinkers List of relevant thinkers sorted by sector. May be NULL. * \return Pointer to the new 3Dfloor. * \sa P_AddFFloor, P_AddFakeFloorsByLine, P_SpawnSpecials */ -static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, ffloortype_e flags, thinkerlist_t *secthinkers) +static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, INT32 alpha, UINT8 blendmode, ffloortype_e flags, thinkerlist_t *secthinkers) { ffloor_t *fflr; thinker_t *th; @@ -5483,7 +5514,7 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f { fixed_t tempceiling = sec2->ceilingheight; //flip the sector around and print an error instead of crashing 12.1.08 -Inuyasha - CONS_Alert(CONS_ERROR, M_GetText("FOF (line %s) has a top height below its bottom.\n"), sizeu1(master - lines)); + CONS_Alert(CONS_ERROR, M_GetText("A FOF tagged %d has a top height below its bottom.\n"), master->args[0]); sec2->ceilingheight = sec2->floorheight; sec2->floorheight = tempceiling; } @@ -5539,12 +5570,6 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f if (sec2->hasslope) sec->hasslope = true; - if ((flags & FF_SOLID) && (master->flags & ML_EFFECT1)) // Block player only - flags &= ~FF_BLOCKOTHERS; - - if ((flags & FF_SOLID) && (master->flags & ML_EFFECT2)) // Block all BUT player - flags &= ~FF_BLOCKPLAYER; - fflr->spawnflags = fflr->flags = flags; fflr->master = master; fflr->norender = INFTICS; @@ -5585,44 +5610,50 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f p = (pusher_t *)th; if (p->affectee == (INT32)sec2num) - Add_Pusher(p->type, p->x_mag<y_mag<source, (INT32)(sec-sectors), p->affectee, p->exclusive, p->slider); + Add_Pusher(p->type, p->x_mag, p->y_mag, p->z_mag, (INT32)(sec-sectors), p->affectee, p->exclusive, p->slider); } if(secthinkers) i++; else th = th->next; } - - if (flags & FF_TRANSLUCENT) + fflr->alpha = max(0, min(0xff, alpha)); + if (fflr->alpha < 0xff || flags & FF_SPLAT) { - if (sides[master->sidenum[0]].toptexture > 0) - { - // for future reference, "#0" is 1, and "#255" is 256. Be warned - fflr->alpha = sides[master->sidenum[0]].toptexture; - - if (fflr->alpha >= 1001) // fourth digit - { - fflr->blend = (fflr->alpha/1000)+1; // becomes an AST - fflr->alpha %= 1000; - } - } - else - fflr->alpha = 0x80; + fflr->flags |= FF_TRANSLUCENT; + fflr->spawnflags = fflr->flags; } - else - fflr->alpha = 0xff; - fflr->spawnalpha = fflr->alpha; // save for netgames + switch (blendmode) + { + case TMB_TRANSLUCENT: + default: + fflr->blend = AST_COPY; + break; + case TMB_ADD: + fflr->blend = AST_ADD; + break; + case TMB_SUBTRACT: + fflr->blend = AST_SUBTRACT; + break; + case TMB_REVERSESUBTRACT: + fflr->blend = AST_REVERSESUBTRACT; + break; + case TMB_MODULATE: + fflr->blend = AST_MODULATE; + break; + } + if (flags & FF_QUICKSAND) CheckForQuicksand = true; - if ((flags & FF_BUSTUP) || (flags & FF_SHATTER) || (flags & FF_SPINBUST)) + if (flags & FF_BUSTUP) CheckForBustableBlocks = true; if ((flags & FF_MARIO)) { - if (!(flags & FF_SHATTERBOTTOM)) // Don't change the textures of a brick block, just a question block + if (!(flags & FF_GOOWATER)) // Don't change the textures of a brick block, just a question block P_AddBlockThinker(sec2, master); CheckForMarioBlocks = true; } @@ -5632,7 +5663,7 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f if ((flags & FF_FLOATBOB)) { - P_AddFloatThinker(sec2, Tag_FGet(&master->tags), master); + P_AddFloatThinker(sec2, master->args[0], master); CheckForFloatBob = true; } @@ -5748,7 +5779,7 @@ static void P_AddRaiseThinker(sector_t *sec, INT16 tag, fixed_t speed, fixed_t c raise->ceilingtop = ceilingtop; raise->ceilingbottom = ceilingbottom; - raise->basespeed = speed; + raise->basespeed = speed >> 2; if (lower) raise->flags |= RF_REVERSE; @@ -5812,7 +5843,7 @@ static inline void P_AddThwompThinker(sector_t *sec, line_t *sourceline, fixed_t thwomp->floorstartheight = sec->floorheight; thwomp->ceilingstartheight = sec->ceilingheight; thwomp->delay = 1; - thwomp->tag = Tag_FGet(&sourceline->tags); + thwomp->tag = sourceline->args[0]; thwomp->sound = sound; sec->floordata = thwomp; @@ -5848,7 +5879,7 @@ static inline void P_AddNoEnemiesThinker(line_t *sourceline) * \sa P_SpawnSpecials, T_EachTimeThinker * \author SSNTails */ -static void P_AddEachTimeThinker(line_t *sourceline) +static void P_AddEachTimeThinker(line_t *sourceline, boolean triggerOnExit) { eachtime_t *eachtime; @@ -5859,7 +5890,7 @@ static void P_AddEachTimeThinker(line_t *sourceline) eachtime->thinker.function.acp1 = (actionf_p1)T_EachTimeThinker; eachtime->sourceline = sourceline; - eachtime->triggerOnExit = !!(sourceline->flags & ML_BOUNCY); + eachtime->triggerOnExit = triggerOnExit; } /** Adds a camera scanner. @@ -6024,16 +6055,16 @@ void P_InitSpecials(void) globalweather = mapheaderinfo[gamemap-1]->weather; } -static void P_ApplyFlatAlignment(line_t *master, sector_t *sector, angle_t flatangle, fixed_t xoffs, fixed_t yoffs) +void P_ApplyFlatAlignment(sector_t *sector, angle_t flatangle, fixed_t xoffs, fixed_t yoffs, boolean floor, boolean ceiling) { - if (!(master->flags & ML_NETONLY)) // Modify floor flat alignment unless ML_NETONLY flag is set + if (floor) { sector->floorpic_angle = flatangle; sector->floor_xoffs += xoffs; sector->floor_yoffs += yoffs; } - if (!(master->flags & ML_NONET)) // Modify ceiling flat alignment unless ML_NONET flag is set + if (ceiling) { sector->ceilingpic_angle = flatangle; sector->ceiling_xoffs += xoffs; @@ -6042,6 +6073,58 @@ static void P_ApplyFlatAlignment(line_t *master, sector_t *sector, angle_t flata } +static void P_MakeFOFBouncy(line_t *paramline, line_t *masterline) +{ + INT32 s; + + if (masterline->special < 100 || masterline->special >= 300) + return; + + TAG_ITER_SECTORS(masterline->args[0], s) + { + ffloor_t *rover; + + for (rover = sectors[s].ffloors; rover; rover = rover->next) + { + if (rover->master != masterline) + continue; + + rover->flags |= FF_BOUNCY; + rover->spawnflags |= FF_BOUNCY; + rover->bouncestrength = (paramline->args[1]<< FRACBITS)/100; + CheckForBouncySector = true; + break; + } + } + +} + +static boolean P_CheckGametypeRules(INT32 checktype, UINT32 target) +{ + switch (checktype) + { + case TMF_HASALL: + default: + return (gametyperules & target) == target; + case TMF_HASANY: + return !!(gametyperules & target); + case TMF_HASEXACTLY: + return gametyperules == target; + case TMF_DOESNTHAVEALL: + return (gametyperules & target) != target; + case TMF_DOESNTHAVEANY: + return !(gametyperules & target); + } +} + +fixed_t P_GetSectorGravityFactor(sector_t *sec) +{ + if (sec->gravityptr) + return FixedDiv(*sec->gravityptr >> FRACBITS, 1000); + else + return sec->gravity; +} + /** After the map has loaded, scans for specials that spawn 3Dfloors and * thinkers. * @@ -6070,6 +6153,14 @@ void P_SpawnSpecials(boolean fromnetsave) sector = sectors; for (i = 0; i < numsectors; i++, sector++) { + CheckForReverseGravity |= (sector->flags & MSF_GRAVITYFLIP); + + if (sector->specialflags & SSF_FINISHLINE) + { + if ((gametyperules & (GTR_RACE|GTR_LIVES)) == GTR_RACE) + circuitmap = true; + } + if (!sector->special) continue; @@ -6078,11 +6169,14 @@ void P_SpawnSpecials(boolean fromnetsave) { case 5: // Spikes //Terrible hack to replace an even worse hack: - //Spike damage automatically sets SF_TRIGGERSPECIAL_TOUCH. + //Spike damage automatically sets MSF_TRIGGERSPECIAL_TOUCH. //Yes, this also affects other specials on the same sector. Sorry. - sector->flags |= SF_TRIGGERSPECIAL_TOUCH; + sector->flags |= MSF_TRIGGERSPECIAL_TOUCH; break; - case 15: // Bouncy sector + case 15: // Bouncy FOF + if (udmf) + break; + CONS_Alert(CONS_WARNING, M_GetText("Deprecated bouncy FOF sector type detected. Please use linedef type 76 instead.\n")); CheckForBouncySector = true; break; } @@ -6091,29 +6185,20 @@ void P_SpawnSpecials(boolean fromnetsave) switch(GETSECSPECIAL(sector->special, 2)) { case 10: // Time for special stage + if (udmf) + break; + CONS_Alert(CONS_WARNING, M_GetText("Deprecated sector type for special stage requirements detected. Please use the SpecialStageTime and SpecialStageSpheres level header options instead.\n")); sstimer = (sector->floorheight>>FRACBITS) * TICRATE + 6; // Time to finish ssspheres = sector->ceilingheight>>FRACBITS; // Ring count for special stage break; case 11: // Custom global gravity! + if (udmf) + break; + CONS_Alert(CONS_WARNING, M_GetText("Deprecated sector type for global gravity detected. Please use the Gravity level header option instead.\n")); gravity = sector->floorheight/1000; break; } - - // Process Section 3 -/* switch(GETSECSPECIAL(player->specialsector, 3)) - { - - }*/ - - // Process Section 4 - switch(GETSECSPECIAL(sector->special, 4)) - { - case 10: // Circuit finish line - if ((gametyperules & (GTR_RACE|GTR_LIVES)) == GTR_RACE) - circuitmap = true; - break; - } } P_SpawnScrollers(); // Add generalized scrollers @@ -6160,527 +6245,406 @@ void P_SpawnSpecials(boolean fromnetsave) // Init line EFFECTs for (i = 0; i < numlines; i++) { - mtag_t tag = Tag_FGet(&lines[i].tags); - - if (lines[i].special != 7) // This is a hack. I can at least hope nobody wants to prevent flat alignment in netgames... + // set line specials to 0 here too, same reason as above + if (netgame || multiplayer) { - // set line specials to 0 here too, same reason as above - if (netgame || multiplayer) - { - if (lines[i].flags & ML_NONET) - { - lines[i].special = 0; - continue; - } - } - else if (lines[i].flags & ML_NETONLY) + if (lines[i].flags & ML_NONET) { lines[i].special = 0; continue; } } + else if (lines[i].flags & ML_NETONLY) + { + lines[i].special = 0; + continue; + } switch (lines[i].special) { INT32 s; + INT32 l; size_t sec; ffloortype_e ffloorflags; case 1: // Definable gravity per sector + if (udmf) + break; + sec = sides[*lines[i].sidenum].sector - sectors; - TAG_ITER_SECTORS(tag, s) + TAG_ITER_SECTORS(Tag_FGet(&lines[i].tags), s) { - sectors[s].gravity = §ors[sec].floorheight; // This allows it to change in realtime! + sectors[s].gravityptr = §ors[sec].floorheight; // This allows it to change in realtime! if (lines[i].flags & ML_NOCLIMB) - sectors[s].verticalflip = true; + sectors[s].flags |= MSF_GRAVITYFLIP; else - sectors[s].verticalflip = false; + sectors[s].flags &= ~MSF_GRAVITYFLIP; - CheckForReverseGravity = sectors[s].verticalflip; + CheckForReverseGravity |= (sectors[s].flags & MSF_GRAVITYFLIP); } break; - case 2: // Custom exit - break; - - case 3: // Zoom Tube Parameters - break; - - case 4: // Speed pad (combines with sector special Section3:5 or Section3:6) - break; - case 5: // Change camera info + if (udmf) + break; + sec = sides[*lines[i].sidenum].sector - sectors; - TAG_ITER_SECTORS(tag, s) + TAG_ITER_SECTORS(Tag_FGet(&lines[i].tags), s) P_AddCameraScanner(§ors[sec], §ors[s], R_PointToAngle2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y)); break; case 7: // Flat alignment - redone by toast - if ((lines[i].flags & (ML_NETONLY|ML_NONET)) != (ML_NETONLY|ML_NONET)) // If you can do something... + { + // Set calculated offsets such that line's v1 is the apparent origin + angle_t flatangle = InvAngle(R_PointToAngle2(lines[i].v1->x, lines[i].v1->y, lines[i].v2->x, lines[i].v2->y)); + fixed_t xoffs = -lines[i].v1->x; + fixed_t yoffs = lines[i].v1->y; + + //If no tag is given, apply to front sector + if (lines[i].args[0] == 0) + P_ApplyFlatAlignment(lines[i].frontsector, flatangle, xoffs, yoffs, lines[i].args[1] != TMP_CEILING, lines[i].args[1] != TMP_FLOOR); + else { - angle_t flatangle = InvAngle(R_PointToAngle2(lines[i].v1->x, lines[i].v1->y, lines[i].v2->x, lines[i].v2->y)); - fixed_t xoffs; - fixed_t yoffs; - - if (lines[i].flags & ML_EFFECT6) // Set offset through x and y texture offsets if ML_EFFECT6 flag is set - { - xoffs = sides[lines[i].sidenum[0]].textureoffset; - yoffs = sides[lines[i].sidenum[0]].rowoffset; - } - else // Otherwise, set calculated offsets such that line's v1 is the apparent origin - { - xoffs = -lines[i].v1->x; - yoffs = lines[i].v1->y; - } - - //If no tag is given, apply to front sector - if (tag == 0) - P_ApplyFlatAlignment(lines + i, lines[i].frontsector, flatangle, xoffs, yoffs); - else - { - TAG_ITER_SECTORS(tag, s) - P_ApplyFlatAlignment(lines + i, sectors + s, flatangle, xoffs, yoffs); - } - } - else // Otherwise, print a helpful warning. Can I do no less? - CONS_Alert(CONS_WARNING, - M_GetText("Flat alignment linedef (tag %d) doesn't have anything to do.\nConsider changing the linedef's flag configuration or removing it entirely.\n"), - tag); - break; - - case 8: // Sector Parameters - TAG_ITER_SECTORS(tag, s) - { - if (lines[i].flags & ML_NOCLIMB) - { - sectors[s].flags &= ~SF_FLIPSPECIAL_FLOOR; - sectors[s].flags |= SF_FLIPSPECIAL_CEILING; - } - else if (lines[i].flags & ML_EFFECT4) - sectors[s].flags |= SF_FLIPSPECIAL_BOTH; - - if (lines[i].flags & ML_EFFECT3) - sectors[s].flags |= SF_TRIGGERSPECIAL_TOUCH; - if (lines[i].flags & ML_EFFECT2) - sectors[s].flags |= SF_TRIGGERSPECIAL_HEADBUMP; - - if (lines[i].flags & ML_EFFECT1) - sectors[s].flags |= SF_INVERTPRECIP; - - if (lines[i].frontsector && GETSECSPECIAL(lines[i].frontsector->special, 4) == 12) - sectors[s].camsec = sides[*lines[i].sidenum].sector-sectors; + TAG_ITER_SECTORS(lines[i].args[0], s) + P_ApplyFlatAlignment(sectors + s, flatangle, xoffs, yoffs, lines[i].args[1] != TMP_CEILING, lines[i].args[1] != TMP_FLOOR); } break; + } - case 9: // Chain Parameters + case 8: // Set camera collision planes + if (lines[i].frontsector) + TAG_ITER_SECTORS(lines[i].args[0], s) + sectors[s].camsec = lines[i].frontsector-sectors; break; case 10: // Vertical culling plane for sprites and FOFs - TAG_ITER_SECTORS(tag, s) + TAG_ITER_SECTORS(lines[i].args[0], s) sectors[s].cullheight = &lines[i]; // This allows it to change in realtime! break; case 50: // Insta-Lower Sector - EV_DoFloor(&lines[i], instantLower); + if (!udmf) + EV_DoFloor(lines[i].args[0], &lines[i], instantLower); break; case 51: // Instant raise for ceilings - EV_DoCeiling(&lines[i], instantRaise); + if (!udmf) + EV_DoCeiling(lines[i].args[0], &lines[i], instantRaise); break; case 52: // Continuously Falling sector - EV_DoContinuousFall(lines[i].frontsector, lines[i].backsector, P_AproxDistance(lines[i].dx, lines[i].dy), (lines[i].flags & ML_NOCLIMB)); + EV_DoContinuousFall(lines[i].frontsector, lines[i].backsector, lines[i].args[0] << FRACBITS, lines[i].args[1]); break; - case 53: // New super cool and awesome moving floor and ceiling type - case 54: // New super cool and awesome moving floor type + case 53: // Continuous plane movement (slowdown) if (lines[i].backsector) - EV_DoFloor(&lines[i], bounceFloor); - if (lines[i].special == 54) - break; - /* FALLTHRU */ - - case 55: // New super cool and awesome moving ceiling type - if (lines[i].backsector) - EV_DoCeiling(&lines[i], bounceCeiling); + { + if (lines[i].args[1] != TMP_CEILING) + EV_DoFloor(lines[i].args[0], &lines[i], bounceFloor); + if (lines[i].args[1] != TMP_FLOOR) + EV_DoCeiling(lines[i].args[0], &lines[i], bounceCeiling); + } break; - case 56: // New super cool and awesome moving floor and ceiling crush type - case 57: // New super cool and awesome moving floor crush type + case 56: // Continuous plane movement (constant) if (lines[i].backsector) - EV_DoFloor(&lines[i], bounceFloorCrush); - - if (lines[i].special == 57) - break; //only move the floor - /* FALLTHRU */ - - case 58: // New super cool and awesome moving ceiling crush type - if (lines[i].backsector) - EV_DoCeiling(&lines[i], bounceCeilingCrush); + { + if (lines[i].args[1] != TMP_CEILING) + EV_DoFloor(lines[i].args[0], &lines[i], bounceFloorCrush); + if (lines[i].args[1] != TMP_FLOOR) + EV_DoCeiling(lines[i].args[0], &lines[i], bounceCeilingCrush); + } break; - case 59: // Activate floating platform - EV_DoElevator(&lines[i], elevateContinuous, false); - break; - - case 60: // Floating platform with adjustable speed - EV_DoElevator(&lines[i], elevateContinuous, true); + case 60: // Moving platform + EV_DoElevator(lines[i].args[0], &lines[i], elevateContinuous); break; case 61: // Crusher! - EV_DoCrush(&lines[i], crushAndRaise); - break; - - case 62: // Crusher (up and then down)! - EV_DoCrush(&lines[i], fastCrushAndRaise); + EV_DoCrush(lines[i].args[0], &lines[i], lines[i].args[1] ? raiseAndCrush : crushAndRaise); break; case 63: // support for drawn heights coming from different sector sec = sides[*lines[i].sidenum].sector-sectors; - TAG_ITER_SECTORS(tag, s) + TAG_ITER_SECTORS(lines[i].args[0], s) sectors[s].heightsec = (INT32)sec; break; case 64: // Appearing/Disappearing FOF option - if (lines[i].flags & ML_BLOCKMONSTERS) { // Find FOFs by control sector tag - TAG_ITER_SECTORS(tag, s) - for (j = 0; (unsigned)j < sectors[s].linecount; j++) - if (sectors[s].lines[j]->special >= 100 && sectors[s].lines[j]->special < 300) - Add_MasterDisappearer(abs(lines[i].dx>>FRACBITS), abs(lines[i].dy>>FRACBITS), abs(sides[lines[i].sidenum[0]].sector->floorheight>>FRACBITS), (INT32)(sectors[s].lines[j]-lines), (INT32)i); - } else // Find FOFs by effect sector tag + if (lines[i].args[0] == 0) // Find FOFs by control sector tag { - TAG_ITER_LINES(tag, s) + TAG_ITER_SECTORS(lines[i].args[1], s) { - if ((size_t)s == i) + for (j = 0; (unsigned)j < sectors[s].linecount; j++) + { + if (sectors[s].lines[j]->special < 100 || sectors[s].lines[j]->special >= 300) + continue; + + Add_MasterDisappearer(abs(lines[i].args[2]), abs(lines[i].args[3]), abs(lines[i].args[4]), (INT32)(sectors[s].lines[j] - lines), (INT32)i); + } + } + } + else // Find FOFs by effect sector tag + { + TAG_ITER_LINES(lines[i].args[0], s) + { + if (lines[s].special < 100 || lines[s].special >= 300) continue; - if (Tag_Find(&sides[lines[s].sidenum[0]].sector->tags, Tag_FGet(&sides[lines[i].sidenum[0]].sector->tags))) - Add_MasterDisappearer(abs(lines[i].dx>>FRACBITS), abs(lines[i].dy>>FRACBITS), abs(sides[lines[i].sidenum[0]].sector->floorheight>>FRACBITS), s, (INT32)i); + + if (lines[i].args[1] != 0 && !Tag_Find(&lines[s].frontsector->tags, lines[i].args[1])) + continue; + + Add_MasterDisappearer(abs(lines[i].args[2]), abs(lines[i].args[3]), abs(lines[i].args[4]), s, (INT32)i); } } break; - case 66: // Displace floor by front sector - TAG_ITER_SECTORS(tag, s) - P_AddPlaneDisplaceThinker(pd_floor, P_AproxDistance(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); - break; - case 67: // Displace ceiling by front sector - TAG_ITER_SECTORS(tag, s) - P_AddPlaneDisplaceThinker(pd_ceiling, P_AproxDistance(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); - break; - case 68: // Displace both floor AND ceiling by front sector - TAG_ITER_SECTORS(tag, s) - P_AddPlaneDisplaceThinker(pd_both, P_AproxDistance(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); + case 66: // Displace planes by front sector + TAG_ITER_SECTORS(lines[i].args[0], s) + P_AddPlaneDisplaceThinker(lines[i].args[1], abs(lines[i].args[2])<<8, sides[lines[i].sidenum[0]].sector-sectors, s, lines[i].args[2] < 0); break; - case 100: // FOF (solid, opaque, shadows) - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); - break; - - case 101: // FOF (solid, opaque, no shadows) - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_NOSHADE|FF_CUTLEVEL, secthinkers); - break; - - case 102: // TL block: FOF (solid, translucent) - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_NOSHADE|FF_TRANSLUCENT|FF_EXTRA|FF_CUTEXTRA; - - // Draw the 'insides' of the block too - if (lines[i].flags & ML_NOCLIMB) + case 70: // Add raise thinker to FOF + if (udmf) { - ffloorflags |= FF_CUTLEVEL|FF_BOTHPLANES|FF_ALLSIDES; - ffloorflags &= ~(FF_EXTRA|FF_CUTEXTRA); + fixed_t destheight = lines[i].args[2] << FRACBITS; + fixed_t startheight, topheight, bottomheight; + + TAG_ITER_LINES(lines[i].args[0], l) + { + if (lines[l].special < 100 || lines[l].special >= 300) + continue; + + startheight = lines[l].frontsector->ceilingheight; + topheight = max(startheight, destheight); + bottomheight = min(startheight, destheight); + + P_AddRaiseThinker(lines[l].frontsector, lines[l].args[0], lines[i].args[1] << FRACBITS, topheight, bottomheight, (destheight < startheight), !!(lines[i].args[3])); + } + } + break; + + case 71: // Add air bob thinker to FOF + if (udmf) + { + TAG_ITER_LINES(lines[i].args[0], l) + { + if (lines[l].special < 100 || lines[l].special >= 300) + continue; + + P_AddAirbob(lines[l].frontsector, lines[l].args[0], lines[i].args[1] << FRACBITS, !!(lines[i].args[2] & TMFB_REVERSE), !!(lines[i].args[2] & TMFB_SPINDASH), !!(lines[i].args[2] & TMFB_DYNAMIC)); + } + } + break; + + case 72: // Add thwomp thinker to FOF + if (udmf) + { + UINT16 sound = (lines[i].stringargs[0]) ? get_number(lines[i].stringargs[0]) : sfx_thwomp; + + TAG_ITER_LINES(lines[i].args[0], l) + { + if (lines[l].special < 100 || lines[l].special >= 300) + continue; + + P_AddThwompThinker(lines[l].frontsector, &lines[l], lines[i].args[1] << (FRACBITS - 3), lines[i].args[2] << (FRACBITS - 3), sound); + } + } + break; + + case 73: // Add laser thinker to FOF + if (udmf) + { + TAG_ITER_LINES(lines[i].args[0], l) + { + if (lines[l].special < 100 || lines[l].special >= 300) + continue; + + P_AddLaserThinker(lines[l].args[0], lines + l, !!(lines[i].args[1])); + } + } + break; + + case 100: // FOF (solid) + ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL; + + //Appearance settings + if (lines[i].args[3] & TMFA_NOPLANES) + ffloorflags &= ~FF_RENDERPLANES; + if (lines[i].args[3] & TMFA_NOSIDES) + ffloorflags &= ~FF_RENDERSIDES; + if (lines[i].args[3] & TMFA_INSIDES) + { + if (ffloorflags & FF_RENDERPLANES) + ffloorflags |= FF_BOTHPLANES; + if (ffloorflags & FF_RENDERSIDES) + ffloorflags |= FF_ALLSIDES; + } + if (lines[i].args[3] & TMFA_ONLYINSIDES) + { + if (ffloorflags & FF_RENDERPLANES) + ffloorflags |= FF_INVERTPLANES; + if (ffloorflags & FF_RENDERSIDES) + ffloorflags |= FF_INVERTSIDES; + } + if (lines[i].args[3] & TMFA_NOSHADE) + ffloorflags |= FF_NOSHADE; + if (lines[i].args[3] & TMFA_SPLAT) + ffloorflags |= FF_SPLAT; + + //Tangibility settings + if (lines[i].args[4] & TMFT_INTANGIBLETOP) + ffloorflags |= FF_REVERSEPLATFORM; + if (lines[i].args[4] & TMFT_INTANGIBLEBOTTOM) + ffloorflags |= FF_PLATFORM; + if (lines[i].args[4] & TMFT_DONTBLOCKPLAYER) + ffloorflags &= ~FF_BLOCKPLAYER; + if (lines[i].args[4] & TMFT_DONTBLOCKOTHERS) + ffloorflags &= ~FF_BLOCKOTHERS; + + //Cutting options + if (ffloorflags & FF_RENDERALL) + { + //If translucent or player can enter it, cut inner walls + if ((lines[i].args[1] < 255) || (lines[i].args[4] & TMFT_VISIBLEFROMINSIDE)) + ffloorflags |= FF_CUTEXTRA|FF_EXTRA; + else + ffloorflags |= FF_CUTLEVEL; } - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); + P_AddFakeFloorsByLine(i, lines[i].args[1], lines[i].args[2], ffloorflags, secthinkers); break; - case 103: // Solid FOF with no floor/ceiling (quite possibly useless) - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERSIDES|FF_NOSHADE|FF_CUTLEVEL, secthinkers); - break; - - case 104: // 3D Floor type that doesn't draw sides - // If line has no-climb set, give it shadows, otherwise don't - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERPLANES|FF_CUTLEVEL; - if (!(lines[i].flags & ML_NOCLIMB)) - ffloorflags |= FF_NOSHADE; - - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - break; - - case 105: // FOF (solid, invisible) - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_NOSHADE, secthinkers); - break; - - case 120: // Opaque water - ffloorflags = FF_EXISTS|FF_RENDERALL|FF_SWIMMABLE|FF_BOTHPLANES|FF_ALLSIDES|FF_CUTEXTRA|FF_EXTRA|FF_CUTSPRITES; - if (lines[i].flags & ML_NOCLIMB) - ffloorflags |= FF_DOUBLESHADOW; - if (lines[i].flags & ML_EFFECT4) - ffloorflags |= FF_COLORMAPONLY; - if (lines[i].flags & ML_EFFECT5) - ffloorflags |= FF_RIPPLE; - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - break; - - case 121: // TL water - ffloorflags = FF_EXISTS|FF_RENDERALL|FF_TRANSLUCENT|FF_SWIMMABLE|FF_BOTHPLANES|FF_ALLSIDES|FF_CUTEXTRA|FF_EXTRA|FF_CUTSPRITES; - if (lines[i].flags & ML_NOCLIMB) - ffloorflags |= FF_DOUBLESHADOW; - if (lines[i].flags & ML_EFFECT4) - ffloorflags |= FF_COLORMAPONLY; - if (lines[i].flags & ML_EFFECT5) - ffloorflags |= FF_RIPPLE; - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - break; - - case 122: // Opaque water, no sides + case 120: // FOF (water) ffloorflags = FF_EXISTS|FF_RENDERPLANES|FF_SWIMMABLE|FF_BOTHPLANES|FF_CUTEXTRA|FF_EXTRA|FF_CUTSPRITES; - if (lines[i].flags & ML_NOCLIMB) + if (!(lines[i].args[3] & TMFW_NOSIDES)) + ffloorflags |= FF_RENDERSIDES|FF_ALLSIDES; + if (lines[i].args[3] & TMFW_DOUBLESHADOW) ffloorflags |= FF_DOUBLESHADOW; - if (lines[i].flags & ML_EFFECT4) + if (lines[i].args[3] & TMFW_COLORMAPONLY) ffloorflags |= FF_COLORMAPONLY; - if (lines[i].flags & ML_EFFECT5) + if (!(lines[i].args[3] & TMFW_NORIPPLE)) ffloorflags |= FF_RIPPLE; - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); + if (lines[i].args[3] & TMFW_GOOWATER) + ffloorflags |= FF_GOOWATER; + if (lines[i].args[3] & TMFW_SPLAT) + ffloorflags |= FF_SPLAT; + P_AddFakeFloorsByLine(i, lines[i].args[1], lines[i].args[2], ffloorflags, secthinkers); break; - case 123: // TL water, no sides - ffloorflags = FF_EXISTS|FF_RENDERPLANES|FF_TRANSLUCENT|FF_SWIMMABLE|FF_BOTHPLANES|FF_CUTEXTRA|FF_EXTRA|FF_CUTSPRITES; - if (lines[i].flags & ML_NOCLIMB) - ffloorflags |= FF_DOUBLESHADOW; - if (lines[i].flags & ML_EFFECT4) - ffloorflags |= FF_COLORMAPONLY; - if (lines[i].flags & ML_EFFECT5) - ffloorflags |= FF_RIPPLE; - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); + case 150: // FOF (Air bobbing) + P_AddFakeFloorsByLine(i, 0xff, TMB_TRANSLUCENT, FF_EXISTS|FF_SOLID|FF_RENDERALL, secthinkers); + P_AddAirbob(lines[i].frontsector, lines[i].args[0], lines[i].args[1] << FRACBITS, !!(lines[i].args[2] & TMFB_REVERSE), !!(lines[i].args[2] & TMFB_SPINDASH), !!(lines[i].args[2] & TMFB_DYNAMIC)); break; - case 124: // goo water - ffloorflags = FF_EXISTS|FF_RENDERALL|FF_TRANSLUCENT|FF_SWIMMABLE|FF_GOOWATER|FF_BOTHPLANES|FF_ALLSIDES|FF_CUTEXTRA|FF_EXTRA|FF_CUTSPRITES; - if (lines[i].flags & ML_NOCLIMB) - ffloorflags |= FF_DOUBLESHADOW; - if (lines[i].flags & ML_EFFECT4) - ffloorflags |= FF_COLORMAPONLY; - if (lines[i].flags & ML_EFFECT5) - ffloorflags |= FF_RIPPLE; - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); + case 160: // FOF (Water bobbing) + P_AddFakeFloorsByLine(i, 0xff, TMB_TRANSLUCENT, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_FLOATBOB, secthinkers); break; - case 125: // goo water, no sides - ffloorflags = FF_EXISTS|FF_RENDERPLANES|FF_TRANSLUCENT|FF_SWIMMABLE|FF_GOOWATER|FF_BOTHPLANES|FF_CUTEXTRA|FF_EXTRA|FF_CUTSPRITES; - if (lines[i].flags & ML_NOCLIMB) - ffloorflags |= FF_DOUBLESHADOW; - if (lines[i].flags & ML_EFFECT4) - ffloorflags |= FF_COLORMAPONLY; - if (lines[i].flags & ML_EFFECT5) - ffloorflags |= FF_RIPPLE; - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - break; + case 170: // FOF (Crumbling) + ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CRUMBLE; - case 140: // 'Platform' - You can jump up through it - // If line has no-climb set, don't give it shadows, otherwise do - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_PLATFORM|FF_BOTHPLANES|FF_ALLSIDES; - if (lines[i].flags & ML_NOCLIMB) + //Tangibility settings + if (lines[i].args[3] & TMFT_INTANGIBLETOP) + ffloorflags |= FF_REVERSEPLATFORM; + if (lines[i].args[3] & TMFT_INTANGIBLEBOTTOM) + ffloorflags |= FF_PLATFORM; + if (lines[i].args[3] & TMFT_DONTBLOCKPLAYER) + ffloorflags &= ~FF_BLOCKPLAYER; + if (lines[i].args[3] & TMFT_DONTBLOCKOTHERS) + ffloorflags &= ~FF_BLOCKOTHERS; + + //Flags + if (lines[i].args[4] & TMFC_NOSHADE) ffloorflags |= FF_NOSHADE; + if (lines[i].args[4] & TMFC_NORETURN) + ffloorflags |= FF_NORETURN; + if (lines[i].args[4] & TMFC_FLOATBOB) + ffloorflags |= FF_FLOATBOB; + if (lines[i].args[4] & TMFC_SPLAT) + ffloorflags |= FF_SPLAT; - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - break; + //If translucent or player can enter it, cut inner walls + if (lines[i].args[1] < 0xff || (lines[i].args[3] & TMFT_VISIBLEFROMINSIDE)) + ffloorflags |= FF_CUTEXTRA|FF_EXTRA; + else + ffloorflags |= FF_CUTLEVEL; - case 141: // Translucent "platform" - // If line has no-climb set, don't give it shadows, otherwise do - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_PLATFORM|FF_TRANSLUCENT|FF_EXTRA|FF_CUTEXTRA; - if (lines[i].flags & ML_NOCLIMB) - ffloorflags |= FF_NOSHADE; - - // Draw the 'insides' of the block too - if (lines[i].flags & ML_EFFECT2) + //If player can enter it, render insides + if (lines[i].args[3] & TMFT_VISIBLEFROMINSIDE) { - ffloorflags |= FF_CUTLEVEL|FF_BOTHPLANES|FF_ALLSIDES; - ffloorflags &= ~(FF_EXTRA|FF_CUTEXTRA); + if (ffloorflags & FF_RENDERPLANES) + ffloorflags |= FF_BOTHPLANES; + if (ffloorflags & FF_RENDERSIDES) + ffloorflags |= FF_ALLSIDES; } - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); + P_AddFakeFloorsByLine(i, lines[i].args[1], lines[i].args[2], ffloorflags, secthinkers); + if (lines[i].args[4] & TMFC_AIRBOB) + P_AddAirbob(lines[i].frontsector, lines[i].args[0], 16*FRACUNIT, false, false, false); break; - case 142: // Translucent "platform" with no sides - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERPLANES|FF_TRANSLUCENT|FF_PLATFORM|FF_EXTRA|FF_CUTEXTRA; - if (lines[i].flags & ML_NOCLIMB) // shade it unless no-climb - ffloorflags |= FF_NOSHADE; - - // Draw the 'insides' of the block too - if (lines[i].flags & ML_EFFECT2) - { - ffloorflags |= FF_CUTLEVEL|FF_BOTHPLANES|FF_ALLSIDES; - ffloorflags &= ~(FF_EXTRA|FF_CUTEXTRA); - } - - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - break; - - case 143: // 'Reverse platform' - You fall through it - // If line has no-climb set, don't give it shadows, otherwise do - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_REVERSEPLATFORM|FF_BOTHPLANES|FF_ALLSIDES; - if (lines[i].flags & ML_NOCLIMB) - ffloorflags |= FF_NOSHADE; - - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - break; - - case 144: // Translucent "reverse platform" - // If line has no-climb set, don't give it shadows, otherwise do - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_REVERSEPLATFORM|FF_TRANSLUCENT|FF_EXTRA|FF_CUTEXTRA; - if (lines[i].flags & ML_NOCLIMB) - ffloorflags |= FF_NOSHADE; - - // Draw the 'insides' of the block too - if (lines[i].flags & ML_EFFECT2) - { - ffloorflags |= FF_CUTLEVEL|FF_BOTHPLANES|FF_ALLSIDES; - ffloorflags &= ~(FF_EXTRA|FF_CUTEXTRA); - } - - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - break; - - case 145: // Translucent "reverse platform" with no sides - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERPLANES|FF_TRANSLUCENT|FF_REVERSEPLATFORM|FF_EXTRA|FF_CUTEXTRA; - if (lines[i].flags & ML_NOCLIMB) // shade it unless no-climb - ffloorflags |= FF_NOSHADE; - - // Draw the 'insides' of the block too - if (lines[i].flags & ML_EFFECT2) - { - ffloorflags |= FF_CUTLEVEL|FF_BOTHPLANES|FF_ALLSIDES; - ffloorflags &= ~(FF_EXTRA|FF_CUTEXTRA); - } - - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - break; - - case 146: // Intangible floor/ceiling with solid sides (fences/hoops maybe?) - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERSIDES|FF_ALLSIDES|FF_INTANGIBLEFLATS, secthinkers); - break; - - case 150: // Air bobbing platform - case 151: // Adjustable air bobbing platform + case 190: // FOF (Rising) { - fixed_t dist = (lines[i].special == 150) ? 16*FRACUNIT : P_AproxDistance(lines[i].dx, lines[i].dy); - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); - P_AddAirbob(lines[i].frontsector, tag, dist, false, !!(lines[i].flags & ML_NOCLIMB), false); - break; - } - case 152: // Adjustable air bobbing platform in reverse - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); - P_AddAirbob(lines[i].frontsector, tag, P_AproxDistance(lines[i].dx, lines[i].dy), true, !!(lines[i].flags & ML_NOCLIMB), false); - break; - case 153: // Dynamic Sinking Platform - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); - P_AddAirbob(lines[i].frontsector, tag, P_AproxDistance(lines[i].dx, lines[i].dy), false, !!(lines[i].flags & ML_NOCLIMB), true); - break; - - case 160: // Float/bob platform - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_FLOATBOB, secthinkers); - break; - - case 170: // Crumbling platform - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_CRUMBLE, secthinkers); - break; - - case 171: // Crumbling platform that will not return - P_AddFakeFloorsByLine(i, - FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_CRUMBLE|FF_NORETURN, secthinkers); - break; - - case 172: // "Platform" that crumbles and returns - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_PLATFORM|FF_CRUMBLE|FF_BOTHPLANES|FF_ALLSIDES; - if (lines[i].flags & ML_NOCLIMB) // shade it unless no-climb - ffloorflags |= FF_NOSHADE; - - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - break; - - case 173: // "Platform" that crumbles and doesn't return - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_PLATFORM|FF_CRUMBLE|FF_NORETURN|FF_BOTHPLANES|FF_ALLSIDES; - if (lines[i].flags & ML_NOCLIMB) // shade it unless no-climb - ffloorflags |= FF_NOSHADE; - - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - break; - - case 174: // Translucent "platform" that crumbles and returns - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_PLATFORM|FF_CRUMBLE|FF_TRANSLUCENT|FF_BOTHPLANES|FF_ALLSIDES; - if (lines[i].flags & ML_NOCLIMB) // shade it unless no-climb - ffloorflags |= FF_NOSHADE; - - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - break; - - case 175: // Translucent "platform" that crumbles and doesn't return - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_PLATFORM|FF_CRUMBLE|FF_NORETURN|FF_TRANSLUCENT|FF_BOTHPLANES|FF_ALLSIDES; - if (lines[i].flags & ML_NOCLIMB) // shade it unless no-climb - ffloorflags |= FF_NOSHADE; - - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - break; - - case 176: // Air bobbing platform that will crumble and bob on the water when it falls and hits - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_FLOATBOB|FF_CRUMBLE, secthinkers); - P_AddAirbob(lines[i].frontsector, tag, 16*FRACUNIT, false, !!(lines[i].flags & ML_NOCLIMB), false); - break; - - case 177: // Air bobbing platform that will crumble and bob on - // the water when it falls and hits, then never return - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_FLOATBOB|FF_CRUMBLE|FF_NORETURN, secthinkers); - P_AddAirbob(lines[i].frontsector, tag, 16*FRACUNIT, false, !!(lines[i].flags & ML_NOCLIMB), false); - break; - - case 178: // Crumbling platform that will float when it hits water - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CRUMBLE|FF_FLOATBOB, secthinkers); - break; - - case 179: // Crumbling platform that will float when it hits water, but not return - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_CRUMBLE|FF_FLOATBOB|FF_NORETURN, secthinkers); - break; - - case 180: // Air bobbing platform that will crumble - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_CRUMBLE, secthinkers); - P_AddAirbob(lines[i].frontsector, tag, 16*FRACUNIT, false, !!(lines[i].flags & ML_NOCLIMB), false); - break; - - case 190: // Rising Platform FOF (solid, opaque, shadows) - case 191: // Rising Platform FOF (solid, opaque, no shadows) - case 192: // Rising Platform TL block: FOF (solid, translucent) - case 193: // Rising Platform FOF (solid, invisible) - case 194: // Rising Platform 'Platform' - You can jump up through it - case 195: // Rising Platform Translucent "platform" - { - fixed_t speed = FixedDiv(P_AproxDistance(lines[i].dx, lines[i].dy), 4*FRACUNIT); fixed_t ceilingtop = P_FindHighestCeilingSurrounding(lines[i].frontsector); fixed_t ceilingbottom = P_FindLowestCeilingSurrounding(lines[i].frontsector); - ffloorflags = FF_EXISTS|FF_SOLID; - if (lines[i].special != 193) - ffloorflags |= FF_RENDERALL; - if (lines[i].special <= 191) - ffloorflags |= FF_CUTLEVEL; - if (lines[i].special == 192 || lines[i].special == 195) - ffloorflags |= FF_TRANSLUCENT|FF_EXTRA|FF_CUTEXTRA; - if (lines[i].special >= 194) - ffloorflags |= FF_PLATFORM|FF_BOTHPLANES|FF_ALLSIDES; - if (lines[i].special != 190 && (lines[i].special <= 193 || lines[i].flags & ML_NOCLIMB)) - ffloorflags |= FF_NOSHADE; - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); + ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL; - P_AddRaiseThinker(lines[i].frontsector, tag, speed, ceilingtop, ceilingbottom, !!(lines[i].flags & ML_BLOCKMONSTERS), !!(lines[i].flags & ML_NOCLIMB)); + //Appearance settings + if (lines[i].args[3] & TMFA_NOPLANES) + ffloorflags &= ~FF_RENDERPLANES; + if (lines[i].args[3] & TMFA_NOSIDES) + ffloorflags &= ~FF_RENDERSIDES; + if (lines[i].args[3] & TMFA_INSIDES) + { + if (ffloorflags & FF_RENDERPLANES) + ffloorflags |= FF_BOTHPLANES; + if (ffloorflags & FF_RENDERSIDES) + ffloorflags |= FF_ALLSIDES; + } + if (lines[i].args[3] & TMFA_ONLYINSIDES) + { + if (ffloorflags & FF_RENDERPLANES) + ffloorflags |= FF_INVERTPLANES; + if (ffloorflags & FF_RENDERSIDES) + ffloorflags |= FF_INVERTSIDES; + } + if (lines[i].args[3] & TMFA_NOSHADE) + ffloorflags |= FF_NOSHADE; + if (lines[i].args[3] & TMFA_SPLAT) + ffloorflags |= FF_SPLAT; + + //Tangibility settings + if (lines[i].args[4] & TMFT_INTANGIBLETOP) + ffloorflags |= FF_REVERSEPLATFORM; + if (lines[i].args[4] & TMFT_INTANGIBLEBOTTOM) + ffloorflags |= FF_PLATFORM; + if (lines[i].args[4] & TMFT_DONTBLOCKPLAYER) + ffloorflags &= ~FF_BLOCKPLAYER; + if (lines[i].args[4] & TMFT_DONTBLOCKOTHERS) + ffloorflags &= ~FF_BLOCKOTHERS; + + //Cutting options + if (ffloorflags & FF_RENDERALL) + { + //If translucent or player can enter it, cut inner walls + if ((lines[i].args[1] < 255) || (lines[i].args[4] & TMFT_VISIBLEFROMINSIDE)) + ffloorflags |= FF_CUTEXTRA|FF_EXTRA; + else + ffloorflags |= FF_CUTLEVEL; + } + + P_AddFakeFloorsByLine(i, lines[i].args[1], lines[i].args[2], ffloorflags, secthinkers); + P_AddRaiseThinker(lines[i].frontsector, lines[i].args[0], lines[i].args[5] << FRACBITS, ceilingtop, ceilingbottom, !!(lines[i].args[6] & TMFR_REVERSE), !!(lines[i].args[6] & TMFR_SPINDASH)); break; } - - case 200: // Double light effect - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_CUTSPRITES|FF_DOUBLESHADOW, secthinkers); - break; - - case 201: // Light effect - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_CUTSPRITES, secthinkers); + case 200: // Light block + ffloorflags = FF_EXISTS|FF_CUTSPRITES; + if (!lines[i].args[1]) + ffloorflags |= FF_DOUBLESHADOW; + P_AddFakeFloorsByLine(i, 0xff, TMB_TRANSLUCENT, ffloorflags, secthinkers); break; case 202: // Fog @@ -6689,136 +6653,274 @@ void P_SpawnSpecials(boolean fromnetsave) // SoM: Because it's fog, check for an extra colormap and set the fog flag... if (sectors[sec].extra_colormap) sectors[sec].extra_colormap->flags = CMF_FOG; - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); + P_AddFakeFloorsByLine(i, 0xff, TMB_TRANSLUCENT, ffloorflags, secthinkers); break; - case 220: // Like opaque water, but not swimmable. (Good for snow effect on FOFs) - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_RENDERALL|FF_BOTHPLANES|FF_ALLSIDES|FF_CUTEXTRA|FF_EXTRA|FF_CUTSPRITES, secthinkers); - break; + case 220: //Intangible + ffloorflags = FF_EXISTS|FF_RENDERALL|FF_CUTEXTRA|FF_EXTRA|FF_CUTSPRITES; - case 221: // FOF (intangible, translucent) - // If line has no-climb set, give it shadows, otherwise don't - ffloorflags = FF_EXISTS|FF_RENDERALL|FF_TRANSLUCENT|FF_EXTRA|FF_CUTEXTRA|FF_CUTSPRITES; - if (!(lines[i].flags & ML_NOCLIMB)) + //Appearance settings + if (lines[i].args[3] & TMFA_NOPLANES) + ffloorflags &= ~FF_RENDERPLANES; + if (lines[i].args[3] & TMFA_NOSIDES) + ffloorflags &= ~FF_RENDERSIDES; + if (!(lines[i].args[3] & TMFA_INSIDES)) + { + if (ffloorflags & FF_RENDERPLANES) + ffloorflags |= FF_BOTHPLANES; + if (ffloorflags & FF_RENDERSIDES) + ffloorflags |= FF_ALLSIDES; + } + if (lines[i].args[3] & TMFA_ONLYINSIDES) + { + if (ffloorflags & FF_RENDERPLANES) + ffloorflags |= FF_INVERTPLANES; + if (ffloorflags & FF_RENDERSIDES) + ffloorflags |= FF_INVERTSIDES; + } + if (lines[i].args[3] & TMFA_NOSHADE) ffloorflags |= FF_NOSHADE; + if (lines[i].args[3] & TMFA_SPLAT) + ffloorflags |= FF_SPLAT; - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - break; - - case 222: // FOF with no floor/ceiling (good for GFZGRASS effect on FOFs) - // If line has no-climb set, give it shadows, otherwise don't - ffloorflags = FF_EXISTS|FF_RENDERSIDES|FF_ALLSIDES; - if (!(lines[i].flags & ML_NOCLIMB)) - ffloorflags |= FF_NOSHADE|FF_CUTSPRITES; - - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); + P_AddFakeFloorsByLine(i, lines[i].args[1], lines[i].args[2], ffloorflags, secthinkers); break; case 223: // FOF (intangible, invisible) - for combining specials in a sector - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_NOSHADE, secthinkers); + P_AddFakeFloorsByLine(i, 0xff, TMB_TRANSLUCENT, FF_EXISTS|FF_NOSHADE, secthinkers); break; case 250: // Mario Block ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_MARIO; - if (lines[i].flags & ML_NOCLIMB) - ffloorflags |= FF_SHATTERBOTTOM; - if (lines[i].flags & ML_EFFECT1) + if (lines[i].args[1] & TMFM_BRICK) + ffloorflags |= FF_GOOWATER; + if (lines[i].args[1] & TMFM_INVISIBLE) ffloorflags &= ~(FF_SOLID|FF_RENDERALL|FF_CUTLEVEL); - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); + P_AddFakeFloorsByLine(i, 0xff, TMB_TRANSLUCENT, ffloorflags, secthinkers); break; case 251: // A THWOMP! { - fixed_t crushspeed = (lines[i].flags & ML_EFFECT5) ? lines[i].dy >> 3 : 10*FRACUNIT; - fixed_t retractspeed = (lines[i].flags & ML_EFFECT5) ? lines[i].dx >> 3 : 2*FRACUNIT; - UINT16 sound = (lines[i].flags & ML_EFFECT4) ? sides[lines[i].sidenum[0]].textureoffset >> FRACBITS : sfx_thwomp; - P_AddThwompThinker(lines[i].frontsector, &lines[i], crushspeed, retractspeed, sound); - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); + UINT16 sound = (lines[i].stringargs[0]) ? get_number(lines[i].stringargs[0]) : sfx_thwomp; + P_AddThwompThinker(lines[i].frontsector, &lines[i], lines[i].args[1] << (FRACBITS - 3), lines[i].args[2] << (FRACBITS - 3), sound); + P_AddFakeFloorsByLine(i, 0xff, TMB_TRANSLUCENT, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); break; } - case 252: // Shatter block (breaks when touched) - ffloorflags = FF_EXISTS|FF_BLOCKOTHERS|FF_RENDERALL|FF_BUSTUP|FF_SHATTER; - if (lines[i].flags & ML_NOCLIMB) - ffloorflags |= FF_BLOCKPLAYER|FF_SHATTERBOTTOM; - - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); - break; - - case 253: // Translucent shatter block (see 76) - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_BLOCKOTHERS|FF_RENDERALL|FF_BUSTUP|FF_SHATTER|FF_TRANSLUCENT, secthinkers); - break; - case 254: // Bustable block - ffloorflags = FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_BUSTUP; - if (lines[i].flags & ML_NOCLIMB) - ffloorflags |= FF_STRONGBUST; + { + UINT8 busttype = BT_REGULAR; + ffloorbustflags_e bustflags = 0; - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); + ffloorflags = FF_EXISTS|FF_BLOCKOTHERS|FF_RENDERALL|FF_BUSTUP; + + //Bustable type + switch (lines[i].args[3]) + { + case TMFB_TOUCH: + busttype = BT_TOUCH; + break; + case TMFB_SPIN: + busttype = BT_SPINBUST; + break; + case TMFB_REGULAR: + busttype = BT_REGULAR; + break; + case TMFB_STRONG: + busttype = BT_STRONG; + break; + } + + //Flags + if (lines[i].args[4] & TMFB_PUSHABLES) + bustflags |= FB_PUSHABLES; + if (lines[i].args[4] & TMFB_EXECUTOR) + bustflags |= FB_EXECUTOR; + if (lines[i].args[4] & TMFB_ONLYBOTTOM) + bustflags |= FB_ONLYBOTTOM; + if (lines[i].args[4] & TMFB_SPLAT) + ffloorflags |= FF_SPLAT; + + if (busttype != BT_TOUCH || bustflags & FB_ONLYBOTTOM) + ffloorflags |= FF_BLOCKPLAYER; + + TAG_ITER_SECTORS(lines[i].args[0], s) + { + ffloor_t *fflr = P_AddFakeFloor(§ors[s], lines[i].frontsector, lines + i, lines[i].args[1], lines[i].args[2], ffloorflags, secthinkers); + if (!fflr) + continue; + fflr->bustflags = bustflags; + fflr->busttype = busttype; + fflr->busttag = lines[i].args[5]; + } break; - - case 255: // Spin bust block (breaks when jumped or spun downwards onto) - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_BUSTUP|FF_SPINBUST, secthinkers); - break; - - case 256: // Translucent spin bust block (see 78) - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_BUSTUP|FF_SPINBUST|FF_TRANSLUCENT, secthinkers); - break; - + } case 257: // Quicksand ffloorflags = FF_EXISTS|FF_QUICKSAND|FF_RENDERALL|FF_ALLSIDES|FF_CUTSPRITES; - if (lines[i].flags & ML_EFFECT5) + if (!(lines[i].args[1])) ffloorflags |= FF_RIPPLE; - P_AddFakeFloorsByLine(i, ffloorflags, secthinkers); + TAG_ITER_SECTORS(lines[i].args[0], s) + { + ffloor_t *fflr = P_AddFakeFloor(§ors[s], lines[i].frontsector, lines + i, 0xff, TMB_TRANSLUCENT, ffloorflags, secthinkers); + if (!fflr) + continue; + fflr->sinkspeed = abs(lines[i].args[2]) << (FRACBITS - 1); + fflr->friction = abs(lines[i].args[3]) << (FRACBITS - 6); + } break; case 258: // Laser block - P_AddLaserThinker(tag, lines + i, !!(lines[i].flags & ML_EFFECT1)); - P_AddFakeFloorsByLine(i, FF_EXISTS|FF_RENDERALL|FF_NOSHADE|FF_EXTRA|FF_CUTEXTRA|FF_TRANSLUCENT, secthinkers); + ffloorflags = FF_EXISTS|FF_RENDERALL|FF_NOSHADE|FF_EXTRA|FF_CUTEXTRA|FF_TRANSLUCENT; + P_AddLaserThinker(lines[i].args[0], lines + i, !!(lines[i].args[3] & TMFL_NOBOSSES)); + if (lines[i].args[3] & TMFL_SPLAT) + ffloorflags |= FF_SPLAT; + P_AddFakeFloorsByLine(i, lines[i].args[1], lines[i].args[2], ffloorflags, secthinkers); break; case 259: // Custom FOF - if (lines[i].sidenum[1] != 0xffff) + TAG_ITER_SECTORS(lines[i].args[0], s) { - ffloortype_e fofflags = sides[lines[i].sidenum[1]].toptexture; - P_AddFakeFloorsByLine(i, fofflags, secthinkers); + ffloor_t *fflr = P_AddFakeFloor(§ors[s], lines[i].frontsector, lines + i, lines[i].args[1], lines[i].args[2], lines[i].args[3], secthinkers); + if (!fflr) + continue; + if (!udmf) // Ugly backwards compatibility stuff + { + if (lines[i].args[3] & FF_QUICKSAND) + { + fflr->sinkspeed = abs(lines[i].dx) >> 1; + fflr->friction = abs(lines[i].dy) >> 6; + } + if (lines[i].args[3] & FF_BUSTUP) + { + switch (lines[i].args[4] % TMFB_ONLYBOTTOM) + { + case TMFB_TOUCH: + fflr->busttype = BT_TOUCH; + break; + case TMFB_SPIN: + fflr->busttype = BT_SPINBUST; + break; + case TMFB_REGULAR: + fflr->busttype = BT_REGULAR; + break; + case TMFB_STRONG: + fflr->busttype = BT_STRONG; + break; + } + + if (lines[i].args[4] & TMFB_ONLYBOTTOM) + fflr->bustflags |= FB_ONLYBOTTOM; + if (lines[i].flags & ML_MIDSOLID) + fflr->bustflags |= FB_PUSHABLES; + if (lines[i].flags & ML_WRAPMIDTEX) + { + fflr->bustflags |= FB_EXECUTOR; + fflr->busttag = P_AproxDistance(lines[i].dx, lines[i].dy) >> FRACBITS; + } + } + } } - else - I_Error("Custom FOF (tag %d) found without a linedef back side!", tag); break; - case 300: // Linedef executor (combines with sector special 974/975) and commands - case 302: - case 303: - case 304: + case 260: // GZDoom-like 3D Floor. + { + UINT8 dtype = lines[i].args[1] & 3; + UINT8 dflags1 = lines[i].args[1] - dtype; + UINT8 dflags2 = lines[i].args[2]; + UINT8 dopacity = lines[i].args[3]; + boolean isfog = false; - // Charability linedef executors - case 305: - case 307: + if (dtype == 0) + dtype = 1; + + ffloorflags = FF_EXISTS; + + if (dflags2 & 1) ffloorflags |= FF_NOSHADE; // Disable light effects (Means no shadowcast) + if (dflags2 & 2) ffloorflags |= FF_DOUBLESHADOW; // Restrict light inside (Means doubleshadow) + if (dflags2 & 4) isfog = true; // Fog effect (Explicitly render like a fog block) + + if (dflags1 & 4) ffloorflags |= FF_BOTHPLANES|FF_ALLSIDES; // Render-inside + if (dflags1 & 16) ffloorflags |= FF_INVERTSIDES|FF_INVERTPLANES; // Invert visibility rules + + // Fog block + if (isfog) + ffloorflags |= FF_RENDERALL|FF_CUTEXTRA|FF_CUTSPRITES|FF_BOTHPLANES|FF_EXTRA|FF_FOG|FF_INVERTPLANES|FF_ALLSIDES|FF_INVERTSIDES; + else + { + ffloorflags |= FF_RENDERALL; + + // Solid + if (dtype == 1) + ffloorflags |= FF_SOLID|FF_CUTLEVEL; + // Water + else if (dtype == 2) + ffloorflags |= FF_SWIMMABLE|FF_CUTEXTRA|FF_CUTSPRITES|FF_EXTRA|FF_RIPPLE; + // Intangible + else if (dtype == 3) + ffloorflags |= FF_CUTEXTRA|FF_CUTSPRITES|FF_EXTRA; + } + + // Non-opaque + if (dopacity < 255) + { + // Invisible + if (dopacity == 0) + { + // True invisible + if (ffloorflags & FF_NOSHADE) + ffloorflags &= ~(FF_RENDERALL|FF_CUTEXTRA|FF_CUTSPRITES|FF_EXTRA|FF_BOTHPLANES|FF_ALLSIDES|FF_CUTLEVEL); + // Shadow block + else + { + ffloorflags |= FF_CUTSPRITES; + ffloorflags &= ~(FF_RENDERALL|FF_CUTEXTRA|FF_EXTRA|FF_BOTHPLANES|FF_ALLSIDES|FF_CUTLEVEL); + } + } + else + { + ffloorflags |= FF_TRANSLUCENT|FF_CUTEXTRA|FF_EXTRA; + ffloorflags &= ~FF_CUTLEVEL; + } + } + + P_AddFakeFloorsByLine(i, dopacity, TMB_TRANSLUCENT, ffloorflags, secthinkers); + } + break; + + case 300: // Trigger linedef executor + case 303: // Count rings + case 305: // Character ability + case 314: // Pushable linedef executors (count # of pushables) + case 317: // Condition set trigger + case 319: // Unlockable trigger + case 331: // Player skin + case 334: // Object dye + case 337: // Emerald check + if (lines[i].args[0] > TMT_EACHTIMEMASK) + P_AddEachTimeThinker(&lines[i], lines[i].args[0] == TMT_EACHTIMEENTERANDEXIT); break; case 308: // Race-only linedef executor. Triggers once. - if (!(gametyperules & GTR_RACE)) + if (!P_CheckGametypeRules(lines[i].args[2], (UINT32)lines[i].args[1])) + { lines[i].special = 0; + break; + } + if (lines[i].args[0] > TMT_EACHTIMEMASK) + P_AddEachTimeThinker(&lines[i], lines[i].args[0] == TMT_EACHTIMEENTERANDEXIT); break; // Linedef executor triggers for CTF teams. case 309: - case 311: if (!(gametyperules & GTR_TEAMFLAGS)) + { lines[i].special = 0; - break; - - // Each time executors - case 306: - case 301: - case 310: - case 312: - case 332: - case 335: - P_AddEachTimeThinker(&lines[i]); + break; + } + if (lines[i].args[0] > TMT_EACHTIMEMASK) + P_AddEachTimeThinker(&lines[i], lines[i].args[0] == TMT_EACHTIMEENTERANDEXIT); break; // No More Enemies Linedef Exec @@ -6826,100 +6928,24 @@ void P_SpawnSpecials(boolean fromnetsave) P_AddNoEnemiesThinker(&lines[i]); break; - // Pushable linedef executors (count # of pushables) - case 314: - case 315: - break; - - // Unlock trigger executors - case 317: - case 318: - break; - case 319: - case 320: - break; - // Trigger on X calls case 321: - case 322: - if (lines[i].flags & ML_NOCLIMB && sides[lines[i].sidenum[0]].rowoffset > 0) // optional "starting" count - lines[i].callcount = sides[lines[i].sidenum[0]].rowoffset>>FRACBITS; - else - lines[i].callcount = sides[lines[i].sidenum[0]].textureoffset>>FRACBITS; - if (lines[i].special == 322) // Each time - P_AddEachTimeThinker(&lines[i]); - break; - - // NiGHTS trigger executors - case 323: - case 324: - case 325: - case 326: - case 327: - case 328: - case 329: - case 330: - break; - - // Skin trigger executors - case 331: - case 333: - break; - - // Object dye executors - case 334: - case 336: - break; - - case 399: // Linedef execute on map load - // This is handled in P_RunLevelLoadExecutors. - break; - - case 400: - case 401: - case 402: - case 403: - case 404: - case 405: - case 406: - case 407: - case 408: - case 409: - case 410: - case 411: - case 412: - case 413: - case 414: - case 415: - case 416: - case 417: - case 418: - case 419: - case 420: - case 421: - case 422: - case 423: - case 424: - case 425: - case 426: - case 427: - case 428: - case 429: - case 430: - case 431: + lines[i].callcount = (lines[i].args[2] && lines[i].args[3] > 0) ? lines[i].args[3] : lines[i].args[1]; // optional "starting" count + if (lines[i].args[0] > TMXT_EACHTIMEMASK) // Each time + P_AddEachTimeThinker(&lines[i], lines[i].args[0] == TMXT_EACHTIMEENTERANDEXIT); break; case 449: // Enable bosses with parameter { - INT32 bossid = sides[*lines[i].sidenum].textureoffset>>FRACBITS; + INT32 bossid = lines[i].args[0]; if (bossid & ~15) // if any bits other than first 16 are set { CONS_Alert(CONS_WARNING, - M_GetText("Boss enable linedef (tag %d) has an invalid texture x offset.\nConsider changing it or removing it entirely.\n"), - tag); + M_GetText("Boss enable linedef has an invalid boss ID (%d).\nConsider changing it or removing it entirely.\n"), + bossid); break; } - if (!(lines[i].flags & ML_NOCLIMB)) + if (!(lines[i].args[1])) { bossdisabled |= (1<>FRACBITS); + TAG_ITER_SECTORS(lines[i].args[0], s) + P_SpawnAdjustableGlowingLight(§ors[s], lines[i].args[2], + lines[i].args[3] ? sectors[s].lightlevel : lines[i].args[4], lines[i].args[1]); break; case 603: // Adjustable flickering light sec = sides[*lines[i].sidenum].sector - sectors; - TAG_ITER_SECTORS(tag, s) - P_SpawnAdjustableFireFlicker(§ors[sec], §ors[s], - P_AproxDistance(lines[i].dx, lines[i].dy)>>FRACBITS); + TAG_ITER_SECTORS(lines[i].args[0], s) + P_SpawnAdjustableFireFlicker(§ors[s], lines[i].args[2], + lines[i].args[3] ? sectors[s].lightlevel : lines[i].args[4], lines[i].args[1]); break; - case 604: // Adjustable Blinking Light (unsynchronized) + case 604: // Adjustable Blinking Light sec = sides[*lines[i].sidenum].sector - sectors; - TAG_ITER_SECTORS(tag, s) - P_SpawnAdjustableStrobeFlash(§ors[sec], §ors[s], - abs(lines[i].dx)>>FRACBITS, abs(lines[i].dy)>>FRACBITS, false); - break; - - case 605: // Adjustable Blinking Light (synchronized) - sec = sides[*lines[i].sidenum].sector - sectors; - TAG_ITER_SECTORS(tag, s) - P_SpawnAdjustableStrobeFlash(§ors[sec], §ors[s], - abs(lines[i].dx)>>FRACBITS, abs(lines[i].dy)>>FRACBITS, true); + TAG_ITER_SECTORS(lines[i].args[0], s) + P_SpawnAdjustableStrobeFlash(§ors[s], lines[i].args[3], + (lines[i].args[4] & TMB_USETARGET) ? sectors[s].lightlevel : lines[i].args[5], + lines[i].args[1], lines[i].args[2], lines[i].args[4] & TMB_SYNC); break; case 606: // HACK! Copy colormaps. Just plain colormaps. @@ -7037,6 +7020,124 @@ void P_SpawnSpecials(boolean fromnetsave) } } + // And another round, this time with all FOFs already created + for (i = 0; i < numlines; i++) + { + switch (lines[i].special) + { + INT32 s; + INT32 l; + + case 74: // Make FOF bustable + { + UINT8 busttype = BT_REGULAR; + ffloorbustflags_e bustflags = 0; + + if (!udmf) + break; + + switch (lines[i].args[1]) + { + case TMFB_TOUCH: + busttype = BT_TOUCH; + break; + case TMFB_SPIN: + busttype = BT_SPINBUST; + break; + case TMFB_REGULAR: + busttype = BT_REGULAR; + break; + case TMFB_STRONG: + busttype = BT_STRONG; + break; + } + + if (lines[i].args[2] & TMFB_PUSHABLES) + bustflags |= FB_PUSHABLES; + if (lines[i].args[2] & TMFB_EXECUTOR) + bustflags |= FB_EXECUTOR; + if (lines[i].args[2] & TMFB_ONLYBOTTOM) + bustflags |= FB_ONLYBOTTOM; + + TAG_ITER_LINES(lines[i].args[0], l) + { + if (lines[l].special < 100 || lines[l].special >= 300) + continue; + + TAG_ITER_SECTORS(lines[l].args[0], s) + { + ffloor_t *rover; + + for (rover = sectors[s].ffloors; rover; rover = rover->next) + { + if (rover->master != lines + l) + continue; + + rover->flags |= FF_BUSTUP; + rover->spawnflags |= FF_BUSTUP; + rover->bustflags = bustflags; + rover->busttype = busttype; + rover->busttag = lines[i].args[3]; + CheckForBustableBlocks = true; + break; + } + } + } + break; + } + + case 75: // Make FOF quicksand + { + if (!udmf) + break; + TAG_ITER_LINES(lines[i].args[0], l) + { + if (lines[l].special < 100 || lines[l].special >= 300) + continue; + + TAG_ITER_SECTORS(lines[l].args[0], s) + { + ffloor_t *rover; + + for (rover = sectors[s].ffloors; rover; rover = rover->next) + { + if (rover->master != lines + l) + continue; + + rover->flags |= FF_QUICKSAND; + rover->spawnflags |= FF_QUICKSAND; + rover->sinkspeed = abs(lines[i].args[1]) << (FRACBITS - 1); + rover->friction = abs(lines[i].args[2]) << (FRACBITS - 6); + CheckForQuicksand = true; + break; + } + } + } + break; + } + + case 76: // Make FOF bouncy + { + if (udmf) + { + TAG_ITER_LINES(lines[i].args[0], l) + P_MakeFOFBouncy(lines + i, lines + l); + } + else + { + TAG_ITER_SECTORS(lines[i].args[0], s) + for (j = 0; (unsigned)j < sectors[s].linecount; j++) + P_MakeFOFBouncy(lines + i, sectors[s].lines[j]); + } + break; + } + } + } + + + + + // Allocate each list for (i = 0; i < numsectors; i++) if(secthinkers[i].thinkers) @@ -7072,20 +7173,22 @@ void P_SpawnSpecials(boolean fromnetsave) /** Adds 3Dfloors as appropriate based on a common control linedef. * * \param line Control linedef to use. + * \param alpha Alpha value (0-255). + * \param blendmode Blending mode. * \param ffloorflags 3Dfloor flags to use. * \param secthkiners Lists of thinkers sorted by sector. May be NULL. * \sa P_SpawnSpecials, P_AddFakeFloor * \author Graue */ -static void P_AddFakeFloorsByLine(size_t line, ffloortype_e ffloorflags, thinkerlist_t *secthinkers) +static void P_AddFakeFloorsByLine(size_t line, INT32 alpha, UINT8 blendmode, ffloortype_e ffloorflags, thinkerlist_t *secthinkers) { INT32 s; - mtag_t tag = Tag_FGet(&lines[line].tags); + mtag_t tag = lines[line].args[0]; size_t sec = sides[*lines[line].sidenum].sector-sectors; line_t* li = lines + line; TAG_ITER_SECTORS(tag, s) - P_AddFakeFloor(§ors[s], §ors[sec], li, ffloorflags, secthinkers); + P_AddFakeFloor(§ors[s], §ors[sec], li, alpha, blendmode, ffloorflags, secthinkers); } /* @@ -7230,7 +7333,7 @@ void T_Scroll(scroll_t *s) if (!is3dblock) continue; - TAG_ITER_SECTORS(Tag_FGet(&line->tags), sect) + TAG_ITER_SECTORS(line->args[0], sect) { sector_t *psec; psec = sectors + sect; @@ -7305,7 +7408,7 @@ void T_Scroll(scroll_t *s) if (!is3dblock) continue; - TAG_ITER_SECTORS(Tag_FGet(&line->tags), sect) + TAG_ITER_SECTORS(line->args[0], sect) { sector_t *psec; psec = sectors + sect; @@ -7388,12 +7491,33 @@ static void Add_Scroller(INT32 type, fixed_t dx, fixed_t dy, INT32 control, INT3 s->accel = accel; s->exclusive = exclusive; s->vdx = s->vdy = 0; - if ((s->control = control) != -1) + s->control = control; + if (s->control != -1) s->last_height = sectors[control].floorheight + sectors[control].ceilingheight; s->affectee = affectee; + if (type == sc_carry || type == sc_carry_ceiling) + sectors[affectee].specialflags |= SSF_CONVEYOR; P_AddThinker(THINK_MAIN, &s->thinker); } +static void P_SpawnPlaneScroller(line_t *l, fixed_t dx, fixed_t dy, INT32 control, INT32 affectee, INT32 accel, INT32 exclusive) +{ + if (l->args[1] != TMP_CEILING) + { + if (l->args[2] != TMS_SCROLLONLY) + Add_Scroller(sc_carry, FixedMul(dx, CARRYFACTOR), FixedMul(dy, CARRYFACTOR), control, affectee, accel, exclusive); + if (l->args[2] != TMS_CARRYONLY) + Add_Scroller(sc_floor, -dx, dy, control, affectee, accel, exclusive); + } + if (l->args[1] != TMP_FLOOR) + { + if (l->args[2] != TMS_SCROLLONLY) + Add_Scroller(sc_carry_ceiling, FixedMul(dx, CARRYFACTOR), FixedMul(dy, CARRYFACTOR), control, affectee, accel, exclusive); + if (l->args[2] != TMS_CARRYONLY) + Add_Scroller(sc_ceiling, -dx, dy, control, affectee, accel, exclusive); + } +} + /** Initializes the scrollers. * * \todo Get rid of all the magic numbers. @@ -7403,140 +7527,65 @@ static void P_SpawnScrollers(void) { size_t i; line_t *l = lines; - mtag_t tag; for (i = 0; i < numlines; i++, l++) { - fixed_t dx = l->dx >> SCROLL_SHIFT; // direction and speed of scrolling - fixed_t dy = l->dy >> SCROLL_SHIFT; INT32 control = -1, accel = 0; // no control sector or acceleration - INT32 special = l->special; - tag = Tag_FGet(&l->tags); - - // These types are same as the ones they get set to except that the - // first side's sector's heights cause scrolling when they change, and - // this linedef controls the direction and speed of the scrolling. The - // most complicated linedef since donuts, but powerful :) - - if (special == 515 || special == 512 || special == 522 || special == 532 || special == 504) // displacement scrollers + if (l->special == 502 || l->special == 510) { - special -= 2; - control = (INT32)(sides[*l->sidenum].sector - sectors); - } - else if (special == 514 || special == 511 || special == 521 || special == 531 || special == 503) // accelerative scrollers - { - special--; - accel = 1; - control = (INT32)(sides[*l->sidenum].sector - sectors); - } - else if (special == 535 || special == 525) // displacement scrollers - { - special -= 2; - control = (INT32)(sides[*l->sidenum].sector - sectors); - } - else if (special == 534 || special == 524) // accelerative scrollers - { - accel = 1; - special--; - control = (INT32)(sides[*l->sidenum].sector - sectors); + if ((l->args[4] & TMST_TYPEMASK) != TMST_REGULAR) + control = (INT32)(sides[*l->sidenum].sector - sectors); + if ((l->args[4] & TMST_TYPEMASK) == TMST_ACCELERATIVE) + accel = 1; } - switch (special) + switch (l->special) { register INT32 s; - case 513: // scroll effect ceiling - case 533: // scroll and carry objects on ceiling - TAG_ITER_SECTORS(tag, s) - Add_Scroller(sc_ceiling, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB); - if (special != 533) - break; - /* FALLTHRU */ + case 510: // plane scroller + { + fixed_t length = R_PointToDist2(l->v2->x, l->v2->y, l->v1->x, l->v1->y); + fixed_t speed = l->args[3] << FRACBITS; + fixed_t dx = FixedMul(FixedDiv(l->dx, length), speed) >> SCROLL_SHIFT; + fixed_t dy = FixedMul(FixedDiv(l->dy, length), speed) >> SCROLL_SHIFT; - case 523: // carry objects on ceiling - dx = FixedMul(dx, CARRYFACTOR); - dy = FixedMul(dy, CARRYFACTOR); - TAG_ITER_SECTORS(tag, s) - Add_Scroller(sc_carry_ceiling, dx, dy, control, s, accel, l->flags & ML_NOCLIMB); - break; - - case 510: // scroll effect floor - case 530: // scroll and carry objects on floor - TAG_ITER_SECTORS(tag, s) - Add_Scroller(sc_floor, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB); - if (special != 530) - break; - /* FALLTHRU */ - - case 520: // carry objects on floor - dx = FixedMul(dx, CARRYFACTOR); - dy = FixedMul(dy, CARRYFACTOR); - TAG_ITER_SECTORS(tag, s) - Add_Scroller(sc_carry, dx, dy, control, s, accel, l->flags & ML_NOCLIMB); + if (l->args[0] == 0) + P_SpawnPlaneScroller(l, dx, dy, control, (INT32)(l->frontsector - sectors), accel, l->args[4] & TMST_NONEXCLUSIVE); + else + { + TAG_ITER_SECTORS(l->args[0], s) + P_SpawnPlaneScroller(l, dx, dy, control, s, accel, l->args[4] & TMST_NONEXCLUSIVE); + } break; + } // scroll wall according to linedef // (same direction and speed as scrolling floors) case 502: { - TAG_ITER_LINES(tag, s) + TAG_ITER_LINES(l->args[0], s) if (s != (INT32)i) { - if (l->flags & ML_EFFECT2) // use texture offsets instead - { - dx = sides[l->sidenum[0]].textureoffset; - dy = sides[l->sidenum[0]].rowoffset; - } - if (l->flags & ML_EFFECT3) - { - if (lines[s].sidenum[1] != 0xffff) - Add_Scroller(sc_side, dx, dy, control, lines[s].sidenum[1], accel, 0); - } - else - Add_Scroller(sc_side, dx, dy, control, lines[s].sidenum[0], accel, 0); + if (l->args[1] != TMSD_BACK) + Add_Scroller(sc_side, l->args[2] << (FRACBITS - SCROLL_SHIFT), l->args[3] << (FRACBITS - SCROLL_SHIFT), control, lines[s].sidenum[0], accel, 0); + if (l->args[1] != TMSD_FRONT && lines[s].sidenum[1] != 0xffff) + Add_Scroller(sc_side, l->args[2] << (FRACBITS - SCROLL_SHIFT), l->args[3] << (FRACBITS - SCROLL_SHIFT), control, lines[s].sidenum[1], accel, 0); } break; } - case 505: - s = lines[i].sidenum[0]; - Add_Scroller(sc_side, -sides[s].textureoffset, sides[s].rowoffset, -1, s, accel, 0); - break; - - case 506: - s = lines[i].sidenum[1]; - - if (s != 0xffff) - Add_Scroller(sc_side, -sides[s].textureoffset, sides[s].rowoffset, -1, lines[i].sidenum[0], accel, 0); - else - CONS_Debug(DBG_GAMELOGIC, "Line special 506 (line #%s) missing back side!\n", sizeu1(i)); - break; - - case 507: - s = lines[i].sidenum[0]; - - if (lines[i].sidenum[1] != 0xffff) - Add_Scroller(sc_side, -sides[s].textureoffset, sides[s].rowoffset, -1, lines[i].sidenum[1], accel, 0); - else - CONS_Debug(DBG_GAMELOGIC, "Line special 507 (line #%s) missing back side!\n", sizeu1(i)); - break; - - case 508: - s = lines[i].sidenum[1]; - - if (s != 0xffff) - Add_Scroller(sc_side, -sides[s].textureoffset, sides[s].rowoffset, -1, s, accel, 0); - else - CONS_Debug(DBG_GAMELOGIC, "Line special 508 (line #%s) missing back side!\n", sizeu1(i)); - break; - - case 500: // scroll first side - Add_Scroller(sc_side, FRACUNIT, 0, -1, lines[i].sidenum[0], accel, 0); - break; - - case 501: // jff 1/30/98 2-way scroll - Add_Scroller(sc_side, -FRACUNIT, 0, -1, lines[i].sidenum[0], accel, 0); + case 500: + if (l->args[0] != TMSD_BACK) + Add_Scroller(sc_side, -l->args[1] << FRACBITS, l->args[2] << FRACBITS, -1, l->sidenum[0], accel, 0); + if (l->args[0] != TMSD_FRONT) + { + if (l->sidenum[1] != 0xffff) + Add_Scroller(sc_side, -l->args[1] << FRACBITS, l->args[2] << FRACBITS, -1, l->sidenum[1], accel, 0); + else + CONS_Debug(DBG_GAMELOGIC, "Line special 500 (line #%s) missing back side!\n", sizeu1(i)); + } break; } } @@ -7581,7 +7630,7 @@ void T_Disappear(disappear_t *d) { ffloor_t *rover; register INT32 s; - mtag_t afftag = Tag_FGet(&lines[d->affectee].tags); + mtag_t afftag = lines[d->affectee].args[0]; TAG_ITER_SECTORS(afftag, s) { @@ -7596,7 +7645,7 @@ void T_Disappear(disappear_t *d) { rover->flags |= FF_EXISTS; - if (!(lines[d->sourceline].flags & ML_NOCLIMB)) + if (!(lines[d->sourceline].args[5])) { sectors[s].soundorg.z = P_GetFFloorTopZAt(rover, sectors[s].soundorg.x, sectors[s].soundorg.y); S_StartSound(§ors[s].soundorg, sfx_appear); @@ -8079,7 +8128,7 @@ static void P_ResetColormapFader(sector_t *sector) // The thinker is the first member in all the action structs, // so just let the thinker get freed, and that will free the whole // structure. - P_RemoveThinker(&((elevator_t *)sector->fadecolormapdata)->thinker); + P_RemoveThinker(&((thinkerdata_t *)sector->fadecolormapdata)->thinker); sector->fadecolormapdata = NULL; } } @@ -8308,40 +8357,32 @@ void T_Friction(friction_t *f) static void P_SpawnFriction(void) { size_t i; - line_t *l = lines; - mtag_t tag; - register INT32 s; - fixed_t strength; // frontside texture offset controls magnitude + sector_t *s = sectors; + fixed_t friction; // friction value to be applied during movement INT32 movefactor; // applied to each player move to simulate inertia - for (i = 0; i < numlines; i++, l++) - if (l->special == 540) - { - tag = Tag_FGet(&l->tags); - strength = sides[l->sidenum[0]].textureoffset>>FRACBITS; - if (strength > 0) // sludge - strength = strength*2; // otherwise, the maximum sludginess value is +967... + for (i = 0; i < numsectors; i++, s++) + { + if (s->friction == ORIG_FRICTION) + continue; - // The following might seem odd. At the time of movement, - // the move distance is multiplied by 'friction/0x10000', so a - // higher friction value actually means 'less friction'. - friction = ORIG_FRICTION - (0x1EB8*strength)/0x80; // ORIG_FRICTION is 0xE800 + friction = s->friction; - if (friction > FRACUNIT) - friction = FRACUNIT; - if (friction < 0) - friction = 0; + if (friction > FRACUNIT) + friction = FRACUNIT; + if (friction < 0) + friction = 0; - movefactor = FixedDiv(ORIG_FRICTION, friction); - if (movefactor < FRACUNIT) - movefactor = 8*movefactor - 7*FRACUNIT; - else - movefactor = FRACUNIT; + movefactor = FixedDiv(ORIG_FRICTION, friction); + if (movefactor < FRACUNIT) + movefactor = 8*movefactor - 7*FRACUNIT; + else + movefactor = FRACUNIT; - TAG_ITER_SECTORS(tag, s) - Add_Friction(friction, movefactor, s, -1); - } + Add_Friction(friction, movefactor, (INT32)(s-sectors), -1); + + } } /* @@ -8360,20 +8401,20 @@ static void P_SpawnFriction(void) * \param type Type of push/pull effect. * \param x_mag X magnitude. * \param y_mag Y magnitude. - * \param source For a point pusher/puller, the source object. + * \param z_mag Z magnitude. * \param affectee Target sector. * \param referrer What sector set it * \sa T_Pusher, P_GetPushThing, P_SpawnPushers */ -static void Add_Pusher(pushertype_e type, fixed_t x_mag, fixed_t y_mag, mobj_t *source, INT32 affectee, INT32 referrer, INT32 exclusive, INT32 slider) +static void Add_Pusher(pushertype_e type, fixed_t x_mag, fixed_t y_mag, fixed_t z_mag, INT32 affectee, INT32 referrer, INT32 exclusive, INT32 slider) { pusher_t *p = Z_Calloc(sizeof *p, PU_LEVSPEC, NULL); p->thinker.function.acp1 = (actionf_p1)T_Pusher; - p->source = source; p->type = type; - p->x_mag = x_mag>>FRACBITS; - p->y_mag = y_mag>>FRACBITS; + p->x_mag = x_mag; + p->y_mag = y_mag; + p->z_mag = z_mag; p->exclusive = exclusive; p->slider = slider; @@ -8381,185 +8422,18 @@ static void Add_Pusher(pushertype_e type, fixed_t x_mag, fixed_t y_mag, mobj_t * { p->roverpusher = true; p->referrer = referrer; + sectors[referrer].specialflags |= SSF_WINDCURRENT; } else - p->roverpusher = false; - - // "The right triangle of the square of the length of the hypotenuse is equal to the sum of the squares of the lengths of the other two sides." - // "Bah! Stupid brains! Don't you know anything besides the Pythagorean Theorem?" - Earthworm Jim - if (type == p_downcurrent || type == p_upcurrent || type == p_upwind || type == p_downwind) - p->magnitude = P_AproxDistance(p->x_mag,p->y_mag)<<(FRACBITS-PUSH_FACTOR); - else - p->magnitude = P_AproxDistance(p->x_mag,p->y_mag); - if (source) // point source exist? { - // where force goes to zero - if (type == p_push) - p->radius = AngleFixed(source->angle); - else - p->radius = (p->magnitude)<<(FRACBITS+1); - - p->x = p->source->x; - p->y = p->source->y; - p->z = p->source->z; + p->roverpusher = false; + sectors[affectee].specialflags |= SSF_WINDCURRENT; } + p->affectee = affectee; P_AddThinker(THINK_MAIN, &p->thinker); } - -// PIT_PushThing determines the angle and magnitude of the effect. -// The object's x and y momentum values are changed. -static pusher_t *tmpusher; // pusher structure for blockmap searches - -/** Applies a point pusher/puller to a thing. - * - * \param thing Thing to be pushed. - * \return True if the thing was pushed. - * \todo Make a more robust P_BlockThingsIterator() so the hidden parameter - * ::tmpusher won't need to be used. - * \sa T_Pusher - */ -static inline boolean PIT_PushThing(mobj_t *thing) -{ - if (thing->eflags & MFE_PUSHED) - return false; - - if (thing->player && thing->player->powers[pw_carry] == CR_ROPEHANG) - return false; - - if (!tmpusher->source) - return false; - - // Allow this to affect pushable objects at some point? - if (thing->player && (!(thing->flags & (MF_NOGRAVITY | MF_NOCLIP)) || thing->player->powers[pw_carry] == CR_NIGHTSMODE)) - { - INT32 dist; - INT32 speed; - INT32 sx, sy, sz; - - sx = tmpusher->x; - sy = tmpusher->y; - sz = tmpusher->z; - - // don't fade wrt Z if health & 2 (mapthing has multi flag) - if (tmpusher->source->health & 2) - dist = P_AproxDistance(thing->x - sx,thing->y - sy); - else - { - // Make sure the Z is in range - if (thing->z < sz - tmpusher->radius || thing->z > sz + tmpusher->radius) - return false; - - dist = P_AproxDistance(P_AproxDistance(thing->x - sx, thing->y - sy), - thing->z - sz); - } - - speed = (tmpusher->magnitude - ((dist>>FRACBITS)>>1))<<(FRACBITS - PUSH_FACTOR - 1); - - // If speed <= 0, you're outside the effective radius. You also have - // to be able to see the push/pull source point. - - // Written with bits and pieces of P_HomingAttack - if ((speed > 0) && (P_CheckSight(thing, tmpusher->source))) - { - if (thing->player->powers[pw_carry] != CR_NIGHTSMODE) - { - // only push wrt Z if health & 1 (mapthing has ambush flag) - if (tmpusher->source->health & 1) - { - fixed_t tmpmomx, tmpmomy, tmpmomz; - - tmpmomx = FixedMul(FixedDiv(sx - thing->x, dist), speed); - tmpmomy = FixedMul(FixedDiv(sy - thing->y, dist), speed); - tmpmomz = FixedMul(FixedDiv(sz - thing->z, dist), speed); - if (tmpusher->source->type == MT_PUSH) // away! - { - tmpmomx *= -1; - tmpmomy *= -1; - tmpmomz *= -1; - } - - thing->momx += tmpmomx; - thing->momy += tmpmomy; - thing->momz += tmpmomz; - - if (thing->player) - { - thing->player->cmomx += tmpmomx; - thing->player->cmomy += tmpmomy; - thing->player->cmomx = FixedMul(thing->player->cmomx, 0xe800); - thing->player->cmomy = FixedMul(thing->player->cmomy, 0xe800); - } - } - else - { - angle_t pushangle; - - pushangle = R_PointToAngle2(thing->x, thing->y, sx, sy); - if (tmpusher->source->type == MT_PUSH) - pushangle += ANGLE_180; // away - pushangle >>= ANGLETOFINESHIFT; - thing->momx += FixedMul(speed, FINECOSINE(pushangle)); - thing->momy += FixedMul(speed, FINESINE(pushangle)); - - if (thing->player) - { - thing->player->cmomx += FixedMul(speed, FINECOSINE(pushangle)); - thing->player->cmomy += FixedMul(speed, FINESINE(pushangle)); - thing->player->cmomx = FixedMul(thing->player->cmomx, 0xe800); - thing->player->cmomy = FixedMul(thing->player->cmomy, 0xe800); - } - } - } - else - { - //NiGHTS-specific handling. - //By default, pushes and pulls only affect the Z-axis. - //By having the ambush flag, it affects the X-axis. - //By having the object special flag, it affects the Y-axis. - fixed_t tmpmomx, tmpmomy, tmpmomz; - - if (tmpusher->source->health & 1) - tmpmomx = FixedMul(FixedDiv(sx - thing->x, dist), speed); - else - tmpmomx = 0; - - if (tmpusher->source->health & 2) - tmpmomy = FixedMul(FixedDiv(sy - thing->y, dist), speed); - else - tmpmomy = 0; - - tmpmomz = FixedMul(FixedDiv(sz - thing->z, dist), speed); - - if (tmpusher->source->type == MT_PUSH) // away! - { - tmpmomx *= -1; - tmpmomy *= -1; - tmpmomz *= -1; - } - - thing->momx += tmpmomx; - thing->momy += tmpmomy; - thing->momz += tmpmomz; - - if (thing->player) - { - thing->player->cmomx += tmpmomx; - thing->player->cmomy += tmpmomy; - thing->player->cmomx = FixedMul(thing->player->cmomx, 0xe800); - thing->player->cmomy = FixedMul(thing->player->cmomy, 0xe800); - } - } - } - } - - if (tmpusher->exclusive) - thing->eflags |= MFE_PUSHED; - - return true; -} - /** Applies a pusher to all affected objects. * * \param p Thinker for the pusher effect. @@ -8571,30 +8445,19 @@ void T_Pusher(pusher_t *p) sector_t *sec, *referrer = NULL; mobj_t *thing; msecnode_t *node; - INT32 xspeed = 0,yspeed = 0; - INT32 xl, xh, yl, yh, bx, by; - INT32 radius; - //INT32 ht = 0; + fixed_t x_mag, y_mag, z_mag; + fixed_t xspeed = 0, yspeed = 0, zspeed = 0; boolean inFOF; boolean touching; boolean moved; - xspeed = yspeed = 0; + x_mag = p->x_mag >> PUSH_FACTOR; + y_mag = p->y_mag >> PUSH_FACTOR; + z_mag = p->z_mag >> PUSH_FACTOR; sec = sectors + p->affectee; - - // Be sure the special sector type is still turned on. If so, proceed. - // Else, bail out; the sector type has been changed on us. - if (p->roverpusher) - { - referrer = §ors[p->referrer]; - - if (GETSECSPECIAL(referrer->special, 3) != 2) - return; - } - else if (GETSECSPECIAL(sec->special, 3) != 2) - return; + referrer = sectors + p->referrer; // For constant pushers (wind/current) there are 3 situations: // @@ -8614,29 +8477,6 @@ void T_Pusher(pusher_t *p) // // In Phase II, you can apply these effects to Things other than players. - if (p->type == p_push) - { - - // Seek out all pushable things within the force radius of this - // point pusher. Crosses sectors, so use blockmap. - - tmpusher = p; // MT_PUSH/MT_PULL point source - radius = p->radius; // where force goes to zero - tmbbox[BOXTOP] = p->y + radius; - tmbbox[BOXBOTTOM] = p->y - radius; - tmbbox[BOXRIGHT] = p->x + radius; - tmbbox[BOXLEFT] = p->x - radius; - - xl = (unsigned)(tmbbox[BOXLEFT] - bmaporgx - MAXRADIUS)>>MAPBLOCKSHIFT; - xh = (unsigned)(tmbbox[BOXRIGHT] - bmaporgx + MAXRADIUS)>>MAPBLOCKSHIFT; - yl = (unsigned)(tmbbox[BOXBOTTOM] - bmaporgy - MAXRADIUS)>>MAPBLOCKSHIFT; - yh = (unsigned)(tmbbox[BOXTOP] - bmaporgy + MAXRADIUS)>>MAPBLOCKSHIFT; - for (bx = xl; bx <= xh; bx++) - for (by = yl; by <= yh; by++) - P_BlockThingsIterator(bx,by, PIT_PushThing); - return; - } - // constant pushers p_wind and p_current node = sec->touching_thinglist; // things touching this sector for (; node; node = node->m_thinglist_next) @@ -8711,84 +8551,36 @@ void T_Pusher(pusher_t *p) if (!touching && !inFOF) // Object is out of range of effect continue; - if (p->type == p_wind) + if (inFOF || (p->type == p_current && touching)) { - if (touching) // on ground - { - xspeed = (p->x_mag)>>1; // half force - yspeed = (p->y_mag)>>1; - moved = true; - } - else if (inFOF) - { - xspeed = (p->x_mag); // full force - yspeed = (p->y_mag); - moved = true; - } + xspeed = x_mag; // full force + yspeed = y_mag; + zspeed = z_mag; + moved = true; } - else if (p->type == p_upwind) + else if (p->type == p_wind && touching) { - if (touching) // on ground - { - thing->momz += (p->magnitude)>>1; - moved = true; - } - else if (inFOF) - { - thing->momz += p->magnitude; - moved = true; - } - } - else if (p->type == p_downwind) - { - if (touching) // on ground - { - thing->momz -= (p->magnitude)>>1; - moved = true; - } - else if (inFOF) - { - thing->momz -= p->magnitude; - moved = true; - } - } - else // p_current - { - if (!touching && !inFOF) // Not in water at all - xspeed = yspeed = 0; // no force - else // underwater / touching water - { - if (p->type == p_upcurrent) - thing->momz += p->magnitude; - else if (p->type == p_downcurrent) - thing->momz -= p->magnitude; - else - { - xspeed = p->x_mag; // full force - yspeed = p->y_mag; - } - moved = true; - } + xspeed = x_mag>>1; // half force + yspeed = y_mag>>1; + zspeed = z_mag>>1; + moved = true; } - if (p->type != p_downcurrent && p->type != p_upcurrent - && p->type != p_upwind && p->type != p_downwind) + thing->momx += xspeed; + thing->momy += yspeed; + thing->momz += zspeed; + if (thing->player) { - thing->momx += xspeed<<(FRACBITS-PUSH_FACTOR); - thing->momy += yspeed<<(FRACBITS-PUSH_FACTOR); - if (thing->player) - { - thing->player->cmomx += xspeed<<(FRACBITS-PUSH_FACTOR); - thing->player->cmomy += yspeed<<(FRACBITS-PUSH_FACTOR); - thing->player->cmomx = FixedMul(thing->player->cmomx, ORIG_FRICTION); - thing->player->cmomy = FixedMul(thing->player->cmomy, ORIG_FRICTION); - } - - // Tumbleweeds bounce a bit... - if (thing->type == MT_LITTLETUMBLEWEED || thing->type == MT_BIGTUMBLEWEED) - thing->momz += P_AproxDistance(xspeed<<(FRACBITS-PUSH_FACTOR), yspeed<<(FRACBITS-PUSH_FACTOR)) >> 2; + thing->player->cmomx += xspeed; + thing->player->cmomy += yspeed; + thing->player->cmomx = FixedMul(thing->player->cmomx, ORIG_FRICTION); + thing->player->cmomy = FixedMul(thing->player->cmomy, ORIG_FRICTION); } + // Tumbleweeds bounce a bit... + if (thing->type == MT_LITTLETUMBLEWEED || thing->type == MT_BIGTUMBLEWEED) + thing->momz += P_AproxDistance(xspeed, yspeed) >> 2; + if (moved) { if (p->slider && thing->player) @@ -8800,7 +8592,7 @@ void T_Pusher(pusher_t *p) thing->player->pflags |= jumped; thing->player->pflags |= PF_SLIDING; - thing->angle = R_PointToAngle2 (0, 0, xspeed<<(FRACBITS-PUSH_FACTOR), yspeed<<(FRACBITS-PUSH_FACTOR)); + thing->angle = R_PointToAngle2(0, 0, xspeed, yspeed); if (!demoplayback || P_ControlStyle(thing->player) == CS_LMAOGALOG) { @@ -8819,86 +8611,33 @@ void T_Pusher(pusher_t *p) } } - -/** Gets a push/pull object. - * - * \param s Sector number to look in. - * \return Pointer to the first ::MT_PUSH or ::MT_PULL object found in the - * sector. - * \sa P_GetTeleportDestThing, P_GetStarpostThing, P_GetAltViewThing - */ -mobj_t *P_GetPushThing(UINT32 s) -{ - mobj_t *thing; - sector_t *sec; - - sec = sectors + s; - thing = sec->thinglist; - while (thing) - { - switch (thing->type) - { - case MT_PUSH: - case MT_PULL: - return thing; - default: - break; - } - thing = thing->snext; - } - return NULL; -} - /** Spawns pushers. * - * \todo Remove magic numbers. * \sa P_SpawnSpecials, Add_Pusher */ static void P_SpawnPushers(void) { size_t i; line_t *l = lines; - mtag_t tag; register INT32 s; - mobj_t *thing; + fixed_t length, hspeed, dx, dy; for (i = 0; i < numlines; i++, l++) { - tag = Tag_FGet(&l->tags); - switch (l->special) + if (l->special != 541) + continue; + + length = R_PointToDist2(l->v2->x, l->v2->y, l->v1->x, l->v1->y); + hspeed = l->args[1] << FRACBITS; + dx = FixedMul(FixedDiv(l->dx, length), hspeed); + dy = FixedMul(FixedDiv(l->dy, length), hspeed); + + if (l->args[0] == 0) + Add_Pusher(l->args[3], dx, dy, l->args[2] << FRACBITS, (INT32)(l->frontsector - sectors), -1, !(l->args[4] & TMPF_NONEXCLUSIVE), !!(l->args[4] & TMPF_SLIDE)); + else { - case 541: // wind - TAG_ITER_SECTORS(tag, s) - Add_Pusher(p_wind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); - break; - case 544: // current - TAG_ITER_SECTORS(tag, s) - Add_Pusher(p_current, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); - break; - case 547: // push/pull - TAG_ITER_SECTORS(tag, s) - { - thing = P_GetPushThing(s); - if (thing) // No MT_P* means no effect - Add_Pusher(p_push, l->dx, l->dy, thing, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); - } - break; - case 545: // current up - TAG_ITER_SECTORS(tag, s) - Add_Pusher(p_upcurrent, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); - break; - case 546: // current down - TAG_ITER_SECTORS(tag, s) - Add_Pusher(p_downcurrent, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); - break; - case 542: // wind up - TAG_ITER_SECTORS(tag, s) - Add_Pusher(p_upwind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); - break; - case 543: // wind down - TAG_ITER_SECTORS(tag, s) - Add_Pusher(p_downwind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); - break; + TAG_ITER_SECTORS(l->args[0], s) + Add_Pusher(l->args[3], dx, dy, l->args[2] << FRACBITS, s, -1, !(l->args[4] & TMPF_NONEXCLUSIVE), !!(l->args[4] & TMPF_SLIDE)); } } } diff --git a/src/p_spec.h b/src/p_spec.h index 75954abe2..33d18d63e 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -21,6 +21,450 @@ extern mobj_t *skyboxmo[2]; // current skybox mobjs: 0 = viewpoint, 1 = centerpo extern mobj_t *skyboxviewpnts[16]; // array of MT_SKYBOX viewpoint mobjs extern mobj_t *skyboxcenterpnts[16]; // array of MT_SKYBOX centerpoint mobjs +// Amount (dx, dy) vector linedef is shifted right to get scroll amount +#define SCROLL_SHIFT 5 + +typedef enum +{ + TMM_DOUBLESIZE = 1, + TMM_SILENT = 1<<1, + TMM_ALLOWYAWCONTROL = 1<<2, + TMM_SWING = 1<<3, + TMM_MACELINKS = 1<<4, + TMM_CENTERLINK = 1<<5, + TMM_CLIP = 1<<6, + TMM_ALWAYSTHINK = 1<<7, +} textmapmaceflags_t; + +typedef enum +{ + TMDA_BOTTOMOFFSET = 1, + TMDA_BOTTOM = 1<<1, + TMDA_MIDDLE = 1<<2, + TMDA_TOP = 1<<3, +} textmapdronealignment_t; + +typedef enum +{ + TMSF_RETRACTED = 1, + TMSF_INTANGIBLE = 1<<1, +} textmapspikeflags_t; + +typedef enum +{ + TMFF_AIMLESS = 1, + TMFF_STATIONARY = 1<<1, + TMFF_HOP = 1<<2, +} textmapflickyflags_t; + +typedef enum +{ + TMFH_NOFLAME = 1, + TMFH_CORONA = 1<<1, +} textmapflameholderflags_t; + +typedef enum +{ + TMDS_NOGRAVITY = 1, + TMDS_ROTATEEXTRA = 1<<1, +} textmapdiagonalspringflags_t; + +typedef enum +{ + TMF_INVISIBLE = 1, + TMF_NODISTANCECHECK = 1<<1, +} textmapfanflags_t; + +typedef enum +{ + TMGD_BACK = 0, + TMGD_RIGHT = 1, + TMGD_LEFT = 2, +} textmapguarddirection_t; + +typedef enum +{ + TMNI_BONUSONLY = 1, + TMNI_REVEAL = 1<<1, +} textmapnightsitem_t; + +typedef enum +{ + TMP_NORMAL = 0, + TMP_SLIDE = 1, + TMP_IMMOVABLE = 2, + TMP_CLASSIC = 3, +} textmappushabletype_t; + +typedef enum +{ + TMED_NONE = 0, + TMED_RIGHT = 1, + TMED_LEFT = 2, +} textmapeggrobodirection_t; + +typedef enum +{ + TMMR_SAME = 0, + TMMR_WEAK = 1, + TMMR_STRONG = 2, +} textmapmonitorrespawn_t; + +typedef enum +{ + TMF_GRAYSCALE = 1, + TMF_SKIPINTRO = 1<<1, +} textmapfangflags_t; + +typedef enum +{ + TMB_NODEATHFLING = 1, + TMB_BARRIER = 1<<1, +} textmapbrakflags_t; + +typedef enum +{ + TMEF_SKIPTALLY = 1, + TMEF_EMERALDCHECK = 1<<1, +} textmapexitflags_t; + +typedef enum +{ + TMSP_NOTELEPORT = 1, + TMSP_FORCESPIN = 1<<1, +} textmapspeedpadflags_t; + +//FOF flags +typedef enum +{ + TMFA_NOPLANES = 1, + TMFA_NOSIDES = 1<<1, + TMFA_INSIDES = 1<<2, + TMFA_ONLYINSIDES = 1<<3, + TMFA_NOSHADE = 1<<4, + TMFA_SPLAT = 1<<5, +} textmapfofappearance_t; + +typedef enum +{ + TMFT_INTANGIBLETOP = 1, + TMFT_INTANGIBLEBOTTOM = 1<<1, + TMFT_DONTBLOCKPLAYER = 1<<2, + TMFT_VISIBLEFROMINSIDE = (TMFT_INTANGIBLETOP|TMFT_INTANGIBLEBOTTOM|TMFT_DONTBLOCKPLAYER), + TMFT_DONTBLOCKOTHERS = 1<<3, + TMFT_INTANGIBLE = (TMFT_DONTBLOCKPLAYER|TMFT_DONTBLOCKOTHERS), +} textmapfoftangibility_t; + +typedef enum +{ + TMFW_NOSIDES = 1, + TMFW_DOUBLESHADOW = 1<<1, + TMFW_COLORMAPONLY = 1<<2, + TMFW_NORIPPLE = 1<<3, + TMFW_GOOWATER = 1<<4, + TMFW_SPLAT = 1<<5, +} textmapfofwater_t; + +typedef enum +{ + TMFB_REVERSE = 1, + TMFB_SPINDASH = 1<<1, + TMFB_DYNAMIC = 1<<2, +} textmapfofbobbing_t; + +typedef enum +{ + TMFC_NOSHADE = 1, + TMFC_NORETURN = 1<<1, + TMFC_AIRBOB = 1<<2, + TMFC_FLOATBOB = 1<<3, + TMFC_SPLAT = 1<<4, +} textmapfofcrumbling_t; + +typedef enum +{ + TMFR_REVERSE = 1, + TMFR_SPINDASH = 1<<1, +} textmapfofrising_t; + +typedef enum +{ + TMFM_BRICK = 1, + TMFM_INVISIBLE = 1<<1, +} textmapfofmario_t; + +typedef enum +{ + TMFB_TOUCH, + TMFB_SPIN, + TMFB_REGULAR, + TMFB_STRONG, +} textmapfofbusttype_t; + +typedef enum +{ + TMFB_PUSHABLES = 1, + TMFB_EXECUTOR = 1<<1, + TMFB_ONLYBOTTOM = 1<<2, + TMFB_SPLAT = 1<<3, +} textmapfofbustflags_t; + +typedef enum +{ + TMFL_NOBOSSES = 1, + TMFL_SPLAT = 1<<1, +} textmapfoflaserflags_t; + +typedef enum +{ + TMT_CONTINUOUS = 0, + TMT_ONCE = 1, + TMT_EACHTIMEMASK = TMT_ONCE, + TMT_EACHTIMEENTER = 2, + TMT_EACHTIMEENTERANDEXIT = 3, +} textmaptriggertype_t; + +typedef enum +{ + TMXT_CONTINUOUS = 0, + TMXT_EACHTIMEMASK = TMXT_CONTINUOUS, + TMXT_EACHTIMEENTER = 1, + TMXT_EACHTIMEENTERANDEXIT = 2, +} textmapxtriggertype_t; + +typedef enum +{ + TMF_HASALL = 0, + TMF_HASANY = 1, + TMF_HASEXACTLY = 2, + TMF_DOESNTHAVEALL = 3, + TMF_DOESNTHAVEANY = 4, +} textmapflagcheck_t; + +typedef enum +{ + TMT_RED = 0, + TMT_BLUE = 1, +} textmapteam_t; + +typedef enum +{ + TMC_EQUAL = 0, + TMC_LTE = 1, + TMC_GTE = 2, +} textmapcomparison_t; + +typedef enum +{ + TMNP_FASTEST = 0, + TMNP_SLOWEST = 1, + TMNP_TRIGGERER = 2, +} textmapnightsplayer_t; + +typedef enum +{ + TMN_ALWAYS = 0, + TMN_FROMNONIGHTS = 1, + TMN_FROMNIGHTS = 2, +} textmapnighterizeoptions_t; + +typedef enum +{ + TMN_BONUSLAPS = 1, + TMN_LEVELCOMPLETION = 1<<2, +} textmapnightserizeflags_t; + +typedef enum +{ + TMD_ALWAYS = 0, + TMD_NOBODYNIGHTS = 1, + TMD_SOMEBODYNIGHTS = 2, +} textmapdenighterizeoptions_t; + +typedef enum +{ + TMS_IFENOUGH = 0, + TMS_IFNOTENOUGH = 1, + TMS_ALWAYS = 2, +} textmapspherescheck_t; + +typedef enum +{ + TMI_BONUSLAPS = 1, + TMI_ENTER = 1<<2, +} textmapideyacaptureflags_t; + +typedef enum +{ + TMP_FLOOR = 0, + TMP_CEILING = 1, + TMP_BOTH = 2, +} textmapplanes_t; + +typedef enum +{ + TMT_ADD = 0, + TMT_REMOVE = 1, + TMT_REPLACEFIRST = 2, + TMT_TRIGGERTAG = 3, +} textmaptagoptions_t; + +typedef enum +{ + TMT_SILENT = 1, + TMT_KEEPANGLE = 1<<1, + TMT_KEEPMOMENTUM = 1<<2, + TMT_RELATIVE = 1<<3, +} textmapteleportflags_t; + +typedef enum +{ + TMM_ALLPLAYERS = 1, + TMM_OFFSET = 1<<1, + TMM_FADE = 1<<2, + TMM_NORELOAD = 1<<3, + TMM_FORCERESET = 1<<4, + TMM_NOLOOP = 1<<5, +} textmapmusicflags_t; + +typedef enum +{ + TMSS_TRIGGERMOBJ = 0, + TMSS_TRIGGERSECTOR = 1, + TMSS_NOWHERE = 2, + TMSS_TAGGEDSECTOR = 3, +} textmapsoundsource_t; + +typedef enum +{ + TMSL_EVERYONE = 0, + TMSL_TRIGGERER = 1, + TMSL_TAGGEDSECTOR = 2, +} textmapsoundlistener_t; + +typedef enum +{ + TML_SECTOR = 0, + TML_FLOOR = 1, + TML_CEILING = 2, +} textmaplightareas_t; + +typedef enum +{ + TMLC_NOSECTOR = 1, + TMLC_NOFLOOR = 1<<1, + TMLC_NOCEILING = 1<<2, +} textmaplightcopyflags_t; + +typedef enum +{ + TMF_RELATIVE = 1, + TMF_OVERRIDE = 1<<1, + TMF_TICBASED = 1<<2, +} textmapfadeflags_t; + +typedef enum +{ + TMB_USETARGET = 1, + TMB_SYNC = 1<<1, +} textmapblinkinglightflags_t; + +typedef enum +{ + TMFR_NORETURN = 1, + TMFR_CHECKFLAG = 1<<1, +} textmapfofrespawnflags_t; + +typedef enum +{ + TMST_RELATIVE = 1, + TMST_DONTDOTRANSLUCENT = 1<<1, +} textmapsettranslucencyflags_t; + +typedef enum +{ + TMFT_RELATIVE = 1, + TMFT_OVERRIDE = 1<<1, + TMFT_TICBASED = 1<<2, + TMFT_IGNORECOLLISION = 1<<3, + TMFT_GHOSTFADE = 1<<4, + TMFT_DONTDOTRANSLUCENT = 1<<5, + TMFT_DONTDOEXISTS = 1<<6, + TMFT_DONTDOLIGHTING = 1<<7, + TMFT_DONTDOCOLORMAP = 1<<8, + TMFT_USEEXACTALPHA = 1<<9, +} textmapfadetranslucencyflags_t; + +typedef enum +{ + TMS_VIEWPOINT = 0, + TMS_CENTERPOINT = 1, + TMS_BOTH = 2, +} textmapskybox_t; + +typedef enum +{ + TMP_CLOSE = 1, + TMP_RUNPOSTEXEC = 1<<1, + TMP_CALLBYNAME = 1<<2, + TMP_KEEPCONTROLS = 1<<3, + TMP_KEEPREALTIME = 1<<4, + //TMP_ALLPLAYERS = 1<<5, + //TMP_FREEZETHINKERS = 1<<6, +} textmappromptflags_t; + +typedef enum +{ + TMF_NOCHANGE = 0, + TMF_ADD = 1, + TMF_REMOVE = 2, +} textmapsetflagflags_t; + +typedef enum +{ + TMSD_FRONT = 0, + TMSD_BACK = 1, + TMSD_FRONTBACK = 2, +} textmapsides_t; + +typedef enum +{ + TMS_SCROLLCARRY = 0, + TMS_SCROLLONLY = 1, + TMS_CARRYONLY = 2, +} textmapscroll_t; + +typedef enum +{ + TMST_REGULAR = 0, + TMST_ACCELERATIVE = 1, + TMST_DISPLACEMENT = 2, + TMST_TYPEMASK = 3, + TMST_NONEXCLUSIVE = 4, +} textmapscrolltype_t; + +typedef enum +{ + TMPF_SLIDE = 1, + TMPF_NONEXCLUSIVE = 1<<1, +} textmappusherflags_t; + +typedef enum +{ + TMPP_NOZFADE = 1, + TMPP_PUSHZ = 1<<1, + TMPP_NONEXCLUSIVE = 1<<2, +} textmappointpushflags_t; + +typedef enum +{ + TMB_TRANSLUCENT = 0, + TMB_ADD = 1, + TMB_SUBTRACT = 2, + TMB_REVERSESUBTRACT = 3, + TMB_MODULATE = 4, +} textmapblendmodes_t; + // GETSECSPECIAL (specialval, section) // // Pulls out the special # from a particular section. @@ -38,12 +482,21 @@ void P_SetupLevelFlatAnims(void); // at map load void P_InitSpecials(void); +void P_ApplyFlatAlignment(sector_t* sector, angle_t flatangle, fixed_t xoffs, fixed_t yoffs, boolean floor, boolean ceiling); +fixed_t P_GetSectorGravityFactor(sector_t *sec); void P_SpawnSpecials(boolean fromnetsave); // every tic void P_UpdateSpecials(void); +sector_t *P_MobjTouchingSectorSpecial(mobj_t *mo, INT32 section, INT32 number); +sector_t *P_MobjTouchingSectorSpecialFlag(mobj_t *mo, sectorspecialflags_t flag); sector_t *P_PlayerTouchingSectorSpecial(player_t *player, INT32 section, INT32 number); +sector_t *P_PlayerTouchingSectorSpecialFlag(player_t *player, sectorspecialflags_t flag); void P_PlayerInSpecialSector(player_t *player); +void P_CheckMobjTrigger(mobj_t *mobj, boolean pushable); +sector_t *P_FindPlayerTrigger(player_t *player, line_t *sourceline); +boolean P_IsPlayerValid(size_t playernum); +boolean P_CanPlayerTrigger(size_t playernum); void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *roversector); fixed_t P_FindLowestFloorSurrounding(sector_t *sec); @@ -60,6 +513,10 @@ INT32 P_FindMinSurroundingLight(sector_t *sector, INT32 max); void P_SetupSignExit(player_t *player); boolean P_IsFlagAtBase(mobjtype_t flag); +boolean P_IsMobjTouchingSectorPlane(mobj_t *mo, sector_t *sec); +boolean P_IsMobjTouching3DFloor(mobj_t *mo, ffloor_t *ffloor, sector_t *sec); +boolean P_IsMobjTouchingPolyobj(mobj_t *mo, polyobj_t *po, sector_t *polysec); + void P_SwitchWeather(INT32 weathernum); boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller); @@ -72,6 +529,12 @@ void P_RunNightsCapsuleTouchExecutors(mobj_t *actor, boolean entering, boolean e UINT16 P_GetFFloorID(ffloor_t *fflr); ffloor_t *P_GetFFloorByID(sector_t *sec, UINT16 id); +// Use this when you don't know the type of your thinker data struct but need to access its thinker. +typedef struct +{ + thinker_t thinker; +} thinkerdata_t; + // // P_LIGHTS // @@ -83,8 +546,8 @@ typedef struct sector_t *sector; ///< The sector where action is taking place. INT32 count; INT32 resetcount; - INT32 maxlight; ///< The brightest light level to use. - INT32 minlight; ///< The darkest light level to use. + INT16 maxlight; ///< The brightest light level to use. + INT16 minlight; ///< The darkest light level to use. } fireflicker_t; typedef struct @@ -112,8 +575,8 @@ typedef struct thinker_t thinker; ///< The thinker in use for the effect. sector_t *sector; ///< The sector where the action is taking place. INT32 count; - INT32 minlight; ///< The minimum light level to use. - INT32 maxlight; ///< The maximum light level to use. + INT16 minlight; ///< The minimum light level to use. + INT16 maxlight; ///< The maximum light level to use. INT32 darktime; ///< How INT32 to use minlight. INT32 brighttime; ///< How INT32 to use maxlight. } strobe_t; @@ -122,10 +585,10 @@ typedef struct { thinker_t thinker; sector_t *sector; - INT32 minlight; - INT32 maxlight; - INT32 direction; - INT32 speed; + INT16 minlight; + INT16 maxlight; + INT16 direction; + INT16 speed; } glow_t; /** Thinker struct for fading lights. @@ -151,18 +614,18 @@ typedef struct void P_RemoveLighting(sector_t *sector); void T_FireFlicker(fireflicker_t *flick); -fireflicker_t *P_SpawnAdjustableFireFlicker(sector_t *minsector, sector_t *maxsector, INT32 length); +fireflicker_t *P_SpawnAdjustableFireFlicker(sector_t *sector, INT16 lighta, INT16 lightb, INT32 length); void T_LightningFlash(lightflash_t *flash); void T_StrobeFlash(strobe_t *flash); void P_SpawnLightningFlash(sector_t *sector); -strobe_t * P_SpawnAdjustableStrobeFlash(sector_t *minsector, sector_t *maxsector, INT32 darktime, INT32 brighttime, boolean inSync); +strobe_t * P_SpawnAdjustableStrobeFlash(sector_t *sector, INT16 lighta, INT16 lightb, INT32 darktime, INT32 brighttime, boolean inSync); void T_Glow(glow_t *g); -glow_t *P_SpawnAdjustableGlowingLight(sector_t *minsector, sector_t *maxsector, INT32 length); +glow_t *P_SpawnAdjustableGlowingLight(sector_t *sector, INT16 lighta, INT16 lightb, INT32 length); void P_FadeLightBySector(sector_t *sector, INT32 destvalue, INT32 speed, boolean ticbased); -void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed, boolean ticbased, boolean force); +void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed, boolean ticbased, boolean force, boolean relative); void T_LightFade(lightlevel_t *ll); typedef enum @@ -178,22 +641,19 @@ typedef enum typedef enum { raiseToHighest, - lowerToLowest, - raiseToLowest, lowerToLowestFast, instantRaise, // instant-move for ceilings - lowerAndCrush, crushAndRaise, - fastCrushAndRaise, + raiseAndCrush, crushCeilOnce, crushBothOnce, moveCeilingByFrontSector, instantMoveCeilingByFrontSector, - moveCeilingByFrontTexture, + moveCeilingByDistance, bounceCeiling, bounceCeilingCrush, @@ -209,7 +669,6 @@ typedef struct fixed_t bottomheight; ///< The lowest height to move to. fixed_t topheight; ///< The highest height to move to. fixed_t speed; ///< Ceiling speed. - fixed_t oldspeed; fixed_t delay; fixed_t delaytimer; UINT8 crush; ///< Whether to crush things or not. @@ -218,17 +677,16 @@ typedef struct INT32 direction; ///< 1 = up, 0 = waiting, -1 = down. // ID - INT32 tag; - INT32 olddirection; + INT16 tag; ///< Tag of linedef executor to run when movement is done. fixed_t origspeed; ///< The original, "real" speed. INT32 sourceline; ///< Index of the source linedef } ceiling_t; #define CEILSPEED (FRACUNIT) -INT32 EV_DoCeiling(line_t *line, ceiling_e type); +INT32 EV_DoCeiling(mtag_t tag, line_t *line, ceiling_e type); -INT32 EV_DoCrush(line_t *line, ceiling_e type); +INT32 EV_DoCrush(mtag_t tag, line_t *line, ceiling_e type); void T_CrushCeiling(ceiling_t *ceiling); void T_MoveCeiling(ceiling_t *ceiling); @@ -238,9 +696,6 @@ void T_MoveCeiling(ceiling_t *ceiling); // typedef enum { - // lower floor to lowest surrounding floor - lowerFloorToLowest, - // raise floor to next highest surrounding floor raiseFloorToNearestFast, @@ -250,7 +705,7 @@ typedef enum moveFloorByFrontSector, instantMoveFloorByFrontSector, - moveFloorByFrontTexture, + moveFloorByDistance, bounceFloor, bounceFloorCrush, @@ -262,7 +717,6 @@ typedef enum { elevateUp, elevateDown, - elevateCurrent, elevateContinuous, elevateBounce, elevateHighest, @@ -282,6 +736,8 @@ typedef struct fixed_t origspeed; fixed_t delay; fixed_t delaytimer; + INT16 tag; + INT32 sourceline; } floormove_t; typedef struct @@ -403,7 +859,6 @@ typedef struct thinker_t thinker; line_t *sourceline; // Source line of the thinker boolean playersInArea[MAXPLAYERS]; - boolean playersOnArea[MAXPLAYERS]; boolean triggerOnExit; } eachtime_t; @@ -439,8 +894,8 @@ typedef enum result_e T_MovePlane(sector_t *sector, fixed_t speed, fixed_t dest, boolean crush, boolean ceiling, INT32 direction); -void EV_DoFloor(line_t *line, floor_e floortype); -void EV_DoElevator(line_t *line, elevator_e elevtype, boolean customspeed); +void EV_DoFloor(mtag_t tag, line_t *line, floor_e floortype); +void EV_DoElevator(mtag_t tag, line_t *line, elevator_e elevtype); void EV_CrumbleChain(sector_t *sec, ffloor_t *rover); void EV_BounceSector(sector_t *sector, fixed_t momz, line_t *sourceline); @@ -525,30 +980,20 @@ void T_Friction(friction_t *f); typedef enum { - p_push, ///< Point pusher or puller. p_wind, ///< Wind. p_current, ///< Current. - p_upcurrent, ///< Upwards current. - p_downcurrent, ///< Downwards current. - p_upwind, ///< Upwards wind. - p_downwind ///< Downwards wind. } pushertype_e; // Model for pushers for push/pull effects typedef struct { - thinker_t thinker; ///< Thinker structure for push/pull effect. - /** Types of push/pull effects. - */ - pushertype_e type; ///< Type of push/pull effect. - mobj_t *source; ///< Point source if point pusher/puller. - INT32 x_mag; ///< X strength. - INT32 y_mag; ///< Y strength. - INT32 magnitude; ///< Vector strength for point pusher/puller. - INT32 radius; ///< Effective radius for point pusher/puller. - INT32 x, y, z; ///< Point source if point pusher/puller. + thinker_t thinker; ///< Thinker structure for pusher effect. + pushertype_e type; ///< Type of pusher effect. + fixed_t x_mag; ///< X strength. + fixed_t y_mag; ///< Y strength. + fixed_t z_mag; ///< Z strength. INT32 affectee; ///< Number of affected sector. - UINT8 roverpusher; ///< flag for whether pusher originated from a FOF or not + UINT8 roverpusher; ///< flag for whether pusher originated from a FOF or not INT32 referrer; ///< If roverpusher == true, then this will contain the sector # of the control sector where the effect was applied. INT32 exclusive; /// < Once this affect has been applied to a mobj, no other pushers may affect it. INT32 slider; /// < Should the player go into an uncontrollable slide? @@ -610,9 +1055,8 @@ typedef struct void T_FadeColormap(fadecolormap_t *d); -// Prototype functions for pushers +// Prototype function for pushers void T_Pusher(pusher_t *p); -mobj_t *P_GetPushThing(UINT32 s); // Plane displacement typedef struct @@ -637,6 +1081,4 @@ void T_PlaneDisplace(planedisplace_t *pd); void P_CalcHeight(player_t *player); -sector_t *P_ThingOnSpecial3DFloor(mobj_t *mo); - #endif diff --git a/src/p_user.c b/src/p_user.c index 8e8194da0..cc5caedd6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -706,8 +706,7 @@ static void P_DeNightserizePlayer(player_t *player) // If you screwed up, kiss your score and ring bonus goodbye. // But only do this in special stage (and instakill!) In regular stages, wait til we hit the ground. - player->marescore = player->spheres =\ - player->rings = 0; + player->marescore = player->spheres = player->rings = 0; } // Check to see if the player should be killed. @@ -717,13 +716,12 @@ static void P_DeNightserizePlayer(player_t *player) continue; mo2 = (mobj_t *)th; - if (!(mo2->type == MT_NIGHTSDRONE)) + if (mo2->type != MT_NIGHTSDRONE) continue; if (mo2->flags2 & MF2_AMBUSH) { - player->marescore = player->spheres =\ - player->rings = 0; + player->marescore = player->spheres = player->rings = 0; P_DamageMobj(player->mo, NULL, NULL, 1, DMG_INSTAKILL); // Reset music to beginning if MIXNIGHTSCOUNTDOWN @@ -777,7 +775,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) UINT8 oldmare, oldmarelap, oldmarebonuslap; // Bots can't be NiGHTSerized, silly!1 :P - if (player->bot == BOT_2PAI || player->bot == BOT_2PHUMAN) + if (player->bot) return; if (player->powers[pw_carry] != CR_NIGHTSMODE) @@ -969,9 +967,6 @@ pflags_t P_GetJumpFlags(player_t *player) // boolean P_PlayerInPain(player_t *player) { - // If the player doesn't have a mobj, it can't be in pain. - if (!player->mo) - return false; // no silly, sliding isn't pain if (!(player->pflags & PF_SLIDING) && player->mo->state == &states[player->mo->info->painstate] && player->powers[pw_flashing]) return true; @@ -1238,8 +1233,8 @@ void P_GivePlayerSpheres(player_t *player, INT32 num_spheres) if (!player) return; - if ((player->bot == BOT_2PAI || player->bot == BOT_2PHUMAN) && player->botleader) - player = player->botleader; + if (player->bot) + player = &players[consoleplayer]; if (!player->mo) return; @@ -1265,8 +1260,8 @@ void P_GivePlayerLives(player_t *player, INT32 numlives) if (!player) return; - if ((player->bot == BOT_2PAI || player->bot == BOT_2PHUMAN) && player->botleader) - player = player->botleader; + if (player->bot) + player = &players[consoleplayer]; if (gamestate == GS_LEVEL) { @@ -1732,89 +1727,6 @@ boolean P_IsObjectOnGround(mobj_t *mo) return false; } -// -// P_IsObjectOnGroundIn -// -// Returns true if the player is -// on the ground in a specific sector. Takes reverse -// gravity and FOFs into account. -// -boolean P_IsObjectOnGroundIn(mobj_t *mo, sector_t *sec) -{ - ffloor_t *rover; - - // Is the object in reverse gravity? - if (mo->eflags & MFE_VERTICALFLIP) - { - // Detect if the player is on the ceiling. - if (mo->z+mo->height >= P_GetSpecialTopZ(mo, sec, sec)) - return true; - // Otherwise, detect if the player is on the bottom of a FOF. - else - { - for (rover = sec->ffloors; rover; rover = rover->next) - { - // If the FOF doesn't exist, continue. - if (!(rover->flags & FF_EXISTS)) - continue; - - // If the FOF is configured to let the object through, continue. - if (!((rover->flags & FF_BLOCKPLAYER && mo->player) - || (rover->flags & FF_BLOCKOTHERS && !mo->player))) - continue; - - // If the the platform is intangible from below, continue. - if (rover->flags & FF_PLATFORM) - continue; - - // If the FOF is a water block, continue. (Unnecessary check?) - if (rover->flags & FF_SWIMMABLE) - continue; - - // Actually check if the player is on the suitable FOF. - if (mo->z+mo->height == P_GetSpecialBottomZ(mo, sectors + rover->secnum, sec)) - return true; - } - } - } - // Nope! - else - { - // Detect if the player is on the floor. - if (mo->z <= P_GetSpecialBottomZ(mo, sec, sec)) - return true; - // Otherwise, detect if the player is on the top of a FOF. - else - { - for (rover = sec->ffloors; rover; rover = rover->next) - { - // If the FOF doesn't exist, continue. - if (!(rover->flags & FF_EXISTS)) - continue; - - // If the FOF is configured to let the object through, continue. - if (!((rover->flags & FF_BLOCKPLAYER && mo->player) - || (rover->flags & FF_BLOCKOTHERS && !mo->player))) - continue; - - // If the the platform is intangible from above, continue. - if (rover->flags & FF_REVERSEPLATFORM) - continue; - - // If the FOF is a water block, continue. (Unnecessary check?) - if (rover->flags & FF_SWIMMABLE) - continue; - - // Actually check if the player is on the suitable FOF. - if (mo->z == P_GetSpecialTopZ(mo, sectors + rover->secnum, sec)) - return true; - } - } - } - - return false; -} - // // P_SetObjectMomZ // @@ -2283,13 +2195,12 @@ void P_DoPlayerExit(player_t *player) P_RestoreMusic(player); } -#define SPACESPECIAL 12 boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space { sector_t *sector = mo->subsector->sector; fixed_t topheight, bottomheight; - if (GETSECSPECIAL(sector->special, 1) == SPACESPECIAL) + if (sector->specialflags & SSF_OUTERSPACE) return true; if (sector->ffloors) @@ -2301,7 +2212,7 @@ boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space if (!(rover->flags & FF_EXISTS)) continue; - if (GETSECSPECIAL(rover->master->frontsector->special, 1) != SPACESPECIAL) + if (!(rover->master->frontsector->specialflags & SSF_OUTERSPACE)) continue; topheight = P_GetFFloorTopZAt (rover, mo->x, mo->y); bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y); @@ -2584,58 +2495,60 @@ static boolean P_PlayerCanBust(player_t *player, ffloor_t *rover) /*if (rover->master->frontsector->crumblestate != CRUMBLE_NONE) return false;*/ - // If it's an FF_SHATTER, you can break it just by touching it. - if (rover->flags & FF_SHATTER) - return true; - - // If it's an FF_SPINBUST, you can break it if you are in your spinning frames - // (either from jumping or spindashing). - if (rover->flags & FF_SPINBUST) + switch (rover->busttype) { + case BT_TOUCH: // Shatters on contact + return true; + case BT_SPINBUST: // Can be busted by spinning (either from jumping or spindashing) if ((player->pflags & PF_SPINNING) && !(player->pflags & PF_STARTDASH)) return true; if ((player->pflags & PF_JUMPED) && !(player->pflags & PF_NOJUMPDAMAGE)) return true; + + /* FALLTHRU */ + case BT_REGULAR: + // Spinning (and not jumping) + if ((player->pflags & PF_SPINNING) && !(player->pflags & PF_JUMPED)) + return true; + + // Strong abilities can break even FF_STRONGBUST. + if (player->charflags & SF_CANBUSTWALLS) + return true; + + // Super + if (player->powers[pw_super]) + return true; + + // Dashmode + if ((player->charflags & (SF_DASHMODE|SF_MACHINE)) == (SF_DASHMODE|SF_MACHINE) && player->dashmode >= DASHMODE_THRESHOLD) + return true; + + // NiGHTS drill + if (player->pflags & PF_DRILLING) + return true; + + // Recording for Metal Sonic + if (metalrecording) + return true; + + /* FALLTHRU */ + case BT_STRONG: // Requires a "strong ability" + if (player->charability == CA_GLIDEANDCLIMB) + return true; + + if (player->pflags & PF_BOUNCING) + return true; + + if (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY) + return true; + + if (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2) + return true; + + break; } - // Strong abilities can break even FF_STRONGBUST. - if (player->charflags & SF_CANBUSTWALLS) - return true; - - if (player->pflags & PF_BOUNCING) - return true; - - if (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY) - return true; - - if (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2) - return true; - - // Everyone else is out of luck. - if (rover->flags & FF_STRONGBUST) - return false; - - // Spinning (and not jumping) - if ((player->pflags & PF_SPINNING) && !(player->pflags & PF_JUMPED)) - return true; - - // Super - if (player->powers[pw_super]) - return true; - - // Dashmode - if ((player->charflags & (SF_DASHMODE|SF_MACHINE)) == (SF_DASHMODE|SF_MACHINE) && player->dashmode >= DASHMODE_THRESHOLD) - return true; - - // NiGHTS drill - if (player->pflags & PF_DRILLING) - return true; - - // Recording for Metal Sonic - if (metalrecording) - return true; - return false; } @@ -2686,7 +2599,7 @@ static void P_CheckBustableBlocks(player_t *player) } // Height checks - if (rover->flags & FF_SHATTERBOTTOM) + if (rover->bustflags & FB_ONLYBOTTOM) { if (player->mo->z + player->mo->momz + player->mo->height < bottomheight) continue; @@ -2694,35 +2607,41 @@ static void P_CheckBustableBlocks(player_t *player) if (player->mo->z + player->mo->height > bottomheight) continue; } - else if (rover->flags & FF_SPINBUST) - { - if (player->mo->z + player->mo->momz > topheight) - continue; - - if (player->mo->z + player->mo->height < bottomheight) - continue; - } - else if (rover->flags & FF_SHATTER) - { - if (player->mo->z + player->mo->momz > topheight) - continue; - - if (player->mo->z + player->mo->momz + player->mo->height < bottomheight) - continue; - } else { - if (player->mo->z >= topheight) - continue; + switch (rover->busttype) + { + case BT_TOUCH: + if (player->mo->z + player->mo->momz > topheight) + continue; - if (player->mo->z + player->mo->height < bottomheight) - continue; + if (player->mo->z + player->mo->momz + player->mo->height < bottomheight) + continue; + + break; + case BT_SPINBUST: + if (player->mo->z + player->mo->momz > topheight) + continue; + + if (player->mo->z + player->mo->height < bottomheight) + continue; + + break; + default: + if (player->mo->z >= topheight) + continue; + + if (player->mo->z + player->mo->height < bottomheight) + continue; + + break; + } } // Impede the player's fall a bit - if (((rover->flags & FF_SPINBUST) || (rover->flags & FF_SHATTER)) && player->mo->z >= topheight) + if (((rover->busttype == BT_TOUCH) || (rover->busttype == BT_SPINBUST)) && player->mo->z >= topheight) player->mo->momz >>= 1; - else if (rover->flags & FF_SHATTER) + else if (rover->busttype == BT_TOUCH) { player->mo->momx >>= 1; player->mo->momy >>= 1; @@ -2734,8 +2653,8 @@ static void P_CheckBustableBlocks(player_t *player) EV_CrumbleChain(NULL, rover); // node->m_sector // Run a linedef executor?? - if (rover->master->flags & ML_EFFECT5) - P_LinedefExecute((INT16)(P_AproxDistance(rover->master->dx, rover->master->dy)>>FRACBITS), player->mo, node->m_sector); + if (rover->bustflags & FB_EXECUTOR) + P_LinedefExecute(rover->busttag, player->mo, node->m_sector); goto bustupdone; } @@ -2780,14 +2699,20 @@ static void P_CheckBouncySectors(player_t *player) for (rover = node->m_sector->ffloors; rover; rover = rover->next) { - fixed_t bouncestrength; fixed_t topheight, bottomheight; if (!(rover->flags & FF_EXISTS)) continue; // FOFs should not be bouncy if they don't even "exist" - if (GETSECSPECIAL(rover->master->frontsector->special, 1) != 15) - continue; // this sector type is required for FOFs to be bouncy + // Handle deprecated bouncy FOF sector type + if (!udmf && GETSECSPECIAL(rover->master->frontsector->special, 1) == 15) + { + rover->flags |= FF_BOUNCY; + rover->bouncestrength = P_AproxDistance(rover->master->dx, rover->master->dy)/100; + } + + if (!(rover->flags & FF_BOUNCY)) + continue; topheight = P_GetFOFTopZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL); bottomheight = P_GetFOFBottomZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL); @@ -2798,14 +2723,11 @@ static void P_CheckBouncySectors(player_t *player) if (player->mo->z + player->mo->height < bottomheight) continue; - bouncestrength = P_AproxDistance(rover->master->dx, rover->master->dy)/100; - if (oldz < P_GetFOFTopZ(player->mo, node->m_sector, rover, oldx, oldy, NULL) && oldz + player->mo->height > P_GetFOFBottomZ(player->mo, node->m_sector, rover, oldx, oldy, NULL)) { - player->mo->momx = -FixedMul(player->mo->momx,bouncestrength); - player->mo->momy = -FixedMul(player->mo->momy,bouncestrength); - + player->mo->momx = -FixedMul(player->mo->momx,rover->bouncestrength); + player->mo->momy = -FixedMul(player->mo->momy,rover->bouncestrength); } else { @@ -2818,9 +2740,9 @@ static void P_CheckBouncySectors(player_t *player) if (slope) P_ReverseQuantizeMomentumToSlope(&momentum, slope); - momentum.z = -FixedMul(momentum.z,bouncestrength)/2; + momentum.z = -FixedMul(momentum.z,rover->bouncestrength)/2; - if (abs(momentum.z) < (bouncestrength*2)) + if (abs(momentum.z) < (rover->bouncestrength*2)) goto bouncydone; if (momentum.z > FixedMul(24*FRACUNIT, player->mo->scale)) //half of the default player height @@ -2854,7 +2776,7 @@ bouncydone: static void P_CheckQuicksand(player_t *player) { ffloor_t *rover; - fixed_t sinkspeed, friction; + fixed_t sinkspeed; fixed_t topheight, bottomheight; if (!(player->mo->subsector->sector->ffloors && player->mo->momz <= 0)) @@ -2872,9 +2794,7 @@ static void P_CheckQuicksand(player_t *player) if (topheight >= player->mo->z && bottomheight < player->mo->z + player->mo->height) { - sinkspeed = abs(rover->master->v1->x - rover->master->v2->x)>>1; - - sinkspeed = FixedDiv(sinkspeed,TICRATE*FRACUNIT); + sinkspeed = FixedDiv(rover->sinkspeed,TICRATE*FRACUNIT); if (player->mo->eflags & MFE_VERTICALFLIP) { @@ -2901,10 +2821,8 @@ static void P_CheckQuicksand(player_t *player) P_PlayerHitFloor(player, false); } - friction = abs(rover->master->v1->y - rover->master->v2->y)>>6; - - player->mo->momx = FixedMul(player->mo->momx, friction); - player->mo->momy = FixedMul(player->mo->momy, friction); + player->mo->momx = FixedMul(player->mo->momx, rover->friction); + player->mo->momy = FixedMul(player->mo->momy, rover->friction); } } } @@ -4788,7 +4706,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd) if (onground && player->pflags & PF_SPINNING && !(player->pflags & PF_STARTDASH) && player->speed < 5*player->mo->scale && canstand) { - if (GETSECSPECIAL(player->mo->subsector->sector->special, 4) == 7 || (player->mo->ceilingz - player->mo->floorz < P_GetPlayerHeight(player))) + if ((player->mo->subsector->sector->specialflags & SSF_FORCESPIN) || (player->mo->ceilingz - player->mo->floorz < P_GetPlayerHeight(player))) P_InstaThrust(player->mo, player->mo->angle, 10*player->mo->scale); else { @@ -5682,6 +5600,22 @@ INT32 P_GetPlayerControlDirection(player_t *player) return 1; // Controls pointing in player's general direction } +static boolean P_ShouldResetConveyorMomentum(player_t *player) +{ + switch (player->onconveyor) + { + case 1: + return false; + case 2: // Wind/Current + return !(player->mo->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER)); + case 3: + default: + return true; + case 4: // Actual conveyor belt + return !P_IsObjectOnGround(player->mo); + } +} + // Control scheme for 2d levels. static void P_2dMovement(player_t *player) { @@ -5716,16 +5650,7 @@ static void P_2dMovement(player_t *player) } } - // cmomx/cmomy stands for the conveyor belt speed. - if (player->onconveyor == 2) // Wind/Current - { - //if (player->mo->z > player->mo->watertop || player->mo->z + player->mo->height < player->mo->waterbottom) - if (!(player->mo->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER))) - player->cmomx = player->cmomy = 0; - } - else if (player->onconveyor == 4 && !P_IsObjectOnGround(player->mo)) // Actual conveyor belt - player->cmomx = player->cmomy = 0; - else if (player->onconveyor != 2 && player->onconveyor != 4 && player->onconveyor != 1) + if (P_ShouldResetConveyorMomentum(player)) player->cmomx = player->cmomy = 0; player->rmomx = player->mo->momx - player->cmomx; @@ -5908,16 +5833,7 @@ static void P_3dMovement(player_t *player) } movepushsideangle = movepushangle-ANGLE_90; - // cmomx/cmomy stands for the conveyor belt speed. - if (player->onconveyor == 2) // Wind/Current - { - //if (player->mo->z > player->mo->watertop || player->mo->z + player->mo->height < player->mo->waterbottom) - if (!(player->mo->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER))) - player->cmomx = player->cmomy = 0; - } - else if (player->onconveyor == 4 && !P_IsObjectOnGround(player->mo)) // Actual conveyor belt - player->cmomx = player->cmomy = 0; - else if (player->onconveyor != 2 && player->onconveyor != 4 && player->onconveyor != 1) + if (P_ShouldResetConveyorMomentum(player)) player->cmomx = player->cmomy = 0; player->rmomx = player->mo->momx - player->cmomx; @@ -7630,8 +7546,8 @@ static void P_NiGHTSMovement(player_t *player) } } - if (objectplacing) - OP_NightsObjectplace(player); + //if (objectplacing) + // OP_NightsObjectplace(player); } // May be used in future for CTF @@ -8692,7 +8608,7 @@ void P_MovePlayer(player_t *player) #endif // Look for blocks to bust up - // Because of FF_SHATTER, we should look for blocks constantly, + // Because of BT_TOUCH, we should look for blocks constantly, // not just when spinning or playing as Knuckles if (CheckForBustableBlocks) P_CheckBustableBlocks(player); @@ -10156,7 +10072,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall for (rover = newsubsec->sector->ffloors; rover; rover = rover->next) { fixed_t topheight, bottomheight; - if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || GETSECSPECIAL(rover->master->frontsector->special, 4) == 12) + if (!(rover->flags & FF_BLOCKOTHERS) || !(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERALL) || (rover->master->frontsector->flags & MSF_NOCLIPCAMERA)) continue; topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, midx, midy, NULL); @@ -10220,7 +10136,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall // We're inside it! Yess... polysec = po->lines[0]->backsector; - if (GETSECSPECIAL(polysec->special, 4) == 12) + if (polysec->flags & MSF_NOCLIPCAMERA) { // Camera noclip polyobj. plink = (polymaplink_t *)(plink->link.next); continue; @@ -10282,7 +10198,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall for (rover = newsubsec->sector->ffloors; rover; rover = rover->next) { fixed_t topheight, bottomheight; - if ((rover->flags & FF_BLOCKOTHERS) && (rover->flags & FF_RENDERALL) && (rover->flags & FF_EXISTS) && GETSECSPECIAL(rover->master->frontsector->special, 4) != 12) + if ((rover->flags & FF_BLOCKOTHERS) && (rover->flags & FF_RENDERALL) && (rover->flags & FF_EXISTS) && !(rover->master->frontsector->flags & MSF_NOCLIPCAMERA)) { topheight = P_CameraGetFOFTopZ(thiscam, newsubsec->sector, rover, midx, midy, NULL); bottomheight = P_CameraGetFOFBottomZ(thiscam, newsubsec->sector, rover, midx, midy, NULL); @@ -10358,7 +10274,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall thiscam->momx = FixedMul(x - thiscam->x, camspeed); thiscam->momy = FixedMul(y - thiscam->y, camspeed); - if (GETSECSPECIAL(thiscam->subsector->sector->special, 1) == 6 + if (thiscam->subsector->sector->damagetype == SD_DEATHPITTILT && thiscam->z < thiscam->subsector->sector->floorheight + 256*FRACUNIT && FixedMul(z - thiscam->z, camspeed) < 0) { @@ -10565,7 +10481,6 @@ static void P_CalcPostImg(player_t *player) postimg_t *type; INT32 *param; fixed_t pviewheight; - size_t i; if (player->mo->eflags & MFE_VERTICALFLIP) pviewheight = player->mo->z + player->mo->height - player->viewheight; @@ -10590,45 +10505,30 @@ static void P_CalcPostImg(player_t *player) } // see if we are in heat (no, not THAT kind of heat...) - for (i = 0; i < sector->tags.count; i++) + if (sector->flags & MSF_HEATWAVE) + *type = postimg_heat; + else if (sector->ffloors) { - if (Tag_FindLineSpecial(13, sector->tags.tags[i]) != -1) - { - *type = postimg_heat; - break; - } - else if (sector->ffloors) - { - ffloor_t *rover; - fixed_t topheight; - fixed_t bottomheight; - boolean gotres = false; + ffloor_t *rover; + fixed_t topheight; + fixed_t bottomheight; - for (rover = sector->ffloors; rover; rover = rover->next) + for (rover = sector->ffloors; rover; rover = rover->next) + { + if (!(rover->flags & FF_EXISTS)) + continue; + + topheight = P_GetFFloorTopZAt (rover, player->mo->x, player->mo->y); + bottomheight = P_GetFFloorBottomZAt(rover, player->mo->x, player->mo->y); + + if (pviewheight >= topheight || pviewheight <= bottomheight) + continue; + + if (rover->master->frontsector->flags & MSF_HEATWAVE) { - size_t j; - - if (!(rover->flags & FF_EXISTS)) - continue; - - topheight = P_GetFFloorTopZAt (rover, player->mo->x, player->mo->y); - bottomheight = P_GetFFloorBottomZAt(rover, player->mo->x, player->mo->y); - - if (pviewheight >= topheight || pviewheight <= bottomheight) - continue; - - for (j = 0; j < rover->master->frontsector->tags.count; j++) - { - if (Tag_FindLineSpecial(13, rover->master->frontsector->tags.tags[j]) != -1) - { - *type = postimg_heat; - gotres = true; - break; - } - } - } - if (gotres) + *type = postimg_heat; break; + } } } @@ -10867,7 +10767,7 @@ static mobj_t *P_LookForRails(mobj_t* mobj, fixed_t c, fixed_t s, angle_t target fixed_t nx, ny; angle_t nang, dummy, angdiff; mobj_t *mark; - mobj_t *snax = P_GetAxis(sides[lines[lline].sidenum[0]].textureoffset >> FRACBITS); + mobj_t *snax = P_GetAxis(lines[lline].args[0]); if (!snax) return NULL; P_GetAxisPosition(x, y, snax, &nx, &ny, &nang, &dummy); @@ -10969,7 +10869,7 @@ static void P_MinecartThink(player_t *player) // Update axis if the cart is standing on a rail. if (sec && lnum != -1) { - mobj_t *axis = P_GetAxis(sides[lines[lnum].sidenum[0]].textureoffset >> FRACBITS); + mobj_t *axis = P_GetAxis(lines[lnum].args[0]); fixed_t newx, newy; angle_t targetangle, grind; angle_t prevangle, angdiff; @@ -12015,7 +11915,7 @@ void P_PlayerThink(player_t *player) if (player->mo->movefactor != FRACUNIT) // Friction-scaled acceleration... acceleration = FixedMul(acceleration<mo->movefactor)>>FRACBITS; - P_Thrust(player->mo, moveAngle, -acceleration); + P_Thrust(player->mo, moveAngle, FixedMul(-acceleration, player->mo->scale)); } if (!(player->pflags & PF_AUTOBRAKE) @@ -12348,7 +12248,10 @@ static boolean P_MobjAboveLava(mobj_t *mobj) for (rover = sector->ffloors; rover; rover = rover->next) { - if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || GETSECSPECIAL(rover->master->frontsector->special, 1) != 3) + if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE)) + continue; + + if (rover->master->frontsector->damagetype != SD_FIRE && rover->master->frontsector->damagetype != SD_LAVA) continue; if (mobj->eflags & MFE_VERTICALFLIP) diff --git a/src/r_bsp.c b/src/r_bsp.c index c9f269816..f0a761d7b 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -238,11 +238,11 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel, { if (floorlightlevel) *floorlightlevel = sec->floorlightsec == -1 ? - sec->lightlevel : sectors[sec->floorlightsec].lightlevel; + (sec->floorlightabsolute ? sec->floorlightlevel : max(0, min(255, sec->lightlevel + sec->floorlightlevel))) : sectors[sec->floorlightsec].lightlevel; if (ceilinglightlevel) *ceilinglightlevel = sec->ceilinglightsec == -1 ? - sec->lightlevel : sectors[sec->ceilinglightsec].lightlevel; + (sec->ceilinglightabsolute ? sec->ceilinglightlevel : max(0, min(255, sec->lightlevel + sec->ceilinglightlevel))) : sectors[sec->ceilinglightsec].lightlevel; // if (sec->midmap != -1) // mapnum = sec->midmap; @@ -301,11 +301,11 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel, tempsec->lightlevel = s->lightlevel; if (floorlightlevel) - *floorlightlevel = s->floorlightsec == -1 ? s->lightlevel + *floorlightlevel = s->floorlightsec == -1 ? (s->floorlightabsolute ? s->floorlightlevel : max(0, min(255, s->lightlevel + s->floorlightlevel))) : sectors[s->floorlightsec].lightlevel; if (ceilinglightlevel) - *ceilinglightlevel = s->ceilinglightsec == -1 ? s->lightlevel + *ceilinglightlevel = s->ceilinglightsec == -1 ? (s->ceilinglightabsolute ? s->ceilinglightlevel : max(0, min(255, s->lightlevel + s->ceilinglightlevel))) : sectors[s->ceilinglightsec].lightlevel; } else if (heightsec != -1 && viewz >= sectors[heightsec].ceilingheight @@ -339,12 +339,12 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel, tempsec->lightlevel = s->lightlevel; if (floorlightlevel) - *floorlightlevel = s->floorlightsec == -1 ? s->lightlevel : - sectors[s->floorlightsec].lightlevel; + *floorlightlevel = s->floorlightsec == -1 ? (s->floorlightabsolute ? s->floorlightlevel : max(0, min(255, s->lightlevel + s->floorlightlevel))) + : sectors[s->floorlightsec].lightlevel; if (ceilinglightlevel) - *ceilinglightlevel = s->ceilinglightsec == -1 ? s->lightlevel : - sectors[s->ceilinglightsec].lightlevel; + *ceilinglightlevel = s->ceilinglightsec == -1 ? (s->ceilinglightabsolute ? s->ceilinglightlevel : max(0, min(255, s->lightlevel + s->ceilinglightlevel))) + : sectors[s->ceilinglightsec].lightlevel; } sec = tempsec; } @@ -370,6 +370,10 @@ boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back) && back->ceiling_yoffs == front->ceiling_yoffs && back->ceilingpic_angle == front->ceilingpic_angle // Consider altered lighting. + && back->floorlightlevel == front->floorlightlevel + && back->floorlightabsolute == front->floorlightabsolute + && back->ceilinglightlevel == front->ceilinglightlevel + && back->ceilinglightabsolute == front->ceilinglightabsolute && back->floorlightsec == front->floorlightsec && back->ceilinglightsec == front->ceilinglightsec // Consider colormaps @@ -872,12 +876,12 @@ static void R_Subsector(size_t num) } light = R_GetPlaneLight(frontsector, floorcenterz, false); - if (frontsector->floorlightsec == -1) - floorlightlevel = *frontsector->lightlist[light].lightlevel; + if (frontsector->floorlightsec == -1 && !frontsector->floorlightabsolute) + floorlightlevel = max(0, min(255, *frontsector->lightlist[light].lightlevel + frontsector->floorlightlevel)); floorcolormap = *frontsector->lightlist[light].extra_colormap; light = R_GetPlaneLight(frontsector, ceilingcenterz, false); - if (frontsector->ceilinglightsec == -1) - ceilinglightlevel = *frontsector->lightlist[light].lightlevel; + if (frontsector->ceilinglightsec == -1 && !frontsector->ceilinglightabsolute) + ceilinglightlevel = max(0, min(255, *frontsector->lightlist[light].lightlevel + frontsector->ceilinglightlevel)); ceilingcolormap = *frontsector->lightlist[light].extra_colormap; } diff --git a/src/r_defs.h b/src/r_defs.h index b72d3ddd8..9788e6b58 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -139,21 +139,34 @@ typedef enum FF_FLOATBOB = 0x40000, ///< Floats on water and bobs if you step on it. FF_NORETURN = 0x80000, ///< Used with ::FF_CRUMBLE. Will not return to its original position after falling. FF_CRUMBLE = 0x100000, ///< Falls 2 seconds after being stepped on, and randomly brings all touching crumbling 3dfloors down with it, providing their master sectors share the same tag (allows crumble platforms above or below, to also exist). - FF_SHATTERBOTTOM = 0x200000, ///< Used with ::FF_BUSTUP. Like FF_SHATTER, but only breaks from the bottom. Good for springing up through rubble. + FF_GOOWATER = 0x200000, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop. FF_MARIO = 0x400000, ///< Acts like a question block when hit from underneath. Goodie spawned at top is determined by master sector. FF_BUSTUP = 0x800000, ///< You can spin through/punch this block and it will crumble! FF_QUICKSAND = 0x1000000, ///< Quicksand! FF_PLATFORM = 0x2000000, ///< You can jump up through this to the top. FF_REVERSEPLATFORM = 0x4000000, ///< A fall-through floor in normal gravity, a platform in reverse gravity. FF_INTANGIBLEFLATS = 0x6000000, ///< Both flats are intangible, but the sides are still solid. - FF_SHATTER = 0x8000000, ///< Used with ::FF_BUSTUP. Bustable on mere touch. - FF_SPINBUST = 0x10000000, ///< Used with ::FF_BUSTUP. Also bustable if you're in your spinning frames. - FF_STRONGBUST = 0x20000000, ///< Used with ::FF_BUSTUP. Only bustable by "strong" characters (Knuckles) and abilities (bouncing, twinspin, melee). - FF_RIPPLE = 0x40000000, ///< Ripple the flats - FF_COLORMAPONLY = 0x80000000, ///< Only copy the colormap, not the lightlevel - FF_GOOWATER = FF_SHATTERBOTTOM, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop. + FF_RIPPLE = 0x8000000, ///< Ripple the flats + FF_COLORMAPONLY = 0x10000000, ///< Only copy the colormap, not the lightlevel + FF_BOUNCY = 0x20000000, ///< Bounces players + FF_SPLAT = 0x40000000, ///< Use splat flat renderer (treat cyan pixels as invisible) } ffloortype_e; +typedef enum +{ + FB_PUSHABLES = 0x1, // Bustable by pushables + FB_EXECUTOR = 0x2, // Trigger linedef executor + FB_ONLYBOTTOM = 0x4, // Only bustable from below +} ffloorbustflags_e; + +typedef enum +{ + BT_TOUCH, + BT_SPINBUST, + BT_REGULAR, + BT_STRONG, +} busttype_e; + typedef struct ffloor_s { fixed_t *topheight; @@ -187,6 +200,18 @@ typedef struct ffloor_s UINT8 blend; // blendmode tic_t norender; // for culling + // Only relevant for FF_BUSTUP + ffloorbustflags_e bustflags; + UINT8 busttype; + INT16 busttag; + + // Only relevant for FF_QUICKSAND + fixed_t sinkspeed; + fixed_t friction; + + // Only relevant for FF_BOUNCY + fixed_t bouncestrength; + // these are saved for netgames, so do not let Lua touch these! ffloortype_e spawnflags; // flags the 3D floor spawned with INT32 spawnalpha; // alpha the 3D floor spawned with @@ -252,16 +277,68 @@ typedef struct pslope_s typedef enum { // flipspecial - planes with effect - SF_FLIPSPECIAL_FLOOR = 1, - SF_FLIPSPECIAL_CEILING = 1<<1, - SF_FLIPSPECIAL_BOTH = (SF_FLIPSPECIAL_FLOOR|SF_FLIPSPECIAL_CEILING), + MSF_FLIPSPECIAL_FLOOR = 1, + MSF_FLIPSPECIAL_CEILING = 1<<1, + MSF_FLIPSPECIAL_BOTH = (MSF_FLIPSPECIAL_FLOOR|MSF_FLIPSPECIAL_CEILING), // triggerspecial - conditions under which plane touch causes effect - SF_TRIGGERSPECIAL_TOUCH = 1<<2, - SF_TRIGGERSPECIAL_HEADBUMP = 1<<3, + MSF_TRIGGERSPECIAL_TOUCH = 1<<2, + MSF_TRIGGERSPECIAL_HEADBUMP = 1<<3, + // triggerline - conditions for linedef executor triggering + MSF_TRIGGERLINE_PLANE = 1<<4, // require plane touch + MSF_TRIGGERLINE_MOBJ = 1<<5, // allow non-pushable mobjs to trigger // invertprecip - inverts presence of precipitation - SF_INVERTPRECIP = 1<<4, + MSF_INVERTPRECIP = 1<<6, + MSF_GRAVITYFLIP = 1<<7, + MSF_HEATWAVE = 1<<8, + MSF_NOCLIPCAMERA = 1<<9, } sectorflags_t; +typedef enum +{ + SSF_OUTERSPACE = 1, + SSF_DOUBLESTEPUP = 1<<1, + SSF_NOSTEPDOWN = 1<<2, + SSF_WINDCURRENT = 1<<3, + SSF_CONVEYOR = 1<<4, + SSF_SPEEDPAD = 1<<5, + SSF_STARPOSTACTIVATOR = 1<<6, + SSF_EXIT = 1<<7, + SSF_SPECIALSTAGEPIT = 1<<8, + SSF_RETURNFLAG = 1<<9, + SSF_REDTEAMBASE = 1<<10, + SSF_BLUETEAMBASE = 1<<11, + SSF_FAN = 1<<12, + SSF_SUPERTRANSFORM = 1<<13, + SSF_FORCESPIN = 1<<14, + SSF_ZOOMTUBESTART = 1<<15, + SSF_ZOOMTUBEEND = 1<<16, + SSF_FINISHLINE = 1<<17, + SSF_ROPEHANG = 1<<18, +} sectorspecialflags_t; + +typedef enum +{ + SD_NONE = 0, + SD_GENERIC = 1, + SD_WATER = 2, + SD_FIRE = 3, + SD_LAVA = 4, + SD_ELECTRIC = 5, + SD_SPIKE = 6, + SD_DEATHPITTILT = 7, + SD_DEATHPITNOTILT = 8, + SD_INSTAKILL = 9, + SD_SPECIALSTAGE = 10, +} sectordamage_t; + +typedef enum +{ + TO_PLAYER = 0, + TO_ALLPLAYERS = 1, + TO_MOBJ = 2, + TO_PLAYEREMERALDS = 3, // only for binary backwards compatibility: check player emeralds + TO_PLAYERNIGHTS = 4, // only for binary backwards compatibility: check NiGHTS mare +} triggerobject_t; typedef enum { @@ -313,7 +390,11 @@ typedef struct sector_s INT32 heightsec; // other sector, or -1 if no other sector INT32 camsec; // used for camera clipping - INT32 floorlightsec, ceilinglightsec; + // floor and ceiling lighting + INT16 floorlightlevel, ceilinglightlevel; + boolean floorlightabsolute, ceilinglightabsolute; // absolute or relative to sector's light level? + INT32 floorlightsec, ceilinglightsec; // take floor/ceiling light level from another sector + INT32 crumblestate; // used for crumbling and bobbing // list of mobjs that are at least partially in the sector @@ -337,10 +418,18 @@ typedef struct sector_s extracolormap_t *extra_colormap; boolean colormap_protected; - // This points to the master's floorheight, so it can be changed in realtime! - fixed_t *gravity; // per-sector gravity - boolean verticalflip; // If gravity < 0, then allow flipped physics + fixed_t gravity; // per-sector gravity factor + fixed_t *gravityptr; // For binary format: Read gravity from floor height of master sector + sectorflags_t flags; + sectorspecialflags_t specialflags; + UINT8 damagetype; + + // Linedef executor triggering + mtag_t triggertag; // tag to call upon triggering + UINT8 triggerer; // who can trigger? + + fixed_t friction; // Sprite culling feature struct line_s *cullheight; @@ -377,7 +466,7 @@ typedef enum #define HORIZONSPECIAL 41 -#define NUMLINEARGS 6 +#define NUMLINEARGS 10 #define NUMLINESTRINGARGS 2 typedef struct line_s diff --git a/src/r_main.c b/src/r_main.c index 13d2413fa..f19962d41 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -445,7 +445,7 @@ fixed_t R_ScaleFromGlobalAngle(angle_t visangle) // R_DoCulling // Checks viewz and top/bottom heights of an item against culling planes // Returns true if the item is to be culled, i.e it shouldn't be drawn! -// if ML_NOCLIMB is set, the camera view is required to be in the same area for culling to occur +// if args[1] is set, the camera view is required to be in the same area for culling to occur boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixed_t bottomh, fixed_t toph) { fixed_t cullplane; @@ -454,7 +454,7 @@ boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixe return false; cullplane = cullheight->frontsector->floorheight; - if (cullheight->flags & ML_NOCLIMB) // Group culling + if (cullheight->args[1]) // Group culling { if (!viewcullheight) return false; diff --git a/src/r_plane.c b/src/r_plane.c index e31d52be9..7ea10f616 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -852,7 +852,7 @@ void R_DrawSinglePlane(visplane_t *pl) if (pl->ffloor->flags & FF_TRANSLUCENT) { - spanfunctype = (pl->ffloor->master->flags & ML_EFFECT6) ? SPANDRAWFUNC_TRANSSPLAT : SPANDRAWFUNC_TRANS; + spanfunctype = (pl->ffloor->flags & FF_SPLAT) ? SPANDRAWFUNC_TRANSSPLAT : SPANDRAWFUNC_TRANS; // Hacked up support for alpha value in software mode Tails 09-24-2002 // ...unhacked by toaster 04-01-2021, re-hacked a little by sphere 19-11-2021 diff --git a/src/r_segs.c b/src/r_segs.c index 41ffa4103..c9f5f0d7b 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -301,7 +301,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) if (ds->curline->sidedef->repeatcnt) repeats = 1 + ds->curline->sidedef->repeatcnt; - else if (ldef->flags & ML_EFFECT5) + else if (ldef->flags & ML_WRAPMIDTEX) { fixed_t high, low; @@ -345,7 +345,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) { dc_texturemid = ds->maskedtextureheight[dc_x]; - if (!!(curline->linedef->flags & ML_DONTPEGBOTTOM) ^ !!(curline->linedef->flags & ML_EFFECT3)) + if (curline->linedef->flags & ML_MIDPEG) dc_texturemid += (textureheight[texnum])*times + textureheight[texnum]; else dc_texturemid -= (textureheight[texnum])*times; @@ -765,10 +765,10 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) skewslope = *pfloor->t_slope; // skew using top slope by default if (newline) { - if (newline->flags & ML_DONTPEGTOP) + if (newline->flags & ML_SKEWTD) slopeskew = true; } - else if (pfloor->master->flags & ML_DONTPEGTOP) + else if (pfloor->master->flags & ML_SKEWTD) slopeskew = true; if (slopeskew) @@ -1455,9 +1455,9 @@ static void R_RenderSegLoop (void) maskedtexturecol[rw_x] = (INT16)texturecolumn; if (maskedtextureheight != NULL) { - maskedtextureheight[rw_x] = (!!(curline->linedef->flags & ML_DONTPEGBOTTOM) ^ !!(curline->linedef->flags & ML_EFFECT3) ? + maskedtextureheight[rw_x] = (curline->linedef->flags & ML_MIDPEG) ? max(rw_midtexturemid, rw_midtextureback) : - min(rw_midtexturemid, rw_midtextureback)); + min(rw_midtexturemid, rw_midtextureback); } } @@ -1766,7 +1766,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) texheight = textureheight[midtexture]; // a single sided line is terminal, so it must mark ends markfloor = markceiling = true; - if (linedef->flags & ML_EFFECT2) { + if (linedef->flags & ML_NOSKEW) { if (linedef->flags & ML_DONTPEGBOTTOM) rw_midtexturemid = frontsector->floorheight + texheight - viewz; else @@ -1903,18 +1903,20 @@ void R_StoreWallRange(INT32 start, INT32 stop) else if (worldlow != worldbottom || worldlowslope != worldbottomslope || backsector->f_slope != frontsector->f_slope - || backsector->floorpic != frontsector->floorpic - || backsector->lightlevel != frontsector->lightlevel - //SoM: 3/22/2000: Check floor x and y offsets. - || backsector->floor_xoffs != frontsector->floor_xoffs - || backsector->floor_yoffs != frontsector->floor_yoffs - || backsector->floorpic_angle != frontsector->floorpic_angle - //SoM: 3/22/2000: Prevents bleeding. - || (frontsector->heightsec != -1 && frontsector->floorpic != skyflatnum) - || backsector->floorlightsec != frontsector->floorlightsec - //SoM: 4/3/2000: Check for colormaps - || frontsector->extra_colormap != backsector->extra_colormap - || (frontsector->ffloors != backsector->ffloors && !Tag_Compare(&frontsector->tags, &backsector->tags))) + || backsector->floorpic != frontsector->floorpic + || backsector->lightlevel != frontsector->lightlevel + //SoM: 3/22/2000: Check floor x and y offsets. + || backsector->floor_xoffs != frontsector->floor_xoffs + || backsector->floor_yoffs != frontsector->floor_yoffs + || backsector->floorpic_angle != frontsector->floorpic_angle + //SoM: 3/22/2000: Prevents bleeding. + || (frontsector->heightsec != -1 && frontsector->floorpic != skyflatnum) + || backsector->floorlightlevel != frontsector->floorlightlevel + || backsector->floorlightabsolute != frontsector->floorlightabsolute + || backsector->floorlightsec != frontsector->floorlightsec + //SoM: 4/3/2000: Check for colormaps + || frontsector->extra_colormap != backsector->extra_colormap + || (frontsector->ffloors != backsector->ffloors && !Tag_Compare(&frontsector->tags, &backsector->tags))) { markfloor = true; } @@ -1934,18 +1936,20 @@ void R_StoreWallRange(INT32 start, INT32 stop) else if (worldhigh != worldtop || worldhighslope != worldtopslope || backsector->c_slope != frontsector->c_slope - || backsector->ceilingpic != frontsector->ceilingpic - || backsector->lightlevel != frontsector->lightlevel - //SoM: 3/22/2000: Check floor x and y offsets. - || backsector->ceiling_xoffs != frontsector->ceiling_xoffs - || backsector->ceiling_yoffs != frontsector->ceiling_yoffs - || backsector->ceilingpic_angle != frontsector->ceilingpic_angle - //SoM: 3/22/2000: Prevents bleeding. - || (frontsector->heightsec != -1 && frontsector->ceilingpic != skyflatnum) - || backsector->ceilinglightsec != frontsector->ceilinglightsec - //SoM: 4/3/2000: Check for colormaps - || frontsector->extra_colormap != backsector->extra_colormap - || (frontsector->ffloors != backsector->ffloors && !Tag_Compare(&frontsector->tags, &backsector->tags))) + || backsector->ceilingpic != frontsector->ceilingpic + || backsector->lightlevel != frontsector->lightlevel + //SoM: 3/22/2000: Check floor x and y offsets. + || backsector->ceiling_xoffs != frontsector->ceiling_xoffs + || backsector->ceiling_yoffs != frontsector->ceiling_yoffs + || backsector->ceilingpic_angle != frontsector->ceilingpic_angle + //SoM: 3/22/2000: Prevents bleeding. + || (frontsector->heightsec != -1 && frontsector->ceilingpic != skyflatnum) + || backsector->ceilinglightlevel != frontsector->ceilinglightlevel + || backsector->ceilinglightabsolute != frontsector->ceilinglightabsolute + || backsector->ceilinglightsec != frontsector->ceilinglightsec + //SoM: 4/3/2000: Check for colormaps + || frontsector->extra_colormap != backsector->extra_colormap + || (frontsector->ffloors != backsector->ffloors && !Tag_Compare(&frontsector->tags, &backsector->tags))) { markceiling = true; } @@ -1971,23 +1975,10 @@ void R_StoreWallRange(INT32 start, INT32 stop) { fixed_t texheight; // top texture - if ((linedef->flags & (ML_DONTPEGTOP) && (linedef->flags & ML_DONTPEGBOTTOM)) - && linedef->sidenum[1] != 0xffff) - { - // Special case... use offsets from 2nd side but only if it has a texture. - side_t *def = &sides[linedef->sidenum[1]]; - toptexture = R_GetTextureNum(def->toptexture); + toptexture = R_GetTextureNum(sidedef->toptexture); + texheight = textureheight[toptexture]; - if (!toptexture) //Second side has no texture, use the first side's instead. - toptexture = R_GetTextureNum(sidedef->toptexture); - texheight = textureheight[toptexture]; - } - else - { - toptexture = R_GetTextureNum(sidedef->toptexture); - texheight = textureheight[toptexture]; - } - if (!(linedef->flags & ML_EFFECT1)) { // Ignore slopes for lower/upper textures unless flag is checked + if (!(linedef->flags & ML_SKEWTD)) { // Ignore slopes for lower/upper textures unless flag is checked if (linedef->flags & ML_DONTPEGTOP) rw_toptexturemid = frontsector->ceilingheight - viewz; else @@ -2012,7 +2003,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) // bottom texture bottomtexture = R_GetTextureNum(sidedef->bottomtexture); - if (!(linedef->flags & ML_EFFECT1)) { // Ignore slopes for lower/upper textures unless flag is checked + if (!(linedef->flags & ML_SKEWTD)) { // Ignore slopes for lower/upper textures unless flag is checked if (linedef->flags & ML_DONTPEGBOTTOM) rw_bottomtexturemid = frontsector->floorheight - viewz; else @@ -2243,7 +2234,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) if (curline->polyseg) { // use REAL front and back floors please, so midtexture rendering isn't mucked up rw_midtextureslide = rw_midtexturebackslide = 0; - if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) + if (linedef->flags & ML_MIDPEG) rw_midtexturemid = rw_midtextureback = max(curline->frontsector->floorheight, curline->backsector->floorheight) - viewz; else rw_midtexturemid = rw_midtextureback = min(curline->frontsector->ceilingheight, curline->backsector->ceilingheight) - viewz; @@ -2251,16 +2242,16 @@ void R_StoreWallRange(INT32 start, INT32 stop) else { // Set midtexture starting height - if (linedef->flags & ML_EFFECT2) + if (linedef->flags & ML_NOSKEW) { // Ignore slopes when texturing rw_midtextureslide = rw_midtexturebackslide = 0; - if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) + if (linedef->flags & ML_MIDPEG) rw_midtexturemid = rw_midtextureback = max(frontsector->floorheight, backsector->floorheight) - viewz; else rw_midtexturemid = rw_midtextureback = min(frontsector->ceilingheight, backsector->ceilingheight) - viewz; } - else if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) + else if (linedef->flags & ML_MIDPEG) { rw_midtexturemid = worldbottom; rw_midtextureslide = floorfrontslide; diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index 4f19d93df..d369d11c0 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -87,39 +87,40 @@ if(${SDL2_FOUND}) endif() if(${CMAKE_SYSTEM} MATCHES Darwin) - find_library(CORE_LIB CoreFoundation) + find_library(CORE_FOUNDATION_LIBRARY "CoreFoundation") target_link_libraries(SRB2SDL2 PRIVATE - ${CORE_LIB} - SDL2 - SDL2_mixer - ${GME_LIBRARIES} - ${OPENMPT_LIBRARIES} - ${MIXERX_LIBRARIES} - ${PNG_LIBRARIES} - ${ZLIB_LIBRARIES} - ${OPENGL_LIBRARIES} - ${CURL_LIBRARIES} + ${CORE_FOUNDATION_LIBRARY} ) set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}") - else() - target_link_libraries(SRB2SDL2 PRIVATE - ${SDL2_LIBRARIES} - ${SDL2_MIXER_LIBRARIES} - ${GME_LIBRARIES} - ${OPENMPT_LIBRARIES} - ${MIXERX_LIBRARIES} - ${PNG_LIBRARIES} - ${ZLIB_LIBRARIES} - ${OPENGL_LIBRARIES} - ${CURL_LIBRARIES} - ) - if(${CMAKE_SYSTEM} MATCHES Linux) - target_link_libraries(SRB2SDL2 PRIVATE - m - rt - ) - endif() + # Configure the app bundle icon and plist properties + target_sources(SRB2SDL2 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/macosx/Srb2mac.icns") + set_target_properties(SRB2SDL2 PROPERTIES + MACOSX_BUNDLE_ICON_FILE "Srb2mac" + MACOSX_BUNDLE_BUNDLE_NAME "Sonic Robo Blast 2" + MACOSX_BUNDLE_BUNDLE_VERSION ${SRB2_VERSION} + + RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/macosx/Srb2mac.icns" + ) + endif() + + target_link_libraries(SRB2SDL2 PRIVATE + ${SDL2_LIBRARIES} + ${SDL2_MIXER_LIBRARIES} + ${GME_LIBRARIES} + ${OPENMPT_LIBRARIES} + ${MIXERX_LIBRARIES} + ${PNG_LIBRARIES} + ${ZLIB_LIBRARIES} + ${OPENGL_LIBRARIES} + ${CURL_LIBRARIES} + ) + + if(${CMAKE_SYSTEM} MATCHES Linux) + target_link_libraries(SRB2SDL2 PRIVATE + m + rt + ) endif() #target_link_libraries(SRB2SDL2 PRIVATE SRB2Core) @@ -136,8 +137,6 @@ if(${SDL2_FOUND}) endif() endif() - set_target_properties(SRB2SDL2 PROPERTIES VERSION ${SRB2_VERSION}) - if(${CMAKE_SYSTEM} MATCHES Windows) target_link_libraries(SRB2SDL2 PRIVATE ws2_32 @@ -188,6 +187,7 @@ if(${SDL2_FOUND}) install(TARGETS SRB2SDL2 BUNDLE DESTINATION . ) + set_property(TARGET SRB2SDL2 PROPERTY INSTALL_RPATH_USE_LINK_PATH ON) else() install(TARGETS SRB2SDL2 SRB2SDL2 RUNTIME DESTINATION . diff --git a/src/taglist.c b/src/taglist.c index 6b50a51ab..305b05f04 100644 --- a/src/taglist.c +++ b/src/taglist.c @@ -14,6 +14,7 @@ #include "taglist.h" #include "z_zone.h" #include "r_data.h" +#include "p_spec.h" // Bit array of whether a tag exists for sectors/lines/things. bitarray_t tags_available[BIT_ARRAY_SIZE (MAXTAGS)]; @@ -37,6 +38,25 @@ void Tag_Add (taglist_t* list, const mtag_t tag) list->tags[list->count++] = tag; } +/// Removes a tag from a given element's taglist. +/// \warning This does not rebuild the global taggroups, which are used for iteration. +void Tag_Remove(taglist_t* list, const mtag_t tag) +{ + UINT16 i; + + for (i = 0; i < list->count; i++) + { + if (list->tags[i] != tag) + continue; + + for (; i+1 < list->count; i++) + list->tags[i] = list->tags[i+1]; + + list->tags = Z_Realloc(list->tags, (list->count - 1) * sizeof(mtag_t), PU_LEVEL, NULL); + return; + } +} + /// Sets the first tag entry in a taglist. /// Replicates the old way of accessing element->tag. void Tag_FSet (taglist_t* list, const mtag_t tag) @@ -408,6 +428,22 @@ INT32 P_FindSpecialLineFromTag(INT16 special, INT16 tag, INT32 start) // Ingame list manipulation. +/// Adds the tag to the given sector, and updates the global taggroups. +void Tag_SectorAdd (const size_t id, const mtag_t tag) +{ + sector_t* sec = §ors[id]; + Tag_Add(&sec->tags, tag); + Taggroup_Add(tags_sectors, tag, id); +} + +/// Removes the tag from the given sector, and updates the global taggroups. +void Tag_SectorRemove (const size_t id, const mtag_t tag) +{ + sector_t* sec = §ors[id]; + Tag_Remove(&sec->tags, tag); + Taggroup_Remove(tags_sectors, tag, id); +} + /// Changes the first tag for a given sector, and updates the global taggroups. void Tag_SectorFSet (const size_t id, const mtag_t tag) { @@ -419,4 +455,22 @@ void Tag_SectorFSet (const size_t id, const mtag_t tag) Taggroup_Remove(tags_sectors, curtag, id); Taggroup_Add(tags_sectors, tag, id); Tag_FSet(&sec->tags, tag); + + // Sectors with linedef trigger effects need to have their trigger tag updated too + // This is a bit of a hack... + if (!udmf && GETSECSPECIAL(sec->special, 2) >= 1 && GETSECSPECIAL(sec->special, 2) <= 7) + sec->triggertag = tag; +} + +mtag_t Tag_NextUnused(mtag_t start) +{ + while ((UINT16)start < MAXTAGS) + { + if (!in_bit_array(tags_available, (UINT16)start)) + return start; + + start++; + } + + return MAXTAGS; } diff --git a/src/taglist.h b/src/taglist.h index d326ef357..de6e9abd5 100644 --- a/src/taglist.h +++ b/src/taglist.h @@ -28,12 +28,15 @@ typedef struct } taglist_t; void Tag_Add (taglist_t* list, const mtag_t tag); +void Tag_Remove (taglist_t* list, const mtag_t tag); void Tag_FSet (taglist_t* list, const mtag_t tag); mtag_t Tag_FGet (const taglist_t* list); boolean Tag_Find (const taglist_t* list, const mtag_t tag); boolean Tag_Share (const taglist_t* list1, const taglist_t* list2); boolean Tag_Compare (const taglist_t* list1, const taglist_t* list2); +void Tag_SectorAdd (const size_t id, const mtag_t tag); +void Tag_SectorRemove (const size_t id, const mtag_t tag); void Tag_SectorFSet (const size_t id, const mtag_t tag); /// Taggroup list. It is essentially just an element id list. @@ -46,6 +49,8 @@ typedef struct extern bitarray_t tags_available[]; +extern mtag_t Tag_NextUnused(mtag_t start); + extern size_t num_tags; extern taggroup_t* tags_sectors[]; diff --git a/src/win32/CMakeLists.txt b/src/win32/CMakeLists.txt deleted file mode 100644 index 39b01588b..000000000 --- a/src/win32/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -file(GLOB SRB2_WIN_SOURCES *.c *.h *.rc) - -if(${SRB2_CONFIG_HWRENDER}) - set(SRB2_WIN_SOURCES ${SRB2_WIN_SOURCES} ${SRB2_HWRENDER_SOURCES} ${SRB2_HWRENDER_HEADERS}) - set(SRB2_WIN_SOURCES ${SRB2_WIN_SOURCES} ${SRB2_R_OPENGL_SOURCES} ${SRB2_R_OPENGL_HEADERS}) -endif() - -add_executable(SRB2DD EXCLUDE_FROM_ALL WIN32 - ${SRB2_WIN_SOURCES} -) - -target_compile_definitions(SRB2DD PRIVATE - -D_WINDOWS -) - -set_target_properties(SRB2DD PROPERTIES OUTPUT_NAME ${SRB2_WIN_EXE_NAME}) - -target_link_libraries(SRB2DD PRIVATE SRB2Core) diff --git a/src/win32/Srb2win-vc10.vcxproj b/src/win32/Srb2win-vc10.vcxproj deleted file mode 100644 index 3e8af3b0e..000000000 --- a/src/win32/Srb2win-vc10.vcxproj +++ /dev/null @@ -1,517 +0,0 @@ - - - - - Debug - ARM - - - Debug - ARM64 - - - Debug - Win32 - - - Release - ARM - - - Release - ARM64 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - Srb2DD - {0F554F1D-ED49-4D65-A9A7-F63C57F277BE} - Win32Proj - Srb2win - 10.0.17763.0 - - - - v140 - true - - - true - true - v141 - - - v140 - false - true - - - false - true - true - v141 - - - v140 - true - - - true - true - v141 - - - v140 - false - true - - - false - true - true - v141 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - false - - - - true - gdi32.lib;%(AdditionalDependencies) - - - ProgramDatabase - false - - - - - true - gdi32.lib;%(AdditionalDependencies) - - - - - ProgramDatabase - false - - - gdi32.lib;%(AdditionalDependencies) - - - - - gdi32.lib;%(AdditionalDependencies) - - - - - gdi32.lib;%(AdditionalDependencies) - - - - - gdi32.lib;%(AdditionalDependencies) - - - - - gdi32.lib;%(AdditionalDependencies) - - - - - gdi32.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - true - - - true - - - - - - - - - - - - - - - - - - - - true - - - true - - - true - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {72b01aca-7a1a-4f7b-acef-2607299cf052} - - - {73a5729c-7323-41d4-ab48-8a03c9f81603} - - - - - - - Document - - - Document - - - Document - - - - - - diff --git a/src/win32/Srb2win-vc10.vcxproj.filters b/src/win32/Srb2win-vc10.vcxproj.filters deleted file mode 100644 index 7279368f1..000000000 --- a/src/win32/Srb2win-vc10.vcxproj.filters +++ /dev/null @@ -1,943 +0,0 @@ - - - - - {20cba664-c3ef-48f1-85dd-42aafd5345cc} - - - {d3817a65-82f5-4989-9217-e5a7f43380a0} - - - {9c3ed4ae-dbed-4d00-a164-b8bb7fc1710c} - - - {4b8a8fb6-7c84-48c2-85d1-0583e6b8cacd} - - - {1907eee5-0ebf-4325-a2fa-793f089ed2e3} - - - {b9e78a3f-3e2b-4f89-9817-b77c7a26d2aa} - - - {3f336df5-a1d7-4610-9728-4525e42c0abc} - - - {b5090aa0-6645-4091-aa1a-ffc3bf4dc422} - - - {d59e82c9-68e5-44bf-827e-f7bb1676cd6c} - - - {29e746a2-3d91-4b69-af6e-5e03895516b7} - - - {b295d364-61c3-4ebb-9b68-7d6c0bb891be} - - - {ba258ec5-13d7-4083-98bd-c2ee58700b66} - - - {6163f1e5-da5d-4af2-b92c-753452f9e1d0} - - - {077b0966-1151-4afa-a533-120a4c931322} - - - {bded90bc-8019-42b1-ba19-32166743d3e3} - - - {c0ddfdb5-7494-4cca-b2ad-cb048be9cbdf} - - - {d5157f99-43ef-49cc-ad76-658a1168fc0d} - - - {2cedf139-53a1-40ea-b4de-19e9f4505a1f} - - - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - G_Game - - - G_Game - - - F_Frame - - - F_Frame - - - I_Interface - - - I_Interface - - - LUA - - - LUA - - - LUA - - - LUA - - - LUA - - - LUA - - - LUA - - - LUA - - - LUA - - - LUA - - - LUA - - - LUA - - - LUA - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - H_Hud - - - B_Bots - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - S_Sounds - - - W_Wad - - - W_Wad - - - S_Sounds - - - O_Other - - - H_Hud - - - H_Hud - - - I_Interface - - - H_Hud - - - P_Play - - - I_Interface - - - H_Hud - - - R_Rend - - - R_Rend - - - H_Hud - - - D_Doom - - - M_Misc - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Win32app - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - Hw_Hardware - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - BLUA - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - D_Doom - - - G_Game - - - G_Game - - - G_Game - - - F_Frame - - - I_Interface - - - I_Interface - - - I_Interface - - - I_Interface - - - I_Interface - - - I_Interface - - - I_Interface - - - LUA - - - LUA - - - LUA - - - LUA - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - M_Misc - - - H_Hud - - - B_Bots - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - P_Play - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - P_Play - - - S_Sounds - - - W_Wad - - - W_Wad - - - I_Interface - - - S_Sounds - - - O_Other - - - I_Interface - - - H_Hud - - - H_Hud - - - I_Interface - - - I_Interface - - - H_Hud - - - P_Play - - - I_Interface - - - A_Asm - - - H_Hud - - - R_Rend - - - R_Rend - - - H_Hud - - - D_Doom - - - O_Other - - - Hw_Hardware - - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - R_Rend - - - - - Win32app - - - - - Win32app - - - - - A_Asm - - - O_Other - - - - - A_Asm - - - A_Asm - - - A_Asm - - - diff --git a/src/win32/Srb2win-vc9.vcproj b/src/win32/Srb2win-vc9.vcproj deleted file mode 100644 index c1c6b5bc4..000000000 --- a/src/win32/Srb2win-vc9.vcproj +++ /dev/null @@ -1,4914 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/win32/Srb2win.dsp b/src/win32/Srb2win.dsp deleted file mode 100644 index 661f3eaf9..000000000 --- a/src/win32/Srb2win.dsp +++ /dev/null @@ -1,1008 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Srb2win" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=Srb2win - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Srb2win.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Srb2win.mak" CFG="Srb2win - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Srb2win - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "Srb2win - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Srb2win - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "..\..\objs\Release" -# PROP BASE Intermediate_Dir "..\..\objs\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\bin\VC\Release\Win32" -# PROP Intermediate_Dir "..\..\objs\VC\Release\Win32" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G5 /W3 /GX /Zi /Ot /Og /Oi /Op /Oy /Ob1 /Gy /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "NDEBUG" /D "_WINDOWS" /D "USEASM" /D "HAVE_PNG" /FR /FD /GF /Gs /GF /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "NDEBUG" /o "NUL" /win32 -# SUBTRACT MTL /mktyplib203 -# ADD BASE RSC /l 0x40c /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo /o"..\..\objs\Release\Srb2win.bsc" -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 dxguid.lib user32.lib gdi32.lib winmm.lib advapi32.lib ws2_32.lib dinput.lib /nologo /subsystem:windows /pdb:"C:\srb2demo2\srb2.pdb" /debug /machine:I386 /out:"C:\srb2demo2\srb2win.exe" -# SUBTRACT LINK32 /profile /pdb:none /incremental:yes /nodefaultlib - -!ELSEIF "$(CFG)" == "Srb2win - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "..\..\objs\Debug" -# PROP BASE Intermediate_Dir "..\..\objs\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\bin\VC\Debug\Win32" -# PROP Intermediate_Dir "..\..\objs\VC\Debug\Win32" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G6 /W4 /Gm /GX /ZI /Od /Op /Oy /I "libs\libpng-src" /I "..\..\libs\libpng-src" /I "..\..\libs\zlib" /D "_DEBUG" /D "_WINDOWS" /D "USEASM" /D "HAVE_PNG" /FAcs /FR /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD BASE RSC /l 0x40c /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 dxguid.lib user32.lib gdi32.lib winmm.lib advapi32.lib ws2_32.lib dinput.lib /nologo /subsystem:windows /profile /debug /machine:I386 /out:"C:\srb2demo2\srb2debug.exe" -# SUBTRACT LINK32 /nodefaultlib - -!ENDIF - -# Begin Target - -# Name "Srb2win - Win32 Release" -# Name "Srb2win - Win32 Debug" -# Begin Group "Win32app" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\afxres.h -# End Source File -# Begin Source File - -SOURCE=.\dx_error.c -# End Source File -# Begin Source File - -SOURCE=.\dx_error.h -# End Source File -# Begin Source File - -SOURCE=.\fabdxlib.c -# End Source File -# Begin Source File - -SOURCE=.\fabdxlib.h -# End Source File -# Begin Source File - -SOURCE=..\filesrch.c -# End Source File -# Begin Source File - -SOURCE=..\filesrch.h -# End Source File -# Begin Source File - -SOURCE=.\mid2strm.c -# End Source File -# Begin Source File - -SOURCE=.\mid2strm.h -# End Source File -# Begin Source File - -SOURCE=.\midstuff.h -# End Source File -# Begin Source File - -SOURCE=.\resource.h -# End Source File -# Begin Source File - -SOURCE=.\Srb2win.rc - -!IF "$(CFG)" == "Srb2win - Win32 Release" - -# ADD BASE RSC /l 0x40c /i "win32" -# ADD RSC /l 0x409 /i "win32" - -!ELSEIF "$(CFG)" == "Srb2win - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\win_cd.c -# End Source File -# Begin Source File - -SOURCE=.\win_dbg.c -# End Source File -# Begin Source File - -SOURCE=.\win_dbg.h -# End Source File -# Begin Source File - -SOURCE=.\win_dll.c -# End Source File -# Begin Source File - -SOURCE=.\win_dll.h -# End Source File -# Begin Source File - -SOURCE=.\win_main.c -# End Source File -# Begin Source File - -SOURCE=.\win_main.h -# End Source File -# Begin Source File - -SOURCE=.\win_net.c -# End Source File -# Begin Source File - -SOURCE=.\win_snd.c -# End Source File -# Begin Source File - -SOURCE=.\win_sys.c -# End Source File -# Begin Source File - -SOURCE=.\win_vid.c -# End Source File -# End Group -# Begin Group "A_Asm" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\p5prof.h -# End Source File -# Begin Source File - -SOURCE=..\tmap.nas - -!IF "$(CFG)" == "Srb2win - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Compiling $(InputName).nas with NASM... -IntDir=.\..\..\objs\VC\Release\Win32 -InputPath=..\tmap.nas -InputName=tmap - -"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath) - -# End Custom Build - -!ELSEIF "$(CFG)" == "Srb2win - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Compiling $(InputName).nas with NASM... -IntDir=.\..\..\objs\VC\Debug\Win32 -InputPath=..\tmap.nas -InputName=tmap - -"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath) - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\tmap_mmx.nas - -!IF "$(CFG)" == "Srb2win - Win32 Release" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Compiling $(InputName).nas with NASM... -IntDir=.\..\..\objs\VC\Release\Win32 -InputPath=..\tmap_mmx.nas -InputName=tmap_mmx - -"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath) - -# End Custom Build - -!ELSEIF "$(CFG)" == "Srb2win - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Compiling $(InputName).nas with NASM... -IntDir=.\..\..\objs\VC\Debug\Win32 -InputPath=..\tmap_mmx.nas -InputName=tmap_mmx - -"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath) - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\tmap_vc.nas - -!IF "$(CFG)" == "Srb2win - Win32 Release" - -# Begin Custom Build - Compiling $(InputName).nas with NASM... -IntDir=.\..\..\objs\VC\Release\Win32 -InputPath=..\tmap_vc.nas -InputName=tmap_vc - -"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath) - -# End Custom Build - -!ELSEIF "$(CFG)" == "Srb2win - Win32 Debug" - -# PROP Ignore_Default_Tool 1 -# Begin Custom Build - Compiling $(InputName).nas with NASM... -IntDir=.\..\..\objs\VC\Debug\Win32 -InputPath=..\tmap_vc.nas -InputName=tmap_vc - -"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasm -g -o $(IntDir)/$(InputName).obj -f win32 $(InputPath) - -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# Begin Group "D_Doom" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\comptime.c -# End Source File -# Begin Source File - -SOURCE=..\d_clisrv.c -# End Source File -# Begin Source File - -SOURCE=..\d_clisrv.h -# End Source File -# Begin Source File - -SOURCE=..\d_event.h -# End Source File -# Begin Source File - -SOURCE=..\d_main.c -# End Source File -# Begin Source File - -SOURCE=..\d_main.h -# End Source File -# Begin Source File - -SOURCE=..\d_net.c -# End Source File -# Begin Source File - -SOURCE=..\d_net.h -# End Source File -# Begin Source File - -SOURCE=..\d_netcmd.c -# End Source File -# Begin Source File - -SOURCE=..\d_netcmd.h -# End Source File -# Begin Source File - -SOURCE=..\d_netfil.c -# End Source File -# Begin Source File - -SOURCE=..\d_netfil.h -# End Source File -# Begin Source File - -SOURCE=..\d_player.h -# End Source File -# Begin Source File - -SOURCE=..\d_think.h -# End Source File -# Begin Source File - -SOURCE=..\d_ticcmd.h -# End Source File -# Begin Source File - -SOURCE=..\dehacked.c -# End Source File -# Begin Source File - -SOURCE=..\dehacked.h -# End Source File -# Begin Source File - -SOURCE=..\doomdata.h -# End Source File -# Begin Source File - -SOURCE=..\doomdef.h -# End Source File -# Begin Source File - -SOURCE=..\doomstat.h -# End Source File -# Begin Source File - -SOURCE=..\doomtype.h -# End Source File -# Begin Source File - -SOURCE=..\z_zone.c -# End Source File -# Begin Source File - -SOURCE=..\z_zone.h -# End Source File -# End Group -# Begin Group "F_Frame" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\f_finale.c -# End Source File -# Begin Source File - -SOURCE=..\f_finale.h -# End Source File -# Begin Source File - -SOURCE=..\f_wipe.c -# End Source File -# End Group -# Begin Group "G_Game" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\g_game.c -# End Source File -# Begin Source File - -SOURCE=..\g_game.h -# End Source File -# Begin Source File - -SOURCE=..\g_input.c -# End Source File -# Begin Source File - -SOURCE=..\g_input.h -# End Source File -# Begin Source File - -SOURCE=..\g_state.h -# End Source File -# End Group -# Begin Group "H_Hud" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\am_map.c -# End Source File -# Begin Source File - -SOURCE=..\am_map.h -# End Source File -# Begin Source File - -SOURCE=..\command.c -# End Source File -# Begin Source File - -SOURCE=..\command.h -# End Source File -# Begin Source File - -SOURCE=..\console.c -# End Source File -# Begin Source File - -SOURCE=..\console.h -# End Source File -# Begin Source File - -SOURCE=..\hu_stuff.c -# End Source File -# Begin Source File - -SOURCE=..\hu_stuff.h -# End Source File -# Begin Source File - -SOURCE=..\st_stuff.c -# End Source File -# Begin Source File - -SOURCE=..\st_stuff.h -# End Source File -# Begin Source File - -SOURCE=..\y_inter.c -# End Source File -# Begin Source File - -SOURCE=..\y_inter.h -# End Source File -# End Group -# Begin Group "Hw_Hardware" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\hardware\hw3dsdrv.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw3sound.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw3sound.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_bsp.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_cache.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_data.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_defs.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_dll.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_draw.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_drv.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_glob.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_light.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_light.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_main.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_main.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_md2.c -# End Source File -# Begin Source File - -SOURCE=..\hardware\hw_md2.h -# End Source File -# Begin Source File - -SOURCE=..\hardware\hws_data.h -# End Source File -# End Group -# Begin Group "I_Interface" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\byteptr.h -# End Source File -# Begin Source File - -SOURCE=..\i_joy.h -# End Source File -# Begin Source File - -SOURCE=..\i_net.h -# End Source File -# Begin Source File - -SOURCE=..\i_sound.h -# End Source File -# Begin Source File - -SOURCE=..\i_system.h -# End Source File -# Begin Source File - -SOURCE=..\i_tcp.c -# End Source File -# Begin Source File - -SOURCE=..\i_tcp.h -# End Source File -# Begin Source File - -SOURCE=..\i_video.h -# End Source File -# Begin Source File - -SOURCE=..\keys.h -# End Source File -# Begin Source File - -SOURCE=..\mserv.c -# End Source File -# Begin Source File - -SOURCE=..\mserv.h -# End Source File -# End Group -# Begin Group "M_Misc" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\m_argv.c -# End Source File -# Begin Source File - -SOURCE=..\m_argv.h -# End Source File -# Begin Source File - -SOURCE=..\m_bbox.c -# End Source File -# Begin Source File - -SOURCE=..\m_bbox.h -# End Source File -# Begin Source File - -SOURCE=..\m_cheat.c -# End Source File -# Begin Source File - -SOURCE=..\m_cheat.h -# End Source File -# Begin Source File - -SOURCE=..\m_dllist.h -# End Source File -# Begin Source File - -SOURCE=..\m_fixed.c -# End Source File -# Begin Source File - -SOURCE=..\m_fixed.h -# End Source File -# Begin Source File - -SOURCE=..\m_menu.c -# End Source File -# Begin Source File - -SOURCE=..\m_menu.h -# End Source File -# Begin Source File - -SOURCE=..\m_misc.c -# End Source File -# Begin Source File - -SOURCE=..\m_misc.h -# End Source File -# Begin Source File - -SOURCE=..\m_queue.c -# End Source File -# Begin Source File - -SOURCE=..\m_queue.h -# End Source File -# Begin Source File - -SOURCE=..\m_random.c -# End Source File -# Begin Source File - -SOURCE=..\m_random.h -# End Source File -# Begin Source File - -SOURCE=..\m_swap.h -# End Source File -# Begin Source File - -SOURCE=..\string.c -# End Source File -# End Group -# Begin Group "P_Play" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\info.c -# End Source File -# Begin Source File - -SOURCE=..\info.h -# End Source File -# Begin Source File - -SOURCE=..\p_ceilng.c -# End Source File -# Begin Source File - -SOURCE=..\p_enemy.c -# End Source File -# Begin Source File - -SOURCE=..\p_fab.c -# End Source File -# Begin Source File - -SOURCE=..\p_floor.c -# End Source File -# Begin Source File - -SOURCE=..\p_inter.c -# End Source File -# Begin Source File - -SOURCE=..\p_lights.c -# End Source File -# Begin Source File - -SOURCE=..\p_local.h -# End Source File -# Begin Source File - -SOURCE=..\p_map.c -# End Source File -# Begin Source File - -SOURCE=..\p_maputl.c -# End Source File -# Begin Source File - -SOURCE=..\p_maputl.h -# End Source File -# Begin Source File - -SOURCE=..\p_mobj.c -# End Source File -# Begin Source File - -SOURCE=..\p_mobj.h -# End Source File -# Begin Source File - -SOURCE=..\p_polyobj.c -# End Source File -# Begin Source File - -SOURCE=..\p_polyobj.h -# End Source File -# Begin Source File - -SOURCE=..\p_pspr.h -# End Source File -# Begin Source File - -SOURCE=..\p_saveg.c -# End Source File -# Begin Source File - -SOURCE=..\p_saveg.h -# End Source File -# Begin Source File - -SOURCE=..\p_setup.c -# End Source File -# Begin Source File - -SOURCE=..\p_setup.h -# End Source File -# Begin Source File - -SOURCE=..\p_sight.c -# End Source File -# Begin Source File - -SOURCE=..\p_spec.c -# End Source File -# Begin Source File - -SOURCE=..\p_spec.h -# End Source File -# Begin Source File - -SOURCE=..\p_telept.c -# End Source File -# Begin Source File - -SOURCE=..\p_tick.c -# End Source File -# Begin Source File - -SOURCE=..\p_tick.h -# End Source File -# Begin Source File - -SOURCE=..\p_user.c -# End Source File -# Begin Source File - -SOURCE=..\tables.c -# End Source File -# Begin Source File - -SOURCE=..\tables.h -# End Source File -# End Group -# Begin Group "R_Rend" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\r_bsp.c -# End Source File -# Begin Source File - -SOURCE=..\r_bsp.h -# End Source File -# Begin Source File - -SOURCE=..\r_data.c -# End Source File -# Begin Source File - -SOURCE=..\r_data.h -# End Source File -# Begin Source File - -SOURCE=..\r_defs.h -# End Source File -# Begin Source File - -SOURCE=..\r_draw.c -# End Source File -# Begin Source File - -SOURCE=..\r_draw.h -# End Source File -# Begin Source File - -SOURCE=..\r_draw16.c -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=..\r_draw8.c -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=..\r_local.h -# End Source File -# Begin Source File - -SOURCE=..\r_main.c -# End Source File -# Begin Source File - -SOURCE=..\r_main.h -# End Source File -# Begin Source File - -SOURCE=..\r_plane.c -# End Source File -# Begin Source File - -SOURCE=..\r_plane.h -# End Source File -# Begin Source File - -SOURCE=..\r_segs.c -# End Source File -# Begin Source File - -SOURCE=..\r_segs.h -# End Source File -# Begin Source File - -SOURCE=..\r_sky.c -# End Source File -# Begin Source File - -SOURCE=..\r_sky.h -# End Source File -# Begin Source File - -SOURCE=..\r_splats.c -# End Source File -# Begin Source File - -SOURCE=..\r_splats.h -# End Source File -# Begin Source File - -SOURCE=..\r_state.h -# End Source File -# Begin Source File - -SOURCE=..\r_things.c -# End Source File -# Begin Source File - -SOURCE=..\r_things.h -# End Source File -# Begin Source File - -SOURCE=..\screen.c -# End Source File -# Begin Source File - -SOURCE=..\screen.h -# End Source File -# Begin Source File - -SOURCE=..\v_video.c -# End Source File -# Begin Source File - -SOURCE=..\v_video.h -# End Source File -# End Group -# Begin Group "S_Sounds" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\s_sound.c -# End Source File -# Begin Source File - -SOURCE=..\s_sound.h -# End Source File -# Begin Source File - -SOURCE=..\sounds.c -# End Source File -# Begin Source File - -SOURCE=..\sounds.h -# End Source File -# End Group -# Begin Group "W_Wad" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\lzf.c -# End Source File -# Begin Source File - -SOURCE=..\lzf.h -# End Source File -# Begin Source File - -SOURCE=..\md5.c -# End Source File -# Begin Source File - -SOURCE=..\md5.h -# End Source File -# Begin Source File - -SOURCE=..\w_wad.c -# End Source File -# Begin Source File - -SOURCE=..\w_wad.h -# End Source File -# End Group -# Begin Group "Docs" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\doc\copying -# End Source File -# Begin Source File - -SOURCE=..\..\doc\faq.txt -# End Source File -# Begin Source File - -SOURCE=..\..\readme.txt -# End Source File -# Begin Source File - -SOURCE=..\..\doc\source.txt -# End Source File -# End Group -# Begin Source File - -SOURCE=.\Srb2win.ico -# End Source File -# End Target -# End Project diff --git a/src/win32/Srb2win.dsw b/src/win32/Srb2win.dsw deleted file mode 100644 index f20998142..000000000 --- a/src/win32/Srb2win.dsw +++ /dev/null @@ -1,77 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Srb2win"=.\Srb2win.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libpng - End Project Dependency - Begin Project Dependency - Project_Dep_Name zlib - End Project Dependency -}}} - -############################################################################### - -Project: "libpng"="..\..\libs\libpng-src\projects\visualc6\libpng.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name zlib - End Project Dependency -}}} - -############################################################################### - -Project: "r_opengl"=..\hardware\r_opengl\r_opengl.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name Srb2win - End Project Dependency -}}} - -############################################################################### - -Project: "zlib"=..\..\libs\zlib\projects\visualc6\zlib.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/win32/Srb2win.props b/src/win32/Srb2win.props deleted file mode 100644 index fa152f0c9..000000000 --- a/src/win32/Srb2win.props +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - HAVE_ZLIB;HAVE_LIBGME;_WINDOWS;%(PreprocessorDefinitions) - - _WINDOWS;%(PreprocessorDefinitions) - - - - dxguid.lib;winmm.lib;dinput8.lib;%(AdditionalDependencies) - - - - \ No newline at end of file diff --git a/src/win32/dx_error.c b/src/win32/dx_error.c deleted file mode 100644 index 8e14539a3..000000000 --- a/src/win32/dx_error.c +++ /dev/null @@ -1,276 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// 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. -//----------------------------------------------------------------------------- -/// \file -/// \brief DirectX error messages -/// adapted from DirectX6 sample code - -#include - -//#define WIN32_LEAN_AND_MEAN -#define RPC_NO_WINDOWS_H -#include -#define DIRECTSOUND_VERSION 0x0600 /* version 6.0 */ -#define DXVERSION_NTCOMPATIBLE 0x0300 -#ifdef _MSC_VER -#pragma warning(disable : 4201) -#endif -#include -#include -#include - -#include "dx_error.h" - -// ----------------- -// DXErrorMessageBox -// Displays a message box containing the given formatted string. -// ----------------- -/* -VOID DXErrorMessageBox (HRESULT error) LPSTR fmt, ...) -{ - char buff[256]; - va_list args; - - va_start(args, fmt); - wvsprintf(buff, fmt, args); - va_end(args); - - lstrcat(buff, "\r\n"); - MessageBoxA(NULL, buff, "DirectX Error:", MB_ICONEXCLAMATION + MB_OK); -}*/ - - -// --------------- -// DXErrorToString -// Returns a pointer to a string describing the given DD, D3D or D3DRM error code. -// --------------- -LPCSTR DXErrorToString (HRESULT error) -{ - switch (error) { - case DD_OK: - /* Also includes D3D_OK and D3DRM_OK */ - return "No error."; - case DDERR_ALREADYINITIALIZED: - return "This object is already initialized."; - case DDERR_BLTFASTCANTCLIP: - return "Return if a clipper object is attached to the source surface passed into a BltFast call."; - case DDERR_CANNOTATTACHSURFACE: - return "This surface can not be attached to the requested surface."; - case DDERR_CANNOTDETACHSURFACE: - return "This surface can not be detached from the requested surface."; - case DDERR_CANTCREATEDC: - return "Windows can not create any more DCs."; - case DDERR_CANTDUPLICATE: - return "Can't duplicate primary & 3D surfaces, or surfaces that are implicitly created."; - case DDERR_CLIPPERISUSINGHWND: - return "An attempt was made to set a cliplist for a clipper object that is already monitoring an hwnd."; - case DDERR_COLORKEYNOTSET: - return "No src color key specified for this operation."; - case DDERR_CURRENTLYNOTAVAIL: - return "Support is currently not available."; - case DDERR_DIRECTDRAWALREADYCREATED: - return "A DirectDraw object representing this driver has already been created for this process."; - case DDERR_EXCEPTION: - return "An exception was encountered while performing the requested operation."; - case DDERR_EXCLUSIVEMODEALREADYSET: - return "An attempt was made to set the cooperative level when it was already set to exclusive."; - case DDERR_GENERIC: - return "Generic failure."; - case DDERR_HEIGHTALIGN: - return "Height of rectangle provided is not a multiple of reqd alignment."; - case DDERR_HWNDALREADYSET: - return "The CooperativeLevel HWND has already been set. It can not be reset while the process has surfaces or palettes created."; - case DDERR_HWNDSUBCLASSED: - return "HWND used by DirectDraw CooperativeLevel has been subclassed, this prevents DirectDraw from restoring state."; - case DDERR_IMPLICITLYCREATED: - return "This surface can not be restored because it is an implicitly created surface."; - case DDERR_INCOMPATIBLEPRIMARY: - return "Unable to match primary surface creation request with existing primary surface."; - case DDERR_INVALIDCAPS: - return "One or more of the caps bits passed to the callback are incorrect."; - case DDERR_INVALIDCLIPLIST: - return "DirectDraw does not support the provided cliplist."; - case DDERR_INVALIDDIRECTDRAWGUID: - return "The GUID passed to DirectDrawCreate is not a valid DirectDraw driver identifier."; - case DDERR_INVALIDMODE: - return "DirectDraw does not support the requested mode."; - case DDERR_INVALIDOBJECT: - return "DirectDraw received a pointer that was an invalid DIRECTDRAW object."; - case DDERR_INVALIDPARAMS: - return "One or more of the parameters passed to the function are incorrect."; - case DDERR_INVALIDPIXELFORMAT: - return "The pixel format was invalid as specified."; - case DDERR_INVALIDPOSITION: - return "Returned when the position of the overlay on the destination is no longer legal for that destination."; - case DDERR_INVALIDRECT: - return "Rectangle provided was invalid."; - case DDERR_LOCKEDSURFACES: - return "Operation could not be carried out because one or more surfaces are locked."; - case DDERR_NO3D: - return "There is no 3D present."; - case DDERR_NOALPHAHW: - return "Operation could not be carried out because there is no alpha accleration hardware present or available."; - case DDERR_NOBLTHW: - return "No blitter hardware present."; - case DDERR_NOCLIPLIST: - return "No cliplist available."; - case DDERR_NOCLIPPERATTACHED: - return "No clipper object attached to surface object."; - case DDERR_NOCOLORCONVHW: - return "Operation could not be carried out because there is no color conversion hardware present or available."; - case DDERR_NOCOLORKEY: - return "Surface doesn't currently have a color key"; - case DDERR_NOCOLORKEYHW: - return "Operation could not be carried out because there is no hardware support of the destination color key."; - case DDERR_NOCOOPERATIVELEVELSET: - return "Create function called without DirectDraw object method SetCooperativeLevel being called."; - case DDERR_NODC: - return "No DC was ever created for this surface."; - case DDERR_NODDROPSHW: - return "No DirectDraw ROP hardware."; - case DDERR_NODIRECTDRAWHW: - return "A hardware-only DirectDraw object creation was attempted but the driver did not support any hardware."; - case DDERR_NOEMULATION: - return "Software emulation not available."; - case DDERR_NOEXCLUSIVEMODE: - return "Operation requires the application to have exclusive mode but the application does not have exclusive mode."; - case DDERR_NOFLIPHW: - return "Flipping visible surfaces is not supported."; - case DDERR_NOGDI: - return "There is no GDI present."; - case DDERR_NOHWND: - return "Clipper notification requires an HWND or no HWND has previously been set as the CooperativeLevel HWND."; - case DDERR_NOMIRRORHW: - return "Operation could not be carried out because there is no hardware present or available."; - case DDERR_NOOVERLAYDEST: - return "Returned when GetOverlayPosition is called on an overlay that UpdateOverlay has never been called on to establish a destination."; - case DDERR_NOOVERLAYHW: - return "Operation could not be carried out because there is no overlay hardware present or available."; - case DDERR_NOPALETTEATTACHED: - return "No palette object attached to this surface."; - case DDERR_NOPALETTEHW: - return "No hardware support for 16 or 256 color palettes."; - case DDERR_NORASTEROPHW: - return "Operation could not be carried out because there is no appropriate raster op hardware present or available."; - case DDERR_NOROTATIONHW: - return "Operation could not be carried out because there is no rotation hardware present or available."; - case DDERR_NOSTRETCHHW: - return "Operation could not be carried out because there is no hardware support for stretching."; - case DDERR_NOT4BITCOLOR: - return "DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color palette."; - case DDERR_NOT4BITCOLORINDEX: - return "DirectDrawSurface is not in 4 bit color index palette and the requested operation requires 4 bit color index palette."; - case DDERR_NOT8BITCOLOR: - return "DirectDrawSurface is not in 8 bit color mode and the requested operation requires 8 bit color."; - case DDERR_NOTAOVERLAYSURFACE: - return "Returned when an overlay member is called for a non-overlay surface."; - case DDERR_NOTEXTUREHW: - return "Operation could not be carried out because there is no texture mapping hardware present or available."; - case DDERR_NOTFLIPPABLE: - return "An attempt has been made to flip a surface that is not flippable."; - case DDERR_NOTFOUND: - return "Requested item was not found."; - case DDERR_NOTLOCKED: - return "Surface was not locked. An attempt to unlock a surface that was not locked at all, or by this process, has been attempted."; - case DDERR_NOTPALETTIZED: - return "The surface being used is not a palette-based surface."; - case DDERR_NOVSYNCHW: - return "Operation could not be carried out because there is no hardware support for vertical blank synchronized operations."; - case DDERR_NOZBUFFERHW: - return "Operation could not be carried out because there is no hardware support for zbuffer blitting."; - case DDERR_NOZOVERLAYHW: - return "Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support z layering of overlays."; - case DDERR_OUTOFCAPS: - return "The hardware needed for the requested operation has already been allocated."; - case DDERR_OUTOFMEMORY: - return "There is not enough memory to perform the operation."; - case DDERR_OUTOFVIDEOMEMORY: - return "DirectDraw does not have enough memory to perform the operation."; - case DDERR_OVERLAYCANTCLIP: - return "The hardware does not support clipped overlays."; - case DDERR_OVERLAYCOLORKEYONLYONEACTIVE: - return "Can only have ony color key active at one time for overlays."; - case DDERR_OVERLAYNOTVISIBLE: - return "Returned when GetOverlayPosition is called on a hidden overlay."; - case DDERR_PALETTEBUSY: - return "Access to this palette is being refused because the palette is already locked by another thread."; - case DDERR_PRIMARYSURFACEALREADYEXISTS: - return "This process already has created a primary surface."; - case DDERR_REGIONTOOSMALL: - return "Region passed to Clipper::GetClipList is too small."; - case DDERR_SURFACEALREADYATTACHED: - return "This surface is already attached to the surface it is being attached to."; - case DDERR_SURFACEALREADYDEPENDENT: - return "This surface is already a dependency of the surface it is being made a dependency of."; - case DDERR_SURFACEBUSY: - return "Access to this surface is being refused because the surface is already locked by another thread."; - case DDERR_SURFACEISOBSCURED: - return "Access to surface refused because the surface is obscured."; - case DDERR_SURFACELOST: - return "Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have Restore called on it."; - case DDERR_SURFACENOTATTACHED: - return "The requested surface is not attached."; - case DDERR_TOOBIGHEIGHT: - return "Height requested by DirectDraw is too large."; - case DDERR_TOOBIGSIZE: - return "Size requested by DirectDraw is too large, but the individual height and width are OK."; - case DDERR_TOOBIGWIDTH: - return "Width requested by DirectDraw is too large."; - case DDERR_UNSUPPORTED: - return "Function call not supported."; - case DDERR_UNSUPPORTEDFORMAT: - return "FOURCC format requested is unsupported by DirectDraw."; - case DDERR_UNSUPPORTEDMASK: - return "Bitmask in the pixel format requested is unsupported by DirectDraw."; - case DDERR_VERTICALBLANKINPROGRESS: - return "Vertical blank is in progress."; - case DDERR_WASSTILLDRAWING: - return "Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is incomplete."; - case DDERR_WRONGMODE: - return "This surface can not be restored because it was created in a different mode."; - case DDERR_XALIGN: - return "Rectangle provided was not horizontally aligned on required boundary."; - - // - // DirectSound errors - // - case DSERR_ALLOCATED: - return "The request failed because resources, such as a priority level, were already in use by another caller."; - case DSERR_ALREADYINITIALIZED: - return "The object is already initialized."; - case DSERR_BADFORMAT: - return "The specified wave format is not supported."; - case DSERR_BUFFERLOST: - return "The buffer memory has been lost and must be restored."; - case DSERR_CONTROLUNAVAIL: - return "The control (volume, pan, and so forth) requested by the caller is not available."; - case DSERR_INVALIDCALL: - return "This function is not valid for the current state of this object."; - case DSERR_NOAGGREGATION: - return "The object does not support aggregation."; - case DSERR_NODRIVER: - return "No sound driver is available for use."; - case DSERR_NOINTERFACE: - return "The requested COM interface is not available."; - case DSERR_OTHERAPPHASPRIO: - return "Another application has a higher priority level, preventing this call from succeeding"; - case DSERR_PRIOLEVELNEEDED: - return "The caller does not have the priority level required for the function to succeed."; - case DSERR_UNINITIALIZED: - return "The IDirectSound::Initialize method has not been called or has not been called successfully before other methods were called."; - default: - return "Unrecognized error value."; - } -} diff --git a/src/win32/dx_error.h b/src/win32/dx_error.h deleted file mode 100644 index 3af4220de..000000000 --- a/src/win32/dx_error.h +++ /dev/null @@ -1,39 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// 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. -//----------------------------------------------------------------------------- -/// \file -/// \brief transform an unreadable DirectX error code -/// into a meaningful error message. - -#ifndef __DX_ERROR_H__ -#define __DX_ERROR_H__ - -//#define WIN32_LEAN_AND_MEAN -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// Displays a message box containing the given formatted string. -//VOID DXErrorMessageBox (LPSTR fmt, ...); - -// Returns a pointer to a string describing the given DD, D3D or D3DRM error code. -LPCSTR DXErrorToString (HRESULT error); - -#ifdef __cplusplus -}; -#endif -#endif // __DX_ERROR_H__ diff --git a/src/win32/fabdxlib.c b/src/win32/fabdxlib.c deleted file mode 100644 index 45ec5d0d3..000000000 --- a/src/win32/fabdxlib.c +++ /dev/null @@ -1,677 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// 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. -// -//----------------------------------------------------------------------------- -/// \file -/// \brief faB's DirectX library v1.0 -/// - converted to C for Doom Legacy - -#include "../doomdef.h" - -#ifdef _WINDOWS - -//#define WIN32_LEAN_AND_MEAN -#define RPC_NO_WINDOWS_H -#include -#include -#include "../i_system.h" -#include "dx_error.h" - -#include "fabdxlib.h" - -#define NT4COMPAT //always defined, always compatible - - -// globals - -IDirectDraw2* DDr2 = NULL; -IDirectDrawSurface* ScreenReal = NULL; // DirectDraw primary surface -IDirectDrawSurface* ScreenVirtual = NULL; // DirectDraw back surface -IDirectDrawPalette* DDPalette = NULL; // The primary surface palette -static IDirectDrawClipper *windclip = NULL; // clipper for windowed mode - -BOOL bAppFullScreen; // true for fullscreen exclusive mode, - -int windowPosX = 0; // current position in windowed mode -int windowPosY = 0; - -int ScreenWidth; -int ScreenHeight; -BOOL ScreenLocked; // Screen surface is being locked -int ScreenPitch; // offset from one line to the next -LPBYTE ScreenPtr; // memory of the surface - - -// -// CreateNewSurface -// -static inline IDirectDrawSurface* CreateNewSurface(int dwWidth, - int dwHeight, - int dwSurfaceCaps) -{ - DDSURFACEDESC ddsd; - HRESULT hr; - LPDIRECTDRAWSURFACE psurf; - - ZeroMemory(&ddsd, sizeof (ddsd)); - ddsd.dwSize = sizeof (ddsd); - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT |DDSD_WIDTH; - - ddsd.ddsCaps.dwCaps = dwSurfaceCaps; - - ddsd.dwHeight = dwHeight; - ddsd.dwWidth = dwWidth; - - hr = IDirectDraw2_CreateSurface (DDr2, &ddsd, &psurf, NULL); - - if (hr == DD_OK) - { - //DDCOLORKEY ddck; - IDirectDrawSurface_Restore(psurf); - - //hr = IDirectDrawSurface_GetColorKey(DDCKEY_SRCBLT, &ddck); - //psurf->SetColorKey(DDCKEY_SRCBLT, &ddck); - } - else - psurf = NULL; - - return psurf; -} - -// -// wow! from 320x200x8 up to 1600x1200x32 thanks Banshee! :) -// -static HRESULT WINAPI myEnumModesCallback (LPDDSURFACEDESC surf, LPVOID lpContext) -{ - APPENUMMODESCALLBACK pfnContext = lpContext; - - if (pfnContext) pfnContext(surf->dwWidth, - surf->dwHeight,surf->ddpfPixelFormat. -#ifdef DUMMYUNIONNAMEN - DUMMYUNIONNAMEN(1). -#endif - dwRGBBitCount - ); - - /*I_OutputMsg("%dx%dx%d bpp %d refresh\n", - surf->dwWidth, - surf->dwHeight, - surf->ddpfPixelFormat.dwRGBBitCount, - surf->dwRefreshRate);*/ - - return DDENUMRET_OK; -} - - -// -// Application call here to enumerate display modes -// -BOOL EnumDirectDrawDisplayModes (APPENUMMODESCALLBACK appFunc) -{ - LPVOID lpappFunc = appFunc; - - if (DDr2 == NULL) - return FALSE; - - // enumerate display modes - // Carl: DirectX 3.x apparently does not support VGA modes. Who cares. :) - // faB: removed DDEDM_REFRESHRATES, detects too many modes, plus we don't care of refresh rate. - if (bDX0300) - IDirectDraw2_EnumDisplayModes (DDr2, 0 /*| DDEDM_REFRESHRATES*/, - NULL, lpappFunc, myEnumModesCallback); - else - IDirectDraw2_EnumDisplayModes (DDr2, DDEDM_STANDARDVGAMODES /*| DDEDM_REFRESHRATES*/, - NULL, lpappFunc, myEnumModesCallback); - return TRUE; -} - -static HINSTANCE DDrawDLL = NULL; -typedef HRESULT(WINAPI *DDCreate)(GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter); -static DDCreate pfnDirectDrawCreate = NULL; - -static inline BOOL LoadDirectDraw(VOID) -{ - // load ddraw.dll - DDrawDLL = LoadLibraryA("DDRAW.DLL"); - if (DDrawDLL == NULL) - return false; - pfnDirectDrawCreate = (DDCreate)(LPVOID)GetProcAddress(DDrawDLL, "DirectDrawCreate"); - if (pfnDirectDrawCreate == NULL) - return false; - return true; -} - -static inline VOID UnLoadDirectDraw(VOID) -{ - if (!DDrawDLL) - return; - FreeLibrary(DDrawDLL); - pfnDirectDrawCreate = NULL; - DDrawDLL = NULL; -} - -// -// Create the DirectDraw object for later -// -BOOL CreateDirectDrawInstance (VOID) -{ - HRESULT hr; - IDirectDraw* DDr; - IDirectDraw** rp = &DDr; - IDirectDraw2** rp2 = &DDr2; - LPVOID *tp = (LPVOID *)rp2; - - if (!LoadDirectDraw()) - return FALSE; - // - // create an instance of DirectDraw object - // - if (FAILED(hr = pfnDirectDrawCreate(NULL, rp, NULL))) - I_Error("DirectDrawCreate FAILED: %s", DXErrorToString(hr)); - - // change interface to IDirectDraw2 - if (FAILED(hr = IDirectDraw_QueryInterface(DDr, &IID_IDirectDraw2, tp))) - I_Error("Failed to query DirectDraw2 interface: %s", DXErrorToString(hr)); - - // release the interface we don't need - IDirectDraw_Release (DDr); - return TRUE; -} - - -// -// - returns true if DirectDraw was initialized properly -// -int InitDirectDrawe (HWND appWin, int width, int height, int bpp, int fullScr) -{ - DDSURFACEDESC ddsd; // DirectDraw surface description for allocating - DDSCAPS ddscaps; - HRESULT ddrval; - - DWORD dwStyle; - RECT rect; - - // enumerate directdraw devices - //if (FAILED(DirectDrawEnumerate (myEnumDDDevicesCallback, NULL))) - // I_Error("Error with DirectDrawEnumerate"); - - if (!DDr2) - CreateDirectDrawInstance(); - - // remember what screen mode we are in - bAppFullScreen = fullScr; - ScreenHeight = height; - ScreenWidth = width; - - if (bAppFullScreen) - { - // Change window attributes - dwStyle = WS_POPUP | WS_VISIBLE; - SetWindowLong (appWin, GWL_STYLE, dwStyle); - SetWindowPos(appWin, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | - SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER); - - // Get exclusive mode - ddrval = IDirectDraw2_SetCooperativeLevel(DDr2, appWin, DDSCL_EXCLUSIVE | - DDSCL_FULLSCREEN | - DDSCL_ALLOWREBOOT); - if (ddrval != DD_OK) - I_Error("SetCooperativeLevel FAILED: %s\n", DXErrorToString(ddrval)); - - // Switch from windows desktop to fullscreen - -#ifdef NT4COMPAT - ddrval = IDirectDraw2_SetDisplayMode(DDr2, width, height, bpp, 0, 0); -#else - ddrval = IDirectDraw2_SetDisplayMode(DDr2, width, height, bpp, 0, DDSDM_STANDARDVGAMODE); -#endif - if (ddrval != DD_OK) - I_Error("SetDisplayMode FAILED: %s\n", DXErrorToString(ddrval)); - - // This is not really needed, except in certain cases. One case - // is while using MFC. When the desktop is initally at 16bpp, a mode - // switch to 8bpp somehow causes the MFC window to not fully initialize - // and a CreateSurface will fail with DDERR_NOEXCLUSIVEMODE. This will - // ensure that the window is initialized properly after a mode switch. - - ShowWindow(appWin, SW_SHOW); - - // Create the primary surface with 1 back buffer. Always zero the - // DDSURFACEDESC structure and set the dwSize member! - - ZeroMemory(&ddsd, sizeof (ddsd)); - ddsd.dwSize = sizeof (ddsd); - ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; - - // for fullscreen we use page flipping, for windowed mode, we blit the hidden surface to - // the visible surface, in both cases we have a visible (or 'real') surface, and a hidden - // (or 'virtual', or 'backbuffer') surface. - ddsd.dwBackBufferCount = 2; - - ddrval = IDirectDraw2_CreateSurface(DDr2,&ddsd, &ScreenReal, NULL); - if (ddrval != DD_OK) - I_Error("CreateSurface Primary Screen FAILED"); - - // Get a pointer to the back buffer - - ddscaps.dwCaps = DDSCAPS_BACKBUFFER; - ddrval = IDirectDrawSurface_GetAttachedSurface(ScreenReal,&ddscaps, &ScreenVirtual); - if (ddrval != DD_OK) - I_Error("GetAttachedSurface FAILED"); - } - else - { - rect.top = 0; - rect.left = 0; - rect.bottom = height; - rect.right = width; - - // Change window attributes - - dwStyle = GetWindowStyle(appWin); - dwStyle &= ~WS_POPUP; - dwStyle |= WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION; - - SetWindowLong(appWin, GWL_STYLE, dwStyle); - - // Resize the window so that the client area is the requested width/height - - AdjustWindowRectEx(&rect, GetWindowStyle(appWin), GetMenu(appWin) != NULL, - GetWindowExStyle(appWin)); - - // Just in case the window was moved off the visible area of the - // screen. - - SetWindowPos(appWin, NULL, 0, 0, rect.right-rect.left, - rect.bottom-rect.top, SWP_NOMOVE | SWP_NOZORDER | - SWP_NOACTIVATE); - - SetWindowPos(appWin, HWND_NOTOPMOST, 0, 0, 0, 0, - SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); - - // Exclusive mode is normal since it's in windowed mode and needs - // to cooperate with GDI - - ddrval = IDirectDraw2_SetCooperativeLevel(DDr2,appWin, DDSCL_NORMAL); - if (ddrval != DD_OK) - I_Error("SetCooperativeLevel FAILED"); - - // Always zero the DDSURFACEDESC structure and set the dwSize member! - - ZeroMemory(&ddsd, sizeof (ddsd)); - ddsd.dwSize = sizeof (ddsd); - ddsd.dwFlags = DDSD_CAPS; - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - - // Create the primary surface - - ddrval = IDirectDraw2_CreateSurface(DDr2,&ddsd, &ScreenReal, NULL); - if (ddrval != DD_OK) - I_Error("CreateSurface Primary Screen FAILED"); - - // Create a back buffer for offscreen rendering, this will be used to - // blt to the primary - - ScreenVirtual = CreateNewSurface(width, height, DDSCAPS_OFFSCREENPLAIN | - DDSCAPS_SYSTEMMEMORY); - if (ScreenVirtual == NULL) - I_Error("CreateSurface Secondary Screen FAILED"); - - /// \todo get the desktop bit depth, and build a lookup table - /// for quick conversions of 8bit color indexes 0-255 to desktop colors - /// eg: 256 entries of equivalent of palette colors 0-255 in 15,16,24,32 bit format - /// when blit virtual to real, convert pixels through lookup table.. - - // Use a clipper object for clipping when in windowed mode - // (make sure our drawing doesn't affect other windows) - - ddrval = IDirectDraw2_CreateClipper (DDr2, 0, &windclip, 0); - if (ddrval != DD_OK) - I_Error("CreateClipper FAILED"); - - // Associate the clipper with the window. - ddrval = IDirectDrawClipper_SetHWnd (windclip,0, appWin); - if (ddrval != DD_OK) - I_Error("Clipper -> SetHWnd FAILED"); - - // Attach the clipper to the surface. - ddrval = IDirectDrawSurface_SetClipper (ScreenReal,windclip); - if (ddrval != DD_OK) - I_Error("PrimaryScreen -> SetClipperClipper FAILED"); - } - - return TRUE; -} - - -// -// Free all memory -// -VOID CloseDirectDraw (VOID) -{ - ReleaseChtuff(); - if (DDr2) - { - IDirectDraw2_Release(DDr2); - DDr2 = NULL; - } - UnLoadDirectDraw(); -} - - -// -// Release DirectDraw stuff before display mode change -// -VOID ReleaseChtuff (VOID) -{ - if (!DDr2) - return; - if (windclip) - { - IDirectDrawClipper_Release(windclip); - windclip = NULL; - } - if (DDPalette) - { - IDirectDrawPalette_Release(DDPalette); - DDPalette = NULL; - } - // If the app is fullscreen, the back buffer is attached to the - // primary. Releasing the primary buffer will also release any - // attached buffers, so explicitly releasing the back buffer is not - // necessary. - - if (!bAppFullScreen && ScreenVirtual) - { - IDirectDrawSurface_Release(ScreenVirtual); // release hidden surface - ScreenVirtual = NULL; - } - if (ScreenReal) - { - IDirectDrawSurface_Release(ScreenReal); // and attached backbuffers for bAppFullScreen mode - ScreenReal = NULL; - } -} - - -// -// Clear the surface to color -// -VOID ClearSurface(IDirectDrawSurface* surface, int color) -{ - DDBLTFX ddbltfx; - - // Use the blter to do a color fill to clear the back buffer - ddbltfx.dwSize = sizeof (ddbltfx); - ddbltfx. -#ifdef DUMMYUNIONNAMEN - DUMMYUNIONNAMEN(5). -#endif - dwFillColor = color; - IDirectDrawSurface_Blt(surface,NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); - -} - -// -// Flip the real page with virtual page -// - in bAppFullScreen mode, do page flipping -// - in windowed mode, copy the hidden surface to the visible surface -// -// waitflip : if not 0, wait for page flip to end -BOOL ScreenFlip(int waitflip) -{ - HRESULT hr; - RECT rect; - - if (bAppFullScreen) - { - //hr = IDirectDrawSurface_GetFlipStatus (ScreenReal, DDGFS_); - - // In full-screen exclusive mode, do a hardware flip. - hr = IDirectDrawSurface_Flip(ScreenReal, NULL, DDFLIP_WAIT | (waitflip ? 0 : DDFLIP_NOVSYNC)); //return immediately - - // If the surface was lost, restore it. - if (hr == DDERR_SURFACELOST) - { - IDirectDrawSurface_Restore(ScreenReal); - - // The restore worked, so try the flip again. - hr = IDirectDrawSurface_Flip(ScreenReal, 0, DDFLIP_WAIT | (waitflip ? 0 : DDFLIP_NOVSYNC)); - } - } - else - { - rect.left = windowPosX; - rect.top = windowPosY; - rect.right = windowPosX + ScreenWidth - 1; - rect.bottom = windowPosY + ScreenHeight - 1; - - // Copy the back buffer to front. - hr = IDirectDrawSurface_Blt(ScreenReal, &rect, ScreenVirtual, 0, DDBLT_WAIT, 0); - - if (hr != DD_OK) - { - // If the surfaces were lost, restore them. - if (IDirectDrawSurface_IsLost(ScreenReal) == DDERR_SURFACELOST) - IDirectDrawSurface_Restore(ScreenReal); - - if (IDirectDrawSurface_IsLost(ScreenVirtual) == DDERR_SURFACELOST) - IDirectDrawSurface_Restore(ScreenVirtual); - - // Retry the copy. - hr = IDirectDrawSurface_Blt(ScreenReal,&rect, ScreenVirtual, 0, DDBLT_WAIT, 0); - } - } - - if (hr != DD_OK) - I_Error("ScreenFlip() : couldn't Flip surfaces because %s", DXErrorToString(hr)); - - return FALSE; -} - -// -// Print a text to the surface -// -VOID TextPrint(int x, int y, LPCSTR message) -{ - HRESULT hr; - HDC hdc = NULL; - - // Get the device context handle. - hr = IDirectDrawSurface_GetDC(ScreenVirtual,&hdc); - if (hr != DD_OK) - return; - - // Write the message. - SetBkMode(hdc, TRANSPARENT); - SetTextColor(hdc, RGB(255, 255, 255)); - TextOutA(hdc, x, y, message, (int)strlen(message)); - - // Release the device context. - hr = IDirectDrawSurface_ReleaseDC(ScreenVirtual,hdc); -} - -// -// Lock surface before multiple drawings by hand, for speed -// -boolean LockScreen(VOID) -{ - DDSURFACEDESC ddsd; - HRESULT ddrval; - - ZeroMemory(&ddsd, sizeof (ddsd)); - ddsd.dwSize = sizeof (ddsd); - - // attempt to Lock the surface - ddrval = IDirectDrawSurface_Lock(ScreenVirtual, NULL, &ddsd, DDLOCK_WAIT, NULL); - - // Always, always check for errors with DirectX! - // If the surface was lost, restore it. - if (ddrval == DDERR_SURFACELOST) - { - ddrval = IDirectDrawSurface_Restore(ScreenReal); - - // now retry to get the lock - ddrval = IDirectDrawSurface_Lock(ScreenVirtual, NULL, &ddsd, DDLOCK_WAIT, NULL); - } - - if (ddrval == DD_OK) - { - ScreenLocked = TRUE; - ScreenPtr = (LPBYTE)ddsd.lpSurface; - ScreenPitch = ddsd. -#ifdef DUMMYUNIONNAMEN - DUMMYUNIONNAMEN(1). -#endif - lPitch; - } - else - { - ScreenLocked = FALSE; - ScreenPtr = NULL; - ScreenPitch = 0; - //I_Error("LockScreen() : couldn't restore the surface."); - return false; - } - return true; -} - -// -// Unlock surface -// -VOID UnlockScreen(VOID) -{ - if (DD_OK != IDirectDrawSurface_Unlock(ScreenVirtual,NULL)) - I_Error("Couldn't UnLock the renderer!"); - - ScreenLocked = FALSE; - ScreenPtr = NULL; - ScreenPitch = 0; -} - -// Blit virtual screen to real screen -//faB: note: testing 14/03/1999, see if it is faster than memcopy of virtual to -/* -static LPDIRECTDRAWSURFACE lpDDS = NULL; -VOID BlitScreen(VOID) -{ - HRESULT hr; - - if (!lpDDS) - I_Error("lpDDS NULL"); - - hr = IDirectDrawSurface_BltFast(ScreenVirtual, - 0, 0, // Upper left xy of destination - lpDDS, // Source surface - NULL, // Source rectangle = entire surface - DDBLTFAST_WAIT | DDBLTFAST_NOCOLORKEY); - if (FAILED(hr)) - I_Error("BltFast FAILED"); -} - -VOID MakeScreen(int width, int height, BYTE* lpSurface) -{ - HRESULT hr; - DDSURFACEDESC ddsd; - - // Initialize the surface description. - ZeroMemory (&ddsd, sizeof ddsd); - ZeroMemory (&ddsd.ddpfPixelFormat, sizeof (DDPIXELFORMAT)); - ddsd.dwSize = sizeof ddsd; - ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | //DDSD_LPSURFACE | - DDSD_PITCH | DDSD_PIXELFORMAT | DDSD_CAPS; - ddsd.dwWidth = width; - ddsd.dwHeight= height; - ddsd.lPitch = width; - ddsd.lpSurface = lpSurface; - ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; - - // Set up the pixel format for 8-bit - ddsd.ddpfPixelFormat.dwSize = sizeof (DDPIXELFORMAT); - ddsd.ddpfPixelFormat.dwFlags= DDPF_RGB | DDPF_PALETTEINDEXED8; - ddsd.ddpfPixelFormat.dwRGBBitCount = 8; - - // - ddsd.ddpfPixelFormat.dwRGBBitCount = (DWORD)DEPTH*8; - ddsd.ddpfPixelFormat.dwRBitMask = 0x00FF0000; - ddsd.ddpfPixelFormat.dwGBitMask = 0x0000FF00; - ddsd.ddpfPixelFormat.dwBBitMask = 0x000000FF; - - // Create the surface - hr = IDirectDraw2_CreateSurface(DDr2, &ddsd, &lpDDS, NULL); - if (FAILED(hr)) - I_Error("MakeScreen FAILED: %s",DDError(hr)); - //ddsd.lpSurface = lpSurface; -} -*/ - -// -// Create a palette object -// -VOID CreateDDPalette (PALETTEENTRY* colorTable) -{ - HRESULT ddrval; - ddrval = IDirectDraw2_CreatePalette(DDr2,DDPCAPS_8BIT|DDPCAPS_ALLOW256, colorTable, &DDPalette, NULL); - if (ddrval != DD_OK) - I_Error("couldn't CreatePalette"); -}; - - -// -// Free the palette object -// -VOID DestroyDDPalette (VOID) -{ - if (DDPalette) - { - IDirectDrawPalette_Release(DDPalette); - DDPalette = NULL; - } -} - -// -// Set a a full palette of 256 PALETTEENTRY entries -// -VOID SetDDPalette(PALETTEENTRY* pal) -{ - // create palette first time - if (DDPalette == NULL) - CreateDDPalette(pal); - else - IDirectDrawPalette_SetEntries(DDPalette, 0, 0, 256, pal); - // setting the same palette to the same surface again does not increase - // the reference count - IDirectDrawSurface_SetPalette(ScreenReal, DDPalette); -} - -// -// Wait for vsync, gross -// -VOID WaitVbl(VOID) -{ - IDirectDraw2_WaitForVerticalBlank(DDr2, DDWAITVB_BLOCKBEGIN, NULL); -} - - -// -// Restore the palette. Useful when we regain focus. -// -VOID RestoreDDPalette(VOID) -{ - if (DDPalette) - IDirectDrawSurface_SetPalette(ScreenReal, DDPalette); -} -#endif diff --git a/src/win32/fabdxlib.h b/src/win32/fabdxlib.h deleted file mode 100644 index 2836b795d..000000000 --- a/src/win32/fabdxlib.h +++ /dev/null @@ -1,82 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// 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. -//----------------------------------------------------------------------------- -/// \file -/// \brief faB's DirectX library v1.0 - -#ifndef _H_FABDXLIB_ -#define _H_FABDXLIB_ - -//#define WIN32_LEAN_AND_MEAN -#define RPC_NO_WINDOWS_H -#include -#ifdef __MINGW32__ -//#define NONAMELESSUNION -#endif -#ifdef _MSC_VER -#pragma warning(disable : 4201) -#endif -#include -#if (defined (DIRECTDRAW_VERSION) && (DIRECTDRAW_VERSION >= 0x0700)) -#undef DUMMYUNIONNAMEN -#endif -// format of function in app called with width,height -typedef BOOL (*APPENUMMODESCALLBACK)(int width, int height, int bpp); - - -// globals -extern IDirectDraw2* DDr2; -extern IDirectDrawSurface* ScreenReal; -extern IDirectDrawSurface* ScreenVirtual; -extern IDirectDrawPalette* DDPalette; - -extern BOOL bAppFullScreen; // main code might need this to know the current - // fullscreen or windowed state - -extern int windowPosX; // current position in windowed mode -extern int windowPosY; - -extern int ScreenWidth; -extern int ScreenHeight; -extern BOOL ScreenLocked; // Screen surface is being locked -extern int ScreenPitch; // offset from one line to the next -extern LPBYTE ScreenPtr; // memory of the surface - -extern BOOL bDX0300; - -BOOL EnumDirectDrawDisplayModes (APPENUMMODESCALLBACK appFunc); -BOOL CreateDirectDrawInstance (VOID); - -int InitDirectDrawe (HWND appWin, int width, int height, int bpp, int fullScr); -VOID CloseDirectDraw (VOID); - -VOID ReleaseChtuff (VOID); - -VOID ClearSurface (IDirectDrawSurface* surface, int color); -BOOL ScreenFlip (int wait); -VOID TextPrint (int x, int y, LPCSTR message); - -VOID CreateDDPalette (PALETTEENTRY* colorTable); -VOID DestroyDDPalette (VOID); -VOID SetDDPalette (PALETTEENTRY* pal); -VOID RestoreDDPalette(VOID); - -VOID WaitVbl (VOID); - -boolean LockScreen (VOID); -VOID UnlockScreen (VOID); - - -#endif /* _H_FABDXLIB_ */ diff --git a/src/win32/win_cd.c b/src/win32/win_cd.c deleted file mode 100644 index 324c24928..000000000 --- a/src/win32/win_cd.c +++ /dev/null @@ -1,539 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// 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. -//----------------------------------------------------------------------------- -/// \file -/// \brief cd music interface (uses MCI). - -#include "../doomdef.h" -#include "../doomstat.h" -#ifdef _WINDOWS -#include "win_main.h" -#include - -#include "../command.h" -#include "../doomtype.h" -#include "../i_sound.h" -#include "../i_system.h" - -#include "../s_sound.h" - -#define MAX_CD_TRACKS 255 - -typedef struct { - BOOL IsAudio; - DWORD Start, End; - DWORD Length; // minutes -} CDTrack; - -// ------- -// private -// ------- -static CDTrack m_nTracks[MAX_CD_TRACKS]; -static int m_nTracksCount; // up to MAX_CD_TRACKS -static MCI_STATUS_PARMS m_MCIStatus; -static MCI_OPEN_PARMS m_MCIOpen; - -// ------ -// protos -// ------ -static void Command_Cd_f (void); - - -// ------------------- -// MCIErrorMessageBox -// Retrieve error message corresponding to return value from -// mciSendCommand() or mciSenString() -// ------------------- -static VOID MCIErrorMessageBox (MCIERROR iErrorCode) -{ - char szErrorText[128]; - if (!mciGetErrorStringA (iErrorCode, szErrorText, sizeof (szErrorText))) - wsprintfA(szErrorText,"MCI CD Audio Unknown Error #%lu\n", iErrorCode); - I_OutputMsg("%s", szErrorText); - /*MessageBox (GetActiveWindow(), szTemp+1, "LEGACY", - MB_OK | MB_ICONSTOP);*/ -} - - -// -------- -// CD_Reset -// -------- -static VOID CD_Reset (VOID) -{ - // no win32 equivalent - //faB: for DOS, some odd drivers like to be reset sometimes.. useless in MCI I guess -} - - -// ---------------- -// CD_ReadTrackInfo -// Read in number of tracks, and length of each track in minutes/seconds -// returns true if error -// ---------------- -static BOOL CD_ReadTrackInfo(VOID) -{ - UINT nTrackLength; - INT i; - MCIERROR iErr; - - m_nTracksCount = 0; - - m_MCIStatus.dwItem = MCI_STATUS_NUMBER_OF_TRACKS; - iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_STATUS, MCI_STATUS_ITEM|MCI_WAIT, (DWORD_PTR)&m_MCIStatus); - if (iErr) - { - MCIErrorMessageBox (iErr); - return FALSE; - } - m_nTracksCount = (int)m_MCIStatus.dwReturn; - if (m_nTracksCount > MAX_CD_TRACKS) - m_nTracksCount = MAX_CD_TRACKS; - - for (i = 0; i < m_nTracksCount; i++) - { - m_MCIStatus.dwTrack = (DWORD)(i+1); - m_MCIStatus.dwItem = MCI_STATUS_LENGTH; - iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_STATUS, MCI_TRACK|MCI_STATUS_ITEM|MCI_WAIT, (DWORD_PTR)&m_MCIStatus); - if (iErr) - { - MCIErrorMessageBox (iErr); - return FALSE; - } - nTrackLength = (DWORD)(MCI_MSF_MINUTE(m_MCIStatus.dwReturn)*60 + MCI_MSF_SECOND(m_MCIStatus.dwReturn)); - m_nTracks[i].Length = nTrackLength; - - m_MCIStatus.dwItem = MCI_CDA_STATUS_TYPE_TRACK; - iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_STATUS, MCI_TRACK|MCI_STATUS_ITEM|MCI_WAIT, (DWORD_PTR)&m_MCIStatus); - if (iErr) - { - MCIErrorMessageBox (iErr); - return FALSE; - } - m_nTracks[i].IsAudio = (m_MCIStatus.dwReturn == MCI_CDA_TRACK_AUDIO); - } - - return TRUE; -} - - -// ------------ -// CD_TotalTime -// returns total time for all audio tracks in seconds -// ------------ -static UINT CD_TotalTime(VOID) -{ - UINT nTotalLength = 0; - INT nTrack; - for (nTrack = 0; nTrack < m_nTracksCount; nTrack++) - { - if (m_nTracks[nTrack].IsAudio) - nTotalLength += m_nTracks[nTrack].Length; - } - return nTotalLength; -} - - -//====================================================================== -// CD AUDIO MUSIC SUBSYSTEM -//====================================================================== - -UINT8 cdaudio_started = 0; // for system startup/shutdown - -static BOOL cdPlaying = FALSE; -static INT cdPlayTrack; // when cdPlaying is true -static BOOL cdLooping = FALSE; -static BYTE cdRemap[MAX_CD_TRACKS]; -static BOOL cdEnabled = TRUE; // cd info available -static BOOL cdValid; // true when last cd audio info was ok -static BOOL wasPlaying; -//static INT cdVolume = 0; // current cd volume (0-31) - -// 0-31 like Music & Sfx, though CD hardware volume is 0-255. -consvar_t cd_volume = CVAR_INIT ("cd_volume","18",CV_SAVE,soundvolume_cons_t, NULL); - -// allow Update for next/loop track -// some crap cd drivers take up to -// a second for a simple 'busy' check.. -// (on those Update can be disabled) -consvar_t cdUpdate = CVAR_INIT ("cd_update","1",CV_SAVE, NULL, NULL); - -#if (__GNUC__ > 6) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wformat-overflow" -#endif -// hour,minutes,seconds -static LPSTR hms(UINT seconds) -{ - UINT hours, minutes; - static CHAR s[9]; - - minutes = seconds / 60; - seconds %= 60; - hours = minutes / 60; - minutes %= 60; - if (hours > 0) - sprintf (s, "%lu:%02lu:%02lu", (long unsigned int)hours, (long unsigned int)minutes, (long unsigned int)seconds); - else - sprintf (s, "%2lu:%02lu", (long unsigned int)minutes, (long unsigned int)seconds); - return s; -} -#if (__GNUC__ > 6) -#pragma GCC diagnostic pop -#endif - -static void Command_Cd_f(void) -{ - LPCSTR s; - int i,j; - - if (!cdaudio_started) - return; - - if (COM_Argc() < 2) - { - CONS_Printf (M_GetText( - "cd [on] [off] [remap] [reset] [select]\n" - " [open] [info] [play ] [resume]\n" - " [stop] [pause] [loop ]\n")); - return; - } - - s = COM_Argv(1); - - // activate cd music - if (!strncmp(s,"on",2)) - { - cdEnabled = TRUE; - return; - } - - // stop/deactivate cd music - if (!strncmp(s, "off", 3)) - { - if (cdPlaying) - I_StopCD(); - cdEnabled = FALSE; - return; - } - - // remap tracks - if (!strncmp(s, "remap", 5)) - { - i = (int)COM_Argc() - 2; - if (i <= 0) - { - CONS_Printf(M_GetText("CD tracks remapped in that order :\n")); - for (j = 1; j < MAX_CD_TRACKS; j++) - if (cdRemap[j] != j) - CONS_Printf(" %2d -> %2d\n", j, cdRemap[j]); - return; - } - for (j = 1; j <= i; j++) - cdRemap[j] = (UINT8)atoi(COM_Argv(j+1)); - return; - } - - // reset the CD driver, useful on some odd cd's - if (!strncmp(s,"reset",5)) - { - cdEnabled = TRUE; - if (cdPlaying) - I_StopCD (); - for (i = 0; i < MAX_CD_TRACKS; i++) - cdRemap[i] = (UINT8)i; - CD_Reset(); - cdValid = CD_ReadTrackInfo(); - return; - } - - // any other command is not allowed until we could retrieve cd information - if (!cdValid) - { - CONS_Printf(M_GetText("CD is not ready.\n")); - return; - } - - /* faB: not with MCI, didn't find it, useless anyway - if (!strncmp(s,"open",4)) - { - if (cdPlaying) - I_StopCD (); - bcd_open_door(); - cdValid = FALSE; - return; - }*/ - - if (!strncmp(s,"info",4)) - { - if (!CD_ReadTrackInfo()) - { - cdValid = FALSE; - return; - } - - cdValid = TRUE; - - if (m_nTracksCount <= 0) - CONS_Printf(M_GetText("No audio tracks\n")); - else - { - // display list of tracks - // highlight current playing track - for (i = 0; i < m_nTracksCount; i++) - { - CONS_Printf("%s%2d. %s %s\n", - cdPlaying && (cdPlayTrack == i) ? "\x82 " : " ", - i+1, m_nTracks[i].IsAudio ? M_GetText("audio") : M_GetText("data "), - hms(m_nTracks[i].Length)); - } - CONS_Printf(M_GetText("\x82Total time : %s\n"), hms(CD_TotalTime())); - } - if (cdPlaying) - { - CONS_Printf(M_GetText("Currently %s track %u\n"), cdLooping ? M_GetText("looping") : M_GetText("playing"), cdPlayTrack); - } - return; - } - - if (!strncmp(s,"play",4)) - { - I_PlayCD ((UINT8)atoi (COM_Argv (2)), false); - return; - } - - if (!strncmp(s,"stop",4)) - { - I_StopCD (); - return; - } - - if (!strncmp(s,"loop",4)) - { - I_PlayCD((UINT8)atoi (COM_Argv (2)), true); - return; - } - - if (!strncmp(s,"resume",4)) - { - I_ResumeCD (); - return; - } - - CONS_Printf (M_GetText("Invalid CD command \"CD %s\"\n"), s); -} - - -// ------------ -// I_ShutdownCD -// Shutdown CD Audio subsystem, release whatever was allocated -// ------------ -void I_ShutdownCD(void) -{ - MCIERROR iErr; - - if (!cdaudio_started) - return; - - CONS_Printf("I_ShutdownCD: "); - - I_StopCD(); - - // closes MCI CD - iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_CLOSE, 0, 0); - if (iErr) - MCIErrorMessageBox (iErr); -} - - -// -------- -// I_InitCD -// Init CD Audio subsystem -// -------- -void I_InitCD(void) -{ - MCI_SET_PARMS mciSet; - MCIERROR iErr; - int i; - - // We don't have an open device yet - m_MCIOpen.wDeviceID = 0; - m_nTracksCount = 0; - - cdaudio_started = false; - - m_MCIOpen.lpstrDeviceType = (LPCTSTR)MCI_DEVTYPE_CD_AUDIO; - iErr = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE|MCI_OPEN_TYPE_ID, (DWORD_PTR)&m_MCIOpen); - if (iErr) - { - MCIErrorMessageBox (iErr); - return; - } - - // Set the time format to track/minute/second/frame (TMSF). - mciSet.dwTimeFormat = MCI_FORMAT_TMSF; - iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD_PTR)&mciSet); - if (iErr) - { - MCIErrorMessageBox (iErr); - mciSendCommand(m_MCIOpen.wDeviceID, MCI_CLOSE, 0, 0); - return; - } - - I_AddExitFunc (I_ShutdownCD); - cdaudio_started = true; - - CONS_Printf (M_GetText("CD audio Initialized\n")); - - // last saved in config.cfg - i = cd_volume.value; - //I_SetVolumeCD (0); // initialize to 0 for some odd cd drivers - I_SetVolumeCD (i); // now set the last saved volume - - for (i = 0; i < MAX_CD_TRACKS; i++) - cdRemap[i] = (UINT8)i; - - if (!CD_ReadTrackInfo()) - { - CONS_Printf(M_GetText("No CD in drive\n")); - cdEnabled = FALSE; - cdValid = FALSE; - } - else - { - cdEnabled = TRUE; - cdValid = TRUE; - } - - COM_AddCommand ("cd", Command_Cd_f); -} - - - -// loop/go to next track when track is finished (if cd_update var is true) -// update the volume when it has changed (from console/menu) -void I_UpdateCD(void) -{ - /// \todo check for cd change and restart music ? -} - - -// -void I_PlayCD(UINT8 nTrack, UINT8 bLooping) -{ - MCI_PLAY_PARMS mciPlay; - MCIERROR iErr; - - if (!cdaudio_started || !cdEnabled) - return; - - //faB: try again if it didn't work (just free the user of typing 'cd reset' command) - if (!cdValid) - cdValid = CD_ReadTrackInfo(); - if (!cdValid) - return; - - // tracks start at 0 in the code.. - nTrack--; - if (nTrack >= m_nTracksCount) - nTrack = (UINT8) (nTrack % m_nTracksCount); - - nTrack = cdRemap[nTrack]; - - if (cdPlaying) - { - if (cdPlayTrack == nTrack) - return; - I_StopCD (); - } - - cdPlayTrack = nTrack; - - if (!m_nTracks[nTrack].IsAudio) - { - //I_OutputMsg("\x82""CD Play: not an audio track\n"); // Tails 03-25-2001 - return; - } - - cdLooping = bLooping; - - //faB: stop MIDI music, MIDI music will restart if volume is upped later - cv_digmusicvolume.value = 0; - cv_midimusicvolume.value = 0; - I_StopSong(); - - //faB: I don't use the notify message, I'm trying to minimize the delay - mciPlay.dwCallback = (DWORD)((size_t)hWndMain); - mciPlay.dwFrom = MCI_MAKE_TMSF(nTrack+1, 0, 0, 0); - iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_PLAY, MCI_FROM|MCI_NOTIFY, (DWORD_PTR)&mciPlay); - if (iErr) - { - MCIErrorMessageBox (iErr); - cdValid = FALSE; - cdPlaying = FALSE; - return; - } - - cdPlaying = TRUE; -} - - -// pause cd music -void I_StopCD(void) -{ - MCIERROR iErr; - - if (!cdaudio_started || !cdEnabled) - return; - - iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_PAUSE, MCI_WAIT, 0); - if (iErr) - MCIErrorMessageBox (iErr); - else - { - wasPlaying = cdPlaying; - cdPlaying = FALSE; - } -} - - -// continue after a pause -void I_ResumeCD(void) -{ - MCIERROR iErr; - - if (!cdaudio_started || !cdEnabled) - return; - - if (!cdValid) - return; - - if (!wasPlaying) - return; - - iErr = mciSendCommand(m_MCIOpen.wDeviceID, MCI_RESUME, MCI_WAIT, 0); - if (iErr) - MCIErrorMessageBox (iErr); - else - cdPlaying = TRUE; -} - - -// volume : logical cd audio volume 0-31 (hardware is 0-255) -boolean I_SetVolumeCD (INT32 volume) -{ - UNREFERENCED_PARAMETER(volume); - return false; -} -#endif diff --git a/src/win32/win_dll.c b/src/win32/win_dll.c deleted file mode 100644 index 4743cec34..000000000 --- a/src/win32/win_dll.c +++ /dev/null @@ -1,238 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// 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. -//----------------------------------------------------------------------------- -/// \file -/// \brief load and initialise the 3D driver DLL - -#include "../doomdef.h" -#ifdef HWRENDER -#include "../hardware/hw_drv.h" // get the standard 3D Driver DLL exports prototypes -#endif - -#ifdef HW3SOUND -#include "../hardware/hw3dsdrv.h" // get the 3D sound driver DLL export prototypes -#endif - -#ifdef _WINDOWS - -#include "win_dll.h" -#include "win_main.h" // I_ShowLastError() - -#if defined(HWRENDER) || defined(HW3SOUND) -typedef struct loadfunc_s { - LPCSTR fnName; - LPVOID fnPointer; -} loadfunc_t; - -// -------------------------------------------------------------------------- -// Load a DLL, returns the HMODULE handle or NULL -// -------------------------------------------------------------------------- -static HMODULE LoadDLL (LPCSTR dllName, loadfunc_t *funcTable) -{ - LPVOID funcPtr; - loadfunc_t *loadfunc; - HMODULE hModule; - - if ((hModule = LoadLibraryA(dllName)) != NULL) - { - // get function pointers for all functions we use - for (loadfunc = funcTable; loadfunc->fnName != NULL; loadfunc++) - { - funcPtr = GetProcAddress(hModule, loadfunc->fnName); - if (!funcPtr) { - I_ShowLastError(FALSE); - MessageBoxA(NULL, va("The '%s' haven't the good specification (function %s missing)\n\n" - "You must use dll from the same zip of this exe\n", dllName, loadfunc->fnName), - "Error", MB_OK|MB_ICONINFORMATION); - return FALSE; - } - // store function address - *((LPVOID*)loadfunc->fnPointer) = funcPtr; - } - } - else - { - I_ShowLastError(FALSE); - MessageBoxA(NULL, va("LoadLibrary() FAILED : couldn't load '%s'\r\n", dllName), "Warning", MB_OK|MB_ICONINFORMATION); - } - - return hModule; -} - - -// -------------------------------------------------------------------------- -// Unload the DLL -// -------------------------------------------------------------------------- -static VOID UnloadDLL (HMODULE* pModule) -{ - if (FreeLibrary(*pModule)) - *pModule = NULL; - else - I_ShowLastError(TRUE); -} -#endif - -// ========================================================================== -// STANDARD 3D DRIVER DLL FOR DOOM LEGACY -// ========================================================================== - -// note : the 3D driver loading should be put somewhere else.. - -#ifdef HWRENDER -static HMODULE hwdModule = NULL; - -static loadfunc_t hwdFuncTable[] = { -#ifdef _X86_ - {"Init@4", &hwdriver.pfnInit}, - {"Shutdown@0", &hwdriver.pfnShutdown}, - {"GetModeList@8", &hwdriver.pfnGetModeList}, - {"SetPalette@4", &hwdriver.pfnSetPalette}, - {"FinishUpdate@4", &hwdriver.pfnFinishUpdate}, - {"Draw2DLine@12", &hwdriver.pfnDraw2DLine}, - {"DrawPolygon@16", &hwdriver.pfnDrawPolygon}, - {"RenderSkyDome@4", &hwdriver.pfnRenderSkyDome}, - {"SetBlend@4", &hwdriver.pfnSetBlend}, - {"ClearBuffer@12", &hwdriver.pfnClearBuffer}, - {"SetTexture@4", &hwdriver.pfnSetTexture}, - {"UpdateTexture@4", &hwdriver.pfnUpdateTexture}, - {"DeleteTexture@4", &hwdriver.pfnDeleteTexture}, - {"ReadRect@24", &hwdriver.pfnReadRect}, - {"GClipRect@20", &hwdriver.pfnGClipRect}, - {"ClearMipMapCache@0", &hwdriver.pfnClearMipMapCache}, - {"SetSpecialState@8", &hwdriver.pfnSetSpecialState}, - {"DrawModel@16", &hwdriver.pfnDrawModel}, - {"SetTransform@4", &hwdriver.pfnSetTransform}, - {"GetTextureUsed@0", &hwdriver.pfnGetTextureUsed}, - {"GetRenderVersion@0", &hwdriver.pfnGetRenderVersion}, -#ifdef SHUFFLE - {"PostImgRedraw@4", &hwdriver.pfnPostImgRedraw}, -#endif - {"FlushScreenTextures@0",&hwdriver.pfnFlushScreenTextures}, - {"StartScreenWipe@0", &hwdriver.pfnStartScreenWipe}, - {"EndScreenWipe@0", &hwdriver.pfnEndScreenWipe}, - {"DoScreenWipe@0", &hwdriver.pfnDoScreenWipe}, - {"DrawIntermissionBG@0",&hwdriver.pfnDrawIntermissionBG}, - {"MakeScreenTexture@0", &hwdriver.pfnMakeScreenTexture}, - {"MakeScreenFinalTexture@0", &hwdriver.pfnMakeScreenFinalTexture}, - {"DrawScreenFinalTexture@8", &hwdriver.pfnDrawScreenFinalTexture}, -#else - {"Init", &hwdriver.pfnInit}, - {"Shutdown", &hwdriver.pfnShutdown}, - {"GetModeList", &hwdriver.pfnGetModeList}, - {"SetPalette", &hwdriver.pfnSetPalette}, - {"FinishUpdate", &hwdriver.pfnFinishUpdate}, - {"Draw2DLine", &hwdriver.pfnDraw2DLine}, - {"DrawPolygon", &hwdriver.pfnDrawPolygon}, - {"RenderSkyDome", &hwdriver.pfnRenderSkyDome}, - {"SetBlend", &hwdriver.pfnSetBlend}, - {"ClearBuffer", &hwdriver.pfnClearBuffer}, - {"SetTexture", &hwdriver.pfnSetTexture}, - {"UpdateTexture", &hwdriver.pfnUpdateTexture}, - {"DeleteTexture", &hwdriver.pfnDeleteTexture}, - {"ReadRect", &hwdriver.pfnReadRect}, - {"GClipRect", &hwdriver.pfnGClipRect}, - {"ClearMipMapCache", &hwdriver.pfnClearMipMapCache}, - {"SetSpecialState", &hwdriver.pfnSetSpecialState}, - {"DrawModel", &hwdriver.pfnDrawModel}, - {"SetTransform", &hwdriver.pfnSetTransform}, - {"GetTextureUsed", &hwdriver.pfnGetTextureUsed}, - {"GetRenderVersion", &hwdriver.pfnGetRenderVersion}, -#ifdef SHUFFLE - {"PostImgRedraw", &hwdriver.pfnPostImgRedraw}, -#endif - {"FlushScreenTextures", &hwdriver.pfnFlushScreenTextures}, - {"StartScreenWipe", &hwdriver.pfnStartScreenWipe}, - {"EndScreenWipe", &hwdriver.pfnEndScreenWipe}, - {"DoScreenWipe", &hwdriver.pfnDoScreenWipe}, - {"DrawIntermissionBG", &hwdriver.pfnDrawIntermissionBG}, - {"MakeScreenTexture", &hwdriver.pfnMakeScreenTexture}, - {"MakeScreenFinalTexture", &hwdriver.pfnMakeScreenFinalTexture}, - {"DrawScreenFinalTexture", &hwdriver.pfnDrawScreenFinalTexture}, -#endif - {NULL,NULL} -}; - -BOOL Init3DDriver (LPCSTR dllName) -{ - hwdModule = LoadDLL(dllName, hwdFuncTable); - return (hwdModule != NULL); -} - -VOID Shutdown3DDriver (VOID) -{ - UnloadDLL(&hwdModule); -} -#endif - -#ifdef HW3SOUND -static HMODULE hwsModule = NULL; - -static loadfunc_t hwsFuncTable[] = { -#ifdef _X86_ - {"Startup@8", &hw3ds_driver.pfnStartup}, - {"Shutdown@0", &hw3ds_driver.pfnShutdown}, - {"AddSfx@4", &hw3ds_driver.pfnAddSfx}, - {"AddSource@8", &hw3ds_driver.pfnAddSource}, - {"StartSource@4", &hw3ds_driver.pfnStartSource}, - {"StopSource@4", &hw3ds_driver.pfnStopSource}, - {"GetHW3DSVersion@0", &hw3ds_driver.pfnGetHW3DSVersion}, - {"BeginFrameUpdate@0", &hw3ds_driver.pfnBeginFrameUpdate}, - {"EndFrameUpdate@0", &hw3ds_driver.pfnEndFrameUpdate}, - {"IsPlaying@4", &hw3ds_driver.pfnIsPlaying}, - {"UpdateListener@8", &hw3ds_driver.pfnUpdateListener}, - {"UpdateSourceParms@12", &hw3ds_driver.pfnUpdateSourceParms}, - {"SetCone@8", &hw3ds_driver.pfnSetCone}, - {"SetGlobalSfxVolume@4", &hw3ds_driver.pfnSetGlobalSfxVolume}, - {"Update3DSource@8", &hw3ds_driver.pfnUpdate3DSource}, - {"ReloadSource@8", &hw3ds_driver.pfnReloadSource}, - {"KillSource@4", &hw3ds_driver.pfnKillSource}, - {"KillSfx@4", &hw3ds_driver.pfnKillSfx}, - {"GetHW3DSTitle@8", &hw3ds_driver.pfnGetHW3DSTitle}, -#else - {"Startup", &hw3ds_driver.pfnStartup}, - {"Shutdown", &hw3ds_driver.pfnShutdown}, - {"AddSfx", &hw3ds_driver.pfnAddSfx}, - {"AddSource", &hw3ds_driver.pfnAddSource}, - {"StartSource", &hw3ds_driver.pfnStartSource}, - {"StopSource", &hw3ds_driver.pfnStopSource}, - {"GetHW3DSVersion", &hw3ds_driver.pfnGetHW3DSVersion}, - {"BeginFrameUpdate", &hw3ds_driver.pfnBeginFrameUpdate}, - {"EndFrameUpdate", &hw3ds_driver.pfnEndFrameUpdate}, - {"IsPlaying", &hw3ds_driver.pfnIsPlaying}, - {"UpdateListener", &hw3ds_driver.pfnUpdateListener}, - {"UpdateSourceParms", &hw3ds_driver.pfnUpdateSourceParms}, - {"SetCone", &hw3ds_driver.pfnSetCone}, - {"SetGlobalSfxVolume", &hw3ds_driver.pfnSetGlobalSfxVolume}, - {"Update3DSource", &hw3ds_driver.pfnUpdate3DSource}, - {"ReloadSource", &hw3ds_driver.pfnReloadSource}, - {"KillSource", &hw3ds_driver.pfnKillSource}, - {"KillSfx", &hw3ds_driver.pfnKillSfx}, - {"GetHW3DSTitle", &hw3ds_driver.pfnGetHW3DSTitle}, -#endif - {NULL, NULL} -}; - -BOOL Init3DSDriver(LPCSTR dllName) -{ - hwsModule = LoadDLL(dllName, hwsFuncTable); - return (hwsModule != NULL); -} - -VOID Shutdown3DSDriver (VOID) -{ - UnloadDLL(&hwsModule); -} -#endif -#endif //_WINDOWS diff --git a/src/win32/win_dll.h b/src/win32/win_dll.h deleted file mode 100644 index b4b259587..000000000 --- a/src/win32/win_dll.h +++ /dev/null @@ -1,31 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// 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. -//----------------------------------------------------------------------------- -/// \file -/// \brief load/unload a DLL at run-time - -//#define WIN32_LEAN_AND_MEAN -#define RPC_NO_WINDOWS_H -#include - -#ifdef HWRENDER -BOOL Init3DDriver (LPCSTR dllName); -VOID Shutdown3DDriver (VOID); -#endif - -#ifdef HW3SOUND -BOOL Init3DSDriver(LPCSTR dllName); -VOID Shutdown3DSDriver(VOID); -#endif diff --git a/src/win32/win_main.c b/src/win32/win_main.c deleted file mode 100644 index a5ebf3211..000000000 --- a/src/win32/win_main.c +++ /dev/null @@ -1,674 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// 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. -//----------------------------------------------------------------------------- -/// \file -/// \brief Win32 WinMain Entry Point -/// -/// Win32 Sonic Robo Blast 2 -/// -/// NOTE: -/// To compile WINDOWS SRB2 version : define a '_WINDOWS' symbol. -/// to do this go to Project/Settings/ menu, click C/C++ tab, in -/// 'Preprocessor definitions:' add '_WINDOWS' - -#include "../doomdef.h" -#include - -#ifdef _WINDOWS - -#include "../doomstat.h" // netgame -#include "resource.h" - -#include "../m_argv.h" -#include "../d_main.h" -#include "../i_system.h" - -#include "../keys.h" //hack quick test - -#include "../console.h" - -#include "fabdxlib.h" -#include "win_main.h" -#include "win_dbg.h" -#include "../s_sound.h" // pause sound with handling -#include "../g_input.h" // KEY_MOUSEWHEELxxx -#include "../screen.h" // for BASEVID* - -// MSWheel support for Win95/NT3.51 -#include - -#ifndef WM_XBUTTONDOWN -#define WM_XBUTTONDOWN 523 -#endif -#ifndef WM_XBUTTONUP -#define WM_XBUTTONUP 524 -#endif -#ifndef MK_XBUTTON1 -#define MK_XBUTTON1 32 -#endif -#ifndef MK_XBUTTON2 -#define MK_XBUTTON2 64 -#endif - -typedef BOOL (WINAPI *p_IsDebuggerPresent)(VOID); - -HWND hWndMain = NULL; -static HCURSOR windowCursor = NULL; // main window cursor - -static LPCSTR wClassName = "SRB2WC"; - -INT appActive = false; // app window is active - -#ifdef LOGMESSAGES -FILE *logstream; -#endif - -BOOL nodinput = FALSE; - -static LRESULT CALLBACK MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - event_t ev; //Doom input event - int mouse_keys; - - // judgecutor: - // Response MSH Mouse Wheel event - - if (message == MSHWheelMessage) - { - message = WM_MOUSEWHEEL; - wParam <<= 16; - } - - //I_OutputMsg("MainWndproc: %p,%i,%i,%i",hWnd, message, wParam, (UINT)lParam); - - switch (message) - { - case WM_CREATE: - nodinput = M_CheckParm("-nodinput"); - if (!nodinput && !LoadDirectInput()) - nodinput = true; - break; - - case WM_ACTIVATEAPP: // Handle task switching - appActive = (int)wParam; - - //coming back from alt-tab? reset the palette. - if (appActive) - vid.recalc = true; - - // pause music when alt-tab - if (appActive && !paused) - S_ResumeAudio(); - else if (!paused) - S_PauseAudio(); - { - HANDLE ci = GetStdHandle(STD_INPUT_HANDLE); - DWORD mode; - if (ci != INVALID_HANDLE_VALUE && GetFileType(ci) == FILE_TYPE_CHAR && GetConsoleMode(ci, &mode)) - appActive = true; - } - InvalidateRect (hWnd, NULL, TRUE); - break; - - case WM_PAINT: - if (!appActive && !bAppFullScreen && !netgame) - // app becomes inactive (if windowed) - { - // Paint "Game Paused" in the middle of the screen - PAINTSTRUCT ps; - RECT rect; - HDC hdc = BeginPaint (hWnd, &ps); - GetClientRect (hWnd, &rect); - DrawText (hdc, TEXT("Game Paused"), -1, &rect, - DT_SINGLELINE | DT_CENTER | DT_VCENTER); - EndPaint (hWnd, &ps); - return 0; - } - - break; - - case WM_QUERYNEWPALETTE: - RestoreDDPalette(); - return TRUE; - - case WM_PALETTECHANGED: - if((HWND)wParam != hWnd) - RestoreDDPalette(); - break; - - //case WM_RBUTTONDOWN: - //case WM_LBUTTONDOWN: - - case WM_MOVE: - if (bAppFullScreen) - { - SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE); - return 0; - } - else - { - windowPosX = (SHORT) LOWORD(lParam); // horizontal position - windowPosY = (SHORT) HIWORD(lParam); // vertical position - break; - } - break; - - // This is where switching windowed/fullscreen is handled. DirectDraw - // objects must be destroyed, recreated, and artwork reloaded. - - case WM_DISPLAYCHANGE: - case WM_SIZE: - break; - - case WM_SETCURSOR: - if (bAppFullScreen) - SetCursor(NULL); - else - SetCursor(windowCursor); - return TRUE; - - case WM_KEYUP: - ev.type = ev_keyup; - goto handleKeyDoom; - break; - - case WM_KEYDOWN: - ev.type = ev_keydown; - - handleKeyDoom: - ev.key = 0; - if (wParam == VK_PAUSE) - // intercept PAUSE key - { - ev.key = KEY_PAUSE; - } - else if (!keyboard_started) - // post some keys during the game startup - // (allow escaping from network synchronization, or pressing enter after - // an error message in the console) - { - switch (wParam) - { - case VK_ESCAPE: ev.key = KEY_ESCAPE; break; - case VK_RETURN: ev.key = KEY_ENTER; break; - case VK_SHIFT: ev.key = KEY_LSHIFT; break; - default: ev.key = MapVirtualKey((DWORD)wParam,2); // convert in to char - } - } - - if (ev.key) - D_PostEvent (&ev); - - return 0; - break; - - // judgecutor: - // Handle mouse events - case WM_LBUTTONDOWN: - case WM_LBUTTONUP: - case WM_RBUTTONDOWN: - case WM_RBUTTONUP: - case WM_MBUTTONDOWN: - case WM_MBUTTONUP: - case WM_MOUSEMOVE: - if (nodinput) - { - mouse_keys = 0; - if (wParam & MK_LBUTTON) - mouse_keys |= 1; - if (wParam & MK_RBUTTON) - mouse_keys |= 2; - if (wParam & MK_MBUTTON) - mouse_keys |= 4; - I_GetSysMouseEvents(mouse_keys); - } - break; - - case WM_XBUTTONUP: - if (nodinput) - { - ev.type = ev_keyup; - ev.key = KEY_MOUSE1 + 3 + HIWORD(wParam); - D_PostEvent(&ev); - return TRUE; - } - break; - case WM_XBUTTONDOWN: - if (nodinput) - { - ev.type = ev_keydown; - ev.key = KEY_MOUSE1 + 3 + HIWORD(wParam); - D_PostEvent(&ev); - return TRUE; - } - break; - case WM_MOUSEWHEEL: - //I_OutputMsg("MW_WHEEL dispatched.\n"); - ev.type = ev_keydown; - if ((INT16)HIWORD(wParam) > 0) - ev.key = KEY_MOUSEWHEELUP; - else - ev.key = KEY_MOUSEWHEELDOWN; - D_PostEvent(&ev); - break; - - case WM_SETTEXT: - COM_BufAddText((LPCSTR)lParam); - return TRUE; - break; - - case WM_CLOSE: - PostQuitMessage(0); //to quit while in-game - ev.key = KEY_ESCAPE; //to exit network synchronization - ev.type = ev_keydown; - D_PostEvent (&ev); - return 0; - case WM_DESTROY: - //faB: main app loop will exit the loop and proceed with I_Quit() - PostQuitMessage(0); - break; - - case WM_SYSCOMMAND: - // Don't allow the keyboard to activate the menu. - if(wParam == SC_KEYMENU) - return 0; - - break; - - default: - break; - } - - return DefWindowProc(hWnd, message, wParam, lParam); -} - -static inline VOID OpenTextConsole(VOID) -{ - HANDLE ci, co; - BOOL console; - -#ifdef _DEBUG - console = M_CheckParm("-noconsole") == 0; -#else - console = M_CheckParm("-console") != 0; -#endif - - dedicated = M_CheckParm("-dedicated") != 0; - - if (M_CheckParm("-detachconsole")) - { - if (FreeConsole()) - { - I_OutputMsg("Detatched console.\n"); - console = TRUE; //lets get back a console - } - else - { - I_OutputMsg("No console to detatch.\n"); - I_ShowLastError(FALSE); - } - } - - if (dedicated || console) - { - if (AllocConsole()) //Let get the real console HANDLEs, because Mingw's Bash is bad! - { - SetConsoleTitleA("SRB2 Console"); - CONS_Printf(M_GetText("Hello, it's me, SRB2's Console Window\n")); - } - else - { - I_OutputMsg("We have a console already.\n"); - I_ShowLastError(FALSE); - return; - } - } - else - return; - - ci = CreateFile(TEXT("CONIN$") , GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (ci != INVALID_HANDLE_VALUE) - { - HANDLE sih = GetStdHandle(STD_INPUT_HANDLE); - if (sih != ci) - { - I_OutputMsg("Old STD_INPUT_HANDLE: %p\nNew STD_INPUT_HANDLE: %p\n", sih, ci); - SetStdHandle(STD_INPUT_HANDLE,ci); - } - else - I_OutputMsg("STD_INPUT_HANDLE already set at %p\n", ci); - - if (GetFileType(ci) == FILE_TYPE_CHAR) - { -#if 0 - const DWORD CM = ENABLE_LINE_INPUT|ENABLE_ECHO_INPUT|ENABLE_PROCESSED_INPUT; //default mode but no ENABLE_MOUSE_INPUT - if (SetConsoleMode(ci,CM)) - { - I_OutputMsg("Disabled mouse input on the console\n"); - } - else - { - I_OutputMsg("Could not disable mouse input on the console\n"); - I_ShowLastError(FALSE); - } -#endif - } - else - I_OutputMsg("Handle CONIN$ in not a Console HANDLE\n"); - } - else - { - I_OutputMsg("Could not get a CONIN$ HANDLE\n"); - I_ShowLastError(FALSE); - } - - co = CreateFile(TEXT("CONOUT$"), GENERIC_WRITE|GENERIC_READ, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (co != INVALID_HANDLE_VALUE) - { - HANDLE soh = GetStdHandle(STD_OUTPUT_HANDLE); - HANDLE seh = GetStdHandle(STD_ERROR_HANDLE); - if (soh != co) - { - I_OutputMsg("Old STD_OUTPUT_HANDLE: %p\nNew STD_OUTPUT_HANDLE: %p\n", soh, co); - SetStdHandle(STD_OUTPUT_HANDLE,co); - } - else - I_OutputMsg("STD_OUTPUT_HANDLE already set at %p\n", co); - if (seh != co) - { - I_OutputMsg("Old STD_ERROR_HANDLE: %p\nNew STD_ERROR_HANDLE: %p\n", seh, co); - SetStdHandle(STD_ERROR_HANDLE,co); - } - else - I_OutputMsg("STD_ERROR_HANDLE already set at %p\n", co); - } - else - I_OutputMsg("Could not get a CONOUT$ HANDLE\n"); -} - - -// -// Do that Windows initialization stuff... -// -static HWND OpenMainWindow (HINSTANCE hInstance, LPSTR wTitle) -{ - const LONG styles = WS_CAPTION|WS_POPUP|WS_SYSMENU, exstyles = 0; - HWND hWnd; - WNDCLASSEXA wc; - RECT bounds; - - // Set up and register window class - ZeroMemory(&wc, sizeof(wc)); - wc.cbSize = sizeof(wc); - wc.style = CS_HREDRAW | CS_VREDRAW /*| CS_DBLCLKS*/; - wc.lpfnWndProc = MainWndproc; - wc.hInstance = hInstance; - wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DLICON1)); - windowCursor = LoadCursor(NULL, IDC_WAIT); //LoadCursor(hInstance, MAKEINTRESOURCE(IDC_DLCURSOR1)); - wc.hCursor = windowCursor; - wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); - wc.lpszClassName = wClassName; - - if (!RegisterClassExA(&wc)) - { - I_OutputMsg("Error doing RegisterClassExA\n"); - I_ShowLastError(TRUE); - return INVALID_HANDLE_VALUE; - } - - // Create a window - // CreateWindowEx - seems to create just the interior, not the borders - - bounds.left = 0; - bounds.right = dedicated ? 0 : specialmodes[0].width; - bounds.top = 0; - bounds.bottom = dedicated ? 0 : specialmodes[0].height; - - AdjustWindowRectEx(&bounds, styles, FALSE, exstyles); - - hWnd = CreateWindowExA( - exstyles, //ExStyle - wClassName, //Classname - wTitle, //Windowname - styles, //dwStyle //WS_VISIBLE|WS_POPUP for bAppFullScreen - 0, - 0, - bounds.right - bounds.left, //GetSystemMetrics(SM_CXSCREEN), - bounds.bottom - bounds.top, //GetSystemMetrics(SM_CYSCREEN), - NULL, //hWnd Parent - NULL, //hMenu Menu - hInstance, - NULL); - - if (hWnd == INVALID_HANDLE_VALUE) - { - I_OutputMsg("Error doing CreateWindowExA\n"); - I_ShowLastError(TRUE); - } - - return hWnd; -} - - -static inline BOOL tlErrorMessage(const TCHAR *err) -{ - /* make the cursor visible */ - SetCursor(LoadCursor(NULL, IDC_ARROW)); - - // - // warn user if there is one - // - printf("Error %s..\n", err); - fflush(stdout); - - MessageBox(hWndMain, err, TEXT("ERROR"), MB_OK); - return FALSE; -} - - -// ------------------ -// Command line stuff -// ------------------ -#define MAXCMDLINEARGS 64 -static char * myWargv[MAXCMDLINEARGS+1]; -static char myCmdline[512]; - -static VOID GetArgcArgv (LPSTR cmdline) -{ - LPSTR tokenstr; - size_t i = 0, len; - char cSep = ' '; - BOOL bCvar = FALSE, prevCvar = FALSE; - - // split arguments of command line into argv - strlcpy (myCmdline, cmdline, sizeof(myCmdline)); // in case window's cmdline is in protected memory..for strtok - len = strlen (myCmdline); - - myargc = 0; - while (myargc < MAXCMDLINEARGS) - { - // get token - while (myCmdline[i] == cSep) - i++; - if (i >= len) - break; - tokenstr = myCmdline + i; - if (myCmdline[i] == '"') - { - cSep = '"'; - i++; - if (!prevCvar) //cvar leave the "" in - tokenstr++; - } - else - cSep = ' '; - - //cvar - if (myCmdline[i] == '+' && cSep == ' ') //a + begins a cvarname, but not after quotes - bCvar = TRUE; - else - bCvar = FALSE; - - while (myCmdline[i] && - myCmdline[i] != cSep) - i++; - - if (myCmdline[i] == '"') - { - cSep = ' '; - if (prevCvar) - i++; // get ending " quote in arg - } - - prevCvar = bCvar; - - if (myCmdline + i > tokenstr) - { - myWargv[myargc++] = tokenstr; - } - - if (!myCmdline[i] || i >= len) - break; - - myCmdline[i++] = '\0'; - } - myWargv[myargc] = NULL; - - // m_argv.c uses myargv[], we used myWargv because we fill the arguments ourselves - // and myargv is just a pointer, so we set it to point myWargv - myargv = myWargv; -} - -static inline VOID MakeCodeWritable(VOID) -{ -#ifdef USEASM // Disable write-protection of code segment - DWORD OldRights; - const DWORD NewRights = PAGE_EXECUTE_READWRITE; - PBYTE pBaseOfImage = (PBYTE)GetModuleHandle(NULL); - PIMAGE_DOS_HEADER dosH =(PIMAGE_DOS_HEADER)pBaseOfImage; - PIMAGE_NT_HEADERS ntH = (PIMAGE_NT_HEADERS)(pBaseOfImage + dosH->e_lfanew); - PIMAGE_OPTIONAL_HEADER oH = (PIMAGE_OPTIONAL_HEADER) - ((PBYTE)ntH + sizeof (IMAGE_NT_SIGNATURE) + sizeof (IMAGE_FILE_HEADER)); - LPVOID pA = pBaseOfImage+oH->BaseOfCode; - SIZE_T pS = oH->SizeOfCode; -#if 1 // try to find the text section - PIMAGE_SECTION_HEADER ntS = IMAGE_FIRST_SECTION (ntH); - WORD s; - for (s = 0; s < ntH->FileHeader.NumberOfSections; s++) - { - if (memcmp (ntS[s].Name, ".text\0\0", 8) == 0) - { - pA = pBaseOfImage+ntS[s].VirtualAddress; - pS = ntS[s].Misc.VirtualSize; - break; - } - } -#endif - - if (!VirtualProtect(pA,pS,NewRights,&OldRights)) - I_Error("Could not make code writable\n"); -#endif -} - -// ----------------------------------------------------------------------------- -// HandledWinMain : called by exception handler -// ----------------------------------------------------------------------------- -static int WINAPI HandledWinMain(HINSTANCE hInstance) -{ - LPSTR args; - -#ifdef LOGMESSAGES - // DEBUG!!! - set logstream to NULL to disable debug log - // Replace WIN32 filehandle with standard C calls, because WIN32 doesn't handle \n properly. - logstream = fopen(va("%s"PATHSEP"%s", srb2home, "log.txt"), "wt"); -#endif - - // fill myargc,myargv for m_argv.c retrieval of cmdline arguments - args = GetCommandLineA(); - CONS_Printf("Command line arguments: '%s'\n", args); - GetArgcArgv(args); - // Create a text console window - OpenTextConsole(); - -#ifdef _DEBUG - { - int i; - CONS_Printf("Myargc: %d\n", myargc); - for (i = 0; i < myargc; i++) - CONS_Printf("myargv[%d] : '%s'\n", i, myargv[i]); - } -#endif - - // open a dummy window, both OpenGL and DirectX need one. - if ((hWndMain = OpenMainWindow(hInstance, va("SRB2 "VERSIONSTRING))) == INVALID_HANDLE_VALUE) - { - tlErrorMessage(TEXT("Couldn't open window")); - return FALSE; - } - - // currently starts DirectInput - CONS_Printf("I_StartupSystem() ...\n"); - I_StartupSystem(); - MakeCodeWritable(); - - // startup SRB2 - CONS_Printf("Setting up SRB2...\n"); - D_SRB2Main(); - CONS_Printf("Entering main game loop...\n"); - // never return - D_SRB2Loop(); - - // back to Windoze - return 0; -} - -// ----------------------------------------------------------------------------- -// Exception handler calls WinMain for catching exceptions -// ----------------------------------------------------------------------------- -int WINAPI WinMain (HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow) -{ - int Result = -1; - UNREFERENCED_PARAMETER(hPrevInstance); - UNREFERENCED_PARAMETER(lpCmdLine); - UNREFERENCED_PARAMETER(nCmdShow); - - { -#if 0 - p_IsDebuggerPresent pfnIsDebuggerPresent = (p_IsDebuggerPresent)GetProcAddress(GetModuleHandleA("kernel32.dll"),"IsDebuggerPresent"); - if((!pfnIsDebuggerPresent || !pfnIsDebuggerPresent()) -#ifdef BUGTRAP - && !InitBugTrap() -#endif - ) -#endif - { - LoadLibraryA("exchndl.dll"); - } - } -#ifndef __MINGW32__ - prevExceptionFilter = SetUnhandledExceptionFilter(RecordExceptionInfo); -#endif - Result = HandledWinMain(hInstance); -#ifdef BUGTRAP - // This is safe even if BT didn't start. - ShutdownBugTrap(); -#endif - - return Result; -} -#endif //_WINDOWS diff --git a/src/win32/win_main.h b/src/win32/win_main.h deleted file mode 100644 index 326a813dd..000000000 --- a/src/win32/win_main.h +++ /dev/null @@ -1,45 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// 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. -//----------------------------------------------------------------------------- -/// \file -/// \brief Win32 Sharing - -//#define WIN32_LEAN_AND_MEAN -#define RPC_NO_WINDOWS_H -#include -#include - -extern HWND hWndMain; - -extern INT appActive; - -VOID I_GetSysMouseEvents(INT mouse_state); -extern UINT MSHWheelMessage; - -extern BOOL nodinput; -BOOL LoadDirectInput(VOID); - -//faB: midi channel Volume set is delayed by the MIDI stream callback thread, see win_snd.c -#define WM_MSTREAM_UPDATEVOLUME (WM_USER + 101) - -// defined in win_sys.c -VOID I_BeginProfile(VOID); //for timing code -DWORD I_EndProfile(VOID); - -VOID I_ShowLastError(BOOL MB); -VOID I_LoadingScreen (LPCSTR msg); - -VOID I_RestartSysMouse(VOID); -VOID I_DoStartupMouse(VOID); diff --git a/src/win32/win_net.c b/src/win32/win_net.c deleted file mode 100644 index 62c081bbe..000000000 --- a/src/win32/win_net.c +++ /dev/null @@ -1,42 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// 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. -//----------------------------------------------------------------------------- -/// \file -/// \brief Win32 network interface - -#include "../doomdef.h" -#include "../m_argv.h" -#include "../i_net.h" - -#ifdef _WINDOWS - -// -// NETWORKING -// - -// -// I_InitNetwork -// -boolean I_InitNetwork(void) -{ - if (M_CheckParm ("-net")) - { - I_Error("The Win32 version of SRB2 doesn't work with external drivers like ipxsetup, sersetup, or doomatic\n" - "Read the documentation about \"-server\" and \"-connect\" parameters or just use the launcher\n"); - } - - return false; -} -#endif diff --git a/src/win32/win_snd.c b/src/win32/win_snd.c deleted file mode 100644 index 13f766728..000000000 --- a/src/win32/win_snd.c +++ /dev/null @@ -1,959 +0,0 @@ -/// \file -/// \brief FMOD Ex interface for sound -#include "../doomdef.h" -#include "../sounds.h" -#include "../i_sound.h" -#include "../s_sound.h" -#include "../w_wad.h" -#include "../z_zone.h" -#include "../byteptr.h" - -#include // FMOD Ex -#define errcode _errcode -#include -#undef errcode - -#ifdef HAVE_LIBGME -#include "gme/gme.h" -#define GME_TREBLE 5.0 -#define GME_BASS 1.0 - -#ifdef HAVE_ZLIB -#ifndef _MSC_VER -#ifndef _LARGEFILE64_SOURCE -#define _LARGEFILE64_SOURCE -#endif -#endif - -#ifndef _LFS64_LARGEFILE -#define _LFS64_LARGEFILE -#endif - -#ifndef _FILE_OFFSET_BITS -#define _FILE_OFFSET_BITS 0 -#endif - -#include "zlib.h" -#endif // HAVE_ZLIB -#endif // HAVE_LIBGME - -static FMOD_SYSTEM *fsys; -static FMOD_SOUND *music_stream; -static FMOD_CHANNEL *music_channel; - -static UINT8 music_volume, midi_volume, sfx_volume; -static INT32 current_track; - -#ifdef HAVE_LIBGME -static Music_Emu *gme; -#endif - -// -// SYSTEM -// - -// spew console messages for general errors. -static void FMR_Debug(FMOD_RESULT e, int line) -{ - if (e != FMOD_OK) - CONS_Alert(CONS_ERROR, "FMOD:%d - %s\n", line, FMOD_ErrorString(e)); -} -#define FMR(x) FMR_Debug(x, __LINE__) - -// for operations on music_channel ONLY. -// returns false if music was released. -// (in other words, if !FMR_MUSIC(op) return immediately, -// because music_stream and music_channel are no longer valid.) -static boolean FMR_Music_Debug(FMOD_RESULT e, int line) -{ - switch(e) - { - case FMOD_ERR_INVALID_HANDLE: // non-looping song ended - case FMOD_ERR_CHANNEL_STOLEN: // song ended and then sfx was played - FMOD_Sound_Release(music_stream); - music_stream = NULL; - return false; - default: - FMR_Debug(e, line); - break; - } - return true; -} -#define FMR_MUSIC(x) FMR_Music_Debug(x, __LINE__) - -void I_StartupSound(void) -{ - I_Assert(!sound_started); - sound_started = true; - - FMR(FMOD_System_Create(&fsys)); - FMR(FMOD_System_SetDSPBufferSize(fsys, 44100 / 30, 2)); - FMR(FMOD_System_Init(fsys, 64, FMOD_INIT_VOL0_BECOMES_VIRTUAL, NULL)); - music_stream = NULL; -#ifdef HAVE_LIBGME - gme = NULL; -#endif - current_track = -1; -} - -void I_ShutdownSound(void) -{ - I_Assert(sound_started); - sound_started = false; - -#ifdef HAVE_LIBGME - if (gme) - gme_delete(gme); -#endif - FMR(FMOD_System_Release(fsys)); -} - -void I_UpdateSound(void) -{ - FMR(FMOD_System_Update(fsys)); -} - -#ifdef HAVE_LIBGME -// Callback hook to read streaming GME data. -static FMOD_RESULT F_CALLBACK GMEReadCallback(FMOD_SOUND *sound, void *data, unsigned int datalen) -{ - Music_Emu *emu; - void *emuvoid = NULL; - // get our emu - FMR(FMOD_Sound_GetUserData(sound, &emuvoid)); - emu = emuvoid; - // no emu? no play. - if (!emu) - return FMOD_ERR_FILE_EOF; - if (gme_track_ended(emu)) - { - // don't delete the primary music stream - if (emu == gme) - return FMOD_ERR_FILE_EOF; - // do delete sfx streams - FMR(FMOD_Sound_SetUserData(sound, NULL)); - gme_delete(emu); - return FMOD_ERR_FILE_EOF; - } - // play beautiful musics theme of ancient land. - if (gme_play(emu, datalen/2, data)) - return FMOD_ERR_FILE_BAD; - // O.K - return FMOD_OK; -} -#endif - -// -// SFX -// - -// convert doom format sound (signed 8bit) -// to an fmod format sound (unsigned 8bit) -// and return the FMOD_SOUND. -static inline FMOD_SOUND *ds2fmod(char *stream) -{ - FMOD_SOUND *sound; - UINT16 ver; - UINT16 freq; - UINT32 samples; - FMOD_CREATESOUNDEXINFO fmt; - UINT32 i; - UINT8 *p; - - // lump header - ver = READUINT16(stream); // sound version format? - if (ver != 3) // It should be 3 if it's a doomsound... - return NULL; // onos! it's not a doomsound! - freq = READUINT16(stream); - samples = READUINT32(stream); - //CONS_Printf("FMT: v%d f%d, s%d, b%d\n", ver, freq, samples, bps); - - memset(&fmt, 0, sizeof(FMOD_CREATESOUNDEXINFO)); - fmt.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); - - // convert to unsigned - fmt.format = FMOD_SOUND_FORMAT_PCM8; // 8bit - fmt.length = samples*1; // 1 bps - fmt.numchannels = 1; // mono - fmt.defaultfrequency = freq; - - // Make a duplicate of the stream to change format. - p = Z_Malloc(fmt.length, PU_SOUND, NULL); - for (i = 0; i < fmt.length; i++) - p[i] = (UINT8)(stream[i]+0x80); // convert from signed to unsigned - stream = (char *)p; - - // Create FMOD_SOUND. - FMR(FMOD_System_CreateSound(fsys, stream, FMOD_CREATESAMPLE|FMOD_OPENMEMORY|FMOD_OPENRAW|FMOD_SOFTWARE|FMOD_LOWMEM, &fmt, &sound)); - - Z_Free(stream); // FMOD made its own copy, so we don't need this anymore. - return sound; -} - -void *I_GetSfx(sfxinfo_t *sfx) -{ - FMOD_SOUND *sound; - char *lump; - FMOD_CREATESOUNDEXINFO fmt; -#ifdef HAVE_LIBGME - Music_Emu *emu; - gme_info_t *info; -#endif - - if (sfx->lumpnum == LUMPERROR) - sfx->lumpnum = S_GetSfxLumpNum(sfx); - sfx->length = W_LumpLength(sfx->lumpnum); - - lump = W_CacheLumpNum(sfx->lumpnum, PU_SOUND); - sound = ds2fmod(lump); - if (sound) - { - Z_Free(lump); - return sound; - } - - // It's not a doom sound. - // Try to read it as an FMOD sound? - - memset(&fmt, 0, sizeof(FMOD_CREATESOUNDEXINFO)); - fmt.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); - fmt.length = sfx->length; - -#ifdef HAVE_LIBGME - // VGZ format - if ((UINT8)lump[0] == 0x1F - && (UINT8)lump[1] == 0x8B) - { -#ifdef HAVE_ZLIB - UINT8 *inflatedData; - size_t inflatedLen; - z_stream stream; - int zErr; // Somewhere to handle any error messages zlib tosses out - - memset(&stream, 0x00, sizeof (z_stream)); // Init zlib stream - // Begin the inflation process - inflatedLen = *(UINT32 *)(lump + (sfx->length-4)); // Last 4 bytes are the decompressed size, typically - inflatedData = (UINT8 *)Z_Malloc(inflatedLen, PU_SOUND, NULL); // Make room for the decompressed data - stream.total_in = stream.avail_in = sfx->length; - stream.total_out = stream.avail_out = inflatedLen; - stream.next_in = (UINT8 *)lump; - stream.next_out = inflatedData; - - zErr = inflateInit2(&stream, 32 + MAX_WBITS); - if (zErr == Z_OK) // We're good to go - { - zErr = inflate(&stream, Z_FINISH); - if (zErr == Z_STREAM_END) { - // Run GME on new data - if (!gme_open_data(inflatedData, inflatedLen, &emu, 44100)) - { - Z_Free(inflatedData); // GME supposedly makes a copy for itself, so we don't need this lying around - Z_Free(lump); // We're done with the uninflated lump now, too. - - gme_start_track(emu, 0); - gme_track_info(emu, &info, 0); - - fmt.format = FMOD_SOUND_FORMAT_PCM16; - fmt.defaultfrequency = 44100; - fmt.numchannels = 2; - fmt.length = ((UINT32)info->play_length * 441 / 10) * 4; - fmt.decodebuffersize = (44100 * 2) / 35; - fmt.pcmreadcallback = GMEReadCallback; - fmt.userdata = emu; - - FMR(FMOD_System_CreateSound(fsys, NULL, FMOD_CREATESAMPLE|FMOD_OPENUSER|FMOD_SOFTWARE|FMOD_LOWMEM, &fmt, &sound)); - return sound; - } - } - else - { - const char *errorType; - switch (zErr) - { - case Z_ERRNO: - errorType = "Z_ERRNO"; break; - case Z_STREAM_ERROR: - errorType = "Z_STREAM_ERROR"; break; - case Z_DATA_ERROR: - errorType = "Z_DATA_ERROR"; break; - case Z_MEM_ERROR: - errorType = "Z_MEM_ERROR"; break; - case Z_BUF_ERROR: - errorType = "Z_BUF_ERROR"; break; - case Z_VERSION_ERROR: - errorType = "Z_VERSION_ERROR"; break; - default: - errorType = "unknown error"; - } - CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", errorType, stream.msg); - } - (void)inflateEnd(&stream); - } - else // Hold up, zlib's got a problem - { - const char *errorType; - switch (zErr) - { - case Z_ERRNO: - errorType = "Z_ERRNO"; break; - case Z_STREAM_ERROR: - errorType = "Z_STREAM_ERROR"; break; - case Z_DATA_ERROR: - errorType = "Z_DATA_ERROR"; break; - case Z_MEM_ERROR: - errorType = "Z_MEM_ERROR"; break; - case Z_BUF_ERROR: - errorType = "Z_BUF_ERROR"; break; - case Z_VERSION_ERROR: - errorType = "Z_VERSION_ERROR"; break; - default: - errorType = "unknown error"; - } - CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", errorType, stream.msg); - } - Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up -#else - //CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n"); -#endif - } - // Try to read it as a GME sound - else if (!gme_open_data(lump, sfx->length, &emu, 44100)) - { - Z_Free(lump); - - gme_start_track(emu, 0); - gme_track_info(emu, &info, 0); - - fmt.format = FMOD_SOUND_FORMAT_PCM16; - fmt.defaultfrequency = 44100; - fmt.numchannels = 2; - fmt.length = ((UINT32)info->play_length * 441 / 10) * 4; - fmt.decodebuffersize = (44100 * 2) / 35; - fmt.pcmreadcallback = GMEReadCallback; - fmt.userdata = emu; - - gme_free_info(info); - - FMR(FMOD_System_CreateSound(fsys, NULL, FMOD_CREATESAMPLE|FMOD_OPENUSER|FMOD_SOFTWARE|FMOD_LOWMEM, &fmt, &sound)); - return sound; - } -#endif - - // Ogg, Mod, Midi, etc. - FMR(FMOD_System_CreateSound(fsys, lump, FMOD_CREATESAMPLE|FMOD_OPENMEMORY|FMOD_SOFTWARE|FMOD_LOWMEM, &fmt, &sound)); - Z_Free(lump); // We're done with the lump now, at least. - return sound; -} - -void I_FreeSfx(sfxinfo_t *sfx) -{ - if (sfx->data) - FMOD_Sound_Release(sfx->data); - sfx->data = NULL; -} - -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) -{ - FMOD_SOUND *sound; - FMOD_CHANNEL *chan; - INT32 i; - float frequency; - (void)channel; - - sound = (FMOD_SOUND *)S_sfx[id].data; - I_Assert(sound != NULL); - - FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, sound, true, &chan)); - - if (sep == 0) - sep = 1; - - FMR(FMOD_Channel_SetVolume(chan, (vol / 255.0) * (sfx_volume / 31.0))); - FMR(FMOD_Channel_SetPan(chan, (sep - 128) / 127.0)); - - FMR(FMOD_Sound_GetDefaults(sound, &frequency, NULL, NULL, NULL)); - FMR(FMOD_Channel_SetFrequency(chan, (pitch / 128.0) * frequency)); - - FMR(FMOD_Channel_SetPriority(chan, priority)); - //UNREFERENCED_PARAMETER(priority); - //FMR(FMOD_Channel_SetPriority(chan, 1 + ((0xff-vol)>>1))); // automatic priority 1 - 128 based on volume (priority 0 is music) - - FMR(FMOD_Channel_GetIndex(chan, &i)); - FMR(FMOD_Channel_SetPaused(chan, false)); - return i; -} - -void I_StopSound(INT32 handle) -{ - FMOD_CHANNEL *chan; - FMR(FMOD_System_GetChannel(fsys, handle, &chan)); - if (music_stream && chan == music_channel) - return; - FMR(FMOD_Channel_Stop(chan)); -} - -boolean I_SoundIsPlaying(INT32 handle) -{ - FMOD_CHANNEL *chan; - FMOD_BOOL playing; - FMOD_RESULT e; - FMR(FMOD_System_GetChannel(fsys, handle, &chan)); - if (music_stream && chan == music_channel) - return false; - e = FMOD_Channel_IsPlaying(chan, &playing); - switch(e) - { - case FMOD_ERR_INVALID_HANDLE: // Sound effect finished. - case FMOD_ERR_CHANNEL_STOLEN: // Sound effect interrupted. -- technically impossible due to GetChannel by handle. :( - return false; // therefore, it's not playing anymore. - default: - FMR(e); - break; - } - return (boolean)playing; -} - -// seems to never be called on an invalid channel (calls I_SoundIsPlaying first?) -// so I'm not gonna worry about it. -void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch) -{ - FMOD_CHANNEL *chan; - FMOD_SOUND *sound; - float frequency; - - FMR(FMOD_System_GetChannel(fsys, handle, &chan)); - FMR(FMOD_Channel_SetVolume(chan, (vol / 255.0) * (sfx_volume / 31.0))); - FMR(FMOD_Channel_SetPan(chan, (sep - 128) / 127.0)); - - FMR(FMOD_Channel_GetCurrentSound(chan, &sound)); - FMR(FMOD_Sound_GetDefaults(sound, &frequency, NULL, NULL, NULL)); - FMR(FMOD_Channel_SetFrequency(chan, (pitch / 128.0) * frequency)); - - //FMR(FMOD_Channel_SetPriority(chan, 1 + ((0xff-vol)>>1))); // automatic priority 1 - 128 based on volume (priority 0 is music) -} - -void I_SetSfxVolume(UINT8 volume) -{ - // volume is 0 to 31. - sfx_volume = volume; -} - -/// ------------------------ -// MUSIC SYSTEM -/// ------------------------ - -void I_InitMusic(void) -{ -} - -void I_ShutdownMusic(void) -{ - I_StopSong(); -} - -/// ------------------------ -// MUSIC PROPERTIES -/// ------------------------ - -musictype_t I_SongType(void) -{ - FMOD_SOUND_TYPE type; - -#ifdef HAVE_LIBGME - if (gme) - return MU_GME; -#endif - - if (!music_stream) - return MU_NONE; - - if (FMOD_Sound_GetFormat(music_stream, &type, NULL, NULL, NULL) == FMOD_OK) - { - switch(type) - { - case FMOD_SOUND_TYPE_WAV: - return MU_WAV; - case FMOD_SOUND_TYPE_MOD: - return MU_MOD; - case FMOD_SOUND_TYPE_MIDI: - return MU_MID; - case FMOD_SOUND_TYPE_OGGVORBIS: - return MU_OGG; - case FMOD_SOUND_TYPE_MPEG: - return MU_MP3; - case FMOD_SOUND_TYPE_FLAC: - return MU_FLAC; - default: - return MU_NONE; - } - } - else - return MU_NONE; -} - -boolean I_SongPlaying(void) -{ - return (music_stream != NULL); -} - -boolean I_SongPaused(void) -{ - FMOD_BOOL fmpaused = false; - if (music_stream) - FMOD_Channel_GetPaused(music_channel, &fmpaused); - return (boolean)fmpaused; -} - -/// ------------------------ -// MUSIC EFFECTS -/// ------------------------ - -boolean I_SetSongSpeed(float speed) -{ - FMOD_RESULT e; - float frequency; - if (!music_stream) - return false; - if (speed > 250.0f) - speed = 250.0f; //limit speed up to 250x - -#ifdef HAVE_LIBGME - // Try to set GME speed - if (gme) - { - gme_set_tempo(gme, speed); - return true; - } -#endif - - // Try to set Mod/Midi speed - e = FMOD_Sound_SetMusicSpeed(music_stream, speed); - - if (e == FMOD_ERR_FORMAT) - { - // Just change pitch instead for Ogg/etc. - FMR(FMOD_Sound_GetDefaults(music_stream, &frequency, NULL, NULL, NULL)); - FMR_MUSIC(FMOD_Channel_SetFrequency(music_channel, speed*frequency)); - } - else - FMR_MUSIC(e); - - return true; -} - -/// ------------------------ -// MUSIC PLAYBACK -/// ------------------------ - -boolean I_LoadSong(char *data, size_t len) -{ - FMOD_CREATESOUNDEXINFO fmt; - FMOD_RESULT e; - FMOD_TAG tag; - unsigned int loopstart, loopend; - - if ( -#ifdef HAVE_LIBGME - gme || -#endif - music_stream - ) - I_UnloadSong(); - - memset(&fmt, 0, sizeof(FMOD_CREATESOUNDEXINFO)); - fmt.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); - -#ifdef HAVE_LIBGME - if ((UINT8)data[0] == 0x1F - && (UINT8)data[1] == 0x8B) - { -#ifdef HAVE_ZLIB - UINT8 *inflatedData; - size_t inflatedLen; - z_stream stream; - int zErr; // Somewhere to handle any error messages zlib tosses out - - memset(&stream, 0x00, sizeof (z_stream)); // Init zlib stream - // Begin the inflation process - inflatedLen = *(UINT32 *)(data + (len-4)); // Last 4 bytes are the decompressed size, typically - inflatedData = (UINT8 *)Z_Calloc(inflatedLen, PU_MUSIC, NULL); // Make room for the decompressed data - stream.total_in = stream.avail_in = len; - stream.total_out = stream.avail_out = inflatedLen; - stream.next_in = (UINT8 *)data; - stream.next_out = inflatedData; - - zErr = inflateInit2(&stream, 32 + MAX_WBITS); - if (zErr == Z_OK) // We're good to go - { - zErr = inflate(&stream, Z_FINISH); - if (zErr == Z_STREAM_END) { - // Run GME on new data - if (!gme_open_data(inflatedData, inflatedLen, &gme, 44100)) - { - gme_equalizer_t gmeq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0}; - Z_Free(inflatedData); // GME supposedly makes a copy for itself, so we don't need this lying around - Z_Free(data); // We don't need this, either. - gme_set_equalizer(gme,&gmeq); - fmt.format = FMOD_SOUND_FORMAT_PCM16; - fmt.defaultfrequency = 44100; - fmt.numchannels = 2; - fmt.length = -1; - fmt.decodebuffersize = (44100 * 2) / 35; - fmt.pcmreadcallback = GMEReadCallback; - fmt.userdata = gme; - FMR(FMOD_System_CreateStream(fsys, NULL, FMOD_OPENUSER, &fmt, &music_stream)); - return true; - } - } - else - { - const char *errorType; - switch (zErr) - { - case Z_ERRNO: - errorType = "Z_ERRNO"; break; - case Z_STREAM_ERROR: - errorType = "Z_STREAM_ERROR"; break; - case Z_DATA_ERROR: - errorType = "Z_DATA_ERROR"; break; - case Z_MEM_ERROR: - errorType = "Z_MEM_ERROR"; break; - case Z_BUF_ERROR: - errorType = "Z_BUF_ERROR"; break; - case Z_VERSION_ERROR: - errorType = "Z_VERSION_ERROR"; break; - default: - errorType = "unknown error"; - } - CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", errorType, stream.msg); - } - (void)inflateEnd(&stream); - } - else // Hold up, zlib's got a problem - { - const char *errorType; - switch (zErr) - { - case Z_ERRNO: - errorType = "Z_ERRNO"; break; - case Z_STREAM_ERROR: - errorType = "Z_STREAM_ERROR"; break; - case Z_DATA_ERROR: - errorType = "Z_DATA_ERROR"; break; - case Z_MEM_ERROR: - errorType = "Z_MEM_ERROR"; break; - case Z_BUF_ERROR: - errorType = "Z_BUF_ERROR"; break; - case Z_VERSION_ERROR: - errorType = "Z_VERSION_ERROR"; break; - default: - errorType = "unknown error"; - } - CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", errorType, stream.msg); - } - Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up -#else - //CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n"); -#endif - } - else if (!gme_open_data(data, len, &gme, 44100)) - { - gme_equalizer_t gmeq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0}; - Z_Free(data); // We don't need this anymore. - gme_set_equalizer(gme,&gmeq); - fmt.format = FMOD_SOUND_FORMAT_PCM16; - fmt.defaultfrequency = 44100; - fmt.numchannels = 2; - fmt.length = -1; - fmt.decodebuffersize = (44100 * 2) / 35; - fmt.pcmreadcallback = GMEReadCallback; - fmt.userdata = gme; - FMR(FMOD_System_CreateStream(fsys, NULL, FMOD_OPENUSER, &fmt, &music_stream)); - return true; - } -#endif - - fmt.length = len; - - e = FMOD_System_CreateStream(fsys, data, FMOD_OPENMEMORY_POINT, &fmt, &music_stream); - if (e != FMOD_OK) - { - if (e == FMOD_ERR_FORMAT) - CONS_Alert(CONS_WARNING, "Failed to play music lump due to invalid format.\n"); - else - FMR(e); - return false; - } - - // Try to find a loop point in streaming music formats (ogg, mp3) - - // A proper LOOPPOINT is its own tag, stupid. - e = FMOD_Sound_GetTag(music_stream, "LOOPPOINT", 0, &tag); - if (e != FMOD_ERR_TAGNOTFOUND) - { - FMR(e); - loopstart = atoi((char *)tag.data); // assumed to be a string data tag. - FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_PCM, &loopend, FMOD_TIMEUNIT_PCM)); - if (loopstart > 0) - FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_PCM, loopend, FMOD_TIMEUNIT_PCM)); - return true; - } - - // Use LOOPMS for time in miliseconds. - e = FMOD_Sound_GetTag(music_stream, "LOOPMS", 0, &tag); - if (e != FMOD_ERR_TAGNOTFOUND) - { - FMR(e); - loopstart = atoi((char *)tag.data); // assumed to be a string data tag. - FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_MS, &loopend, FMOD_TIMEUNIT_PCM)); - if (loopstart > 0) - FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_MS, loopend, FMOD_TIMEUNIT_PCM)); - return true; - } - - // Try to fetch it from the COMMENT tag, like A.J. Freda - e = FMOD_Sound_GetTag(music_stream, "COMMENT", 0, &tag); - if (e != FMOD_ERR_TAGNOTFOUND) - { - char *loopText; - // Handle any errors that arose, first - FMR(e); - // Figure out where the number starts - loopText = strstr((char *)tag.data,"LOOPPOINT="); - if (loopText != NULL) - { - // Skip the "LOOPPOINT=" part. - loopText += 10; - // Convert it to our looppoint - // FMOD seems to ensure the tag is properly NULL-terminated. - // atoi will stop when it reaches anything that's not a number. - loopstart = atoi(loopText); - // Now do the rest like above - FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_PCM, &loopend, FMOD_TIMEUNIT_PCM)); - if (loopstart > 0) - FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_PCM, loopend, FMOD_TIMEUNIT_PCM)); - } - return true; - } - - // No special loop point - return true; -} - -void I_UnloadSong(void) -{ - I_StopSong(); -#ifdef HAVE_LIBGME - if (gme) - { - gme_delete(gme); - gme = NULL; - } -#endif - if (music_stream) - { - FMR(FMOD_Sound_Release(music_stream)); - music_stream = NULL; - } -} - -boolean I_PlaySong(boolean looping) -{ -#ifdef HAVE_LIBGME - if (gme) - { - gme_start_track(gme, 0); - current_track = 0; - FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, music_stream, false, &music_channel)); - FMR(FMOD_Channel_SetVolume(music_channel, music_volume / 31.0)); - FMR(FMOD_Channel_SetPriority(music_channel, 0)); - return true; - } -#endif - - FMR(FMOD_Sound_SetMode(music_stream, (looping ? FMOD_LOOP_NORMAL : FMOD_LOOP_OFF))); - FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, music_stream, false, &music_channel)); - if (I_SongType() != MU_MID) - FMR(FMOD_Channel_SetVolume(music_channel, midi_volume / 31.0)); - else - FMR(FMOD_Channel_SetVolume(music_channel, music_volume / 31.0)); - FMR(FMOD_Channel_SetPriority(music_channel, 0)); - current_track = 0; - - return true; -} - -void I_StopSong(void) -{ - if (music_channel) - FMR_MUSIC(FMOD_Channel_Stop(music_channel)); -} - -void I_PauseSong(void) -{ - if (music_channel) - FMR_MUSIC(FMOD_Channel_SetPaused(music_channel, true)); -} - -void I_ResumeSong(void) -{ - if (music_channel) - FMR_MUSIC(FMOD_Channel_SetPaused(music_channel, false)); -} - -void I_SetMusicVolume(UINT8 volume) -{ - if (!music_channel) - return; - - // volume is 0 to 31. - if (I_SongType() == MU_MID) - music_volume = 31; // windows bug hack - else - music_volume = volume; - - FMR_MUSIC(FMOD_Channel_SetVolume(music_channel, music_volume / 31.0)); -} - -UINT32 I_GetSongLength(void) -{ - UINT32 length; - if (I_SongType() == MU_MID) - return 0; - FMR_MUSIC(FMOD_Sound_GetLength(music_stream, &length, FMOD_TIMEUNIT_MS)); - return length; -} - -boolean I_SetSongLoopPoint(UINT32 looppoint) -{ - (void)looppoint; - return false; -} - -UINT32 I_GetSongLoopPoint(void) -{ - return 0; -} - -boolean I_SetSongPosition(UINT32 position) -{ - FMOD_RESULT e; - if(I_SongType() == MU_MID) - // Dummy out; this works for some MIDI, but not others. - // SDL does not support this for any MIDI. - return false; - - e = FMOD_Channel_SetPosition(music_channel, position, FMOD_TIMEUNIT_MS); - if (e == FMOD_OK) - return true; - else if (e == FMOD_ERR_UNSUPPORTED // Only music modules, numbnuts! - || e == FMOD_ERR_INVALID_POSITION) // Out-of-bounds! - return false; - else // Congrats, you horribly broke it somehow - { - FMR_MUSIC(e); - return false; - } -} - -UINT32 I_GetSongPosition(void) -{ - FMOD_RESULT e; - unsigned int fmposition = 0; - if(I_SongType() == MU_MID) - // Dummy out because unsupported, even though FMOD does this correctly. - return 0; - e = FMOD_Channel_GetPosition(music_channel, &fmposition, FMOD_TIMEUNIT_MS); - if (e == FMOD_OK) - return (UINT32)fmposition; - else - return 0; -} - -boolean I_SetSongTrack(INT32 track) -{ - if (track != current_track) // If the track's already playing, then why bother? - { - FMOD_RESULT e; - - #ifdef HAVE_LIBGME - // If the specified track is within the number of tracks playing, then change it - if (gme) - { - if (track >= 0 - && track < gme_track_count(gme)) - { - gme_err_t gme_e = gme_start_track(gme,track); - if (gme_e == NULL) - { - current_track = track; - return true; - } - else - CONS_Alert(CONS_ERROR, "Encountered GME error: %s\n", gme_e); - } - return false; - } - #endif // HAVE_LIBGME - - // Try to set it via FMOD - e = FMOD_Channel_SetPosition(music_channel, (UINT32)track, FMOD_TIMEUNIT_MODORDER); - if (e == FMOD_OK) // We good - { - current_track = track; - return true; - } - else if (e == FMOD_ERR_UNSUPPORTED // Only music modules, numbnuts! - || e == FMOD_ERR_INVALID_POSITION) // Out-of-bounds! - return false; - else // Congrats, you horribly broke it somehow - { - FMR_MUSIC(e); - return false; - } - } - return false; -} - -/// ------------------------ -/// MUSIC FADING -/// ------------------------ - -void I_SetInternalMusicVolume(UINT8 volume) -{ - (void)volume; -} - -void I_StopFadingSong(void) -{ -} - -boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms, void (*callback)(void)) -{ - (void)target_volume; - (void)source_volume; - (void)ms; - (void)callback; - return false; -} - -boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void)) -{ - (void)target_volume; - (void)ms; - (void)callback; - return false; -} - -boolean I_FadeOutStopSong(UINT32 ms) -{ - (void)ms; - return false; -} - -boolean I_FadeInPlaySong(UINT32 ms, boolean looping) -{ - (void)ms; - (void)looping; - return false; -} diff --git a/src/win32/win_sys.c b/src/win32/win_sys.c deleted file mode 100644 index ff443935f..000000000 --- a/src/win32/win_sys.c +++ /dev/null @@ -1,3707 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// 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. -//----------------------------------------------------------------------------- -/// \file -/// \brief win32 system i/o -/// -/// Startup & Shutdown routines for music,sound,timer,keyboard,... -/// Signal handler to trap errors and exit cleanly. - -#include "../doomdef.h" - -#ifdef _WINDOWS - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "../m_misc.h" -#include "../i_video.h" -#include "../i_sound.h" -#include "../i_system.h" - -#include "../d_net.h" -#include "../g_game.h" - -#include "../d_main.h" - -#include "../m_argv.h" - -#include "../w_wad.h" -#include "../z_zone.h" -#include "../g_input.h" - -#include "../keys.h" - -#include "../screen.h" - -#include "../m_menu.h" - -// Wheel support for Win95/WinNT3.51 -#include - -// Taken from Win98/NT4.0 -#ifndef SM_MOUSEWHEELPRESENT -#define SM_MOUSEWHEELPRESENT 75 -#endif - -#ifndef MSH_MOUSEWHEEL -#ifdef UNICODE -#define MSH_MOUSEWHEEL L"MSWHEEL_ROLLMSG" -#else -#define MSH_MOUSEWHEEL "MSWHEEL_ROLLMSG" -#endif -#endif - -#include "win_main.h" -#include "win_dbg.h" -#include "../i_joy.h" - -#ifndef NOMUMBLE -// Mumble context string -#include "../d_clisrv.h" -#include "../byteptr.h" -#endif - -#define DIRECTINPUT_VERSION 0x0500 -// Force dinput.h to generate old DX3 headers. -#define DXVERSION_NTCOMPATIBLE 0x0300 -#include -#ifndef IDirectInputEffect_Stop -#define IDirectInputEffect_Stop(p) (p)->lpVtbl->Stop(p) -#endif -#ifndef IDirectInputEffect_SetParameters -#define IDirectInputEffect_SetParameters(p,a,b) (p)->lpVtbl->SetParameters(p,a,b) -#endif -#ifndef IDirectInputEffect_Release -#define IDirectInputEffect_Release(p) (p)->lpVtbl->Release(p) -#endif - -#include "fabdxlib.h" - -/// \brief max number of joystick buttons -#define JOYBUTTONS_MAX 32 // rgbButtons[32] -/// \brief max number of joystick button events -#define JOYBUTTONS_MIN min((JOYBUTTONS),(JOYBUTTONS_MAX)) - -/// \brief max number of joysick axies -#define JOYAXISSET_MAX 4 // (lX, lY), (lZ,lRx), (lRy, lRz), rglSlider[2] is very diff -/// \brief max number ofjoystick axis events -#define JOYAXISSET_MIN min((JOYAXISSET),(JOYAXISSET_MAX)) - -/// \brief max number of joystick hats -#define JOYHATS_MAX 4 // rgdwPOV[4]; -/// \brief max number of joystick hat events -#define JOYHATS_MIN min((JOYHATS),(JOYHATS_MAX)) - -/// \brief max number of mouse buttons -#define MOUSEBUTTONS_MAX 8 // 8 bit of BYTE and DIMOFS_BUTTON7 -/// \brief max number of muse button events -#define MOUSEBUTTONS_MIN min((MOUSEBUTTONS),(MOUSEBUTTONS_MAX)) - -// ================== -// DIRECT INPUT STUFF -// ================== -BOOL bDX0300; // if true, we created a DirectInput 0x0300 version -static LPDIRECTINPUTA lpDI = NULL; -static LPDIRECTINPUTDEVICEA lpDIK = NULL; // Keyboard -static LPDIRECTINPUTDEVICEA lpDIM = NULL; // mice -static LPDIRECTINPUTDEVICEA lpDIJ = NULL; // joystick 1P -static LPDIRECTINPUTEFFECT lpDIE[NumberofForces]; // joystick 1Es -static LPDIRECTINPUTDEVICE2A lpDIJA = NULL; // joystick 1I -static LPDIRECTINPUTDEVICEA lpDIJ2 = NULL; // joystick 2P -static LPDIRECTINPUTEFFECT lpDIE2[NumberofForces]; // joystick 1Es -static LPDIRECTINPUTDEVICE2A lpDIJ2A = NULL;// joystick 2I - -// Do not execute cleanup code more than once. See Shutdown_xxx() routines. -UINT8 graphics_started = 0; -UINT8 keyboard_started = 0; -UINT8 sound_started = 0; -static boolean mouse_enabled = false; -static boolean joystick_detected = false; -static boolean joystick2_detected = false; - -static VOID I_ShutdownKeyboard(VOID); -static VOID I_GetKeyboardEvents(VOID); -static VOID I_ShutdownJoystick(VOID); -static VOID I_ShutdownJoystick2(VOID); - -static boolean entering_con_command = false; - -// -// Why would this be system specific?? hmmmm.... -// -// it is for virtual reality system, next incoming feature :) -static ticcmd_t emptycmd; -ticcmd_t *I_BaseTiccmd(void) -{ - return &emptycmd; -} - -static ticcmd_t emptycmd2; -ticcmd_t *I_BaseTiccmd2(void) -{ - return &emptycmd2; -} - -// Allocates the base zone memory, -// this function returns a valid pointer and size, -// else it should interrupt the program immediately. -// -// now checks if mem could be allocated, this is still -// prehistoric... there's a lot to do here: memory locking, detection -// of win95 etc... -// - -// return free and total memory in the system -UINT32 I_GetFreeMem(UINT32* total) -{ - MEMORYSTATUS info; - - info.dwLength = sizeof (MEMORYSTATUS); - GlobalMemoryStatus(&info); - if (total) - *total = (UINT32)info.dwTotalPhys; - return (UINT32)info.dwAvailPhys; -} - -// --------- -// I_Profile -// Two little functions to profile our code using the high resolution timer -// --------- -static LARGE_INTEGER ProfileCount; -VOID I_BeginProfile(VOID) -{ - if (!QueryPerformanceCounter(&ProfileCount)) - I_Error("I_BeginProfile failed"); // can't profile without the high res timer -} - -// we're supposed to use this to measure very small amounts of time, -// that's why we return a DWORD and not a 64bit value -DWORD I_EndProfile(VOID) -{ - LARGE_INTEGER CurrTime; - DWORD ret; - if (!QueryPerformanceCounter (&CurrTime)) - I_Error("I_EndProfile failed"); - if (CurrTime.QuadPart - ProfileCount.QuadPart > (LONGLONG)0xFFFFFFFFUL) - I_Error("I_EndProfile overflow"); - ret = (DWORD)(CurrTime.QuadPart - ProfileCount.QuadPart); - // we can call I_EndProfile() several time, I_BeginProfile() need be called just once - ProfileCount = CurrTime; - - return ret; -} - -// --------- -// I_GetTime -// Use the High Resolution Timer if available, -// else use the multimedia timer which has 1 millisecond precision on Windowz 95, -// but lower precision on Windows NT -// --------- -static long hacktics = 0; // used locally for keyboard repeat keys -static DWORD starttickcount = 0; // hack for win2k time bug - -tic_t I_GetTime(void) -{ - tic_t newtics = 0; - - if (!starttickcount) // high precision timer - { - LARGE_INTEGER currtime; // use only LowPart if high resolution counter is not available - static LARGE_INTEGER basetime = {{0, 0}}; - - // use this if High Resolution timer is found - static LARGE_INTEGER frequency; - - if (!basetime.LowPart) - { - if (!QueryPerformanceFrequency(&frequency)) - frequency.QuadPart = 0; - else - QueryPerformanceCounter(&basetime); - } - - if (frequency.LowPart && QueryPerformanceCounter(&currtime)) - { - newtics = (int)((currtime.QuadPart - basetime.QuadPart) * NEWTICRATE - / frequency.QuadPart); - } - else - { - currtime.LowPart = timeGetTime(); - if (!basetime.LowPart) - basetime.LowPart = currtime.LowPart; - newtics = ((currtime.LowPart - basetime.LowPart)/(1000/NEWTICRATE)); - } - } - else - newtics = (GetTickCount() - starttickcount)/(1000/NEWTICRATE); - - hacktics = newtics; // a local counter for keyboard repeat key - return newtics; -} - -void I_Sleep(void) -{ - if (cv_sleep.value != -1) - Sleep(cv_sleep.value); -} - -// should move to i_video -void I_WaitVBL(INT32 count) -{ - UNREFERENCED_PARAMETER(count); -} - -// this is probably to activate the 'loading' disc icon -// it should set a flag, that I_FinishUpdate uses to know -// whether it draws a small 'loading' disc icon on the screen or not -// -// also it should explicitly draw the disc because the screen is -// possibly not refreshed while loading -// -void I_BeginRead(void) {} - -// see above, end the 'loading' disc icon, set the flag false -// -void I_EndRead(void) {} - -// =========================================================================================== -// EVENTS -// =========================================================================================== -static BOOL I_ReadyConsole(HANDLE ci) -{ - DWORD gotinput; - if (ci == INVALID_HANDLE_VALUE) return FALSE; - if (WaitForSingleObject(ci,0) != WAIT_OBJECT_0) return FALSE; - if (GetFileType(ci) != FILE_TYPE_CHAR) return FALSE; - if (!GetConsoleMode(ci, &gotinput)) return FALSE; - return (GetNumberOfConsoleInputEvents(ci, &gotinput) && gotinput); -} - -static inline VOID I_GetConsoleEvents(VOID) -{ - event_t ev = {0,0,0,0}; - HANDLE ci = GetStdHandle(STD_INPUT_HANDLE); - HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE); - CONSOLE_SCREEN_BUFFER_INFO CSBI; - INPUT_RECORD input; - DWORD t; - - while (I_ReadyConsole(ci) && ReadConsoleInput(ci, &input, 1, &t) && t) - { - ZeroMemory(&ev, sizeof(ev)); - switch (input.EventType) - { - case KEY_EVENT: - if (input.Event.KeyEvent.bKeyDown) - { - ev.type = ev_console; - entering_con_command = true; - switch (input.Event.KeyEvent.wVirtualKeyCode) - { - case VK_ESCAPE: - case VK_TAB: - ev.key = KEY_NULL; - break; - case VK_SHIFT: - ev.key = KEY_LSHIFT; - break; - case VK_RETURN: - entering_con_command = false; - /* FALLTHRU */ - default: - ev.key = MapVirtualKey(input.Event.KeyEvent.wVirtualKeyCode,2); // convert in to char - } - if (co != INVALID_HANDLE_VALUE && GetFileType(co) == FILE_TYPE_CHAR && GetConsoleMode(co, &t)) - { - if (ev.key && ev.key != KEY_LSHIFT && ev.key != KEY_RSHIFT) - { -#ifdef UNICODE - WriteConsole(co, &input.Event.KeyEvent.uChar.UnicodeChar, 1, &t, NULL); -#else - WriteConsole(co, &input.Event.KeyEvent.uChar.AsciiChar, 1, &t, NULL); -#endif - } - if (input.Event.KeyEvent.wVirtualKeyCode == VK_BACK - && GetConsoleScreenBufferInfo(co,&CSBI)) - { - WriteConsoleOutputCharacterA(co, " ",1, CSBI.dwCursorPosition, &t); - } - } - } - else - { - ev.type = ev_keyup; - switch (input.Event.KeyEvent.wVirtualKeyCode) - { - case VK_SHIFT: - ev.key = KEY_LSHIFT; - break; - default: - break; - } - } - if (ev.key) D_PostEvent(&ev); - break; - case MOUSE_EVENT: - case WINDOW_BUFFER_SIZE_EVENT: - case MENU_EVENT: - case FOCUS_EVENT: - break; - } - } -} - -// ---------- -// I_GetEvent -// Post new events for all sorts of user-input -// ---------- -void I_GetEvent(void) -{ - I_GetConsoleEvents(); - I_GetKeyboardEvents(); - I_GetMouseEvents(); - I_GetJoystickEvents(); - I_GetJoystick2Events(); -} - -// ---------- -// I_OsPolling -// ---------- -void I_OsPolling(void) -{ - MSG msg; - HANDLE ci = GetStdHandle(STD_INPUT_HANDLE); - - // we need to dispatch messages to the window - // so the window procedure can respond to messages and PostEvent() for keys - // during D_SRB2Main startup. - // this one replaces the main loop of windows since I_OsPolling is called in the main loop - do - { - while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) - { - if (GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - else // winspec : this is quit message - I_Quit(); - } - if (!appActive && !netgame && !I_ReadyConsole(ci)) - WaitMessage(); - } while (!appActive && !netgame && !I_ReadyConsole(ci)); - - // this is called by the network synchronization, - // check keys and allow escaping - I_GetEvent(); - - // reset "emulated keys" - gamekeydown[KEY_MOUSEWHEELUP] = 0; - gamekeydown[KEY_MOUSEWHEELDOWN] = 0; -} - -// =========================================================================================== -// TIMER -// =========================================================================================== - -static VOID I_ShutdownTimer(VOID) -{ - timeEndPeriod(1); -} - -// -// Installs the timer interrupt handler with timer speed as TICRATE. -// -#define TIMER_ID 1 -#define TIMER_RATE (1000/TICRATE) -void I_StartupTimer(void) -{ - // for win2k time bug - if (M_CheckParm("-gettickcount")) - { - starttickcount = GetTickCount(); - CONS_Printf("Using GetTickCount()\n"); - } - timeBeginPeriod(1); - I_AddExitFunc(I_ShutdownTimer); -} - -// =========================================================================================== -// EXIT CODE, ERROR HANDLING -// =========================================================================================== - -static int errorcount = 0; // phuck recursive errors -static int shutdowning = false; - -// -// Used to trap various signals, to make sure things get shut down cleanly. -// -#ifdef NDEBUG -static void signal_handler(int num) -{ - //static char msg[] = "oh no! back to reality!\r\n"; - const char *sigmsg; - char sigdef[64]; - - D_QuitNetGame(); // Fix server freezes - CL_AbortDownloadResume(); - I_ShutdownSystem(); - - switch (num) - { - case SIGINT: - sigmsg = "interrupt"; - break; - case SIGILL: - sigmsg = "illegal instruction - invalid function image"; - break; - case SIGFPE: - sigmsg = "floating point exception"; - break; - case SIGSEGV: - sigmsg = "segment violation"; - break; - case SIGTERM: - sigmsg = "software termination signal from kill"; - break; - case SIGBREAK: - sigmsg = "Ctrl-Break sequence"; - break; - case SIGABRT: - sigmsg = "abnormal termination triggered by abort call"; - break; - default: - sprintf(sigdef, "signal number %d", num); - sigmsg = sigdef; - } - -#ifdef LOGMESSAGES - if (logstream) - { - I_OutputMsg("signal_handler() error: %s\r\n", sigmsg); - fclose(logstream); - logstream = NULL; - } -#endif - - MessageBoxA(hWndMain, va("signal_handler(): %s", sigmsg), "SRB2 error", MB_OK|MB_ICONERROR); - - signal(num, SIG_DFL); // default signal action - raise(num); -} -#endif - -// -// put an error message (with format) on stderr -// -void I_OutputMsg(const char *fmt, ...) -{ - HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE); - DWORD bytesWritten; - va_list argptr; - char txt[8192]; - - va_start(argptr,fmt); - vsprintf(txt, fmt, argptr); - va_end(argptr); - -#ifdef _MSC_VER - OutputDebugStringA(txt); -#endif - -#ifdef LOGMESSAGES - if (logstream) - { - fwrite(txt, strlen(txt), 1, logstream); - fflush(logstream); - } -#endif - - if (co == INVALID_HANDLE_VALUE) - return; - - if (GetFileType(co) == FILE_TYPE_CHAR && GetConsoleMode(co, &bytesWritten)) - { - static COORD coordNextWrite = {0,0}; - LPVOID oldLines = NULL; - INT oldLength; - CONSOLE_SCREEN_BUFFER_INFO csbi; - - // Save the lines that we're going to obliterate. - GetConsoleScreenBufferInfo(co, &csbi); - oldLength = csbi.dwSize.X * (csbi.dwCursorPosition.Y - coordNextWrite.Y) + csbi.dwCursorPosition.X - coordNextWrite.X; - - if (oldLength > 0) - { - LPVOID blank = malloc(oldLength); - if (!blank) return; - memset(blank, ' ', oldLength); // Blank out. - oldLines = malloc(oldLength*sizeof(TCHAR)); - if (!oldLines) - { - free(blank); - return; - } - - ReadConsoleOutputCharacter(co, oldLines, oldLength, coordNextWrite, &bytesWritten); - - // Move to where we what to print - which is where we would've been, - // had console input not been in the way, - SetConsoleCursorPosition(co, coordNextWrite); - - WriteConsoleA(co, blank, oldLength, &bytesWritten, NULL); - free(blank); - - // And back to where we want to print again. - SetConsoleCursorPosition(co, coordNextWrite); - } - - // Actually write the string now! - WriteConsoleA(co, txt, (DWORD)strlen(txt), &bytesWritten, NULL); - - // Next time, output where we left off. - GetConsoleScreenBufferInfo(co, &csbi); - coordNextWrite = csbi.dwCursorPosition; - - // Restore what was overwritten. - if (oldLines && entering_con_command) - WriteConsole(co, oldLines, oldLength, &bytesWritten, NULL); - if (oldLines) free(oldLines); - } - else // Redirected to a file. - WriteFile(co, txt, (DWORD)strlen(txt), &bytesWritten, NULL); -} - -// display error messy after shutdowngfx -// -void I_Error(const char *error, ...) -{ - va_list argptr; - char txt[8192]; - - // added 11-2-98 recursive error detecting - if (shutdowning) - { - errorcount++; - // try to shutdown each subsystem separately - if (errorcount == 5) - I_ShutdownGraphics(); - if (errorcount == 6) - I_ShutdownSystem(); - if (errorcount == 7) - { - M_SaveConfig(NULL); - G_SaveGameData(); - } - if (errorcount > 20) - { - // Don't print garbage - va_start(argptr,error); - vsprintf(txt, error, argptr); - va_end(argptr); - - OutputDebugStringA(txt); - MessageBoxA(hWndMain, txt, "SRB2 Recursive Error", MB_OK|MB_ICONERROR); - W_Shutdown(); - exit(-1); // recursive errors detected - } - } - shutdowning = true; - - // put message to stderr - va_start(argptr, error); - wvsprintfA(txt, error, argptr); - va_end(argptr); - - CONS_Printf("I_Error(): %s\n", txt); //don't change from CONS_Printf. - - // saving one time is enough! - if (!errorcount) - { - M_SaveConfig(NULL); // save game config, cvars.. - G_SaveGameData(); - } - - // save demo, could be useful for debug - // NOTE: demos are normally not saved here. - if (demorecording) - G_CheckDemoStatus(); - if (metalrecording) - G_StopMetalRecording(false); - - D_QuitNetGame(); - CL_AbortDownloadResume(); - M_FreePlayerSetupColors(); - - // shutdown everything that was started - I_ShutdownSystem(); - -#ifdef LOGMESSAGES - if (logstream) - { - fclose(logstream); - logstream = NULL; - } -#endif - - MessageBoxA(hWndMain, txt, "SRB2 Error", MB_OK|MB_ICONERROR); - - W_Shutdown(); - exit(-1); -} - -static inline VOID ShowEndTxt(HANDLE co) -{ - int i; - UINT16 j, att = 0; - int nlflag = 1; - CONSOLE_SCREEN_BUFFER_INFO backupcon; - COORD resizewin = {80,-1}; - DWORD bytesWritten; - CHAR let = 0; - UINT16 *ptext; - LPVOID data; - lumpnum_t endoomnum = W_GetNumForName("ENDOOM"); - //HANDLE ci = GetStdHandle(STD_INPUT_HANDLE); - - /* get the lump with the text */ - data = ptext = W_CacheLumpNum(endoomnum, PU_CACHE); - - backupcon.wAttributes = FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE; // Just in case - GetConsoleScreenBufferInfo(co, &backupcon); //Store old state - resizewin.Y = backupcon.dwSize.Y; - if (backupcon.dwSize.X < resizewin.X) - SetConsoleScreenBufferSize(co, resizewin); - - for (i = 1; i <= 80*25; i++) // print 80x25 text and deal with the attributes too - { - j = (UINT16)(*ptext >> 8); // attribute first - let = (char)(*ptext & 0xff); // text senond - if (j != att) // attribute changed? - { - att = j; // save current attribute - SetConsoleTextAttribute(co, j); //set fg and bg color for buffer - } - - WriteConsoleA(co, &let, 1, &bytesWritten, NULL); // now the text - - if (nlflag && !(i % 80) && backupcon.dwSize.X > resizewin.X) // do we need a nl? - { - att = backupcon.wAttributes; - SetConsoleTextAttribute(co, att); // all attributes off - WriteConsoleA(co, "\n", 1, &bytesWritten, NULL); // newline to console - } - ptext++; - } - SetConsoleTextAttribute(co, backupcon.wAttributes); // all attributes off - //if (nlflag) - // WriteConsoleA(co, "\n", 1, &bytesWritten, NULL); - - getchar(); //pause! - - Z_Free(data); -} - - -// -// I_Quit: shutdown everything cleanly, in reverse order of Startup. -// -void I_Quit(void) -{ - HANDLE co = GetStdHandle(STD_OUTPUT_HANDLE); - DWORD mode; - // when recording a demo, should exit using 'q', - // but sometimes we forget and use Alt+F4, so save here too. - if (demorecording) - G_CheckDemoStatus(); - if (metalrecording) - G_StopMetalRecording(false); - - M_SaveConfig(NULL); // save game config, cvars.. -#ifndef NONET - D_SaveBan(); // save the ban list -#endif - G_SaveGameData(); - - // maybe it needs that the ticcount continues, - // or something else that will be finished by I_ShutdownSystem(), - // so do it before. - D_QuitNetGame(); - CL_AbortDownloadResume(); - - M_FreePlayerSetupColors(); - - // shutdown everything that was started - I_ShutdownSystem(); - - if (shutdowning || errorcount) - I_Error("Error detected (%d)", errorcount); - -#ifdef LOGMESSAGES - if (logstream) - { - I_OutputMsg("I_Quit(): end of logstream.\n"); - fclose(logstream); - logstream = NULL; - } -#endif - if (!M_CheckParm("-noendtxt") && W_CheckNumForName("ENDOOM")!=LUMPERROR - && co != INVALID_HANDLE_VALUE && GetFileType(co) == FILE_TYPE_CHAR - && GetConsoleMode(co, &mode)) - { - printf("\r"); - ShowEndTxt(co); - } - fflush(stderr); - if (myargmalloc) - free(myargv); // Deallocate allocated memory - W_Shutdown(); - exit(0); -} - -// -------------------------------------------------------------------------- -// I_ShowLastError -// Print a GetLastError() error message, and if MB is TRUE, also display it in a MessageBox -// -------------------------------------------------------------------------- -VOID I_ShowLastError(BOOL MB) -{ - LPSTR lpMsgBuf = NULL; - const DWORD LE = GetLastError(); - - if (LE == 0xdeadbeef) return; // Not a real error - - FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, LE, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPVOID)&lpMsgBuf, 0, NULL); - - if (!lpMsgBuf) - { - I_OutputMsg("GetLastError: Unknown\n"); - return; - } - - // Display the string - if (MB && LE) MessageBoxA(NULL, lpMsgBuf, "GetLastError", MB_OK|MB_ICONINFORMATION); - - // put it in text console and log if any - I_OutputMsg("GetLastError: %s", lpMsgBuf); - - // Free the buffer. - LocalFree(lpMsgBuf); -} - -// =========================================================================================== -// CLEAN STARTUP & SHUTDOWN HANDLING, JUST CLOSE EVERYTHING YOU OPENED. -// =========================================================================================== -// -// -static quitfuncptr quit_funcs[MAX_QUIT_FUNCS] = -{ - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL -}; - -// Adds a function to the list that need to be called by I_SystemShutdown(). -// -void I_AddExitFunc(void (*func)()) -{ - int c; - - for (c = 0; c < MAX_QUIT_FUNCS; c++) - { - if (!quit_funcs[c]) - { - quit_funcs[c] = func; - break; - } - } -} - -// Removes a function from the list that need to be called by I_SystemShutdown(). -// -void I_RemoveExitFunc(void (*func)()) -{ - int c; - - for (c = 0; c < MAX_QUIT_FUNCS; c++) - { - if (quit_funcs[c] == func) - { - while (c < MAX_QUIT_FUNCS - 1) - { - quit_funcs[c] = quit_funcs[c+1]; - c++; - } - quit_funcs[MAX_QUIT_FUNCS-1] = NULL; - break; - } - } -} - -// =========================================================================================== -// DIRECT INPUT HELPER CODE -// =========================================================================================== - -// Create a DirectInputDevice interface, -// create a DirectInputDevice2 interface if possible -static VOID CreateDevice2A(LPDIRECTINPUTA di, REFGUID pguid, LPDIRECTINPUTDEVICEA* lpDEV, - LPDIRECTINPUTDEVICE2A* lpDEV2) -{ - HRESULT hr, hr2; - LPDIRECTINPUTDEVICEA lpdid1; - LPDIRECTINPUTDEVICE2A lpdid2 = NULL; - - hr = IDirectInput_CreateDevice(di, pguid, &lpdid1, NULL); - - if (SUCCEEDED(hr)) - { - // get Device2 but only if we are not in DirectInput version 3 - if (!bDX0300 && lpDEV2) - { - LPDIRECTINPUTDEVICE2A *rp = &lpdid2; - LPVOID *tp = (LPVOID *)rp; - hr2 = IDirectInputDevice_QueryInterface(lpdid1, &IID_IDirectInputDevice2, tp); - if (FAILED(hr2)) - { - CONS_Alert(CONS_ERROR, M_GetText("Could not create IDirectInput device 2")); - lpdid2 = NULL; - } - } - } - else - I_Error("Could not create IDirectInput device"); - - *lpDEV = lpdid1; - if (lpDEV2) // only if we requested it - *lpDEV2 = lpdid2; -} - -// =========================================================================================== -// DIRECT INPUT MOUSE -// =========================================================================================== - -#define DI_MOUSE_BUFFERSIZE 16 // number of data elements in mouse buffer - -// -// Initialise the mouse. -// -static void I_ShutdownMouse(VOID); - -void I_StartupMouse(VOID) -{ - // this gets called when cv_usemouse is initted - // for the win32 version, we want to startup the mouse later - if (menuactive) - { - if (cv_usemouse.value) - I_DoStartupMouse(); - else - I_ShutdownMouse(); - } -} - -static HANDLE mouse2filehandle = INVALID_HANDLE_VALUE; - -static void I_ShutdownMouse2(VOID) -{ - if (mouse2filehandle != INVALID_HANDLE_VALUE) - { - event_t event; - UINT i; - - SetCommMask(mouse2filehandle, 0); - - EscapeCommFunction(mouse2filehandle, CLRDTR); - EscapeCommFunction(mouse2filehandle, CLRRTS); - - PurgeComm(mouse2filehandle, PURGE_TXABORT|PURGE_RXABORT|PURGE_TXCLEAR|PURGE_RXCLEAR); - - CloseHandle(mouse2filehandle); - - // emulate the up of all mouse buttons - for (i = 0; i < MOUSEBUTTONS; i++) - { - event.type = ev_keyup; - event.key = KEY_2MOUSE1 + i; - D_PostEvent(&event); - } - - mouse2filehandle = INVALID_HANDLE_VALUE; - } -} - -#define MOUSECOMBUFFERSIZE 256 -static int handlermouse2x, handlermouse2y, handlermouse2buttons; - -static VOID I_PoolMouse2(VOID) -{ - BYTE buffer[MOUSECOMBUFFERSIZE]; - COMSTAT ComStat; - DWORD dwErrorFlags, dwLength, i; - CHAR dx, dy; - static BYTE bytenum, combytes[4]; - - ClearCommError(mouse2filehandle, &dwErrorFlags, &ComStat); - dwLength = min(MOUSECOMBUFFERSIZE, ComStat.cbInQue); - - if (dwLength > 0) - { - if (!ReadFile(mouse2filehandle, buffer, dwLength, &dwLength, NULL)) - { - CONS_Alert(CONS_ERROR, M_GetText("Read Error on secondary mouse port\n")); - return; - } - - // parse the mouse packets - for (i = 0; i < dwLength; i++) - { - if ((buffer[i] & 64) == 64) - bytenum = 0; - - if (bytenum < 4) - combytes[bytenum] = buffer[i]; - bytenum++; - - if (bytenum == 1) - { - handlermouse2buttons &= ~3; - handlermouse2buttons |= ((combytes[0] & (32+16)) >>4); - } - else if (bytenum == 3) - { - dx = (CHAR)((combytes[0] & 3) << 6); - dy = (CHAR)((combytes[0] & 12) << 4); - dx = (CHAR)(dx + combytes[1]); - dy = (CHAR)(dy + combytes[2]); - handlermouse2x += dx; - handlermouse2y += dy; - } - else if (bytenum == 4) // fourth byte (logitech mouses) - { - if (buffer[i] & 32) - handlermouse2buttons |= 4; - else - handlermouse2buttons &= ~4; - } - } - } -} - -// secondary mouse doesn't use DirectX, therefore forget all about grabbing, acquire, etc. -void I_StartupMouse2(void) -{ - DCB dcb; - - if (mouse2filehandle != INVALID_HANDLE_VALUE) - I_ShutdownMouse2(); - - if (!cv_usemouse2.value) - return; - - if (mouse2filehandle != INVALID_HANDLE_VALUE) - { - // COM file handle - mouse2filehandle = CreateFileA(cv_mouse2port.string, GENERIC_READ|GENERIC_WRITE, - 0, // exclusive access - NULL, // no security attrs - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (mouse2filehandle == INVALID_HANDLE_VALUE) - { - int e = GetLastError(); - if (e == 5) - CONS_Alert(CONS_ERROR, M_GetText("Error opening %s!\n"), cv_mouse2port.string); - else - CONS_Alert(CONS_ERROR, M_GetText("Can't open %s: error %d\n"), cv_mouse2port.string, e); - return; - } - } - - // buffers - SetupComm(mouse2filehandle, MOUSECOMBUFFERSIZE, MOUSECOMBUFFERSIZE); - - // purge buffers - PurgeComm(mouse2filehandle, PURGE_TXABORT|PURGE_RXABORT|PURGE_TXCLEAR|PURGE_RXCLEAR); - - // setup port to 1200 7N1 - dcb.DCBlength = sizeof (DCB); - - GetCommState(mouse2filehandle, &dcb); - - dcb.BaudRate = CBR_1200; - dcb.ByteSize = 7; - dcb.Parity = NOPARITY; - dcb.StopBits = ONESTOPBIT; - - dcb.fDtrControl = DTR_CONTROL_ENABLE; - dcb.fRtsControl = RTS_CONTROL_ENABLE; - - dcb.fBinary = dcb.fParity = TRUE; - - SetCommState(mouse2filehandle, &dcb); - - I_AddExitFunc(I_ShutdownMouse2); -} - -#define MAX_MOUSE_BTNS 5 -static int center_x, center_y; -static INT old_mparms[3], new_mparms[3] = {0, 0, 1}; -static BOOL restore_mouse = FALSE; -static INT old_mouse_state = 0; -UINT MSHWheelMessage = 0; - -static VOID I_DoStartupSysMouse(VOID) -{ - boolean valid; - RECT w_rect; - - valid = SystemParametersInfo(SPI_GETMOUSE, 0, old_mparms, 0); - if (valid) - { - new_mparms[2] = old_mparms[2]; - restore_mouse = SystemParametersInfo(SPI_SETMOUSE, 0, new_mparms, 0); - } - - if (bAppFullScreen) - { - w_rect.top = 0; - w_rect.left = 0; - } - else - { - w_rect.top = windowPosY; - w_rect.left = windowPosX; - } - - w_rect.bottom = w_rect.top + VIDHEIGHT; - w_rect.right = w_rect.left + VIDWIDTH; - center_x = w_rect.left + (VIDWIDTH >> 1); - center_y = w_rect.top + (VIDHEIGHT >> 1); - SetCursor(NULL); - SetCursorPos(center_x, center_y); - SetCapture(hWndMain); - ClipCursor(&w_rect); -} - -static VOID I_ShutdownSysMouse(VOID) -{ - if (restore_mouse) - SystemParametersInfo(SPI_SETMOUSE, 0, old_mparms, 0); - ClipCursor(NULL); - ReleaseCapture(); -} - -VOID I_RestartSysMouse(VOID) -{ - if (nodinput) - { - I_ShutdownSysMouse(); - I_DoStartupSysMouse(); - } -} - -VOID I_GetSysMouseEvents(INT mouse_state) -{ - UINT i; - event_t event; - int xmickeys = 0, ymickeys = 0; - POINT c_pos; - - for (i = 0; i < MAX_MOUSE_BTNS; i++) - { - // check if button pressed - if ((mouse_state & (1 << i)) && !(old_mouse_state & (1 << i))) - { - event.type = ev_keydown; - event.key = KEY_MOUSE1 + i; - D_PostEvent(&event); - } - // check if button released - if (!(mouse_state & (1 << i)) && (old_mouse_state & (1 << i))) - { - event.type = ev_keyup; - event.key = KEY_MOUSE1 + i; - D_PostEvent(&event); - } - } - old_mouse_state = mouse_state; - - // proceed mouse movements - GetCursorPos(&c_pos); - xmickeys = c_pos.x - center_x; - ymickeys = c_pos.y - center_y; - - if (xmickeys || ymickeys) - { - event.type = ev_mouse; - event.key = 0; - event.x = xmickeys; - event.y = -ymickeys; - D_PostEvent(&event); - SetCursorPos(center_x, center_y); - } -} - -// This is called just before entering the main game loop, -// when we are going fullscreen and the loading screen has finished. -VOID I_DoStartupMouse(VOID) -{ - DIPROPDWORD dip; - - // mouse detection may be skipped by setting usemouse false - if (!cv_usemouse.value || M_CheckParm("-nomouse")) - { - mouse_enabled = false; - return; - } - - if (nodinput) - { - CONS_Printf(M_GetText("\tMouse will not use DirectInput.\n")); - // System mouse input will be initiated by VID_SetMode - I_AddExitFunc(I_ShutdownMouse); - - MSHWheelMessage = RegisterWindowMessage(MSH_MOUSEWHEEL); - } - else if (!lpDIM) // acquire the mouse only once - { - CreateDevice2A(lpDI, &GUID_SysMouse, &lpDIM, NULL); - - if (lpDIM) - { - if (FAILED(IDirectInputDevice_SetDataFormat(lpDIM, &c_dfDIMouse))) - I_Error("Couldn't set mouse data format"); - - // create buffer for buffered data - dip.diph.dwSize = sizeof (dip); - dip.diph.dwHeaderSize = sizeof (dip.diph); - dip.diph.dwObj = 0; - dip.diph.dwHow = DIPH_DEVICE; - dip.dwData = DI_MOUSE_BUFFERSIZE; - if (FAILED(IDirectInputDevice_SetProperty(lpDIM, DIPROP_BUFFERSIZE, &dip.diph))) - I_Error("Couldn't set mouse buffer size"); - - if (FAILED(IDirectInputDevice_SetCooperativeLevel(lpDIM, hWndMain, - DISCL_EXCLUSIVE|DISCL_FOREGROUND))) - { - I_Error("Couldn't set mouse coop level"); - } - I_AddExitFunc(I_ShutdownMouse); - } - else - I_Error("Couldn't create mouse input"); - } - - // if re-enabled while running, just set mouse_enabled true again, - // do not acquire the mouse more than once - mouse_enabled = true; -} - -// -// Shutdown Mouse DirectInput device -// -static void I_ShutdownMouse(void) -{ - int i; - event_t event; - - CONS_Printf("I_ShutdownMouse()\n"); - - if (lpDIM) - { - IDirectInputDevice_Unacquire(lpDIM); - IDirectInputDevice_Release(lpDIM); - lpDIM = NULL; - } - - // emulate the up of all mouse buttons - for (i = 0; i < MOUSEBUTTONS; i++) - { - event.type = ev_keyup; - event.key = KEY_MOUSE1 + i; - D_PostEvent(&event); - } - if (nodinput) - I_ShutdownSysMouse(); - - mouse_enabled = false; -} - -// -// Get buffered data from the mouse -// -void I_GetMouseEvents(void) -{ - DIDEVICEOBJECTDATA rgdod[DI_MOUSE_BUFFERSIZE]; - DWORD dwItems, d; - HRESULT hr; - - event_t event; - int xmickeys, ymickeys; - - if (mouse2filehandle != INVALID_HANDLE_VALUE) - { - //mouse movement - static UINT8 lastbuttons2 = 0; - - I_PoolMouse2(); - // post key event for buttons - if (handlermouse2buttons != lastbuttons2) - { - int i, j = 1, k; - k = handlermouse2buttons ^ lastbuttons2; // only changed bit to 1 - lastbuttons2 = (UINT8)handlermouse2buttons; - - for (i = 0; i < MOUSEBUTTONS; i++, j <<= 1) - if (k & j) - { - if (handlermouse2buttons & j) - event.type = ev_keydown; - else - event.type = ev_keyup; - event.key = KEY_2MOUSE1 + i; - D_PostEvent(&event); - } - } - - if (handlermouse2x || handlermouse2y) - { - event.type = ev_mouse2; - event.key = 0; - event.x = handlermouse2x<<1; - event.y = -handlermouse2y<<1; - handlermouse2x = 0; - handlermouse2y = 0; - - D_PostEvent(&event); - } - } - - if (!mouse_enabled || nodinput) - return; - -getBufferedData: - dwItems = DI_MOUSE_BUFFERSIZE; - hr = IDirectInputDevice_GetDeviceData(lpDIM, sizeof (DIDEVICEOBJECTDATA), rgdod, &dwItems, 0); - - // If data stream was interrupted, reacquire the device and try again. - if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED) - { - hr = IDirectInputDevice_Acquire(lpDIM); - if (SUCCEEDED(hr)) - goto getBufferedData; - } - - // We got buffered input, act on it - if (SUCCEEDED(hr)) - { - xmickeys = ymickeys = 0; - - // dwItems contains number of elements read (could be 0) - for (d = 0; d < dwItems; d++) - { - if (rgdod[d].dwOfs >= DIMOFS_BUTTON0 && - rgdod[d].dwOfs < DIMOFS_BUTTON0 + MOUSEBUTTONS) - { - if (rgdod[d].dwData & 0x80) // Button down - event.type = ev_keydown; - else - event.type = ev_keyup; // Button up - - event.key = rgdod[d].dwOfs - DIMOFS_BUTTON0 + KEY_MOUSE1; - D_PostEvent(&event); - } - else if (rgdod[d].dwOfs == DIMOFS_X) - xmickeys += rgdod[d].dwData; - else if (rgdod[d].dwOfs == DIMOFS_Y) - ymickeys += rgdod[d].dwData; - - else if (rgdod[d].dwOfs == DIMOFS_Z) - { - // z-axes the wheel - if ((int)rgdod[d].dwData > 0) - event.key = KEY_MOUSEWHEELUP; - else - event.key = KEY_MOUSEWHEELDOWN; - event.type = ev_keydown; - D_PostEvent(&event); - } - - } - - if (xmickeys || ymickeys) - { - event.type = ev_mouse; - event.key = 0; - event.x = xmickeys; - event.y = -ymickeys; - D_PostEvent(&event); - } - } -} - -void I_UpdateMouseGrab(void) {} - -// =========================================================================================== -// DIRECT INPUT JOYSTICK -// =========================================================================================== - -struct DIJoyInfo_s -{ - BYTE X,Y,Z,Rx,Ry,Rz,U,V; - LONG ForceAxises; -}; -typedef struct DIJoyInfo_s DIJoyInfo_t; - -// private info - static BYTE iJoyNum; // used by enumeration - static DIJoyInfo_t JoyInfo; - static BYTE iJoy2Num; - static DIJoyInfo_t JoyInfo2; - -//----------------------------------------------------------------------------- -// Name: EnumAxesCallback() -// Desc: Callback function for enumerating the axes on a joystick and counting -// each force feedback enabled axis -//----------------------------------------------------------------------------- -static BOOL CALLBACK EnumAxesCallback(const DIDEVICEOBJECTINSTANCEA* pdidoi, - VOID* pContext) -{ - DWORD* pdwNumForceFeedbackAxis = (DWORD*) pContext; - - if ((pdidoi->dwFlags & DIDOI_FFACTUATOR) != 0) - (*pdwNumForceFeedbackAxis)++; - - return DIENUM_CONTINUE; -} - - -static HRESULT SetupForceTacile(LPDIRECTINPUTDEVICE2A DJI, LPDIRECTINPUTEFFECT *DJE, DWORD FFAXIS, FFType EffectType,REFGUID EffectGUID) -{ - HRESULT hr; - DIEFFECT eff; - DWORD rgdwAxes[2] = { DIJOFS_X, DIJOFS_Y }; - LONG rglDirection[2] = { 0, 0 }; - DICONSTANTFORCE cf = { 0 }; // LONG lMagnitude - DIRAMPFORCE rf = {0,0}; // LONG lStart, lEnd; - DIPERIODIC pf = {0,0,0,0}; - ZeroMemory(&eff, sizeof (eff)); - if (FFAXIS > 2) - FFAXIS = 2; //up to 2 FFAXIS - eff.dwSize = sizeof (DIEFFECT); - eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS; // Cartesian and data format offsets - eff.dwDuration = INFINITE; - eff.dwSamplePeriod = 0; - eff.dwGain = DI_FFNOMINALMAX; - eff.dwTriggerButton = DIEB_NOTRIGGER; - eff.dwTriggerRepeatInterval = 0; - eff.cAxes = FFAXIS; - eff.rgdwAxes = rgdwAxes; - eff.rglDirection = rglDirection; - eff.lpEnvelope = NULL; - eff.lpvTypeSpecificParams = NULL; - if (EffectType == ConstantForce) - { - eff.cbTypeSpecificParams = sizeof (cf); - eff.lpvTypeSpecificParams = &cf; - } - else if (EffectType == RampForce) - { - eff.cbTypeSpecificParams = sizeof (rf); - eff.lpvTypeSpecificParams = &rf; - } - else if (EffectType >= SquareForce && SawtoothDownForce >= EffectType) - { - eff.cbTypeSpecificParams = sizeof (pf); - eff.lpvTypeSpecificParams = &pf; - } - - // Create the prepared effect - if (FAILED(hr = IDirectInputDevice2_CreateEffect(DJI, EffectGUID, - &eff, DJE, NULL))) - { - return hr; - } - - if (NULL == *DJE) - return E_FAIL; - - return hr; -} - -static BOOL CALLBACK DIEnumEffectsCallback1(LPCDIEFFECTINFOA pdei, LPVOID pvRef) -{ - LPDIRECTINPUTEFFECT *DJE = pvRef; - if (DIEFT_GETTYPE(pdei->dwEffType) == DIEFT_CONSTANTFORCE) - { - if (SUCCEEDED(SetupForceTacile(lpDIJA,DJE, JoyInfo.ForceAxises, ConstantForce, &pdei->guid))) - return DIENUM_STOP; - } - if (DIEFT_GETTYPE(pdei->dwEffType) == DIEFT_RAMPFORCE) - { - if (SUCCEEDED(SetupForceTacile(lpDIJA,DJE, JoyInfo.ForceAxises, RampForce, &pdei->guid))) - return DIENUM_STOP; - } - return DIENUM_CONTINUE; -} - -static BOOL CALLBACK DIEnumEffectsCallback2(LPCDIEFFECTINFOA pdei, LPVOID pvRef) -{ - LPDIRECTINPUTEFFECT *DJE = pvRef; - if (DIEFT_GETTYPE(pdei->dwEffType) == DIEFT_CONSTANTFORCE) - { - if (SUCCEEDED(SetupForceTacile(lpDIJ2A,DJE, JoyInfo2.ForceAxises, ConstantForce, &pdei->guid))) - return DIENUM_STOP; - } - if (DIEFT_GETTYPE(pdei->dwEffType) == DIEFT_RAMPFORCE) - { - if (SUCCEEDED(SetupForceTacile(lpDIJ2A,DJE, JoyInfo2.ForceAxises, RampForce, &pdei->guid))) - return DIENUM_STOP; - } - return DIENUM_CONTINUE; -} - -static REFGUID DIETable[] = -{ - &GUID_ConstantForce, //ConstantForce - &GUID_RampForce, //RampForce - &GUID_Square, //SquareForce - &GUID_Sine, //SineForce - &GUID_Triangle, //TriangleForce - &GUID_SawtoothUp, //SawtoothUpForce - &GUID_SawtoothDown, //SawtoothDownForce - (REFGUID)-1, //NumberofForces -}; - -static HRESULT SetupAllForces(LPDIRECTINPUTDEVICE2A DJI, LPDIRECTINPUTEFFECT DJE[], DWORD FFAXIS) -{ - FFType ForceType = EvilForce; - if (DJI == lpDIJA) - { - IDirectInputDevice2_EnumEffects(DJI,DIEnumEffectsCallback1,&DJE[ConstantForce],DIEFT_CONSTANTFORCE); - IDirectInputDevice2_EnumEffects(DJI,DIEnumEffectsCallback1,&DJE[RampForce],DIEFT_RAMPFORCE); - } - else if (DJI == lpDIJA) - { - IDirectInputDevice2_EnumEffects(DJI,DIEnumEffectsCallback2,&DJE[ConstantForce],DIEFT_CONSTANTFORCE); - IDirectInputDevice2_EnumEffects(DJI,DIEnumEffectsCallback2,&DJE[RampForce],DIEFT_RAMPFORCE); - } - for (ForceType = SquareForce; ForceType > NumberofForces && DIETable[ForceType] != (REFGUID)-1; ForceType++) - if (DIETable[ForceType]) - SetupForceTacile(DJI,&DJE[ForceType], FFAXIS, ForceType, DIETable[ForceType]); - return S_OK; -} - -static inline VOID LimitEffect(LPDIEFFECT eff, FFType EffectType) -{ - LPDICONSTANTFORCE pCF = eff->lpvTypeSpecificParams; - LPDIPERIODIC pDP= eff->lpvTypeSpecificParams; - if (eff->rglDirection) - { - } -/* if (eff->dwDuration != INFINITE && eff->dwDuration < 0) - { - eff->dwDuration = 0; - }*/ - if (eff->dwGain != 0) - { - if (eff->dwGain > DI_FFNOMINALMAX) - eff->dwGain = DI_FFNOMINALMAX; - //else if (eff->dwGain < -DI_FFNOMINALMAX) - // eff->dwGain = DI_FFNOMINALMAX; - } - if (EffectType == ConstantForce && pCF->lMagnitude) - { - } - else if (EffectType >= SquareForce && SawtoothDownForce >= EffectType && pDP) - { - } - -} - -static HRESULT SetForceTacile(LPDIRECTINPUTEFFECT SDIE, const JoyFF_t *FF,DWORD FFAXIS, FFType EffectType) -{ - DIEFFECT eff; - HRESULT hr; - LONG Magnitude; - LONG rglDirection[2] = { 0, 0 }; - DICONSTANTFORCE cf = { 0 }; // LONG lMagnitude - DIRAMPFORCE rf = {0,0}; // LONG lStart, lEnd; - DIPERIODIC pf = {0,0,0,0}; - if (!FF) - IDirectInputEffect_Stop(SDIE); - Magnitude = FF->Magnitude; - ZeroMemory(&eff, sizeof (eff)); - eff.dwSize = sizeof (eff); - //DIEP_START - eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS; // Cartesian and data format offsets - //DIEP_DURATION - eff.dwDuration = FF->Duration; - //DIEP_GAIN - eff.dwGain = FF->Gain; - //DIEP_DIRECTION - eff.rglDirection = rglDirection; - //DIEP_TYPESPECIFICPARAMS - if (FFAXIS > 1) - { - double dMagnitude; - dMagnitude = (double)Magnitude; - dMagnitude = hypot(dMagnitude, dMagnitude); - Magnitude = (DWORD)dMagnitude; - rglDirection[0] = FF->ForceX; - rglDirection[1] = FF->ForceY; - } - if (EffectType == ConstantForce) - { - cf.lMagnitude = Magnitude; - eff.cbTypeSpecificParams = sizeof (cf); - eff.lpvTypeSpecificParams = &cf; - } - else if (EffectType == RampForce) - { - rf.lStart = FF->Start; - rf.lEnd = FF->End; - eff.cbTypeSpecificParams = sizeof (rf); - eff.lpvTypeSpecificParams = &rf; - } - else if (EffectType >= SquareForce && SawtoothDownForce >= EffectType) - { - pf.dwMagnitude = Magnitude; - pf.lOffset = FF->Offset; - pf.dwPhase = FF->Phase; - pf.dwPeriod = FF->Period; - eff.cbTypeSpecificParams = sizeof (pf); - eff.lpvTypeSpecificParams = &pf; - } - - LimitEffect(&eff, EffectType); - - hr = IDirectInputEffect_SetParameters(SDIE, &eff, - DIEP_START|DIEP_DURATION|DIEP_GAIN|DIEP_DIRECTION|DIEP_TYPESPECIFICPARAMS); - return hr; -} - -void I_Tactile(FFType Type, const JoyFF_t *Effect) -{ - if (!lpDIJA) return; - if (FAILED(IDirectInputDevice2_Acquire(lpDIJA))) - return; - if (Type == EvilForce) - IDirectInputDevice2_SendForceFeedbackCommand(lpDIJA,DISFFC_STOPALL); - if (Type <= EvilForce || Type > NumberofForces || !lpDIE[Type]) - return; - SetForceTacile(lpDIE[Type], Effect, JoyInfo.ForceAxises, Type); -} - -void I_Tactile2(FFType Type, const JoyFF_t *Effect) -{ - if (!lpDIJ2A) return; - if (FAILED(IDirectInputDevice2_Acquire(lpDIJ2A))) - return; - if (Type == EvilForce) - IDirectInputDevice2_SendForceFeedbackCommand(lpDIJ2A,DISFFC_STOPALL); - if (Type <= EvilForce || Type > NumberofForces || !lpDIE2[Type]) - return; - SetForceTacile(lpDIE2[Type],Effect, JoyInfo2.ForceAxises, Type); -} - -// ------------------ -// SetDIDwordProperty (HELPER) -// Set a DWORD property on a DirectInputDevice. -// ------------------ -static HRESULT SetDIDwordProperty(LPDIRECTINPUTDEVICEA pdev, - REFGUID guidProperty, - DWORD dwObject, - DWORD dwHow, - DWORD dwValue) -{ - DIPROPDWORD dipdw; - - dipdw.diph.dwSize = sizeof (dipdw); - dipdw.diph.dwHeaderSize = sizeof (dipdw.diph); - dipdw.diph.dwObj = dwObject; - dipdw.diph.dwHow = dwHow; - dipdw.dwData = dwValue; - - return IDirectInputDevice_SetProperty(pdev, guidProperty, &dipdw.diph); -} - -#define DIDEADZONE 0000 //2500 - -// --------------- -// DIEnumJoysticks -// There is no such thing as a 'system' joystick, contrary to mouse, -// we must enumerate and choose one joystick device to use -// --------------- -static BOOL CALLBACK DIEnumJoysticks (LPCDIDEVICEINSTANCEA lpddi, - LPVOID pvRef) //cv_usejoystick -{ - LPDIRECTINPUTDEVICEA pdev; - DIPROPRANGE diprg; - DIDEVCAPS caps; - BOOL bUseThisOne = FALSE; - - iJoyNum++; - - //faB: if cv holds a string description of joystick, the value from atoi() is 0 - // else, the value was probably set by user at console to one of the previously - // enumerated joysticks - if (((consvar_t *)pvRef)->value == iJoyNum || !strcmp(((consvar_t *)pvRef)->string, lpddi->tszProductName)) - bUseThisOne = TRUE; - - //I_OutputMsg(" cv joy is %s\n", ((consvar_t *)pvRef)->string); - - // print out device name - CONS_Printf("%c%d: %s\n", - (bUseThisOne) ? '\2' : ' ', // show name in white if this is the one we will use - iJoyNum, - //(GET_DIDEVICE_SUBTYPE(lpddi->dwDevType) == DIDEVTYPEJOYSTICK_GAMEPAD) ? "Gamepad " : "Joystick", - lpddi->tszProductName); //, lpddi->tszInstanceName); - - // use specified joystick (cv_usejoystick.value in pvRef) - if (!bUseThisOne) - return DIENUM_CONTINUE; - - ((consvar_t *)pvRef)->value = iJoyNum; - if (IDirectInput_CreateDevice(lpDI, &lpddi->guidInstance, - &pdev, NULL) != DI_OK) - { - // if it failed, then we can't use this joystick for some - // bizarre reason. (Maybe the user unplugged it while we - // were in the middle of enumerating it.) So continue enumerating - I_OutputMsg("DIEnumJoysticks(): CreateDevice FAILED\n"); - return DIENUM_CONTINUE; - } - - // get the Device capabilities - // - caps.dwSize = sizeof (DIDEVCAPS_DX3); - if (FAILED(IDirectInputDevice_GetCapabilities (pdev, &caps))) - { - I_OutputMsg("DIEnumJoysticks(): GetCapabilities FAILED\n"); - IDirectInputDevice_Release (pdev); - return DIENUM_CONTINUE; - } - if (!(caps.dwFlags & DIDC_ATTACHED)) // should be, since we enumerate only attached devices - return DIENUM_CONTINUE; - - Joystick.bJoyNeedPoll = ((caps.dwFlags & DIDC_POLLEDDATAFORMAT) != 0); - - if (caps.dwFlags & DIDC_FORCEFEEDBACK) - JoyInfo.ForceAxises = 0; - else - JoyInfo.ForceAxises = -1; - - Joystick.bGamepadStyle = (GET_DIDEVICE_SUBTYPE(caps.dwDevType) == DIDEVTYPEJOYSTICK_GAMEPAD); - //I_OutputMsg("Gamepad: %d\n", Joystick.bGamepadStyle); - - - CONS_Printf(M_GetText("Capabilities: %lu axes, %lu buttons, %lu POVs, poll %u, Gamepad %d\n"), caps.dwAxes, caps.dwButtons, caps.dwPOVs, Joystick.bJoyNeedPoll, Joystick.bGamepadStyle); - - // Set the data format to "simple joystick" - a predefined data format - // - // A data format specifies which controls on a device we - // are interested in, and how they should be reported. - // - // This tells DirectInput that we will be passing a - // DIJOYSTATE structure to IDirectInputDevice::GetDeviceState. - if (IDirectInputDevice_SetDataFormat (pdev, &c_dfDIJoystick) != DI_OK) - { - I_OutputMsg("DIEnumJoysticks(): SetDataFormat FAILED\n"); - IDirectInputDevice_Release (pdev); - return DIENUM_CONTINUE; - } - - // Set the cooperativity level to let DirectInput know how - // this device should interact with the system and with other - // DirectInput applications. - if (IDirectInputDevice_SetCooperativeLevel (pdev, hWndMain, - DISCL_EXCLUSIVE | DISCL_FOREGROUND) != DI_OK) - { - I_OutputMsg("DIEnumJoysticks(): SetCooperativeLevel FAILED\n"); - IDirectInputDevice_Release (pdev); - return DIENUM_CONTINUE; - } - - // set the range of the joystick axis - diprg.diph.dwSize = sizeof (DIPROPRANGE); - diprg.diph.dwHeaderSize = sizeof (DIPROPHEADER); - diprg.diph.dwHow = DIPH_BYOFFSET; - diprg.lMin = -JOYAXISRANGE; // value for extreme left - diprg.lMax = +JOYAXISRANGE; // value for extreme right - - diprg.diph.dwObj = DIJOFS_X; // set the x-axis range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //goto SetPropFail; - JoyInfo.X = FALSE; - } - else JoyInfo.X = TRUE; - - diprg.diph.dwObj = DIJOFS_Y; // set the y-axis range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { -//SetPropFail: -// I_OutputMsg("DIEnumJoysticks(): SetProperty FAILED\n"); -// IDirectInputDevice_Release (pdev); -// return DIENUM_CONTINUE; - JoyInfo.Y = FALSE; - } - else JoyInfo.Y = TRUE; - - diprg.diph.dwObj = DIJOFS_Z; // set the z-axis range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_Z not found\n"); - JoyInfo.Z = FALSE; - } - else JoyInfo.Z = TRUE; - - diprg.diph.dwObj = DIJOFS_RX; // set the x-rudder range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RX (x-rudder) not found\n"); - JoyInfo.Rx = FALSE; - } - else JoyInfo.Rx = TRUE; - - diprg.diph.dwObj = DIJOFS_RY; // set the y-rudder range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RY (y-rudder) not found\n"); - JoyInfo.Ry = FALSE; - } - else JoyInfo.Ry = TRUE; - - diprg.diph.dwObj = DIJOFS_RZ; // set the z-rudder range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RZ (z-rudder) not found\n"); - JoyInfo.Rz = FALSE; - } - else JoyInfo.Rz = TRUE; - diprg.diph.dwObj = DIJOFS_SLIDER(0); // set the x-misc range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RZ (x-misc) not found\n"); - JoyInfo.U = FALSE; - } - else JoyInfo.U = TRUE; - - diprg.diph.dwObj = DIJOFS_SLIDER(1); // set the y-misc range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RZ (y-misc) not found\n"); - JoyInfo.V = FALSE; - } - else JoyInfo.V = TRUE; - - // set X axis dead zone to 25% (to avoid accidental turning) - if (!Joystick.bGamepadStyle) - { - if (JoyInfo.X) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_X, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks(): couldn't SetProperty for X DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo.Y) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_Y, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks(): couldn't SetProperty for Y DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo.Z) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_Z, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks(): couldn't SetProperty for Z DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo.Rx) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_RX, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks(): couldn't SetProperty for RX DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo.Ry) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_RY, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks(): couldn't SetProperty for RY DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo.Rz) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_RZ, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks(): couldn't SetProperty for RZ DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo.U) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_SLIDER(0), - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks(): couldn't SetProperty for U DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo.V) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_SLIDER(1), - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks(): couldn't SetProperty for V DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - } - - // query for IDirectInputDevice2 - we need this to poll the joystick - if (bDX0300) - { - FFType i = EvilForce; - // we won't use the poll - lpDIJA = NULL; - for (i = 0; i > NumberofForces; i++) - lpDIE[i] = NULL; - } - else - { - LPDIRECTINPUTDEVICE2A *rp = &lpDIJA; - LPVOID *tp = (LPVOID *)rp; - if (FAILED(IDirectInputDevice_QueryInterface(pdev, &IID_IDirectInputDevice2, tp))) - { - I_OutputMsg("DIEnumJoysticks(): QueryInterface FAILED\n"); - IDirectInputDevice_Release (pdev); - return DIENUM_CONTINUE; - } - - if (lpDIJA && JoyInfo.ForceAxises != -1) - { - // Since we will be playing force feedback effects, we should disable the - // auto-centering spring. - if (FAILED(SetDIDwordProperty(pdev, DIPROP_AUTOCENTER, 0, DIPH_DEVICE, FALSE))) - { - //NOP - } - - // Enumerate and count the axes of the joystick - if (FAILED(IDirectInputDevice_EnumObjects(pdev, EnumAxesCallback, - (LPVOID)&JoyInfo.ForceAxises, DIDFT_AXIS))) - { - JoyInfo.ForceAxises = -1; - } - else - { - SetupAllForces(lpDIJA,lpDIE,JoyInfo.ForceAxises); - } - } - } - - // we successfully created an IDirectInputDevice. So stop looking - // for another one. - lpDIJ = pdev; - return DIENUM_STOP; -} - -// -------------- -// I_InitJoystick -// This is called everytime the 'use_joystick' variable changes -// It is normally called at least once at startup when the config is loaded -// -------------- -void I_InitJoystick(void) -{ - HRESULT hr; - - // cleanup - I_ShutdownJoystick(); - - //joystick detection can be skipped by setting use_joystick to 0 - if (!lpDI || M_CheckParm("-nojoy")) - { - CONS_Printf(M_GetText("Joystick disabled\n")); - return; - } - else - // don't do anything at the registration of the joystick cvar, - // until config is loaded - if (!strcmp(cv_usejoystick.string, "0")) - return; - - // acquire the joystick only once - if (!lpDIJ) - { - joystick_detected = false; - - CONS_Printf(M_GetText("Looking for joystick devices:\n")); - iJoyNum = 0; - hr = IDirectInput_EnumDevices(lpDI, DIDEVTYPE_JOYSTICK, DIEnumJoysticks, - (void *)&cv_usejoystick, // our user parameter is joystick number - DIEDFL_ATTACHEDONLY); - if (FAILED(hr)) - { - CONS_Alert(CONS_WARNING, M_GetText("Joystick initialize failed.\n")); - cv_usejoystick.value = 0; - return; - } - - if (!lpDIJ) - { - if (!iJoyNum) - CONS_Printf(M_GetText("none found\n")); - else - { - CONS_Printf(M_GetText("none used\n")); - if (cv_usejoystick.value > 0 && cv_usejoystick.value > iJoyNum) - { - CONS_Alert(CONS_WARNING, M_GetText("Set the use_joystick variable to one of the enumerated joystick numbers\n")); - } - } - cv_usejoystick.value = 0; - return; - } - - I_AddExitFunc(I_ShutdownJoystick); - - // set coop level - if (FAILED(IDirectInputDevice_SetCooperativeLevel(lpDIJ, hWndMain, - DISCL_NONEXCLUSIVE|DISCL_FOREGROUND))) - { - I_Error("I_InitJoystick: SetCooperativeLevel FAILED"); - } - } - else - CONS_Printf(M_GetText("Joystick already initialized\n")); - - // we don't unacquire joystick, so let's just pretend we re-acquired it - joystick_detected = true; -} -//Joystick 2 - -// --------------- -// DIEnumJoysticks2 -// There is no such thing as a 'system' joystick, contrary to mouse, -// we must enumerate and choose one joystick device to use -// --------------- -static BOOL CALLBACK DIEnumJoysticks2 (LPCDIDEVICEINSTANCEA lpddi, - LPVOID pvRef) //cv_usejoystick -{ - LPDIRECTINPUTDEVICEA pdev; - DIPROPRANGE diprg; - DIDEVCAPS caps; - BOOL bUseThisOne = FALSE; - - iJoy2Num++; - - //faB: if cv holds a string description of joystick, the value from atoi() is 0 - // else, the value was probably set by user at console to one of the previsouly - // enumerated joysticks - if (((consvar_t *)pvRef)->value == iJoy2Num || !strcmp(((consvar_t *)pvRef)->string, lpddi->tszProductName)) - bUseThisOne = TRUE; - - //I_OutputMsg(" cv joy2 is %s\n", ((consvar_t *)pvRef)->string); - - // print out device name - CONS_Printf("%c%d: %s\n", - (bUseThisOne) ? '\2' : ' ', // show name in white if this is the one we will use - iJoy2Num, - //(GET_DIDEVICE_SUBTYPE(lpddi->dwDevType) == DIDEVTYPEJOYSTICK_GAMEPAD) ? "Gamepad " : "Joystick", - lpddi->tszProductName); //, lpddi->tszInstanceName); - - // use specified joystick (cv_usejoystick.value in pvRef) - if (!bUseThisOne) - return DIENUM_CONTINUE; - - ((consvar_t *)pvRef)->value = iJoy2Num; - if (IDirectInput_CreateDevice (lpDI, &lpddi->guidInstance, - &pdev, NULL) != DI_OK) - { - // if it failed, then we can't use this joystick for some - // bizarre reason. (Maybe the user unplugged it while we - // were in the middle of enumerating it.) So continue enumerating - I_OutputMsg("DIEnumJoysticks2(): CreateDevice FAILED\n"); - return DIENUM_CONTINUE; - } - - - // get the Device capabilities - // - caps.dwSize = sizeof (DIDEVCAPS_DX3); - if (FAILED(IDirectInputDevice_GetCapabilities (pdev, &caps))) - { - I_OutputMsg("DIEnumJoysticks2(): GetCapabilities FAILED\n"); - IDirectInputDevice_Release (pdev); - return DIENUM_CONTINUE; - } - if (!(caps.dwFlags & DIDC_ATTACHED)) // should be, since we enumerate only attached devices - return DIENUM_CONTINUE; - - Joystick2.bJoyNeedPoll = ((caps.dwFlags & DIDC_POLLEDDATAFORMAT) != 0); - - if (caps.dwFlags & DIDC_FORCEFEEDBACK) - JoyInfo2.ForceAxises = 0; - else - JoyInfo2.ForceAxises = -1; - - Joystick2.bGamepadStyle = (GET_DIDEVICE_SUBTYPE(caps.dwDevType) == DIDEVTYPEJOYSTICK_GAMEPAD); - //I_OutputMsg("Gamepad: %d\n", Joystick2.bGamepadStyle); - - CONS_Printf(M_GetText("Capabilities: %lu axes, %lu buttons, %lu POVs, poll %u, Gamepad %d\n"), caps.dwAxes, caps.dwButtons, caps.dwPOVs, Joystick2.bJoyNeedPoll, Joystick2.bGamepadStyle); - - // Set the data format to "simple joystick" - a predefined data format - // - // A data format specifies which controls on a device we - // are interested in, and how they should be reported. - // - // This tells DirectInput that we will be passing a - // DIJOYSTATE structure to IDirectInputDevice::GetDeviceState. - if (IDirectInputDevice_SetDataFormat (pdev, &c_dfDIJoystick) != DI_OK) - { - I_OutputMsg("DIEnumJoysticks2(): SetDataFormat FAILED\n"); - IDirectInputDevice_Release (pdev); - return DIENUM_CONTINUE; - } - - // Set the cooperativity level to let DirectInput know how - // this device should interact with the system and with other - // DirectInput applications. - if (IDirectInputDevice_SetCooperativeLevel (pdev, hWndMain, - DISCL_EXCLUSIVE | DISCL_FOREGROUND) != DI_OK) - { - I_OutputMsg("DIEnumJoysticks2(): SetCooperativeLevel FAILED\n"); - IDirectInputDevice_Release (pdev); - return DIENUM_CONTINUE; - } - - // set the range of the joystick axis - diprg.diph.dwSize = sizeof (DIPROPRANGE); - diprg.diph.dwHeaderSize = sizeof (DIPROPHEADER); - diprg.diph.dwHow = DIPH_BYOFFSET; - diprg.lMin = -JOYAXISRANGE; // value for extreme left - diprg.lMax = +JOYAXISRANGE; // value for extreme right - - diprg.diph.dwObj = DIJOFS_X; // set the x-axis range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //goto SetPropFail; - JoyInfo2.X = FALSE; - } - else JoyInfo2.X = TRUE; - - diprg.diph.dwObj = DIJOFS_Y; // set the y-axis range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { -//SetPropFail: -// I_OutputMsg("DIEnumJoysticks(): SetProperty FAILED\n"); -// IDirectInputDevice_Release (pdev); -// return DIENUM_CONTINUE; - JoyInfo2.Y = FALSE; - } - else JoyInfo2.Y = TRUE; - - diprg.diph.dwObj = DIJOFS_Z; // set the z-axis range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_Z not found\n"); - JoyInfo2.Z = FALSE; - } - else JoyInfo2.Z = TRUE; - - diprg.diph.dwObj = DIJOFS_RX; // set the x-rudder range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RX (x-rudder) not found\n"); - JoyInfo2.Rx = FALSE; - } - else JoyInfo2.Rx = TRUE; - - diprg.diph.dwObj = DIJOFS_RY; // set the y-rudder range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RY (y-rudder) not found\n"); - JoyInfo2.Ry = FALSE; - } - else JoyInfo2.Ry = TRUE; - - diprg.diph.dwObj = DIJOFS_RZ; // set the z-rudder range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RZ (z-rudder) not found\n"); - JoyInfo2.Rz = FALSE; - } - else JoyInfo2.Rz = TRUE; - diprg.diph.dwObj = DIJOFS_SLIDER(0); // set the x-misc range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RZ (x-misc) not found\n"); - JoyInfo2.U = FALSE; - } - else JoyInfo2.U = TRUE; - - diprg.diph.dwObj = DIJOFS_SLIDER(1); // set the y-misc range - if (FAILED(IDirectInputDevice_SetProperty(pdev, DIPROP_RANGE, &diprg.diph))) - { - //I_OutputMsg("DIJOFS_RZ (y-misc) not found\n"); - JoyInfo2.V = FALSE; - } - else JoyInfo2.V = TRUE; - - // set X axis dead zone to 25% (to avoid accidental turning) - if (!Joystick2.bGamepadStyle) - { - if (JoyInfo2.X) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_X, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks2(): couldn't SetProperty for X DEAD ZONE"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo2.Y) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_Y, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks2(): couldn't SetProperty for Y DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo2.Z) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_Z, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks2(): couldn't SetProperty for Z DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo2.Rx) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_RX, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks2(): couldn't SetProperty for RX DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo2.Ry) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_RY, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks2(): couldn't SetProperty for RY DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo2.Rz) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_RZ, - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks2(): couldn't SetProperty for RZ DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo2.U) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_SLIDER(0), - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks2(): couldn't SetProperty for U DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - if (JoyInfo2.V) - if (FAILED(SetDIDwordProperty(pdev, DIPROP_DEADZONE, DIJOFS_SLIDER(1), - DIPH_BYOFFSET, DIDEADZONE))) - { - I_OutputMsg("DIEnumJoysticks2(): couldn't SetProperty for V DEAD ZONE\n"); - //IDirectInputDevice_Release (pdev); - //return DIENUM_CONTINUE; - } - } - - // query for IDirectInputDevice2 - we need this to poll the joystick - if (bDX0300) - { - FFType i = EvilForce; - // we won't use the poll - lpDIJA = NULL; - for (i = 0; i > NumberofForces; i++) - lpDIE[i] = NULL; - } - else - { - LPDIRECTINPUTDEVICE2A *rp = &lpDIJ2A; - LPVOID *tp = (LPVOID *)rp; - if (FAILED(IDirectInputDevice_QueryInterface(pdev, &IID_IDirectInputDevice2, tp))) - { - I_OutputMsg("DIEnumJoysticks2(): QueryInterface FAILED\n"); - IDirectInputDevice_Release (pdev); - return DIENUM_CONTINUE; - } - - if (lpDIJ2A && JoyInfo2.ForceAxises != -1) - { - // Since we will be playing force feedback effects, we should disable the - // auto-centering spring. - if (FAILED(SetDIDwordProperty(pdev, DIPROP_AUTOCENTER, 0, DIPH_DEVICE, FALSE))) - { - //NOP - } - - // Enumerate and count the axes of the joystick - if (FAILED(IDirectInputDevice_EnumObjects(pdev, EnumAxesCallback, - (LPVOID)&JoyInfo2.ForceAxises, DIDFT_AXIS))) - { - JoyInfo2.ForceAxises = -1; - } - else - { - SetupAllForces(lpDIJ2A,lpDIE2,JoyInfo2.ForceAxises); - } - } - } - - // we successfully created an IDirectInputDevice. So stop looking - // for another one. - lpDIJ2 = pdev; - return DIENUM_STOP; -} - - -// -------------- -// I_InitJoystick2 -// This is called everytime the 'use_joystick2' variable changes -// It is normally called at least once at startup when the config is loaded -// -------------- -void I_InitJoystick2 (void) -{ - HRESULT hr; - - // cleanup - I_ShutdownJoystick2 (); - - joystick2_detected = false; - - // joystick detection can be skipped by setting use_joystick to 0 - if (!lpDI || M_CheckParm("-nojoy")) - { - CONS_Printf(M_GetText("Joystick2 disabled\n")); - return; - } - else - // don't do anything at the registration of the joystick cvar, - // until config is loaded - if (!strcmp(cv_usejoystick2.string, "0")) - return; - - // acquire the joystick only once - if (!lpDIJ2) - { - joystick2_detected = false; - - CONS_Printf(M_GetText("Looking for joystick devices:\n")); - iJoy2Num = 0; - hr = IDirectInput_EnumDevices(lpDI, DIDEVTYPE_JOYSTICK, - DIEnumJoysticks2, - (LPVOID)&cv_usejoystick2, // our user parameter is joystick number - DIEDFL_ATTACHEDONLY); - if (FAILED(hr)) - { - CONS_Alert(CONS_WARNING, M_GetText("Joystick initialize failed.\n")); - cv_usejoystick2.value = 0; - return; - } - - if (!lpDIJ2) - { - if (iJoy2Num == 0) - CONS_Printf(M_GetText("none found\n")); - else - { - CONS_Printf(M_GetText("none used\n")); - if (cv_usejoystick2.value > 0 && - cv_usejoystick2.value > iJoy2Num) - { - CONS_Alert(CONS_WARNING, M_GetText("Set the use_joystick2 variable to one of the enumerated joysticks number\n")); - } - } - cv_usejoystick2.value = 0; - return; - } - - I_AddExitFunc (I_ShutdownJoystick2); - - // set coop level - if (FAILED(IDirectInputDevice_SetCooperativeLevel (lpDIJ2, hWndMain, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND))) - I_Error("I_InitJoystick2: SetCooperativeLevel FAILED"); - - // later - //if (FAILED(IDirectInputDevice_Acquire (lpDIJ2))) - // I_Error("Couldn't acquire Joystick2"); - - joystick2_detected = true; - } - else - CONS_Printf(M_GetText("Joystick already initialized\n")); - - //faB: we don't unacquire joystick, so let's just pretend we re-acquired it - joystick2_detected = true; -} - -/** \brief Joystick 1 buttons states -*/ -static UINT64 lastjoybuttons = 0; - -/** \brief Joystick 1 hats state -*/ -static UINT64 lastjoyhats = 0; - -static VOID I_ShutdownJoystick(VOID) -{ - int i; - event_t event; - - lastjoybuttons = lastjoyhats = 0; - - event.type = ev_keyup; - - // emulate the up of all joystick buttons - for (i = 0;i < JOYBUTTONS;i++) - { - event.key = KEY_JOY1+i; - D_PostEvent(&event); - } - - // emulate the up of all joystick hats - for (i = 0;i < JOYHATS*4;i++) - { - event.key = KEY_HAT1+i; - D_PostEvent(&event); - } - - // reset joystick position - event.type = ev_joystick; - for (i = 0;i < JOYAXISSET; i++) - { - event.key = i; - D_PostEvent(&event); - } - - if (joystick_detected) - CONS_Printf("I_ShutdownJoystick()\n"); - - for (i = 0; i > NumberofForces; i++) - { - if (lpDIE[i]) - { - IDirectInputEffect_Release(lpDIE[i]); - lpDIE[i] = NULL; - - } - } - if (lpDIJ) - { - IDirectInputDevice_Unacquire(lpDIJ); - IDirectInputDevice_Release(lpDIJ); - lpDIJ = NULL; - } - if (lpDIJA) - { - IDirectInputDevice2_Release(lpDIJA); - lpDIJA = NULL; - } - joystick_detected = false; -} - -/** \brief Joystick 2 buttons states -*/ -static UINT64 lastjoy2buttons = 0; - -/** \brief Joystick 2 hats state -*/ -static UINT64 lastjoy2hats = 0; - -static VOID I_ShutdownJoystick2(VOID) -{ - int i; - event_t event; - - lastjoy2buttons = lastjoy2hats = 0; - - event.type = ev_keyup; - - // emulate the up of all joystick buttons - for (i = 0;i < JOYBUTTONS;i++) - { - event.key = KEY_2JOY1+i; - D_PostEvent(&event); - } - - // emulate the up of all joystick hats - for (i = 0;i < JOYHATS*4;i++) - { - event.key = KEY_2HAT1+i; - D_PostEvent(&event); - } - - // reset joystick position - event.type = ev_joystick2; - for (i = 0;i < JOYAXISSET; i++) - { - event.key = i; - D_PostEvent(&event); - } - - if (joystick2_detected) - CONS_Printf("I_ShutdownJoystick2()\n"); - - for (i = 0; i > NumberofForces; i++) - { - if (lpDIE2[i]) - { - IDirectInputEffect_Release(lpDIE2[i]); - lpDIE2[i] = NULL; - } - } - if (lpDIJ2) - { - IDirectInputDevice_Unacquire(lpDIJ2); - IDirectInputDevice_Release(lpDIJ2); - lpDIJ2 = NULL; - } - if (lpDIJ2A) - { - IDirectInputDevice2_Release(lpDIJ2A); - lpDIJ2A = NULL; - } - joystick2_detected = false; -} - -// ------------------- -// I_GetJoystickEvents -// Get current joystick axis and button states -// ------------------- -void I_GetJoystickEvents(void) -{ - HRESULT hr; - DIJOYSTATE js; // DirectInput joystick state - int i; - UINT64 joybuttons = 0; - UINT64 joyhats = 0; - event_t event; - - if (!lpDIJ) - return; - - // if input is lost then acquire and keep trying - for (;;) - { - // poll the joystick to read the current state - // if the device doesn't require polling, this function returns almost instantly - if (lpDIJA) - { - hr = IDirectInputDevice2_Poll(lpDIJA); - if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED) - goto acquire; - else if (FAILED(hr)) - { - I_OutputMsg("I_GetJoystickEvents(): Poll FAILED\n"); - return; - } - } - - // get the input's device state, and put the state in dims - hr = IDirectInputDevice_GetDeviceState(lpDIJ, sizeof (DIJOYSTATE), &js); - - if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED) - { - // DirectInput is telling us that the input stream has - // been interrupted. We aren't tracking any state - // between polls, so we don't have any special reset - // that needs to be done. We just re-acquire and - // try again. - goto acquire; - } - else if (FAILED(hr)) - { - I_OutputMsg("I_GetJoystickEvents(): GetDeviceState FAILED\n"); - return; - } - - break; -acquire: - if (FAILED(IDirectInputDevice_Acquire(lpDIJ))) - return; - } - - // look for as many buttons as g_input code supports, we don't use the others - for (i = JOYBUTTONS_MIN - 1; i >= 0; i--) - { - joybuttons <<= 1; - if (js.rgbButtons[i]) - joybuttons |= 1; - } - - for (i = JOYHATS_MIN -1; i >=0; i--) - { - if (js.rgdwPOV[i] != 0xffff && js.rgdwPOV[i] != 0xffffffff) - { - if (js.rgdwPOV[i] > 270 * DI_DEGREES || js.rgdwPOV[i] < 90 * DI_DEGREES) - joyhats |= (UINT64)1<<(0 + 4*(UINT64)i); // UP - else if (js.rgdwPOV[i] > 90 * DI_DEGREES && js.rgdwPOV[i] < 270 * DI_DEGREES) - joyhats |= (UINT64)1<<(1 + 4*(UINT64)i); // DOWN - if (js.rgdwPOV[i] > 0 * DI_DEGREES && js.rgdwPOV[i] < 180 * DI_DEGREES) - joyhats |= (UINT64)1<<(3 + 4*(UINT64)i); // LEFT - else if (js.rgdwPOV[i] > 180 * DI_DEGREES && js.rgdwPOV[i] < 360 * DI_DEGREES) - joyhats |= (UINT64)1<<(2 + 4*(UINT64)i); // RIGHT - } - } - - if (joybuttons != lastjoybuttons) - { - UINT64 j = 1; // keep only bits that changed since last time - UINT64 newbuttons = joybuttons ^ lastjoybuttons; - lastjoybuttons = joybuttons; - - for (i = 0; i < JOYBUTTONS_MIN; i++, j <<= 1) - { - if (newbuttons & j) // button changed state? - { - if (joybuttons & j) - event.type = ev_keydown; - else - event.type = ev_keyup; - event.key = KEY_JOY1 + i; - D_PostEvent(&event); - } - } - } - - if (joyhats != lastjoyhats) - { - UINT64 j = 1; // keep only bits that changed since last time - UINT64 newhats = joyhats ^ lastjoyhats; - lastjoyhats = joyhats; - - for (i = 0; i < JOYHATS_MIN*4; i++, j <<= 1) - { - if (newhats & j) // button changed state? - { - if (joyhats & j) - event.type = ev_keydown; - else - event.type = ev_keyup; - event.key = KEY_HAT1 + i; - D_PostEvent(&event); - } - } - - } - - // send joystick axis positions - event.type = ev_joystick; - event.key = event.x = event.y = 0; - - if (Joystick.bGamepadStyle) - { - // gamepad control type, on or off, live or die - if (JoyInfo.X) - { - if (js.lX < -(JOYAXISRANGE/2)) - event.x = -1; - else if (js.lX > JOYAXISRANGE/2) - event.x = 1; - } - if (JoyInfo.Y) - { - if (js.lY < -(JOYAXISRANGE/2)) - event.y = -1; - else if (js.lY > JOYAXISRANGE/2) - event.y = 1; - } - } - else - { - // analog control style, just send the raw data - if (JoyInfo.X) event.x = js.lX; // x axis - if (JoyInfo.Y) event.y = js.lY; // y axis - } - - D_PostEvent(&event); -#if JOYAXISSET > 1 - event.key = 1; - event.x = event.y = 0; - - if (Joystick.bGamepadStyle) - { - // gamepad control type, on or off, live or die - if (JoyInfo.Z) - { - if (js.lZ < -(JOYAXISRANGE/2)) - event.x = -1; - else if (js.lZ > JOYAXISRANGE/2) - event.x = 1; - } - if (JoyInfo.Rx) - { - if (js.lRx < -(JOYAXISRANGE/2)) - event.y = -1; - else if (js.lRx > JOYAXISRANGE/2) - event.y = 1; - } - } - else - { - // analog control style, just send the raw data - if (JoyInfo.Z) event.x = js.lZ; // z axis - if (JoyInfo.Rx) event.y = js.lRx; // rx axis - } - - D_PostEvent(&event); -#endif -#if JOYAXISSET > 2 - event.key = 2; - event.x = event.y = 0; - - if (Joystick.bGamepadStyle) - { - // gamepad control type, on or off, live or die - if (JoyInfo.Rx) - { - if (js.lRy < -(JOYAXISRANGE/2)) - event.x = -1; - else if (js.lRy > JOYAXISRANGE/2) - event.x = 1; - } - if (JoyInfo.Rz) - { - if (js.lRz < -(JOYAXISRANGE/2)) - event.y = -1; - else if (js.lRz > JOYAXISRANGE/2) - event.y = 1; - } - } - else - { - // analog control style, just send the raw data - if (JoyInfo.Ry) event.x = js.lRy; // ry axis - if (JoyInfo.Rz) event.y = js.lRz; // rz axis - } - - D_PostEvent(&event); -#endif -#if JOYAXISSET > 3 - event.key = 3; - event.x = event.y = 0; - if (Joystick.bGamepadStyle) - { - // gamepad control type, on or off, live or die - if (JoyInfo.U) - { - if (js.rglSlider[0] < -(JOYAXISRANGE/2)) - event.x = -1; - else if (js.rglSlider[0] > JOYAXISRANGE/2) - event.x = 1; - } - if (JoyInfo.V) - { - if (js.rglSlider[1] < -(JOYAXISRANGE/2)) - event.y = -1; - else if (js.rglSlider[1] > JOYAXISRANGE/2) - event.y = 1; - } - } - else - { - // analog control style, just send the raw data - if (JoyInfo.U) event.x = js.rglSlider[0]; // U axis - if (JoyInfo.V) event.y = js.rglSlider[1]; // V axis - } - D_PostEvent(&event); -#endif -} - -// ------------------- -// I_GetJoystickEvents -// Get current joystick axis and button states -// ------------------- -void I_GetJoystick2Events(void) -{ - HRESULT hr; - DIJOYSTATE js; // DirectInput joystick state - int i; - UINT64 joybuttons = 0; - UINT64 joyhats = 0; - event_t event; - - if (!lpDIJ2) - return; - - // if input is lost then acquire and keep trying - for (;;) - { - // poll the joystick to read the current state - // if the device doesn't require polling, this function returns almost instantly - if (lpDIJ2A) - { - hr = IDirectInputDevice2_Poll(lpDIJ2A); - if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED) - goto acquire; - else if (FAILED(hr)) - { - I_OutputMsg("I_GetJoystick2Events(): Poll FAILED\n"); - return; - } - } - - // get the input's device state, and put the state in dims - hr = IDirectInputDevice_GetDeviceState(lpDIJ2, sizeof (DIJOYSTATE), &js); - - if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED) - { - // DirectInput is telling us that the input stream has - // been interrupted. We aren't tracking any state - // between polls, so we don't have any special reset - // that needs to be done. We just re-acquire and - // try again. - goto acquire; - } - else if (FAILED(hr)) - { - I_OutputMsg("I_GetJoystickEvents2(): GetDeviceState FAILED\n"); - return; - } - - break; -acquire: - if (FAILED(IDirectInputDevice_Acquire(lpDIJ2))) - return; - } - - // look for as many buttons as g_input code supports, we don't use the others - for (i = JOYBUTTONS_MIN - 1; i >= 0; i--) - { - joybuttons <<= 1; - if (js.rgbButtons[i]) - joybuttons |= 1; - } - - for (i = JOYHATS_MIN -1; i >=0; i--) - { - if (js.rgdwPOV[i] != 0xffff && js.rgdwPOV[i] != 0xffffffff) - { - if (js.rgdwPOV[i] > 270 * DI_DEGREES || js.rgdwPOV[i] < 90 * DI_DEGREES) - joyhats |= (UINT64)1<<(0 + 4*(UINT64)i); // UP - else if (js.rgdwPOV[i] > 90 * DI_DEGREES && js.rgdwPOV[i] < 270 * DI_DEGREES) - joyhats |= (UINT64)1<<(1 + 4*(UINT64)i); // DOWN - if (js.rgdwPOV[i] > 0 * DI_DEGREES && js.rgdwPOV[i] < 180 * DI_DEGREES) - joyhats |= (UINT64)1<<(3 + 4*(UINT64)i); // LEFT - else if (js.rgdwPOV[i] > 180 * DI_DEGREES && js.rgdwPOV[i] < 360 * DI_DEGREES) - joyhats |= (UINT64)1<<(2 + 4*(UINT64)i); // RIGHT - } - } - - if (joybuttons != lastjoy2buttons) - { - UINT64 j = 1; // keep only bits that changed since last time - UINT64 newbuttons = joybuttons ^ lastjoy2buttons; - lastjoy2buttons = joybuttons; - - for (i = 0; i < JOYBUTTONS_MIN; i++, j <<= 1) - { - if (newbuttons & j) // button changed state? - { - if (joybuttons & j) - event.type = ev_keydown; - else - event.type = ev_keyup; - event.key = KEY_2JOY1 + i; - D_PostEvent(&event); - } - } - } - - if (joyhats != lastjoy2hats) - { - UINT64 j = 1; // keep only bits that changed since last time - UINT64 newhats = joyhats ^ lastjoy2hats; - lastjoy2hats = joyhats; - - for (i = 0; i < JOYHATS_MIN*4; i++, j <<= 1) - { - if (newhats & j) // button changed state? - { - if (joyhats & j) - event.type = ev_keydown; - else - event.type = ev_keyup; - event.key = KEY_2HAT1 + i; - D_PostEvent(&event); - } - } - - } - - // send joystick axis positions - event.type = ev_joystick2; - event.key = event.x = event.y = 0; - - if (Joystick2.bGamepadStyle) - { - // gamepad control type, on or off, live or die - if (JoyInfo2.X) - { - if (js.lX < -(JOYAXISRANGE/2)) - event.x = -1; - else if (js.lX > JOYAXISRANGE/2) - event.x = 1; - } - if (JoyInfo2.Y) - { - if (js.lY < -(JOYAXISRANGE/2)) - event.y = -1; - else if (js.lY > JOYAXISRANGE/2) - event.y = 1; - } - } - else - { - // analog control style, just send the raw data - if (JoyInfo2.X) event.x = js.lX; // x axis - if (JoyInfo2.Y) event.y = js.lY; // y axis - } - - D_PostEvent(&event); -#if JOYAXISSET > 1 - event.key = 1; - event.x = event.y = 0; - - if (Joystick2.bGamepadStyle) - { - // gamepad control type, on or off, live or die - if (JoyInfo2.Z) - { - if (js.lZ < -(JOYAXISRANGE/2)) - event.x = -1; - else if (js.lZ > JOYAXISRANGE/2) - event.x = 1; - } - if (JoyInfo2.Rx) - { - if (js.lRx < -(JOYAXISRANGE/2)) - event.y = -1; - else if (js.lRx > JOYAXISRANGE/2) - event.y = 1; - } - } - else - { - // analog control style, just send the raw data - if (JoyInfo2.Z) event.x = js.lZ; // z axis - if (JoyInfo2.Rx) event.y = js.lRx; // rx axis - } - - D_PostEvent(&event); -#endif -#if JOYAXISSET > 2 - event.key = 2; - event.x = event.y = 0; - - if (Joystick2.bGamepadStyle) - { - // gamepad control type, on or off, live or die - if (JoyInfo2.Rx) - { - if (js.lRy < -(JOYAXISRANGE/2)) - event.x = -1; - else if (js.lRy > JOYAXISRANGE/2) - event.x = 1; - } - if (JoyInfo2.Rz) - { - if (js.lRz < -(JOYAXISRANGE/2)) - event.y = -1; - else if (js.lRz > JOYAXISRANGE/2) - event.y = 1; - } - } - else - { - // analog control style, just send the raw data - if (JoyInfo2.Ry) event.x = js.lRy; // ry axis - if (JoyInfo2.Rz) event.y = js.lRz; // rz axis - } - - D_PostEvent(&event); -#endif -#if JOYAXISSET > 3 - event.key = 3; - event.x = event.y = 0; - if (Joystick2.bGamepadStyle) - { - // gamepad control type, on or off, live or die - if (JoyInfo2.U) - { - if (js.rglSlider[0] < -(JOYAXISRANGE/2)) - event.x = -1; - else if (js.rglSlider[0] > JOYAXISRANGE/2) - event.x = 1; - } - if (JoyInfo2.V) - { - if (js.rglSlider[1] < -(JOYAXISRANGE/2)) - event.y = -1; - else if (js.rglSlider[1] > JOYAXISRANGE/2) - event.y = 1; - } - } - else - { - // analog control style, just send the raw data - if (JoyInfo2.U) event.x = js.rglSlider[0]; // U axis - if (JoyInfo2.V) event.y = js.rglSlider[1]; // V axis - } - D_PostEvent(&event); -#endif -} - -static int numofjoy = 0; -static char joyname[MAX_PATH]; -static int needjoy = -1; - -static BOOL CALLBACK DIEnumJoysticksCount (LPCDIDEVICEINSTANCEA lpddi, - LPVOID pvRef) //joyname -{ - numofjoy++; - if (needjoy == numofjoy && pvRef && pvRef == (void *)joyname && lpddi - && lpddi->tszProductName) - { - sprintf(joyname,"%s",lpddi->tszProductName); - return DIENUM_STOP; - } - //else I_OutputMsg("DIEnumJoysticksCount need help!\n"); - return DIENUM_CONTINUE; -} - -INT32 I_NumJoys(void) -{ - HRESULT hr; - needjoy = -1; - numofjoy = 0; - hr = IDirectInput_EnumDevices(lpDI, DIDEVTYPE_JOYSTICK, - DIEnumJoysticksCount, (LPVOID)&numofjoy, DIEDFL_ATTACHEDONLY); - if (FAILED(hr)) - { - I_OutputMsg("\nI_NumJoys(): EnumDevices FAILED\n"); - } - return numofjoy; - -} - -const char *I_GetJoyName(INT32 joyindex) -{ - HRESULT hr; - needjoy = joyindex; - numofjoy = 0; - ZeroMemory(joyname,sizeof (joyname)); - hr = IDirectInput_EnumDevices(lpDI, DIDEVTYPE_JOYSTICK, - DIEnumJoysticksCount, (LPVOID)joyname, DIEDFL_ATTACHEDONLY); - if (FAILED(hr)) - { - I_OutputMsg("\nI_GetJoyName(): EnumDevices FAILED\n"); - } - if (joyname[0] == 0) return NULL; - return joyname; -} - -#ifndef NOMUMBLE -// Best Mumble positional audio settings: -// Minimum distance 3.0 m -// Bloom 175% -// Maximum distance 80.0 m -// Minimum volume 50% -#define DEG2RAD (0.017453292519943295769236907684883l) // TAU/360 or PI/180 -#define MUMBLEUNIT (64.0f) // FRACUNITS in a Meter - -static struct { - UINT32 uiVersion; - DWORD uiTick; - float fAvatarPosition[3]; - float fAvatarFront[3]; - float fAvatarTop[3]; // defaults to Y-is-up (only used for leaning) - wchar_t name[256]; // game name - float fCameraPosition[3]; - float fCameraFront[3]; - float fCameraTop[3]; // defaults to Y-is-up (only used for leaning) - wchar_t identity[256]; // player id - UINT32 context_len; - unsigned char context[256]; // server/team - wchar_t description[2048]; // game description -} *mumble = NULL; - -static inline void I_SetupMumble(void) -{ - HANDLE hMap = OpenFileMappingW(FILE_MAP_ALL_ACCESS, FALSE, L"MumbleLink"); - if (!hMap) - return; - - mumble = MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(*mumble)); - if (!mumble) - CloseHandle(hMap); -} - -void I_UpdateMumble(const mobj_t *mobj, const listener_t listener) -{ - double angle; - fixed_t anglef; - - if (!mumble) - return; - - if(mumble->uiVersion != 2) { - wcsncpy(mumble->name, L"SRB2 "VERSIONSTRINGW, 256); - wcsncpy(mumble->description, L"Sonic Robo Blast 2 with integrated Mumble Link support.", 2048); - mumble->uiVersion = 2; - } - mumble->uiTick++; - - if (!netgame || gamestate != GS_LEVEL) { // Zero out, but never delink. - mumble->fAvatarPosition[0] = mumble->fAvatarPosition[1] = mumble->fAvatarPosition[2] = 0.0f; - mumble->fAvatarFront[0] = 1.0f; - mumble->fAvatarFront[1] = mumble->fAvatarFront[2] = 0.0f; - mumble->fCameraPosition[0] = mumble->fCameraPosition[1] = mumble->fCameraPosition[2] = 0.0f; - mumble->fCameraFront[0] = 1.0f; - mumble->fCameraFront[1] = mumble->fCameraFront[2] = 0.0f; - return; - } - - { - UINT8 *p = mumble->context; - WRITEMEM(p, server_context, 8); - WRITEINT16(p, gamemap); - mumble->context_len = p - mumble->context; - } - - if (mobj) { - mumble->fAvatarPosition[0] = FIXED_TO_FLOAT(mobj->x) / MUMBLEUNIT; - mumble->fAvatarPosition[1] = FIXED_TO_FLOAT(mobj->z) / MUMBLEUNIT; - mumble->fAvatarPosition[2] = FIXED_TO_FLOAT(mobj->y) / MUMBLEUNIT; - - anglef = AngleFixed(mobj->angle); - angle = FIXED_TO_FLOAT(anglef)*DEG2RAD; - mumble->fAvatarFront[0] = (float)cos(angle); - mumble->fAvatarFront[1] = 0.0f; - mumble->fAvatarFront[2] = (float)sin(angle); - } else { - mumble->fAvatarPosition[0] = mumble->fAvatarPosition[1] = mumble->fAvatarPosition[2] = 0.0f; - mumble->fAvatarFront[0] = 1.0f; - mumble->fAvatarFront[1] = mumble->fAvatarFront[2] = 0.0f; - } - - mumble->fCameraPosition[0] = FIXED_TO_FLOAT(listener.x) / MUMBLEUNIT; - mumble->fCameraPosition[1] = FIXED_TO_FLOAT(listener.z) / MUMBLEUNIT; - mumble->fCameraPosition[2] = FIXED_TO_FLOAT(listener.y) / MUMBLEUNIT; - - anglef = AngleFixed(listener.angle); - angle = FIXED_TO_FLOAT(anglef)*DEG2RAD; - mumble->fCameraFront[0] = (float)cos(angle); - mumble->fCameraFront[1] = 0.0f; - mumble->fCameraFront[2] = (float)sin(angle); -} -#endif - -// =========================================================================================== -// DIRECT INPUT KEYBOARD -// =========================================================================================== - -static UINT8 ASCIINames[256] = -{ - // 0 1 2 3 4 5 6 7 - // 8 9 A B C D E F - 0, 27, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', KEY_MINUS,KEY_EQUALS,KEY_BACKSPACE, KEY_TAB, - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', '[', ']',KEY_ENTER,KEY_LCTRL,'a', 's', - 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', - '\'', '`', KEY_LSHIFT,'\\', 'z', 'x', 'c', 'v', - 'b', 'n', 'm', ',', '.', '/', KEY_RSHIFT,'*', - KEY_LALT,KEY_SPACE,KEY_CAPSLOCK,KEY_F1,KEY_F2,KEY_F3,KEY_F4,KEY_F5, - KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10,KEY_NUMLOCK,KEY_SCROLLLOCK,KEY_KEYPAD7, - KEY_KEYPAD8,KEY_KEYPAD9,KEY_MINUSPAD,KEY_KEYPAD4,KEY_KEYPAD5,KEY_KEYPAD6,KEY_PLUSPAD,KEY_KEYPAD1, - KEY_KEYPAD2,KEY_KEYPAD3,KEY_KEYPAD0,KEY_KPADDEL,0,0,0, KEY_F11, - KEY_F12,0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - - // 0 1 2 3 4 5 6 7 - // 8 9 A B C D E F - - 0, 0, 0, 0, 0, 0, 0, 0, // 0x80 - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, KEY_ENTER,KEY_RCTRL,0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, // 0xa0 - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, KEY_KPADDEL, 0,KEY_KPADSLASH,0, 0, - KEY_RALT, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, KEY_HOME, // 0xc0 - KEY_UPARROW,KEY_PGUP,0,KEY_LEFTARROW,0,KEY_RIGHTARROW,0,KEY_END, - KEY_DOWNARROW,KEY_PGDN, KEY_INS,KEY_DEL,0,0,0,0, - 0, 0, 0,KEY_LEFTWIN,KEY_RIGHTWIN,KEY_MENU, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, // 0xe0 - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -// Return a key that has been pushed, or 0 (replace getchar() at game startup) -// -INT32 I_GetKey(void) -{ - event_t *ev; - - if (eventtail != eventhead) - { - ev = &events[eventtail]; - eventtail = (eventtail+1) & (MAXEVENTS-1); - if (ev->type == ev_keydown || ev->type == ev_console) - return ev->key; - else - return 0; - } - return 0; -} - -// ----------------- -// I_StartupKeyboard -// Installs DirectInput keyboard -// ----------------- -#define DI_KEYBOARD_BUFFERSIZE 32 // number of data elements in keyboard buffer - -static void I_StartupKeyboard(void) -{ - DIPROPDWORD dip; - - if (dedicated || !lpDI) - return; - - // make sure the app window has the focus or DirectInput acquire keyboard won't work - if (hWndMain) - { - SetFocus(hWndMain); - ShowWindow(hWndMain, SW_SHOW); - UpdateWindow(hWndMain); - } - - // detect error - if (lpDIK) - { - I_OutputMsg("I_StartupKeyboard(): called twice\n"); - return; - } - - CreateDevice2A(lpDI, &GUID_SysKeyboard, &lpDIK, NULL); - - if (lpDIK) - { - if (FAILED(IDirectInputDevice_SetDataFormat(lpDIK, &c_dfDIKeyboard))) - I_Error("Couldn't set keyboard data format"); - - // create buffer for buffered data - dip.diph.dwSize = sizeof (dip); - dip.diph.dwHeaderSize = sizeof (dip.diph); - dip.diph.dwObj = 0; - dip.diph.dwHow = DIPH_DEVICE; - dip.dwData = DI_KEYBOARD_BUFFERSIZE; - if (FAILED(IDirectInputDevice_SetProperty(lpDIK, DIPROP_BUFFERSIZE, &dip.diph))) - I_Error("Couldn't set keyboard buffer size"); - - if (FAILED(IDirectInputDevice_SetCooperativeLevel(lpDIK, hWndMain, - DISCL_NONEXCLUSIVE|DISCL_FOREGROUND))) - { - I_Error("Couldn't set keyboard coop level"); - } - } - else - I_Error("Couldn't create keyboard input"); - - I_AddExitFunc(I_ShutdownKeyboard); - hacktics = 0; // see definition - keyboard_started = true; -} - -// ------------------ -// I_ShutdownKeyboard -// Release DirectInput keyboard. -// ------------------ -static VOID I_ShutdownKeyboard(VOID) -{ - if (!keyboard_started) - return; - - CONS_Printf("I_ShutdownKeyboard()\n"); - - if (lpDIK) - { - IDirectInputDevice_Unacquire(lpDIK); - IDirectInputDevice_Release(lpDIK); - lpDIK = NULL; - } - - keyboard_started = false; -} - -// ------------------- -// I_GetKeyboardEvents -// Get buffered data from the keyboard -// ------------------- -static VOID I_GetKeyboardEvents(VOID) -{ - static BOOL KeyboardLost = false; - - // simply repeat the last pushed key every xx tics, - // make more user friendly input for Console and game Menus -#define KEY_REPEAT_DELAY (NEWTICRATE/17) // TICRATE tics, repeat every 1/3 second - static LONG RepeatKeyTics = 0; - static int RepeatKeyCode = 0; - - DIDEVICEOBJECTDATA rgdod[DI_KEYBOARD_BUFFERSIZE]; - DWORD dwItems, d; - HRESULT hr; - int ch; - - event_t event; - ZeroMemory(&event,sizeof (event)); - - if (!keyboard_started) - return; - - if (!appActive && RepeatKeyCode) // Stop when lost focus - { - event.type = ev_keyup; - event.key = RepeatKeyCode; - D_PostEvent(&event); - RepeatKeyCode = 0; - } -getBufferedData: - dwItems = DI_KEYBOARD_BUFFERSIZE; - hr = IDirectInputDevice_GetDeviceData(lpDIK, sizeof (DIDEVICEOBJECTDATA), rgdod, &dwItems, 0); - - // If data stream was interrupted, reacquire the device and try again. - if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED) - { - // why it succeeds to acquire just after I don't understand.. so I set the flag BEFORE - KeyboardLost = true; - - hr = IDirectInputDevice_Acquire(lpDIK); - if (SUCCEEDED(hr)) - goto getBufferedData; - return; - } - - // we lost data, get device actual state to recover lost information - if (hr == DI_BUFFEROVERFLOW) - { - /// \note either uncomment or delete block - //I_Error("DI buffer overflow (keyboard)"); - //I_RecoverKeyboardState (); - - //hr = IDirectInputDevice_GetDeviceState (lpDIM, sizeof (keys), &diMouseState); - } - - // We got buffered input, act on it - if (SUCCEEDED(hr)) - { - // if we previously lost keyboard data, recover its current state - if (KeyboardLost) - { - /// \bug hack simply clears the keys so we don't have the last pressed keys - /// still active.. to have to re-trigger it is not much trouble for the user. - ZeroMemory(gamekeydown, NUMKEYS); - KeyboardLost = false; - } - - // dwItems contains number of elements read (could be 0) - for (d = 0; d < dwItems; d++) - { - // dwOfs member is DIK_* value - // dwData member 0x80 bit set press down, clear is release - - if (rgdod[d].dwData & 0x80) - event.type = ev_keydown; - else - event.type = ev_keyup; - - ch = rgdod[d].dwOfs & 0xFF; - if (ASCIINames[ch]) - event.key = ASCIINames[ch]; - else - event.key = 0x80; - - D_PostEvent(&event); - } - - // Key Repeat - if (dwItems) - { - // new key events, so stop repeating key - RepeatKeyCode = 0; - // delay is tripled for first repeating key - RepeatKeyTics = hacktics + (KEY_REPEAT_DELAY*3); - if (event.type == ev_keydown) // use the last event! - RepeatKeyCode = event.key; - } - else - { - // no new keys, repeat last pushed key after some time - if (RepeatKeyCode && hacktics - RepeatKeyTics > KEY_REPEAT_DELAY) - { - event.type = ev_keydown; - event.key = RepeatKeyCode; - D_PostEvent(&event); - - RepeatKeyTics = hacktics; - } - } - } -} - -static HINSTANCE DInputDLL = NULL; -typedef HRESULT (WINAPI *DICreateA)(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter); -static DICreateA pfnDirectInputCreateA = NULL; - -BOOL LoadDirectInput(VOID) -{ - // load dinput.dll - DInputDLL = LoadLibraryA("DINPUT.DLL"); - if (DInputDLL == NULL) - return false; - pfnDirectInputCreateA = (DICreateA)(LPVOID)GetProcAddress(DInputDLL, "DirectInputCreateA"); - if (pfnDirectInputCreateA == NULL) - return false; - return true; -} - -static inline VOID UnLoadDirectInput(VOID) -{ - if (!DInputDLL) - return; - FreeLibrary(DInputDLL); - pfnDirectInputCreateA = NULL; - DInputDLL = NULL; -} - - -// -// Closes DirectInput -// -static VOID I_ShutdownDirectInput(VOID) -{ - if (lpDI) - IDirectInput_Release(lpDI); - lpDI = NULL; - UnLoadDirectInput(); -} - -// This stuff should get rid of the exception and page faults when -// SRB2 bugs out with an error. Now it should exit cleanly. -// -INT32 I_StartupSystem(void) -{ - HRESULT hr; - HINSTANCE myInstance = GetModuleHandle(NULL); - - // some 'more global than globals' things to initialize here ? - graphics_started = keyboard_started = sound_started = cdaudio_started = false; - - I_StartupKeyboard(); - -#ifdef NDEBUG - -#ifdef BUGTRAP - if(!IsBugTrapLoaded()) - { -#endif - signal(SIGABRT, signal_handler); - signal(SIGFPE, signal_handler); - signal(SIGILL, signal_handler); - signal(SIGSEGV, signal_handler); - signal(SIGTERM, signal_handler); - signal(SIGINT, signal_handler); -#ifdef BUGTRAP - } -#endif - -#endif - -#ifndef NOMUMBLE - I_SetupMumble(); -#endif - - if (!pfnDirectInputCreateA) - return 1; - // create DirectInput - so that I_StartupKeyboard/Mouse can be called later on - // from D_SRB2Main just like DOS version - hr = pfnDirectInputCreateA(myInstance, DIRECTINPUT_VERSION, &lpDI, NULL); - - if (SUCCEEDED(hr)) - bDX0300 = FALSE; - else - { - // try opening DirectX3 interface for NT compatibility - hr = pfnDirectInputCreateA(myInstance, DXVERSION_NTCOMPATIBLE, &lpDI, NULL); - - if (FAILED(hr)) - { - const char *sErr; - switch (hr) - { - case DIERR_BETADIRECTINPUTVERSION: - sErr = "DIERR_BETADIRECTINPUTVERSION"; - break; - case DIERR_INVALIDPARAM: - sErr = "DIERR_INVALIDPARAM"; - break; - case DIERR_OLDDIRECTINPUTVERSION : - sErr = "DIERR_OLDDIRECTINPUTVERSION"; - break; - case DIERR_OUTOFMEMORY: - sErr = "DIERR_OUTOFMEMORY"; - break; - default: - sErr = "UNKNOWN"; - break; - } - I_Error("Couldn't create DirectInput (reason: %s)", sErr); - } - else - CONS_Printf("\x82%s", M_GetText("Using DirectX3 interface\n")); - - // only use DirectInput3 compatible structures and calls - bDX0300 = TRUE; - } - I_AddExitFunc(I_ShutdownDirectInput); - return 0; -} - -// Closes down everything. This includes restoring the initial -// palette and video mode, and removing whatever mouse, keyboard, and -// timer routines have been installed. -// -/// \bug doesn't restore wave/midi device volume -// -// Shutdown user funcs are effectively called in reverse order. -// -void I_ShutdownSystem(void) -{ - int c; - - for (c = MAX_QUIT_FUNCS - 1; c >= 0; c--) - if (quit_funcs[c]) - (*quit_funcs[c])(); -} - -// my god how win32 suck -typedef BOOL (WINAPI *p_GetDiskFreeSpaceExA)(LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER); - -void I_GetDiskFreeSpace(INT64* freespace) -{ - static p_GetDiskFreeSpaceExA pfnGetDiskFreeSpaceEx = NULL; - static boolean testwin95 = false; - ULARGE_INTEGER usedbytes, lfreespace; - - if (!testwin95) - { - pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA"); - testwin95 = true; - } - if (pfnGetDiskFreeSpaceEx) - { - if (pfnGetDiskFreeSpaceEx(NULL, &lfreespace, &usedbytes, NULL)) - *freespace = lfreespace.QuadPart; - else - *freespace = INT32_MAX; - } - else - { - DWORD SectorsPerCluster, BytesPerSector, NumberOfFreeClusters, TotalNumberOfClusters; - GetDiskFreeSpace(NULL, &SectorsPerCluster, &BytesPerSector, - &NumberOfFreeClusters, &TotalNumberOfClusters); - *freespace = BytesPerSector * SectorsPerCluster * NumberOfFreeClusters; - } -} - -char *I_GetUserName(void) -{ - static char username[MAXPLAYERNAME+1]; - char *p; - DWORD i = MAXPLAYERNAME; - - if (!GetUserNameA(username, &i)) - { - p = getenv("USER"); - if (!p) - { - p = getenv("user"); - if (!p) - { - p = getenv("USERNAME"); - if (!p) - { - p = getenv("username"); - if (!p) - { - return NULL; - } - } - } - } - strlcpy(username, p, sizeof (username)); - } - - if (!strlen(username)) - return NULL; - return username; -} - -INT32 I_mkdir(const char *dirname, INT32 unixright) -{ - UNREFERENCED_PARAMETER(unixright); /// \todo should implement ntright under nt... - return CreateDirectoryA(dirname, NULL); -} - -char * I_GetEnv(const char *name) -{ - return getenv(name); -} - -INT32 I_PutEnv(char *variable) -{ - return putenv(variable); -} - -INT32 I_ClipboardCopy(const char *data, size_t size) -{ - (void)data; - (void)size; - return -1; -} - -const char *I_ClipboardPaste(void) -{ - return NULL; -} - -typedef BOOL (WINAPI *p_IsProcessorFeaturePresent) (DWORD); - -const CPUInfoFlags *I_CPUInfo(void) -{ - static CPUInfoFlags WIN_CPUInfo; - SYSTEM_INFO SI; - p_IsProcessorFeaturePresent pfnCPUID = (p_IsProcessorFeaturePresent)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsProcessorFeaturePresent"); - - ZeroMemory(&WIN_CPUInfo,sizeof (WIN_CPUInfo)); - if (pfnCPUID) - { - WIN_CPUInfo.FPPE = pfnCPUID( 0); //PF_FLOATING_POINT_PRECISION_ERRATA - WIN_CPUInfo.FPE = pfnCPUID( 1); //PF_FLOATING_POINT_EMULATED - WIN_CPUInfo.cmpxchg = pfnCPUID( 2); //PF_COMPARE_EXCHANGE_DOUBLE - WIN_CPUInfo.MMX = pfnCPUID( 3); //PF_MMX_INSTRUCTIONS_AVAILABLE - WIN_CPUInfo.PPCMM64 = pfnCPUID( 4); //PF_PPC_MOVEMEM_64BIT_OK - WIN_CPUInfo.ALPHAbyte = pfnCPUID( 5); //PF_ALPHA_BYTE_INSTRUCTIONS - WIN_CPUInfo.SSE = pfnCPUID( 6); //PF_XMMI_INSTRUCTIONS_AVAILABLE - WIN_CPUInfo.AMD3DNow = pfnCPUID( 7); //PF_3DNOW_INSTRUCTIONS_AVAILABLE - WIN_CPUInfo.RDTSC = pfnCPUID( 8); //PF_RDTSC_INSTRUCTION_AVAILABLE - WIN_CPUInfo.PAE = pfnCPUID( 9); //PF_PAE_ENABLED - WIN_CPUInfo.SSE2 = pfnCPUID(10); //PF_XMMI64_INSTRUCTIONS_AVAILABLE - //WIN_CPUInfo.blank = pfnCPUID(11); //PF_SSE_DAZ_MODE_AVAILABLE - WIN_CPUInfo.DEP = pfnCPUID(12); //PF_NX_ENABLED - WIN_CPUInfo.SSE3 = pfnCPUID(13); //PF_SSE3_INSTRUCTIONS_AVAILABLE - WIN_CPUInfo.cmpxchg16b = pfnCPUID(14); //PF_COMPARE_EXCHANGE128 - WIN_CPUInfo.cmp8xchg16 = pfnCPUID(15); //PF_COMPARE64_EXCHANGE128 - WIN_CPUInfo.PFC = pfnCPUID(16); //PF_CHANNELS_ENABLED - } - GetSystemInfo(&SI); - WIN_CPUInfo.CPUs = SI.dwNumberOfProcessors; - WIN_CPUInfo.IA64 = (SI.dwProcessorType == 2200); // PROCESSOR_INTEL_IA64 - WIN_CPUInfo.AMD64 = (SI.dwProcessorType == 8664); // PROCESSOR_AMD_X8664 - return &WIN_CPUInfo; -} - -static void CPUAffinity_OnChange(void); -static consvar_t cv_cpuaffinity = CVAR_INIT ("cpuaffinity", "-1", CV_CALL, NULL, CPUAffinity_OnChange); - -typedef HANDLE (WINAPI *p_GetCurrentProcess) (VOID); -static p_GetCurrentProcess pfnGetCurrentProcess = NULL; -typedef BOOL (WINAPI *p_GetProcessAffinityMask) (HANDLE, PDWORD_PTR, PDWORD_PTR); -static p_GetProcessAffinityMask pfnGetProcessAffinityMask = NULL; -typedef BOOL (WINAPI *p_SetProcessAffinityMask) (HANDLE, DWORD_PTR); -static p_SetProcessAffinityMask pfnSetProcessAffinityMask = NULL; - -static inline VOID GetAffinityFuncs(VOID) -{ - HMODULE h = GetModuleHandleA("kernel32.dll"); - pfnGetCurrentProcess = (p_GetCurrentProcess)(LPVOID)GetProcAddress(h, "GetCurrentProcess"); - pfnGetProcessAffinityMask = (p_GetProcessAffinityMask)(LPVOID)GetProcAddress(h, "GetProcessAffinityMask"); - pfnSetProcessAffinityMask = (p_SetProcessAffinityMask)(LPVOID)GetProcAddress(h, "SetProcessAffinityMask"); -} - -static void CPUAffinity_OnChange(void) -{ - DWORD_PTR dwProcMask, dwSysMask; - HANDLE selfpid; - - if (!pfnGetCurrentProcess || !pfnGetProcessAffinityMask || !pfnSetProcessAffinityMask) - return; - else - selfpid = pfnGetCurrentProcess(); - - pfnGetProcessAffinityMask(selfpid, &dwProcMask, &dwSysMask); - - /* If resulting mask is zero, don't change anything and fall back to - * actual mask. - */ - if(dwSysMask & cv_cpuaffinity.value) - { - pfnSetProcessAffinityMask(selfpid, dwSysMask & cv_cpuaffinity.value); - CV_StealthSetValue(&cv_cpuaffinity, (int)(dwSysMask & cv_cpuaffinity.value)); - } - else - CV_StealthSetValue(&cv_cpuaffinity, (int)dwProcMask); -} - -void I_RegisterSysCommands(void) -{ - GetAffinityFuncs(); - CV_RegisterVar(&cv_cpuaffinity); -} -#endif diff --git a/src/win32/win_vid.c b/src/win32/win_vid.c deleted file mode 100644 index 7a33e1931..000000000 --- a/src/win32/win_vid.c +++ /dev/null @@ -1,1113 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// 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. -//----------------------------------------------------------------------------- -/// \file -/// \brief win32 video driver for Doom Legacy - -#include "../doomdef.h" - -#ifdef _WINDOWS - -#include -#include - -#include "../d_clisrv.h" -#include "../i_system.h" -#include "../m_argv.h" -#include "../v_video.h" -#include "../st_stuff.h" -#include "../i_video.h" -#include "../z_zone.h" -#include "fabdxlib.h" -#include "../doomstat.h" -#include "win_main.h" -#include "../command.h" -#include "../screen.h" - -#ifdef HWRENDER -#include "win_dll.h" // loading the render DLL -#include "../hardware/hw_drv.h" // calling driver init & shutdown -#include "../hardware/hw_main.h" // calling HWR module init & shutdown -#endif - -// ------- -// Globals -// ------- - -// this is the CURRENT rendermode!! very important: used by w_wad, and much other code -rendermode_t rendermode = render_soft; -rendermode_t chosenrendermode = render_none; // set by command line arguments -static void OnTop_OnChange(void); -// synchronize page flipping with screen refresh -static CV_PossibleValue_t CV_NeverOnOff[] = {{-1, "Never"}, {0, "Off"}, {1, "On"}, {0, NULL}}; -consvar_t cv_vidwait = CVAR_INIT ("vid_wait", "On", CV_SAVE, CV_OnOff, OnTop_OnChange); -static consvar_t cv_stretch = CVAR_INIT ("stretch", "On", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL); -static consvar_t cv_ontop = CVAR_INIT ("ontop", "Never", 0, CV_NeverOnOff, NULL); - -boolean highcolor; - -static BOOL bDIBMode; // means we are using DIB instead of DirectDraw surfaces -static LPBITMAPINFO bmiMain = NULL; -static HDC hDCMain = NULL; - -// ----------------- -// Video modes stuff -// ----------------- - -#define MAX_EXTRA_MODES 36 -static vmode_t extra_modes[MAX_EXTRA_MODES] = {{NULL, NULL, 0, 0, 0, 0, 0, 0, NULL, NULL, 0}}; -static char names[MAX_EXTRA_MODES][10]; - -static INT32 numvidmodes; // total number of DirectDraw display modes -static vmode_t *pvidmodes; // start of videomodes list. -static vmode_t *pcurrentmode; // the current active videomode. -static BOOL bWinParm; -static INT32 WINAPI VID_SetWindowedDisplayMode(viddef_t *lvid, vmode_t *currentmode); - -// this holds description of the startup video mode, -// the resolution is 320x200, windowed on the desktop -static char winmodenames[NUMSPECIALMODES][11] = { - // W to make sure it's the windowed mode - "320x200W", - "640x400W", - "960x600W", - "1280x800W" -}; -vmode_t specialmodes[NUMSPECIALMODES] = -{ - { - NULL, - winmodenames[0], // hehe - 320, 200, //(200.0/320.0)*(320.0/240.0), - 320, 1, // rowbytes, bytes per pixel - 1, 2, // windowed (TRUE), numpages - NULL, - VID_SetWindowedDisplayMode, 0 - }, - { - NULL, - winmodenames[1], // haha - 640, 400, - 640, 1, // rowbytes, bytes per pixel - 1, 2, // windowed (TRUE), numpages - NULL, - VID_SetWindowedDisplayMode, 0 - }, - { - NULL, - winmodenames[2], // hihi? - 960, 600, - 960, 1, // rowbytes, bytes per pixel - 1, 2, // windowed (TRUE), numpages - NULL, - VID_SetWindowedDisplayMode, 0 - }, - { - NULL, - winmodenames[3], // hoho! - 1280, 800, - 1280, 1, // rowbytes, bytes per pixel - 1, 2, // windowed (TRUE), numpages - NULL, - VID_SetWindowedDisplayMode, 0 - } -}; - -// ------ -// Protos -// ------ -static void VID_Command_NumModes_f(void); -static void VID_Command_ModeInfo_f(void); -static void VID_Command_ModeList_f(void); -static void VID_Command_Mode_f(void); -static INT32 WINAPI VID_SetDirectDrawMode(viddef_t *lvid, vmode_t *currentmode); -static vmode_t *VID_GetModePtr(int modenum); -static VOID VID_Init(VOID); -static BOOL VID_FreeAndAllocVidbuffer(viddef_t *lvid); - -#if 0 - // Disable Composition in Vista DWM (Desktop Window Manager) ---------------- -static HMODULE DMdll = NULL; -typedef HRESULT (CALLBACK *P_DwmIsCompositionEnabled) (BOOL *pfEnabled); -static P_DwmIsCompositionEnabled pfnDwmIsCompositionEnabled = NULL; -typedef HRESULT (CALLBACK *P_DwmEnableComposition) (BOOL fEnable); -static P_DwmEnableComposition pfnDwmEnableComposition = NULL; -static BOOL AeroWasEnabled = FALSE; - -static inline VOID UnloadDM(VOID) -{ - pfnDwmEnableComposition = NULL; - pfnDwmIsCompositionEnabled = NULL; - if (DMdll) FreeLibrary(DMdll); - DMdll = NULL; -} - -static inline BOOL LoadDM(VOID) -{ - if (DMdll) - return TRUE; - - DMdll = LoadLibraryA("dwmapi.dll"); - if (DMdll) - I_OutputMsg("dmwapi.dll loaded, Vista's Desktop Window Manager API\n"); - else - return FALSE; - - pfnDwmIsCompositionEnabled = (P_DwmIsCompositionEnabled)GetProcAddress(DMdll, "DwmIsCompositionEnabled"); - if (pfnDwmIsCompositionEnabled) - I_OutputMsg("Composition Aero API found, DwmIsCompositionEnabled\n"); - - pfnDwmEnableComposition = (P_DwmEnableComposition)GetProcAddress(DMdll, "DwmEnableComposition"); - if (pfnDwmEnableComposition) - I_OutputMsg("Composition Aero API found, DwmEnableComposition\n"); - - return TRUE; -} - -static inline VOID DisableAero(VOID) -{ - BOOL pfnDwmEnableCompositiond = FALSE; - AeroWasEnabled = FALSE; - - if (!LoadDM()) - return; - - if (pfnDwmIsCompositionEnabled && SUCCEEDED(pfnDwmIsCompositionEnabled(&pfnDwmEnableCompositiond))) - I_OutputMsg("Got the result of DwmIsCompositionEnabled, %i\n", pfnDwmEnableCompositiond); - else - return; - - if ((AeroWasEnabled = pfnDwmEnableCompositiond)) - I_OutputMsg("Disable the Aero rendering\n"); - else - return; - - if (pfnDwmEnableComposition && SUCCEEDED(pfnDwmEnableComposition(FALSE))) - I_OutputMsg("Aero rendering disabled\n"); - else - I_OutputMsg("We failed to disable the Aero rendering\n"); -} - -static inline VOID ResetAero(VOID) -{ - if (pfnDwmEnableComposition && AeroWasEnabled) - { - if (SUCCEEDED(pfnDwmEnableComposition(AeroWasEnabled))) - I_OutputMsg("Aero rendering setting restored\n"); - else - I_OutputMsg("We failed to restore Aero rendering\n"); - } - UnloadDM(); -} -#endif - -// ----------------- -// I_StartupGraphics -// Initialize video mode, setup dynamic screen size variables, -// and allocate screens. -// ----------------- -void I_StartupGraphics(void) -{ - if (graphics_started) - return; - -#ifdef HWRENDER - else if (M_CheckParm("-opengl")) - rendermode = render_opengl; - else -#endif - rendermode = render_soft; - - if (dedicated) - rendermode = render_none; - else - VID_Init(); - - // register exit code for graphics - I_AddExitFunc(I_ShutdownGraphics); - if (!dedicated) graphics_started = true; -} - -void VID_StartupOpenGL(void){} - -// ------------------ -// I_ShutdownGraphics -// Close the screen, restore previous video mode. -// ------------------ -void I_ShutdownGraphics(void) -{ -#ifdef HWRENDER - const rendermode_t oldrendermode = rendermode; -#endif - -// This is BAD because it makes the I_Error box screw up! -// rendermode = render_none; - - if (!graphics_started) - return; - - CONS_Printf("I_ShutdownGraphics: "); - - //FreeConsole(); - - //ResetAero(); - - // release windowed startup stuff - if (hDCMain) - { - ReleaseDC(hWndMain, hDCMain); - hDCMain = NULL; - } - if (bmiMain) - { - GlobalFree(bmiMain); - bmiMain = NULL; - } - -#ifdef HWRENDER - if (oldrendermode != render_soft) - { - HWR_Shutdown(); // free stuff from the hardware renderer - HWD.pfnShutdown(); // close 3d card display - Shutdown3DDriver(); // free the driver DLL - } -#endif - - // free the last video mode screen buffers - if (vid.buffer) - { - GlobalFree(vid.buffer); - vid.buffer = NULL; - } - -#ifdef HWRENDER - if (rendermode == render_soft) -#endif - CloseDirectDraw(); - - graphics_started = false; -} - -// -------------- -// I_UpdateNoBlit -// -------------- -void I_UpdateNoBlit(void) -{ - // what is this? -} - -// I_SkipFrame -// -// Returns true if it thinks we can afford to skip this frame -// from PrBoom's src/SDL/i_video.c -static inline boolean I_SkipFrame(void) -{ - static boolean skip = false; - - if (render_soft != rendermode) - return false; - - skip = !skip; - switch (gamestate) - { - case GS_LEVEL: - if (!paused) - return false; - //case GS_TIMEATTACK: -- sorry optimisation but now we have a cool level platter and that being laggardly looks terrible -#ifndef NONET - /* FALLTHRU */ - case GS_WAITINGPLAYERS: -#endif - return skip; // Skip odd frames - default: - return false; - } -} - -static void OnTop_OnChange(void) -{ - const UINT uFlags = SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER; - RECT bounds; - int x = 0, y = 0, w = 0, h = 0; - - if (!hWndMain || bAppFullScreen || cv_ontop.value == -1) - return; - - GetWindowRect(hWndMain, &bounds); - AdjustWindowRectEx(&bounds, GetWindowLong(hWndMain, GWL_STYLE), 0, 0); - w = bounds.right - (x = bounds.left); h = bounds.bottom - (y = bounds.top); - - if (cv_ontop.value && !paused) - SetWindowPos(hWndMain, HWND_TOP , x, y, w, h, uFlags); - else - SetWindowPos(hWndMain, HWND_NOTOPMOST, x, y, w, h, uFlags); -} - -// -------------- -// I_FinishUpdate -// -------------- -void I_FinishUpdate(void) -{ - if (rendermode == render_none) - return; - - if (I_SkipFrame()) - return; - - if (marathonmode) - SCR_DisplayMarathonInfo(); - - // draw captions if enabled - if (cv_closedcaptioning.value) - SCR_ClosedCaptions(); - - // display a graph of ticrate - if (cv_ticrate.value) - SCR_DisplayTicRate(); - - if (cv_showping.value && netgame && consoleplayer != serverplayer) - SCR_DisplayLocalPing(); - - // - if (bDIBMode) - { - // paranoia - if (!hDCMain || !bmiMain || !vid.buffer) - return; - // main game loop, still in a window (-win parm) - SetDIBitsToDevice(hDCMain, 0, 0, vid.width, vid.height, 0, 0, 0, vid.height, vid.buffer, bmiMain, - DIB_RGB_COLORS); - } - else -#ifdef HWRENDER - if (rendermode != render_soft) - HWD.pfnFinishUpdate(cv_vidwait.value); - else -#endif - { - // DIRECT DRAW - // copy virtual screen to real screen - // can fail when not active (alt-tab) - if (LockScreen()) - { - /// \todo use directX blit here!!? a blit might use hardware with access - /// to main memory on recent hardware, and software blit of directX may be - /// optimized for p2 or mmx?? - if (ScreenHeight > vid.height) - { - UINT8 *ptr = (UINT8 *)ScreenPtr; - size_t half_excess = ScreenPitch*(ScreenHeight-vid.height)/2; - memset(ptr, 0x1F, half_excess); - ptr += half_excess; - VID_BlitLinearScreen(screens[0], ptr, vid.width*vid.bpp, vid.height, - vid.width*vid.bpp, ScreenPitch); - ptr += vid.height*ScreenPitch; - memset(ptr, 0x1F, half_excess); - } - else - VID_BlitLinearScreen(screens[0], (UINT8 *)ScreenPtr, vid.width*vid.bpp, vid.height, - vid.width*vid.bpp, ScreenPitch); - - UnlockScreen(); - - // swap screens - ScreenFlip(cv_vidwait.value); - } - } -} - -// --------------- -// I_UpdateNoVsync -// --------------- -void I_UpdateNoVsync(void) -{ - int real_vidwait = cv_vidwait.value; - cv_vidwait.value = 0; - I_FinishUpdate(); - cv_vidwait.value = real_vidwait; -} - -// -// This is meant to be called only by CONS_Printf() while game startup -// -void I_LoadingScreen(LPCSTR msg) -{ - RECT rect; - - // paranoia - if (!hDCMain || !bmiMain || !vid.buffer) - return; - - GetClientRect(vid.WndParent, &rect); - - SetDIBitsToDevice(hDCMain, 0, 0, vid.width, vid.height, 0, 0, 0, vid.height, vid.buffer, bmiMain, DIB_RGB_COLORS); - - if (msg) - { - if (rect.bottom - rect.top > 32) - rect.top = rect.bottom - 32; // put msg on bottom of window - SetBkMode(hDCMain, TRANSPARENT); - SetTextColor(hDCMain, RGB(0x00, 0x00, 0x00)); - DrawTextA(hDCMain, msg, -1, &rect, DT_WORDBREAK|DT_CENTER); - } -} - -// ------------ -// I_ReadScreen -// ------------ -void I_ReadScreen(UINT8 *scr) -{ - // DEBUGGING - if (rendermode != render_soft) - I_Error("I_ReadScreen: called while in non-software mode"); - VID_BlitLinearScreen(screens[0], scr, vid.width*vid.bpp, vid.height, vid.width*vid.bpp, - vid.rowbytes); -} - -// ------------ -// I_SetPalette -// ------------ -void I_SetPalette(RGBA_t *palette) -{ - int i; - - if (bDIBMode) - { - // set palette in RGBQUAD format, NOT THE SAME ORDER as PALETTEENTRY, grmpf! - RGBQUAD *pColors; - pColors = (RGBQUAD *)((LPBYTE)bmiMain + bmiMain->bmiHeader.biSize); - ZeroMemory(pColors, sizeof (RGBQUAD)*256); - for (i = 0; i < 256; i++, pColors++, palette++) - { - pColors->rgbRed = palette->s.red; - pColors->rgbGreen = palette->s.green; - pColors->rgbBlue = palette->s.blue; - } - } - else -#ifdef HWRENDER - if (rendermode == render_soft) -#endif - { - PALETTEENTRY mainpal[256]; - - // this clears the 'flag' for each color in palette - ZeroMemory(mainpal, sizeof mainpal); - - // set palette in PALETTEENTRY format - for (i = 0; i < 256; i++, palette++) - { - mainpal[i].peRed = palette->s.red; - mainpal[i].peGreen = palette->s.green; - mainpal[i].peBlue = palette->s.blue; - } - SetDDPalette(mainpal); // set DirectDraw palette - } -} - -// -// return number of video modes in pvidmodes list -// MODES ARE ZERO INDEXED. DO NOT USE (n > nummodes). USE >= INSTEAD. -// -INT32 VID_NumModes(void) -{ - return numvidmodes; -} - -// return a video mode number from the dimensions -// returns any available video mode if the mode was not found -INT32 VID_GetModeForSize(INT32 w, INT32 h) -{ - vmode_t *pv = pvidmodes; - int modenum = 0; - - // Fullscreen resolutions exist - if (numvidmodes > NUMSPECIALMODES) - { - // skip the special modes so that it finds only fullscreen modes - for (; pv && modenum < NUMSPECIALMODES; pv = pv->pnext, ++modenum); - for (; pv; pv = pv->pnext, ++modenum) - if (pv->width == (unsigned)w && pv->height == (unsigned)h) - return modenum; - - // Try default video mode first - if (w != cv_scr_width.value || h != cv_scr_height.value) - return VID_GetModeForSize(cv_scr_width.value, cv_scr_height.value); - - // didn't find, return first fullscreen mode - return NUMSPECIALMODES; - } - - // rely only on special (windowed) modes - for (; pv && modenum < NUMSPECIALMODES; pv = pv->pnext, ++modenum) - if (pv->width == (unsigned)w && pv->height == (unsigned)h) - return modenum; - - // Try default video mode first - if (w != cv_scr_width.value || h != cv_scr_height.value) - return VID_GetModeForSize(cv_scr_width.value, cv_scr_height.value); - - // didn't find, return first windowed mode - return 0; -} - -// -// Enumerate DirectDraw modes available -// -static int nummodes = 0; -static BOOL GetExtraModesCallback(int width, int height, int bpp) -{ -#ifdef _DEBUG - CONS_Printf("mode %d x %d x %d bpp\n", width, height, bpp); -#endif - - // skip all unwanted modes - if (highcolor && bpp != 15) - goto skip; - if (!highcolor && bpp != 8) - goto skip; - - if (bpp > 16 || width > MAXVIDWIDTH || height > MAXVIDHEIGHT) - goto skip; - - // check if we have space for this mode - if (nummodes >= MAX_EXTRA_MODES) - { -#ifdef _DEBUG - CONS_Printf("mode skipped (too many)\n"); -#endif - return FALSE; - } - - // store mode info - extra_modes[nummodes].pnext = &extra_modes[nummodes+1]; - memset(names[nummodes], 0, 10); - snprintf(names[nummodes], 9, "%dx%d", width, height); - - extra_modes[nummodes].name = names[nummodes]; - extra_modes[nummodes].width = width; - extra_modes[nummodes].height = height; - - // exactly, the current FinishUdpate() gets the rowbytes itself after locking the video buffer - // so for now we put anything here - extra_modes[nummodes].rowbytes = width; - extra_modes[nummodes].windowed = false; - extra_modes[nummodes].misc = 0; // unused - extra_modes[nummodes].pextradata = NULL; - extra_modes[nummodes].setmode = VID_SetDirectDrawMode; - - extra_modes[nummodes].numpages = 3; // triple-buffer (but this value is unused) - - extra_modes[nummodes].bytesperpixel = (bpp+1)>>3; - - nummodes++; -skip: - return TRUE; -} - -// -// Collect info about DirectDraw display modes we use -// -static inline VOID VID_GetExtraModes(VOID) -{ - nummodes = 0; - EnumDirectDrawDisplayModes(GetExtraModesCallback); - - // add the extra modes (not 320x200) at the start of the mode list (if there are any) - if (nummodes) - { - extra_modes[nummodes-1].pnext = NULL; - pvidmodes = &extra_modes[0]; - numvidmodes += nummodes; - } -} - -// --------------- -// WindowMode_Init -// Add windowed modes to the start of the list, -// mode 0 is used for windowed console startup (works on all computers with no DirectX) -// --------------- -static VOID WindowMode_Init(VOID) -{ - int modenum; - - for (modenum = 0; modenum < NUMSPECIALMODES - 1; modenum++) - specialmodes[modenum].pnext = &specialmodes[modenum + 1]; - specialmodes[NUMSPECIALMODES-1].pnext = pvidmodes; - - pvidmodes = specialmodes; - numvidmodes += NUMSPECIALMODES; -} - -// ************************************************************************************* -// VID_Init -// Initialize Video modes subsystem -// ************************************************************************************* -static VOID VID_Init(VOID) -{ -#ifdef _DEBUG - vmode_t *pv; - int iMode; -#endif - - // if '-win' is specified on the command line, do not add DirectDraw modes - bWinParm = M_CheckParm("-win"); - - COM_AddCommand("vid_nummodes", VID_Command_NumModes_f); - COM_AddCommand("vid_modeinfo", VID_Command_ModeInfo_f); - COM_AddCommand("vid_modelist", VID_Command_ModeList_f); - COM_AddCommand("vid_mode", VID_Command_Mode_f); - - CV_RegisterVar(&cv_vidwait); - CV_RegisterVar(&cv_stretch); - CV_RegisterVar(&cv_ontop); - - // setup the videmodes list, - // note that mode 0 must always be VGA mode 0x13 - pvidmodes = pcurrentmode = NULL; - numvidmodes = 0; - - //DisableAero(); - - // store the main window handle in viddef struct - SetWindowPos(hWndMain, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE|SWP_NOSENDCHANGING|SWP_NOSIZE|SWP_NOMOVE); - vid.WndParent = hWndMain; - vid.buffer = NULL; - - // we startup in windowed mode using DIB bitmap - // we will use DirectDraw when switching fullScreen and entering main game loop - bDIBMode = TRUE; - bAppFullScreen = FALSE; - -#ifdef HWRENDER - // initialize the appropriate display device - if (rendermode != render_soft) - { - const char *drvname = NULL; - - switch (rendermode) - { - case render_opengl: - drvname = "r_opengl.dll"; - break; - default: - I_Error("Unknown hardware render mode"); - } - - // load the DLL - if (drvname && Init3DDriver(drvname)) - { - int hwdversion = HWD.pfnGetRenderVersion(); - if (hwdversion != VERSION) - CONS_Alert(CONS_WARNING, M_GetText("This r_opengl version is not supported, use it at your own risk!\n")); - - // perform initialisations - HWD.pfnInit(I_Error); - // get available display modes for the device - HWD.pfnGetModeList(&pvidmodes, &numvidmodes); - } - else - { - switch (rendermode) - { - case render_opengl: - I_Error("Error initializing OpenGL"); - default: - break; - } - rendermode = render_soft; - } - } - - if (rendermode == render_soft) -#endif - if (!bWinParm) - { - if (!CreateDirectDrawInstance()) - bWinParm = TRUE; - else // get available display modes for the device - VID_GetExtraModes(); - } - - // the game boots in 320x200 standard VGA, but - // we need a highcolor mode to run the game in highcolor - if (highcolor && !numvidmodes) - I_Error("Cannot run in highcolor - No 15bit highcolor DirectX video mode found."); - - // add windowed mode at the start of the list, very important! - WindowMode_Init(); - - if (!numvidmodes) - I_Error("No display modes available."); - -#ifdef _DEBUG // DEBUG - for (iMode = 0, pv = pvidmodes; pv; pv = pv->pnext, iMode++) - I_OutputMsg("#%02d: %dx%dx%dbpp (desc: '%s')\n", iMode, pv->width, pv->height, pv->bytesperpixel, pv->name); -#endif - - // set the startup screen in a window - VID_SetMode(0); -} - -// -------------------------- -// VID_SetWindowedDisplayMode -// Display the startup 320x200 console screen into a window on the desktop, -// switching to fullscreen display only when we will enter the main game loop. -// - we can display error message boxes for startup errors -// - we can set the last used resolution only once, when entering the main game loop -// -------------------------- -static INT32 WINAPI VID_SetWindowedDisplayMode(viddef_t *lvid, vmode_t *currentmode) -{ - RECT bounds; - int x = 0, y = 0, w = 0, h = 0; - - UNREFERENCED_PARAMETER(currentmode); - - I_OutputMsg("VID_SetWindowedDisplayMode()\n"); - - - lvid->u.numpages = 1; // not used - lvid->direct = NULL; // DOS remains - lvid->buffer = NULL; - - // allocate screens - if (!VID_FreeAndAllocVidbuffer(lvid)) - return -1; - - // lvid->buffer should be NULL here! - - bmiMain = GlobalAlloc(GPTR, sizeof (BITMAPINFO) + (sizeof (RGBQUAD)*256)); - if (!bmiMain) - I_Error("VID_SWDM(): No mem"); - - // setup a BITMAPINFO to allow copying our video buffer to the desktop, - // with color conversion as needed - bmiMain->bmiHeader.biSize = sizeof (BITMAPINFOHEADER); - bmiMain->bmiHeader.biWidth = lvid->width; - bmiMain->bmiHeader.biHeight= -(lvid->height); - bmiMain->bmiHeader.biPlanes = 1; - bmiMain->bmiHeader.biBitCount = 8; - bmiMain->bmiHeader.biCompression = BI_RGB; - - // center window on the desktop - bounds.left = 0; - bounds.right = lvid->width; - bounds.top = 0; - bounds.bottom = lvid->height; - AdjustWindowRectEx(&bounds, GetWindowLong(hWndMain, GWL_STYLE), FALSE, GetWindowLong(hWndMain, GWL_EXSTYLE)); - - w = bounds.right-bounds.left; - h = bounds.bottom-bounds.top; - x = (GetSystemMetrics(SM_CXSCREEN)-w)/2; - y = (GetSystemMetrics(SM_CYSCREEN)-h)/2; - - if (devparm) - MoveWindow(hWndMain, x<<1, y<<1, w, h, TRUE); - else - MoveWindow(hWndMain, x, y, w, h, TRUE); - - SetFocus(hWndMain); - ShowWindow(hWndMain, SW_SHOW); - - hDCMain = GetDC(hWndMain); - if (!hDCMain) - I_Error("VID_SWDM(): GetDC FAILED"); - - return 1; -} - -// ======================================================================== -// Returns a vmode_t from the video modes list, given a video mode number. -// ======================================================================== -vmode_t *VID_GetModePtr(int modenum) -{ - vmode_t *pv; - - pv = pvidmodes; - if (!pv) - I_Error("VID_error: No video mode found\n"); - - while (modenum--) - { - pv = pv->pnext; - if (!pv) - I_Error("VID_error: Mode not available\n"); - } - return pv; -} - -// -// return the name of a video mode -// -const char *VID_GetModeName(INT32 modenum) -{ - return (VID_GetModePtr(modenum))->name; -} - -// ======================================================================== -// Sets a video mode -// ======================================================================== -INT32 VID_SetMode(INT32 modenum) -{ - int vstat; - vmode_t *pnewmode; - - if (dedicated) - return 0; - - I_OutputMsg("VID_SetMode(%d)\n", modenum); - - // if mode 0 (windowed) we must not be fullscreen already, - // if other mode, check it is not mode 0 and existing - if (modenum >= numvidmodes) - { - if (!pcurrentmode) - modenum = 0; // revert to the default base vid mode - else - I_Error("Unknown video mode: %d\n", modenum); - } - else if (bAppFullScreen && modenum < NUMSPECIALMODES) - I_Error("Tried to switch from fullscreen back to windowed mode %d\n", modenum); - - pnewmode = VID_GetModePtr(modenum); - - // dont switch to the same display mode - if (pnewmode == pcurrentmode) - return 1; - - // initialize the new mode - pcurrentmode = pnewmode; - - // initialize vidbuffer size for setmode - vid.width = pcurrentmode->width; - vid.height = pcurrentmode->height; - vid.rowbytes = pcurrentmode->rowbytes; - vid.bpp = pcurrentmode->bytesperpixel; - if (modenum) // if not 320x200 windowed mode, it's actually a hack - { - if (rendermode == render_opengl) - { - // don't accept depth < 16 for OpenGL mode (too much ugly) - if (cv_scr_depth.value < 16) - CV_SetValue(&cv_scr_depth, 16); - vid.bpp = cv_scr_depth.value/8; - vid.u.windowed = (bWinParm || !cv_fullscreen.value); - pcurrentmode->bytesperpixel = vid.bpp; - pcurrentmode->windowed = vid.u.windowed; - } - } - - vstat = (*pcurrentmode->setmode)(&vid, pcurrentmode); - - if (vstat == -1) - I_Error("Not enough mem for VID_SetMode\n"); - else if (vstat == -2) - I_Error("Couldn't set video mode because it failed the test\n"); - else if (vstat == -3) - I_Error("Couldn't set video mode because it failed the change?\n"); - else if (!vstat) - I_Error("Couldn't set video mode %d (%dx%d %d bits)\n", modenum, vid.width, vid.height, (vid.bpp*8));// hardware could not setup mode - else - CONS_Printf(M_GetText("Mode changed to %d (%s)\n"), modenum, pcurrentmode->name); - - vid.modenum = modenum; - - // tell game engine to recalc all tables and realloc buffers based on new values - vid.recalc = 1; - - if (modenum < NUMSPECIALMODES) - { - // we are in startup windowed mode - bAppFullScreen = FALSE; - bDIBMode = TRUE; - } - else - { - // we switch to fullscreen - bAppFullScreen = TRUE; - bDIBMode = FALSE; -#ifdef HWRENDER - if (rendermode != render_soft) - { - // purge all patch graphics stored in software format - //Z_FreeTags (PU_PURGELEVEL, PU_PURGELEVEL+100); - HWR_Startup(); - } -#endif - } - - I_RestartSysMouse(); - return 1; -} - -boolean VID_CheckRenderer(void) -{ - return false; -} - -void VID_CheckGLLoaded(rendermode_t oldrender) -{ - (void)oldrender; -} - -// ======================================================================== -// Free the video buffer of the last video mode, -// allocate a new buffer for the video mode to set. -// ======================================================================== -static BOOL VID_FreeAndAllocVidbuffer(viddef_t *lvid) -{ - const DWORD vidbuffersize = (lvid->width * lvid->height * lvid->bpp * NUMSCREENS); - - // free allocated buffer for previous video mode - if (lvid->buffer) - GlobalFree(lvid->buffer); - - // allocate & clear the new screen buffer - lvid->buffer = GlobalAlloc(GPTR, vidbuffersize); - if (!lvid->buffer) - return FALSE; - - ZeroMemory(lvid->buffer, vidbuffersize); - I_OutputMsg("VID_FreeAndAllocVidbuffer done, vidbuffersize: %x\n",(UINT32)vidbuffersize); - - return TRUE; -} - -// ======================================================================== -// Set video mode routine for DirectDraw display modes -// Out: 1 ok, -// 0 hardware could not set mode, -// -1 no mem -// ======================================================================== -static INT32 WINAPI VID_SetDirectDrawMode(viddef_t *lvid, vmode_t *currentmode) -{ - UNREFERENCED_PARAMETER(currentmode); - - I_OutputMsg("VID_SetDirectDrawMode...\n"); - - - // DD modes do double-buffer page flipping, but the game engine doesn't need this.. - lvid->u.numpages = 2; - - // release ddraw surfaces etc.. - ReleaseChtuff(); - - // clean up any old vid buffer lying around, alloc new if needed - if (!VID_FreeAndAllocVidbuffer(lvid)) - return -1; // no mem - - // should clear video mem here - - // note use lvid->bpp instead of 8...will this be needed? will we support other than 256color - // in software ? - if (!InitDirectDrawe(hWndMain, lvid->width, lvid->height, 8, TRUE)) // TRUE currently always full screen - return 0; // could not set mode - - // this is NOT used with DirectDraw modes, game engine should never use this directly - // but rather render to memory bitmap buffer - lvid->direct = NULL; - - if (!cv_stretch.value && fabsf((float)vid.width/vid.height - ((float)BASEVIDWIDTH/BASEVIDHEIGHT)) > 1.0E-36f) - vid.height = (int)(vid.width * ((float)BASEVIDHEIGHT/BASEVIDWIDTH));// Adjust the height to match - - return 1; -} - -// ======================================================================== -// VIDEO MODE CONSOLE COMMANDS -// ======================================================================== - -// vid_nummodes -// -static void VID_Command_NumModes_f(void) -{ - CONS_Printf(M_GetText("%d video mode(s) available(s)\n"), VID_NumModes()); -} - -// vid_modeinfo -// -static void VID_Command_ModeInfo_f(void) -{ - vmode_t *pv; - int modenum; - - if (COM_Argc() != 2) - modenum = vid.modenum; // describe the current mode - else - modenum = atoi(COM_Argv(1)); // the given mode number - - if (modenum >= VID_NumModes() - || (!bWinParm && modenum < NUMSPECIALMODES)) // don't accept the windowed modes - { - CONS_Printf(M_GetText("Video mode not present\n")); - return; - } - - pv = VID_GetModePtr(modenum); - - CONS_Printf("\x82" "%s\n", VID_GetModeName(modenum)); - CONS_Printf(M_GetText("width: %d\nheight: %d\n"), - pv->width, pv->height); - if (rendermode == render_soft) - CONS_Printf(M_GetText("bytes per scanline: %d\nbytes per pixel: %d\nnumpages: %d\n"), - pv->rowbytes, pv->bytesperpixel, pv->numpages); -} - -// vid_modelist -// -static void VID_Command_ModeList_f(void) -{ - int i, numodes; - const char *pinfo; - vmode_t *pv; - - numodes = VID_NumModes(); - - // hide windowed modes unless using them - i = (!bWinParm) ? NUMSPECIALMODES : 0; - - for (; i < numodes; i++) - { - pv = VID_GetModePtr(i); - pinfo = VID_GetModeName(i); - - if (pv->bytesperpixel == 1) - CONS_Printf("%d: %s\n", i, pinfo); - else - CONS_Printf("%d: %s (hicolor)\n", i, pinfo); - } -} - -// vid_mode -// -static void VID_Command_Mode_f(void) -{ - int modenum; - - if (COM_Argc() != 2) - { - CONS_Printf(M_GetText("vid_mode : set video mode, current video mode %i\n"), vid.modenum); - return; - } - - modenum = atoi(COM_Argv(1)); - - if (modenum >= VID_NumModes() - || (!bWinParm && modenum < NUMSPECIALMODES)) // don't accept the windowed modes - CONS_Printf(M_GetText("Video mode not present\n")); - else - setmodeneeded = modenum + 1; // request vid mode change -} -#endif diff --git a/tools/PHP/RSS1.0.php b/tools/PHP/RSS1.0.php deleted file mode 100644 index 30eb32585..000000000 --- a/tools/PHP/RSS1.0.php +++ /dev/null @@ -1,55 +0,0 @@ -'; -echo "\n"; -echo ''; -echo "\n"; -echo "\n"; -echo ' '; -echo "\n"; -echo ' SRB2 Master Server RSS Feed'; -echo "\n"; -echo ' http://srb2.servegame.org/'; -echo "\n"; -echo ' Playing around with RSS'; -echo "\n"; -//echo ' en-us'; -//echo "\n"; - $fd = fsockopen("srb2.servegame.org", 28900, $errno, $errstr, 5); -// $fd = 0; - if ($fd) - { - $buff = "000012400000"; - fwrite($fd, $buff); - while (1) - { - $content=fgets($fd, 13); // skip 13 first bytes - $content=fgets($fd, 1024); - echo "$content"; - if (feof($fd)) break; - } - fclose($fd); - } - else - { - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo "\n"; - echo ' '; - echo 'No master serverThe master server is not running'; - } -?> - \ No newline at end of file diff --git a/tools/PHP/RSS92.php b/tools/PHP/RSS92.php deleted file mode 100644 index 4dd194089..000000000 --- a/tools/PHP/RSS92.php +++ /dev/null @@ -1,37 +0,0 @@ -'; -echo "\n"; -echo ''; -echo "\n"; -echo ' '; -echo "\n"; -echo ' SRB2 Master Server RSS Feed'; -echo "\n"; -echo ' Playing around with RSS'; -echo "\n"; -echo ' http://srb2.servegame.org/'; -echo "\n"; -echo ' en-us'; -echo "\n"; - $fd = fsockopen("srb2.servegame.org", 28900, $errno, $errstr, 5); - if ($fd) - { - $buff = "000012380000"; - fwrite($fd, $buff); - while (1) - { - $content=fgets($fd, 13); // skip the next 13 bytes - $content=fgets($fd, 1024); - echo "$content"; - if (feof($fd)) break; - } - fclose($fd); - } - else - { - echo "No master serverThe master server is not running"; - } -?> - - \ No newline at end of file diff --git a/tools/PHP/index.php b/tools/PHP/index.php deleted file mode 100644 index 93bb7c92b..000000000 --- a/tools/PHP/index.php +++ /dev/null @@ -1,90 +0,0 @@ - - - - -SRB2 Master Server Status - - -
- - - - - - - - - -
-
- SRB2 logo. -
- SRB2's HomePage
-
-
-
- Chompy World logo. -
- Chompy World
-
-
-
- SRB2 World logo. -
- SRB2 World
-
-
- -
-
-
- -SRB2 Master Server Status\nCurrent host: $host_addr
"; - $buff = "000043210000"; - fwrite($fd, $buff); - while (1) - { - $content=fgets($fd, 13); // skip 13 first bytes - $content=fgets($fd, 1024); - echo "$content"; - if (feof($fd)) break; - } - fclose($fd); - - } - else - { - echo 'The master server is not running
'; - echo "ERROR: $errno - $errstr
\n"; - } -?> -
-

Info:

-Win32 SRB2MSLauncher Great job, "Gregor Dick"/Oogaland of Gregorsoft Software -
-

-

Version Info:

-srb2dos.exe (DOS/Allegro/WATTCP32 version)
-srb2.exe (Windows/DirectX/FMOD version)
-srb2sdl.exe (Windows/SDL/SDL_mixer version)
-lsdlsrb2 (GNU/Linux/SDL/SDL_mixer version)
-
-Srb2win.exe v1.09.4 (use Internet search menu)
- - - diff --git a/tools/PHP/text.php b/tools/PHP/text.php deleted file mode 100644 index 282b812b7..000000000 --- a/tools/PHP/text.php +++ /dev/null @@ -1,24 +0,0 @@ - diff --git a/tools/SDL-1.2.14-gc/README b/tools/SDL-1.2.14-gc/README deleted file mode 100644 index 8ce488fa9..000000000 --- a/tools/SDL-1.2.14-gc/README +++ /dev/null @@ -1 +0,0 @@ -Once patched, run autogen.sh, configure with "./configure --without-x --disable-video-x11 --disable-video-fbcon --disable-video-aalib --disable-video-directfb --disable-video-opengl --enable-video-gc" and then compile. diff --git a/tools/SDL-1.2.14-gc/SDL-1.2.14-gc.patch b/tools/SDL-1.2.14-gc/SDL-1.2.14-gc.patch deleted file mode 100644 index 5b2b2cfa0..000000000 --- a/tools/SDL-1.2.14-gc/SDL-1.2.14-gc.patch +++ /dev/null @@ -1,641 +0,0 @@ -From 8e6ada7bc33e3cc4e1c17821ea171bf0815a505d Mon Sep 17 00:00:00 2001 -From: Alam Arias -Date: Tue, 1 Dec 2009 19:31:57 -0500 -Subject: [PATCH] SDL GC hack - ---- - configure.in | 17 ++ - include/SDL_config.h.in | 1 + - src/video/fbcon/SDL_fbgc.c | 471 +++++++++++++++++++++++++++++++++++++++++ - src/video/fbcon/SDL_fbgc.h | 35 +++ - src/video/fbcon/SDL_fbvideo.c | 10 + - src/video/fbcon/SDL_fbvideo.h | 11 + - 6 files changed, 545 insertions(+), 0 deletions(-) - create mode 100644 src/video/fbcon/SDL_fbgc.c - create mode 100644 src/video/fbcon/SDL_fbgc.h - -diff --git a/configure.in b/configure.in -index a7e9b18..a8961ba 100644 ---- a/configure.in -+++ b/configure.in -@@ -1227,6 +1227,22 @@ AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [[d - fi - } - -+dnl See if we're running on Linux for the Nintendo GameCube/Wii -+dnl FIXME, perform a real test here... -+CheckGC() -+{ -+ AC_ARG_ENABLE(video-gc, -+AC_HELP_STRING([--enable-video-gc], [enable GameCube video support in FB [[default=no]]]), -+ , enable_video_gc=no) -+ if test x$enable_video = xyes -a x$enable_video_gc = xyes -a x$video_fbcon = xyes; then -+ video_gc=yes -+ AC_MSG_RESULT($video_gc) -+ if test x$video_gc = xyes; then -+ AC_DEFINE(SDL_VIDEO_DRIVER_GC) -+ fi -+ fi -+} -+ - dnl Find DirectFB - CheckDirectFB() - { -@@ -2322,6 +2338,7 @@ case "$host" in - CheckX11 - CheckNANOX - CheckFBCON -+ CheckGC - CheckDirectFB - CheckPS2GS - CheckPS3 -diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in -index 58593ca..e523e9b 100644 ---- a/include/SDL_config.h.in -+++ b/include/SDL_config.h.in -@@ -262,6 +262,7 @@ - #undef SDL_VIDEO_DRIVER_DUMMY - #undef SDL_VIDEO_DRIVER_FBCON - #undef SDL_VIDEO_DRIVER_GAPI -+#undef SDL_VIDEO_DRIVER_GC - #undef SDL_VIDEO_DRIVER_GEM - #undef SDL_VIDEO_DRIVER_GGI - #undef SDL_VIDEO_DRIVER_IPOD -diff --git a/src/video/fbcon/SDL_fbgc.c b/src/video/fbcon/SDL_fbgc.c -new file mode 100644 -index 0000000..b3b72bb ---- /dev/null -+++ b/src/video/fbcon/SDL_fbgc.c -@@ -0,0 +1,471 @@ -+/* -+ SDL - Simple DirectMedia Layer -+ Copyright (C) 1997-2009 Sam Lantinga -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ This library 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 -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with this library; if not, write to the Free Software -+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -+ -+ Sam Lantinga -+ slouken@libsdl.org -+*/ -+#include "SDL_config.h" -+ -+#ifdef SDL_VIDEO_DRIVER_GC -+#include -+#include "SDL_video.h" -+#include "../SDL_blit.h" -+#include "SDL_fbgc.h" -+ -+static Uint32 r_Yr[256]; -+static Uint32 g_Yg_[256]; -+static Uint32 b_Yb[256]; -+static Uint32 r_Ur[256]; -+static Uint32 g_Ug_[256]; -+static Uint32 b_Ub[256]; -+/* static Uint32 r_Vr[256]; // space and cache optimisation */ -+#define r_Vr b_Ub -+static Uint32 g_Vg_[256]; -+static Uint32 b_Vb[256]; -+ -+static Uint8 RGB16toY[1 << 16]; -+static Uint8 RGB16toU[1 << 16]; -+static Uint8 RGB16toV[1 << 16]; -+ -+#ifndef FBIOFLIPHACK -+#define FBIOFLIPHACK 0x4623 /* gc-linux */ -+#endif -+ -+#ifndef GC_BLACK -+#define GC_BLACK 0x00800080 -+#endif -+ -+#ifdef GC_DEBUG -+# define GC_DPRINTF(fmt, args...) \ -+ fprintf(stderr,"DDD|%s: " fmt, __FUNCTION__ , ## args) -+#else -+# define GC_DPRINTF(fmt, args...) -+#endif -+ -+SDL_bool GC_Test(_THIS) -+{ -+ int fliptest; -+ if (ioctl(console_fd, FBIOFLIPHACK, &fliptest)) -+ return SDL_TRUE; -+ return SDL_FALSE; -+} -+ -+SDL_bool GC_Available(void) -+{ -+ if (access("/sys/bus/of_platform/drivers/gcn-vifb", 0) == 0) -+ return SDL_TRUE; -+ -+ return SDL_FALSE; -+} -+ -+/* -+ * -+ * Color space handling. -+ */ -+ -+#define RGB2YUV_SHIFT 16 -+#define RGB2YUV_LUMA 16 -+#define RGB2YUV_CHROMA 128 -+ -+#define Yr ((int)( 0.299*(1< y) ? y : z)) -+ -+static void GC_InitRGB2YUVTables(void) -+{ -+ unsigned int i; -+ unsigned int r, g, b; -+ -+ for (i = 0; i < 256; i++) { -+ r_Yr[i] = Yr * i; -+ g_Yg_[i] = Yg * i + (RGB2YUV_LUMA << RGB2YUV_SHIFT); -+ b_Yb[i] = Yb * i; -+ r_Ur[i] = Ur * i; -+ g_Ug_[i] = Ug * i + (RGB2YUV_CHROMA << RGB2YUV_SHIFT); -+ b_Ub[i] = Ub * i; -+ r_Vr[i] = Vr * i; -+ g_Vg_[i] = Vg * i + (RGB2YUV_CHROMA << RGB2YUV_SHIFT); -+ b_Vb[i] = Vb * i; -+ } -+ -+ for (i = 0; i < 1 << 16; i++) { -+ /* RGB565 */ -+ r = ((i >> 8) & 0xf8); -+ g = ((i >> 3) & 0xfc); -+ b = ((i << 3) & 0xf8); -+ /* extend to 8bit */ -+ r |= (r >> 5); -+ g |= (g >> 6); -+ b |= (b >> 5); -+ -+ RGB16toY[i] = -+ clamp(16, 235, -+ (r_Yr[r] + g_Yg_[g] + b_Yb[b]) >> RGB2YUV_SHIFT); -+ RGB16toU[i] = -+ clamp(16, 240, -+ (r_Ur[r] + g_Ug_[g] + b_Ub[b]) >> RGB2YUV_SHIFT); -+ RGB16toV[i] = -+ clamp(16, 240, -+ (r_Vr[r] + g_Vg_[g] + b_Vb[b]) >> RGB2YUV_SHIFT); -+ } -+} -+ -+static inline Uint32 rgbrgb16toyuy2(Uint16 rgb1, Uint16 rgb2) -+{ -+ register int Y1, Cb, Y2, Cr; -+ Uint16 rgb; -+ -+ /* fast path, thanks to bohdy */ -+ if (!(rgb1 | rgb2)) { -+ return GC_BLACK; /* black, black */ -+ } -+ -+ if (rgb1 == rgb2) { -+ /* fast path, thanks to isobel */ -+ Y1 = Y2 = RGB16toY[rgb1]; -+ Cb = RGB16toU[rgb1]; -+ Cr = RGB16toV[rgb1]; -+ } else { -+ Y1 = RGB16toY[rgb1]; -+ Y2 = RGB16toY[rgb2]; -+ -+ /* RGB565 average */ -+ rgb = ((rgb1 >> 1) & 0xFBEF) + ((rgb2 >> 1) & 0xFBEF) + -+ ((rgb1 & rgb2) & 0x0821); -+ -+ Cb = RGB16toU[rgb]; -+ Cr = RGB16toV[rgb]; -+ } -+ -+ return (((char)Y1) << 24) | (((char)Cb) << 16) | (((char)Y2) << 8) -+ | (((char)Cr) << 0); -+} -+ -+/* -+ * -+ * Blitters. -+ */ -+static void GC_UpdateRectRGB16(_THIS, SDL_Rect * rect, int pitch) -+{ -+ int width, height, left, i, mod, mod32; -+ Uint8 *src, *dst; -+ Uint32 *src32, *dst32; -+ Uint16 *rgb; -+ -+ /* XXX case width < 2 needs special treatment */ -+ -+ /* in pixel units */ -+ left = rect->x & ~1; /* 2 pixel align */ -+ width = (rect->w + 1) & ~1; /* 2 pixel align in excess */ -+ height = rect->h; -+ -+ /* in bytes, src and dest are 16bpp */ -+ src = shadow_mem + (rect->y * pitch) + left * 2; -+ dst = flip_address[back_page] + page_offset + -+ (rect->y * pitch) + left * 2; -+ mod = pitch - width * 2; -+ -+ src32 = (Uint32 *) src; -+ dst32 = (Uint32 *) dst; -+ mod32 = mod / 4; -+ -+ while (height--) { -+ i = width / 2; -+ -+ while (i--) { -+ rgb = (Uint16 *) src32; -+ *dst32++ = rgbrgb16toyuy2(rgb[0], rgb[1]); -+ src32++; -+ } -+ src32 += mod32; -+ dst32 += mod32; -+ } -+} -+ -+void GC_Init(_THIS, SDL_PixelFormat *vformat) -+{ -+ GC_InitRGB2YUVTables(); -+ -+ /* 16 bits per pixel */ -+ vformat->BitsPerPixel = 16; -+ vformat->BytesPerPixel = 2; -+ /* RGB565 */ -+ vformat->Rmask = 0x0000f800; -+ vformat->Gmask = 0x000007e0; -+ vformat->Bmask = 0x0000001f; -+ -+ shadow_fb = 1; -+} -+ -+/* -+ * -+ * Video mode handling. -+ */ -+ -+/* only 640x480 16bpp is currently supported */ -+const static SDL_Rect RECT_640x480 = { 0, 0, 640, 480 }; -+const static SDL_Rect *vid_modes[] = { -+ &RECT_640x480, -+ NULL -+}; -+ -+static SDL_Rect **GC_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags) -+{ -+ switch (format->BitsPerPixel) { -+ case 16: -+ return (SDL_Rect **) vid_modes; -+ default: -+ return NULL; -+ } -+} -+ -+SDL_Surface *GC_SetVideoMode(_THIS, SDL_Surface * current, -+ int width, int height, int bpp, Uint32 flags) -+{ -+ struct fb_fix_screeninfo finfo; -+ struct fb_var_screeninfo vinfo; -+ int i; -+ Uint32 Rmask; -+ Uint32 Gmask; -+ Uint32 Bmask; -+ Uint32 *p, *q; -+ Uint32 yres; -+ -+ GC_DPRINTF("Setting %dx%d %dbpp %smode\n", width, height, bpp, -+ (flags & SDL_DOUBLEBUF)?"(doublebuf) ":""); -+ -+ /* Set the terminal into graphics mode */ -+ if (FB_EnterGraphicsMode(this) < 0) { -+ return (NULL); -+ } -+ -+ /* Restore the original palette */ -+ //FB_RestorePalette(this); -+ -+ /* Set the video mode and get the final screen format */ -+ if (ioctl(console_fd, FBIOGET_VSCREENINFO, &vinfo) < 0) { -+ SDL_SetError("Couldn't get console screen info"); -+ return (NULL); -+ } -+ -+ yres = vinfo.yres; -+ -+ /* hack to center 640x480 resolution on PAL cubes */ -+ if (vinfo.xres == 640 && vinfo.yres == 576) { -+ page_offset = ((576 - 480) / 2) * 640 * ((bpp + 7) / 8); -+ } else { -+ page_offset = 0; -+ } -+ -+ /* clear all video memory */ -+ p = (Uint32 *)mapped_mem; -+ q = (Uint32 *)(mapped_mem + mapped_memlen); -+ while (p < q) -+ *p++ = GC_BLACK; -+ -+ if ((vinfo.xres != width) || (vinfo.yres != height) || -+ (vinfo.bits_per_pixel != bpp)) { -+ vinfo.activate = FB_ACTIVATE_NOW; -+ vinfo.accel_flags = 0; -+ vinfo.bits_per_pixel = bpp; -+ vinfo.xres = width; -+ vinfo.xres_virtual = width; -+ /* do not modify yres*, we use a fake 640x480 mode in PAL */ -+ //vinfo.yres = height; -+ //vinfo.yres_virtual = 2*height; -+ vinfo.xoffset = 0; -+ vinfo.yoffset = 0; -+ vinfo.red.length = vinfo.red.offset = 0; -+ vinfo.green.length = vinfo.green.offset = 0; -+ vinfo.blue.length = vinfo.blue.offset = 0; -+ vinfo.transp.length = vinfo.transp.offset = 0; -+ -+ if (ioctl(console_fd, FBIOPUT_VSCREENINFO, &vinfo) < 0) { -+ SDL_SetError("Couldn't set console screen info"); -+ return (NULL); -+ } -+ } else { -+ int maxheight; -+ -+ /* Figure out how much video memory is available */ -+ maxheight = 2*yres; -+ if (vinfo.yres_virtual > maxheight) { -+ vinfo.yres_virtual = maxheight; -+ } -+ } -+ cache_vinfo = vinfo; -+ -+ Rmask = 0; -+ for (i = 0; i < vinfo.red.length; ++i) { -+ Rmask <<= 1; -+ Rmask |= (0x00000001 << vinfo.red.offset); -+ } -+ Gmask = 0; -+ for (i = 0; i < vinfo.green.length; ++i) { -+ Gmask <<= 1; -+ Gmask |= (0x00000001 << vinfo.green.offset); -+ } -+ Bmask = 0; -+ for (i = 0; i < vinfo.blue.length; ++i) { -+ Bmask <<= 1; -+ Bmask |= (0x00000001 << vinfo.blue.offset); -+ } -+ if (!SDL_ReallocFormat(current, bpp, Rmask, Gmask, Bmask, 0)) { -+ return (NULL); -+ } -+ -+ /* Get the fixed information about the console hardware. -+ This is necessary since finfo.line_length changes. -+ */ -+ if (ioctl(console_fd, FBIOGET_FSCREENINFO, &finfo) < 0) { -+ SDL_SetError("Couldn't get console hardware info"); -+ return (NULL); -+ } -+ -+ /* Save hardware palette, if needed */ -+ //FB_SavePalette(this, &finfo, &vinfo); -+ -+ /* Set up the new mode framebuffer */ -+ current->flags = SDL_FULLSCREEN; -+ current->w = width; -+ current->h = height; -+ current->pitch = width * ((bpp + 7) / 8); -+ current->pixels = shadow_mem; -+ -+ flip_address[0] = mapped_mem; -+ flip_address[1] = mapped_mem + current->pitch * yres; -+ -+ back_page = 1; -+ if (flags & SDL_DOUBLEBUF) { -+ current->flags |= SDL_DOUBLEBUF; -+ flip_pending = 1; -+ } else { -+ flip_pending = 0; -+ /* make page 0 both the visible and back page */ -+ back_page = ioctl(console_fd, FBIOFLIPHACK, &back_page); -+ if (back_page < 0) -+ back_page = 0; -+ } -+ -+ /* Set the update rectangle function */ -+ switch (bpp) { -+ case 16: -+ GC_DPRINTF("Using 16bpp blitter\n"); -+ this->hidden->UpdateRect = GC_UpdateRectRGB16; -+ break; -+ default: -+ GC_DPRINTF("Using NO blitter\n"); -+ this->hidden->UpdateRect = NULL; -+ break; -+ } -+ -+ /* Handle OpenGL support */ -+#ifdef HAVE_OPENGL -+ if (flags & SDL_OPENGL) { -+ if (GC_GL_CreateWindow(this, width, height) == 0) { -+ current->flags |= (SDL_OPENGL | SDL_FULLSCREEN); -+ } else { -+ current = NULL; -+ } -+ } -+#endif /* HAVE_OPENGL */ -+ -+ /* We're done */ -+ return (current); -+} -+ -+static int GC_FlipHWSurface(_THIS, SDL_Surface * surface) -+{ -+ if (flip_pending) { -+ /* SDL_UpdateRect was not called */ -+ SDL_UpdateRect(this->screen, 0, 0, 0, 0); -+ } -+ -+ /* flip video page as soon as possible */ -+ ioctl(console_fd, FBIOFLIPHACK, NULL); -+ flip_pending = 1; -+ -+ return (0); -+} -+ -+static void GC_WaitForFlipCompletion(_THIS) -+{ -+ int visible_page; -+ int result; -+ -+ if (flip_pending) { -+ flip_pending = 0; -+ back_page ^= 1; -+ visible_page = back_page; -+ while (visible_page == back_page) { -+ /* wait until back_page is not visible */ -+ result = ioctl(console_fd, FBIOFLIPHACK, &back_page); -+ if (result < 0) { -+ if ((errno == EINTR) || (errno == EAGAIN)) -+ continue; -+ return; /* ioctl unsupported ... */ -+ } -+ visible_page = result; -+ } -+ /* -+ * At this point the back_page is not visible. We can safely -+ * write to it without tearing. -+ */ -+ } -+} -+ -+static void GC_UpdateRects(_THIS, int numrects, SDL_Rect * rects) -+{ -+ SDL_Surface *screen; -+ int pitch; -+ -+ /* external yuy2 fb is 16bpp */ -+ -+ screen = this->screen; -+ pitch = screen->pitch; /* this is the pitch of the shadow buffer */ -+ -+ if (this->hidden->UpdateRect) { -+ GC_WaitForFlipCompletion(this); -+ while (numrects--) { -+ if (rects->w <= 0 || rects->h <= 0) -+ continue; -+ this->hidden->UpdateRect(this, rects, pitch); -+ rects++; -+ } -+ } -+} -+ -+void GC_CreateDevice(SDL_VideoDevice *this) -+{ -+ this->ListModes = GC_ListModes; -+ this->SetVideoMode = GC_SetVideoMode; -+ this->FlipHWSurface = GC_FlipHWSurface; -+ this->UpdateRects = GC_UpdateRects; -+} -+ -+#endif -diff --git a/src/video/fbcon/SDL_fbgc.h b/src/video/fbcon/SDL_fbgc.h -new file mode 100644 -index 0000000..534a73e ---- /dev/null -+++ b/src/video/fbcon/SDL_fbgc.h -@@ -0,0 +1,35 @@ -+/* -+ SDL - Simple DirectMedia Layer -+ Copyright (C) 1997-2009 Sam Lantinga -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ This library 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 -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with this library; if not, write to the Free Software -+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -+ -+ Sam Lantinga -+ slouken@libsdl.org -+*/ -+#include "SDL_config.h" -+ -+ -+#ifdef SDL_VIDEO_DRIVER_GC -+/* Gamecube/Wii hardware setup for the SDL framebuffer console driver */ -+ -+#include "SDL_fbvideo.h" -+ -+extern SDL_bool GC_Available(void); -+extern void GC_CreateDevice(SDL_VideoDevice *this); -+ -+extern SDL_bool GC_Test(_THIS); -+extern void GC_Init(_THIS, SDL_PixelFormat *vformat); -+#endif -diff --git a/src/video/fbcon/SDL_fbvideo.c b/src/video/fbcon/SDL_fbvideo.c -index 81a89da..328790e 100644 ---- a/src/video/fbcon/SDL_fbvideo.c -+++ b/src/video/fbcon/SDL_fbvideo.c -@@ -272,6 +272,11 @@ static SDL_VideoDevice *FB_CreateDevice(int devindex) - - this->free = FB_DeleteDevice; - -+#ifdef SDL_VIDEO_DRIVER_GC -+ if (GC_Available(this)) -+ GC_CreateDevice(this); -+#endif -+ - return this; - } - -@@ -784,6 +789,11 @@ static int FB_VideoInit(_THIS, SDL_PixelFormat *vformat) - } - } - -+#ifdef SDL_VIDEO_DRIVER_GC -+ if (GC_Test(this)) -+ GC_Init(this, vformat); -+#endif -+ - if (shadow_fb) { - shadow_mem = (char *)SDL_malloc(mapped_memlen); - if (shadow_mem == NULL) { -diff --git a/src/video/fbcon/SDL_fbvideo.h b/src/video/fbcon/SDL_fbvideo.h -index 03b9e94..74d1460 100644 ---- a/src/video/fbcon/SDL_fbvideo.h -+++ b/src/video/fbcon/SDL_fbvideo.h -@@ -106,6 +106,12 @@ struct SDL_PrivateVideoData { - - void (*wait_vbl)(_THIS); - void (*wait_idle)(_THIS); -+#ifdef SDL_VIDEO_DRIVER_GC -+ void (*UpdateRect) (_THIS, SDL_Rect * rect, int pitch); -+ int back_page; -+ int page_offset; -+ int flip_pending; -+#endif - }; - /* Old variable names */ - #define console_fd (this->hidden->console_fd) -@@ -147,6 +153,11 @@ struct SDL_PrivateVideoData { - #define screen_palette (this->hidden->screen_palette) - #define wait_vbl (this->hidden->wait_vbl) - #define wait_idle (this->hidden->wait_idle) -+#ifdef SDL_VIDEO_DRIVER_GC -+#define back_page (this->hidden->back_page) -+#define page_offset (this->hidden->page_offset) -+#define flip_pending (this->hidden->flip_pending) -+#endif - - /* Accelerator types that are supported by the driver, but are not - necessarily in the kernel headers on the system we compile on. --- -1.6.5 - diff --git a/tools/SDL1.2.7_CE/SDL-1.27_CE.diff b/tools/SDL1.2.7_CE/SDL-1.27_CE.diff deleted file mode 100644 index 196329b84..000000000 --- a/tools/SDL1.2.7_CE/SDL-1.27_CE.diff +++ /dev/null @@ -1,2260 +0,0 @@ -diff -ruN SDL-1.2.7-orig/src/audio/windib/SDL_dibaudio.c SDL-1.2.7/src/audio/windib/SDL_dibaudio.c ---- SDL-1.2.7-orig/src/audio/windib/SDL_dibaudio.c Wed Feb 18 09:22:00 2004 -+++ SDL-1.2.7/src/audio/windib/SDL_dibaudio.c Thu Nov 18 12:07:29 2004 -@@ -146,8 +146,16 @@ - - /* Set high priority for the audio thread */ - static void DIB_ThreadInit(_THIS) --{ -- SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); -+{ -+#ifdef _WIN32_WCE -+#ifdef SH3 -+ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL); -+#else -+ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); -+#endif -+#else -+ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); -+#endif - } - - void DIB_WaitAudio(_THIS) -diff -ruN SDL-1.2.7-orig/src/cpuinfo/SDL_cpuinfo.c SDL-1.2.7/src/cpuinfo/SDL_cpuinfo.c ---- SDL-1.2.7-orig/src/cpuinfo/SDL_cpuinfo.c Tue Feb 10 07:31:36 2004 -+++ SDL-1.2.7/src/cpuinfo/SDL_cpuinfo.c Fri Nov 19 20:53:01 2004 -@@ -38,6 +38,10 @@ - - #ifdef MACOSX - #include /* For AltiVec check */ -+#endif -+ -+#if defined(_MSC_VER) && (defined(ARM) || defined(MIPS) || defined(SHx)) -+#undef _MSC_VER - #endif - - #define CPU_HAS_RDTSC 0x00000001 -diff -ruN SDL-1.2.7-orig/src/joystick/win32/SDL_mmjoystick.c SDL-1.2.7/src/joystick/win32/SDL_mmjoystick.c ---- SDL-1.2.7-orig/src/joystick/win32/SDL_mmjoystick.c Wed Feb 18 09:22:02 2004 -+++ SDL-1.2.7/src/joystick/win32/SDL_mmjoystick.c Fri Nov 19 20:47:22 2004 -@@ -37,6 +37,7 @@ - - #include - #include -+#include - - #define MAX_JOYSTICKS 16 - #define MAX_AXES 6 /* each joystick can have up to 6 axes */ -@@ -51,6 +52,7 @@ - /* array to hold joystick ID values */ - static UINT SYS_JoystickID[MAX_JOYSTICKS]; - static JOYCAPS SYS_Joystick[MAX_JOYSTICKS]; -+static char *SYS_JoystickName[MAX_JOYSTICKS]; - - /* The private structure used to keep track of a joystick */ - struct joystick_hwdata -@@ -69,6 +71,78 @@ - /* Convert a win32 Multimedia API return code to a text message */ - static void SetMMerror(char *function, int code); - -+static char *GetJoystickName(int index, const char *szRegKey) -+{ -+ /* added 7/24/2004 by Eckhard Stolberg */ -+ /* -+ see if there is a joystick for the current -+ index (1-16) listed in the registry -+ */ -+ char *name = NULL; -+ HKEY hKey; -+ DWORD regsize; -+ LONG regresult; -+ unsigned char regkey[256]; -+ unsigned char regvalue[256]; -+ unsigned char regname[256]; -+ -+ sprintf(regkey, "%s\\%s\\%s", -+ REGSTR_PATH_JOYCONFIG, -+ szRegKey, -+ REGSTR_KEY_JOYCURR); -+ regresult = RegOpenKeyExA(HKEY_LOCAL_MACHINE, -+ (LPTSTR) ®key, 0, KEY_READ, &hKey); -+ if (regresult == ERROR_SUCCESS) -+ { -+ /* -+ find the registry key name for the -+ joystick's properties -+ */ -+ regsize = sizeof(regname); -+ sprintf(regvalue, -+ "Joystick%d%s", index+1, -+ REGSTR_VAL_JOYOEMNAME); -+ regresult = RegQueryValueExA(hKey, -+ regvalue, 0, 0, (LPBYTE) ®name, -+ (LPDWORD) ®size); -+ RegCloseKey(hKey); -+ if (regresult == ERROR_SUCCESS) -+ { -+ /* open that registry key */ -+ sprintf(regkey, "%s\\%s", -+ REGSTR_PATH_JOYOEM, regname); -+ regresult = RegOpenKeyExA(HKEY_LOCAL_MACHINE, -+ regkey, 0, KEY_READ, &hKey); -+ if (regresult == ERROR_SUCCESS) -+ { -+ /* find the size for the OEM name text */ -+ regsize = sizeof(regvalue); -+ regresult = -+ RegQueryValueExA(hKey, -+ REGSTR_VAL_JOYOEMNAME, -+ 0, 0, NULL, -+ (LPDWORD) ®size); -+ if (regresult == ERROR_SUCCESS) -+ { -+ /* -+ allocate enough memory -+ for the OEM name text ... -+ */ -+ name = (char *) malloc(regsize); -+ /* ... and read it from the registry */ -+ regresult = -+ RegQueryValueExA(hKey, -+ REGSTR_VAL_JOYOEMNAME, 0, 0, -+ (LPBYTE) name, -+ (LPDWORD) ®size); -+ RegCloseKey(hKey); -+ } -+ } -+ } -+ } -+ return(name); -+} -+ - - /* Function to scan the system for joysticks. - * This function should set SDL_numjoysticks to the number of available -@@ -94,6 +168,7 @@ - - for ( i = 0; i < MAX_JOYSTICKS; i++ ) { - SYS_JoystickID[i] = JOYSTICKID1 + i; -+ SYS_JoystickName[i] = NULL; - } - - -@@ -110,6 +185,7 @@ - if ( result == JOYERR_NOERROR ) { - SYS_JoystickID[numdevs] = SYS_JoystickID[i]; - SYS_Joystick[numdevs] = joycaps; -+ SYS_JoystickName[numdevs] = GetJoystickName(numdevs, joycaps.szRegKey); - numdevs++; - } - } -@@ -120,8 +196,11 @@ - /* Function to get the device-dependent name of a joystick */ - const char *SDL_SYS_JoystickName(int index) - { -- /***-> test for invalid index ? */ -+ if ( SYS_JoystickName[index] != NULL ) { -+ return(SYS_JoystickName[index]); -+ } else { - return(SYS_Joystick[index].szPname); -+ } - } - - /* Function to open a joystick for use. -@@ -292,7 +371,12 @@ - /* Function to perform any system-specific joystick related cleanup */ - void SDL_SYS_JoystickQuit(void) - { -- return; -+ int i; -+ for (i = 0; i < MAX_JOYSTICKS; i++) { -+ if ( SYS_JoystickName[i] != NULL ) { -+ free(SYS_JoystickName[i]); -+ } -+ } - } - - -diff -ruN SDL-1.2.7-orig/src/video/SDL_sysvideo.h SDL-1.2.7/src/video/SDL_sysvideo.h ---- SDL-1.2.7-orig/src/video/SDL_sysvideo.h Wed Feb 18 09:22:04 2004 -+++ SDL-1.2.7/src/video/SDL_sysvideo.h Thu Nov 18 12:08:48 2004 -@@ -361,6 +361,9 @@ - #endif - #ifdef ENABLE_WINDIB - extern VideoBootStrap WINDIB_bootstrap; -+#endif -+#ifdef ENABLE_WINGAPI -+extern VideoBootStrap WINGAPI_bootstrap; - #endif - #ifdef ENABLE_DIRECTX - extern VideoBootStrap DIRECTX_bootstrap; -diff -ruN SDL-1.2.7-orig/src/video/SDL_video.c SDL-1.2.7/src/video/SDL_video.c ---- SDL-1.2.7-orig/src/video/SDL_video.c Wed Feb 18 09:22:04 2004 -+++ SDL-1.2.7/src/video/SDL_video.c Thu Nov 18 12:11:01 2004 -@@ -80,6 +80,9 @@ - #endif - #ifdef ENABLE_DIRECTX - &DIRECTX_bootstrap, -+#endif -+#ifdef ENABLE_WINGAPI -+ &WINGAPI_bootstrap, - #endif - #ifdef ENABLE_WINDIB - &WINDIB_bootstrap, -diff -ruN SDL-1.2.7-orig/src/video/wincommon/SDL_sysevents.c SDL-1.2.7/src/video/wincommon/SDL_sysevents.c ---- SDL-1.2.7-orig/src/video/wincommon/SDL_sysevents.c Wed Feb 18 09:22:10 2004 -+++ SDL-1.2.7/src/video/wincommon/SDL_sysevents.c Thu Nov 18 12:28:03 2004 -@@ -40,6 +40,9 @@ - #include "SDL_lowvideo.h" - #include "SDL_syswm_c.h" - #include "SDL_main.h" -+#ifdef _WIN32_CE -+#include "SDL_dibvideo.h" -+#endif - - #ifdef WMMSG_DEBUG - #include "wmmsg.h" -@@ -173,6 +176,39 @@ - SDL_SetModState(state); - #endif /* !NO_GETKEYBOARDSTATE */ - } -+ -+#ifdef _WIN32_CE -+void transform(SDL_RotateAttr rotate, char ozone, Sint16 *x, Sint16 *y) { -+ Sint16 rotatedX; -+ Sint16 rotatedY; -+ -+ if (ozone) { -+ *x = *x * 2; -+ *y = *y * 2; -+ } -+ -+ switch(rotate) { -+ case SDL_ROTATE_NONE: -+ break; -+ case SDL_ROTATE_LEFT: -+ if (!SDL_VideoSurface) -+ break; -+ rotatedX = SDL_VideoSurface->w - *y; -+ rotatedY = *x; -+ *x = rotatedX; -+ *y = rotatedY; -+ break; -+ case SDL_ROTATE_RIGHT: -+ if (!SDL_VideoSurface) -+ break; -+ rotatedX = *y; -+ rotatedY = SDL_VideoSurface->h - *x; -+ *x = rotatedX; -+ *y = rotatedY; -+ break; -+ } -+} -+#endif - - /* The main Win32 event handler - DJM: This is no longer static as (DX5/DIB)_CreateWindow needs it -@@ -273,7 +309,11 @@ - SetCursorPos(center.x, center.y); - posted = SDL_PrivateMouseMotion(0, 1, x, y); - } -- } else { -+ } else { -+#ifdef _WIN32_CE -+ if (SDL_VideoSurface) -+ transform(rotation, ozoneHack, &x, &y); -+#endif - posted = SDL_PrivateMouseMotion(0, 0, x, y); - } - } -@@ -361,8 +401,16 @@ - x = 0; y = 0; - } else { - x = (Sint16)LOWORD(lParam); -- y = (Sint16)HIWORD(lParam); -- } -+ y = (Sint16)HIWORD(lParam); -+#ifdef _WIN32_CE -+ if (SDL_VideoSurface) -+ transform(rotation, ozoneHack, &x, &y); -+#endif -+ } -+#ifdef _WIN32_WCE -+ /* Since stylus movements are not continuous */ -+ posted = SDL_PrivateMouseMotion(0, 0, x, y); -+#endif - posted = SDL_PrivateMouseButton( - state, button, x, y); - } -diff -ruN SDL-1.2.7-orig/src/video/wincommon/SDL_sysmouse.c SDL-1.2.7/src/video/wincommon/SDL_sysmouse.c ---- SDL-1.2.7-orig/src/video/wincommon/SDL_sysmouse.c Sat Aug 30 13:13:12 2003 -+++ SDL-1.2.7/src/video/wincommon/SDL_sysmouse.c Thu Nov 18 12:29:20 2004 -@@ -250,12 +250,16 @@ - - /* Check to see if we need to enter or leave mouse relative mode */ - void WIN_CheckMouseMode(_THIS) --{ -+{ -+#ifdef _WIN32_WCE -+ mouse_relative = 0; -+#else - /* If the mouse is hidden and input is grabbed, we use relative mode */ - if ( !(SDL_cursorstate & CURSOR_VISIBLE) && - (this->input_grab != SDL_GRAB_OFF) ) { - mouse_relative = 1; - } else { - mouse_relative = 0; -- } -+ } -+#endif - } -diff -ruN SDL-1.2.7-orig/src/video/windib/SDL_dibevents.c SDL-1.2.7/src/video/windib/SDL_dibevents.c ---- SDL-1.2.7-orig/src/video/windib/SDL_dibevents.c Wed Feb 18 09:22:10 2004 -+++ SDL-1.2.7/src/video/windib/SDL_dibevents.c Thu Nov 18 13:12:28 2004 -@@ -58,6 +58,29 @@ - /* DJM: If the user setup the window for us, we want to save his window proc, - and give him a chance to handle some messages. */ - static WNDPROC userWindowProc = NULL; -+ -+#ifdef _WIN32_WCE -+ -+WPARAM rotateKey(WPARAM key, SDL_RotateAttr direction) { -+ if (direction != SDL_ROTATE_LEFT) -+ return key; -+ -+ switch (key) { -+ case 0x26: /* up */ -+ return 0x27; -+ case 0x27: /* right */ -+ return 0x28; -+ case 0x28: /* down */ -+ return 0x25; -+ case 0x25: /* left */ -+ return 0x26; -+ } -+ -+ return key; -+} -+ -+#endif -+ - - /* The main Win32 event handler */ - LONG -@@ -69,6 +92,16 @@ - case WM_SYSKEYDOWN: - case WM_KEYDOWN: { - SDL_keysym keysym; -+ -+#ifdef _WIN32_WCE -+ // Drop GAPI artefacts -+ if (wParam == 0x84 || wParam == 0x5B) -+ return 0; -+ -+ // Rotate key if necessary -+ if (rotation != SDL_ROTATE_NONE) -+ wParam = rotateKey(wParam, rotation); -+#endif - - /* Ignore repeated keys */ - if ( lParam&REPEATED_KEYMASK ) { -@@ -129,6 +162,16 @@ - case WM_KEYUP: { - SDL_keysym keysym; - -+#ifdef _WIN32_WCE -+ // Drop GAPI artefacts -+ if (wParam == 0x84 || wParam == 0x5B) -+ return 0; -+ -+ // Rotate key if necessary -+ if (rotation != SDL_ROTATE_NONE) -+ wParam = rotateKey(wParam, rotation); -+#endif -+ - switch (wParam) { - case VK_CONTROL: - if ( lParam&EXTENDED_KEYMASK ) -@@ -333,7 +376,16 @@ - VK_keymap[VK_APPS] = SDLK_MENU; - - prev_shiftstates[0] = FALSE; -- prev_shiftstates[1] = FALSE; -+ prev_shiftstates[1] = FALSE; -+ -+#ifdef _WIN32_WCE -+ /* Hardcode the 4 magic keys to F1 F2 F3 F4 - the actual location of the keys varies ... */ -+ VK_keymap[0xC1] = SDLK_F1; -+ VK_keymap[0xC2] = SDLK_F2; -+ VK_keymap[0xC3] = SDLK_F3; -+ VK_keymap[0xC4] = SDLK_F4; -+#endif -+ - } - - static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, int pressed) -@@ -364,9 +416,15 @@ - { - #ifndef CS_BYTEALIGNCLIENT - #define CS_BYTEALIGNCLIENT 0 -+#endif -+#ifdef _WIN32_CE -+ SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT | CS_HREDRAW | CS_VREDRAW, 0); -+#else -+ SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT, 0); - #endif -- SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT, 0); -- if ( SDL_windowid ) { -+ if ( SDL_windowid ) { -+// FIXME -+#ifndef _WIN32_WCE - SDL_Window = (HWND)strtol(SDL_windowid, NULL, 0); - - /* DJM: we want all event's for the user specified -@@ -375,11 +433,19 @@ - if (SDL_Window) { - userWindowProc = (WNDPROC)GetWindowLong(SDL_Window, GWL_WNDPROC); - SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage); -- } -- } else { -+ } -+ #endif -+ } else { -+#ifdef _WIN32_WCE -+ -+ SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX), -+ 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), -+ NULL, NULL, SDL_Instance, NULL); -+#else - SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, - (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX), -- CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, NULL, NULL, SDL_Instance, NULL); -+ CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, NULL, NULL, SDL_Instance, NULL); -+#endif - if ( SDL_Window == NULL ) { - SDL_SetError("Couldn't create window"); - return(-1); -diff -ruN SDL-1.2.7-orig/src/video/windib/SDL_dibvideo.c SDL-1.2.7/src/video/windib/SDL_dibvideo.c ---- SDL-1.2.7-orig/src/video/windib/SDL_dibvideo.c Wed Feb 18 09:22:10 2004 -+++ SDL-1.2.7/src/video/windib/SDL_dibvideo.c Mon Aug 8 18:27:52 2005 -@@ -29,15 +29,26 @@ - #include - #include - #include --#if defined(WIN32_PLATFORM_PSPC) -+#if (defined (UNDER_CE) && (UNDER_CE >= 420)) - #include // Add Pocket PC includes - #pragma comment( lib, "aygshell" ) // Link Pocket PC library - #endif -+ -+#ifdef _MSC_VER -+#pragma warning(disable: 4244) -+#define inline __inline -+#endif -+ - - /* Not yet in the mingw32 cross-compile headers */ - #ifndef CDS_FULLSCREEN - #define CDS_FULLSCREEN 4 - #endif -+ -+#ifndef WS_THICKFRAME -+#define WS_THICKFRAME 0 -+#endif -+ - - #include "SDL.h" - #include "SDL_mutex.h" -@@ -55,7 +66,18 @@ - #ifdef _WIN32_WCE - #define NO_GETDIBITS - #define NO_CHANGEDISPLAYSETTINGS --#define NO_GAMMA_SUPPORT -+#define NO_GAMMA_SUPPORT -+ -+/* uncomment this line if you target WinCE 3.x platform: */ -+//#define NO_SETDIBCOLORTABLE -+ -+/* these 2 variables are used to suport paletted DIBs on WinCE 3.x that -+ does not implement SetDIBColorTable, and when SetDIBColorTable is not working. -+ Slow. DIB is recreated every time. -+*/ -+static BITMAPINFO *last_bitmapinfo; -+static void** last_bits; -+ - #endif - #ifndef WS_MAXIMIZE - #define WS_MAXIMIZE 0 -@@ -96,6 +118,13 @@ - - /* helper fn */ - static int DIB_SussScreenDepth(); -+ -+#ifdef _WIN32_WCE -+void DIB_ShowTaskBar(BOOL taskBarShown); -+#ifdef ENABLE_WINGAPI -+extern void GAPI_GrabHardwareKeys(BOOL grab); -+#endif -+#endif - - /* DIB driver bootstrap functions */ - -@@ -352,6 +381,9 @@ - - /* Fill in some window manager capabilities */ - this->info.wm_available = 1; -+ -+ /* Rotation information */ -+ rotation = SDL_ROTATE_NONE; - - /* We're done! */ - return(0); -@@ -370,7 +402,43 @@ - } - #endif - } -- -+ -+#ifdef _WIN32_WCE -+ -+void DIB_ShowTaskBar(BOOL taskBarShown) { -+#if (UNDER_CE < 420) -+ // Hide taskbar, WinCE 2.x style - from EasyCE -+ HKEY hKey=0; -+ DWORD dwValue = 0; -+ unsigned long lSize = sizeof( DWORD ); -+ DWORD dwType = REG_DWORD; -+ HWND hWnd; -+ -+ RegOpenKeyEx( HKEY_LOCAL_MACHINE, TEXT("\\software\\microsoft\\shell"), 0, KEY_ALL_ACCESS, &hKey ); -+ RegQueryValueEx( hKey, TEXT("TBOpt"), 0, &dwType, (BYTE*)&dwValue, &lSize ); -+ if (taskBarShown) -+ dwValue &= 0xFFFFFFFF - 8; // reset bit to show taskbar -+ else -+ dwValue |= 8; // set bit to hide taskbar -+ RegSetValueEx( hKey, TEXT("TBOpt"), 0, REG_DWORD, (BYTE*)&dwValue, lSize ); -+ hWnd = FindWindow( TEXT("HHTaskBar"), NULL ); -+ SendMessage(hWnd, WM_COMMAND, 0x03EA, 0 ); -+ SetForegroundWindow(SDL_Window); -+#else -+ if (taskBarShown) -+ SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON | SHFS_SHOWSTARTICON); -+ else -+ SHFullScreen(SDL_Window, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON | SHFS_HIDESTARTICON); -+#endif -+ if (FindWindow(TEXT("HHTaskBar"), NULL)) { // is it valid for HPC ? -+ if (taskBarShown) -+ ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_SHOWNORMAL); -+ else -+ ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_HIDE); -+ } -+} -+ -+#endif - - /* - Helper fn to work out which screen depth windows is currently using. -@@ -444,7 +512,8 @@ - - - /* Various screen update functions available */ --static void DIB_NormalUpdate(_THIS, int numrects, SDL_Rect *rects); -+static void DIB_NormalUpdate(_THIS, int numrects, SDL_Rect *rects); -+static void DIB_RotatedUpdate(_THIS, int numrects, SDL_Rect *rects); - - SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current, - int width, int height, int bpp, Uint32 flags) -@@ -463,12 +532,20 @@ - HDC hdc; - RECT bounds; - int x, y; -- Uint32 Rmask, Gmask, Bmask; -- -+ Uint32 Rmask, Gmask, Bmask; -+#ifdef _WIN32_CE -+ int screenWidth, screenHeight; -+#endif -+#ifdef UNDER_CE -+ int i; -+#endif -+ -+#ifdef HAVE_OPENGL - /* Clean up any GL context that may be hanging around */ - if ( current->flags & SDL_OPENGL ) { - WIN_GL_ShutDown(this); -- } -+ } -+#endif - - /* Recalculate the bitmasks if necessary */ - if ( bpp == current->format->BitsPerPixel ) { -@@ -517,20 +594,16 @@ - video->h = height; - video->pitch = SDL_CalculatePitch(video); - --#ifdef WIN32_PLATFORM_PSPC -+#ifdef _WIN32_CE - /* Stuff to hide that $#!^%#$ WinCE taskbar in fullscreen... */ - if ( flags & SDL_FULLSCREEN ) { - if ( !(prev_flags & SDL_FULLSCREEN) ) { -- SHFullScreen(SDL_Window, SHFS_HIDETASKBAR); -- SHFullScreen(SDL_Window, SHFS_HIDESIPBUTTON); -- ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_HIDE); -+ DIB_ShowTaskBar(FALSE); - } - video->flags |= SDL_FULLSCREEN; - } else { - if ( prev_flags & SDL_FULLSCREEN ) { -- SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR); -- SHFullScreen(SDL_Window, SHFS_SHOWSIPBUTTON); -- ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_SHOWNORMAL); -+ DIB_ShowTaskBar(TRUE); - } - } - #endif -@@ -640,28 +713,82 @@ - ((Uint32*)binfo->bmiColors)[0] = video->format->Rmask; - ((Uint32*)binfo->bmiColors)[1] = video->format->Gmask; - ((Uint32*)binfo->bmiColors)[2] = video->format->Bmask; -- } else { -+ } else { -+#ifdef UNDER_CE -+ binfo->bmiHeader.biCompression = BI_RGB; /* 332 */ -+ if ( video->format->palette ) { -+ binfo->bmiHeader.biClrUsed = video->format->palette->ncolors; -+ for(i=0; iformat->palette->ncolors; i++) -+ { -+ binfo->bmiColors[i].rgbRed=i&(7<<5); -+ binfo->bmiColors[i].rgbGreen=(i&(7<<2))<<3; -+ binfo->bmiColors[i].rgbBlue=(i&3)<<5; -+ binfo->bmiColors[i].rgbReserved=0; -+ } -+ } -+#else - binfo->bmiHeader.biCompression = BI_RGB; /* BI_BITFIELDS for 565 vs 555 */ - if ( video->format->palette ) { - memset(binfo->bmiColors, 0, - video->format->palette->ncolors*sizeof(RGBQUAD)); -- } -+ } -+#endif - } - - /* Create the offscreen bitmap buffer */ -- hdc = GetDC(SDL_Window); -+ hdc = GetDC(SDL_Window); -+#ifdef _WIN32_CE -+ /* See if we need to rotate the buffer (WinCE specific) */ -+ screenWidth = GetDeviceCaps(hdc, HORZRES); -+ screenHeight = GetDeviceCaps(hdc, VERTRES); -+ rotation = SDL_ROTATE_NONE; -+ work_pixels = NULL; -+ if (rotation_pixels) { -+ free(rotation_pixels); -+ rotation_pixels = NULL; -+ } -+ -+ if ((flags & SDL_FULLSCREEN) && (width>height) && (width > screenWidth) ) { -+ /* OK, we rotate the screen */ -+ video->pixels = malloc(video->h * video->pitch); -+ rotation_pixels = video->pixels; -+ if (video->pixels) -+ rotation = SDL_ROTATE_LEFT; -+ OutputDebugString(TEXT("will rotate\r\n")); -+ } -+ screen_bmp = CreateDIBSection(hdc, binfo, DIB_RGB_COLORS, -+ (rotation == SDL_ROTATE_NONE ? (void **)(&video->pixels) : (void**)&work_pixels), NULL, 0); -+#else - screen_bmp = CreateDIBSection(hdc, binfo, DIB_RGB_COLORS, -- (void **)(&video->pixels), NULL, 0); -- ReleaseDC(SDL_Window, hdc); -- free(binfo); -+ (void **)(&video->pixels), NULL, 0); -+#endif -+ ReleaseDC(SDL_Window, hdc); -+#ifdef UNDER_CE -+/* keep bitmapinfo for palette in 8-bit modes for devices that don't have SetDIBColorTable */ -+ last_bits = (rotation == SDL_ROTATE_NONE ? (void **)(&video->pixels) : (void**)&work_pixels); -+ if(last_bitmapinfo) -+ free(last_bitmapinfo); -+ if(is16bitmode) -+ { -+ last_bitmapinfo = 0; -+ free(binfo); -+ } else -+ last_bitmapinfo = binfo; -+#else -+ free(binfo); -+#endif - if ( screen_bmp == NULL ) { - if ( video != current ) { - SDL_FreeSurface(video); - } - SDL_SetError("Couldn't create DIB section"); - return(NULL); -- } -- this->UpdateRects = DIB_NormalUpdate; -+ } -+#ifdef _WIN32_CE -+ this->UpdateRects = (work_pixels ? DIB_RotatedUpdate : DIB_NormalUpdate); -+#else -+ this->UpdateRects = DIB_NormalUpdate; -+#endif - - /* Set video surface flags */ - if ( bpp <= 8 ) { -@@ -695,7 +822,15 @@ - bounds.left = SDL_windowX; - bounds.top = SDL_windowY; - bounds.right = SDL_windowX+video->w; -- bounds.bottom = SDL_windowY+video->h; -+ bounds.bottom = SDL_windowY+video->h; -+#ifdef UNDER_CE -+ if(rotation != SDL_ROTATE_NONE) -+ { -+ int t=bounds.right; -+ bounds.right = bounds.bottom; -+ bounds.bottom=t; -+ } -+#endif - AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0); - width = bounds.right-bounds.left; - height = bounds.bottom-bounds.top; -@@ -709,8 +844,10 @@ - x = (GetSystemMetrics(SM_CXSCREEN)-width)/2; - y = (GetSystemMetrics(SM_CYSCREEN)-height)/2; - } else { -- x = y = -1; -- swp_flags |= SWP_NOMOVE; -+ x = y = -1; -+#ifndef UNDER_CE -+ swp_flags |= SWP_NOMOVE; -+#endif - } - if ( y < 0 ) { /* Cover up title bar for more client area */ - y -= GetSystemMetrics(SM_CYCAPTION)/2; -@@ -719,19 +856,44 @@ - top = HWND_TOPMOST; - } else { - top = HWND_NOTOPMOST; -- } -- SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags); -+ } -+#ifdef _WIN32_CE -+ if (flags & SDL_FULLSCREEN) { -+/* When WinCE program switches resolution from larger to smaller we should move its window so it would be visible in fullscreen */ -+// SetWindowPos(SDL_Window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); -+ DIB_ShowTaskBar(FALSE); -+ if(x>0) x=0; // remove space from the left side of a screen in 320x200 mode -+ if(y>0) y=0; -+ SetWindowPos(SDL_Window, HWND_TOPMOST, x, y, width, height, SWP_NOCOPYBITS); -+ ShowWindow(SDL_Window, SW_SHOW); -+ } -+ else -+ SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags); -+#else -+ SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags); -+#endif - SDL_resizing = 0; - SetForegroundWindow(SDL_Window); - } - - /* Set up for OpenGL */ -- if ( flags & SDL_OPENGL ) { -+ if ( flags & SDL_OPENGL ) { -+#ifdef HAVE_OPENGL - if ( WIN_GL_SetupWindow(this) < 0 ) { - return(NULL); - } -- video->flags |= SDL_OPENGL; -- } -+ video->flags |= SDL_OPENGL; -+#else -+ return NULL; -+#endif -+ } -+ -+#ifdef ENABLE_WINGAPI -+ /* Grab hardware keys if necessary */ -+ if ( flags & SDL_FULLSCREEN ) { -+ GAPI_GrabHardwareKeys(TRUE); -+ } -+#endif - - /* We're live! */ - return(video); -@@ -754,22 +916,169 @@ - { - return; - } -+ -+#ifdef _WIN32_CE -+ -+static inline void rotateBlit(unsigned short *src, unsigned short *dest, SDL_Rect *rect, int pitch) { -+ int i=rect->w, j=rect->h; -+ src+=i; -+ -+ for (;i--;) { -+ register unsigned short *S=src--; -+// I use loop unrolling to spedup things a little -+ int cnt = j; -+ if(cnt&1) -+ { -+ *(dest++) = *S; -+ S+=pitch; -+ } -+ cnt>>=1; -+ if(cnt&1) -+ { -+ *(dest++) = *S; -+ S+=pitch; -+ *(dest++) = *S; -+ S+=pitch; -+ } -+ cnt>>=1; -+ for (; cnt--; ) { -+ *(dest++) = *S; -+ S+=pitch; -+ *(dest++) = *S; -+ S+=pitch; -+ *(dest++) = *S; -+ S+=pitch; -+ *(dest++) = *S; -+ S+=pitch; -+ } -+ } -+/* tiny optimization -+ int i, j; -+ src+=rect->w; -+ -+ for (i=0; iw; i++) { -+ register unsigned short *S=src--; -+ for (j=0; jh; j++) { -+ *(dest++) = *S; -+ S+=pitch; -+ } -+ } -+*/ -+/* original unoptimized version -+ int i, j; -+ -+ for (i=0; iw; i++) { -+ for (j=0; jh; j++) { -+ dest[i * rect->h + j] = src[pitch * j + (rect->w - i)]; -+ } -+ } -+*/ -+} -+ -+static inline void rotateBlit8(unsigned char *src, unsigned char *dest, SDL_Rect *rect, int pitch) { -+ int i=rect->w, j=rect->h; -+ src+=i; -+ -+ for (;i--;) { -+ register unsigned char *S=src--; -+// I use loop unrolling to spedup things a little -+ int cnt = j; -+ if(cnt&1) -+ { -+ *(dest++) = *S; -+ S+=pitch; -+ } -+ cnt>>=1; -+ if(cnt&1) -+ { -+ *(dest++) = *S; -+ S+=pitch; -+ *(dest++) = *S; -+ S+=pitch; -+ } -+ cnt>>=1; -+ for (; cnt--; ) { -+ *(dest++) = *S; -+ S+=pitch; -+ *(dest++) = *S; -+ S+=pitch; -+ *(dest++) = *S; -+ S+=pitch; -+ *(dest++) = *S; -+ S+=pitch; -+ } -+ } -+} -+ -+static void DIB_RotatedUpdate(_THIS, int numrects, SDL_Rect *rects) -+{ -+ HDC hdc, mdc; -+ HBITMAP hb, old; -+ int i; -+ -+ hdc = GetDC(SDL_Window); -+ if ( screen_pal ) { -+ SelectPalette(hdc, screen_pal, FALSE); -+ } -+ mdc = CreateCompatibleDC(hdc); -+ /*SelectObject(mdc, screen_bmp);*/ -+ if(this->screen->format->BytesPerPixel == 2) { -+ for ( i=0; iscreen->pixels; -+ rotateBlit(src + (this->screen->w * rects[i].y) + rects[i].x, work_pixels, &rects[i], this->screen->w); -+ hb = CreateBitmap(rects[i].h, rects[i].w, 1, 16, work_pixels); -+ old = (HBITMAP)SelectObject(mdc, hb); -+ BitBlt(hdc, rects[i].y, this->screen->w - (rects[i].x + rects[i].w), rects[i].h, rects[i].w, -+ mdc, 0, 0, SRCCOPY); -+ SelectObject(mdc, old); -+ DeleteObject(hb); -+ } -+ } else { -+ if ( screen_pal ) { -+ SelectPalette(mdc, screen_pal, FALSE); -+ } -+ for ( i=0; iscreen->pixels; -+ rotateBlit8(src + (this->screen->w * rects[i].y) + rects[i].x, work_pixels, &rects[i], this->screen->w); -+ hb = CreateBitmap(rects[i].h, rects[i].w, 1, 8, work_pixels); -+ old = (HBITMAP)SelectObject(mdc, hb); -+ BitBlt(hdc, rects[i].y, this->screen->w - (rects[i].x + rects[i].w), rects[i].h, rects[i].w, -+ mdc, 0, 0, SRCCOPY); -+ SelectObject(mdc, old); -+ DeleteObject(hb); -+ } -+ } -+ DeleteDC(mdc); -+ ReleaseDC(SDL_Window, hdc); -+} -+#endif -+ - - static void DIB_NormalUpdate(_THIS, int numrects, SDL_Rect *rects) - { - HDC hdc, mdc; -- int i; -+ int i; -+#ifdef _WIN32_CE -+ HBITMAP old; -+#endif - - hdc = GetDC(SDL_Window); - if ( screen_pal ) { - SelectPalette(hdc, screen_pal, FALSE); - } -- mdc = CreateCompatibleDC(hdc); -- SelectObject(mdc, screen_bmp); -+ mdc = CreateCompatibleDC(hdc); -+#ifdef _WIN32_CE -+ old = (HBITMAP)SelectObject(mdc, screen_bmp); -+#else -+ SelectObject(mdc, screen_bmp); -+#endif - for ( i=0; ibmiHeader.biClrUsed=256; -+ for ( i=firstcolor; ibmiColors[i]=pal[i]; -+ screen_bmp = CreateDIBSection(hdc, last_bitmapinfo, DIB_RGB_COLORS, -+ last_bits, NULL, 0); -+ } -+#else - SelectObject(mdc, screen_bmp); -- SetDIBColorTable(mdc, firstcolor, ncolors, pal); -+ SetDIBColorTable(mdc, firstcolor, ncolors, pal); -+#endif -+#ifndef UNDER_CE - BitBlt(hdc, 0, 0, this->screen->w, this->screen->h, -- mdc, 0, 0, SRCCOPY); -+ mdc, 0, 0, SRCCOPY); -+#else -+ { -+ SDL_Rect rect; -+ rect.x=0; rect.y=0; -+ rect.w=this->screen->w; rect.h=this->screen->h; -+// Fixme: screen flickers: (this->UpdateRects)(this, 1, &rect) ; -+ } -+#endif - DeleteDC(mdc); --#endif - ReleaseDC(SDL_Window, hdc); - return(1); - } -@@ -937,27 +1270,27 @@ - - void DIB_VideoQuit(_THIS) - { -- /* Destroy the window and everything associated with it */ -+ /* Destroy the window and everything associated with it */ -+#ifdef _WIN32_CE -+ DIB_ShowTaskBar(TRUE); -+#ifdef ENABLE_WINGAPI -+ GAPI_GrabHardwareKeys(FALSE); -+#endif -+#endif - if ( SDL_Window ) { - /* Delete the screen bitmap (also frees screen->pixels) */ - if ( this->screen ) { --#ifdef WIN32_PLATFORM_PSPC -- if ( this->screen->flags & SDL_FULLSCREEN ) { -- /* Unhide taskbar, etc. */ -- SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR); -- SHFullScreen(SDL_Window, SHFS_SHOWSIPBUTTON); -- ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_SHOWNORMAL); -- } --#endif - #ifndef NO_CHANGEDISPLAYSETTINGS - if ( this->screen->flags & SDL_FULLSCREEN ) { - ChangeDisplaySettings(NULL, 0); - ShowWindow(SDL_Window, SW_HIDE); - } --#endif -+#endif -+#ifdef HAVE_OPENGL - if ( this->screen->flags & SDL_OPENGL ) { - WIN_GL_ShutDown(this); -- } -+ } -+#endif - this->screen->pixels = NULL; - } - if ( screen_bmp ) { -diff -ruN SDL-1.2.7-orig/src/video/windib/SDL_dibvideo.h SDL-1.2.7/src/video/windib/SDL_dibvideo.h ---- SDL-1.2.7-orig/src/video/windib/SDL_dibvideo.h Wed Feb 18 09:22:10 2004 -+++ SDL-1.2.7/src/video/windib/SDL_dibvideo.h Thu Nov 18 13:13:42 2004 -@@ -29,11 +29,26 @@ - #define _SDL_dibvideo_h - - #include -+ -+//#ifdef _WIN32_CE -+/* Rotation direction */ -+typedef enum { -+ SDL_ROTATE_NONE, -+ SDL_ROTATE_LEFT, -+ SDL_ROTATE_RIGHT -+} SDL_RotateAttr; -+//#endif - - /* Private display data */ - struct SDL_PrivateVideoData { - HBITMAP screen_bmp; -- HPALETTE screen_pal; -+ HPALETTE screen_pal; -+//#ifdef _WIN32_CE -+ void *work_pixels; /* if the display needs to be rotated, memory allocated by the API */ -+ void *rotation_pixels; /* if the display needs to be rotated, memory allocated by the code */ -+ SDL_RotateAttr rotation; -+ char ozoneHack; /* force stylus translation if running without Hi Res flag */ -+//#endif - - #define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */ - int SDL_nummodes[NUM_MODELISTS]; -@@ -43,6 +58,12 @@ - #define screen_bmp (this->hidden->screen_bmp) - #define screen_pal (this->hidden->screen_pal) - #define SDL_nummodes (this->hidden->SDL_nummodes) --#define SDL_modelist (this->hidden->SDL_modelist) -+#define SDL_modelist (this->hidden->SDL_modelist) -+//#ifdef _WIN32_CE -+#define work_pixels (this->hidden->work_pixels) -+#define rotation (this->hidden->rotation) -+#define rotation_pixels (this->hidden->rotation_pixels) -+#define ozoneHack (this->hidden->ozoneHack) -+//#endif - - #endif /* _SDL_dibvideo_h */ -diff -ruN SDL-1.2.7-orig/src/video/wingapi/SDL_gapivideo.c SDL-1.2.7/src/video/wingapi/SDL_gapivideo.c ---- SDL-1.2.7-orig/src/video/wingapi/SDL_gapivideo.c Wed Dec 31 19:00:00 1969 -+++ SDL-1.2.7/src/video/wingapi/SDL_gapivideo.c Thu Nov 18 13:43:27 2004 -@@ -0,0 +1,956 @@ -+/* -+ SDL - Simple DirectMedia Layer -+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License as published by the Free Software Foundation; either -+ version 2 of the License, or (at your option) any later version. -+ -+ This library 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 -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public -+ License along with this library; if not, write to the Free -+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ -+ Sam Lantinga -+ slouken@libsdl.org -+*/ -+ -+#ifdef SAVE_RCSID -+static char rcsid = -+ "@(#) $Id: SDL_gapivideo.c,v 1.5 2004/02/29 21:54:11 lemure Exp $"; -+#endif -+ -+/* Dummy SDL video driver implementation; this is just enough to make an -+ * SDL-based application THINK it's got a working video driver, for -+ * applications that call SDL_Init(SDL_INIT_VIDEO) when they don't need it, -+ * and also for use as a collection of stubs when porting SDL to a new -+ * platform for which you haven't yet written a valid video driver. -+ * -+ * This is also a great way to determine bottlenecks: if you think that SDL -+ * is a performance problem for a given platform, enable this driver, and -+ * then see if your application runs faster without video overhead. -+ * -+ * Initial work by Ryan C. Gordon (icculus@linuxgames.com). A good portion -+ * of this was cut-and-pasted from Stephane Peter's work in the AAlib -+ * SDL video driver. Renamed to "DUMMY" by Sam Lantinga. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+/* Not yet in the mingw32 cross-compile headers */ -+#ifndef CDS_FULLSCREEN -+#define CDS_FULLSCREEN 4 -+#endif -+ -+#ifndef WS_THICKFRAME -+#define WS_THICKFRAME 0 -+#endif -+ -+#include "SDL.h" -+#include "SDL_mutex.h" -+#include "SDL_syswm.h" -+#include "SDL_sysvideo.h" -+#include "SDL_sysevents.h" -+#include "SDL_events_c.h" -+#include "SDL_pixels_c.h" -+#include "SDL_syswm_c.h" -+#include "SDL_sysmouse_c.h" -+#include "SDL_dibevents_c.h" -+#include "SDL_gapivideo.h" -+ -+#if defined(WIN32_PLATFORM_PSPC) -+#include // Add Pocket PC includes -+#pragma comment( lib, "aygshell" ) // Link Pocket PC library -+#endif -+ -+#ifdef _WIN32_WCE -+extern void DIB_ShowTaskBar(BOOL taskBarShown); -+#endif -+ -+ -+/* Initialization/Query functions */ -+static int GAPI_VideoInit(_THIS, SDL_PixelFormat *vformat); -+static SDL_Rect **GAPI_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags); -+static SDL_Surface *GAPI_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); -+static int GAPI_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors); -+static void GAPI_VideoQuit(_THIS); -+ -+ -+/* Hardware surface functions */ -+static int GAPI_AllocHWSurface(_THIS, SDL_Surface *surface); -+static int GAPI_LockHWSurface(_THIS, SDL_Surface *surface); -+static void GAPI_UnlockHWSurface(_THIS, SDL_Surface *surface); -+static void GAPI_FreeHWSurface(_THIS, SDL_Surface *surface); -+ -+/* Windows message handling functions, will not be processed */ -+static void GAPI_RealizePalette(_THIS); -+static void GAPI_PaletteChanged(_THIS, HWND window); -+static void GAPI_WinPAINT(_THIS, HDC hdc); -+ -+static void GAPI_UpdateRects(_THIS, int numrects, SDL_Rect *rects); -+/*static void GAPI_UpdateRectsMono(_THIS, int numrects, SDL_Rect *rects);*/ -+ -+static int GAPI_Available(void); -+static SDL_VideoDevice *GAPI_CreateDevice(int devindex); -+ -+void GAPI_GrabHardwareKeys(BOOL grab); -+ -+VideoBootStrap WINGAPI_bootstrap = { -+ "wingapi", "WinCE GAPI", -+ GAPI_Available, GAPI_CreateDevice -+}; -+ -+/* 2003 SE GAPI emulation */ -+ -+#define GETRAWFRAMEBUFFER 0x00020001 -+ -+#define FORMAT_565 1 -+#define FORMAT_555 2 -+#define FORMAT_OTHER 3 -+ -+static void* _OzoneFrameBuffer = NULL; -+static struct GXDisplayProperties _OzoneDisplayProperties; -+static char _OzoneAvailable = 0; -+ -+typedef struct _RawFrameBufferInfo -+{ -+ WORD wFormat; -+ WORD wBPP; -+ VOID *pFramePointer; -+ int cxStride; -+ int cyStride; -+ int cxPixels; -+ int cyPixels; -+} RawFrameBufferInfo; -+ -+ -+struct GXDisplayProperties Ozone_GetDisplayProperties(void) { -+ return _OzoneDisplayProperties; -+} -+ -+int Ozone_OpenDisplay(HWND window, unsigned long flag) { -+ return 1; -+} -+ -+int Ozone_CloseDisplay(void) { -+ return 1; -+} -+ -+void* Ozone_BeginDraw(void) { -+ return _OzoneFrameBuffer; -+} -+ -+int Ozone_EndDraw(void) { -+ return 1; -+} -+ -+int Ozone_Suspend(void) { -+ return 1; -+} -+ -+int Ozone_Resume(void) { -+ return 1; -+} -+ -+static HINSTANCE checkOzone(tGXDisplayProperties *gxGetDisplayProperties, tGXOpenDisplay *gxOpenDisplay, -+ tGXVoidFunction *gxCloseDisplay, tGXBeginDraw *gxBeginDraw, -+ tGXVoidFunction *gxEndDraw, tGXVoidFunction *gxSuspend, tGXVoidFunction *gxResume) { -+#ifdef ARM -+ -+ int result; -+ RawFrameBufferInfo frameBufferInfo; -+ HDC hdc = GetDC(NULL); -+ result = ExtEscape(hdc, GETRAWFRAMEBUFFER, 0, NULL, sizeof(RawFrameBufferInfo), (char *)&frameBufferInfo); -+ ReleaseDC(NULL, hdc); -+ if (result < 0) -+ return NULL; -+ OutputDebugString(TEXT("Running on Ozone\r\n")); -+ _OzoneAvailable = 1; -+ -+ // Initializing global parameters -+ _OzoneFrameBuffer = frameBufferInfo.pFramePointer; -+ _OzoneDisplayProperties.cBPP = frameBufferInfo.wBPP; -+ _OzoneDisplayProperties.cbxPitch = frameBufferInfo.cxStride; -+ _OzoneDisplayProperties.cbyPitch = frameBufferInfo.cyStride; -+ _OzoneDisplayProperties.cxWidth = frameBufferInfo.cxPixels; -+ _OzoneDisplayProperties.cyHeight = frameBufferInfo.cyPixels; -+ if (frameBufferInfo.wFormat == FORMAT_565) -+ _OzoneDisplayProperties.ffFormat = kfDirect565; -+ else -+ if (frameBufferInfo.wFormat == FORMAT_555) -+ _OzoneDisplayProperties.ffFormat = kfDirect555; -+ else { -+ OutputDebugString(TEXT("Ozone unknown screen format")); -+ return NULL; -+ } -+ -+ if (gxGetDisplayProperties) -+ *gxGetDisplayProperties = Ozone_GetDisplayProperties; -+ if (gxOpenDisplay) -+ *gxOpenDisplay = Ozone_OpenDisplay; -+ if (gxCloseDisplay) -+ *gxCloseDisplay = Ozone_CloseDisplay; -+ if (gxBeginDraw) -+ *gxBeginDraw = Ozone_BeginDraw; -+ if (gxEndDraw) -+ *gxEndDraw = Ozone_EndDraw; -+ if (gxSuspend) -+ *gxSuspend = Ozone_Suspend; -+ if (gxResume) -+ *gxResume = Ozone_Resume; -+ -+ return (HINSTANCE)1; -+ -+#else -+ -+ return NULL; -+ -+#endif -+} -+ -+int getScreenWidth() { -+ return (_OzoneFrameBuffer ? _OzoneDisplayProperties.cxWidth : GetSystemMetrics(SM_CXSCREEN)); -+} -+ -+int getScreenHeight() { -+ return (_OzoneFrameBuffer ? _OzoneDisplayProperties.cyHeight : GetSystemMetrics(SM_CYSCREEN)); -+} -+ -+ -+/* Check GAPI library */ -+ -+#define IMPORT(Handle,Variable,Type,Function, Store) \ -+ Variable = GetProcAddress(Handle, TEXT(Function)); \ -+ if (!Variable) { \ -+ FreeLibrary(Handle); \ -+ return NULL; \ -+ } \ -+ if (Store) \ -+ *Store = (Type)Variable; -+ -+static HINSTANCE checkGAPI(tGXDisplayProperties *gxGetDisplayProperties, tGXOpenDisplay *gxOpenDisplay, -+ tGXVoidFunction *gxCloseDisplay, tGXBeginDraw *gxBeginDraw, -+ tGXVoidFunction *gxEndDraw, tGXVoidFunction *gxSuspend, tGXVoidFunction *gxResume, -+ BOOL bypassOzone) { -+ HMODULE gapiLibrary; -+ FARPROC proc; -+ HINSTANCE result; -+ // FIXME paletted ! -+ tGXDisplayProperties temp_gxGetDisplayProperties; -+ -+ // Workaround for Windows Mobile 2003 SE -+ _OzoneFrameBuffer = NULL; -+ if (!bypassOzone) { -+ result = checkOzone(gxGetDisplayProperties, gxOpenDisplay, gxCloseDisplay, gxBeginDraw, gxEndDraw, gxSuspend, gxResume); -+ if (result) -+ return result; -+ } -+ -+ gapiLibrary = LoadLibrary(TEXT("gx.dll")); -+ if (!gapiLibrary) -+ return NULL; -+ -+ IMPORT(gapiLibrary, proc, tGXDisplayProperties, "?GXGetDisplayProperties@@YA?AUGXDisplayProperties@@XZ", gxGetDisplayProperties) -+ IMPORT(gapiLibrary, proc, tGXOpenDisplay, "?GXOpenDisplay@@YAHPAUHWND__@@K@Z", gxOpenDisplay) -+ IMPORT(gapiLibrary, proc, tGXVoidFunction, "?GXCloseDisplay@@YAHXZ", gxCloseDisplay) -+ IMPORT(gapiLibrary, proc, tGXBeginDraw, "?GXBeginDraw@@YAPAXXZ", gxBeginDraw) -+ IMPORT(gapiLibrary, proc, tGXVoidFunction, "?GXEndDraw@@YAHXZ", gxEndDraw) -+ IMPORT(gapiLibrary, proc, tGXVoidFunction, "?GXSuspend@@YAHXZ", gxSuspend) -+ IMPORT(gapiLibrary, proc, tGXVoidFunction, "?GXResume@@YAHXZ", gxResume) -+ -+ // FIXME paletted ! for the moment we just bail out -+ if (!gxGetDisplayProperties) { -+ IMPORT(gapiLibrary, proc, tGXDisplayProperties, "?GXGetDisplayProperties@@YA?AUGXDisplayProperties@@XZ", &temp_gxGetDisplayProperties) -+ if (temp_gxGetDisplayProperties().ffFormat & kfPalette) { -+ FreeLibrary(gapiLibrary); -+ return NULL; -+ } -+ FreeLibrary(gapiLibrary); -+ gapiLibrary = (HINSTANCE)1; -+ } -+ -+ return gapiLibrary; -+} -+ -+ -+/* GAPI driver bootstrap functions */ -+ -+static int GAPI_Available(void) -+{ -+ /* Check if the GAPI library is available */ -+ -+ if (!checkGAPI(NULL, NULL, NULL, NULL, NULL, NULL, NULL, FALSE)) { -+ OutputDebugString(TEXT("GAPI driver not available\r\n")); -+ return 0; -+ } -+ else { -+ OutputDebugString(TEXT("GAPI driver available\r\n")); -+ return 1; -+ } -+} -+ -+static void GAPI_DeleteDevice(SDL_VideoDevice *device) -+{ -+ if (device && device->hidden && device->hidden->gapiFuncs.dynamicGXCloseDisplay) -+ device->hidden->gapiFuncs.dynamicGXCloseDisplay(); -+ -+ if (device && device->hidden) -+ free(device->hidden); -+ if (device) -+ free(device); -+ -+} -+ -+static SDL_VideoDevice *GAPI_CreateDevice(int devindex) -+{ -+ SDL_VideoDevice *device; -+ -+ /* Initialize all variables that we clean on shutdown */ -+ device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); -+ if ( device ) { -+ memset(device, 0, (sizeof *device)); -+ device->hidden = (struct SDL_PrivateVideoData *) -+ malloc((sizeof *device->hidden)); -+ } -+ if ( (device == NULL) || (device->hidden == NULL) ) { -+ SDL_OutOfMemory(); -+ if ( device ) { -+ free(device); -+ } -+ return(0); -+ } -+ memset(device->hidden, 0, (sizeof *device->hidden)); -+ -+ /* Set GAPI pointers */ -+ -+ checkGAPI(&device->hidden->gapiFuncs.dynamicGXGetDisplayProperties, -+ &device->hidden->gapiFuncs.dynamicGXOpenDisplay, -+ &device->hidden->gapiFuncs.dynamicGXCloseDisplay, -+ &device->hidden->gapiFuncs.dynamicGXBeginDraw, -+ &device->hidden->gapiFuncs.dynamicGXEndDraw, -+ &device->hidden->gapiFuncs.dynamicGXSuspend, -+ &device->hidden->gapiFuncs.dynamicGXResume, -+ FALSE); -+ device->hidden->displayProps = device->hidden->gapiFuncs.dynamicGXGetDisplayProperties(); -+ -+ /* Set the function pointers */ -+ -+ device->VideoInit = GAPI_VideoInit; -+ device->ListModes = GAPI_ListModes; -+ device->SetVideoMode = GAPI_SetVideoMode; -+ device->UpdateMouse = WIN_UpdateMouse; -+ device->SetColors = GAPI_SetColors; -+ device->UpdateRects = NULL; -+ device->VideoQuit = GAPI_VideoQuit; -+ device->AllocHWSurface = GAPI_AllocHWSurface; -+ device->CheckHWBlit = NULL; -+ device->FillHWRect = NULL; -+ device->SetHWColorKey = NULL; -+ device->SetHWAlpha = NULL; -+ device->LockHWSurface = GAPI_LockHWSurface; -+ device->UnlockHWSurface = GAPI_UnlockHWSurface; -+ device->FlipHWSurface = NULL; -+ device->FreeHWSurface = GAPI_FreeHWSurface; -+ device->SetCaption = WIN_SetWMCaption; -+ device->SetIcon = WIN_SetWMIcon; -+ device->IconifyWindow = WIN_IconifyWindow; -+ device->GrabInput = WIN_GrabInput; -+ device->GetWMInfo = WIN_GetWMInfo; -+ device->FreeWMCursor = WIN_FreeWMCursor; -+ device->CreateWMCursor = WIN_CreateWMCursor; -+ device->ShowWMCursor = WIN_ShowWMCursor; -+ device->WarpWMCursor = WIN_WarpWMCursor; -+ device->CheckMouseMode = WIN_CheckMouseMode; -+ device->InitOSKeymap = DIB_InitOSKeymap; -+ device->PumpEvents = DIB_PumpEvents; -+ -+ device->SetColors = GAPI_SetColors; -+ -+ /* Set up the windows message handling functions */ -+ WIN_RealizePalette = GAPI_RealizePalette; -+ WIN_PaletteChanged = GAPI_PaletteChanged; -+ WIN_WinPAINT = GAPI_WinPAINT; -+ HandleMessage = DIB_HandleMessage; -+ -+ device->free = GAPI_DeleteDevice; -+ -+ -+ /* -+ device->VideoInit = GAPI_VideoInit; -+ device->ListModes = GAPI_ListModes; -+ device->SetVideoMode = GAPI_SetVideoMode; -+ device->CreateYUVOverlay = NULL; -+ device->SetColors = DUMMY_SetColors; -+ device->UpdateRects = DUMMY_UpdateRects; -+ device->VideoQuit = DUMMY_VideoQuit; -+ device->AllocHWSurface = DUMMY_AllocHWSurface; -+ device->CheckHWBlit = NULL; -+ device->FillHWRect = NULL; -+ device->SetHWColorKey = NULL; -+ device->SetHWAlpha = NULL; -+ device->LockHWSurface = DUMMY_LockHWSurface; -+ device->UnlockHWSurface = DUMMY_UnlockHWSurface; -+ device->FlipHWSurface = NULL; -+ device->FreeHWSurface = DUMMY_FreeHWSurface; -+ device->SetCaption = NULL; -+ device->SetIcon = NULL; -+ device->IconifyWindow = NULL; -+ device->GrabInput = NULL; -+ device->GetWMInfo = NULL; -+ device->InitOSKeymap = DUMMY_InitOSKeymap; -+ device->PumpEvents = DUMMY_PumpEvents; -+ -+ device->free = DUMMY_DeleteDevice; -+ */ -+ -+ return device; -+} -+ -+ -+int GAPI_VideoInit(_THIS, SDL_PixelFormat *vformat) -+{ -+ -+ /* Create the window */ -+ if ( DIB_CreateWindow(this) < 0 ) { -+ return(-1); -+ } -+ -+ vformat->BitsPerPixel = (unsigned char)displayProperties.cBPP; -+ -+ // Get color mask -+ if (displayProperties.ffFormat & kfDirect565) { -+ vformat->BitsPerPixel = 16; -+ vformat->Rmask = 0x0000f800; -+ vformat->Gmask = 0x000007e0; -+ vformat->Bmask = 0x0000001f; -+ videoMode = GAPI_DIRECT_565; -+ } -+ else -+ if (displayProperties.ffFormat & kfDirect555) { -+ vformat->BitsPerPixel = 16; -+ vformat->Rmask = 0x00007c00; -+ vformat->Gmask = 0x000003e0; -+ vformat->Bmask = 0x0000001f; -+ videoMode = GAPI_DIRECT_555; -+ } -+ else -+ if ((displayProperties.ffFormat & kfDirect) && (displayProperties.cBPP <= 8)) { -+ // We'll perform the conversion -+ vformat->BitsPerPixel = 24; -+ vformat->Rmask = 0x00ff0000; -+ vformat->Gmask = 0x0000ff00; -+ vformat->Bmask = 0x000000ff; -+ if (displayProperties.ffFormat & kfDirectInverted) -+ invert = (1 << displayProperties.cBPP) - 1; -+ colorscale = displayProperties.cBPP < 8 ? 8 - displayProperties.cBPP : 0; -+ videoMode = GAPI_MONO; -+ } -+ else -+ if (displayProperties.ffFormat & kfPalette) { -+ videoMode = GAPI_PALETTE; -+ } -+ -+ /* Set UpdateRect callback */ -+ // FIXME -+ /* -+ if (videoMode != GAPI_MONO) -+ this->UpdateRects = GAPI_UpdateRects; -+ else -+ this->UpdateRects = GAPI_UpdateRectsMono; -+ */ -+ -+ this->UpdateRects = GAPI_UpdateRects; -+ -+ /* We're done! */ -+ return(0); -+} -+ -+SDL_Rect **GAPI_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags) -+{ -+ return (SDL_Rect **) -1; -+} -+ -+SDL_Surface *GAPI_SetVideoMode(_THIS, SDL_Surface *current, -+ int width, int height, int bpp, Uint32 flags) -+{ -+ SDL_Surface *video; -+ Uint32 Rmask, Gmask, Bmask; -+ Uint32 prev_flags; -+ DWORD style; -+ const DWORD directstyle = -+ (WS_POPUP); -+ const DWORD windowstyle = -+ (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX); -+ const DWORD resizestyle = -+ (WS_THICKFRAME|WS_MAXIMIZEBOX); -+ int screenWidth, screenHeight; -+ BOOL was_visible; -+ -+ /* We negociate legacy GAPI if we want a screen that fits in QVGA */ -+ if (_OzoneAvailable && _OzoneFrameBuffer && (width <= GetSystemMetrics(SM_CXSCREEN) || width <= GetSystemMetrics(SM_CYSCREEN)) && -+ (height <= GetSystemMetrics(SM_CXSCREEN) || height <= GetSystemMetrics(SM_CYSCREEN))) { -+ OutputDebugString(TEXT("Ozone workaround, switching back to GAPI\r\n")); -+ ozoneHack = 0; -+ checkGAPI(&this->hidden->gapiFuncs.dynamicGXGetDisplayProperties, -+ &this->hidden->gapiFuncs.dynamicGXOpenDisplay, -+ &this->hidden->gapiFuncs.dynamicGXCloseDisplay, -+ &this->hidden->gapiFuncs.dynamicGXBeginDraw, -+ &this->hidden->gapiFuncs.dynamicGXEndDraw, -+ &this->hidden->gapiFuncs.dynamicGXSuspend, -+ &this->hidden->gapiFuncs.dynamicGXResume, -+ TRUE); -+ this->hidden->displayProps = this->hidden->gapiFuncs.dynamicGXGetDisplayProperties(); -+ } -+ /* Otherwise we'll use the new system call */ -+ if (_OzoneAvailable && !_OzoneFrameBuffer && (width > GetSystemMetrics(SM_CXSCREEN) && width > GetSystemMetrics(SM_CYSCREEN)) && -+ (height > GetSystemMetrics(SM_CXSCREEN) && height > GetSystemMetrics(SM_CYSCREEN))) { -+ OutputDebugString(TEXT("Ozone workaround, switching back to true Ozone\r\n")); -+ checkGAPI(&this->hidden->gapiFuncs.dynamicGXGetDisplayProperties, -+ &this->hidden->gapiFuncs.dynamicGXOpenDisplay, -+ &this->hidden->gapiFuncs.dynamicGXCloseDisplay, -+ &this->hidden->gapiFuncs.dynamicGXBeginDraw, -+ &this->hidden->gapiFuncs.dynamicGXEndDraw, -+ &this->hidden->gapiFuncs.dynamicGXSuspend, -+ &this->hidden->gapiFuncs.dynamicGXResume, -+ FALSE); -+ this->hidden->displayProps = this->hidden->gapiFuncs.dynamicGXGetDisplayProperties(); -+ } -+ /* Which will need a tiny input hack if the original code does not have the "Hi Res" aware ressource property set */ -+ ozoneHack = 0; -+ if (_OzoneFrameBuffer && (GetSystemMetrics(SM_CXSCREEN) != (signed) _OzoneDisplayProperties.cxWidth || -+ GetSystemMetrics(SM_CYSCREEN) != (signed) _OzoneDisplayProperties.cyHeight)) { -+ OutputDebugString(TEXT("Running true Ozone with stylus hack\r\n")); -+ ozoneHack = 1; -+ } -+ -+ /* See whether or not we should center the window */ -+ was_visible = IsWindowVisible(SDL_Window); -+ -+ /* Recalculate bitmasks if necessary */ -+ if (bpp == current->format->BitsPerPixel) { -+ video = current; -+ } -+ else { -+ switch(bpp) { -+ case 8: -+ Rmask = 0; -+ Gmask = 0; -+ Bmask = 0; -+ break; -+ case 15: -+ case 16: -+ /* Default is 565 unless the display is specifically 555 */ -+ if (displayProperties.ffFormat & kfDirect555) { -+ Rmask = 0x00007c00; -+ Gmask = 0x000003e0; -+ Bmask = 0x0000001f; -+ } -+ else { -+ Rmask = 0x0000f800; -+ Gmask = 0x000007e0; -+ Bmask = 0x0000001f; -+ } -+ break; -+ case 24: -+ case 32: -+ Rmask = 0x00ff0000; -+ Gmask = 0x0000ff00; -+ Bmask = 0x000000ff; -+ break; -+ default: -+ SDL_SetError("Unsupported Bits Per Pixel format requested"); -+ return NULL; -+ } -+ video = SDL_CreateRGBSurface(SDL_SWSURFACE, -+ 0, 0, bpp, Rmask, Gmask, Bmask, 0); -+ if ( video == NULL ) { -+ SDL_OutOfMemory(); -+ return(NULL); -+ } -+ } -+ -+ /* Fill in part of the video surface */ -+ prev_flags = video->flags; -+ video->flags = 0; /* Clear flags */ -+ video->w = width; -+ video->h = height; -+ video->pitch = SDL_CalculatePitch(video); -+ mainSurfaceWidth = width; -+ mainSurfaceHeight = height; -+ -+//#ifdef WIN32_PLATFORM_PSPC -+ /* Hide taskbar */ -+ if ( flags & SDL_FULLSCREEN ) { -+ if ( !(prev_flags & SDL_FULLSCREEN) ) { -+ //SHFullScreen(SDL_Window, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON | SHFS_HIDESTARTICON); -+ //ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_HIDE); -+ DIB_ShowTaskBar(FALSE); -+ } -+ video->flags |= SDL_FULLSCREEN; -+ } else { -+ if ( prev_flags & SDL_FULLSCREEN ) { -+ //SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON | SHFS_SHOWSTARTICON); -+ //ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_SHOWNORMAL); -+ DIB_ShowTaskBar(TRUE); -+ } -+ } -+//#endif -+ -+ /* Reset the palette and create a new one if necessary */ -+ if (screenPal != NULL) { -+ DeleteObject(screenPal); -+ screenPal = NULL; -+ } -+ -+ /* See if we need to create a translation palette */ -+ if (convertPalette != NULL) { -+ free(convertPalette); -+ } -+ if (bpp == 8) { -+ OutputDebugString(TEXT("creating palette\r\n")); -+ convertPalette = (unsigned short*)malloc(256 * sizeof(unsigned short)); -+ } -+ -+ if (displayProperties.ffFormat & kfPalette) { -+ /* Will only be able to support 256 colors in this mode */ -+ // FIXME -+ //screenPal = GAPI_CreatePalette(); -+ } -+ -+ /* Set Window style */ -+ style = GetWindowLong(SDL_Window, GWL_STYLE); -+ if ( (video->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) { -+ style &= ~windowstyle; -+ style |= directstyle; -+ } else { -+ if ( flags & SDL_NOFRAME ) { -+ style &= ~windowstyle; -+ style |= directstyle; -+ video->flags |= SDL_NOFRAME; -+ } else { -+ style &= ~directstyle; -+ style |= windowstyle; -+ if ( flags & SDL_RESIZABLE ) { -+ style |= resizestyle; -+ video->flags |= SDL_RESIZABLE; -+ } -+ } -+#if WS_MAXIMIZE -+ if (IsZoomed(SDL_Window)) style |= WS_MAXIMIZE; -+#endif -+ } -+ -+ if (!SDL_windowid) -+ SetWindowLong(SDL_Window, GWL_STYLE, style); -+ -+ /* Allocate bitmap */ -+ if (gapiBuffer) { -+ free(gapiBuffer); -+ gapiBuffer = NULL; -+ } -+ gapiBuffer = malloc(video->h * video->pitch); -+ video->pixels = gapiBuffer; -+ -+ /* See if we will rotate */ -+ rotation = SDL_ROTATE_NONE; -+ screenWidth = getScreenWidth(); -+ screenHeight = getScreenHeight(); -+ if ((flags & SDL_FULLSCREEN) && -+ (width > screenWidth && width <= screenHeight) -+ ) -+ { -+ rotation = SDL_ROTATE_LEFT; -+ } -+ /* Compute the different drawing properties */ -+ switch(rotation) { -+ case SDL_ROTATE_NONE: -+ dstPixelstep = displayProperties.cbxPitch; -+ dstLinestep = displayProperties.cbyPitch; -+ startOffset = 0; -+ break; -+ case SDL_ROTATE_LEFT: -+ dstPixelstep = -displayProperties.cbyPitch; -+ dstLinestep = displayProperties.cbxPitch; -+ startOffset = displayProperties.cbyPitch * (displayProperties.cyHeight - 1); -+ break; -+ case SDL_ROTATE_RIGHT: -+ dstPixelstep = displayProperties.cbyPitch; -+ dstLinestep = -displayProperties.cbxPitch; -+ startOffset = displayProperties.cbxPitch * (displayProperties.cxWidth - 1); -+ break; -+ } -+ /* Compute padding */ -+ padWidth = 0; -+ padHeight = 0; -+ if (rotation == SDL_ROTATE_NONE) { -+ if (getScreenWidth() > width) -+ padWidth = (getScreenWidth() - width) / 2; -+ if (getScreenHeight() > height) -+ padHeight = (getScreenHeight() - height) / 2; -+ } -+ else { -+ if (getScreenWidth() > height) -+ padWidth = (getScreenWidth() - height) / 2; -+ if (getScreenHeight() > width) -+ padHeight = (getScreenHeight() - width) / 2; -+ } -+ srcLinestep = video->pitch; -+ srcPixelstep = (bpp == 15 ? 2 : bpp / 8); -+ -+ MoveWindow(SDL_Window, 0, 0, getScreenWidth(), getScreenHeight(), FALSE); -+ ShowWindow(SDL_Window, SW_SHOW); -+ -+ /* Resize the window */ -+ //if ( SDL_windowid == NULL ) { -+ if (0) { -+ HWND top; -+ UINT swp_flags; -+ RECT bounds; -+ int x,y; -+ -+ SDL_resizing = 1; -+ bounds.left = 0; -+ bounds.top = 0; -+ bounds.right = video->w; -+ bounds.bottom = video->h; -+ AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0); -+ width = bounds.right-bounds.left; -+ height = bounds.bottom-bounds.top; -+ x = (getScreenWidth()-width)/2; -+ y = (getScreenHeight()-height)/2; -+ if ( y < 0 ) { /* Cover up title bar for more client area */ -+ y -= GetSystemMetrics(SM_CYCAPTION)/2; -+ } -+ swp_flags = (SWP_FRAMECHANGED | SWP_SHOWWINDOW); -+ if ( was_visible && !(flags & SDL_FULLSCREEN) ) { -+ swp_flags |= SWP_NOMOVE; -+ } -+ if ( flags & SDL_FULLSCREEN ) { -+ top = HWND_TOPMOST; -+ } else { -+ top = HWND_NOTOPMOST; -+ } -+ -+ if (flags & SDL_FULLSCREEN) { -+ SetWindowPos(SDL_Window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); -+ ShowWindow(SDL_Window, SW_SHOW); -+ } -+ else -+ SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags); -+ -+ SDL_resizing = 0; -+ SetForegroundWindow(SDL_Window); -+ } -+ -+ /* Open GAPI display */ -+ GXOpenDisplay(SDL_Window, (flags & SDL_FULLSCREEN ? GX_FULLSCREEN : 0)); -+ -+ /* Grab hardware keys if necessary */ -+ if (flags & SDL_FULLSCREEN) -+ GAPI_GrabHardwareKeys(TRUE); -+ -+ /* Blank screen */ -+ memset(GXBeginDraw(), 0, getScreenWidth() * getScreenHeight() * 2); -+ GXEndDraw(); -+ -+ /* We're done */ -+ return(video); -+} -+ -+/* We don't actually allow hardware surfaces other than the main one */ -+static int GAPI_AllocHWSurface(_THIS, SDL_Surface *surface) -+{ -+ return(-1); -+} -+static void GAPI_FreeHWSurface(_THIS, SDL_Surface *surface) -+{ -+ return; -+} -+ -+/* We need to wait for vertical retrace on page flipped displays */ -+static int GAPI_LockHWSurface(_THIS, SDL_Surface *surface) -+{ -+ return(0); -+} -+ -+static void GAPI_UnlockHWSurface(_THIS, SDL_Surface *surface) -+{ -+ return; -+} -+ -+static void updateLine(_THIS, unsigned char *srcPointer, unsigned char *destPointer, int width) { -+ // FIXME, we assume everything is in the correct format, either 16 bits 565 or 555, or 8 bits -+ int i; -+ for (i=0; i= 8) \ -+ { \ -+ bitshift = 0; \ -+ bitmask = (1<>= displayProperties.cBPP; -+ -+ -+static void GAPI_UpdateRectsMono(_THIS, int numrects, SDL_Rect *rects) -+{ -+ int i; -+ unsigned char *screenBuffer; -+ -+ screenBuffer = GXBeginDraw(); -+ -+ for (i=0; i>3)) -+ -+#define COLORCONV555(r,g,b) (((r&0xf8)<<(10-3))|((g&0xf8)<<(5-2))|((b&0xf8)>>3)) -+ -+int GAPI_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) -+{ -+ int i; -+ /* Convert colors to appropriate 565 or 555 mapping */ -+ for (i=0; ipixels) */ -+ if ( this->screen ) { -+//#ifdef WIN32_PLATFORM_PSPC -+ if ( this->screen->flags & SDL_FULLSCREEN ) { -+ /* Unhide taskbar, etc. */ -+ //SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON | SHFS_SHOWSTARTICON); -+ //ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_SHOWNORMAL); -+ DIB_ShowTaskBar(TRUE); -+ GAPI_GrabHardwareKeys(FALSE); -+ } -+//#endif -+ -+ if (this->screen->pixels != NULL) -+ { -+ free(this->screen->pixels); -+ this->screen->pixels = NULL; -+ } -+ -+ if (GXCloseDisplay) -+ GXCloseDisplay(); -+ } -+ } -+} -+ -+void GAPI_GrabHardwareKeys(BOOL grab) { -+ HINSTANCE GAPI_handle; -+ tGXVoidFunction GAPIActionInput; -+ -+ GAPI_handle = LoadLibrary(TEXT("gx.dll")); -+ if (!GAPI_handle) -+ return; -+ GAPIActionInput = (tGXVoidFunction)GetProcAddress(GAPI_handle, (grab ? TEXT("?GXOpenInput@@YAHXZ") : TEXT("?GXCloseInput@@YAHXZ"))); -+ if (GAPIActionInput) { -+ GAPIActionInput(); -+ } -+ FreeLibrary(GAPI_handle); -+} -diff -ruN SDL-1.2.7-orig/src/video/wingapi/SDL_gapivideo.h SDL-1.2.7/src/video/wingapi/SDL_gapivideo.h ---- SDL-1.2.7-orig/src/video/wingapi/SDL_gapivideo.h Wed Dec 31 19:00:00 1969 -+++ SDL-1.2.7/src/video/wingapi/SDL_gapivideo.h Sun May 30 17:57:48 2004 -@@ -0,0 +1,192 @@ -+/* -+ SDL - Simple DirectMedia Layer -+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga -+ -+ This library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Library General Public -+ License as published by the Free Software Foundation; either -+ version 2 of the License, or (at your option) any later version. -+ -+ This library 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 -+ Library General Public License for more details. -+ -+ You should have received a copy of the GNU Library General Public -+ License along with this library; if not, write to the Free -+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ -+ Sam Lantinga -+ slouken@libsdl.org -+*/ -+ -+#ifdef SAVE_RCSID -+static char rcsid = -+ "@(#) $Id: SDL_gapivideo.h,v 1.1 2004/02/02 23:25:35 lemure Exp $"; -+#endif -+ -+#ifndef _SDL_gapivideo_h -+#define _SDL_gapivideo_h -+ -+#include -+ -+/* -------------------------------------------------------------------------------------------- */ -+ -+/* From gx.h, since it's not really C compliant */ -+ -+struct GXDisplayProperties { -+ DWORD cxWidth; -+ DWORD cyHeight; // notice lack of 'th' in the word height. -+ long cbxPitch; // number of bytes to move right one x pixel - can be negative. -+ long cbyPitch; // number of bytes to move down one y pixel - can be negative. -+ long cBPP; // # of bits in each pixel -+ DWORD ffFormat; // format flags. -+}; -+ -+struct GXKeyList { -+ short vkUp; // key for up -+ POINT ptUp; // x,y position of key/button. Not on screen but in screen coordinates. -+ short vkDown; -+ POINT ptDown; -+ short vkLeft; -+ POINT ptLeft; -+ short vkRight; -+ POINT ptRight; -+ short vkA; -+ POINT ptA; -+ short vkB; -+ POINT ptB; -+ short vkC; -+ POINT ptC; -+ short vkStart; -+ POINT ptStart; -+}; -+ -+#define kfLandscape 0x8 // Screen is rotated 270 degrees -+#define kfPalette 0x10 // Pixel values are indexes into a palette -+#define kfDirect 0x20 // Pixel values contain actual level information -+#define kfDirect555 0x40 // 5 bits each for red, green and blue values in a pixel. -+#define kfDirect565 0x80 // 5 red bits, 6 green bits and 5 blue bits per pixel -+#define kfDirect888 0x100 // 8 bits each for red, green and blue values in a pixel. -+#define kfDirect444 0x200 // 4 red, 4 green, 4 blue -+#define kfDirectInverted 0x400 -+ -+#define GX_FULLSCREEN 0x01 // for OpenDisplay() -+ -+/* -------------------------------------------------------------------------------------------- */ -+ -+/* Rotation direction */ -+typedef enum { -+ SDL_ROTATE_NONE, -+ SDL_ROTATE_LEFT, -+ SDL_ROTATE_RIGHT -+} SDL_RotateAttr; -+ -+/* GAPI video mode */ -+typedef enum { -+ GAPI_NONE = 0, -+ GAPI_DIRECT_565, -+ GAPI_DIRECT_555, -+ GAPI_MONO, -+ GAPI_PALETTE -+} SDL_GAPIVideoMode; -+ -+ -+/* Hidden "this" pointer for the video functions */ -+#define _THIS SDL_VideoDevice *this -+ -+/* GAPI functions definitions */ -+ -+typedef struct GXDisplayProperties (*tGXDisplayProperties)(void); -+typedef int (*tGXOpenDisplay)(HWND, unsigned long); -+typedef void* (*tGXBeginDraw)(void); -+typedef int (*tGXVoidFunction)(void); -+ -+/* Private display data */ -+ -+struct GAPI_funcs { -+ tGXDisplayProperties dynamicGXGetDisplayProperties; -+ tGXOpenDisplay dynamicGXOpenDisplay; -+ tGXVoidFunction dynamicGXCloseDisplay; -+ tGXBeginDraw dynamicGXBeginDraw; -+ tGXVoidFunction dynamicGXEndDraw; -+ tGXVoidFunction dynamicGXSuspend; -+ tGXVoidFunction dynamicGXResume; -+}; -+ -+struct GAPI_properties { -+ unsigned char invert; -+ int colorscale; -+ int dstPixelstep; -+ int dstLinestep; -+ int startOffset; -+ SDL_GAPIVideoMode videoMode; -+}; -+ -+#define MAX_CLR 0x100 -+ -+struct palette_properties { -+ unsigned char *palRed; -+ unsigned char *palGreen; -+ unsigned char *palBlue; -+ unsigned short *pal; -+}; -+ -+ -+struct SDL_PrivateVideoData { -+ /* --- --- begin with DIB private structure to allow DIB events code sharing */ -+ HBITMAP screen_bmp; -+ HPALETTE screen_pal; -+ void *work_pixels; /* if the display needs to be rotated, memory allocated by the API */ -+ void *rotation_pixels; /* if the display needs to be rotated, memory allocated by the code */ -+ SDL_RotateAttr rotation; -+ char ozoneHack; /* force stylus translation if running without Hi Res flag */ -+ -+#define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */ -+ int SDL_nummodes[NUM_MODELISTS]; -+ SDL_Rect **SDL_modelist[NUM_MODELISTS]; -+ -+ /* --- --- */ -+ -+ int w, h; -+ void *gapiBuffer; -+ HPALETTE screenPal; -+ struct GAPI_funcs gapiFuncs; -+ struct GAPI_properties gapiProperties; -+ struct GXDisplayProperties displayProps; -+ int srcLinestep; -+ int srcPixelstep; -+ -+ int padWidth; -+ int padHeight; -+ -+ unsigned short *convertPalette; -+}; -+ -+#define gapiBuffer (this->hidden->gapiBuffer) -+#define mainSurfaceWidth (this->hidden->w) -+#define mainSurfaceHeight (this->hidden->h) -+#define rotation (this->hidden->rotation) -+#define ozoneHack (this->hidden->ozoneHack) -+#define displayProperties (this->hidden->displayProps) -+#define screenPal (this->hidden->screenPal) -+#define GXGetDisplayProperties (this->hidden->gapiFuncs.dynamicGXGetDisplayProperties) -+#define GXOpenDisplay (this->hidden->gapiFuncs.dynamicGXOpenDisplay) -+#define GXCloseDisplay (this->hidden->gapiFuncs.dynamicGXCloseDisplay) -+#define GXBeginDraw (this->hidden->gapiFuncs.dynamicGXBeginDraw) -+#define GXEndDraw (this->hidden->gapiFuncs.dynamicGXEndDraw) -+#define GXSuspend (this->hidden->gapiFuncs.dynamicGXSuspend) -+#define GXResume (this->hidden->gapiFuncs.dynamicGXResume) -+#define invert (this->hidden->gapiProperties.invert) -+#define colorscale (this->hidden->gapiProperties.colorscale) -+#define videoMode (this->hidden->gapiProperties.videoMode) -+#define srcPixelstep (this->hidden->srcPixelstep) -+#define srcLinestep (this->hidden->srcLinestep) -+#define dstPixelstep (this->hidden->gapiProperties.dstPixelstep) -+#define dstLinestep (this->hidden->gapiProperties.dstLinestep) -+#define startOffset (this->hidden->gapiProperties.startOffset) -+#define padWidth (this->hidden->padWidth) -+#define padHeight (this->hidden->padHeight) -+#define convertPalette (this->hidden->convertPalette) -+ -+#endif /* _SDL_gapivideo_h */ diff --git a/tools/SDL1.2.7_CE/VisualCEv2.zip b/tools/SDL1.2.7_CE/VisualCEv2.zip deleted file mode 100644 index 816382e3b..000000000 Binary files a/tools/SDL1.2.7_CE/VisualCEv2.zip and /dev/null differ diff --git a/tools/SOCEdit/Global.bas b/tools/SOCEdit/Global.bas deleted file mode 100644 index 77bf3df2b..000000000 --- a/tools/SOCEdit/Global.bas +++ /dev/null @@ -1,96 +0,0 @@ -Attribute VB_Name = "Module1" -Option Explicit -Public SOCFile As String -Public SOCTemp As String -Public SourcePath As String - -Public Function FirstToken(ByVal line As String) - Dim index As Integer - - index = InStr(line, " ") - 1 - - If index < 1 Then - index = Len(line) - End If - - FirstToken = TrimComplete(Left(line, index)) -End Function - -Public Function SecondToken(ByVal line As String) - Dim startclip As Integer - Dim endclip As Integer - - startclip = InStr(line, " ") - - startclip = startclip + 1 - - SecondToken = TrimComplete(Mid(line, startclip, Len(line))) -End Function - -Public Function SecondTokenEqual(ByVal line As String) - Dim startclip As Integer - Dim endclip As Integer - - startclip = InStr(line, "=") - - startclip = startclip + 2 - - line = Mid(line, startclip, Len(line)) - - SecondTokenEqual = TrimComplete(line) -End Function - -Public Function TrimComplete(ByVal sValue As String) As String - Dim sAns As String - Dim sWkg As String - Dim sChar As String - Dim lLen As Long - Dim lCtr As Long - - sAns = sValue - lLen = Len(sValue) - - If lLen > 0 Then - 'Ltrim - For lCtr = 1 To lLen - sChar = Mid(sAns, lCtr, 1) - If Asc(sChar) > 32 Then Exit For - Next - - sAns = Mid(sAns, lCtr) - lLen = Len(sAns) - - 'Rtrim - If lLen > 0 Then - For lCtr = lLen To 1 Step -1 - sChar = Mid(sAns, lCtr, 1) - If Asc(sChar) > 32 Then Exit For - Next - End If - sAns = Left$(sAns, lCtr) - End If - - TrimComplete = sAns -End Function - -Public Function RTrimComplete(ByVal sValue As String) As String - Dim sAns As String - Dim sWkg As String - Dim sChar As String - Dim lLen As Long - Dim lCtr As Long - - sAns = sValue - lLen = Len(sValue) - - 'Rtrim - If lLen > 0 Then - For lCtr = lLen To 1 Step -1 - sChar = Mid(sAns, lCtr, 1) - If Asc(sChar) > 32 Then Exit For - Next - End If - sAns = Left$(sAns, lCtr) - - RTrimComplete = sAns -End Function diff --git a/tools/SOCEdit/SOCEdit.vbp b/tools/SOCEdit/SOCEdit.vbp deleted file mode 100644 index 90af0095a..000000000 --- a/tools/SOCEdit/SOCEdit.vbp +++ /dev/null @@ -1,53 +0,0 @@ -Type=Exe -Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\WINNT\system32\stdole2.tlb#OLE Automation -Reference=*\G{420B2830-E718-11CF-893D-00A0C9054228}#1.0#0#..\..\..\WINNT\system32\scrrun.dll#Microsoft Scripting Runtime -Form=Things.frm -Module=Module1; Global.bas -Form=frmStateEdit.frm -Form=frmLevelHeader.frm -Form=frmHub.frm -Form=frmMaincfg.frm -Form=frmUnlockablesEdit.frm -Form=frmEmblemEdit.frm -Form=frmSoundEdit.frm -Form=frmCharacterEdit.frm -Form=frmCutsceneEdit.frm -Form=frmHelp.frm -Form=frmHUDEdit.frm -IconForm="frmThingEdit" -Startup="frmHub" -HelpFile="" -Title="SOC Editor" -ExeName32="SOCEdit.exe" -Path32="..\..\..\srb2demo2\SOCEdit" -Command32="" -Name="SOCEditor" -HelpContextID="0" -CompatibleMode="0" -MajorVer=0 -MinorVer=7 -RevisionVer=7 -AutoIncrementVer=0 -ServerSupportFiles=0 -VersionComments="http://www.srb2.org/" -VersionCompanyName="Sonic Team Junior" -VersionFileDescription="For SRB2 v1.09.4" -CompilationType=0 -OptimizationType=0 -FavorPentiumPro(tm)=0 -CodeViewDebugInfo=0 -NoAliasing=0 -BoundsCheck=0 -OverflowCheck=0 -FlPointCheck=0 -FDIVCheck=0 -UnroundedFP=0 -StartMode=0 -Unattended=0 -Retained=0 -ThreadPerObject=0 -MaxNumberOfThreads=1 -DebugStartupOption=0 - -[MS Transaction Server] -AutoRefresh=1 diff --git a/tools/SOCEdit/Things.frm b/tools/SOCEdit/Things.frm deleted file mode 100644 index f95b6afb7..000000000 --- a/tools/SOCEdit/Things.frm +++ /dev/null @@ -1,1895 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmThingEdit - Caption = "Thing Edit" - ClientHeight = 5745 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 11880 - Icon = "Things.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 5745 - ScaleWidth = 11880 - StartUpPosition = 3 'Windows Default - Begin VB.CommandButton cmdCopy - Caption = "&Copy Thing" - Height = 615 - Left = 6600 - TabIndex = 77 - Top = 4920 - Width = 975 - End - Begin VB.CommandButton cmdLoadDefault - Caption = "&Load Code Default" - Height = 615 - Left = 4440 - Style = 1 'Graphical - TabIndex = 76 - Top = 4920 - Width = 975 - End - Begin VB.CommandButton cmdDelete - Caption = "&Delete Thing from SOC" - Height = 615 - Left = 3240 - Style = 1 'Graphical - TabIndex = 74 - Top = 4920 - Width = 1095 - End - Begin VB.CommandButton cmdSave - Caption = "&Save" - Height = 615 - Left = 5520 - TabIndex = 73 - Top = 4920 - Width = 975 - End - Begin VB.Frame frmFlags - Caption = "Flags" - Height = 3735 - Left = 7680 - TabIndex = 45 - Top = 1920 - Width = 4095 - Begin VB.CheckBox chkFlags - Caption = "MF_FIRE" - Height = 255 - Index = 26 - Left = 2040 - TabIndex = 72 - Tag = "4194304" - ToolTipText = "Fire object. Doesn't harm if you have red shield." - Top = 2160 - Width = 1695 - End - Begin VB.CheckBox chkFlags - Caption = "MF_NOCLIPTHING" - Height = 255 - Index = 25 - Left = 2040 - TabIndex = 71 - Tag = "1073741824" - ToolTipText = "Don't be blocked by things (partial clipping)" - Top = 3120 - Width = 1815 - End - Begin VB.CheckBox chkFlags - Caption = "MF_SCENERY" - Height = 255 - Index = 24 - Left = 2040 - TabIndex = 70 - Tag = "33554432" - ToolTipText = "Scenery (uses scenery thinker). Uses less CPU than a standard object, but generally can't move, etc." - Top = 2880 - Width = 1455 - End - Begin VB.CheckBox chkFlags - Caption = "MF_ENEMY" - Height = 255 - Index = 23 - Left = 2040 - TabIndex = 69 - Tag = "16777216" - ToolTipText = "This mobj is an enemy!" - Top = 2640 - Width = 1335 - End - Begin VB.CheckBox chkFlags - Caption = "MF_COUNTITEM" - Height = 255 - Index = 22 - Left = 2040 - TabIndex = 68 - Tag = "8388608" - ToolTipText = "On picking up, count this item object towards intermission item total." - Top = 2400 - Width = 1695 - End - Begin VB.CheckBox chkFlags - Caption = "MF_NOTHINK" - Height = 255 - Index = 21 - Left = 2040 - TabIndex = 67 - Tag = "2097152" - ToolTipText = "Don't run this thing's thinker." - Top = 1920 - Width = 1695 - End - Begin VB.CheckBox chkFlags - Caption = "MF_MONITOR" - Height = 255 - Index = 20 - Left = 2040 - TabIndex = 66 - Tag = "1048576" - ToolTipText = "Item box" - Top = 1680 - Width = 1575 - End - Begin VB.CheckBox chkFlags - Caption = "MF_HIRES" - Height = 255 - Index = 19 - Left = 2040 - TabIndex = 65 - Tag = "524288" - ToolTipText = "Object uses a high-resolution sprite" - Top = 1440 - Width = 1215 - End - Begin VB.CheckBox chkFlags - Caption = "MF_BOUNCE" - Height = 255 - Index = 18 - Left = 2040 - TabIndex = 64 - Tag = "262144" - ToolTipText = "Bounce off walls and things." - Top = 1200 - Width = 1335 - End - Begin VB.CheckBox chkFlags - Caption = "MF_SPRING" - Height = 255 - Index = 17 - Left = 2040 - TabIndex = 63 - Tag = "131072" - ToolTipText = "Item is a spring." - Top = 960 - Width = 1575 - End - Begin VB.CheckBox chkFlags - Caption = "MF_MISSILE" - Height = 255 - Index = 16 - Left = 2040 - TabIndex = 62 - Tag = "65536" - ToolTipText = "Any kind of projectile currently flying through the air, waiting to hit something" - Top = 720 - Width = 1335 - End - Begin VB.CheckBox chkFlags - Caption = "MF_BOXICON" - Height = 255 - Index = 15 - Left = 2040 - TabIndex = 61 - Tag = "32768" - ToolTipText = "Monitor powerup icon. These rise a bit." - Top = 480 - Width = 1815 - End - Begin VB.CheckBox chkFlags - Caption = "MF_FLOAT" - Height = 255 - Index = 14 - Left = 2040 - TabIndex = 60 - Tag = "16384" - ToolTipText = "Allow moves to any height, no gravity. For active floaters." - Top = 240 - Width = 1215 - End - Begin VB.CheckBox chkFlags - Caption = "MF_SPECIALFLAGS" - Height = 255 - Index = 13 - Left = 120 - TabIndex = 59 - Tag = "8192" - ToolTipText = "This object does not adhere to regular flag/z properties for object placing." - Top = 3360 - Width = 1815 - End - Begin VB.CheckBox chkFlags - Caption = "MF_NOCLIP" - Height = 255 - Index = 12 - Left = 120 - TabIndex = 58 - Tag = "4096" - ToolTipText = "Don't clip against objects, walls, etc." - Top = 3120 - Width = 1335 - End - Begin VB.CheckBox chkFlags - Caption = "MF_SLIDEME" - Height = 255 - Index = 11 - Left = 120 - TabIndex = 57 - Tag = "2048" - ToolTipText = "Slide this object when it hits a wall." - Top = 2880 - Width = 1335 - End - Begin VB.CheckBox chkFlags - Caption = "MF_AMBIENT" - Height = 255 - Index = 10 - Left = 120 - TabIndex = 56 - Tag = "1024" - ToolTipText = "This object is an ambient sound." - Top = 2640 - Width = 1695 - End - Begin VB.CheckBox chkFlags - Caption = "MF_NOGRAVITY" - Height = 255 - Index = 9 - Left = 120 - TabIndex = 55 - Tag = "512" - ToolTipText = "Don't apply gravity" - Top = 2400 - Width = 1695 - End - Begin VB.CheckBox chkFlags - Caption = "MF_SPAWNCEILING" - Height = 255 - Index = 8 - Left = 120 - TabIndex = 54 - Tag = "256" - ToolTipText = "On level spawning (initial position), hang from ceiling instead of stand on floor." - Top = 2160 - Width = 1935 - End - Begin VB.CheckBox chkFlags - Caption = "MF_BOSS" - Height = 255 - Index = 7 - Left = 120 - TabIndex = 53 - Tag = "128" - ToolTipText = "Object is a boss." - Top = 1920 - Width = 1575 - End - Begin VB.CheckBox chkFlags - Caption = "MF_PUSHABLE" - Height = 255 - Index = 6 - Left = 120 - TabIndex = 52 - Tag = "64" - ToolTipText = "You can push this object. It can activate switches and things by pushing it on top." - Top = 1680 - Width = 1575 - End - Begin VB.CheckBox chkFlags - Caption = "MF_AMBUSH" - Height = 255 - Index = 5 - Left = 120 - TabIndex = 51 - Tag = "32" - ToolTipText = "Special attributes" - Top = 1440 - Width = 1455 - End - Begin VB.CheckBox chkFlags - Caption = "MF_NOBLOCKMAP" - Height = 255 - Index = 4 - Left = 120 - TabIndex = 50 - Tag = "16" - ToolTipText = "Don't use the blocklinks (inert but displayable)" - Top = 1200 - Width = 1815 - End - Begin VB.CheckBox chkFlags - Caption = "MF_NOSECTOR" - Height = 255 - Index = 3 - Left = 120 - TabIndex = 49 - Tag = "8" - ToolTipText = "Don't use the sector links (invisible but touchable)." - Top = 960 - Width = 1575 - End - Begin VB.CheckBox chkFlags - Caption = "MF_SHOOTABLE" - Height = 255 - Index = 2 - Left = 120 - TabIndex = 48 - Tag = "4" - ToolTipText = "Can be hit." - Top = 720 - Width = 1695 - End - Begin VB.CheckBox chkFlags - Caption = "MF_SOLID" - Height = 255 - Index = 1 - Left = 120 - TabIndex = 47 - Tag = "2" - ToolTipText = "Blocks." - Top = 480 - Width = 1335 - End - Begin VB.CheckBox chkFlags - Caption = "MF_SPECIAL" - Height = 255 - Index = 0 - Left = 120 - TabIndex = 46 - Tag = "1" - ToolTipText = "Call P_TouchSpecialThing when touched." - Top = 240 - Width = 1455 - End - End - Begin VB.ComboBox cmbRaisestate - Height = 315 - Left = 4320 - TabIndex = 43 - Text = "cmbRaisestate" - Top = 4440 - Width = 3300 - End - Begin VB.ComboBox cmbActivesound - Height = 315 - Left = 4320 - TabIndex = 41 - Text = "cmbActivesound" - Top = 4080 - Width = 3300 - End - Begin VB.TextBox txtDamage - Height = 285 - Left = 10680 - TabIndex = 39 - Text = "0" - Top = 1200 - Width = 1095 - End - Begin VB.TextBox txtMass - Height = 285 - Left = 10680 - TabIndex = 37 - Text = "0" - Top = 840 - Width = 1095 - End - Begin VB.TextBox txtHeight - Height = 285 - Left = 10680 - TabIndex = 35 - Text = "0" - Top = 480 - Width = 1095 - End - Begin VB.TextBox txtRadius - Height = 285 - Left = 10680 - TabIndex = 33 - Text = "0" - Top = 120 - Width = 1095 - End - Begin VB.TextBox txtSpeed - Height = 285 - Left = 8760 - TabIndex = 31 - Text = "0" - Top = 1560 - Width = 1095 - End - Begin VB.ComboBox cmbDeathsound - Height = 315 - Left = 4320 - TabIndex = 29 - Text = "cmbDeathsound" - Top = 3720 - Width = 3300 - End - Begin VB.ComboBox cmbXdeathstate - Height = 315 - Left = 4320 - TabIndex = 27 - Text = "cmbXdeathstate" - Top = 3360 - Width = 3300 - End - Begin VB.ComboBox cmbDeathstate - Height = 315 - Left = 4320 - TabIndex = 25 - Text = "cmbDeathstate" - Top = 3000 - Width = 3300 - End - Begin VB.ComboBox cmbMissilestate - Height = 315 - Left = 4320 - TabIndex = 23 - Text = "cmbMissilestate" - Top = 2640 - Width = 3300 - End - Begin VB.ComboBox cmbMeleestate - Height = 315 - Left = 4320 - TabIndex = 21 - Text = "cmbMeleestate" - Top = 2280 - Width = 3300 - End - Begin VB.ComboBox cmbPainsound - Height = 315 - Left = 4320 - TabIndex = 19 - Text = "cmbPainsound" - Top = 1920 - Width = 3300 - End - Begin VB.TextBox txtPainchance - Height = 285 - Left = 8760 - TabIndex = 17 - Text = "0" - Top = 1200 - Width = 1095 - End - Begin VB.ComboBox cmbPainstate - Height = 315 - Left = 4320 - TabIndex = 15 - Text = "cmbPainstate" - Top = 1560 - Width = 3300 - End - Begin VB.ComboBox cmbAttacksound - Height = 315 - Left = 4320 - TabIndex = 13 - Text = "cmbAttacksound" - Top = 1200 - Width = 3300 - End - Begin VB.TextBox txtReactiontime - Height = 285 - Left = 8760 - TabIndex = 11 - Text = "0" - Top = 840 - Width = 1095 - End - Begin VB.ComboBox cmbSeesound - Height = 315 - Left = 4320 - TabIndex = 9 - Text = "cmbSeesound" - Top = 840 - Width = 3300 - End - Begin VB.ComboBox cmbSeestate - Height = 315 - Left = 4320 - TabIndex = 7 - Text = "cmbSeestate" - Top = 480 - Width = 3300 - End - Begin VB.TextBox txtSpawnhealth - Height = 285 - Left = 8760 - TabIndex = 6 - Text = "0" - Top = 480 - Width = 1095 - End - Begin VB.ComboBox cmbSpawnstate - Height = 315 - Left = 4320 - TabIndex = 3 - Text = "cmbSpawnstate" - Top = 120 - Width = 3300 - End - Begin VB.TextBox txtDoomednum - Height = 285 - Left = 8760 - TabIndex = 1 - Text = "0" - Top = 120 - Width = 1095 - End - Begin VB.ListBox lstThings - Height = 5520 - ItemData = "Things.frx":0442 - Left = 120 - List = "Things.frx":0444 - TabIndex = 0 - Top = 120 - Width = 3015 - End - Begin VB.Label lblStatusInfo - Alignment = 2 'Center - Caption = "Idle" - BeginProperty Font - Name = "MS Sans Serif" - Size = 8.25 - Charset = 0 - Weight = 700 - Underline = 0 'False - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 375 - Left = 9960 - TabIndex = 75 - Top = 1560 - Width = 1815 - End - Begin VB.Label lblRaisestate - Alignment = 1 'Right Justify - Caption = "Raisestate:" - Height = 255 - Left = 3360 - TabIndex = 44 - Top = 4440 - Width = 855 - End - Begin VB.Label lblActivesound - Alignment = 1 'Right Justify - Caption = "Activesound:" - Height = 255 - Left = 3240 - TabIndex = 42 - Top = 4080 - Width = 975 - End - Begin VB.Label lblDamage - Alignment = 1 'Right Justify - Caption = "Damage:" - Height = 255 - Left = 9840 - TabIndex = 40 - Top = 1200 - Width = 735 - End - Begin VB.Label lblMass - Alignment = 1 'Right Justify - Caption = "Mass:" - Height = 255 - Left = 9960 - TabIndex = 38 - Top = 840 - Width = 615 - End - Begin VB.Label lblHeight - Alignment = 1 'Right Justify - Caption = "Height:" - Height = 255 - Left = 9960 - TabIndex = 36 - Top = 480 - Width = 615 - End - Begin VB.Label lblRadius - Alignment = 1 'Right Justify - Caption = "Radius:" - Height = 255 - Left = 9960 - TabIndex = 34 - Top = 120 - Width = 615 - End - Begin VB.Label lblSpeed - Alignment = 1 'Right Justify - Caption = "Speed:" - Height = 255 - Left = 7680 - TabIndex = 32 - Top = 1560 - Width = 975 - End - Begin VB.Label lblDeathsound - Alignment = 1 'Right Justify - Caption = "Deathsound:" - Height = 255 - Left = 3240 - TabIndex = 30 - Top = 3720 - Width = 975 - End - Begin VB.Label lblXdeathstate - Alignment = 1 'Right Justify - Caption = "Xdeathstate:" - Height = 255 - Left = 3240 - TabIndex = 28 - Top = 3360 - Width = 975 - End - Begin VB.Label lblDeathstate - Alignment = 1 'Right Justify - Caption = "Deathstate:" - Height = 255 - Left = 3240 - TabIndex = 26 - Top = 3000 - Width = 975 - End - Begin VB.Label lblMissilestate - Alignment = 1 'Right Justify - Caption = "Missilestate:" - Height = 255 - Left = 3240 - TabIndex = 24 - Top = 2640 - Width = 975 - End - Begin VB.Label lblMeleestate - Alignment = 1 'Right Justify - Caption = "Meleestate:" - Height = 255 - Left = 3240 - TabIndex = 22 - Top = 2280 - Width = 975 - End - Begin VB.Label lblPainsound - Alignment = 1 'Right Justify - Caption = "Painsound:" - Height = 255 - Left = 3240 - TabIndex = 20 - Top = 1920 - Width = 975 - End - Begin VB.Label lblPainchance - Alignment = 1 'Right Justify - Caption = "Painchance:" - Height = 255 - Left = 7680 - TabIndex = 18 - Top = 1200 - Width = 975 - End - Begin VB.Label lblPainstate - Alignment = 1 'Right Justify - Caption = "Painstate:" - Height = 255 - Left = 3240 - TabIndex = 16 - Top = 1560 - Width = 975 - End - Begin VB.Label lblAttacksound - Alignment = 1 'Right Justify - Caption = "Attacksound:" - Height = 255 - Left = 3240 - TabIndex = 14 - Top = 1200 - Width = 975 - End - Begin VB.Label lblReactiontime - Alignment = 1 'Right Justify - Caption = "Reactiontime:" - Height = 255 - Left = 7680 - TabIndex = 12 - Top = 840 - Width = 975 - End - Begin VB.Label lblSeesound - Alignment = 1 'Right Justify - Caption = "Seesound:" - Height = 255 - Left = 3240 - TabIndex = 10 - Top = 840 - Width = 975 - End - Begin VB.Label lblSeestate - Alignment = 1 'Right Justify - Caption = "Seestate:" - Height = 255 - Left = 3240 - TabIndex = 8 - Top = 480 - Width = 975 - End - Begin VB.Label lblSpawnhealth - Alignment = 1 'Right Justify - Caption = "Spawnhealth:" - Height = 255 - Left = 7680 - TabIndex = 5 - Top = 480 - Width = 975 - End - Begin VB.Label lblSpawnstate - Alignment = 1 'Right Justify - Caption = "Spawnstate:" - Height = 255 - Left = 3240 - TabIndex = 4 - Top = 120 - Width = 975 - End - Begin VB.Label lblDoomednum - Alignment = 1 'Right Justify - Caption = "Thing Map #:" - Height = 255 - Left = 7680 - TabIndex = 2 - Top = 120 - Width = 975 - End -End -Attribute VB_Name = "frmThingEdit" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdCopy_Click() - Dim Response As String - - Response$ = InputBox("Copy state to #:", "Copy State") - - If Response = "" Then Exit Sub - - Response = TrimComplete(Response) - - Call WriteThing(False, Val(Response)) - - MsgBox "Thing copied to #" & Val(Response) -End Sub - -Private Sub cmdDelete_Click() - Call WriteThing(True, lstThings.ListIndex) -End Sub - -Private Sub cmdLoadDefault_Click() - Call ClearForm - If InStr(lstThings.List(lstThings.ListIndex), "MT_FREESLOT") = 0 Then - LoadObjectInfo (lstThings.ListIndex) - Else - MsgBox "Free slots do not have a code default." - End If -End Sub - -Private Sub cmdSave_Click() - Call WriteThing(False, lstThings.ListIndex) -End Sub - -Private Sub Form_Load() - Call Reload -End Sub - -Private Sub ClearForm() - Dim i As Integer - cmbSpawnstate.Text = "" - cmbSeestate.Text = "" - cmbSeesound.Text = "" - cmbAttacksound.Text = "" - cmbPainstate.Text = "" - cmbPainsound.Text = "" - cmbMeleestate.Text = "" - cmbMissilestate.Text = "" - cmbDeathstate.Text = "" - cmbXdeathstate.Text = "" - cmbDeathsound.Text = "" - cmbActivesound.Text = "" - cmbRaisestate.Text = "" - txtDoomednum.Text = "" - txtSpawnhealth.Text = "" - txtReactiontime.Text = "" - txtPainchance.Text = "" - txtSpeed.Text = "" - txtRadius.Text = "" - txtHeight.Text = "" - txtMass.Text = "" - txtDamage.Text = "" - - For i = 0 To 26 - chkFlags(i).Value = 0 - Next -End Sub - -Private Sub Reload() - lblStatusInfo.Caption = "Loading Sounds Info..." - DoEvents - LoadSounds - lblStatusInfo.Caption = "Loading Things Info..." - DoEvents - LoadThings - lblStatusInfo.Caption = "Loading States Info..." - DoEvents - LoadStates - lblStatusInfo.Caption = "Idle" - lstThings.ListIndex = 0 -End Sub - -Private Sub LoadSounds() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim addstring As String - Dim i As Integer, numfreeslots As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("sounds.h", ForReading, False) - - Do While InStr(ts.ReadLine, "List of sounds (don't modify this comment!)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - cmbSeesound.Clear - cmbAttacksound.Clear - cmbPainsound.Clear - cmbDeathsound.Clear - cmbActivesound.Clear - - Do While InStr(line, "sfx_freeslot0") = 0 - startclip = InStr(line, "sfx_") - If InStr(line, "sfx_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - addstring = number & " - " & line - cmbSeesound.AddItem addstring - cmbAttacksound.AddItem addstring - cmbPainsound.AddItem addstring - cmbDeathsound.AddItem addstring - cmbActivesound.AddItem addstring - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - Set myFSO = Nothing - - 'Populate the free slots! - numfreeslots = 800 - - For i = 1 To numfreeslots - If i < 10 Then - addstring = number & " - " & "sfx_fre00" & i & " (free slot)" - ElseIf i < 100 Then - addstring = number & " - " & "sfx_fre0" & i & " (free slot)" - Else - addstring = number & " - " & "sfx_fre" & i & " (free slot)" - End If - cmbSeesound.AddItem addstring - cmbAttacksound.AddItem addstring - cmbPainsound.AddItem addstring - cmbDeathsound.AddItem addstring - cmbActivesound.AddItem addstring - number = number + 1 - Next -End Sub -Private Sub LoadStates() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim addstring As String - Dim i As Integer - Dim numfreeslots As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - Do While InStr(ts.ReadLine, "Object states (don't modify this comment!)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - cmbSpawnstate.Clear - cmbSeestate.Clear - cmbPainstate.Clear - cmbMeleestate.Clear - cmbMissilestate.Clear - cmbDeathstate.Clear - cmbXdeathstate.Clear - cmbRaisestate.Clear - - Do While InStr(line, "S_FIRSTFREESLOT") = 0 - startclip = InStr(line, "S_") - If InStr(line, "S_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - addstring = number & " - " & line - cmbSpawnstate.AddItem addstring - cmbSeestate.AddItem addstring - cmbPainstate.AddItem addstring - cmbMeleestate.AddItem addstring - cmbMissilestate.AddItem addstring - cmbDeathstate.AddItem addstring - cmbXdeathstate.AddItem addstring - cmbRaisestate.AddItem addstring - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - - 'Populate the free slots! - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - line = ts.ReadLine - Do While InStr(line, "#define NUMMOBJFREESLOTS") = 0 - line = ts.ReadLine - Loop - - startclip = InStr(line, "SLOTS ") + 6 - numfreeslots = Val(Mid(line, startclip, Len(line) - startclip + 1)) * 6 - - For i = 1 To numfreeslots - addstring = number & " - " & "S_FREESLOT" & i - cmbSpawnstate.AddItem addstring - cmbSeestate.AddItem addstring - cmbPainstate.AddItem addstring - cmbMeleestate.AddItem addstring - cmbMissilestate.AddItem addstring - cmbDeathstate.AddItem addstring - cmbXdeathstate.AddItem addstring - cmbRaisestate.AddItem addstring - number = number + 1 - Next - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub LoadThings() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim numfreeslots As Integer, i As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - Do While InStr(ts.ReadLine, "Little flag for SOC editor (don't change this comment!)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - lstThings.Clear - - Do While InStr(line, "MT_FIRSTFREESLOT") = 0 - startclip = InStr(line, "MT_") - If InStr(line, "MT_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - lstThings.AddItem number & " - " & line - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - - 'Populate the free slots! - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - line = ts.ReadLine - Do While InStr(line, "#define NUMMOBJFREESLOTS") = 0 - line = ts.ReadLine - Loop - - startclip = InStr(line, "SLOTS ") + 6 - numfreeslots = Val(Mid(line, startclip, Len(line) - startclip + 1)) - - For i = 1 To numfreeslots - lstThings.AddItem number & " - " & "MT_FREESLOT" & i - number = number + 1 - Next - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub LoadObjectInfo(ThingNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("info.c", ForReading, False) - - Do While InStr(ts.ReadLine, "mobjinfo[NUMMOBJTYPES] =") = 0 - Loop - - number = 0 - - Do While number <> ThingNum - Do While InStr(ts.ReadLine, "}") = 0 - Loop - number = number + 1 - Loop - - Do While InStr(line, "doomednum") = 0 - line = ts.ReadLine - Loop - - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - 'Check for *FRACUNIT values - endclip = InStr(line, "*FRACUNIT") - If endclip <> 0 Then - line = Left(line, endclip - 1) - line = Val(line) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - line = FindThingNum(line) & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - line = FindPowerNum(line) & " - " & line - End If - txtDoomednum.Text = line - - line = ts.ReadLine - Do While InStr(line, "spawnstate") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbSpawnstate, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbSpawnstate.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbSpawnstate.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "spawnhealth") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - 'Check for *FRACUNIT values - endclip = InStr(line, "*FRACUNIT") - If endclip <> 0 Then - line = Left(line, endclip - 1) - line = Val(line) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - line = FindThingNum(line) & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - line = FindPowerNum(line) & " - " & line - End If - txtSpawnhealth.Text = line - - line = ts.ReadLine - Do While InStr(line, "seestate") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbSeestate, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbSeestate.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbSeestate.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "seesound") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbSeesound, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbSeesound.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbSeesound.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "reactiontime") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - 'Check for *FRACUNIT values - endclip = InStr(line, "*FRACUNIT") - If endclip <> 0 Then - line = Left(line, endclip - 1) - line = Val(line) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - line = FindThingNum(line) & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - line = FindPowerNum(line) & " - " & line - End If - txtReactiontime.Text = line - - line = ts.ReadLine - Do While InStr(line, "attacksound") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbAttacksound, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbAttacksound.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbAttacksound.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "painstate") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbPainstate, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbPainstate.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbPainstate.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "painchance") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - 'Check for *FRACUNIT values - endclip = InStr(line, "*FRACUNIT") - If endclip <> 0 Then - line = Left(line, endclip - 1) - line = Val(line) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - line = FindThingNum(line) & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - line = FindPowerNum(line) & " - " & line - End If - txtPainchance.Text = line - - line = ts.ReadLine - Do While InStr(line, "painsound") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbPainsound, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbPainsound.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbPainsound.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "meleestate") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbMeleestate, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbMeleestate.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbMeleestate.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "missilestate") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbMissilestate, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbMissilestate.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbMissilestate.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "deathstate") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbDeathstate, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbDeathstate.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbDeathstate.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "xdeathstate") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbXdeathstate, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbXdeathstate.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbXdeathstate.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "deathsound") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbDeathsound, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbDeathsound.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbDeathsound.Text = number & " - " & line - End If - - - line = ts.ReadLine - Do While InStr(line, "speed") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - 'Check for *FRACUNIT values - endclip = InStr(line, "*FRACUNIT") - If endclip <> 0 Then - line = Left(line, endclip - 1) - line = Val(line) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - line = FindThingNum(line) & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - line = FindPowerNum(line) & " - " & line - End If - txtSpeed.Text = line - - line = ts.ReadLine - Do While InStr(line, "radius") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - 'Check for *FRACUNIT values - endclip = InStr(line, "*FRACUNIT") - If endclip <> 0 Then - line = Left(line, endclip - 1) - line = Val(line) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - line = FindThingNum(line) & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - line = FindPowerNum(line) & " - " & line - End If - txtRadius.Text = line - - line = ts.ReadLine - Do While InStr(line, "height") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - 'Check for *FRACUNIT values - endclip = InStr(line, "*FRACUNIT") - If endclip <> 0 Then - line = Left(line, endclip - 1) - line = Val(line) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - line = FindThingNum(line) & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - line = FindPowerNum(line) & " - " & line - End If - txtHeight.Text = line - - line = ts.ReadLine 'Display order offset (add support, please!) - - line = ts.ReadLine - Do While InStr(line, "mass") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - 'Check for *FRACUNIT values - endclip = InStr(line, "*FRACUNIT") - If endclip <> 0 Then - line = Left(line, endclip - 1) - line = Val(line) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - line = FindThingNum(line) & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - line = FindPowerNum(line) & " - " & line - End If - txtMass.Text = line - - line = ts.ReadLine - Do While InStr(line, "damage") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - 'Check for *FRACUNIT values - endclip = InStr(line, "*FRACUNIT") - If endclip <> 0 Then - line = Left(line, endclip - 1) - line = Val(line) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - line = FindThingNum(line) & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - line = FindPowerNum(line) & " - " & line - End If - txtDamage.Text = line - - line = ts.ReadLine - Do While InStr(line, "activesound") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbActivesound, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbActivesound.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbActivesound.Text = number & " - " & line - End If - - line = ts.ReadLine - Do While InStr(line, "flags") = 0 - Loop - endclip = InStr(line, ",") - line = Left(line, endclip - 1) - line = TrimComplete(line) - ProcessFlags (line) - - line = ts.ReadLine - Do While InStr(line, "raisestate") = 0 - Loop - endclip = InStr(line, "//") - line = Left(line, endclip - 1) - line = TrimComplete(line) - Call FindComboIndex(cmbRaisestate, line) - 'Check for crazy-odd MT_ usage - endclip = InStr(line, "MT_") - If endclip <> 0 Then - number = FindThingNum(line) - cmbRaisestate.Text = number & " - " & line - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(line, "pw_") - If endclip <> 0 Then - number = FindPowerNum(line) - cmbRaisestate.Text = number & " - " & line - End If - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub ProcessFlags(flags As String) - Dim FlagList(32) As String - Dim endpoint As Integer - Dim ListCount As Integer - Dim FlagString As String - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim j As Integer, i As Integer - Dim number As Long - Dim startclip As Integer, endclip As Integer - - For j = 0 To 26 - chkFlags(j).Value = 0 - Next j - - FlagString = flags - - flags = flags & "||" - - ListCount = 0 - - Do While Len(flags) > 3 - endpoint = InStr(flags, "|") - FlagString = Left(flags, endpoint - 1) - flags = Right(flags, Len(flags) - endpoint) - FlagList(ListCount) = FlagString - ListCount = ListCount + 1 - Loop - - ChDir SourcePath - - For i = 0 To ListCount - 1 - Set ts = myFSO.OpenTextFile("p_mobj.h", ForReading, False) - - line = ts.ReadLine - - Do While Not ts.AtEndOfStream - line = ts.ReadLine - If InStr(line, FlagList(i)) Then - If InStr(line, "//") = 0 Or (InStr(line, "//") > InStr(line, FlagList(i))) Then - Exit Do - End If - End If - Loop - - If InStr(line, FlagList(i)) Then - startclip = InStr(line, "0x") - endclip = InStr(line, ",") - line = Mid(line, startclip + 2, endclip - 1) - line = "&H" & line - TrimComplete (line) - line = Left(line, Len(line) - 1) - number = CLng(line) - - For j = 0 To 26 - If chkFlags(j).Tag = number Then - chkFlags(j).Value = 1 - End If - Next j - End If - ts.Close - Next i - - Set myFSO = Nothing -End Sub - -Private Sub FindComboIndex(ByRef Box As ComboBox, line As String) - Dim i As Integer - - For i = 0 To Box.ListCount - If InStr(Box.List(i), line) Then - Box.ListIndex = i - Exit For - End If - Next -End Sub - -Private Sub lstThings_Click() - lblStatusInfo.Caption = "Loading thing info..." - DoEvents - Call ClearForm - If InStr(lstThings.List(lstThings.ListIndex), "MT_FREESLOT") = 0 Then - LoadObjectInfo (lstThings.ListIndex) - End If - LoadSOCObjectInfo (lstThings.ListIndex) - lblStatusInfo.Caption = "Idle" -End Sub - -Private Sub LoadSOCObjectInfo(ThingNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim j As Integer - Dim temp As Long - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "THING" And Val(word2) = ThingNum Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "MAPTHINGNUM" Then - txtDoomednum.Text = Val(word2) - ElseIf word = "SPAWNSTATE" Then - cmbSpawnstate.ListIndex = Val(word2) - ElseIf word = "SPAWNHEALTH" Then - txtSpawnhealth.Text = Val(word2) - ElseIf word = "SEESTATE" Then - cmbSeestate.ListIndex = Val(word2) - ElseIf word = "SEESOUND" Then - cmbSeesound.ListIndex = Val(word2) - ElseIf word = "REACTIONTIME" Then - txtReactiontime.Text = Val(word2) - ElseIf word = "ATTACKSOUND" Then - cmbAttacksound.ListIndex = Val(word2) - ElseIf word = "PAINSTATE" Then - cmbPainstate.ListIndex = Val(word2) - ElseIf word = "PAINCHANCE" Then - txtPainchance.Text = Val(word2) - ElseIf word = "PAINSOUND" Then - cmbPainsound.ListIndex = Val(word2) - ElseIf word = "MELEESTATE" Then - cmbMeleestate.ListIndex = Val(word2) - ElseIf word = "MISSILESTATE" Then - cmbMissilestate.ListIndex = Val(word2) - ElseIf word = "DEATHSTATE" Then - cmbDeathstate.ListIndex = Val(word2) - ElseIf word = "DEATHSOUND" Then - cmbDeathsound.ListIndex = Val(word2) - ElseIf word = "XDEATHSTATE" Then - cmbXdeathstate.ListIndex = Val(word2) - ElseIf word = "SPEED" Then - txtSpeed.Text = Val(word2) - ElseIf word = "RADIUS" Then - txtRadius.Text = Val(word2) - ElseIf word = "HEIGHT" Then - txtHeight.Text = Val(word2) - ElseIf word = "MASS" Then - txtMass.Text = Val(word2) - ElseIf word = "DAMAGE" Then - txtDamage.Text = Val(word2) - ElseIf word = "ACTIVESOUND" Then - cmbActivesound.ListIndex = Val(word2) - ElseIf word = "FLAGS" Then - For j = 0 To 26 - temp = Val(word2) - If temp And chkFlags(j).Tag Then - chkFlags(j).Value = 1 - Else - chkFlags(j).Value = 0 - End If - Next j - ElseIf word = "RAISESTATE" Then - cmbRaisestate.ListIndex = Val(word2) - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC!" & vbCrLf & "Unknown line: " & line - End If - Loop - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Function FindThingNum(ThingName As String) As Integer - Dim i As Integer - Dim temp As String - Dim startpoint As Integer - Dim endpoint As Integer - - For i = 0 To lstThings.ListCount - 1 - temp = lstThings.List(i) - startpoint = InStr(temp, "-") + 2 - endpoint = Len(temp) - startpoint + 1 - temp = Mid(temp, startpoint, endpoint) - If temp = ThingName Then - FindThingNum = Val(lstThings.List(i)) - Exit For - End If - Next -End Function - -Private Function FindPowerNum(PowerName As String) As Integer - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("d_player.h", ForReading, False) - - Do While InStr(ts.ReadLine, "Player powers. (don't edit this comment)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - Do While InStr(line, "NUMPOWERS") = 0 - startclip = InStr(line, PowerName) - If startclip <> 0 Then - FindPowerNum = number - Exit Do - End If - number = number + 1 - line = ts.ReadLine - Loop - - ts.Close - Set myFSO = Nothing -End Function - -Private Sub WriteThing(Remove As Boolean, num As Integer) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim flags As Long - Dim thingfound As Boolean - Dim i As Integer - - thingfound = False - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - 'If the current thing exists in the SOC, delete it. - If word = "THING" And Val(word2) = num Then - thingfound = True - Do While Len(TrimComplete(tsSource.ReadLine)) > 0 And Not (tsSource.AtEndOfStream) - Loop - Else - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False Then - If line <> "" Then tsTarget.WriteLine "" - tsTarget.WriteLine "Thing " & num - txtDoomednum.Text = TrimComplete(txtDoomednum.Text) - cmbSpawnstate.Text = TrimComplete(cmbSpawnstate.Text) - txtSpawnhealth.Text = TrimComplete(txtSpawnhealth.Text) - cmbSeestate.Text = TrimComplete(cmbSeestate.Text) - cmbSeesound.Text = TrimComplete(cmbSeesound.Text) - txtReactiontime.Text = TrimComplete(txtReactiontime.Text) - cmbAttacksound.Text = TrimComplete(cmbAttacksound.Text) - cmbPainstate.Text = TrimComplete(cmbPainstate.Text) - txtPainchance.Text = TrimComplete(txtPainchance.Text) - cmbPainsound.Text = TrimComplete(cmbPainsound.Text) - cmbMeleestate.Text = TrimComplete(cmbMeleestate.Text) - cmbMissilestate.Text = TrimComplete(cmbMissilestate.Text) - cmbDeathstate.Text = TrimComplete(cmbDeathstate.Text) - cmbDeathsound.Text = TrimComplete(cmbDeathsound.Text) - cmbXdeathstate.Text = TrimComplete(cmbXdeathstate.Text) - txtSpeed.Text = TrimComplete(txtSpeed.Text) - txtRadius.Text = TrimComplete(txtRadius.Text) - txtHeight.Text = TrimComplete(txtHeight.Text) - txtMass.Text = TrimComplete(txtMass.Text) - txtDamage.Text = TrimComplete(txtDamage.Text) - cmbActivesound.Text = TrimComplete(cmbActivesound.Text) - cmbRaisestate.Text = TrimComplete(cmbRaisestate.Text) - flags = 0 - ' Only 31 bits can be used, because VB is stupid. - For i = 0 To 26 - If chkFlags(i).Value = 1 Then flags = flags + Val(chkFlags(i).Tag) - Next - If txtDoomednum.Text <> "" Then tsTarget.WriteLine "MAPTHINGNUM = " & Val(txtDoomednum.Text) - If cmbSpawnstate.Text <> "" Then tsTarget.WriteLine "SPAWNSTATE = " & Val(cmbSpawnstate.Text) - If txtSpawnhealth.Text <> "" Then tsTarget.WriteLine "SPAWNHEALTH = " & Val(txtSpawnhealth.Text) - If cmbSeestate.Text <> "" Then tsTarget.WriteLine "SEESTATE = " & Val(cmbSeestate.Text) - If cmbSeesound.Text <> "" Then tsTarget.WriteLine "SEESOUND = " & Val(cmbSeesound.Text) - If txtReactiontime.Text <> "" Then tsTarget.WriteLine "REACTIONTIME = " & Val(txtReactiontime.Text) - If cmbAttacksound.Text <> "" Then tsTarget.WriteLine "ATTACKSOUND = " & Val(cmbAttacksound.Text) - If cmbPainstate.Text <> "" Then tsTarget.WriteLine "PAINSTATE = " & Val(cmbPainstate.Text) - If txtPainchance.Text <> "" Then tsTarget.WriteLine "PAINCHANCE = " & Val(txtPainchance.Text) - If cmbPainsound.Text <> "" Then tsTarget.WriteLine "PAINSOUND = " & Val(cmbPainsound.Text) - If cmbMeleestate.Text <> "" Then tsTarget.WriteLine "MELEESTATE = " & Val(cmbMeleestate.Text) - If cmbMissilestate.Text <> "" Then tsTarget.WriteLine "MISSILESTATE = " & Val(cmbMissilestate.Text) - If cmbDeathstate.Text <> "" Then tsTarget.WriteLine "DEATHSTATE = " & Val(cmbDeathstate.Text) - If cmbDeathsound.Text <> "" Then tsTarget.WriteLine "DEATHSOUND = " & Val(cmbDeathsound.Text) - If cmbXdeathstate.Text <> "" Then tsTarget.WriteLine "XDEATHSTATE = " & Val(cmbXdeathstate.Text) - If txtSpeed.Text <> "" Then tsTarget.WriteLine "SPEED = " & Val(txtSpeed.Text) - If txtRadius.Text <> "" Then tsTarget.WriteLine "RADIUS = " & Val(txtRadius.Text) - If txtHeight.Text <> "" Then tsTarget.WriteLine "HEIGHT = " & Val(txtHeight.Text) - If txtMass.Text <> "" Then tsTarget.WriteLine "MASS = " & Val(txtMass.Text) - If txtDamage.Text <> "" Then tsTarget.WriteLine "DAMAGE = " & Val(txtDamage.Text) - If cmbActivesound.Text <> "" Then tsTarget.WriteLine "ACTIVESOUND = " & Val(cmbActivesound.Text) - If cmbRaisestate.Text <> "" Then tsTarget.WriteLine "RAISESTATE = " & Val(cmbRaisestate.Text) - tsTarget.WriteLine "FLAGS = " & flags - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - If thingfound = True Then - MsgBox "Thing removed from SOC." - Else - MsgBox "Thing not found in SOC." - End If - Else - MsgBox "Thing Saved." - End If -End Sub diff --git a/tools/SOCEdit/Things.frx b/tools/SOCEdit/Things.frx deleted file mode 100644 index 980538679..000000000 Binary files a/tools/SOCEdit/Things.frx and /dev/null differ diff --git a/tools/SOCEdit/frmCharacterEdit.frm b/tools/SOCEdit/frmCharacterEdit.frm deleted file mode 100644 index 415fcbb0f..000000000 --- a/tools/SOCEdit/frmCharacterEdit.frm +++ /dev/null @@ -1,320 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmCharacterEdit - Caption = "Character Edit" - ClientHeight = 3345 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 4680 - Icon = "frmCharacterEdit.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 3345 - ScaleWidth = 4680 - Begin VB.CommandButton cmdExample - Caption = "Show Me An &Example" - Height = 495 - Left = 1320 - Style = 1 'Graphical - TabIndex = 14 - Top = 2400 - Width = 975 - End - Begin VB.CheckBox chkEnabled - Caption = "Enable this player selection." - Height = 495 - Left = 1080 - TabIndex = 13 - Top = 1560 - Width = 1455 - End - Begin VB.CommandButton cmdDelete - Caption = "&Delete from SOC" - Height = 495 - Left = 120 - Style = 1 'Graphical - TabIndex = 12 - Top = 2760 - Width = 855 - End - Begin VB.CommandButton cmdSave - Caption = "&Save" - Height = 495 - Left = 120 - TabIndex = 11 - Top = 2160 - Width = 855 - End - Begin VB.TextBox txtSkinname - Height = 285 - Left = 3240 - TabIndex = 9 - Top = 1200 - Width = 1335 - End - Begin VB.TextBox txtPicname - Height = 285 - Left = 3240 - MaxLength = 8 - TabIndex = 7 - Top = 840 - Width = 1095 - End - Begin VB.TextBox txtMenuposition - Height = 285 - Left = 3240 - MaxLength = 3 - TabIndex = 5 - Top = 480 - Width = 495 - End - Begin VB.TextBox txtPlayername - Height = 285 - Left = 3240 - MaxLength = 64 - TabIndex = 3 - Top = 120 - Width = 1335 - End - Begin VB.TextBox txtPlayertext - Height = 1455 - Left = 2640 - MultiLine = -1 'True - TabIndex = 1 - Top = 1800 - Width = 1935 - End - Begin VB.ListBox lstPlayers - Height = 1815 - ItemData = "frmCharacterEdit.frx":0442 - Left = 120 - List = "frmCharacterEdit.frx":0461 - TabIndex = 0 - Top = 240 - Width = 855 - End - Begin VB.Label lblSkinname - Caption = "Name of player (skin) to use:" - Height = 255 - Left = 1080 - TabIndex = 10 - Top = 1200 - Width = 2055 - End - Begin VB.Label lblPicname - Alignment = 1 'Right Justify - Caption = "Picture to display:" - Height = 255 - Left = 1560 - TabIndex = 8 - Top = 840 - Width = 1575 - End - Begin VB.Label lblMenuposition - Alignment = 1 'Right Justify - Caption = "Vertical menu position:" - Height = 255 - Left = 1320 - TabIndex = 6 - Top = 480 - Width = 1815 - End - Begin VB.Label lblPlayername - Alignment = 1 'Right Justify - Caption = "Displayed name of player:" - Height = 255 - Left = 1320 - TabIndex = 4 - Top = 120 - Width = 1815 - End - Begin VB.Label lblPlayertext - Caption = "Short Description:" - Height = 255 - Left = 2640 - TabIndex = 2 - Top = 1560 - Width = 1455 - End -End -Attribute VB_Name = "frmCharacterEdit" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdDelete_Click() - Call WriteCharacter(True) -End Sub - -Private Sub cmdExample_Click() - txtPlayername.Text = "SONIC" - txtMenuposition.Text = "20" - txtPicname.Text = "SONCCHAR" - txtSkinname.Text = "SONIC" - chkEnabled.Value = 1 - txtPlayertext.Text = " Fastest" & vbCrLf & " Speed Thok" & vbCrLf & " Not a good pick" & vbCrLf & "for starters, but when" & vbCrLf & "controlled properly," & vbCrLf & "Sonic is the most" & vbCrLf & "powerful of the three." -End Sub - -Private Sub cmdSave_Click() - Call WriteCharacter(False) -End Sub - -Private Sub ClearForm() - txtPlayername.Text = "" - txtMenuposition.Text = "" - txtPicname.Text = "" - txtSkinname.Text = "" - chkEnabled.Value = 0 - txtPlayertext.Text = "" -End Sub - -Private Sub ReadSOCPlayer(num As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "CHARACTER" And Val(word2) = num Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "PLAYERTEXT" Then - Dim startclip As Integer, endclip As Integer - startclip = InStr(line, "=") - - startclip = startclip + 2 - - line = Mid(line, startclip, Len(line)) - - txtPlayertext.Text = line & vbCrLf - - Do While InStr(line, "#") = 0 And Not ts.AtEndOfStream - line = ts.ReadLine & vbCrLf - txtPlayertext.Text = txtPlayertext.Text & line - Loop - - txtPlayertext.Text = RTrimComplete(txtPlayertext.Text) - If Right(txtPlayertext.Text, 1) = "#" Then - txtPlayertext.Text = Left(txtPlayertext.Text, Len(txtPlayertext.Text) - 1) - End If - ElseIf word = "PLAYERNAME" Then - txtPlayername.Text = word2 - ElseIf word = "MENUPOSITION" Then - txtMenuposition.Text = Val(word2) - ElseIf word = "PICNAME" Then - txtPicname.Text = word2 - ElseIf word = "STATUS" Then - If Val(word2) = 32 Then - chkEnabled.Value = 1 - Else - chkEnabled.Value = 0 - End If - ElseIf word = "SKINNAME" Then - txtSkinname.Text = word2 - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC!" & vbCrLf & "Unknown line: " & line - End If - Loop - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub lstPlayers_Click() - Call ClearForm - Call ReadSOCPlayer(lstPlayers.ListIndex) -End Sub - -Private Sub WriteCharacter(Remove As Boolean) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim charfound As Boolean - - charfound = False - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - 'If the current character exists in the SOC, delete it. - If word = "CHARACTER" And Val(word2) = lstPlayers.ListIndex Then - charfound = True - Do While Len(TrimComplete(tsSource.ReadLine)) > 0 And Not (tsSource.AtEndOfStream) - Loop - Else - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False Then - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine "CHARACTER " & lstPlayers.ListIndex - txtPlayername.Text = TrimComplete(txtPlayername.Text) - txtMenuposition.Text = TrimComplete(txtMenuposition.Text) - txtPicname.Text = TrimComplete(txtPicname.Text) - txtSkinname.Text = TrimComplete(txtSkinname.Text) - If txtPlayername.Text <> "" Then tsTarget.WriteLine "PLAYERNAME = " & txtPlayername.Text - If txtMenuposition.Text <> "" Then tsTarget.WriteLine "MENUPOSITION = " & Val(txtMenuposition.Text) - If txtPicname.Text <> "" Then tsTarget.WriteLine "PICNAME = " & txtPicname.Text - If txtSkinname.Text <> "" Then tsTarget.WriteLine "SKINNAME = " & txtSkinname.Text - If chkEnabled.Value = 1 Then - tsTarget.WriteLine "STATUS = 32" - Else - tsTarget.WriteLine "STATUS = 0" - End If - If txtPlayertext.Text <> "" Then tsTarget.WriteLine "PLAYERTEXT = " & txtPlayertext.Text & "#" - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - If charfound = True Then - MsgBox "Player choice removed from SOC." - Else - MsgBox "Player choice not found in SOC." - End If - Else - MsgBox "Character Saved." - End If -End Sub - diff --git a/tools/SOCEdit/frmCharacterEdit.frx b/tools/SOCEdit/frmCharacterEdit.frx deleted file mode 100644 index 5e767f4ab..000000000 Binary files a/tools/SOCEdit/frmCharacterEdit.frx and /dev/null differ diff --git a/tools/SOCEdit/frmCutsceneEdit.frm b/tools/SOCEdit/frmCutsceneEdit.frm deleted file mode 100644 index 7fb18feed..000000000 --- a/tools/SOCEdit/frmCutsceneEdit.frm +++ /dev/null @@ -1,1365 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmCutsceneEdit - Caption = "Cutscene Edit" - ClientHeight = 6495 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 10410 - Icon = "frmCutsceneEdit.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 6495 - ScaleWidth = 10410 - StartUpPosition = 3 'Windows Default - Begin VB.TextBox txtNumScenes - Height = 285 - Left = 3480 - MaxLength = 3 - TabIndex = 97 - Top = 240 - Width = 615 - End - Begin VB.ListBox lstScene - Height = 450 - ItemData = "frmCutsceneEdit.frx":0442 - Left = 3360 - List = "frmCutsceneEdit.frx":0444 - TabIndex = 94 - Top = 600 - Width = 735 - End - Begin VB.ComboBox cmbMusicslot - Height = 315 - Left = 8760 - TabIndex = 93 - Top = 1680 - Width = 1575 - End - Begin VB.Frame frmPic1 - Caption = "Picture 8:" - Height = 1335 - Index = 7 - Left = 7440 - TabIndex = 80 - Top = 5040 - Width = 2895 - Begin VB.TextBox txtPicycoord - Height = 285 - Index = 7 - Left = 600 - MaxLength = 3 - TabIndex = 85 - Top = 960 - Width = 495 - End - Begin VB.TextBox txtPicXcoord - Height = 285 - Index = 7 - Left = 600 - MaxLength = 3 - TabIndex = 84 - Top = 600 - Width = 495 - End - Begin VB.TextBox txtPicduration - Height = 285 - Index = 7 - Left = 2040 - MaxLength = 5 - TabIndex = 83 - Top = 600 - Width = 735 - End - Begin VB.TextBox txtPicname - Height = 285 - Index = 7 - Left = 1320 - TabIndex = 82 - Top = 240 - Width = 1455 - End - Begin VB.CheckBox chkPichires - Caption = "High-Resolution" - Height = 255 - Index = 7 - Left = 1320 - TabIndex = 81 - Top = 960 - Width = 1455 - End - Begin VB.Label lblPicycoord - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Index = 7 - Left = 240 - TabIndex = 89 - Top = 960 - Width = 255 - End - Begin VB.Label lblPicxcoord - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Index = 7 - Left = 240 - TabIndex = 88 - Top = 600 - Width = 255 - End - Begin VB.Label lblPicduration - Alignment = 1 'Right Justify - Caption = "Duration:" - Height = 255 - Index = 7 - Left = 1200 - TabIndex = 87 - Top = 600 - Width = 735 - End - Begin VB.Label lblPicname - Alignment = 1 'Right Justify - Caption = "Picture Name:" - Height = 255 - Index = 7 - Left = 120 - TabIndex = 86 - Top = 240 - Width = 1095 - End - End - Begin VB.Frame frmPic1 - Caption = "Picture 7:" - Height = 1335 - Index = 6 - Left = 4440 - TabIndex = 70 - Top = 5040 - Width = 2895 - Begin VB.TextBox txtPicycoord - Height = 285 - Index = 6 - Left = 600 - MaxLength = 3 - TabIndex = 75 - Top = 960 - Width = 495 - End - Begin VB.TextBox txtPicXcoord - Height = 285 - Index = 6 - Left = 600 - MaxLength = 3 - TabIndex = 74 - Top = 600 - Width = 495 - End - Begin VB.TextBox txtPicduration - Height = 285 - Index = 6 - Left = 2040 - MaxLength = 5 - TabIndex = 73 - Top = 600 - Width = 735 - End - Begin VB.TextBox txtPicname - Height = 285 - Index = 6 - Left = 1320 - TabIndex = 72 - Top = 240 - Width = 1455 - End - Begin VB.CheckBox chkPichires - Caption = "High-Resolution" - Height = 255 - Index = 6 - Left = 1320 - TabIndex = 71 - Top = 960 - Width = 1455 - End - Begin VB.Label lblPicycoord - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Index = 6 - Left = 240 - TabIndex = 79 - Top = 960 - Width = 255 - End - Begin VB.Label lblPicxcoord - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Index = 6 - Left = 240 - TabIndex = 78 - Top = 600 - Width = 255 - End - Begin VB.Label lblPicduration - Alignment = 1 'Right Justify - Caption = "Duration:" - Height = 255 - Index = 6 - Left = 1200 - TabIndex = 77 - Top = 600 - Width = 735 - End - Begin VB.Label lblPicname - Alignment = 1 'Right Justify - Caption = "Picture Name:" - Height = 255 - Index = 6 - Left = 120 - TabIndex = 76 - Top = 240 - Width = 1095 - End - End - Begin VB.Frame frmPic1 - Caption = "Picture 6:" - Height = 1335 - Index = 5 - Left = 7440 - TabIndex = 60 - Top = 3600 - Width = 2895 - Begin VB.TextBox txtPicycoord - Height = 285 - Index = 5 - Left = 600 - MaxLength = 3 - TabIndex = 65 - Top = 960 - Width = 495 - End - Begin VB.TextBox txtPicXcoord - Height = 285 - Index = 5 - Left = 600 - MaxLength = 3 - TabIndex = 64 - Top = 600 - Width = 495 - End - Begin VB.TextBox txtPicduration - Height = 285 - Index = 5 - Left = 2040 - MaxLength = 5 - TabIndex = 63 - Top = 600 - Width = 735 - End - Begin VB.TextBox txtPicname - Height = 285 - Index = 5 - Left = 1320 - TabIndex = 62 - Top = 240 - Width = 1455 - End - Begin VB.CheckBox chkPichires - Caption = "High-Resolution" - Height = 255 - Index = 5 - Left = 1320 - TabIndex = 61 - Top = 960 - Width = 1455 - End - Begin VB.Label lblPicycoord - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Index = 5 - Left = 240 - TabIndex = 69 - Top = 960 - Width = 255 - End - Begin VB.Label lblPicxcoord - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Index = 5 - Left = 240 - TabIndex = 68 - Top = 600 - Width = 255 - End - Begin VB.Label lblPicduration - Alignment = 1 'Right Justify - Caption = "Duration:" - Height = 255 - Index = 5 - Left = 1200 - TabIndex = 67 - Top = 600 - Width = 735 - End - Begin VB.Label lblPicname - Alignment = 1 'Right Justify - Caption = "Picture Name:" - Height = 255 - Index = 5 - Left = 120 - TabIndex = 66 - Top = 240 - Width = 1095 - End - End - Begin VB.Frame frmPic1 - Caption = "Picture 5:" - Height = 1335 - Index = 4 - Left = 4440 - TabIndex = 50 - Top = 3600 - Width = 2895 - Begin VB.TextBox txtPicycoord - Height = 285 - Index = 4 - Left = 600 - MaxLength = 3 - TabIndex = 55 - Top = 960 - Width = 495 - End - Begin VB.TextBox txtPicXcoord - Height = 285 - Index = 4 - Left = 600 - MaxLength = 3 - TabIndex = 54 - Top = 600 - Width = 495 - End - Begin VB.TextBox txtPicduration - Height = 285 - Index = 4 - Left = 2040 - MaxLength = 5 - TabIndex = 53 - Top = 600 - Width = 735 - End - Begin VB.TextBox txtPicname - Height = 285 - Index = 4 - Left = 1320 - TabIndex = 52 - Top = 240 - Width = 1455 - End - Begin VB.CheckBox chkPichires - Caption = "High-Resolution" - Height = 255 - Index = 4 - Left = 1320 - TabIndex = 51 - Top = 960 - Width = 1455 - End - Begin VB.Label lblPicycoord - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Index = 4 - Left = 240 - TabIndex = 59 - Top = 960 - Width = 255 - End - Begin VB.Label lblPicxcoord - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Index = 4 - Left = 240 - TabIndex = 58 - Top = 600 - Width = 255 - End - Begin VB.Label lblPicduration - Alignment = 1 'Right Justify - Caption = "Duration:" - Height = 255 - Index = 4 - Left = 1200 - TabIndex = 57 - Top = 600 - Width = 735 - End - Begin VB.Label lblPicname - Alignment = 1 'Right Justify - Caption = "Picture Name:" - Height = 255 - Index = 4 - Left = 120 - TabIndex = 56 - Top = 240 - Width = 1095 - End - End - Begin VB.Frame frmPic1 - Caption = "Picture 4:" - Height = 1335 - Index = 3 - Left = 1440 - TabIndex = 40 - Top = 3600 - Width = 2895 - Begin VB.CheckBox chkPichires - Caption = "High-Resolution" - Height = 255 - Index = 3 - Left = 1320 - TabIndex = 45 - Top = 960 - Width = 1455 - End - Begin VB.TextBox txtPicname - Height = 285 - Index = 3 - Left = 1320 - TabIndex = 44 - Top = 240 - Width = 1455 - End - Begin VB.TextBox txtPicduration - Height = 285 - Index = 3 - Left = 2040 - MaxLength = 5 - TabIndex = 43 - Top = 600 - Width = 735 - End - Begin VB.TextBox txtPicXcoord - Height = 285 - Index = 3 - Left = 600 - MaxLength = 3 - TabIndex = 42 - Top = 600 - Width = 495 - End - Begin VB.TextBox txtPicycoord - Height = 285 - Index = 3 - Left = 600 - MaxLength = 3 - TabIndex = 41 - Top = 960 - Width = 495 - End - Begin VB.Label lblPicname - Alignment = 1 'Right Justify - Caption = "Picture Name:" - Height = 255 - Index = 3 - Left = 120 - TabIndex = 49 - Top = 240 - Width = 1095 - End - Begin VB.Label lblPicduration - Alignment = 1 'Right Justify - Caption = "Duration:" - Height = 255 - Index = 3 - Left = 1200 - TabIndex = 48 - Top = 600 - Width = 735 - End - Begin VB.Label lblPicxcoord - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Index = 3 - Left = 240 - TabIndex = 47 - Top = 600 - Width = 255 - End - Begin VB.Label lblPicycoord - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Index = 3 - Left = 240 - TabIndex = 46 - Top = 960 - Width = 255 - End - End - Begin VB.Frame frmPic1 - Caption = "Picture 3:" - Height = 1335 - Index = 2 - Left = 7440 - TabIndex = 30 - Top = 2160 - Width = 2895 - Begin VB.CheckBox chkPichires - Caption = "High-Resolution" - Height = 255 - Index = 2 - Left = 1320 - TabIndex = 35 - Top = 960 - Width = 1455 - End - Begin VB.TextBox txtPicname - Height = 285 - Index = 2 - Left = 1320 - TabIndex = 34 - Top = 240 - Width = 1455 - End - Begin VB.TextBox txtPicduration - Height = 285 - Index = 2 - Left = 2040 - MaxLength = 5 - TabIndex = 33 - Top = 600 - Width = 735 - End - Begin VB.TextBox txtPicXcoord - Height = 285 - Index = 2 - Left = 600 - MaxLength = 3 - TabIndex = 32 - Top = 600 - Width = 495 - End - Begin VB.TextBox txtPicycoord - Height = 285 - Index = 2 - Left = 600 - MaxLength = 3 - TabIndex = 31 - Top = 960 - Width = 495 - End - Begin VB.Label lblPicname - Alignment = 1 'Right Justify - Caption = "Picture Name:" - Height = 255 - Index = 2 - Left = 120 - TabIndex = 39 - Top = 240 - Width = 1095 - End - Begin VB.Label lblPicduration - Alignment = 1 'Right Justify - Caption = "Duration:" - Height = 255 - Index = 2 - Left = 1200 - TabIndex = 38 - Top = 600 - Width = 735 - End - Begin VB.Label lblPicxcoord - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Index = 2 - Left = 240 - TabIndex = 37 - Top = 600 - Width = 255 - End - Begin VB.Label lblPicycoord - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Index = 2 - Left = 240 - TabIndex = 36 - Top = 960 - Width = 255 - End - End - Begin VB.Frame frmPic1 - Caption = "Picture 2:" - Height = 1335 - Index = 1 - Left = 4440 - TabIndex = 20 - Top = 2160 - Width = 2895 - Begin VB.CheckBox chkPichires - Caption = "High-Resolution" - Height = 255 - Index = 1 - Left = 1320 - TabIndex = 25 - Top = 960 - Width = 1455 - End - Begin VB.TextBox txtPicname - Height = 285 - Index = 1 - Left = 1320 - TabIndex = 24 - Top = 240 - Width = 1455 - End - Begin VB.TextBox txtPicduration - Height = 285 - Index = 1 - Left = 2040 - MaxLength = 5 - TabIndex = 23 - Top = 600 - Width = 735 - End - Begin VB.TextBox txtPicXcoord - Height = 285 - Index = 1 - Left = 600 - MaxLength = 3 - TabIndex = 22 - Top = 600 - Width = 495 - End - Begin VB.TextBox txtPicycoord - Height = 285 - Index = 1 - Left = 600 - MaxLength = 3 - TabIndex = 21 - Top = 960 - Width = 495 - End - Begin VB.Label lblPicname - Alignment = 1 'Right Justify - Caption = "Picture Name:" - Height = 255 - Index = 1 - Left = 120 - TabIndex = 29 - Top = 240 - Width = 1095 - End - Begin VB.Label lblPicduration - Alignment = 1 'Right Justify - Caption = "Duration:" - Height = 255 - Index = 1 - Left = 1200 - TabIndex = 28 - Top = 600 - Width = 735 - End - Begin VB.Label lblPicxcoord - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Index = 1 - Left = 240 - TabIndex = 27 - Top = 600 - Width = 255 - End - Begin VB.Label lblPicycoord - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Index = 1 - Left = 240 - TabIndex = 26 - Top = 960 - Width = 255 - End - End - Begin VB.TextBox txtTextypos - Height = 285 - Left = 3120 - MaxLength = 3 - TabIndex = 19 - Top = 5880 - Width = 615 - End - Begin VB.TextBox txtTextxpos - Height = 285 - Left = 3120 - MaxLength = 3 - TabIndex = 18 - Top = 5520 - Width = 615 - End - Begin VB.Frame frmPic1 - Caption = "Picture 1:" - Height = 1335 - Index = 0 - Left = 1440 - TabIndex = 6 - Top = 2160 - Width = 2895 - Begin VB.TextBox txtPicycoord - Height = 285 - Index = 0 - Left = 600 - MaxLength = 3 - TabIndex = 14 - Top = 960 - Width = 495 - End - Begin VB.TextBox txtPicXcoord - Height = 285 - Index = 0 - Left = 600 - MaxLength = 3 - TabIndex = 12 - Top = 600 - Width = 495 - End - Begin VB.TextBox txtPicduration - Height = 285 - Index = 0 - Left = 2040 - MaxLength = 5 - TabIndex = 11 - Top = 600 - Width = 735 - End - Begin VB.TextBox txtPicname - Height = 285 - Index = 0 - Left = 1320 - TabIndex = 8 - Top = 240 - Width = 1455 - End - Begin VB.CheckBox chkPichires - Caption = "High-Resolution" - Height = 255 - Index = 0 - Left = 1320 - TabIndex = 7 - Top = 960 - Width = 1455 - End - Begin VB.Label lblPicycoord - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Index = 0 - Left = 240 - TabIndex = 15 - Top = 960 - Width = 255 - End - Begin VB.Label lblPicxcoord - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Index = 0 - Left = 240 - TabIndex = 13 - Top = 600 - Width = 255 - End - Begin VB.Label lblPicduration - Alignment = 1 'Right Justify - Caption = "Duration:" - Height = 255 - Index = 0 - Left = 1200 - TabIndex = 10 - Top = 600 - Width = 735 - End - Begin VB.Label lblPicname - Alignment = 1 'Right Justify - Caption = "Picture Name:" - Height = 255 - Index = 0 - Left = 120 - TabIndex = 9 - Top = 240 - Width = 1095 - End - End - Begin VB.TextBox txtNumberofpics - Height = 285 - Left = 3840 - MaxLength = 1 - TabIndex = 5 - Top = 1800 - Width = 375 - End - Begin VB.TextBox txtScenetext - Height = 1815 - Left = 4440 - MultiLine = -1 'True - TabIndex = 3 - Top = 240 - Width = 3135 - End - Begin VB.CommandButton cmdSave - Caption = "&Save Scene" - Height = 495 - Left = 3360 - Style = 1 'Graphical - TabIndex = 1 - Top = 1200 - Width = 855 - End - Begin VB.ListBox lstCutscenes - Height = 6300 - ItemData = "frmCutsceneEdit.frx":0446 - Left = 120 - List = "frmCutsceneEdit.frx":0448 - TabIndex = 0 - Top = 120 - Width = 1215 - End - Begin VB.Label Label3 - Caption = "Note: The cutscene editor is not fully functional. Only use it to get an idea of the proper syntax to use." - BeginProperty Font - Name = "MS Sans Serif" - Size = 9.75 - Charset = 0 - Weight = 700 - Underline = 0 'False - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 1335 - Left = 7680 - TabIndex = 98 - Top = 240 - Width = 2655 - End - Begin VB.Label Label2 - Caption = "For Scene Text:" - BeginProperty Font - Name = "MS Sans Serif" - Size = 8.25 - Charset = 0 - Weight = 400 - Underline = -1 'True - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 255 - Left = 1560 - TabIndex = 96 - Top = 5160 - Width = 1695 - End - Begin VB.Label Label1 - Caption = "Enter all time durations in game tics (35 = 1 second)" - BeginProperty Font - Name = "MS Sans Serif" - Size = 8.25 - Charset = 0 - Weight = 700 - Underline = 0 'False - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 855 - Left = 1560 - TabIndex = 95 - Top = 960 - Width = 1335 - End - Begin VB.Label lblMusicslot - Alignment = 1 'Right Justify - Caption = "Music to play:" - Height = 255 - Left = 7680 - TabIndex = 92 - Top = 1680 - Width = 975 - End - Begin VB.Label lblCurrentScene - Alignment = 1 'Right Justify - Caption = "Current Scene:" - Height = 255 - Left = 1920 - TabIndex = 91 - Top = 720 - Width = 1215 - End - Begin VB.Label lblNumScenes - Alignment = 1 'Right Justify - Caption = "Number of Scenes in this Cutscene:" - Height = 375 - Left = 1440 - TabIndex = 90 - Top = 120 - Width = 1935 - End - Begin VB.Label lblTextypos - Alignment = 1 'Right Justify - Caption = "Text Y Position:" - Height = 255 - Left = 1800 - TabIndex = 17 - Top = 5880 - Width = 1215 - End - Begin VB.Label lblTextxpos - Alignment = 1 'Right Justify - Caption = "Text X Position:" - Height = 255 - Left = 1800 - TabIndex = 16 - Top = 5520 - Width = 1215 - End - Begin VB.Label lblNumberofpics - Alignment = 1 'Right Justify - Caption = "Number of Pictures (max 8):" - Height = 255 - Left = 1560 - TabIndex = 4 - Top = 1800 - Width = 2175 - End - Begin VB.Label lblScenetext - Caption = "Scene Text:" - Height = 255 - Left = 4440 - TabIndex = 2 - Top = 0 - Width = 1215 - End -End -Attribute VB_Name = "frmCutsceneEdit" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdSave_Click() - Call WriteScene(False) -End Sub - -Private Sub lstScene_Click() - Call ClearForm - Call LoadSOCCutscene(Val(lstCutscenes.List(lstCutscenes.ListIndex)), Val(lstScene.List(lstScene.ListIndex))) -End Sub - -Private Sub LoadMusic() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim addstring As String - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("sounds.h", ForReading, False) - - Do While InStr(ts.ReadLine, "Music list (don't edit this comment!)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - cmbMusicslot.Clear - - Do While InStr(line, "NUMMUSIC") = 0 - startclip = InStr(line, "mus_") - If InStr(line, "mus_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - addstring = number & " - " & line - cmbMusicslot.AddItem addstring - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub cmdReload_Click() - Call Reload -End Sub - -Private Sub Form_Load() - Call Reload -End Sub - -Private Sub Reload() - ClearForm - Call ReadCutsceneSOCNumbers - Call LoadMusic - If lstCutscenes.ListCount > 0 Then - lstCutscenes.ListIndex = 0 - End If -End Sub - -Private Sub LoadSOCCutscene(CutNum As Integer, SceneNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim ind As Integer - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - ' WOW! This looks fun, don't it?! - If UCase(word) = "CUTSCENE" And Val(word2) = CutNum Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - If word = "NUMSCENES" Then - txtNumScenes.Text = Val(word2) - ElseIf UCase(word) = "SCENE" And Val(word2) = SceneNum Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "SCENETEXT" Then - Dim startclip As Integer, endclip As Integer - startclip = InStr(line, "=") - - startclip = startclip + 2 - - line = Mid(line, startclip, Len(line)) - - txtScenetext.Text = line & vbCrLf - - Do While InStr(line, "#") = 0 And Not ts.AtEndOfStream - line = ts.ReadLine & vbCrLf - txtScenetext.Text = txtScenetext.Text & line - Loop - - txtScenetext.Text = RTrimComplete(txtScenetext.Text) - If Right(txtScenetext.Text, 1) = "#" Then - txtScenetext.Text = Left(txtScenetext.Text, Len(txtScenetext.Text) - 1) - End If - ElseIf word = "PIC1NAME" Or word = "PIC2NAME" Or word = "PIC3NAME" Or word = "PIC4NAME" Or word = "PIC5NAME" Or word = "PIC6NAME" Or word = "PIC7NAME" Or word = "PIC8NAME" Then - ind = Val(Mid(word, 4, 1)) - 1 - txtPicname(ind).Text = word2 - ElseIf word = "PIC1HIRES" Or word = "PIC2HIRES" Or word = "PIC3HIRES" Or word = "PIC4HIRES" Or word = "PIC5HIRES" Or word = "PIC6HIRES" Or word = "PIC7HIRES" Or word = "PIC8HIRES" Then - ind = Val(Mid(word, 4, 1)) - 1 - chkPichires(ind).Value = Val(word2) - ElseIf word = "PIC1DURATION" Or word = "PIC2DURATION" Or word = "PIC3DURATION" Or word = "PIC4DURATION" Or word = "PIC5DURATION" Or word = "PIC6DURATION" Or word = "PIC7DURATION" Or word = "PIC8DURATION" Then - ind = Val(Mid(word, 4, 1)) - 1 - txtPicduration(ind).Text = Val(word2) - ElseIf word = "PIC1XCOORD" Or word = "PIC2XCOORD" Or word = "PIC3XCOORD" Or word = "PIC4XCOORD" Or word = "PIC5XCOORD" Or word = "PIC6XCOORD" Or word = "PIC7XCOORD" Or word = "PIC8XCOORD" Then - ind = Val(Mid(word, 4, 1)) - 1 - txtPicXcoord(ind).Text = Val(word2) - ElseIf word = "PIC1YCOORD" Or word = "PIC2YCOORD" Or word = "PIC3YCOORD" Or word = "PIC4YCOORD" Or word = "PIC5YCOORD" Or word = "PIC6YCOORD" Or word = "PIC7YCOORD" Or word = "PIC8YCOORD" Then - ind = Val(Mid(word, 4, 1)) - 1 - txtPicycoord(ind).Text = Val(word2) - ElseIf word = "TEXTXPOS" Then - txtTextxpos.Text = Val(word2) - ElseIf word = "TEXTYPOS" Then - txtTextypos.Text = Val(word2) - ElseIf word = "MUSICSLOT" Then - cmbMusicslot.ListIndex = Val(word2) - ElseIf word = "NUMBEROFPICS" Then - txtNumberofpics.Text = Val(word2) - ElseIf word = "SCENE" Then 'End of scene data - line = "" - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC!" & vbCrLf & "Unknown line: " & line - End If - Loop - End If - Loop - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub ReadCutsceneSOCNumbers() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - - lstCutscenes.Clear - -CutsceneLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo CutsceneLoad - - If Left(line, 1) = vbCrLf Then GoTo CutsceneLoad - - If Len(line) < 1 Then GoTo CutsceneLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "CUTSCENE" Then - lstCutscenes.AddItem (Val(word2)) - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub ClearForm() - Dim i As Integer - - For i = 0 To 7 - chkPichires(i).Value = 0 - txtPicXcoord(i).Text = "" - txtPicycoord(i).Text = "" - txtPicname(i).Text = "" - txtPicduration(i).Text = "" - Next - - txtScenetext.Text = "" - txtNumberofpics.Text = "" - txtTextxpos.Text = "" - txtTextypos.Text = "" - cmbMusicslot.Text = "" -End Sub - -Private Sub lstCutscenes_Click() - Dim i As Integer - - LoadNumScenes (Val(lstCutscenes.List(lstCutscenes.ListIndex))) - - lstScene.Clear - For i = 1 To Val(txtNumScenes.Text) - lstScene.AddItem i - Next - - If Val(txtNumScenes) > 0 Then - lstScene.ListIndex = lstScene.ListCount - 1 - lstScene.ListIndex = 0 - End If -End Sub - -Private Sub LoadNumScenes(CutNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim ind As Integer - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - ' WOW! This looks fun, don't it?! - If UCase(word) = "CUTSCENE" And Val(word2) = CutNum Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - If word = "NUMSCENES" Then - txtNumScenes.Text = Val(word2) - End If - Loop - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub WriteScene(Remove As Boolean) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim flags As Long - Dim i As Integer - Dim CutsceneNum As Integer - Dim InCutScene As Boolean - Dim scenefound As Boolean - Dim nevercheckagain As Boolean - - ' This whole sub is a mess, but it works, - ' so I'd better not touch it... - scenefound = False - nevercheckagain = False - - InCutScene = False - CutsceneNum = Val(lstCutscenes.List(lstCutscenes.ListIndex)) - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - If nevercheckagain = False And word = "CUTSCENE" And Val(word2) = CutsceneNum Then - InCutScene = True - tsTarget.WriteLine "CUTSCENE " & Val(lstCutscenes.List(lstCutscenes.ListIndex)) - tsTarget.WriteLine "NUMSCENES " & Val(txtNumScenes.Text) - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - If word = "NUMSCENES" Then - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - End If - End If - - 'If the current scene exists in the SOC, delete it. - If nevercheckagain = False And InCutScene = True And word = "SCENE" And Val(word2) = Val(lstScene.List(lstScene.ListIndex)) Then - scenefound = True - line = tsSource.ReadLine - Do While (Left(UCase(line), 6) <> "SCENE " And Len(TrimComplete(line)) > 0) And Not (tsSource.AtEndOfStream) - line = tsSource.ReadLine - Loop - If Remove = False Then - tsTarget.WriteLine "SCENE " & Val(lstScene.List(lstScene.ListIndex)) - txtNumberofpics.Text = TrimComplete(txtNumberofpics.Text) - txtTextxpos.Text = TrimComplete(txtTextxpos.Text) - txtTextypos.Text = TrimComplete(txtTextypos.Text) - cmbMusicslot.Text = TrimComplete(cmbMusicslot.Text) - - For i = 0 To 7 - txtPicname(i).Text = TrimComplete(txtPicname(i).Text) - txtPicXcoord(i).Text = TrimComplete(txtPicXcoord(i).Text) - txtPicycoord(i).Text = TrimComplete(txtPicycoord(i).Text) - txtPicduration(i).Text = TrimComplete(txtPicduration(i).Text) - Next - - If txtNumberofpics.Text <> "" Then tsTarget.WriteLine "NUMBEROFPICS = " & Val(txtNumberofpics.Text) - If txtTextxpos.Text <> "" Then tsTarget.WriteLine "TEXTXPOS = " & Val(txtTextxpos.Text) - If txtTextypos.Text <> "" Then tsTarget.WriteLine "TEXTYPOS = " & Val(txtTextypos.Text) - If cmbMusicslot.Text <> "" Then tsTarget.WriteLine "MUSICSLOT = " & Val(cmbMusicslot.Text) - - For i = 0 To 7 - If txtPicname(i).Text <> "" Then tsTarget.WriteLine "PIC" & (i + 1) & "NAME = " & txtPicname(i).Text - - If chkPichires(i).Value = 1 Then tsTarget.WriteLine "PIC" & (i + 1) & "HIRES = 1" - - If txtPicXcoord(i).Text <> "" Then tsTarget.WriteLine "PIC" & (i + 1) & "XCOORD = " & Val(txtPicXcoord(i).Text) - If txtPicycoord(i).Text <> "" Then tsTarget.WriteLine "PIC" & (i + 1) & "YCOORD = " & Val(txtPicycoord(i).Text) - If txtPicduration(i).Text <> "" Then tsTarget.WriteLine "PIC" & (i + 1) & "DURATION = " & Val(txtPicduration(i).Text) - Next - If txtScenetext.Text <> "" Then tsTarget.WriteLine "SCENETEXT = " & txtScenetext.Text & "#" - End If - InCutScene = False - nevercheckagain = True - End If - tsTarget.WriteLine line - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False And scenefound = False Then - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine "CUTSCENE " & Val(lstCutscenes.List(lstCutscenes.ListIndex)) - tsTarget.WriteLine "NUMSCENES " & Val(txtNumScenes.Text) - tsTarget.WriteLine "SCENE " & Val(lstScene.List(lstScene.ListIndex)) - txtNumberofpics.Text = TrimComplete(txtNumberofpics.Text) - txtScenetext.Text = TrimComplete(txtScenetext.Text) - txtTextxpos.Text = TrimComplete(txtTextxpos.Text) - txtTextypos.Text = TrimComplete(txtTextypos.Text) - cmbMusicslot.Text = TrimComplete(cmbMusicslot.Text) - - For i = 0 To 7 - txtPicname(i).Text = TrimComplete(txtPicname(i).Text) - txtPicXcoord(i).Text = TrimComplete(txtPicXcoord(i).Text) - txtPicycoord(i).Text = TrimComplete(txtPicycoord(i).Text) - txtPicduration(i).Text = TrimComplete(txtPicduration(i).Text) - Next - - If txtNumberofpics.Text <> "" Then tsTarget.WriteLine "NUMBEROFPICS = " & Val(txtNumberofpics.Text) - If txtScenetext.Text <> "" Then tsTarget.WriteLine "SCENETEXT = " & txtScenetext.Text & "#" - If txtTextxpos.Text <> "" Then tsTarget.WriteLine "TEXTXPOS = " & Val(txtTextxpos.Text) - If txtTextypos.Text <> "" Then tsTarget.WriteLine "TEXTYPOS = " & Val(txtTextypos.Text) - If cmbMusicslot.Text <> "" Then tsTarget.WriteLine "MUSICSLOT = " & Val(cmbMusicslot.Text) - - For i = 0 To 7 - If txtPicname(i).Text <> "" Then tsTarget.WriteLine "PIC" & (i + 1) & "NAME = " & txtPicname(i).Text - - If chkPichires(i).Value = 1 Then tsTarget.WriteLine "PIC" & (i + 1) & "HIRES = 1" - - If txtPicXcoord(i).Text <> "" Then tsTarget.WriteLine "PIC" & (i + 1) & "XCOORD = " & Val(txtPicXcoord(i).Text) - If txtPicycoord(i).Text <> "" Then tsTarget.WriteLine "PIC" & (i + 1) & "YCOORD = " & Val(txtPicycoord(i).Text) - If txtPicduration(i).Text <> "" Then tsTarget.WriteLine "PIC" & (i + 1) & "DURATION = " & Val(txtPicduration(i).Text) - Next - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - If scenefound = True Then - MsgBox "Scene removed from SOC." - Else - MsgBox "Scene not found in SOC." - End If - Else - MsgBox "Scene Saved." - End If -End Sub diff --git a/tools/SOCEdit/frmCutsceneEdit.frx b/tools/SOCEdit/frmCutsceneEdit.frx deleted file mode 100644 index 6f844e643..000000000 Binary files a/tools/SOCEdit/frmCutsceneEdit.frx and /dev/null differ diff --git a/tools/SOCEdit/frmEmblemEdit.frm b/tools/SOCEdit/frmEmblemEdit.frm deleted file mode 100644 index f94255b9c..000000000 --- a/tools/SOCEdit/frmEmblemEdit.frm +++ /dev/null @@ -1,384 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmEmblemEdit - Caption = "Emblem Edit" - ClientHeight = 2865 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 5160 - Icon = "frmEmblemEdit.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 2865 - ScaleWidth = 5160 - StartUpPosition = 3 'Windows Default - Begin VB.CommandButton cmdDelete - Caption = "&Delete Last Emblem" - Height = 735 - Left = 1560 - Style = 1 'Graphical - TabIndex = 17 - Top = 600 - Width = 855 - End - Begin VB.CommandButton cmdAdd - Caption = "&Add" - Height = 375 - Left = 1560 - TabIndex = 16 - Top = 120 - Width = 855 - End - Begin VB.CommandButton cmdSave - Caption = "&Save Emblem" - Height = 495 - Left = 4200 - Style = 1 'Graphical - TabIndex = 13 - Top = 2280 - Width = 855 - End - Begin VB.CommandButton cmdReload - Caption = "&Reload" - Height = 495 - Left = 3120 - TabIndex = 12 - Top = 2280 - Width = 975 - End - Begin VB.TextBox txtPlayernum - Height = 285 - Left = 4320 - MaxLength = 3 - TabIndex = 9 - Top = 1800 - Width = 735 - End - Begin VB.TextBox txtMapnum - Height = 285 - Left = 4320 - MaxLength = 4 - TabIndex = 7 - Top = 1320 - Width = 735 - End - Begin VB.TextBox txtZ - Height = 285 - Left = 4320 - MaxLength = 5 - TabIndex = 3 - Top = 960 - Width = 735 - End - Begin VB.TextBox txtY - Height = 285 - Left = 4320 - MaxLength = 5 - TabIndex = 2 - Top = 600 - Width = 735 - End - Begin VB.TextBox txtX - Height = 285 - Left = 4320 - MaxLength = 5 - TabIndex = 1 - Top = 240 - Width = 735 - End - Begin VB.ListBox lstEmblems - Height = 2400 - Left = 120 - TabIndex = 0 - Top = 120 - Width = 1335 - End - Begin VB.Label Label1 - Caption = "Emblem #s must be linear, sorry!" - Height = 495 - Left = 1560 - TabIndex = 18 - Top = 2400 - Width = 1455 - End - Begin VB.Label lblNumEmblems - Caption = "# of Emblems:" - Height = 255 - Left = 120 - TabIndex = 15 - Top = 2520 - Width = 1335 - End - Begin VB.Label lblNote2 - Caption = "Don't forget to set Game Data file and # of Emblems in Global Game Settings!" - Height = 855 - Left = 1560 - TabIndex = 14 - Top = 1440 - Width = 1575 - End - Begin VB.Label lblNote - Appearance = 0 'Flat - BorderStyle = 1 'Fixed Single - Caption = "Note: Enter map coordinates, not game coordinates. (I.e., 128, not 8388608)" - ForeColor = &H80000008& - Height = 1095 - Left = 2640 - TabIndex = 11 - Top = 120 - Width = 1335 - End - Begin VB.Label lblPlayernum - Caption = "Player # (255 for all players):" - Height = 495 - Left = 3240 - TabIndex = 10 - Top = 1680 - Width = 1095 - End - Begin VB.Label lblMapnum - Alignment = 1 'Right Justify - Caption = "Map #:" - Height = 255 - Left = 3600 - TabIndex = 8 - Top = 1320 - Width = 615 - End - Begin VB.Label lblZ - Alignment = 1 'Right Justify - Caption = "Z:" - Height = 255 - Left = 3960 - TabIndex = 6 - Top = 960 - Width = 255 - End - Begin VB.Label lblY - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Left = 3960 - TabIndex = 5 - Top = 600 - Width = 255 - End - Begin VB.Label lblX - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Left = 3960 - TabIndex = 4 - Top = 240 - Width = 255 - End -End -Attribute VB_Name = "frmEmblemEdit" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdAdd_Click() - lstEmblems.AddItem "Emblem " & lstEmblems.ListCount + 1 - lstEmblems.ListIndex = lstEmblems.ListCount - 1 - lblNumEmblems.Caption = "# of Emblems: " & lstEmblems.ListCount - txtX.Text = 0 - txtY.Text = 0 - txtZ.Text = 0 - txtPlayernum.Text = 255 - txtMapnum.Text = 1 -End Sub - -Private Sub cmdDelete_Click() - Call WriteEmblem(True) - lstEmblems.RemoveItem lstEmblems.ListCount - 1 - lstEmblems.ListIndex = lstEmblems.ListCount - 1 - lblNumEmblems.Caption = "# of Emblems: " & lstEmblems.ListCount -End Sub - -Private Sub cmdReload_Click() - Call Reload -End Sub - -Private Sub Reload() - lstEmblems.Clear - txtX.Text = "" - txtY.Text = "" - txtZ.Text = "" - txtMapnum.Text = "" - txtPlayernum.Text = "" - lblNumEmblems.Caption = "# of Emblems: " & lstEmblems.ListCount - Call ReadSOCEmblems -End Sub - -Private Sub cmdSave_Click() - If lstEmblems.ListCount <= 0 Then - MsgBox "You have no emblems to save!" - Else - Call WriteEmblem(False) - End If -End Sub - -Private Sub Form_Load() - Call Reload -End Sub - -Private Sub ReadSOCEmblems() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - - lstEmblems.Clear - -EmblemLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo EmblemLoad - - If Left(line, 1) = vbCrLf Then GoTo EmblemLoad - - If Len(line) < 1 Then GoTo EmblemLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "EMBLEM" Then - lstEmblems.AddItem ("Emblem " & Val(word2)) - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub ReadSOCEmblemNum(num As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -EmblemLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo EmblemLoad - - If Left(line, 1) = vbCrLf Then GoTo EmblemLoad - - If Len(line) < 1 Then GoTo EmblemLoad - - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - If word = "EMBLEM" Then - If Val(word2) = num Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "X" Then - txtX.Text = Val(word2) - ElseIf word = "Y" Then - txtY.Text = Val(word2) - ElseIf word = "Z" Then - txtZ.Text = Val(word2) - ElseIf word = "PLAYERNUM" Then - txtPlayernum.Text = Val(word2) - ElseIf word = "MAPNUM" Then - txtMapnum.Text = Val(word2) - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC with Emblem " & num & vbCrLf & "Unknown line: " & line - End If - Loop - Exit Do - End If - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub lstEmblems_Click() - Dim i As Integer - - i = InStr(lstEmblems.List(lstEmblems.ListIndex), " ") + 1 - - i = Mid(lstEmblems.List(lstEmblems.ListIndex), i, Len(lstEmblems.List(lstEmblems.ListIndex)) - i + 1) - i = Val(i) - Call ReadSOCEmblemNum(i) -End Sub - -Private Sub WriteEmblem(Remove As Boolean) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim i As Integer - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - i = InStr(lstEmblems.List(lstEmblems.ListIndex), " ") + 1 - - i = Mid(lstEmblems.List(lstEmblems.ListIndex), i, Len(lstEmblems.List(lstEmblems.ListIndex)) - i + 1) - i = Val(i) - - 'If the current emblem exists in the SOC, delete it. - If word = "EMBLEM" And Val(word2) = i Then - Do While Len(TrimComplete(tsSource.ReadLine)) > 0 And Not (tsSource.AtEndOfStream) - Loop - Else - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False Then - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine UCase(lstEmblems.List(lstEmblems.ListIndex)) - txtX.Text = TrimComplete(txtX.Text) - txtY.Text = TrimComplete(txtY.Text) - txtZ.Text = TrimComplete(txtZ.Text) - txtMapnum.Text = TrimComplete(txtMapnum.Text) - txtPlayernum.Text = TrimComplete(txtPlayernum.Text) - If txtX.Text <> "" Then tsTarget.WriteLine "X = " & Val(txtX.Text) - If txtY.Text <> "" Then tsTarget.WriteLine "Y = " & Val(txtY.Text) - If txtZ.Text <> "" Then tsTarget.WriteLine "Z = " & Val(txtZ.Text) - If txtMapnum.Text <> "" Then tsTarget.WriteLine "MAPNUM = " & Val(txtMapnum.Text) - If txtPlayernum.Text <> "" Then tsTarget.WriteLine "PLAYERNUM = " & Val(txtPlayernum.Text) - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - MsgBox "Emblem deleted." - Else - MsgBox "Emblem Saved." - End If -End Sub diff --git a/tools/SOCEdit/frmEmblemEdit.frx b/tools/SOCEdit/frmEmblemEdit.frx deleted file mode 100644 index 2ae367330..000000000 Binary files a/tools/SOCEdit/frmEmblemEdit.frx and /dev/null differ diff --git a/tools/SOCEdit/frmHUDEdit.frm b/tools/SOCEdit/frmHUDEdit.frm deleted file mode 100644 index 2b267b79b..000000000 --- a/tools/SOCEdit/frmHUDEdit.frm +++ /dev/null @@ -1,315 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmHUDEdit - Caption = "HUD Edit" - ClientHeight = 2505 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 5160 - Icon = "frmHUDEdit.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 2505 - ScaleWidth = 5160 - StartUpPosition = 3 'Windows Default - Begin VB.CommandButton cmdCodeDefault - Caption = "&Load Code Default" - Height = 375 - Left = 3480 - TabIndex = 9 - Top = 1080 - Width = 1575 - End - Begin VB.CommandButton cmdDelete - Caption = "&Delete from SOC" - Height = 375 - Left = 3480 - TabIndex = 7 - Top = 2040 - Width = 1575 - End - Begin VB.CommandButton cmdSave - Caption = "&Save Changes" - Height = 375 - Left = 3480 - TabIndex = 6 - Top = 1560 - Width = 1575 - End - Begin VB.TextBox txtY - Height = 285 - Left = 4080 - MaxLength = 3 - TabIndex = 3 - Top = 720 - Width = 615 - End - Begin VB.TextBox txtX - Height = 285 - Left = 4080 - MaxLength = 3 - TabIndex = 2 - Top = 360 - Width = 615 - End - Begin VB.ListBox lstHUD - Height = 2010 - Left = 120 - TabIndex = 0 - Top = 360 - Width = 3255 - End - Begin VB.Label lblNote - Caption = "HUD items are placed on a 320x200 grid." - Height = 255 - Left = 1680 - TabIndex = 8 - Top = 120 - Width = 3015 - End - Begin VB.Label lblY - Alignment = 1 'Right Justify - Caption = "Y:" - Height = 255 - Left = 3600 - TabIndex = 5 - Top = 720 - Width = 375 - End - Begin VB.Label lblX - Alignment = 1 'Right Justify - Caption = "X:" - Height = 255 - Left = 3720 - TabIndex = 4 - Top = 360 - Width = 255 - End - Begin VB.Label lblHUDItems - Caption = "HUD Items:" - Height = 255 - Left = 120 - TabIndex = 1 - Top = 120 - Width = 975 - End -End -Attribute VB_Name = "frmHUDEdit" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdCodeDefault_Click() - LoadHUDInfo (lstHUD.ListIndex) -End Sub - -Private Sub cmdDelete_Click() - Call WriteHUDItem(True) -End Sub - -Private Sub cmdSave_Click() - Call WriteHUDItem(False) -End Sub - -Private Sub Form_Load() - Call Reload -End Sub - -Private Sub Reload() - txtX.Text = "" - txtY.Text = "" - Call LoadCode - lstHUD.ListIndex = 0 -End Sub - -Private Sub LoadCode() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim addstring As String - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("st_stuff.h", ForReading, False) - - Do While ts.ReadLine <> "/** HUD location information (don't move this comment)" - Loop - - ts.ReadLine ' */ - ts.ReadLine ' typedef struct - ts.ReadLine ' { - ts.ReadLine ' int x, y; - ts.ReadLine ' } hudinfo_t; - ts.ReadLine ' - ts.ReadLine ' typedef enum - ts.ReadLine ' { - - line = ts.ReadLine - number = 0 - - lstHUD.Clear - - Do While InStr(line, "NUMHUDITEMS") = 0 - startclip = InStr(line, "HUD_") - If InStr(line, "HUD_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - addstring = number & " - " & line - lstHUD.AddItem addstring - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub lstHUD_Click() - LoadHUDInfo (lstHUD.ListIndex) - Call ReadSOC(lstHUD.ListIndex) -End Sub - -Private Sub LoadHUDInfo(HUDNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("st_stuff.c", ForReading, False) - - Do While InStr(ts.ReadLine, "hudinfo[NUMHUDITEMS] =") = 0 - Loop - - ts.SkipLine ' { - line = ts.ReadLine ' First HUD item - - number = 0 - - Do While number <> HUDNum - line = ts.ReadLine - number = number + 1 - Loop - - startclip = InStr(line, "{") + 1 - endclip = InStr(line, ",") - - txtX.Text = TrimComplete(Mid(line, startclip, endclip - startclip)) - - startclip = endclip + 2 - endclip = InStr(startclip, line, "}") - 1 - - txtY.Text = TrimComplete(Mid(line, startclip, endclip - startclip)) - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub ReadSOC(HUDNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "HUDITEM" And Val(word2) = HUDNum Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "X" Then - txtX.Text = Val(word2) - ElseIf word = "Y" Then - txtY.Text = Val(word2) - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC!" & vbCrLf & "Unknown line: " & line - End If - Loop - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub WriteHUDItem(Remove As Boolean) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim hudremoved As Boolean - - hudremoved = False - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - 'If the current item exists in the SOC, delete it. - If word = "HUDITEM" And Val(word2) = lstHUD.ListIndex Then - hudremoved = True - Do While Len(TrimComplete(tsSource.ReadLine)) > 0 And Not tsSource.AtEndOfStream - Loop - Else - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False Then - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine "HUDITEM " & lstHUD.ListIndex - txtX.Text = TrimComplete(txtX.Text) - txtY.Text = TrimComplete(txtY.Text) - If txtX.Text <> "" Then tsTarget.WriteLine "X = " & Val(txtX.Text) - If txtY.Text <> "" Then tsTarget.WriteLine "Y = " & Val(txtY.Text) - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - If hudremoved = True Then - MsgBox "HUD Item deleted from SOC." - Else - MsgBox "Couldn't find HUD Item in SOC." - End If - Else - MsgBox "HUD Item Saved." - End If -End Sub diff --git a/tools/SOCEdit/frmHUDEdit.frx b/tools/SOCEdit/frmHUDEdit.frx deleted file mode 100644 index 2ae367330..000000000 Binary files a/tools/SOCEdit/frmHUDEdit.frx and /dev/null differ diff --git a/tools/SOCEdit/frmHelp.frm b/tools/SOCEdit/frmHelp.frm deleted file mode 100644 index acf991057..000000000 --- a/tools/SOCEdit/frmHelp.frm +++ /dev/null @@ -1,213 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmHelp - BorderStyle = 3 'Fixed Dialog - Caption = "Getting Started" - ClientHeight = 7395 - ClientLeft = 45 - ClientTop = 330 - ClientWidth = 6360 - Icon = "frmHelp.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - MinButton = 0 'False - ScaleHeight = 7395 - ScaleWidth = 6360 - ShowInTaskbar = 0 'False - StartUpPosition = 1 'CenterOwner - Begin VB.CommandButton cmdOK - Caption = "&OK, I know what I'm doing now." - Height = 495 - Left = 1920 - Style = 1 'Graphical - TabIndex = 8 - Top = 6840 - Width = 2535 - End - Begin VB.Line Line9 - X1 = 120 - X2 = 6120 - Y1 = 4800 - Y2 = 4800 - End - Begin VB.Line Line7 - X1 = 120 - X2 = 6120 - Y1 = 5400 - Y2 = 5400 - End - Begin VB.Label Label12 - Caption = $"frmHelp.frx":0442 - Height = 615 - Left = 120 - TabIndex = 12 - Top = 4800 - Width = 6015 - End - Begin VB.Line Line6 - X1 = 120 - X2 = 6120 - Y1 = 4200 - Y2 = 4200 - End - Begin VB.Label Label11 - Caption = $"frmHelp.frx":04F8 - Height = 615 - Left = 120 - TabIndex = 11 - Top = 4200 - Width = 6015 - End - Begin VB.Line Line8 - X1 = 120 - X2 = 6120 - Y1 = 6360 - Y2 = 6360 - End - Begin VB.Line Line5 - X1 = 120 - X2 = 6120 - Y1 = 3720 - Y2 = 3720 - End - Begin VB.Line Line4 - X1 = 120 - X2 = 6120 - Y1 = 2880 - Y2 = 2880 - End - Begin VB.Line Line3 - X1 = 120 - X2 = 6120 - Y1 = 2400 - Y2 = 2400 - End - Begin VB.Line Line2 - X1 = 120 - X2 = 6120 - Y1 = 1800 - Y2 = 1800 - End - Begin VB.Line Line1 - X1 = 120 - X2 = 6120 - Y1 = 1200 - Y2 = 1200 - End - Begin VB.Label Label10 - Caption = $"frmHelp.frx":05EC - Height = 495 - Left = 120 - TabIndex = 10 - Top = 3720 - Width = 6135 - End - Begin VB.Label Label9 - Caption = $"frmHelp.frx":068F - Height = 615 - Left = 120 - TabIndex = 9 - Top = 1200 - Width = 6135 - End - Begin VB.Label Label8 - Caption = $"frmHelp.frx":0772 - Height = 495 - Left = 120 - TabIndex = 7 - Top = 6360 - Width = 6135 - End - Begin VB.Label Label7 - Caption = "However, if you have these settings in the SOC you are using, don't worry - the editor will not erase them from your file." - Height = 495 - Left = 120 - TabIndex = 6 - Top = 5880 - Width = 6135 - End - Begin VB.Label Label6 - Caption = $"frmHelp.frx":0816 - Height = 495 - Left = 120 - TabIndex = 5 - Top = 5400 - Width = 6135 - End - Begin VB.Label Label5 - Caption = $"frmHelp.frx":08A9 - BeginProperty Font - Name = "MS Sans Serif" - Size = 8.25 - Charset = 0 - Weight = 700 - Underline = 0 'False - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 855 - Left = 120 - TabIndex = 4 - Top = 2880 - Width = 6135 - End - Begin VB.Label Label4 - Caption = $"frmHelp.frx":09B1 - Height = 495 - Left = 120 - TabIndex = 3 - Top = 2400 - Width = 6135 - End - Begin VB.Label Label3 - Caption = $"frmHelp.frx":0A5A - Height = 495 - Left = 120 - TabIndex = 2 - Top = 1920 - Width = 6135 - End - Begin VB.Label Label2 - Caption = "Finally! A way to easily edit SOC files! I know you're anxious to get started, but here are some things you should know first:" - BeginProperty Font - Name = "MS Sans Serif" - Size = 9.75 - Charset = 0 - Weight = 400 - Underline = 0 'False - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 495 - Left = 120 - TabIndex = 1 - Top = 600 - Width = 6135 - End - Begin VB.Label Label1 - Caption = "How To Use This Program" - BeginProperty Font - Name = "MS Sans Serif" - Size = 13.5 - Charset = 0 - Weight = 700 - Underline = -1 'True - Italic = 0 'False - Strikethrough = 0 'False - EndProperty - Height = 495 - Left = 120 - TabIndex = 0 - Top = 120 - Width = 3855 - End -End -Attribute VB_Name = "frmHelp" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdOK_Click() - frmHelp.Hide -End Sub diff --git a/tools/SOCEdit/frmHelp.frx b/tools/SOCEdit/frmHelp.frx deleted file mode 100644 index 25004fe29..000000000 Binary files a/tools/SOCEdit/frmHelp.frx and /dev/null differ diff --git a/tools/SOCEdit/frmHub.frm b/tools/SOCEdit/frmHub.frm deleted file mode 100644 index 3672c62b0..000000000 --- a/tools/SOCEdit/frmHub.frm +++ /dev/null @@ -1,429 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmHub - Caption = "SOC Editor" - ClientHeight = 6960 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 4920 - Icon = "frmHub.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 6960 - ScaleWidth = 4920 - StartUpPosition = 3 'Windows Default - Begin VB.CommandButton cmdCreateBlank - Caption = "Make a &Blank SOC" - Height = 255 - Left = 240 - TabIndex = 22 - Top = 2520 - Width = 2055 - End - Begin VB.CommandButton cmdUnlockables - Caption = "Edit &Unlockables" - Enabled = 0 'False - Height = 495 - Left = 2760 - Style = 1 'Graphical - TabIndex = 21 - Top = 6360 - Width = 1095 - End - Begin VB.CommandButton cmdAuthor - Caption = "Enter &Author Info" - Enabled = 0 'False - Height = 495 - Left = 120 - Style = 1 'Graphical - TabIndex = 19 - Top = 3960 - Width = 1215 - End - Begin VB.CommandButton cmdHelp - Caption = "Getting Starte&d / READ ME FIRST!" - Height = 495 - Left = 480 - TabIndex = 18 - Top = 2880 - Width = 1575 - End - Begin VB.CommandButton cmdEditCutscenes - Caption = "Edit C&utscenes" - Enabled = 0 'False - Height = 495 - Left = 120 - TabIndex = 17 - Top = 6360 - Width = 1215 - End - Begin VB.CommandButton cmdCharacterEdit - Caption = "Edit &Character Select Screen" - Enabled = 0 'False - Height = 495 - Left = 120 - Style = 1 'Graphical - TabIndex = 16 - Top = 5760 - Width = 1215 - End - Begin VB.PictureBox Picture1 - Height = 1965 - Left = 2760 - Picture = "frmHub.frx":0442 - ScaleHeight = 1905 - ScaleWidth = 1905 - TabIndex = 15 - Top = 3960 - Width = 1965 - End - Begin VB.CommandButton cmdSoundEdit - Caption = "Edit &Sounds" - Enabled = 0 'False - Height = 495 - Left = 120 - TabIndex = 14 - Top = 5160 - Width = 1215 - End - Begin VB.CommandButton cmdEmblemEdit - Caption = "Edit &Emblem Locations" - Enabled = 0 'False - Height = 495 - Left = 120 - Style = 1 'Graphical - TabIndex = 13 - Top = 4560 - Width = 1215 - End - Begin VB.CommandButton cmdHUDEdit - Caption = "Edit &HUD Coordinates" - Enabled = 0 'False - Height = 495 - Left = 1440 - Style = 1 'Graphical - TabIndex = 12 - Top = 3960 - Width = 1215 - End - Begin VB.CommandButton cmdMaincfg - Caption = "Edit &Global Game Settings" - Enabled = 0 'False - Height = 495 - Left = 1440 - Style = 1 'Graphical - TabIndex = 11 - Top = 4560 - Width = 1215 - End - Begin VB.DriveListBox Drive2 - Height = 315 - Left = 2640 - TabIndex = 9 - Top = 360 - Width = 2175 - End - Begin VB.DirListBox Dir2 - Height = 1665 - Left = 2520 - TabIndex = 8 - Top = 720 - Width = 2295 - End - Begin VB.FileListBox File1 - Height = 1455 - Left = 2520 - Pattern = "*.soc" - TabIndex = 7 - Top = 2400 - Width = 2295 - End - Begin VB.DriveListBox Drive1 - Height = 315 - Left = 120 - TabIndex = 6 - Top = 360 - Width = 2295 - End - Begin VB.DirListBox Dir1 - Height = 1665 - Left = 120 - TabIndex = 4 - Top = 720 - Width = 2295 - End - Begin VB.CommandButton cmdAbout - Caption = "&About" - Height = 375 - Left = 3960 - TabIndex = 3 - Top = 6000 - Width = 735 - End - Begin VB.CommandButton cmdStateEdit - Caption = "Edit St&ates" - Enabled = 0 'False - Height = 495 - Left = 1440 - TabIndex = 2 - Top = 6360 - Width = 1215 - End - Begin VB.CommandButton cmdLevelHeader - Caption = "Edit &Level Headers" - Enabled = 0 'False - Height = 495 - Left = 1440 - Style = 1 'Graphical - TabIndex = 1 - Top = 5160 - Width = 1215 - End - Begin VB.CommandButton cmdThingEdit - Caption = "Edit &Things" - Enabled = 0 'False - Height = 495 - Left = 1440 - TabIndex = 0 - Top = 5760 - Width = 1215 - End - Begin VB.Label lblAuthor - Caption = "Modification By:" - Height = 495 - Left = 120 - TabIndex = 20 - Top = 3480 - Width = 2295 - End - Begin VB.Label lblSOCFile - Caption = "SOC File to use (double click):" - Height = 255 - Left = 2640 - TabIndex = 10 - Top = 120 - Width = 2175 - End - Begin VB.Label lblSourcePath - Caption = "Path to SRB2 Source Code:" - Height = 255 - Left = 120 - TabIndex = 5 - Top = 120 - Width = 2175 - End -End -Attribute VB_Name = "frmHub" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdAbout_Click() - MsgBox App.Title & " v" & App.Major & "." & App.Minor & "." & App.Revision & vbCrLf & "By " & App.CompanyName & vbCrLf & "(SSNTails)" & vbCrLf & App.Comments & vbCrLf & App.FileDescription -End Sub - -Private Sub cmdAuthor_Click() - Dim Response As String - - Response$ = InputBox("Enter name to appear on credits (type in NOBODY to delete):", "Modification By", GetAuthor) - - If Response = "" Then Exit Sub - - Response = TrimComplete(Response) - - If UCase(Response) = "NOBODY" Then - Call WriteAuthor(True, Response) - lblAuthor.Caption = "Modification By: " - Else - Call WriteAuthor(False, Response) - lblAuthor.Caption = "Modification By: " & Response - End If -End Sub - -Private Sub cmdCharacterEdit_Click() - frmCharacterEdit.Show vbModal, Me -End Sub - -Private Sub cmdCreateBlank_Click() - Dim socname As String - - socname = InputBox("This file will be created in the directory you have selected on the main window." & vbCrLf & vbCrLf & "Enter the filename you want (do not include .SOC at the end):", "Make A Blank SOC") - Trim (socname) - - If InStr(LCase(socname), ".soc") > 0 Then - MsgBox "The thing says not to include the .SOC at the end, stupid.", vbOKOnly, "You goofed!" - Exit Sub - End If - - If Len(socname) > 0 Then - socname = socname & ".soc" - - Dim myFSOSOC As New Scripting.FileSystemObject - Dim tsSOC As TextStream - - Set tsSOC = myFSOSOC.OpenTextFile(File1.Path & "\" & socname, ForWriting, True) - tsSOC.Close - Set myFSOSOC = Nothing - - MsgBox "Blank SOC named " & socname & " created in " & File1.Path, vbOKOnly, "Success!" - End If -End Sub - -Private Sub cmdEditCutscenes_Click() - frmCutsceneEdit.Show vbModal, Me -End Sub - -Private Sub cmdEmblemEdit_Click() - frmEmblemEdit.Show vbModal, Me -End Sub - -Private Sub cmdHelp_Click() - frmHelp.Show vbModal, Me -End Sub - -Private Sub cmdHUDEdit_Click() - frmHUDEdit.Show vbModal, Me -End Sub - -Private Sub cmdLevelHeader_Click() - frmLevelHeader.Show vbModal, Me -End Sub - -Private Sub cmdMaincfg_Click() - frmMaincfg.Show vbModal, Me -End Sub - -Private Sub cmdSoundEdit_Click() - frmSoundEdit.Show vbModal, Me -End Sub - -Private Sub cmdStateEdit_Click() - frmStateEdit.Show vbModal, Me -End Sub - -Private Sub cmdThingEdit_Click() - frmThingEdit.Show vbModal, Me -End Sub - -Private Sub cmdUnlockables_Click() - frmUnlockablesEdit.Show vbModal, Me -End Sub - -Private Sub Dir1_Change() - SourcePath = Dir1.Path -End Sub - -Private Sub Dir2_Change() - File1.Path = Dir2.Path -End Sub - -Private Sub Drive1_Change() - Dir1.Path = Drive1.Drive -End Sub - -Private Sub Drive2_Change() - Dir2.Path = Drive2.Drive -End Sub - -Private Sub File1_DblClick() - SOCTemp = File1.Path & "\" & "socedit.tmp" - SOCFile = File1.Path & "\" & File1.List(File1.ListIndex) - MsgBox "You are now using the file: " & vbCrLf & SOCFile - cmdLevelHeader.Enabled = True - cmdThingEdit.Enabled = True - cmdStateEdit.Enabled = True - cmdHUDEdit.Enabled = True - cmdMaincfg.Enabled = True - cmdEmblemEdit.Enabled = True - cmdSoundEdit.Enabled = True - cmdCharacterEdit.Enabled = True - cmdEditCutscenes.Enabled = True - cmdAuthor.Enabled = True - cmdUnlockables.Enabled = True - lblAuthor.Caption = "Modification By: " & GetAuthor -End Sub - -Private Sub Form_Load() - SourcePath = App.Path - Dir1.Path = SourcePath -End Sub - -Private Function GetAuthor() As String - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "MODBY" Then - GetAuthor = word2 - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Function - -Private Sub WriteAuthor(Remove As Boolean, ModderName As String) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - 'If the entry exists in the SOC, delete it. - If word <> "MODBY" Then - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False Then - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine "ModBy " & ModderName - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - MsgBox "Name removed." - Else - MsgBox "Name Saved." - End If -End Sub - diff --git a/tools/SOCEdit/frmHub.frx b/tools/SOCEdit/frmHub.frx deleted file mode 100644 index 176491ab6..000000000 Binary files a/tools/SOCEdit/frmHub.frx and /dev/null differ diff --git a/tools/SOCEdit/frmLevelHeader.frm b/tools/SOCEdit/frmLevelHeader.frm deleted file mode 100644 index e30acd581..000000000 --- a/tools/SOCEdit/frmLevelHeader.frm +++ /dev/null @@ -1,839 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmLevelHeader - Caption = "Level Header Info" - ClientHeight = 5250 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 7650 - Icon = "frmLevelHeader.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 5250 - ScaleWidth = 7650 - StartUpPosition = 3 'Windows Default - Begin VB.TextBox txtRunSOC - Height = 285 - Left = 6240 - MaxLength = 8 - TabIndex = 49 - Top = 4680 - Width = 1215 - End - Begin VB.CheckBox chkLevelSelect - Caption = "Show on Host Game selection menu" - Height = 375 - Left = 1680 - TabIndex = 48 - Top = 4800 - Width = 1935 - End - Begin VB.CheckBox chkTimeAttack - Caption = "Include in Time Attack calculations" - Height = 255 - Left = 1680 - TabIndex = 47 - Top = 4440 - Width = 2775 - End - Begin VB.CheckBox chkNoReload - Caption = "Retain level state when player dies." - Height = 255 - Left = 1680 - TabIndex = 46 - Top = 4080 - Width = 2895 - End - Begin VB.CommandButton cmdSave - Caption = "&Save Map" - Height = 735 - Left = 120 - Style = 1 'Graphical - TabIndex = 45 - Top = 4440 - Width = 1215 - End - Begin VB.CommandButton cmdRename - Caption = "&Rename Map" - Height = 375 - Left = 120 - TabIndex = 44 - Top = 3960 - Width = 1215 - End - Begin VB.CommandButton cmdDelete - Caption = "&Delete Map" - Height = 375 - Left = 120 - TabIndex = 43 - Top = 3480 - Width = 1215 - End - Begin VB.CommandButton cmdAddMap - Caption = "&Add Map" - Height = 375 - Left = 120 - TabIndex = 42 - Top = 3000 - Width = 1215 - End - Begin VB.CheckBox chkNossmusic - Caption = "Disable Super Sonic music changes" - Height = 255 - Left = 4560 - TabIndex = 29 - Top = 1200 - Width = 2895 - End - Begin VB.CheckBox chkHidden - Caption = "Don't show on level selection menu" - Height = 255 - Left = 4560 - TabIndex = 28 - Top = 480 - Width = 2895 - End - Begin VB.TextBox txtCountdown - Height = 285 - Left = 6360 - MaxLength = 3 - TabIndex = 26 - Top = 840 - Width = 735 - End - Begin VB.TextBox txtCutscenenum - Height = 285 - Left = 4440 - MaxLength = 3 - TabIndex = 25 - Top = 3720 - Width = 495 - End - Begin VB.TextBox txtPrecutscenenum - Height = 285 - Left = 2640 - MaxLength = 3 - TabIndex = 22 - Top = 3720 - Width = 495 - End - Begin VB.CheckBox chkScriptislump - Caption = "Script is a lump in WAD, not a file" - Height = 255 - Left = 1680 - TabIndex = 21 - Top = 3360 - Width = 2775 - End - Begin VB.TextBox txtScriptname - Height = 285 - Left = 2640 - MaxLength = 191 - TabIndex = 19 - Top = 3000 - Width = 1455 - End - Begin VB.TextBox txtSkynum - Height = 285 - Left = 2640 - MaxLength = 4 - TabIndex = 17 - Top = 2640 - Width = 495 - End - Begin VB.ComboBox cmbWeather - Height = 315 - ItemData = "frmLevelHeader.frx":0442 - Left = 2640 - List = "frmLevelHeader.frx":0458 - TabIndex = 15 - Top = 2280 - Width = 2295 - End - Begin VB.TextBox txtForcecharacter - Height = 285 - Left = 2640 - MaxLength = 2 - TabIndex = 13 - Top = 1920 - Width = 495 - End - Begin VB.ComboBox cmbMusicslot - Height = 315 - Left = 2640 - TabIndex = 11 - Top = 1560 - Width = 1815 - End - Begin VB.TextBox txtNextlevel - Height = 285 - Left = 2640 - MaxLength = 4 - TabIndex = 9 - Top = 1200 - Width = 615 - End - Begin VB.Frame frmTypeOfLevel - Caption = "Type of Level" - Height = 2775 - Left = 5040 - TabIndex = 8 - Top = 1680 - Width = 2535 - Begin VB.CheckBox chkTypeoflevel - Caption = "Christmas" - Height = 255 - Index = 11 - Left = 1440 - TabIndex = 41 - Tag = "1024" - Top = 960 - Width = 975 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "2D" - Height = 255 - Index = 10 - Left = 1440 - TabIndex = 40 - Tag = "512" - Top = 720 - Width = 735 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "Mario" - Height = 255 - Index = 9 - Left = 120 - TabIndex = 39 - Tag = "256" - Top = 2400 - Width = 1455 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "Sonic Adventure" - Height = 255 - Index = 8 - Left = 120 - TabIndex = 38 - Tag = "128" - Top = 2160 - Width = 1575 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "NiGHTS" - Height = 255 - Index = 7 - Left = 120 - TabIndex = 37 - Tag = "64" - Top = 1920 - Width = 1335 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "Chaos" - Height = 255 - Index = 6 - Left = 120 - TabIndex = 36 - Tag = "32" - Top = 1680 - Width = 1455 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "Capture the Flag" - Height = 255 - Index = 5 - Left = 120 - TabIndex = 35 - Tag = "16" - Top = 1440 - Width = 1695 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "Tag" - Height = 255 - Index = 4 - Left = 120 - TabIndex = 34 - Tag = "8" - Top = 1200 - Width = 1215 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "Match" - Height = 255 - Index = 3 - Left = 120 - TabIndex = 33 - Tag = "4" - Top = 960 - Width = 855 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "Race" - Height = 255 - Index = 2 - Left = 120 - TabIndex = 32 - Tag = "2" - Top = 720 - Width = 855 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "Cooperative" - Height = 255 - Index = 1 - Left = 120 - TabIndex = 31 - Tag = "1" - Top = 480 - Width = 1215 - End - Begin VB.CheckBox chkTypeoflevel - Caption = "Single Player" - Height = 255 - Index = 0 - Left = 120 - TabIndex = 30 - Tag = "4096" - Top = 240 - Width = 1215 - End - End - Begin VB.CheckBox chkNozone - Caption = "Don't show ""ZONE"" after Level Name" - Height = 255 - Left = 4560 - TabIndex = 7 - Top = 120 - Width = 3015 - End - Begin VB.TextBox txtAct - Height = 285 - Left = 2640 - MaxLength = 2 - TabIndex = 5 - Top = 840 - Width = 495 - End - Begin VB.TextBox txtInterscreen - Height = 285 - Left = 2640 - MaxLength = 8 - TabIndex = 3 - Top = 480 - Width = 1335 - End - Begin VB.ListBox lstMaps - Height = 2790 - Left = 120 - Sorted = -1 'True - TabIndex = 2 - Top = 120 - Width = 1215 - End - Begin VB.TextBox txtLevelName - Height = 285 - Left = 2640 - MaxLength = 32 - TabIndex = 0 - Top = 120 - Width = 1815 - End - Begin VB.Label lblRunSOC - Alignment = 1 'Right Justify - Caption = "Run SOC at level load (lump name):" - Height = 495 - Left = 4440 - TabIndex = 50 - Top = 4560 - Width = 1695 - End - Begin VB.Label lblCountdown - Alignment = 1 'Right Justify - Caption = "Level Timer (seconds):" - Height = 255 - Left = 4560 - TabIndex = 27 - Top = 840 - Width = 1695 - End - Begin VB.Label lblCutscenenum - Alignment = 1 'Right Justify - Caption = "Cutscene to play after level:" - Height = 495 - Left = 3240 - TabIndex = 24 - Top = 3600 - Width = 1095 - End - Begin VB.Label lblPrecutscenenum - Alignment = 1 'Right Justify - Caption = "Cutscene to play before level:" - Height = 375 - Left = 1320 - TabIndex = 23 - Top = 3600 - Width = 1215 - End - Begin VB.Label lblScriptName - Alignment = 1 'Right Justify - Caption = "Script Name:" - Height = 255 - Left = 1440 - TabIndex = 20 - Top = 3000 - Width = 1095 - End - Begin VB.Label lblSkynum - Alignment = 1 'Right Justify - Caption = "Sky #:" - Height = 255 - Left = 1800 - TabIndex = 18 - Top = 2640 - Width = 735 - End - Begin VB.Label Label1 - Alignment = 1 'Right Justify - Caption = "Weather:" - Height = 255 - Left = 1680 - TabIndex = 16 - Top = 2280 - Width = 855 - End - Begin VB.Label lblForcecharacter - Caption = "Force Character #:" - Height = 375 - Left = 1440 - TabIndex = 14 - Top = 1800 - Width = 1095 - End - Begin VB.Label lblMusicslot - Alignment = 1 'Right Justify - Caption = "Music:" - Height = 255 - Left = 1800 - TabIndex = 12 - Top = 1560 - Width = 735 - End - Begin VB.Label lblNextlevel - Alignment = 1 'Right Justify - Caption = "Next Level:" - Height = 255 - Left = 1440 - TabIndex = 10 - Top = 1200 - Width = 1095 - End - Begin VB.Label lblAct - Alignment = 1 'Right Justify - Caption = "Act:" - Height = 255 - Left = 2040 - TabIndex = 6 - Top = 840 - Width = 495 - End - Begin VB.Label lblInterscreen - Alignment = 1 'Right Justify - Caption = "Intermission BG:" - Height = 255 - Left = 1320 - TabIndex = 4 - Top = 480 - Width = 1215 - End - Begin VB.Label lblLevelName - Alignment = 1 'Right Justify - Caption = "Level Name:" - Height = 255 - Left = 1560 - TabIndex = 1 - Top = 120 - Width = 975 - End -End -Attribute VB_Name = "frmLevelHeader" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdAddMap_Click() - Dim Response As String - Dim NewNum As Integer - - Response$ = InputBox("Enter the new level (NUMBER ONLY):") - - If Response = "" Then - Exit Sub - End If - - NewNum = Val(TrimComplete(Response)) - - lstMaps.AddItem "Level " & NewNum - lstMaps.ListIndex = lstMaps.ListCount - 1 -End Sub - -Private Sub cmdDelete_Click() - Dim i As Integer - - If MsgBox("Delete this level header?", vbYesNo) = vbNo Then - Exit Sub - End If - - i = InStr(lstMaps.List(lstMaps.ListIndex), " ") + 1 - - i = Mid(lstMaps.List(lstMaps.ListIndex), i, Len(lstMaps.List(lstMaps.ListIndex)) - i + 1) - i = Val(i) - Call WriteLevel(True, i) - lstMaps.RemoveItem lstMaps.ListIndex - - If lstMaps.ListCount > 0 Then - lstMaps.ListIndex = 0 - End If -End Sub - -Private Sub cmdRename_Click() - Dim Response As String - Dim NewNum As Integer - Dim i As Integer - - Response$ = InputBox("Rename level to (NUMBER ONLY):") - - If Response = "" Then - Exit Sub - End If - - NewNum = Val(TrimComplete(Response)) - - i = InStr(lstMaps.List(lstMaps.ListIndex), " ") + 1 - - i = Mid(lstMaps.List(lstMaps.ListIndex), i, Len(lstMaps.List(lstMaps.ListIndex)) - i + 1) - i = Val(i) - Call WriteLevel(True, i) - lstMaps.List(lstMaps.ListIndex) = "Level " & NewNum - Call cmdSave_Click -End Sub - -Private Sub cmdSave_Click() - Dim i As Integer - - i = InStr(lstMaps.List(lstMaps.ListIndex), " ") + 1 - - i = Val(Mid(lstMaps.List(lstMaps.ListIndex), i, Len(lstMaps.List(lstMaps.ListIndex)) - i + 1)) - Call WriteLevel(False, i) -End Sub - -Private Sub Form_Load() - Call LoadMusic - Call LoadSOCMaps - If lstMaps.ListCount > 0 Then lstMaps.ListIndex = 0 -End Sub - -Private Sub LoadSOCMaps() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - - lstMaps.Clear - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "LEVEL" Then - lstMaps.AddItem ("Level " & Val(word2)) - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub LoadMusic() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim addstring As String - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("sounds.h", ForReading, False) - - Do While InStr(ts.ReadLine, "Music list (don't edit this comment!)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - cmbMusicslot.Clear - - Do While InStr(line, "NUMMUSIC") = 0 - startclip = InStr(line, "mus_") - If InStr(line, "mus_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - addstring = number & " - " & line - cmbMusicslot.AddItem addstring - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub ClearForm() - Dim j As Integer - - txtLevelName.Text = "" - txtInterscreen.Text = "" - txtAct.Text = "" - txtNextlevel.Text = "" - cmbMusicslot.Text = "" - txtForcecharacter.Text = "" - cmbWeather.Text = "" - txtSkynum.Text = "" - txtScriptname.Text = "" - chkScriptislump.Value = 0 - txtPrecutscenenum.Text = "" - txtCutscenenum.Text = "" - txtRunSOC.Text = "" - chkNozone.Value = 0 - chkHidden.Value = 0 - txtCountdown.Text = "" - chkNossmusic.Value = 0 - chkNoReload.Value = 0 - chkTimeAttack.Value = 0 - chkLevelSelect = 0 - - For j = 0 To 11 - chkTypeoflevel(j).Value = 0 - Next j -End Sub - -Private Sub lstMaps_Click() - Dim startclip As Integer - Call ClearForm - startclip = InStr(lstMaps.List(lstMaps.ListIndex), " ") - Call LoadSOCMapInfo(Val(Mid(lstMaps.List(lstMaps.ListIndex), startclip + 1, Len(lstMaps.List(lstMaps.ListIndex))))) -End Sub - -Private Sub LoadSOCMapInfo(num As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - If word = "LEVEL" Then - If Val(word2) = num Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "LEVELNAME" Then - txtLevelName.Text = word2 - ElseIf word = "INTERSCREEN" Then - txtInterscreen.Text = word2 - ElseIf word = "ACT" Then - txtAct.Text = Val(word2) - ElseIf word = "NOZONE" Then - chkNozone.Value = Val(word2) - ElseIf word = "TYPEOFLEVEL" Then - ProcessMapFlags (Val(word2)) - ElseIf word = "NEXTLEVEL" Then - txtNextlevel.Text = Val(word2) - ElseIf word = "MUSICSLOT" Then - cmbMusicslot.ListIndex = Val(word2) - ElseIf word = "FORCECHARACTER" Then - txtForcecharacter.Text = Val(word2) - ElseIf word = "WEATHER" Then - cmbWeather.ListIndex = Val(word2) - ElseIf word = "SKYNUM" Then - txtSkynum.Text = Val(word2) - ElseIf word = "SCRIPTNAME" Then - txtScriptname.Text = word2 - ElseIf word = "SCRIPTISLUMP" Then - chkScriptislump.Value = Val(word2) - ElseIf word = "PRECUTSCENENUM" Then - txtPrecutscenenum.Text = Val(word2) - ElseIf word = "CUTSCENENUM" Then - txtCutscenenum.Text = Val(word2) - ElseIf word = "COUNTDOWN" Then - txtCountdown.Text = Val(word2) - ElseIf word = "HIDDEN" Then - chkHidden.Value = Val(word2) - ElseIf word = "NOSSMUSIC" Then - chkNossmusic.Value = Val(word2) - ElseIf word = "NORELOAD" Then - chkNoReload.Value = Val(word2) - ElseIf word = "TIMEATTACK" Then - chkTimeAttack.Value = Val(word2) - ElseIf word = "LEVELSELECT" Then - chkLevelSelect.Value = Val(word2) - ElseIf word = "RUNSOC" Then - txtRunSOC.Text = word2 - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC!" & vbCrLf & "Unknown line: " & line - End If - Loop - Exit Do - End If - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub ProcessMapFlags(flags As Long) - Dim j As Integer - - For j = 0 To 11 - If flags And chkTypeoflevel(j).Tag Then - chkTypeoflevel(j).Value = 1 - Else - chkTypeoflevel(j).Value = 0 - End If - Next j -End Sub - -Private Sub WriteLevel(Remove As Boolean, Mapnum As Integer) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim flags As Long - Dim i As Integer - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - i = InStr(lstMaps.List(lstMaps.ListIndex), " ") + 1 - - i = Mid(lstMaps.List(lstMaps.ListIndex), i, Len(lstMaps.List(lstMaps.ListIndex)) - i + 1) - i = Val(i) - 'If the current level exists in the SOC, delete it. - If word = "LEVEL" And Val(word2) = i Then - Do While Len(TrimComplete(tsSource.ReadLine)) > 0 And Not (tsSource.AtEndOfStream) - Loop - Else - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False Then - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine UCase(lstMaps.List(lstMaps.ListIndex)) - txtLevelName.Text = TrimComplete(txtLevelName.Text) - txtInterscreen.Text = TrimComplete(txtInterscreen.Text) - txtAct.Text = TrimComplete(txtAct.Text) - txtNextlevel.Text = TrimComplete(txtNextlevel.Text) - cmbMusicslot.Text = TrimComplete(cmbMusicslot.Text) - txtForcecharacter.Text = TrimComplete(txtForcecharacter.Text) - cmbWeather.Text = TrimComplete(cmbWeather.Text) - txtSkynum.Text = TrimComplete(txtSkynum.Text) - txtScriptname.Text = TrimComplete(txtScriptname.Text) - txtPrecutscenenum.Text = TrimComplete(txtPrecutscenenum.Text) - txtCutscenenum.Text = TrimComplete(txtCutscenenum.Text) - txtCountdown.Text = TrimComplete(txtCountdown.Text) - txtRunSOC.Text = TrimComplete(txtRunSOC.Text) - - If txtLevelName.Text <> "" Then tsTarget.WriteLine "LEVELNAME = " & txtLevelName.Text - If txtInterscreen.Text <> "" Then tsTarget.WriteLine "INTERSCREEN = " & txtInterscreen.Text - If txtAct.Text <> "" Then tsTarget.WriteLine "ACT = " & Val(txtAct.Text) - If txtNextlevel.Text <> "" Then tsTarget.WriteLine "NEXTLEVEL = " & Val(txtNextlevel.Text) - If cmbMusicslot.Text <> "" Then tsTarget.WriteLine "MUSICSLOT = " & cmbMusicslot.ListIndex - If txtForcecharacter.Text <> "" Then tsTarget.WriteLine "FORCECHARACTER = " & Val(txtForcecharacter.Text) - If cmbWeather.Text <> "" Then tsTarget.WriteLine "WEATHER = " & cmbWeather.ListIndex - If txtSkynum.Text <> "" Then tsTarget.WriteLine "SKYNUM = " & Val(txtSkynum.Text) - If txtScriptname.Text <> "" Then tsTarget.WriteLine "SCRIPTNAME = " & txtScriptname.Text - If txtPrecutscenenum.Text <> "" Then tsTarget.WriteLine "PRECUTSCENENUM = " & Val(txtPrecutscenenum.Text) - If txtCutscenenum.Text <> "" Then tsTarget.WriteLine "CUTSCENENUM = " & Val(txtCutscenenum.Text) - If txtCountdown.Text <> "" Then tsTarget.WriteLine "COUNTDOWN = " & Val(txtCountdown.Text) - If chkScriptislump.Value = 1 Then tsTarget.WriteLine "SCRIPTISLUMP = 1" - If chkNozone.Value = 1 Then tsTarget.WriteLine "NOZONE = 1" - If chkHidden.Value = 1 Then tsTarget.WriteLine "HIDDEN = 1" - If chkNossmusic.Value = 1 Then tsTarget.WriteLine "NOSSMUSIC = 1" - If chkNoReload.Value = 1 Then tsTarget.WriteLine "NORELOAD = 1" - If chkTimeAttack.Value = 1 Then tsTarget.WriteLine "TIMEATTACK = 1" - If chkLevelSelect.Value = 1 Then tsTarget.WriteLine "LEVELSELECT = 1" - If txtRunSOC.Text <> "" Then tsTarget.WriteLine "RUNSOC = " & txtRunSOC.Text - - flags = 0 - For i = 0 To 11 - If chkTypeoflevel(i).Value = 1 Then - flags = flags + Val(chkTypeoflevel(i).Tag) - End If - Next - - If flags > 0 Then tsTarget.WriteLine "TYPEOFLEVEL = " & flags - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - MsgBox "Level Deleted." - Else - MsgBox "Level Saved." - End If -End Sub - diff --git a/tools/SOCEdit/frmLevelHeader.frx b/tools/SOCEdit/frmLevelHeader.frx deleted file mode 100644 index fe81f4413..000000000 Binary files a/tools/SOCEdit/frmLevelHeader.frx and /dev/null differ diff --git a/tools/SOCEdit/frmMaincfg.frm b/tools/SOCEdit/frmMaincfg.frm deleted file mode 100644 index 3efca74a8..000000000 --- a/tools/SOCEdit/frmMaincfg.frm +++ /dev/null @@ -1,644 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmMaincfg - Caption = "Global Game Settings" - ClientHeight = 5295 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 9360 - Icon = "frmMaincfg.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 5295 - ScaleWidth = 9360 - StartUpPosition = 3 'Windows Default - Begin VB.Frame frmReset - Caption = "Reset Data (Be sure this is at the TOP of your SOC)" - Height = 975 - Left = 4800 - TabIndex = 43 - Top = 4200 - Width = 4455 - Begin VB.CheckBox chkReset - Caption = "Thing Properties" - Height = 255 - Index = 2 - Left = 1680 - TabIndex = 46 - Tag = "4" - Top = 240 - Width = 1575 - End - Begin VB.CheckBox chkReset - Caption = "States" - Height = 255 - Index = 1 - Left = 240 - TabIndex = 45 - Tag = "2" - Top = 600 - Width = 1335 - End - Begin VB.CheckBox chkReset - Caption = "Sprite Names" - Height = 255 - Index = 0 - Left = 240 - TabIndex = 44 - Tag = "1" - Top = 240 - Width = 1575 - End - End - Begin VB.CheckBox chkDisableSpeedAdjust - Caption = "Disable speed adjustment of player animations depending on how fast they are moving." - Height = 375 - Left = 1080 - TabIndex = 42 - Top = 4200 - Width = 3615 - End - Begin VB.TextBox txtTitleScrollSpeed - Height = 285 - Left = 4080 - TabIndex = 41 - Top = 1920 - Width = 495 - End - Begin VB.CheckBox chkLoopTitle - Caption = "Loop the title screen music?" - Height = 195 - Left = 1080 - TabIndex = 39 - Top = 3840 - Width = 2415 - End - Begin VB.TextBox txtCreditsCutscene - Height = 285 - Left = 4080 - TabIndex = 37 - Top = 1560 - Width = 495 - End - Begin VB.CommandButton cmdSave - Caption = "&Save" - Height = 495 - Left = 120 - TabIndex = 36 - Top = 3120 - Width = 735 - End - Begin VB.CommandButton cmdReload - Caption = "&Reload" - Height = 495 - Left = 120 - TabIndex = 35 - Top = 2520 - Width = 735 - End - Begin VB.TextBox txtNumemblems - Height = 285 - Left = 4080 - MaxLength = 2 - TabIndex = 33 - Top = 3360 - Width = 495 - End - Begin VB.TextBox txtGamedata - Height = 285 - Left = 3240 - MaxLength = 64 - TabIndex = 31 - Top = 2880 - Width = 1335 - End - Begin VB.TextBox txtExeccfg - Height = 285 - Left = 3240 - TabIndex = 9 - Top = 2400 - Width = 1335 - End - Begin VB.Frame frmTimers - Caption = "Timers (35 = 1 second)" - Height = 3975 - Left = 4800 - TabIndex = 8 - Top = 120 - Width = 4455 - Begin VB.TextBox txtGameovertics - Height = 285 - Left = 3000 - TabIndex = 29 - Top = 3480 - Width = 1335 - End - Begin VB.TextBox txtHelpertics - Height = 285 - Left = 3000 - TabIndex = 27 - Top = 3120 - Width = 1335 - End - Begin VB.TextBox txtParalooptics - Height = 285 - Left = 3000 - TabIndex = 25 - Top = 2760 - Width = 1335 - End - Begin VB.TextBox txtExtralifetics - Height = 285 - Left = 3000 - TabIndex = 23 - Top = 2400 - Width = 1335 - End - Begin VB.TextBox txtSpacetimetics - Height = 285 - Left = 3000 - TabIndex = 21 - Top = 2040 - Width = 1335 - End - Begin VB.TextBox txtUnderwatertics - Height = 285 - Left = 3000 - TabIndex = 19 - Top = 1680 - Width = 1335 - End - Begin VB.TextBox txtTailsflytics - Height = 285 - Left = 3000 - TabIndex = 17 - Top = 1320 - Width = 1335 - End - Begin VB.TextBox txtFlashingtics - Height = 285 - Left = 3000 - TabIndex = 15 - Top = 960 - Width = 1335 - End - Begin VB.TextBox txtSneakertics - Height = 285 - Left = 3000 - TabIndex = 13 - Top = 600 - Width = 1335 - End - Begin VB.TextBox txtInvulntics - Height = 285 - Left = 3000 - TabIndex = 11 - Top = 240 - Width = 1335 - End - Begin VB.Label lblGameovertics - Alignment = 1 'Right Justify - Caption = "Game Over Screen Time:" - Height = 255 - Left = 960 - TabIndex = 30 - Top = 3480 - Width = 1935 - End - Begin VB.Label lblHelpertics - Alignment = 1 'Right Justify - Caption = "NiGHTS Nightopian Helper Time:" - Height = 255 - Left = 240 - TabIndex = 28 - Top = 3120 - Width = 2655 - End - Begin VB.Label lblParalooptics - Alignment = 1 'Right Justify - Caption = "NiGHTS Paraloop Powerup Time:" - Height = 255 - Left = 360 - TabIndex = 26 - Top = 2760 - Width = 2535 - End - Begin VB.Label lblExtralifetics - Alignment = 1 'Right Justify - Caption = "Extra Life Music Duration:" - Height = 255 - Left = 960 - TabIndex = 24 - Top = 2400 - Width = 1935 - End - Begin VB.Label lblSpacetimetics - Alignment = 1 'Right Justify - Caption = "Space Breath Timeout:" - Height = 255 - Left = 1200 - TabIndex = 22 - Top = 2040 - Width = 1695 - End - Begin VB.Label lblUnderwatertics - Alignment = 1 'Right Justify - Caption = "Underwater Breath Timeout:" - Height = 255 - Left = 840 - TabIndex = 20 - Top = 1680 - Width = 2055 - End - Begin VB.Label lblTailsflytics - Alignment = 1 'Right Justify - Caption = "Tails Flying Time:" - Height = 255 - Left = 1440 - TabIndex = 18 - Top = 1320 - Width = 1455 - End - Begin VB.Label lblFlashingtics - Alignment = 1 'Right Justify - Caption = "Flashing Time After Being Hit:" - Height = 255 - Left = 360 - TabIndex = 16 - Top = 960 - Width = 2535 - End - Begin VB.Label lblSneakertics - Alignment = 1 'Right Justify - Caption = "Super Sneakers Time:" - Height = 255 - Left = 240 - TabIndex = 14 - Top = 600 - Width = 2655 - End - Begin VB.Label lblInvulntics - Alignment = 1 'Right Justify - Caption = "Invincibility Time:" - Height = 255 - Left = 360 - TabIndex = 12 - Top = 240 - Width = 2535 - End - End - Begin VB.TextBox txtIntrotoplay - Height = 285 - Left = 4080 - TabIndex = 6 - Top = 1200 - Width = 495 - End - Begin VB.TextBox txtRacestage_start - Height = 285 - Left = 4080 - MaxLength = 4 - TabIndex = 4 - Top = 840 - Width = 495 - End - Begin VB.TextBox txtSpstage_start - Height = 285 - Left = 4080 - MaxLength = 4 - TabIndex = 2 - Top = 480 - Width = 495 - End - Begin VB.TextBox txtSstage_start - Height = 285 - Left = 4080 - MaxLength = 4 - TabIndex = 0 - Top = 120 - Width = 495 - End - Begin VB.Label lblTitleScrollSpeed - Alignment = 1 'Right Justify - Caption = "Scroll speed of title background:" - Height = 255 - Left = 1560 - TabIndex = 40 - Top = 1920 - Width = 2415 - End - Begin VB.Label lblCreditsCutscene - Alignment = 1 'Right Justify - Caption = "Cutscene # to replace credits with:" - Height = 255 - Left = 1080 - TabIndex = 38 - Top = 1560 - Width = 2895 - End - Begin VB.Label lblNumemblems - Alignment = 1 'Right Justify - Caption = "# of LEVEL Emblems (Gamedata field must also be filled out):" - Height = 375 - Left = 1440 - TabIndex = 34 - Top = 3240 - Width = 2535 - End - Begin VB.Label lblGamedata - Alignment = 1 'Right Justify - Caption = "Gamedata file (to save mod emblems and time data):" - Height = 375 - Left = 960 - TabIndex = 32 - Top = 2760 - Width = 2175 - End - Begin VB.Label lblExeccfg - Alignment = 1 'Right Justify - Caption = "CFG file to instantly execute upon loading this SOC:" - Height = 495 - Left = 960 - TabIndex = 10 - Top = 2280 - Width = 2175 - End - Begin VB.Label lblIntrotoplay - Alignment = 1 'Right Justify - Caption = "Cutscene # to use for introduction:" - Height = 255 - Left = 1440 - TabIndex = 7 - Top = 1200 - Width = 2535 - End - Begin VB.Label lblRacestage_start - Alignment = 1 'Right Justify - Caption = "Racing mode starts/loops back to this map #:" - Height = 255 - Left = 720 - TabIndex = 5 - Top = 840 - Width = 3255 - End - Begin VB.Label lblSpstage_start - Alignment = 1 'Right Justify - Caption = "Single Player Game Starts on this map #:" - Height = 255 - Left = 1080 - TabIndex = 3 - Top = 480 - Width = 2895 - End - Begin VB.Label lblSstage_start - Alignment = 1 'Right Justify - Caption = "First Special Stage Map #:" - Height = 255 - Left = 2040 - TabIndex = 1 - Top = 120 - Width = 1935 - End -End -Attribute VB_Name = "frmMaincfg" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Private Sub cmdReload_Click() - Call Reload -End Sub - -Private Sub cmdSave_Click() - Call WriteSettings -End Sub - -Private Sub Form_Load() - Call Reload -End Sub - -Private Sub ClearForm() - Dim i As Integer - - txtSstage_start.Text = "" - txtSpstage_start.Text = "" - txtRacestage_start.Text = "" - txtIntrotoplay.Text = "" - txtExeccfg.Text = "" - txtGamedata.Text = "" - txtNumemblems.Text = "" - txtInvulntics.Text = "" - txtSneakertics.Text = "" - txtFlashingtics.Text = "" - txtTailsflytics.Text = "" - txtUnderwatertics.Text = "" - txtSpacetimetics.Text = "" - txtExtralifetics.Text = "" - txtParalooptics.Text = "" - txtHelpertics.Text = "" - txtGameovertics.Text = "" - txtCreditsCutscene.Text = "" - txtTitleScrollSpeed.Text = "" - chkLoopTitle.Value = 0 - chkDisableSpeedAdjust.Value = 0 - - For i = 0 To 2 - chkReset(i).Value = 0 - Next i -End Sub - -Private Sub Reload() - Call ClearForm - Call ReadSOCMaincfg -End Sub - -Private Sub ReadSOCMaincfg() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "MAINCFG" Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "SSTAGE_START" Then - txtSstage_start.Text = Val(word2) - ElseIf word = "SPSTAGE_START" Then - txtSpstage_start.Text = Val(word2) - ElseIf word = "RACESTAGE_START" Then - txtRacestage_start.Text = Val(word2) - ElseIf word = "INVULNTICS" Then - txtInvulntics.Text = Val(word2) - ElseIf word = "SNEAKERTICS" Then - txtSneakertics.Text = Val(word2) - ElseIf word = "FLASHINGTICS" Then - txtFlashingtics.Text = Val(word2) - ElseIf word = "TAILSFLYTICS" Then - txtTailsflytics.Text = Val(word2) - ElseIf word = "UNDERWATERTICS" Then - txtUnderwatertics.Text = Val(word2) - ElseIf word = "SPACETIMETICS" Then - txtSpacetimetics.Text = Val(word2) - ElseIf word = "EXTRALIFETICS" Then - txtExtralifetics.Text = Val(word2) - ElseIf word = "PARALOOPTICS" Then - txtParalooptics.Text = Val(word2) - ElseIf word = "HELPERTICS" Then - txtHelpertics.Text = Val(word2) - ElseIf word = "GAMEOVERTICS" Then - txtGameovertics.Text = Val(word2) - ElseIf word = "INTROTOPLAY" Then - txtIntrotoplay.Text = Val(word2) - ElseIf word = "CREDITSCUTSCENE" Then - txtCreditsCutscene.Text = Val(word2) - ElseIf word = "TITLESCROLLSPEED" Then - txtTitleScrollSpeed.Text = Val(word2) - ElseIf word = "LOOPTITLE" Then - chkLoopTitle.Value = Val(word2) - ElseIf word = "DISABLESPEEDADJUST" Then - chkDisableSpeedAdjust.Value = Val(word2) - ElseIf word = "GAMEDATA" Then - txtGamedata.Text = word2 - ElseIf word = "NUMEMBLEMS" Then - txtNumemblems.Text = Val(word2) - ElseIf word = "RESETDATA" Then - Dim resetflags As Integer - Dim z As Integer - - resetflags = Val(word2) - - For z = 0 To 2 - If resetflags And chkReset(z).Tag Then - chkReset(z).Value = 1 - Else - chkReset(z).Value = 0 - End If - Next z - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC!" & vbCrLf & "Unknown line: " & line - End If - Loop - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub WriteSettings() - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim flags As Long - Dim i As Integer - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - 'If the category exists in the SOC, delete it. - If word = "MAINCFG" Then - Do While Len(TrimComplete(tsSource.ReadLine)) > 0 And Not (tsSource.AtEndOfStream) - Loop - Else - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine "MAINCFG CATEGORY" - txtSstage_start.Text = TrimComplete(txtSstage_start.Text) - txtSpstage_start.Text = TrimComplete(txtSpstage_start.Text) - txtRacestage_start.Text = TrimComplete(txtRacestage_start.Text) - txtIntrotoplay.Text = TrimComplete(txtIntrotoplay.Text) - txtCreditsCutscene.Text = TrimComplete(txtCreditsCutscene.Text) - txtExeccfg.Text = TrimComplete(txtExeccfg.Text) - txtGamedata.Text = TrimComplete(txtGamedata.Text) - txtNumemblems.Text = TrimComplete(txtNumemblems.Text) - txtInvulntics.Text = TrimComplete(txtInvulntics.Text) - txtSneakertics.Text = TrimComplete(txtSneakertics.Text) - txtFlashingtics.Text = TrimComplete(txtFlashingtics.Text) - txtTailsflytics.Text = TrimComplete(txtTailsflytics.Text) - txtUnderwatertics.Text = TrimComplete(txtUnderwatertics.Text) - txtSpacetimetics.Text = TrimComplete(txtSpacetimetics.Text) - txtExtralifetics.Text = TrimComplete(txtExtralifetics.Text) - txtParalooptics.Text = TrimComplete(txtParalooptics.Text) - txtHelpertics.Text = TrimComplete(txtHelpertics.Text) - txtGameovertics.Text = TrimComplete(txtGameovertics.Text) - txtTitleScrollSpeed.Text = TrimComplete(txtTitleScrollSpeed.Text) - - If txtSstage_start.Text <> "" Then tsTarget.WriteLine "SSTAGE_START = " & Val(txtSstage_start.Text) - If txtSpstage_start.Text <> "" Then tsTarget.WriteLine "SPSTAGE_START = " & Val(txtSpstage_start.Text) - If txtRacestage_start.Text <> "" Then tsTarget.WriteLine "RACESTAGE_START = " & Val(txtRacestage_start.Text) - If txtIntrotoplay.Text <> "" Then tsTarget.WriteLine "INTROTOPLAY = " & Val(txtIntrotoplay.Text) - If txtCreditsCutscene.Text <> "" Then tsTarget.WriteLine "CREDITSCUTSCENE = " & Val(txtCreditsCutscene.Text) - If txtExeccfg.Text <> "" Then tsTarget.WriteLine "EXECCFG = " & txtExeccfg.Text - If txtGamedata.Text <> "" Then tsTarget.WriteLine "GAMEDATA = " & txtGamedata.Text - If txtNumemblems.Text <> "" Then - tsTarget.WriteLine "NUMEMBLEMS = " & Val(txtNumemblems.Text) - EditedNumemblems = True - End If - If txtInvulntics.Text <> "" Then tsTarget.WriteLine "INVULNTICS = " & Val(txtInvulntics.Text) - If txtSneakertics.Text <> "" Then tsTarget.WriteLine "SNEAKERTICS = " & Val(txtSneakertics.Text) - If txtFlashingtics.Text <> "" Then tsTarget.WriteLine "FLASHINGTICS = " & Val(txtFlashingtics.Text) - If txtTailsflytics.Text <> "" Then tsTarget.WriteLine "TAILSFLYTICS = " & Val(txtTailsflytics.Text) - If txtUnderwatertics.Text <> "" Then tsTarget.WriteLine "UNDERWATERTICS = " & Val(txtUnderwatertics.Text) - If txtSpacetimetics.Text <> "" Then tsTarget.WriteLine "SPACETIMETICS = " & Val(txtSpacetimetics.Text) - If txtExtralifetics.Text <> "" Then tsTarget.WriteLine "EXTRALIFETICS = " & Val(txtExtralifetics.Text) - If txtParalooptics.Text <> "" Then tsTarget.WriteLine "PARALOOPTICS = " & Val(txtParalooptics.Text) - If txtHelpertics.Text <> "" Then tsTarget.WriteLine "HELPERTICS = " & Val(txtHelpertics.Text) - If txtGameovertics.Text <> "" Then tsTarget.WriteLine "GAMEOVERTICS = " & Val(txtGameovertics.Text) - If txtTitleScrollSpeed.Text <> "" Then tsTarget.WriteLine "TITLESCROLLSPEED = " & Val(txtTitleScrollSpeed.Text) - If chkLoopTitle.Value = 1 Then tsTarget.WriteLine "LOOPTITLE = " & chkLoopTitle.Value - If chkDisableSpeedAdjust.Value = 1 Then tsTarget.WriteLine "DISABLESPEEDADJUST = " & chkDisableSpeedAdjust.Value - - flags = 0 - For i = 0 To 2 - If chkReset(i).Value = 1 Then - flags = flags + Val(chkReset(i).Tag) - End If - Next - - If flags > 0 Then tsTarget.WriteLine "RESETDATA = " & flags - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - MsgBox "Settings Saved." -End Sub - diff --git a/tools/SOCEdit/frmMaincfg.frx b/tools/SOCEdit/frmMaincfg.frx deleted file mode 100644 index 2ae367330..000000000 Binary files a/tools/SOCEdit/frmMaincfg.frx and /dev/null differ diff --git a/tools/SOCEdit/frmSoundEdit.frm b/tools/SOCEdit/frmSoundEdit.frm deleted file mode 100644 index c91d84ed8..000000000 --- a/tools/SOCEdit/frmSoundEdit.frm +++ /dev/null @@ -1,485 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmSoundEdit - Caption = "Sound Edit" - ClientHeight = 4995 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 6180 - Icon = "frmSoundEdit.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 4995 - ScaleWidth = 6180 - StartUpPosition = 3 'Windows Default - Begin VB.CommandButton cmdDelete - Caption = "&Delete sound from SOC" - Height = 495 - Left = 5040 - Style = 1 'Graphical - TabIndex = 13 - Top = 4320 - Width = 1095 - End - Begin VB.CommandButton cmdSave - Caption = "&Save" - Height = 495 - Left = 3840 - TabIndex = 6 - Top = 4320 - Width = 1095 - End - Begin VB.CommandButton cmdReload - Caption = "&Load Code Default" - Height = 495 - Left = 2640 - Style = 1 'Graphical - TabIndex = 5 - Top = 4320 - Width = 1095 - End - Begin VB.Frame frmSpecial - Caption = "Special Properties" - Height = 3375 - Left = 2640 - TabIndex = 4 - Top = 840 - Width = 3495 - Begin VB.CheckBox chkTotallySingle - Caption = "Make sure only one sound of this is playing at a time on any sound channel." - Height = 615 - Left = 120 - TabIndex = 12 - Tag = "1" - Top = 2640 - Width = 3255 - End - Begin VB.CheckBox chkEightEx - Caption = "Sound can be heard across 8x the distance" - Height = 375 - Left = 120 - TabIndex = 10 - Tag = "16" - Top = 2160 - Width = 2295 - End - Begin VB.CheckBox chkOutside - Caption = "Volume dependent on how close you are to outside" - Height = 375 - Left = 120 - TabIndex = 9 - Tag = "4" - Top = 360 - Width = 2295 - End - Begin VB.CheckBox chkFourEx - Caption = "Sound can be heard across 4x the distance" - Height = 375 - Left = 120 - TabIndex = 8 - Tag = "8" - Top = 1560 - Width = 2055 - End - Begin VB.CheckBox chkMultiple - Caption = "More than one of this sound can be played per object at a time (i.e., thunder)" - Height = 615 - Left = 120 - TabIndex = 7 - Tag = "2" - Top = 840 - Width = 2535 - End - Begin VB.Label Label1 - Caption = "Combine for 32x" - Height = 495 - Left = 2760 - TabIndex = 11 - Top = 1800 - Width = 615 - End - Begin VB.Line Line4 - X1 = 2400 - X2 = 2640 - Y1 = 2400 - Y2 = 2400 - End - Begin VB.Line Line2 - X1 = 2400 - X2 = 2640 - Y1 = 1800 - Y2 = 1800 - End - Begin VB.Line Line1 - X1 = 2640 - X2 = 2640 - Y1 = 2400 - Y2 = 1800 - End - End - Begin VB.ComboBox cmbPriority - Height = 315 - ItemData = "frmSoundEdit.frx":0442 - Left = 3360 - List = "frmSoundEdit.frx":0444 - TabIndex = 2 - Top = 120 - Width = 855 - End - Begin VB.CheckBox chkSingularity - Caption = "Only one can be played at a time per object." - Height = 255 - Left = 2640 - TabIndex = 1 - Top = 480 - Width = 3495 - End - Begin VB.ListBox lstSounds - Height = 4740 - Left = 120 - TabIndex = 0 - Top = 120 - Width = 2415 - End - Begin VB.Line Line3 - X1 = 0 - X2 = 720 - Y1 = 0 - Y2 = 0 - End - Begin VB.Label lblPriority - Alignment = 1 'Right Justify - Caption = "Priority:" - Height = 255 - Left = 2640 - TabIndex = 3 - Top = 120 - Width = 615 - End -End -Attribute VB_Name = "frmSoundEdit" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdDelete_Click() - Call WriteSound(True) -End Sub - -Private Sub cmdReload_Click() - Call ClearForm - If InStr(lstSounds.List(lstSounds.ListIndex), "(free slot)") = 0 Then - Call LoadSoundInfo(lstSounds.ListIndex) - Else - MsgBox "Free slots do not have a code default." - End If -End Sub - -Private Sub cmdSave_Click() - Call WriteSound(False) -End Sub - -Private Sub Form_Load() - Call Reload -End Sub - -Private Sub ClearForm() - cmbPriority.Text = "" - chkSingularity.Value = 0 - chkOutside.Value = 0 - chkMultiple.Value = 0 - chkFourEx.Value = 0 - chkEightEx.Value = 0 - chkTotallySingle.Value = 0 -End Sub - -Private Sub Reload() - Call ClearForm - Call LoadCode - lstSounds.ListIndex = 0 -End Sub - -Private Sub LoadCode() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim addstring As String - Dim i As Integer, numfreeslots As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("sounds.h", ForReading, False) - - Do While InStr(ts.ReadLine, "List of sounds (don't modify this comment!)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - lstSounds.Clear - - Do While InStr(line, "sfx_freeslot0") = 0 - startclip = InStr(line, "sfx_") - If InStr(line, "sfx_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - addstring = number & " - " & line - lstSounds.AddItem addstring - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - Set myFSO = Nothing - -'Populate the free slots! - numfreeslots = 800 - - For i = 1 To numfreeslots - If i < 10 Then - addstring = number & " - " & "sfx_fre00" & i & " (free slot)" - ElseIf i < 100 Then - addstring = number & " - " & "sfx_fre0" & i & " (free slot)" - Else - addstring = number & " - " & "sfx_fre" & i & " (free slot)" - End If - lstSounds.AddItem addstring - number = number + 1 - Next - - For i = 0 To 127 - cmbPriority.AddItem i - Next -End Sub - -Private Sub lstSounds_Click() - Call ClearForm - If InStr(lstSounds.List(lstSounds.ListIndex), "(free slot)") = 0 Then - Call LoadSoundInfo(lstSounds.ListIndex) - End If - Call LoadSOCSoundInfo(lstSounds.ListIndex) -End Sub - -Private Sub LoadSOCSoundInfo(SoundNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "SOUND" And Val(word2) = SoundNum Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "SINGULAR" Then - If Val(word2) = 1 Then - chkSingularity.Value = 1 - Else - chkSingularity.Value = 0 - End If - ElseIf word = "PRIORITY" Then - cmbPriority.Text = Val(word2) - ElseIf word = "FLAGS" Then - ProcessSoundFlags (Val(word2)) - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC!" & vbCrLf & "Unknown line: " & line - End If - Loop - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub LoadSoundInfo(StateNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim token As String - Dim frame As Long - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("sounds.c", ForReading, False) - - Do While InStr(ts.ReadLine, "S_sfx[0] needs to be a dummy for odd reasons.") = 0 - Loop - - number = 0 - - Do While number <> StateNum - Do While InStr(ts.ReadLine, """") = 0 - Loop - number = number + 1 - Loop - - Do While InStr(line, """") = 0 - line = ts.ReadLine - Loop - - startclip = InStr(line, """") + 1 - line = Mid(line, startclip, Len(line) - startclip) - endclip = InStr(line, """") - 1 - token = TrimComplete(Left(line, endclip)) - - 'txtName.Text = line - - startclip = InStr(line, ",") + 1 - line = Mid(line, startclip, Len(line) - startclip) - endclip = InStr(line, ",") - 1 - token = TrimComplete(Left(line, endclip)) - - If token = "true" Then - chkSingularity.Value = 1 - Else - chkSingularity.Value = 0 - End If - - startclip = InStr(line, ",") + 1 - line = Mid(line, startclip, Len(line) - startclip) - endclip = InStr(line, ",") - 1 - token = TrimComplete(Left(line, endclip)) - cmbPriority.Text = token - - startclip = InStr(line, ",") + 1 - line = Mid(line, startclip, Len(line) - startclip) - endclip = InStr(line, ",") - 1 - token = TrimComplete(Left(line, endclip)) - - ProcessSoundFlags (Val(token)) - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub ProcessSoundFlags(flags As Long) - - chkTotallySingle.Value = 0 - chkMultiple.Value = 0 - chkOutside.Value = 0 - chkFourEx.Value = 0 - chkEightEx.Value = 0 - - If flags = -1 Then - Exit Sub - End If - - If flags And 1 Then - chkTotallySingle.Value = 1 - End If - - If flags And 2 Then - chkMultiple.Value = 1 - End If - - If flags And 4 Then - chkOutside.Value = 1 - End If - - If flags And 8 Then - chkFourEx.Value = 1 - End If - - If flags And 16 Then - chkEightEx.Value = 1 - End If - -End Sub - -Private Sub WriteSound(Remove As Boolean) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim flags As Long - Dim soundfound As Boolean - - soundfound = False - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - 'If the current sound exists in the SOC, delete it. - If word = "SOUND" And Val(word2) = lstSounds.ListIndex Then - soundfound = True - Do While Len(TrimComplete(tsSource.ReadLine)) > 0 And Not (tsSource.AtEndOfStream) - Loop - Else - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False Then - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine "SOUND " & lstSounds.ListIndex - cmbPriority.Text = TrimComplete(cmbPriority.Text) - If cmbPriority.Text <> "" Then tsTarget.WriteLine "PRIORITY = " & Val(cmbPriority.Text) - If chkSingularity.Value = 1 Then tsTarget.WriteLine "SINGULAR = 1" - - flags = 0 - - If chkOutside.Value = 1 Then flags = flags + Val(chkOutside.Tag) - If chkMultiple.Value = 1 Then flags = flags + Val(chkMultiple.Tag) - If chkFourEx.Value = 1 Then flags = flags + Val(chkFourEx.Tag) - If chkEightEx.Value = 1 Then flags = flags + Val(chkEightEx.Tag) - If chkTotallySingle.Value = 1 Then flags = flags + Val(chkTotallySingle.Tag) - - If flags > 0 Then tsTarget.WriteLine "FLAGS = " & flags - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - If soundfound = True Then - MsgBox "Sound removed from SOC." - Else - MsgBox "Sound not found in SOC." - End If - Else - MsgBox "Sound Saved." - End If -End Sub - diff --git a/tools/SOCEdit/frmSoundEdit.frx b/tools/SOCEdit/frmSoundEdit.frx deleted file mode 100644 index 980538679..000000000 Binary files a/tools/SOCEdit/frmSoundEdit.frx and /dev/null differ diff --git a/tools/SOCEdit/frmStateEdit.frm b/tools/SOCEdit/frmStateEdit.frm deleted file mode 100644 index 4eca5a1bc..000000000 --- a/tools/SOCEdit/frmStateEdit.frm +++ /dev/null @@ -1,940 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmStateEdit - Caption = "State Edit" - ClientHeight = 6750 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 8970 - Icon = "frmStateEdit.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 6750 - ScaleWidth = 8970 - StartUpPosition = 3 'Windows Default - Begin VB.TextBox lblVar2Desc - Height = 495 - Left = 4440 - Locked = -1 'True - MultiLine = -1 'True - ScrollBars = 2 'Vertical - TabIndex = 25 - Top = 3000 - Width = 4455 - End - Begin VB.TextBox lblVar1Desc - Height = 495 - Left = 4440 - Locked = -1 'True - MultiLine = -1 'True - ScrollBars = 2 'Vertical - TabIndex = 24 - Top = 2400 - Width = 4455 - End - Begin VB.TextBox lblActionDesc - Height = 735 - Left = 4440 - Locked = -1 'True - MultiLine = -1 'True - ScrollBars = 2 'Vertical - TabIndex = 23 - Top = 1560 - Width = 4455 - End - Begin VB.ListBox lstThings - Height = 450 - ItemData = "frmStateEdit.frx":0442 - Left = 7440 - List = "frmStateEdit.frx":0444 - TabIndex = 22 - Top = 6120 - Visible = 0 'False - Width = 975 - End - Begin VB.TextBox txtFuncVar2 - Height = 285 - Left = 7200 - TabIndex = 19 - Top = 3600 - Width = 1215 - End - Begin VB.TextBox txtFuncVar1 - Height = 285 - Left = 5520 - TabIndex = 18 - Top = 3600 - Width = 1095 - End - Begin VB.CommandButton cmdCopy - Caption = "&Copy state to..." - Height = 495 - Left = 6120 - Style = 1 'Graphical - TabIndex = 17 - Top = 6120 - Width = 1095 - End - Begin VB.CommandButton cmdDelete - Caption = "&Delete State from SOC" - Height = 495 - Left = 6120 - Style = 1 'Graphical - TabIndex = 16 - Top = 5520 - Width = 1095 - End - Begin VB.CommandButton cmdReload - Caption = "&Load Code Default" - Height = 495 - Left = 4920 - Style = 1 'Graphical - TabIndex = 15 - Top = 5520 - Width = 1095 - End - Begin VB.CommandButton cmdSave - Caption = "&Save" - Height = 495 - Left = 7320 - TabIndex = 14 - Top = 5520 - Width = 1095 - End - Begin VB.ComboBox cmbTranslucency - Height = 315 - ItemData = "frmStateEdit.frx":0446 - Left = 6720 - List = "frmStateEdit.frx":045C - TabIndex = 12 - Top = 5040 - Width = 1695 - End - Begin VB.CheckBox chkFullbright - Caption = "Make sprite full-brightness (unaffected by lighting)" - Height = 495 - Left = 6240 - TabIndex = 11 - Top = 4440 - Width = 2175 - End - Begin VB.ComboBox cmbNextstate - Height = 315 - Left = 6120 - TabIndex = 9 - Top = 3960 - Width = 2295 - End - Begin VB.ComboBox cmbAction - Height = 315 - Left = 6000 - TabIndex = 7 - Top = 1200 - Width = 2295 - End - Begin VB.TextBox txtTics - Height = 285 - Left = 7800 - TabIndex = 5 - Top = 720 - Width = 495 - End - Begin VB.TextBox txtFrame - Height = 285 - Left = 5880 - MaxLength = 2 - TabIndex = 3 - Top = 720 - Width = 495 - End - Begin VB.ComboBox cmbSprite - Height = 315 - Left = 5880 - TabIndex = 1 - Top = 120 - Width = 2415 - End - Begin VB.ListBox lstStates - Height = 6495 - Left = 120 - TabIndex = 0 - Top = 120 - Width = 4215 - End - Begin VB.Label lblFuncVar2 - Alignment = 1 'Right Justify - Caption = "Var2:" - Height = 255 - Left = 6600 - TabIndex = 21 - Top = 3600 - Width = 495 - End - Begin VB.Label lblFuncVar1 - Alignment = 1 'Right Justify - Caption = "Var1:" - Height = 255 - Left = 4920 - TabIndex = 20 - Top = 3600 - Width = 495 - End - Begin VB.Label lblTranslucency - Alignment = 1 'Right Justify - Caption = "Translucency:" - Height = 255 - Left = 5520 - TabIndex = 13 - Top = 5040 - Width = 1095 - End - Begin VB.Label lblNextstate - Alignment = 1 'Right Justify - Caption = "Next State:" - Height = 255 - Left = 5160 - TabIndex = 10 - Top = 3960 - Width = 855 - End - Begin VB.Label lblAction - Alignment = 1 'Right Justify - Caption = "Function to Call:" - Height = 375 - Left = 5040 - TabIndex = 8 - Top = 1080 - Width = 855 - End - Begin VB.Label lblTics - Alignment = 1 'Right Justify - Caption = "Tics (-1 for infinite duration):" - Height = 495 - Left = 6480 - TabIndex = 6 - Top = 600 - Width = 1215 - End - Begin VB.Label lblFrame - Alignment = 1 'Right Justify - Caption = "Frame:" - Height = 255 - Left = 5160 - TabIndex = 4 - Top = 720 - Width = 615 - End - Begin VB.Label lblSprite - Alignment = 1 'Right Justify - Caption = "Sprite:" - Height = 255 - Left = 5160 - TabIndex = 2 - Top = 120 - Width = 615 - End -End -Attribute VB_Name = "frmStateEdit" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmbAction_Click() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim index As Integer - Dim ActionName As String - - ActionName = cmbAction.List(cmbAction.ListIndex) - - If cmbAction.ListIndex = 0 Then - lblActionDesc.Text = "" - lblVar1Desc.Text = "" - lblVar2Desc.Text = "" - Exit Sub - End If - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("p_enemy.c", ForReading, False) - - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Mid(line, 4, 9) = "Function:" And InStr(line, ActionName) > 0 Then - ts.ReadLine ' // - line = ts.ReadLine ' // Description: - index = InStr(line, ":") - lblActionDesc.Text = Mid(line, index + 2, Len(line) - (index + 1)) - - ts.ReadLine ' // - line = ts.ReadLine ' // var1 = - If InStr(line, "var1:") Then - lblVar1Desc.Text = Mid(line, 4, Len(line) - 3) - line = ts.ReadLine - Do While Left(line, 7) <> "// var2" - lblVar1Desc.Text = lblVar1Desc.Text & vbCrLf & TrimComplete(Mid(line, 4, Len(line) - 3)) - line = ts.ReadLine - Loop - Else - lblVar1Desc.Text = Mid(line, 4, Len(line) - 3) - End If - - If Left(line, 7) <> "// var2" Then - line = ts.ReadLine ' // var2 = - End If - - If InStr(line, "var2:") Then - lblVar2Desc.Text = Mid(line, 4, Len(line) - 3) - line = ts.ReadLine - Do While Len(line) > 4 - lblVar2Desc.Text = lblVar2Desc.Text & vbCrLf & TrimComplete(Mid(line, 4, Len(line) - 3)) - line = ts.ReadLine - Loop - Else - lblVar2Desc.Text = Mid(line, 4, Len(line) - 3) - End If - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub cmdCopy_Click() - Dim Response As String - - Response$ = InputBox("Copy state to #:", "Copy State") - - If Response = "" Then Exit Sub - - Response = TrimComplete(Response) - - Call WriteState(False, Val(Response)) - - MsgBox "State copied to #" & Val(Response) -End Sub - -Private Sub cmdDelete_Click() - Call WriteState(True, lstStates.ListIndex) -End Sub - -Private Sub cmdReload_Click() - Call ClearForm - - If InStr(lstStates.List(lstStates.ListIndex), "S_FREESLOT") = 0 Then - LoadStateInfo (lstStates.ListIndex) - Else - MsgBox "Free slots do not have a code default." - End If -End Sub - -Private Sub cmdSave_Click() - If TrimComplete(txtFrame.Text) = "" And (chkFullbright.Value = 1 Or cmbTranslucency.ListIndex > 0) Then - MsgBox "ERROR: Frame field required for fullbright/translucency." - Exit Sub - End If - Call WriteState(False, lstStates.ListIndex) -End Sub - -Private Sub Form_Load() - Call Reload - lstStates.ListIndex = 0 -End Sub - -Private Sub ClearForm() - cmbNextstate.Text = "" - cmbSprite.Text = "" - txtFrame.Text = "" - cmbAction.Text = "" - txtFuncVar1.Text = "" - txtFuncVar2.Text = "" - lblActionDesc.Text = "" - lblVar1Desc.Text = "" - lblVar2Desc.Text = "" - chkFullbright.Value = False - cmbTranslucency.ListIndex = 0 -End Sub - -Private Sub Reload() - LoadStates - LoadSprites - LoadActions -End Sub - -Private Sub LoadStates() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim addstring As String - Dim numfreeslots As Integer, i As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - Do While InStr(ts.ReadLine, "Object states (don't modify this comment!)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - lstStates.Clear - - Do While InStr(line, "S_FIRSTFREESLOT") = 0 - startclip = InStr(line, "S_") - If InStr(line, "S_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - addstring = number & " - " & line - lstStates.AddItem addstring - cmbNextstate.AddItem addstring - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - - 'Populate the free slots! - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - line = ts.ReadLine - Do While InStr(line, "#define NUMMOBJFREESLOTS") = 0 - line = ts.ReadLine - Loop - - startclip = InStr(line, "SLOTS ") + 6 - numfreeslots = Val(Mid(line, startclip, Len(line) - startclip + 1)) * 6 - - For i = 1 To numfreeslots - addstring = number & " - " & "S_FREESLOT" & i - lstStates.AddItem addstring - cmbNextstate.AddItem addstring - number = number + 1 - Next - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub LoadSprites() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim addstring As String - Dim numfreeslots As Integer, i As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - Do While InStr(ts.ReadLine, "Hey, moron! If you change this table, don't forget about") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - cmbSprite.Clear - - Do While InStr(line, "SPR_FIRSTFREESLOT") = 0 - startclip = InStr(line, "SPR_") - If InStr(line, "SPR_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - addstring = number & " - " & line - cmbSprite.AddItem addstring - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - - 'Populate the free slots! - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - line = ts.ReadLine - Do While InStr(line, "#define NUMMOBJFREESLOTS") = 0 - line = ts.ReadLine - Loop - - startclip = InStr(line, "SLOTS ") + 6 - numfreeslots = Val(Mid(line, startclip, Len(line) - startclip + 1)) - - For i = 1 To numfreeslots - If i < 10 Then - addstring = number & " - " & "SPR_F00" & i & " (Free slot)" - ElseIf i < 100 Then - addstring = number & " - " & "SPR_F0" & i & " (Free slot)" - Else - addstring = number & " - " & "SPR_F" & i & " (Free slot)" - End If - - cmbSprite.AddItem addstring - number = number + 1 - Next - - ts.Close - - Set myFSO = Nothing -End Sub - -Private Sub LoadActions() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim addstring As String - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("dehacked.c", ForReading, False) - - Do While InStr(ts.ReadLine, "actionpointer_t actionpointers[]") = 0 - Loop - - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - cmbAction.Clear - - cmbAction.AddItem "None" - - Do While InStr(line, "NULL") = 0 - startclip = InStr(line, "A_") - If InStr(line, "A_") <> 0 Then - endclip = InStr(line, "}") - line = Mid(line, startclip, endclip - startclip) - cmbAction.AddItem line - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub lstStates_Click() - Call ClearForm - - If InStr(lstStates.List(lstStates.ListIndex), "S_FREESLOT") = 0 Then - LoadStateInfo (lstStates.ListIndex) - End If - - LoadSOCStateInfo (lstStates.ListIndex) -End Sub - -Private Sub LoadSOCStateInfo(StateNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim frameNum As Long - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "FRAME" And Val(word2) = StateNum Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "SPRITENUMBER" Then - cmbSprite.ListIndex = Val(word2) - ElseIf word = "SPRITESUBNUMBER" Then - frameNum = Val(word2) - - If frameNum >= 327680 Then ' 5 << 16 - cmbTranslucency.ListIndex = 5 - frameNum = frameNum And Not 327680 - ElseIf frameNum >= 262144 Then ' 4 << 16 - cmbTranslucency.ListIndex = 4 - frameNum = frameNum And Not 262144 - ElseIf frameNum >= 196608 Then ' 3 << 16 - cmbTranslucency.ListIndex = 3 - frameNum = frameNum And Not 196608 - ElseIf frameNum >= 131072 Then ' 2 << 16 - cmbTranslucency.ListIndex = 2 - frameNum = frameNum And Not 131072 - ElseIf frameNum >= 65536 Then ' 1 << 16 - cmbTranslucency.ListIndex = 1 - frameNum = frameNum And Not 65536 - End If - - If frameNum >= 32768 Then - chkFullbright.Value = 1 - frameNum = frameNum And Not 32768 - Else - chkFullbright.Value = 0 - End If - - txtFrame.Text = frameNum - ElseIf word = "DURATION" Then - txtTics.Text = Val(word2) - ElseIf word = "NEXT" Then - cmbNextstate.ListIndex = Val(word2) - ElseIf word = "ACTION" Then - Call FindComboIndex(cmbAction, UCase(SecondToken(line))) - ElseIf word = "VAR1" Then - txtFuncVar1.Text = Val(word2) - ElseIf word = "VAR2" Then - txtFuncVar2.Text = Val(word2) - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC!" & vbCrLf & "Unknown line: " & line - End If - Loop - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub LoadStateInfo(StateNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim token As String - Dim frame As Long - Dim templine As String - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("info.c", ForReading, False) - - Do While InStr(ts.ReadLine, "Keep this comment directly above S_NULL") = 0 - Loop - - number = 0 - - Do While number <> StateNum - Do While InStr(ts.ReadLine, "SPR_") = 0 - Loop - number = number + 1 - Loop - - Do While InStr(line, "SPR_") = 0 - line = ts.ReadLine - Loop - - startclip = InStr(line, "SPR_") - line = Mid(line, startclip, Len(line) - startclip) - endclip = InStr(line, ",") - 1 - token = Left(line, endclip) - Call FindComboIndex(cmbSprite, token) - - startclip = InStr(line, ",") + 1 - line = TrimComplete(Mid(line, startclip, Len(line) - startclip)) - endclip = InStr(line, ",") - 1 - frame = Val(Left(line, endclip)) - - If frame >= 32768 Then - chkFullbright.Value = 1 - frame = frame - 32768 - Else - chkFullbright.Value = 0 - End If - - txtFrame.Text = frame - - cmbTranslucency.ListIndex = 0 - - startclip = InStr(line, ",") + 1 - line = TrimComplete(Mid(line, startclip, Len(line) - startclip)) - endclip = InStr(line, ",") - 1 - txtTics.Text = Val(Left(line, endclip)) - - startclip = InStr(line, "{") + 1 - line = TrimComplete(Mid(line, startclip, Len(line) - startclip)) - endclip = InStr(line, "}") - 1 - cmbAction.Text = TrimComplete(Left(line, endclip)) - If cmbAction.Text = "NULL" Then cmbAction.Text = "None" - - startclip = InStr(line, ",") + 1 - line = TrimComplete(Mid(line, startclip, Len(line) - startclip)) - endclip = InStr(line, ",") - 1 - templine = Left(line, endclip) - - templine = TrimComplete(templine) - 'Check for *FRACUNIT values - endclip = InStr(templine, "*FRACUNIT") - If endclip <> 0 Then - templine = Left(templine, endclip - 1) - templine = Val(templine) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(templine, "MT_") - If endclip <> 0 Then - templine = FindThingNum(templine) & " - " & templine - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(templine, "pw_") - If endclip <> 0 Then - templine = FindPowerNum(templine) & " - " & templine - End If - txtFuncVar1.Text = templine - - startclip = InStr(line, ",") + 1 - line = TrimComplete(Mid(line, startclip, Len(line) - startclip)) - endclip = InStr(line, ",") - 1 - templine = Left(line, endclip) - - templine = TrimComplete(templine) - 'Check for *FRACUNIT values - endclip = InStr(templine, "*FRACUNIT") - If endclip <> 0 Then - templine = Left(templine, endclip - 1) - templine = Val(templine) * 65536 - End If - 'Check for crazy-odd MT_ usage - endclip = InStr(templine, "MT_") - If endclip <> 0 Then - templine = FindThingNum(templine) & " - " & templine - End If - 'Check for crazy-odd pw_ usage - endclip = InStr(templine, "pw_") - If endclip <> 0 Then - templine = FindPowerNum(templine) & " - " & templine - End If - txtFuncVar2.Text = templine - - startclip = InStr(line, ",") + 1 - line = TrimComplete(Mid(line, startclip, Len(line) - startclip)) - endclip = InStr(line, "}") - 1 - Call FindComboIndex(cmbNextstate, TrimComplete(Left(line, endclip))) - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub FindComboIndex(ByRef Box As ComboBox, line As String) - Dim i As Integer - - For i = 0 To Box.ListCount - If InStr(UCase(Box.List(i)), UCase(line)) Then - Box.ListIndex = i - Exit For - End If - Next -End Sub - -Private Sub WriteState(Remove As Boolean, num As Integer) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim flags As Long - Dim statefound As Boolean - - statefound = False - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - 'If the current sound exists in the SOC, delete it. - If word = "FRAME" And Val(word2) = num Then - statefound = True - Do While Len(TrimComplete(tsSource.ReadLine)) > 0 And Not (tsSource.AtEndOfStream) - Loop - Else - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False Then - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine "FRAME " & num - cmbSprite.Text = TrimComplete(cmbSprite.Text) - txtFrame.Text = TrimComplete(txtFrame.Text) - txtTics.Text = TrimComplete(txtTics.Text) - cmbAction.Text = TrimComplete(cmbAction.Text) - txtFuncVar1.Text = TrimComplete(txtFuncVar1.Text) - txtFuncVar2.Text = TrimComplete(txtFuncVar2.Text) - cmbNextstate.Text = TrimComplete(cmbNextstate.Text) - cmbTranslucency.Text = TrimComplete(cmbTranslucency.Text) - - If cmbSprite.Text <> "" Then tsTarget.WriteLine "SPRITENUMBER = " & cmbSprite.ListIndex - - flags = Val(txtFrame.Text) - If chkFullbright.Value = 1 Then flags = flags + 32768 - - ' Grrr VB doesn't have bitshifts!! - If cmbTranslucency.Text <> "" Then - flags = flags + cmbTranslucency.ListIndex * 65536 - End If - - If txtFrame.Text <> "" Then tsTarget.WriteLine "SPRITESUBNUMBER = " & flags - If txtTics.Text <> "" Then tsTarget.WriteLine "DURATION = " & Val(txtTics.Text) - If cmbNextstate.Text <> "" Then tsTarget.WriteLine "NEXT = " & cmbNextstate.ListIndex - If cmbAction.Text <> "" Then tsTarget.WriteLine "ACTION " & cmbAction.Text - If txtFuncVar1.Text <> "" Then tsTarget.WriteLine "VAR1 = " & Val(txtFuncVar1.Text) - If txtFuncVar2.Text <> "" Then tsTarget.WriteLine "VAR2 = " & Val(txtFuncVar2.Text) - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - If statefound = True Then - MsgBox "State removed from SOC." - Else - MsgBox "State not found in SOC." - End If - Else - MsgBox "State Saved." - End If -End Sub - -Private Sub LoadThings() - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer, endclip As Integer - Dim numfreeslots As Integer, i As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - Do While InStr(ts.ReadLine, "Little flag for SOC editor (don't change this comment!)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - lstThings.Clear - - Do While InStr(line, "MT_FIRSTFREESLOT") = 0 - startclip = InStr(line, "MT_") - If InStr(line, "MT_") <> 0 Then - endclip = InStr(line, ",") - line = Mid(line, startclip, endclip - startclip) - lstThings.AddItem number & " - " & line - number = number + 1 - End If - line = ts.ReadLine - Loop - - ts.Close - - 'Populate the free slots! - Set ts = myFSO.OpenTextFile("info.h", ForReading, False) - - line = ts.ReadLine - Do While InStr(line, "#define NUMMOBJFREESLOTS") = 0 - line = ts.ReadLine - Loop - - startclip = InStr(line, "SLOTS ") + 6 - numfreeslots = Val(Mid(line, startclip, Len(line) - startclip + 1)) - - For i = 1 To numfreeslots - lstThings.AddItem number & " - " & "MT_FREESLOT" & i - number = number + 1 - Next - - ts.Close - Set myFSO = Nothing -End Sub - -Private Function FindThingNum(ThingName As String) As Integer - Dim i As Integer - Dim temp As String - Dim startpoint As Integer - Dim endpoint As Integer - - lstThings.Clear - LoadThings - - For i = 0 To lstThings.ListCount - 1 - temp = lstThings.List(i) - startpoint = InStr(temp, "-") + 2 - endpoint = Len(temp) - startpoint + 1 - temp = Mid(temp, startpoint, endpoint) - If temp = ThingName Then - FindThingNum = Val(lstThings.List(i)) - Exit For - End If - Next -End Function - -Private Function FindPowerNum(PowerName As String) As Integer - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim number As Integer - Dim startclip As Integer - - ChDir SourcePath - Set ts = myFSO.OpenTextFile("d_player.h", ForReading, False) - - Do While InStr(ts.ReadLine, "Player powers. (don't edit this comment)") = 0 - Loop - - ts.SkipLine ' typedef enum - ts.SkipLine ' { - - line = ts.ReadLine - number = 0 - - Do While InStr(line, "NUMPOWERS") = 0 - startclip = InStr(line, PowerName) - If startclip <> 0 Then - FindPowerNum = number - Exit Do - End If - number = number + 1 - line = ts.ReadLine - Loop - - ts.Close - Set myFSO = Nothing -End Function diff --git a/tools/SOCEdit/frmStateEdit.frx b/tools/SOCEdit/frmStateEdit.frx deleted file mode 100644 index 8069c37e0..000000000 Binary files a/tools/SOCEdit/frmStateEdit.frx and /dev/null differ diff --git a/tools/SOCEdit/frmUnlockablesEdit.frm b/tools/SOCEdit/frmUnlockablesEdit.frm deleted file mode 100644 index f43209a78..000000000 --- a/tools/SOCEdit/frmUnlockablesEdit.frm +++ /dev/null @@ -1,391 +0,0 @@ -VERSION 5.00 -Begin VB.Form frmUnlockablesEdit - Caption = "Unlockables Edit" - ClientHeight = 3675 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 8130 - Icon = "frmUnlockablesEdit.frx":0000 - LinkTopic = "Form1" - MaxButton = 0 'False - ScaleHeight = 3675 - ScaleWidth = 8130 - StartUpPosition = 3 'Windows Default - Begin VB.CheckBox chkGrade - Caption = "Must have beaten Ultimate" - Height = 255 - Index = 4 - Left = 5400 - TabIndex = 20 - Tag = "1024" - Top = 2160 - Width = 2655 - End - Begin VB.CheckBox chkGrade - Caption = "Must have beaten Very Hard" - Height = 255 - Index = 3 - Left = 5400 - TabIndex = 19 - Tag = "128" - Top = 1800 - Width = 2655 - End - Begin VB.CheckBox chkGrade - Caption = "Must have all emblems" - Height = 255 - Index = 2 - Left = 5400 - TabIndex = 18 - Tag = "16" - Top = 1440 - Width = 2055 - End - Begin VB.CheckBox chkGrade - Caption = "Must have gotten all 7 emeralds" - Height = 255 - Index = 1 - Left = 5400 - TabIndex = 17 - Tag = "8" - Top = 1080 - Width = 2655 - End - Begin VB.CheckBox chkGrade - Caption = "Game must be completed" - Height = 255 - Index = 0 - Left = 5400 - TabIndex = 16 - Tag = "1" - Top = 720 - Width = 2175 - End - Begin VB.TextBox txtVar - Height = 285 - Left = 4320 - TabIndex = 14 - Top = 2640 - Width = 615 - End - Begin VB.ComboBox cmbType - Height = 315 - ItemData = "frmUnlockablesEdit.frx":0442 - Left = 3360 - List = "frmUnlockablesEdit.frx":044C - TabIndex = 12 - Top = 2160 - Width = 1575 - End - Begin VB.TextBox txtNeededTime - Height = 285 - Left = 4080 - TabIndex = 10 - Top = 1680 - Width = 855 - End - Begin VB.TextBox txtNeededEmblems - Height = 285 - Left = 4440 - TabIndex = 9 - Top = 1200 - Width = 495 - End - Begin VB.TextBox txtObjective - Height = 285 - Left = 3240 - TabIndex = 7 - Top = 720 - Width = 1695 - End - Begin VB.TextBox txtName - Height = 285 - Left = 3240 - TabIndex = 5 - Top = 240 - Width = 1695 - End - Begin VB.CommandButton cmdDelete - Caption = "&Delete from SOC" - Height = 375 - Left = 3480 - TabIndex = 3 - Top = 3120 - Width = 1575 - End - Begin VB.CommandButton cmdSave - Caption = "&Save Changes" - Height = 375 - Left = 1800 - TabIndex = 2 - Top = 3120 - Width = 1575 - End - Begin VB.ListBox lstUnlockables - Height = 2985 - ItemData = "frmUnlockablesEdit.frx":046A - Left = 120 - List = "frmUnlockablesEdit.frx":049B - TabIndex = 0 - Top = 480 - Width = 1215 - End - Begin VB.Label lblNote - Caption = "Note: All requirements are combinable." - Height = 495 - Left = 6000 - TabIndex = 22 - Top = 2760 - Width = 1695 - End - Begin VB.Label lblOtherReqs - Caption = "Other Requirements:" - Height = 255 - Left = 5400 - TabIndex = 21 - Top = 360 - Width = 1935 - End - Begin VB.Label lblVar - Alignment = 1 'Right Justify - Caption = "Map # to warp to:" - Height = 255 - Left = 2880 - TabIndex = 15 - Top = 2640 - Width = 1335 - End - Begin VB.Label lblType - Alignment = 1 'Right Justify - Caption = "Type of Unlockable:" - Height = 255 - Left = 1800 - TabIndex = 13 - Top = 2160 - Width = 1455 - End - Begin VB.Label lblNeededTime - Alignment = 1 'Right Justify - Caption = "Needed time on Time Attack rank (in seconds):" - Height = 375 - Left = 1440 - TabIndex = 11 - Top = 1560 - Width = 2535 - End - Begin VB.Label lblNeededEmblems - Alignment = 1 'Right Justify - Caption = "# of Emblems Needed:" - Height = 255 - Left = 2640 - TabIndex = 8 - Top = 1200 - Width = 1695 - End - Begin VB.Label lblObjective - Alignment = 1 'Right Justify - Caption = "Objective:" - Height = 255 - Left = 2400 - TabIndex = 6 - Top = 720 - Width = 735 - End - Begin VB.Label lblName - Alignment = 1 'Right Justify - Caption = "Name:" - Height = 255 - Left = 2640 - TabIndex = 4 - Top = 240 - Width = 495 - End - Begin VB.Label lblHUDItems - Caption = "Unlockables:" - Height = 255 - Left = 120 - TabIndex = 1 - Top = 240 - Width = 975 - End -End -Attribute VB_Name = "frmUnlockablesEdit" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -Private Sub cmdDelete_Click() - Call WriteUnlockableItem(True) -End Sub - -Private Sub cmdSave_Click() - Call WriteUnlockableItem(False) -End Sub - -Private Sub Form_Load() - Call Reload -End Sub - -Private Sub Reload() - txtName.Text = "" - txtObjective.Text = "" - txtNeededEmblems.Text = "" - txtNeededTime.Text = "" - cmbType.Text = "" - txtVar.Text = "" - - Dim i As Integer - - For i = 0 To chkGrade.Count - 1 - chkGrade(i).Value = 0 - Next i - - lstUnlockables.ListIndex = 0 -End Sub - -Private Sub lstUnlockables_Click() - Call ReadSOC(lstUnlockables.ListIndex + 1) -End Sub - -Private Sub ReadSOC(UnlockableNum As Integer) - Dim myFSO As New Scripting.FileSystemObject - Dim ts As TextStream - Dim line As String - Dim word As String - Dim word2 As String - - Set ts = myFSO.OpenTextFile(SOCFile, ForReading, False) - -SOCLoad: - Do While Not ts.AtEndOfStream - line = ts.ReadLine - - If Left(line, 1) = "#" Then GoTo SOCLoad - - If Left(line, 1) = vbCrLf Then GoTo SOCLoad - - If Len(line) < 1 Then GoTo SOCLoad - - word = FirstToken(line) - word2 = SecondToken(line) - - If UCase(word) = "UNLOCKABLE" And Val(word2) = UnlockableNum Then - Do While Len(line) > 0 And Not ts.AtEndOfStream - line = ts.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondTokenEqual(line)) - - If word = "NAME" Then - txtName.Text = word2 - ElseIf word = "OBJECTIVE" Then - txtObjective.Text = word2 - ElseIf word = "NEEDEDEMBLEMS" Then - txtNeededEmblems.Text = Val(word2) - ElseIf word = "NEEDEDTIME" Then - txtNeededTime.Text = Val(word2) - ElseIf word = "TYPE" Then - cmbType.ListIndex = Val(word2) - ElseIf word = "VAR" Then - txtVar.Text = Val(word2) - ElseIf word = "NEEDEDGRADE" Then - Dim i As Integer - - For i = 0 To chkGrade.Count - 1 - If Val(word2) And chkGrade(i).Tag Then - chkGrade(i).Tag = True - End If - Next i - ElseIf Len(line) > 0 And Left(line, 1) <> "#" Then - MsgBox "Error in SOC!" & vbCrLf & "Unknown line: " & line - End If - Loop - Exit Do - End If - Loop - - ts.Close - Set myFSO = Nothing -End Sub - -Private Sub WriteUnlockableItem(Remove As Boolean) - Dim myFSOSource As New Scripting.FileSystemObject - Dim tsSource As TextStream - Dim myFSOTarget As New Scripting.FileSystemObject - Dim tsTarget As TextStream - Dim line As String - Dim word As String - Dim word2 As String - Dim unlockableremoved As Boolean - - unlockableremoved = False - - Set tsSource = myFSOSource.OpenTextFile(SOCFile, ForReading, False) - Set tsTarget = myFSOTarget.OpenTextFile(SOCTemp, ForWriting, True) - - Do While Not tsSource.AtEndOfStream - line = tsSource.ReadLine - word = UCase(FirstToken(line)) - word2 = UCase(SecondToken(line)) - - 'If the current item exists in the SOC, delete it. - If word = "UNLOCKABLE" And Val(word2) = lstUnlockables.ListIndex + 1 Then - unlockableremoved = True - Do While Len(TrimComplete(tsSource.ReadLine)) > 0 And Not tsSource.AtEndOfStream - Loop - Else - tsTarget.WriteLine line - End If - Loop - - tsSource.Close - Set myFSOSource = Nothing - - If Remove = False Then - If line <> "" Then tsTarget.WriteLine "" - - tsTarget.WriteLine "UNLOCKABLE " & lstUnlockables.ListIndex + 1 - txtName.Text = TrimComplete(txtName.Text) - txtObjective.Text = TrimComplete(txtObjective.Text) - txtNeededEmblems.Text = TrimComplete(txtNeededEmblems.Text) - txtNeededTime.Text = TrimComplete(txtNeededTime.Text) - txtVar.Text = TrimComplete(txtVar.Text) - - If txtName.Text <> "" Then tsTarget.WriteLine "NAME = " & txtName.Text - If txtObjective.Text <> "" Then tsTarget.WriteLine "OBJECTIVE = " & txtObjective.Text - If txtNeededEmblems.Text <> "" Then tsTarget.WriteLine "NEEDEDEMBLEMS = " & txtNeededEmblems.Text - If txtNeededTime.Text <> "" Then tsTarget.WriteLine "NEEDEDTIME = " & txtNeededTime.Text - If cmbType.ListIndex <> -1 Then tsTarget.WriteLine "TYPE = " & cmbType.ListIndex - If txtVar.Text <> "" Then tsTarget.WriteLine "VAR = " & txtVar.Text - - Dim writegrade As Long - Dim i As Integer - writegrade = 0 - - For i = 0 To chkGrade.Count - 1 - If chkGrade(i).Value = 1 Then - writegrade = writegrade + chkGrade(i).Tag - End If - Next i - - If writegrade > 0 Then tsTarget.WriteLine "NEEDEDGRADE = " & writegrade - End If - - tsTarget.Close - Set myFSOTarget = Nothing - - FileCopy SOCTemp, SOCFile - - Kill SOCTemp - - If Remove = True Then - If unlockableremoved = True Then - MsgBox "Unlockable deleted from SOC." - Else - MsgBox "Couldn't find Unlockable in SOC." - End If - Else - MsgBox "Unlockable Saved." - End If -End Sub diff --git a/tools/SOCEdit/frmUnlockablesEdit.frx b/tools/SOCEdit/frmUnlockablesEdit.frx deleted file mode 100644 index d9d464d4e..000000000 Binary files a/tools/SOCEdit/frmUnlockablesEdit.frx and /dev/null differ diff --git a/tools/SOCEdit/icon1.ico b/tools/SOCEdit/icon1.ico deleted file mode 100644 index 1ea9d1005..000000000 Binary files a/tools/SOCEdit/icon1.ico and /dev/null differ diff --git a/tools/SRB2Launcher/ReadMe.txt b/tools/SRB2Launcher/ReadMe.txt deleted file mode 100644 index 9aafe08b8..000000000 --- a/tools/SRB2Launcher/ReadMe.txt +++ /dev/null @@ -1,35 +0,0 @@ -======================================================================== - WIN32 APPLICATION : SRB2Launcher -======================================================================== - - -AppWizard has created this SRB2Launcher application for you. - -This file contains a summary of what you will find in each of the files that -make up your SRB2Launcher application. - -SRB2Launcher.cpp - This is the main application source file. - -SRB2Launcher.dsp - This file (the project file) contains information at the project level and - is used to build a single project or subproject. Other users can share the - project (.dsp) file, but they should export the makefiles locally. - - -///////////////////////////////////////////////////////////////////////////// -Other standard files: - -StdAfx.h, StdAfx.cpp - These files are used to build a precompiled header (PCH) file - named SRB2Launcher.pch and a precompiled types file named StdAfx.obj. - - -///////////////////////////////////////////////////////////////////////////// -Other notes: - -AppWizard uses "TODO:" to indicate parts of the source code you -should add to or customize. - - -///////////////////////////////////////////////////////////////////////////// diff --git a/tools/SRB2Launcher/SRB2Launcher.cpp b/tools/SRB2Launcher/SRB2Launcher.cpp deleted file mode 100644 index 4138676d3..000000000 --- a/tools/SRB2Launcher/SRB2Launcher.cpp +++ /dev/null @@ -1,1155 +0,0 @@ -///////////////////////////// -// // -// Sonic Robo Blast 2 // -// Official Win32 Launcher // -// // -// By // -// SSNTails // -// ah518@tcnet.org // -// (Sonic Team Junior) // -// http://www.srb2.org // -// // -///////////////////////////// -// -// This source code is released under -// Public Domain. I hope it helps you -// learn how to write exciting Win32 -// applications in C! -// -// However, you may not alter this -// program and continue to call it -// the "Official Sonic Robo Blast 2 -// Launcher". -// -// NOTE: Not all files in this project -// are released under this license. -// Any license mentioned in accompanying -// source files overrides the license -// mentioned here, sorry! -// -// SRB2Launcher.cpp : Defines the entry point for the application. -// - -#include "stdafx.h" -#include -#include -#include "SRB2Launcher.h" - -char TempString[256]; - -char Arguments[16384]; - -HWND mainHWND; -HWND hostHWND; -HWND joinHWND; -HINSTANCE g_hInst; - -HANDLE ServerlistThread = 0; - -typedef struct -{ - char nospecialrings; - char suddendeath; - char scoringtype[16]; - char matchboxes[16]; - int respawnitemtime; - int timelimit; - int pointlimit; -} matchsettings_t; - -typedef struct -{ - char raceitemboxes[16]; - int numlaps; -} racesettings_t; - -typedef struct -{ - char nospecialrings; - char matchboxes[16]; - int respawnitemtime; - int timelimit; - int pointlimit; -} tagsettings_t; - -typedef struct -{ - char nospecialrings; - char matchboxes[16]; - int respawnitemtime; - int timelimit; - int flagtime; - int pointlimit; -} ctfsettings_t; - -typedef struct -{ - char nofile; - char nodownload; -} joinsettings_t; - -typedef struct -{ - matchsettings_t match; - racesettings_t race; - tagsettings_t tag; - ctfsettings_t ctf; - char gametype[16]; - char startmap[9]; - int maxplayers; - char advancestage[16]; - int inttime; - char forceskin; - char noautoaim; - char nosend; - char noadvertise; - - // Monitor Toggles... - char teleporters[8]; - char superring[8]; - char silverring[8]; - char supersneakers[8]; - char invincibility[8]; - char jumpshield[8]; - char watershield[8]; - char ringshield[8]; - char fireshield[8]; - char bombshield[8]; - char oneup[8]; - char eggmanbox[8]; -} hostsettings_t; - -typedef struct -{ - hostsettings_t host; - joinsettings_t join; - char EXEName[1024]; - char ConfigFile[1024]; - char ManualParameters[8192]; - char PlayerName[24]; - char PlayerColor[16]; - char PlayerSkin[24]; -} settings_t; - -// Whole structure is just dumped to a binary file when settings are saved. -settings_t launchersettings; - -#define APPTITLE "Official Sonic Robo Blast 2 Launcher" -#define APPVERSION "v0.1" -#define APPAUTHOR "SSNTails" -#define APPCOMPANY "Sonic Team Junior" - -LRESULT CALLBACK MainProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); - -// -// RunSRB2 -// -// Runs SRB2 -// returns true if successful -// -BOOL RunSRB2(void) -{ - SHELLEXECUTEINFO lpExecInfo; - BOOL result; - char EXEName[1024]; - - memset(&lpExecInfo, 0, sizeof(SHELLEXECUTEINFO)); - - lpExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); - - SendMessage(GetDlgItem(mainHWND, IDC_EXENAME), WM_GETTEXT, sizeof(EXEName), (LPARAM)(LPCSTR)EXEName); - lpExecInfo.lpFile = EXEName; - lpExecInfo.lpParameters = Arguments; - lpExecInfo.nShow = SW_SHOWNORMAL; - lpExecInfo.hwnd = mainHWND; - lpExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS; - lpExecInfo.lpVerb = "open"; - - result = ShellExecuteEx(&lpExecInfo); - - if(!result) - { - MessageBox(mainHWND, "Error starting the game!", "Error", MB_OK|MB_APPLMODAL|MB_ICONERROR); - return false; - } - - return true; -} - -// -// ChooseEXEName -// -// Provides a common dialog box -// for selecting the desired executable. -// -void ChooseEXEName(void) -{ - OPENFILENAME ofn; - char FileBuffer[256]; - - ZeroMemory(&ofn, sizeof(ofn)); - ofn.hwndOwner = NULL; - FileBuffer[0] = '\0'; - ofn.lpstrFilter = "Executable Files\0*.exe\0All Files\0*.*\0\0"; - ofn.lpstrInitialDir = NULL; - ofn.lpstrFile = FileBuffer; - ofn.lStructSize = sizeof(ofn); - ofn.nMaxFile = sizeof(FileBuffer); - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = 0; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - - if(GetOpenFileName(&ofn)) - { - SendMessage(GetDlgItem(mainHWND, IDC_EXENAME), WM_SETTEXT, 0, (LPARAM)(LPCSTR)FileBuffer); - strcpy(launchersettings.EXEName, FileBuffer); - } -} - -// -// ChooseConfigName -// -// Provides a common dialog box -// for selecting the desired cfg file. -// -void ChooseConfigName(void) -{ - OPENFILENAME ofn; - char FileBuffer[256]; - - ZeroMemory(&ofn, sizeof(ofn)); - ofn.hwndOwner = NULL; - FileBuffer[0] = '\0'; - ofn.lpstrFilter = "Config Files\0*.cfg\0All Files\0*.*\0\0"; - ofn.lpstrInitialDir = NULL; - ofn.lpstrFile = FileBuffer; - ofn.lStructSize = sizeof(ofn); - ofn.nMaxFile = sizeof(FileBuffer); - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = 0; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - - if(GetOpenFileName(&ofn)) - { - SendMessage(GetDlgItem(mainHWND, IDC_CONFIGFILE), WM_SETTEXT, 0, (LPARAM)(LPCSTR)FileBuffer); - strcpy(launchersettings.ConfigFile, FileBuffer); - } -} - -// -// Add External File -// -// Provides a common dialog box -// for adding an external file. -// -void AddExternalFile(void) -{ - OPENFILENAME ofn; - char FileBuffer[256]; - - ZeroMemory(&ofn, sizeof(ofn)); - ofn.hwndOwner = NULL; - FileBuffer[0] = '\0'; - ofn.lpstrFilter = "WAD/SOC Files\0*.soc;*.wad\0All Files\0*.*\0\0"; - ofn.lpstrInitialDir = NULL; - ofn.lpstrFile = FileBuffer; - ofn.lStructSize = sizeof(ofn); - ofn.nMaxFile = sizeof(FileBuffer); - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = 0; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - - if(GetOpenFileName(&ofn) && SendMessage(GetDlgItem(mainHWND, IDC_EXTFILECOMBO), CB_FINDSTRING, -1, (LPARAM)(LPCSTR)FileBuffer) == CB_ERR) - SendMessage(GetDlgItem(mainHWND, IDC_EXTFILECOMBO), CB_ADDSTRING, 0, (LPARAM)(LPCSTR)FileBuffer); -} - -// -// CompileArguments -// -// Go through ALL of the settings -// and put them into a parameter -// string. Yikes! -// -void CompileArguments(void) -{ - HWND temp; - int numitems; - int i; - - // Clear out the arguments, if any existed. - memset(Arguments, 0, sizeof(Arguments)); - - - // WAD/SOC Files Added - temp = GetDlgItem(mainHWND, IDC_EXTFILECOMBO); - - if ((numitems = SendMessage(temp, CB_GETCOUNT, 0, 0)) > 0) - { - char tempbuffer[1024]; - - strcpy(Arguments, "-file "); - - for (i = 0; i < numitems; i++) - { - SendMessage(temp, CB_GETLBTEXT, i, (LPARAM)(LPCSTR)tempbuffer); - strcat(Arguments, tempbuffer); - strcat(Arguments, " "); - } - } - - // Manual Parameters - temp = GetDlgItem(mainHWND, IDC_PARAMETERS); - - if (SendMessage(temp, WM_GETTEXTLENGTH, 0, 0) > 0) - { - char tempbuffer[8192]; - - SendMessage(temp, WM_GETTEXT, 8192, (LPARAM)(LPCSTR)tempbuffer); - - strcat(Arguments, tempbuffer); - } -} - -// -// GetConfigVariable -// -// Pulls a value out of the chosen -// config.cfg and places it into the -// string supplied in 'dest' -// -BOOL GetConfigVariable(char* varname, char* dest) -{ - FILE* f; - int size = 0; - char* buffer; - char* posWeWant; - char* stringstart; - char varnamecpy[256]; - - varnamecpy[0] = '\n'; - - strncpy(varnamecpy+1, varname, 255); - - if(!(f = fopen(launchersettings.ConfigFile, "rb"))) - return false; // Oops! - - // Get file size - while(!feof(f)) - { - size++; - fgetc(f); - } - - fseek(f, 0, SEEK_SET); - - buffer = (char*)malloc(size); - - fread(buffer, size, 1, f); - fclose(f); - - posWeWant = strstr(buffer, varname); - - if(posWeWant == NULL) - { - free(buffer); - return false; - } - - posWeWant++; - - // We are now at the line we want. - // Get the variable from it - - while(*posWeWant != '\"') posWeWant++; - - posWeWant++; - - stringstart = posWeWant; - - while(*posWeWant != '\"') posWeWant++; - - *posWeWant = '\0'; - - strcpy(dest, stringstart); - - free(buffer); - - // Phew! - return true; -} - -SOCKET ConnectSocket(char* IPAddress, int portnumber) -{ - DWORD dwDestAddr; - SOCKADDR_IN sockAddrDest; - SOCKET sockDest; - - // Create socket - sockDest = socket(AF_INET, SOCK_STREAM, 0); - - if(sockDest == SOCKET_ERROR) - { -// printf("Could not create socket: %d\n", WSAGetLastError()); - return INVALID_SOCKET; - } - - // Convert address to in_addr (binary) format - dwDestAddr = inet_addr(IPAddress); - - if(dwDestAddr == INADDR_NONE) - { - // It's not a xxx.xxx.xxx.xxx IP, so resolve through DNS - struct hostent* pHE = gethostbyname(IPAddress); - if(pHE == 0) - { -// printf("Unable to resolve address.\n"); - return INVALID_SOCKET; - } - - dwDestAddr = *((u_long*)pHE->h_addr_list[0]); - } - - // Initialize SOCKADDR_IN with IP address, port number and address family - memcpy(&sockAddrDest.sin_addr, &dwDestAddr, sizeof(DWORD)); - - sockAddrDest.sin_port = htons(portnumber); - sockAddrDest.sin_family = AF_INET; - - // Attempt to connect to server - if(connect(sockDest, (LPSOCKADDR)&sockAddrDest, sizeof(sockAddrDest)) == SOCKET_ERROR) - { -// printf("Could not connect to server socket: %d\n", WSAGetLastError()); - closesocket(sockDest); - return INVALID_SOCKET; - } - - return sockDest; -} - -// -// MS_Write(): -// -static int MS_Write(msg_t *msg, SOCKET socket) -{ -#ifdef NONET - msg = NULL; - return MS_WRITE_ERROR; -#else - int len; - - if (msg->length < 0) - msg->length = (long)strlen(msg->buffer); - len = msg->length + HEADER_SIZE; - - msg->type = htonl(msg->type); - msg->length = htonl(msg->length); - - if (send(socket, (char *)msg, len, 0) != len) - return MS_WRITE_ERROR; - return 0; -#endif -} - -// -// MS_Read(): -// -static int MS_Read(msg_t *msg, SOCKET socket) -{ -#ifdef NONET - msg = NULL; - return MS_READ_ERROR; -#else - if (recv(socket, (char *)msg, HEADER_SIZE, 0) != HEADER_SIZE) - return MS_READ_ERROR; - - msg->type = ntohl(msg->type); - msg->length = ntohl(msg->length); - - if (!msg->length) // fix a bug in Windows 2000 - return 0; - - if (recv(socket, (char *)msg->buffer, msg->length, 0) != msg->length) - return MS_READ_ERROR; - return 0; -#endif -} - -/** Gets a list of game servers from the master server. - */ -static inline int GetServersList(SOCKET socket) -{ - msg_t msg; - int count = 0; - - msg.type = GET_SERVER_MSG; - msg.length = 0; - if (MS_Write(&msg, socket) < 0) - return MS_WRITE_ERROR; - - while (MS_Read(&msg, socket) >= 0) - { - if (!msg.length) - { -// if (!count) -// printf("No server currently running.\n"); - return MS_NO_ERROR; - } - count++; - printf(msg.buffer); - } - - return MS_READ_ERROR; -} - -// -// RunSocketStuff -// -// Thread that checks the masterserver for new games. -void RunSocketStuff(HWND hListView) -{ - WSADATA wsaData; - SOCKET sock; - int i = 0; - char ServerAddressAndPort[256]; - char Address[256]; - char Port[8]; - - if(!GetConfigVariable("masterserver", ServerAddressAndPort)) // srb2.servegame.org:28900 - { - ServerlistThread = NULL; - return; - } - - strcpy(Address, ServerAddressAndPort); - - for(i = 0; i < (signed)strlen(Address); i++) - { - if(Address[i] == ':') - { - Address[i] = '\0'; - break; - } - } - - for(i = 0; i < (signed)strlen(ServerAddressAndPort); i++) - { - if(ServerAddressAndPort[i] == ':') - { - strcpy(Port, &ServerAddressAndPort[i+1]); - break; - } - } - - // Address now contains the hostname or IP - // Port now contains the port number - - - // Initialize WinSock - if(WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) - { -// printf("Could not initialize sockets.\n"); - ServerlistThread = NULL; - return; - } - - // Create socket and connect to server - sock = ConnectSocket(/*IPAddress*/0, /*PortNumber*/0); - if(sock == INVALID_SOCKET) - { -// printf("Socket Error: %d\n", WSAGetLastError()); - ServerlistThread = NULL; - return; - } - - // We're connected! - // Now get information from server - - - // Add games to listview box. - ListView_DeleteAllItems(hListView); - -/* - while (MoreServersStillExist) - { - GetTheNextServerInformation(); - AddItemToList(hListView, servername, ping, players, gametype, level); - } -*/ - - // close socket - closesocket(sock); - - // Clean up WinSock - if(WSACleanup() == SOCKET_ERROR) - { -// printf("Could not cleanup sockets: %d\n", WSAGetLastError()); - ServerlistThread = NULL; - return; - } - - printf("Winsock thread terminated successfully.\n"); - ServerlistThread = NULL; - - return; -} - -BOOL GetGameList(HWND hListView) -{ - DWORD dwThreadID; - ServerlistThread = CreateThread( NULL, // default security - 0, // default stack - (LPTHREAD_START_ROUTINE)(void*)RunSocketStuff, // thread function - hListView, // arguments - 0, // default flags - &dwThreadID); // don't need this, but it makes it happy (and compatible with old Win32 OSes) - - if(ServerlistThread == NULL) - return false; - - return true; -} - -void RegisterDialogClass(char* name, WNDPROC callback) -{ - WNDCLASS wnd; - - wnd.style = CS_HREDRAW | CS_VREDRAW; - wnd.cbWndExtra = DLGWINDOWEXTRA; - wnd.cbClsExtra = 0; - wnd.hCursor = LoadCursor(NULL,MAKEINTRESOURCE(IDC_ARROW)); - wnd.hIcon = LoadIcon(NULL,MAKEINTRESOURCE(IDI_ICON1)); - wnd.hInstance = g_hInst; - wnd.lpfnWndProc = callback; - wnd.lpszClassName = name; - wnd.lpszMenuName = NULL; - wnd.hbrBackground = (HBRUSH)(COLOR_WINDOW); - - if(!RegisterClass(&wnd)) - { - return; - } -} - -int APIENTRY WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow) -{ - // Prevent multiples instances of this app. - CreateMutex(NULL, true, APPTITLE); - - if(GetLastError() == ERROR_ALREADY_EXISTS) - return 0; - - g_hInst = hInstance; - - RegisterDialogClass("SRB2Launcher", MainProc); - - DialogBox(g_hInst, (LPCSTR)IDD_MAIN, NULL, (DLGPROC)MainProc); - - return 0; -} - -// -// InitHostOptionsComboBoxes -// -// Does what it says. -// -void InitHostOptionsComboBoxes(HWND hwnd) -{ - HWND ctrl; - - ctrl = GetDlgItem(hwnd, IDC_MATCHBOXES); - - if(ctrl) - { - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Normal (Default)"); - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Random"); - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Non-Random"); - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"None"); - } - - ctrl = GetDlgItem(hwnd, IDC_RACEITEMBOXES); - - if(ctrl) - { - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Normal (Default)"); - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Random"); - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Teleports"); - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"None"); - } - - ctrl = GetDlgItem(hwnd, IDC_MATCH_SCORING); - - if(ctrl) - { - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Normal (Default)"); - SendMessage(ctrl, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Classic"); - } -} - -LRESULT CALLBACK MatchOptionsDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch(message) - { - case WM_INITDIALOG: - InitHostOptionsComboBoxes(hwnd); - break; - - case WM_DESTROY: - EndDialog(hwnd, LOWORD(wParam)); - break; - - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case 2: - PostMessage(hwnd, WM_DESTROY, 0, 0); - break; - default: - break; - } - - break; - } - } - - return 0; -} - -LRESULT CALLBACK RaceOptionsDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch(message) - { - case WM_INITDIALOG: - InitHostOptionsComboBoxes(hwnd); - break; - - case WM_DESTROY: - EndDialog(hwnd, LOWORD(wParam)); - break; - - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case 2: - PostMessage(hwnd, WM_DESTROY, 0, 0); - break; - default: - break; - } - - break; - } - } - - return 0; -} - -LRESULT CALLBACK TagOptionsDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch(message) - { - case WM_INITDIALOG: - InitHostOptionsComboBoxes(hwnd); - break; - - case WM_DESTROY: - EndDialog(hwnd, LOWORD(wParam)); - break; - - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case 2: - PostMessage(hwnd, WM_DESTROY, 0, 0); - break; - default: - break; - } - - break; - } - } - - return 0; -} - -LRESULT CALLBACK CTFOptionsDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch(message) - { - case WM_INITDIALOG: - InitHostOptionsComboBoxes(hwnd); - break; - - case WM_DESTROY: - EndDialog(hwnd, LOWORD(wParam)); - break; - - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case 2: - PostMessage(hwnd, WM_DESTROY, 0, 0); - break; - default: - break; - } - - break; - } - } - - return 0; -} - -LRESULT CALLBACK HostProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - HWND temp; - - switch(message) - { - case WM_INITDIALOG: - hostHWND = hwnd; - - temp = GetDlgItem(hwnd, IDC_ADVANCEMAP); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Off"); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Next (Default)"); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Random"); - - temp = GetDlgItem(hwnd, IDC_GAMETYPE); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Coop"); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Match"); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Team Match"); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Race"); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Time-Only Race"); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Tag"); - SendMessage(temp, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"CTF"); - - break; - - case WM_CREATE: - { - - break; - } - - case WM_DESTROY: - { - hostHWND = NULL; - EndDialog(hwnd, LOWORD(wParam)); - break; - } - - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case 2: - PostMessage(hwnd, WM_DESTROY, 0, 0); - break; - case IDC_OPTIONS: - { - int gametype; - int dialognum; - DLGPROC callbackfunc; - - // Grab the current gametype from the IDC_GAMETYPE - // combo box and then display the appropriate - // options dialog. - temp = GetDlgItem(hostHWND, IDC_GAMETYPE); - switch(SendMessage(temp, CB_GETCURSEL, 0, 0)) - { - case 0: - gametype = 0; - break; - case 1: - gametype = 1; - break; - case 2: - gametype = 1; - break; - case 3: - gametype = 2; - break; - case 4: - gametype = 2; - break; - case 5: - gametype = 3; - break; - case 6: - gametype = 4; - break; - } - - switch(gametype) - { - case 1: - dialognum = IDD_MATCHOPTIONS; - callbackfunc = (DLGPROC)MatchOptionsDlgProc; - break; - case 2: - dialognum = IDD_RACEOPTIONS; - callbackfunc = (DLGPROC)RaceOptionsDlgProc; - break; - case 3: - dialognum = IDD_TAGOPTIONS; - callbackfunc = (DLGPROC)TagOptionsDlgProc; - break; - case 4: - dialognum = IDD_CTFOPTIONS; - callbackfunc = (DLGPROC)CTFOptionsDlgProc; - break; - case 0: - default: // ??? - dialognum = 0; - callbackfunc = NULL; - MessageBox(hostHWND, "This gametype does not have any additional options.", "Not Available", MB_OK|MB_APPLMODAL); - break; - } - - if(dialognum) - DialogBox(g_hInst, (LPCSTR)dialognum, hostHWND, callbackfunc); - } - break; - default: - break; - } - - break; - } - - case WM_PAINT: - { - break; - } - } - - return 0; -} - -// -// AddItemToList -// -// Adds a game to the list view. -// -void AddItemToList(HWND hListView, char* servername, - char* ping, char* players, - char* gametype, char* level) -{ - LVITEM lvTest; - - lvTest.mask = LVIF_TEXT | LVIF_STATE; - - lvTest.pszText = servername; - lvTest.iIndent = 0; - lvTest.stateMask = 0; - lvTest.state = 0; - - lvTest.iSubItem = 0; - lvTest.iItem = ListView_InsertItem(hListView, &lvTest); - - ListView_SetItemText(hListView,lvTest.iItem,1,ping); - - ListView_SetItemText(hListView,lvTest.iItem,2,players); - - ListView_SetItemText(hListView,lvTest.iItem,3,gametype); - - ListView_SetItemText(hListView,lvTest.iItem,4,level); -} - -// -// InitJoinGameColumns -// -// Initializes the column headers on the listview control -// on the Join Game page. -// -void InitJoinGameColumns(HWND hDlg) -{ - HWND hItemList; - LVCOLUMN columns[10]; - int i = 0; - - //Create the columns in the list control - hItemList = GetDlgItem(hDlg, IDC_GAMELIST); - - columns[i].mask = LVCF_TEXT | LVCF_WIDTH; - columns[i].pszText = "Server Name"; - columns[i].cchTextMax = 256; - columns[i].cx = 120; - columns[i].fmt = LVCFMT_LEFT; - ListView_InsertColumn(hItemList, i, &columns[i]); - - i++; - - columns[i].mask = LVCF_TEXT | LVCF_WIDTH; - columns[i].pszText = "Ping"; - columns[i].cchTextMax = 256; - columns[i].cx = 80; - columns[i].fmt = LVCFMT_LEFT; - ListView_InsertColumn(hItemList, i, &columns[i]); - - i++; - - columns[i].mask = LVCF_TEXT | LVCF_WIDTH; - columns[i].pszText = "Players"; - columns[i].cchTextMax = 256; - columns[i].cx = 80; - columns[i].fmt = LVCFMT_LEFT; - ListView_InsertColumn(hItemList, i, &columns[i]); - - i++; - - columns[i].mask = LVCF_TEXT | LVCF_WIDTH; - columns[i].pszText = "Game Type"; - columns[i].cchTextMax = 256; - columns[i].cx = 80; - columns[i].fmt = LVCFMT_LEFT; - ListView_InsertColumn(hItemList, i, &columns[i]); - - i++; - - columns[i].mask = LVCF_TEXT | LVCF_WIDTH; - columns[i].pszText = "Level"; - columns[i].cchTextMax = 256; - columns[i].cx = 120; - columns[i].fmt = LVCFMT_LEFT; - ListView_InsertColumn(hItemList, i, &columns[i]); -} - -LRESULT CALLBACK JoinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch(message) - { - case WM_INITDIALOG: - joinHWND = hwnd; - InitJoinGameColumns(hwnd); - // Start server listing thread - // and grab game list. - GetGameList(GetDlgItem(hwnd, IDC_GAMELIST)); - break; - - case WM_DESTROY: - joinHWND = NULL; - // Terminate server listing thread. - EndDialog(hwnd, LOWORD(wParam)); - break; - - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case 2: - PostMessage(hwnd, WM_DESTROY, 0, 0); - break; - case IDC_SEARCHGAMES: - if(ServerlistThread == NULL) - GetGameList(GetDlgItem(hwnd, IDC_GAMELIST)); - break; - default: - break; - } - - break; - } - - case WM_PAINT: - { - break; - } - } - - return 0; -} - -void InitializeDefaults(void) -{ - memset(&launchersettings, 0, sizeof(launchersettings)); - strcpy(launchersettings.EXEName, "srb2win.exe"); - strcpy(launchersettings.ConfigFile, "config.cfg"); -} - -LRESULT CALLBACK MainProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - HWND temp; - - switch(message) - { - case WM_INITDIALOG: - mainHWND = hwnd; - InitializeDefaults(); - SendMessage(GetDlgItem(hwnd, IDC_EXENAME), WM_SETTEXT, 0, (LPARAM)(LPCSTR)launchersettings.EXEName); - SendMessage(GetDlgItem(hwnd, IDC_CONFIGFILE), WM_SETTEXT, 0, (LPARAM)(LPCSTR)launchersettings.ConfigFile); - break; - - case WM_CREATE: - { - - break; - } - - case WM_DESTROY: - { - PostQuitMessage(0); - break; - } - - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case 2: - PostMessage(hwnd, WM_DESTROY, 0, 0); - break; - case IDC_ABOUT: // The About button. - sprintf(TempString, "%s %s by %s - %s", APPTITLE, APPVERSION, APPAUTHOR, APPCOMPANY); - MessageBox(mainHWND, TempString, "About", MB_OK|MB_APPLMODAL); - break; - case IDC_FINDEXENAME: - ChooseEXEName(); - break; - case IDC_FINDCONFIGNAME: - ChooseConfigName(); - break; - case IDC_ADDFILE: - AddExternalFile(); - break; - case IDC_REMOVEFILE: - temp = GetDlgItem(mainHWND, IDC_EXTFILECOMBO); - SendMessage(temp, CB_DELETESTRING, SendMessage(temp, CB_GETCURSEL, 0, 0), 0); - break; - case IDC_HOSTGAME: - DialogBox(g_hInst, (LPCSTR)IDD_HOSTGAME, mainHWND, (DLGPROC)HostProc); - break; - case IDC_JOINGAME: - DialogBox(g_hInst, (LPCSTR)IDD_JOINGAME, mainHWND, (DLGPROC)JoinProc); - break; - case IDC_GO: - CompileArguments(); - RunSRB2(); - break; - default: - break; - } - - break; - } - - case WM_PAINT: - { - break; - } - } - - return 0; -} - diff --git a/tools/SRB2Launcher/SRB2Launcher.dsp b/tools/SRB2Launcher/SRB2Launcher.dsp deleted file mode 100644 index 386dc301c..000000000 --- a/tools/SRB2Launcher/SRB2Launcher.dsp +++ /dev/null @@ -1,144 +0,0 @@ -# Microsoft Developer Studio Project File - Name="SRB2Launcher" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=SRB2Launcher - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "SRB2Launcher.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "SRB2Launcher.mak" CFG="SRB2Launcher - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "SRB2Launcher - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "SRB2Launcher - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "SRB2Launcher - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:windows /machine:I386 - -!ELSEIF "$(CFG)" == "SRB2Launcher - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "SRB2Launcher - Win32 Release" -# Name "SRB2Launcher - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\SRB2Launcher.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\lilsocklib.h -# End Source File -# Begin Source File - -SOURCE=.\resource.h -# End Source File -# Begin Source File - -SOURCE=.\SRB2Launcher.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\bitmap1.bmp -# End Source File -# Begin Source File - -SOURCE=.\icon1.ico -# End Source File -# Begin Source File - -SOURCE=.\Script1.rc -# End Source File -# End Group -# Begin Source File - -SOURCE=.\ReadMe.txt -# End Source File -# End Target -# End Project diff --git a/tools/SRB2Launcher/SRB2Launcher.dsw b/tools/SRB2Launcher/SRB2Launcher.dsw deleted file mode 100644 index b716faced..000000000 --- a/tools/SRB2Launcher/SRB2Launcher.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "SRB2Launcher"=.\SRB2Launcher.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/tools/SRB2Launcher/SRB2Launcher.h b/tools/SRB2Launcher/SRB2Launcher.h deleted file mode 100644 index 3b9049f82..000000000 --- a/tools/SRB2Launcher/SRB2Launcher.h +++ /dev/null @@ -1,8 +0,0 @@ -extern char TempString[256]; -extern char EXEName[1024]; -extern char Arguments[16384]; - -#define APPTITLE "Official Sonic Robo Blast 2 Launcher" -#define APPVERSION "v0.1" -#define APPAUTHOR "SSNTails" -#define APPCOMPANY "Sonic Team Junior" diff --git a/tools/SRB2Launcher/Script1.rc b/tools/SRB2Launcher/Script1.rc deleted file mode 100644 index 1a27c0414..000000000 --- a/tools/SRB2Launcher/Script1.rc +++ /dev/null @@ -1,355 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_MAIN DIALOG DISCARDABLE 0, 0, 272, 226 -STYLE DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "Official Sonic Robo Blast 2 Launcher v0.1" -FONT 8, "MS Sans Serif" -BEGIN - COMBOBOX IDC_LAUNCHCONFIG,125,15,135,155,CBS_DROPDOWNLIST | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX "Saved Launch Configuration",IDC_STATIC,120,5,145,45 - GROUPBOX "WAD/SOC Files",IDC_STATIC,120,55,145,45 - COMBOBOX IDC_EXTFILECOMBO,125,65,135,95,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - CONTROL 102,IDC_STATIC,"Static",SS_BITMAP,5,90,107,79 - PUSHBUTTON "&About",IDC_ABOUT,125,210,25,10 - DEFPUSHBUTTON "&Go!",IDC_GO,60,150,50,14 - PUSHBUTTON "Add",IDC_ADDFILE,225,80,35,15 - PUSHBUTTON "Remove",IDC_REMOVEFILE,185,80,35,15 - PUSHBUTTON "Save",IDC_SAVELAUNCHCFG,220,30,40,15 - GROUPBOX "Multiplayer",IDC_STATIC,5,5,105,50 - PUSHBUTTON "&Join A Game",IDC_JOINGAME,10,15,50,15 - PUSHBUTTON "&Host A Game",IDC_HOSTGAME,55,35,50,15 - EDITTEXT IDC_PARAMETERS,160,190,105,30,ES_MULTILINE | - ES_AUTOVSCROLL | WS_VSCROLL - RTEXT "Manual Parameters:",IDC_STATIC,115,190,40,15 - GROUPBOX "Executable Name",IDC_STATIC,120,105,145,50 - EDITTEXT IDC_EXENAME,125,115,95,12,ES_AUTOHSCROLL - PUSHBUTTON "Choose...",IDC_FINDEXENAME,225,115,35,10 - PUSHBUTTON "General &Options",IDC_OPTIONS,55,60,50,20,BS_MULTILINE - EDITTEXT IDC_CONFIGFILE,125,140,95,12,ES_AUTOHSCROLL - LTEXT "Configuration File:",IDC_STATIC,125,130,60,10 - PUSHBUTTON "Choose...",IDC_FINDCONFIGNAME,225,140,35,10 - CONTROL "List1",IDC_LIST1,"SysListView32",WS_BORDER | WS_TABSTOP, - 20,180,85,40 -END - -IDD_JOINGAME DIALOG DISCARDABLE 0, 0, 367, 166 -STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "Join Game" -FONT 8, "MS Sans Serif" -BEGIN - PUSHBUTTON "&Refresh List",IDC_SEARCHGAMES,5,140,55,20,BS_MULTILINE - CONTROL "List1",IDC_GAMELIST,"SysListView32",LVS_REPORT | - LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,5,15,240,120 - EDITTEXT IDC_NAME,295,10,65,12,ES_AUTOHSCROLL - COMBOBOX IDC_COLOR,295,30,65,130,CBS_DROPDOWNLIST | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - RTEXT "Name:",IDC_STATIC,265,10,25,10 - RTEXT "Color:",IDC_STATIC,265,30,25,10 - COMBOBOX IDC_SKIN,295,50,65,110,CBS_DROPDOWNLIST | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - RTEXT "Character:",IDC_STATIC,255,50,35,10 - EDITTEXT IDC_ADDRESS,255,115,70,12,ES_AUTOHSCROLL - LTEXT "Manual Address:",IDC_STATIC,255,105,60,10 - CONTROL "Don't check server for files.",IDC_NOFILE,"Button", - BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,255,70,105, - 10 - DEFPUSHBUTTON "&Go!",IDC_JOINSTART,330,115,30,15 - LTEXT "Double-Click on a game to join:",IDC_STATIC,5,5,215,10 - CONTROL "Don't download files",IDC_NODOWNLOAD,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,255,90,105,10 -END - -IDD_HOSTGAME DIALOG DISCARDABLE 0, 0, 287, 156 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Host Game" -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Game Type",IDC_STATIC,5,5,110,65 - PUSHBUTTON "&Options...",IDC_OPTIONS,55,30,40,15 - COMBOBOX IDC_GAMETYPE,10,15,85,100,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - RTEXT "Max # of players:",IDC_STATIC,35,86,70,10 - EDITTEXT IDC_MAXPLAYERS,110,86,20,12,ES_AUTOHSCROLL - GROUPBOX "General Options",IDC_STATIC,5,75,275,75 - COMBOBOX IDC_STARTMAP,40,50,70,95,CBS_DROPDOWN | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - RTEXT "Start on map #:",IDC_STATIC,10,45,25,20 - CONTROL "Force players to use host's character",IDC_FORCESKIN, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,140, - 85,135,10 - COMBOBOX IDC_ADVANCEMAP,45,105,85,50,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - RTEXT "Advance Stage:",IDC_STATIC,10,100,30,20 - CONTROL "Don't advertise server on Internet",IDC_INTERNETSERVER, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,140, - 130,120,10 - RTEXT "Intermission Delay Between Levels (in seconds):", - IDC_STATIC,10,125,90,15 - EDITTEXT IDC_INTTIME,105,130,20,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Don't allow autoaim",IDC_DISABLEAUTOAIM,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,140,100,75,10 - CONTROL "Disable WAD/SOC Downloading",IDC_NODOWNLOAD,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,140,115,120,10 - PUSHBUTTON "Monitor &Toggles...",IDC_MONITORTOGGLES,125,45,40,20, - BS_MULTILINE -END - -IDD_MATCHOPTIONS DIALOG DISCARDABLE 0, 0, 142, 141 -STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "Match Options" -FONT 8, "MS Sans Serif" -BEGIN - CONTROL "Don't use special ring weapons.",IDC_SPECIALRINGS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,5,115,10 - RTEXT "Item Box Behavior:",IDC_STATIC,5,50,60,10 - EDITTEXT IDC_RESPAWNITEMTIME,115,70,20,12,ES_AUTOHSCROLL | - ES_NUMBER - COMBOBOX IDC_MATCHBOXES,70,50,65,65,CBS_DROPDOWN | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - RTEXT "Item Respawn Time (in seconds):",IDC_STATIC,5,70,105,10 - EDITTEXT IDC_TIMELIMIT,115,84,20,12,ES_AUTOHSCROLL | ES_NUMBER - RTEXT "Time Limit (in minutes):",IDC_STATIC,35,84,75,10 - RTEXT "Point Limit:",IDC_STATIC,70,100,40,10 - EDITTEXT IDC_POINTLIMIT,115,100,20,12,ES_AUTOHSCROLL | ES_NUMBER - CONTROL "Sudden Death Mode",IDC_SUDDENDEATH,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,15,20,80,10 - COMBOBOX IDC_MATCH_SCORING,70,35,65,65,CBS_DROPDOWNLIST | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - RTEXT "Scoring Type:",IDC_STATIC,15,35,50,10 - PUSHBUTTON "Cance&l",IDC_CANCEL,100,120,35,15 - DEFPUSHBUTTON "O&K",IDC_OK,60,120,35,15 -END - -IDD_RACEOPTIONS DIALOG DISCARDABLE 0, 0, 142, 71 -STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "Race Options" -FONT 8, "MS Sans Serif" -BEGIN - RTEXT "Item Box Behavior:",IDC_STATIC,5,10,60,10 - COMBOBOX IDC_RACEITEMBOXES,70,10,65,55,CBS_DROPDOWNLIST | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_NUMLAPS,115,30,20,12,ES_AUTOHSCROLL | ES_NUMBER - RTEXT "Number of Laps:",IDC_STATIC,55,30,55,10 - PUSHBUTTON "Cance&l",IDC_CANCEL,100,50,35,15 - DEFPUSHBUTTON "O&K",IDC_OK,60,50,35,15 -END - -IDD_CTFOPTIONS DIALOG DISCARDABLE 0, 0, 142, 126 -STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "CTF Options" -FONT 8, "MS Sans Serif" -BEGIN - CONTROL "Don't use special ring weapons.",IDC_SPECIALRINGS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,5,115,10 - RTEXT "Item Box Behavior:",IDC_STATIC,5,20,60,10 - COMBOBOX IDC_MATCHBOXES,70,20,65,60,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - RTEXT "Item Respawn Time (in seconds):",IDC_STATIC,5,40,105,10 - EDITTEXT IDC_RESPAWNITEMTIME,115,40,20,12,ES_AUTOHSCROLL | - ES_NUMBER - RTEXT "Time Limit (in minutes):",IDC_STATIC,35,70,75,10 - EDITTEXT IDC_TIMELIMIT,115,70,20,12,ES_AUTOHSCROLL | ES_NUMBER - RTEXT "Point Limit:",IDC_STATIC,70,86,40,10 - EDITTEXT IDC_POINTLIMIT,115,86,20,12,ES_AUTOHSCROLL | ES_NUMBER - RTEXT "Flag Respawn Time (in seconds):",IDC_STATIC,5,55,105,10 - EDITTEXT IDC_FLAGTIME,115,55,20,12,ES_AUTOHSCROLL | ES_NUMBER - PUSHBUTTON "Cance&l",IDC_CANCEL,100,105,35,15 - DEFPUSHBUTTON "O&K",IDC_OK,60,105,35,15 -END - -IDD_TAGOPTIONS DIALOG DISCARDABLE 0, 0, 142, 111 -STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "Tag Options" -FONT 8, "MS Sans Serif" -BEGIN - CONTROL "Don't use special ring weapons.",IDC_SPECIALRINGS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,5,115,10 - COMBOBOX IDC_MATCHBOXES,70,20,65,60,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - RTEXT "Item Box Behavior:",IDC_STATIC,5,20,60,10 - DEFPUSHBUTTON "O&K",IDC_OK,60,90,35,15 - PUSHBUTTON "Cance&l",IDC_CANCEL,100,90,35,15 - RTEXT "Item Respawn Time (in seconds):",IDC_STATIC,5,40,105,10 - EDITTEXT IDC_RESPAWNITEMTIME,115,40,20,12,ES_AUTOHSCROLL | - ES_NUMBER - RTEXT "Time Limit (in minutes):",IDC_STATIC,35,55,75,10 - EDITTEXT IDC_TIMELIMIT,115,55,20,12,ES_AUTOHSCROLL | ES_NUMBER - RTEXT "Point Limit:",IDC_STATIC,70,70,40,10 - EDITTEXT IDC_POINTLIMIT,115,70,20,12,ES_AUTOHSCROLL | ES_NUMBER -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_MAIN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 265 - TOPMARGIN, 7 - BOTTOMMARGIN, 219 - END - - IDD_JOINGAME, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 360 - TOPMARGIN, 7 - BOTTOMMARGIN, 159 - END - - IDD_HOSTGAME, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 280 - TOPMARGIN, 7 - BOTTOMMARGIN, 149 - END - - IDD_MATCHOPTIONS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 135 - TOPMARGIN, 7 - BOTTOMMARGIN, 134 - END - - IDD_RACEOPTIONS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 135 - TOPMARGIN, 7 - BOTTOMMARGIN, 64 - END - - IDD_CTFOPTIONS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 135 - TOPMARGIN, 7 - BOTTOMMARGIN, 119 - END - - IDD_TAGOPTIONS, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 135 - TOPMARGIN, 7 - BOTTOMMARGIN, 104 - END -END -#endif // APSTUDIO_INVOKED - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -IDB_BITMAP1 BITMAP DISCARDABLE "bitmap1.bmp" - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_ICON1 ICON DISCARDABLE "icon1.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog Info -// - -IDD_JOINGAME DLGINIT -BEGIN - IDC_SKIN, 0x403, 6, 0 -0x6f53, 0x696e, 0x0063, - IDC_SKIN, 0x403, 6, 0 -0x6154, 0x6c69, 0x0073, - IDC_SKIN, 0x403, 9, 0 -0x6e4b, 0x6375, 0x6c6b, 0x7365, "\000" - 0 -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/tools/SRB2Launcher/StdAfx.cpp b/tools/SRB2Launcher/StdAfx.cpp deleted file mode 100644 index 444cafebf..000000000 --- a/tools/SRB2Launcher/StdAfx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// SRB2Launcher.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/tools/SRB2Launcher/StdAfx.h b/tools/SRB2Launcher/StdAfx.h deleted file mode 100644 index 549cbf9ee..000000000 --- a/tools/SRB2Launcher/StdAfx.h +++ /dev/null @@ -1,29 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) -#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -#include -#include -#include -#include -#include -#include "lilsocklib.h" -#include "resource.h" - - -// TODO: reference additional headers your program requires here - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/tools/SRB2Launcher/bitmap1.bmp b/tools/SRB2Launcher/bitmap1.bmp deleted file mode 100644 index 01b7cecd9..000000000 Binary files a/tools/SRB2Launcher/bitmap1.bmp and /dev/null differ diff --git a/tools/SRB2Launcher/i_tcp.c b/tools/SRB2Launcher/i_tcp.c deleted file mode 100644 index 259b416d3..000000000 --- a/tools/SRB2Launcher/i_tcp.c +++ /dev/null @@ -1,57 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// MSERV SDK -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// Adapted by Oogaland. -// -// 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. -// -// -// -// DESCRIPTION: -// TCP/IP stuff. -// -//----------------------------------------------------------------------------- - - - - -#include -#include - - -#include "launcher.h" -#include "mserv.h" //Hurdler: support master server - - - - -static int init_tcp_driver = 0; - - -void I_InitTcpDriver(void) -{ - if (!init_tcp_driver) - { -#ifdef __WIN32__ - WSADATA winsockdata; - if( WSAStartup(MAKEWORD(1,1),&winsockdata) ) - I_Error("No Tcp/Ip driver detected"); -#endif -#ifdef __DJGPP_ - if( !__lsck_init() ) - I_Error("No Tcp/Ip driver detected"); -#endif - init_tcp_driver = 1; - } -} diff --git a/tools/SRB2Launcher/i_tcp.h b/tools/SRB2Launcher/i_tcp.h deleted file mode 100644 index 9cd34f930..000000000 --- a/tools/SRB2Launcher/i_tcp.h +++ /dev/null @@ -1,34 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// MSERV SDK -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// Adapted by Oogaland. -// -// 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. -// -// -// -// DESCRIPTION: -// Header file for the TCP/IP routines -// -//----------------------------------------------------------------------------- - - -#ifndef _I_TCP_H_ -#define _I_TCP_H_ - -extern int sock_port; - -void I_InitTcpDriver(void); - -#endif // !defined(_I_TCP_H_) diff --git a/tools/SRB2Launcher/icon1.ico b/tools/SRB2Launcher/icon1.ico deleted file mode 100644 index f54ce0d6a..000000000 Binary files a/tools/SRB2Launcher/icon1.ico and /dev/null differ diff --git a/tools/SRB2Launcher/launcher.c b/tools/SRB2Launcher/launcher.c deleted file mode 100644 index 4967a95cc..000000000 --- a/tools/SRB2Launcher/launcher.c +++ /dev/null @@ -1,19 +0,0 @@ -#include - -#include "launcher.h" - -int WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpvReserved) -{ - return TRUE; -} - - -void CONS_Printf(char *fmt, ...) -{ - MessageBox(NULL, fmt, "Master Server", 0); -} - -void I_Error (char *error, ...) -{ - MessageBox(NULL, error, "Master Server", MB_ICONERROR); -} diff --git a/tools/SRB2Launcher/launcher.h b/tools/SRB2Launcher/launcher.h deleted file mode 100644 index 12b10aad5..000000000 --- a/tools/SRB2Launcher/launcher.h +++ /dev/null @@ -1,34 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// MSERV SDK -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// Adapted by Oogaland. -// -// 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. -// -// -// -// DESCRIPTION: -// Header file for the launcher routines -// -//----------------------------------------------------------------------------- - - -#ifndef _LAUNCHER_H_ -#define _LAUNCHER_H_ - - -void CONS_Printf(char *fmt, ...); -void I_Error (char *error, ...); - -#endif // !defined(_LAUNCHER_H_) diff --git a/tools/SRB2Launcher/lilsocklib.h b/tools/SRB2Launcher/lilsocklib.h deleted file mode 100644 index 232f3753a..000000000 --- a/tools/SRB2Launcher/lilsocklib.h +++ /dev/null @@ -1,52 +0,0 @@ -// Unlike lilsocklib.c, since this takes code from SRB2, -// it is under the GPL, rather than public domain. =( -// -#ifndef __LILSOCKLIB_H__ -#define __LILSOCKLIB_H__ - -#define SD_BOTH 0x02 - -#define PACKET_SIZE 1024 - -#define MS_NO_ERROR 0 -#define MS_SOCKET_ERROR -201 -#define MS_CONNECT_ERROR -203 -#define MS_WRITE_ERROR -210 -#define MS_READ_ERROR -211 -#define MS_CLOSE_ERROR -212 -#define MS_GETHOSTBYNAME_ERROR -220 -#define MS_GETHOSTNAME_ERROR -221 -#define MS_TIMEOUT_ERROR -231 - -// see master server code for the values -#define ADD_SERVER_MSG 101 -#define REMOVE_SERVER_MSG 103 -#ifdef MASTERSERVERS12 -#define ADD_SERVERv2_MSG 104 -#endif -#define GET_SERVER_MSG 200 -#define GET_SHORT_SERVER_MSG 205 -#ifdef MASTERSERVERS12 -#define ASK_SERVER_MSG 206 -#define ANSWER_ASK_SERVER_MSG 207 -#endif - -#define HEADER_SIZE ((long)sizeof (long)*3) - -#define HEADER_MSG_POS 0 -#define IP_MSG_POS 16 -#define PORT_MSG_POS 32 -#define HOSTNAME_MSG_POS 40 - -/** A message to be exchanged with the master server. - */ -typedef struct -{ - long id; ///< Unused? - long type; ///< Type of message. - long length; ///< Length of the message. - char buffer[PACKET_SIZE]; ///< Actual contents of the message. -} msg_t; - -SOCKET ConnectSocket(char* IPAddress); -#endif diff --git a/tools/SRB2Launcher/mserv.c b/tools/SRB2Launcher/mserv.c deleted file mode 100644 index 0dd00e2bb..000000000 --- a/tools/SRB2Launcher/mserv.c +++ /dev/null @@ -1,400 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// MSERV SDK -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// Adapted by Oogaland. -// -// 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. -// -// -// -// DESCRIPTION: -// Commands used to communicate with the master server -// -//----------------------------------------------------------------------------- - - -#ifdef WIN32 -#include // socket(),... -#else -#include -#endif - - - - -#include "launcher.h" - -#include "mserv.h" -#include "i_tcp.h" - - - - - -// ================================ DEFINITIONS =============================== - -#define PACKET_SIZE 1024 - -#define MS_NO_ERROR 0 -#define MS_SOCKET_ERROR -201 -#define MS_CONNECT_ERROR -203 -#define MS_WRITE_ERROR -210 -#define MS_READ_ERROR -211 -#define MS_CLOSE_ERROR -212 -#define MS_GETHOSTBYNAME_ERROR -220 -#define MS_GETHOSTNAME_ERROR -221 -#define MS_TIMEOUT_ERROR -231 - -// see master server code for the values -#define GET_SERVER_MSG 200 - - -#define HEADER_SIZE ((long)sizeof(long)*3) - -#define HEADER_MSG_POS 0 -#define IP_MSG_POS 16 -#define PORT_MSG_POS 32 -#define HOSTNAME_MSG_POS 40 - -#ifndef SOCKET -#define SOCKET int -#endif - -typedef struct { - long id; - long type; - long length; - char buffer[PACKET_SIZE]; -} msg_t; - - -// win32 or djgpp -#if defined( WIN32) || defined( __DJGPP__ ) -#define ioctl ioctlsocket -#define close closesocket -#endif - -#if defined( WIN32) || defined( __OS2__) -// it seems windows doesn't define that... maybe some other OS? OS/2 -int inet_aton(char *hostname, struct in_addr *addr) -{ - return ( (addr->s_addr=inet_addr(hostname)) != INADDR_NONE ); -} -#endif - - - -enum { MSCS_NONE, MSCS_WAITING, MSCS_REGISTERED, MSCS_FAILED } con_state = MSCS_NONE; - - -static SOCKET socket_fd = -1; // TCP/IP socket -static struct sockaddr_in addr; -static struct timeval select_timeout; -static fd_set wset; - -int MS_Connect(char *ip_addr, char *str_port, int async); -static int MS_Read(msg_t *msg); -static int MS_Write(msg_t *msg); -static int MS_GetIP(char *); - -void ExtractServerInfo(char *serverout, struct SERVERLIST *serverlist); - - - - - - - - - - -void CloseConnection(void) -{ - if(socket_fd > 0) close(socket_fd); - socket_fd = -1; -} - - - - -/* -** MS_GetIP() -*/ -static int MS_GetIP(char *hostname) -{ - struct hostent *host_ent; - - if (!inet_aton(hostname, &addr.sin_addr)) { - //TODO: only when we are connected to Internet, or use a non bloking call - host_ent = gethostbyname(hostname); - if (host_ent==NULL) - return MS_GETHOSTBYNAME_ERROR; - memcpy(&addr.sin_addr, host_ent->h_addr_list[0], sizeof(struct in_addr)); - } - return 0; -} - - - - - - -/* -** MS_Connect() -*/ -int MS_Connect(char *ip_addr, char *str_port, int async) -{ - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - I_InitTcpDriver(); // this is done only if not already done - - if ((socket_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) - return MS_SOCKET_ERROR; - - if (MS_GetIP(ip_addr)==MS_GETHOSTBYNAME_ERROR) - return MS_GETHOSTBYNAME_ERROR; - addr.sin_port = htons((u_short)atoi(str_port)); - - if (async) // do asynchronous connection - { - int res = 1; - - ioctl(socket_fd, FIONBIO, &res); - res = connect(socket_fd, (struct sockaddr *) &addr, sizeof(addr)); - if (res < 0) - { - // humm, on win32 it doesn't work with EINPROGRESS (stupid windows) - if (WSAGetLastError() != WSAEWOULDBLOCK) - { - con_state = MSCS_FAILED; - CloseConnection(); - return MS_CONNECT_ERROR; - } - } - con_state = MSCS_WAITING; - FD_ZERO(&wset); - FD_SET(socket_fd, &wset); - select_timeout.tv_sec = 0, select_timeout.tv_usec = 0; - } - else - { - if (connect(socket_fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) - return MS_CONNECT_ERROR; - } - - return 0; -} - - - - - - -/* - * MS_Write(): - */ -static int MS_Write(msg_t *msg) -{ - int len; - - if (msg->length < 0) - msg->length = strlen(msg->buffer); - len = msg->length+HEADER_SIZE; - - //msg->id = htonl(msg->id); - msg->type = htonl(msg->type); - msg->length = htonl(msg->length); - - if (send(socket_fd, (char*)msg, len, 0) != len) - return MS_WRITE_ERROR; - - return 0; -} - - - - - - -/* - * MS_Read(): - */ -static int MS_Read(msg_t *msg) -{ - if (recv(socket_fd, (char*)msg, HEADER_SIZE, 0) != HEADER_SIZE) - return MS_READ_ERROR; - - msg->type = ntohl(msg->type); - msg->length = ntohl(msg->length); - - if (!msg->length) //Hurdler: fix a bug in Windows 2000 - return 0; - - if (recv(socket_fd, (char*)msg->buffer, msg->length, 0) != msg->length) - return MS_READ_ERROR; - - return 0; -} - - - - - - - - -/***************************************************************************/ - - - - - - - - - -/* GetServerListEx */ -EXPORT int __stdcall GetServerListEx(char *host, char *str_port, struct SERVERLIST serverlist[], short max_servers) -{ - msg_t msg; - int count = 0; - - - /* Attempt to connect to list server. */ - MS_Connect(host, str_port, 0); - - /* Poll the list server. If it fails, depart with an error code of -1. */ - msg.type = GET_SERVER_MSG; - msg.length = 0; - if (MS_Write(&msg) < 0) - return -1; - - - - /* Get a description of each server in turn. */ - /* What we get is exactly the same as the output to the console when using LISTSERV. */ - while (MS_Read(&msg) >= 0) - { - if(msg.length == 0 || count >= max_servers) - { - CloseConnection(); - return count; - } - - ExtractServerInfo(msg.buffer, &serverlist[count]); - - count++; - } - - - CloseConnection(); - return -2; -} - - - - - - - - - - - -/* GetServerList */ -/* Warning: Large kludge follows! This function is only included for backwards-compatibility. */ -/* Use GetServerListVB or GetServerListEx instead. */ -EXPORT int __stdcall GetServerList(char *host, char *str_port, - - struct SERVERLIST *serverlist1,struct SERVERLIST *serverlist2,struct SERVERLIST *serverlist3, - struct SERVERLIST *serverlist4,struct SERVERLIST *serverlist5,struct SERVERLIST *serverlist6, - struct SERVERLIST *serverlist7,struct SERVERLIST *serverlist8,struct SERVERLIST *serverlist9, - struct SERVERLIST *serverlist10,struct SERVERLIST *serverlist11,struct SERVERLIST *serverlist12, - struct SERVERLIST *serverlist13,struct SERVERLIST *serverlist14,struct SERVERLIST *serverlist15, - struct SERVERLIST *serverlist16) -{ - msg_t msg; - int count = 0; - struct SERVERLIST *serverlist[16]; - - - /* Attempt to connect to list server. */ - MS_Connect(host, str_port, 0); - - /* Poll the list server. If it fails, bomb with an error code of -1. */ - msg.type = GET_SERVER_MSG; - msg.length = 0; - if (MS_Write(&msg) < 0) - return -1; - - serverlist[0] = serverlist1; - serverlist[1] = serverlist2; - serverlist[2] = serverlist3; - serverlist[3] = serverlist4; - serverlist[4] = serverlist5; - serverlist[5] = serverlist6; - serverlist[6] = serverlist7; - serverlist[7] = serverlist8; - serverlist[8] = serverlist9; - serverlist[9] = serverlist10; - serverlist[10] = serverlist11; - serverlist[11] = serverlist12; - serverlist[12] = serverlist13; - serverlist[13] = serverlist14; - serverlist[14] = serverlist15; - serverlist[15] = serverlist16; - - - - - while (MS_Read(&msg) >= 0 && count < 16) - { - if(msg.length == 0 || count >= 16) - { - CloseConnection(); - return count; - } - - ExtractServerInfo(msg.buffer, serverlist[count]); - - count++; - } - - - CloseConnection(); - - - return -2; -} - - - -void ExtractServerInfo(char *serverout, struct SERVERLIST *serverlist) -{ - char *lines[5]; - int i; - - i=0; - lines[0] = strtok(serverout, "\r\n"); - for(i=1; i<5; i++) - { - lines[i] = strtok(NULL, "\r\n"); - } - - strcpy(serverlist->ip, strstr(lines[0], ": ")+2); - strcpy(serverlist->port, strstr(lines[1], ": ")+2); - strcpy(serverlist->name, strstr(lines[2], ": ")+2); - strcpy(serverlist->version, strstr(lines[3], ": ")+2); - strcpy(serverlist->perm, strstr(lines[4], ": ")+2); -} diff --git a/tools/SRB2Launcher/mserv.h b/tools/SRB2Launcher/mserv.h deleted file mode 100644 index 8f32ae632..000000000 --- a/tools/SRB2Launcher/mserv.h +++ /dev/null @@ -1,64 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// MSERV SDK -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// Adapted by Oogaland. -// -// 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. -// -// -// -// DESCRIPTION: -// Header file for the master server routines -// -//----------------------------------------------------------------------------- - -#ifndef _MSERV_H_ -#define _MSERV_H_ - - - -#ifndef EXPORT -#ifdef __cplusplus -#define EXPORT extern "C" __declspec (dllexport) -#else -#define EXPORT __declspec (dllexport) -#endif -#endif - - - -struct SERVERLIST -{ - char ip[16]; - char port[6]; - char name[32]; - char version[16]; - char perm[4]; -}; - - - -EXPORT int __stdcall GetServerListEx(char *ip_addr, char *str_port, struct SERVERLIST serverlist[], short max_servers); -EXPORT int __stdcall GetServerList(char *ip_addr, char *str_port, - struct SERVERLIST *serverlist1,struct SERVERLIST *serverlist2,struct SERVERLIST *serverlist3, - struct SERVERLIST *serverlist4,struct SERVERLIST *serverlist5,struct SERVERLIST *serverlist6, - struct SERVERLIST *serverlist7,struct SERVERLIST *serverlist8,struct SERVERLIST *serverlist9, - struct SERVERLIST *serverlist10,struct SERVERLIST *serverlist11,struct SERVERLIST *serverlist12, - struct SERVERLIST *serverlist13,struct SERVERLIST *serverlist14,struct SERVERLIST *serverlist15, - struct SERVERLIST *serverlist16); - - - - -#endif // !defined(_MSERV_H_) diff --git a/tools/SRB2Launcher/mservsdk.h b/tools/SRB2Launcher/mservsdk.h deleted file mode 100644 index 722288e0b..000000000 --- a/tools/SRB2Launcher/mservsdk.h +++ /dev/null @@ -1,65 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// MSERV SDK -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// Adapted by Oogaland. -// -// 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. -// -// -// -// DESCRIPTION: -// Header file for the master server SDK. -// -//----------------------------------------------------------------------------- - -#ifndef _MSERVSDK_H_ -#define _MSERVSDK_H_ - - - -#ifndef IMPORT -#ifdef __cplusplus -#define IMPORT extern "C" __declspec (dllimport) -#else -#define IMPORT __declspec (dllimport) -#endif -#endif - - - - -struct SERVERLIST -{ - char ip[16]; - char port[6]; - char name[32]; - char version[16]; - char perm[4]; -}; - - - -IMPORT int __stdcall GetServerListEx(char *host, char *str_port, struct SERVERLIST serverlist[], short max_servers); -IMPORT int __stdcall GetServerList(char *host, char *str_port, - struct SERVERLIST *serverlist1,struct SERVERLIST *serverlist2,struct SERVERLIST *serverlist3, - struct SERVERLIST *serverlist4,struct SERVERLIST *serverlist5,struct SERVERLIST *serverlist6, - struct SERVERLIST *serverlist7,struct SERVERLIST *serverlist8,struct SERVERLIST *serverlist9, - struct SERVERLIST *serverlist10,struct SERVERLIST *serverlist11,struct SERVERLIST *serverlist12, - struct SERVERLIST *serverlist13,struct SERVERLIST *serverlist14,struct SERVERLIST *serverlist15, - struct SERVERLIST *serverlist16); - - - - -#endif // !defined(_MSERVSDK_H_) diff --git a/tools/SRB2Launcher/resource.h b/tools/SRB2Launcher/resource.h deleted file mode 100644 index d787fef41..000000000 --- a/tools/SRB2Launcher/resource.h +++ /dev/null @@ -1,71 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by Script1.rc -// -#define IDD_MAIN 101 -#define IDB_BITMAP1 102 -#define IDI_ICON1 103 -#define IDD_JOINGAME 104 -#define IDD_HOSTGAME 106 -#define IDD_MATCHOPTIONS 108 -#define IDD_RACEOPTIONS 109 -#define IDD_CTFOPTIONS 110 -#define IDD_TAGOPTIONS 111 -#define IDC_GO 1001 -#define IDC_LAUNCHCONFIG 1002 -#define IDC_EXTFILECOMBO 1003 -#define IDC_ABOUT 1005 -#define IDC_ADDFILE 1006 -#define IDC_REMOVEFILE 1007 -#define IDC_SAVELAUNCHCFG 1008 -#define IDC_JOINGAME 1010 -#define IDC_HOSTGAME 1011 -#define IDC_SOUNDOPTS 1012 -#define IDC_PARAMETERS 1013 -#define IDC_EXENAME 1014 -#define IDC_FINDEXENAME 1015 -#define IDC_SEARCHGAMES 1016 -#define IDC_GAMELIST 1018 -#define IDC_NAME 1020 -#define IDC_COLOR 1021 -#define IDC_SKIN 1022 -#define IDC_ADDRESS 1023 -#define IDC_NOFILE 1024 -#define IDC_JOINSTART 1026 -#define IDC_NODOWNLOAD 1027 -#define IDC_OPTIONS 1028 -#define IDC_GAMETYPE 1029 -#define IDC_MAXPLAYERS 1030 -#define IDC_STARTMAP 1031 -#define IDC_FORCESKIN 1032 -#define IDC_ADVANCEMAP 1033 -#define IDC_INTERNETSERVER 1034 -#define IDC_SPECIALRINGS 1036 -#define IDC_MATCHBOXES 1037 -#define IDC_OK 1038 -#define IDC_CANCEL 1039 -#define IDC_RESPAWNITEMTIME 1040 -#define IDC_TIMELIMIT 1041 -#define IDC_POINTLIMIT 1042 -#define IDC_FLAGTIME 1048 -#define IDC_RACEITEMBOXES 1051 -#define IDC_NUMLAPS 1052 -#define IDC_SUDDENDEATH 1060 -#define IDC_MATCH_SCORING 1061 -#define IDC_INTTIME 1064 -#define IDC_DISABLEAUTOAIM 1065 -#define IDC_MONITORTOGGLES 1067 -#define IDC_CONFIGFILE 1069 -#define IDC_FINDCONFIGNAME 1070 -#define IDC_LIST1 1071 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 117 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1072 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/tools/SRB2MP/Makefile b/tools/SRB2MP/Makefile deleted file mode 100644 index 92e112d7a..000000000 --- a/tools/SRB2MP/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# Makfile of SRB2MP - -CFLAGS +=-Wall -mms-bitfields -fno-exceptions -LDFLAGS +=-mwindows -lfmod -WINDRESFLAGS= - -SRC=lump.c SRB2MP.c - -ifdef DEBUGMODE -CFLAGS +=-g -D_DEBUG -LDFLAGS +=-g -else -CFLAGS :=-Os -s $(CFLAGS) -LDFLAGS :=-s $(LDFLAGS) -endif - -OBJ=$(SRC:.c=.o) # replaces the .c from SRC with .o -EXTRAOBJ=Script1.res -EXE=SRB2MP.exe - -ifdef PREFIX -CC=$(PREFIX)-gcc -WINDRES ?=$(PREFIX)-windres -endif - -WINDRES ?=windres - -RM=rm - -%.o: %.c StdAfx.h lump.h resource.h - $(CC) $(CFLAGS) -o $@ -c $< - -%.res: %.rc resource.h - $(WINDRES) -i $< -O rc $(WINDRESFLAGS) -o $@ -O coff - -.PHONY : all # .PHONY ignores files named all -all: $(EXE) # all is dependent on $(EXE) to be complete - -$(EXE): $(OBJ) $(EXTRAOBJ) # $(EXE) is dependent on all of the files in $(OBJ) to exist - $(CC) $(OBJ) $(EXTRAOBJ) $(LDFLAGS) -o $@ - -.PHONY : clean # .PHONY ignores files named clean -clean: - -$(RM) $(OBJ) $(EXTRAOBJ) diff --git a/tools/SRB2MP/SRB2MP.c b/tools/SRB2MP/SRB2MP.c deleted file mode 100644 index 69cc21040..000000000 --- a/tools/SRB2MP/SRB2MP.c +++ /dev/null @@ -1,464 +0,0 @@ -// SRB2MP.cpp : Defines the entry point for the application. -// - -#include "StdAfx.h" -#include "lump.h" - -#define APPTITLE "SRB2 Music Player" -#define APPVERSION "v0.1" -#define APPAUTHOR "SSNTails" -#define APPCOMPANY "Sonic Team Junior" - -static FSOUND_STREAM *fmus = NULL; -static int fsoundchannel = -1; -static FMUSIC_MODULE *mod = NULL; -static struct wadfile* wfptr = NULL; - -static inline VOID M_SetVolume(int volume) -{ - if (mod && FMUSIC_GetType(mod) != FMUSIC_TYPE_NONE) - FMUSIC_SetMasterVolume(mod, volume); - if (fsoundchannel != -1) - FSOUND_SetVolume(fsoundchannel, volume); -} - -static inline BOOL M_InitMusic(VOID) -{ - if (FSOUND_GetVersion() < FMOD_VERSION) - { - printf("Error : You are using the wrong DLL version!\nYou should be using FMOD %.02f\n", FMOD_VERSION); - return FALSE; - } - -#ifdef _DEBUG - FSOUND_SetOutput(FSOUND_OUTPUT_WINMM); -#endif - - if (!FSOUND_Init(44100, 1, FSOUND_INIT_GLOBALFOCUS)) - { - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - return FALSE; - } - return TRUE; -} - -static inline VOID M_FreeMusic(VOID) -{ - if (mod) - { - FMUSIC_StopSong(mod); - FMUSIC_FreeSong(mod); - mod = NULL; - } - if (fmus) - { - FSOUND_Stream_Stop(fmus); - FSOUND_Stream_Close(fmus); - fmus = NULL; - fsoundchannel = -1; - } -} - -static inline VOID M_ShutdownMusic(VOID) -{ - M_FreeMusic(); - FSOUND_Close(); - //remove(musicfile); // Delete the temp file -} - -static inline VOID M_PauseMusic(VOID) -{ - if (mod && !FMUSIC_GetPaused(mod)) - FMUSIC_SetPaused(mod, TRUE); - if (fsoundchannel != -1 && FSOUND_IsPlaying(fsoundchannel)) - FSOUND_SetPaused(fsoundchannel, TRUE); -} - -static inline VOID M_ResumeMusic(VOID) -{ - if (mod && FMUSIC_GetPaused(mod)) - FMUSIC_SetPaused(mod, FALSE); - if (fsoundchannel != -1 && FSOUND_GetPaused(fsoundchannel)) - FSOUND_SetPaused(fsoundchannel, FALSE); -} - -static inline VOID M_StopMusic(VOID) -{ - if (mod) - FMUSIC_StopSong(mod); - if (fsoundchannel != -1 && fmus && FSOUND_IsPlaying(fsoundchannel)) - FSOUND_Stream_Stop(fmus); -} - -static inline VOID M_StartFMODSong(LPVOID data, int len, int looping, HWND hDlg) -{ - const int loops = FSOUND_LOOP_NORMAL|FSOUND_LOADMEMORY; - const int nloop = FSOUND_LOADMEMORY; - M_FreeMusic(); - - if (looping) - mod = FMUSIC_LoadSongEx(data, 0, len, loops, NULL, 0); - else - mod = FMUSIC_LoadSongEx(data, 0, len, nloop, NULL, 0); - - if (mod) - { - FMUSIC_SetLooping(mod, (signed char)looping); - FMUSIC_SetPanSeperation(mod, 0.0f); - } - else - { - if (looping) - fmus = FSOUND_Stream_Open(data, loops, 0, len); - else - fmus = FSOUND_Stream_Open(data, nloop, 0, len); - } - - if (!fmus && !mod) - { - MessageBoxA(hDlg, FMOD_ErrorString(FSOUND_GetError()), "Error", MB_OK|MB_APPLMODAL); - return; - } - - // Scan the OGG for the COMMENT= field for a custom loop point - if (looping && fmus) - { - const BYTE *origpos, *dataum = data; - size_t scan, size = len; - - CHAR buffer[512]; - BOOL titlefound = FALSE, artistfound = FALSE; - - unsigned int loopstart = 0; - - origpos = dataum; - - for(scan = 0; scan < size; scan++) - { - if (!titlefound) - { - if (*dataum++ == 'T') - if (*dataum++ == 'I') - if (*dataum++ == 'T') - if (*dataum++ == 'L') - if (*dataum++ == 'E') - if (*dataum++ == '=') - { - size_t titlecount = 0; - CHAR title[256]; - BYTE length = *(dataum-10) - 6; - - while(titlecount < length) - title[titlecount++] = *dataum++; - - title[titlecount] = '\0'; - - sprintf(buffer, "Title: %s", title); - - SendMessage(GetDlgItem(hDlg, IDC_TITLE), WM_SETTEXT, 0, (LPARAM)(LPCSTR)buffer); - - titlefound = TRUE; - } - } - } - - dataum = origpos; - - for(scan = 0; scan < size; scan++) - { - if (!artistfound) - { - if (*dataum++ == 'A') - if (*dataum++ == 'R') - if (*dataum++ == 'T') - if (*dataum++ == 'I') - if (*dataum++ == 'S') - if (*dataum++ == 'T') - if (*dataum++ == '=') - { - size_t artistcount = 0; - CHAR artist[256]; - BYTE length = *(dataum-11) - 7; - - while(artistcount < length) - artist[artistcount++] = *dataum++; - - artist[artistcount] = '\0'; - - sprintf(buffer, "By: %s", artist); - - SendMessage(GetDlgItem(hDlg, IDC_ARTIST), WM_SETTEXT, 0, (LPARAM)(LPCSTR)buffer); - - artistfound = TRUE; - } - } - } - - dataum = origpos; - - for(scan = 0; scan < size; scan++) - { - if (*dataum++ == 'C'){ - if (*dataum++ == 'O'){ - if (*dataum++ == 'M'){ - if (*dataum++ == 'M'){ - if (*dataum++ == 'E'){ - if (*dataum++ == 'N'){ - if (*dataum++ == 'T'){ - if (*dataum++ == '='){ - if (*dataum++ == 'L'){ - if (*dataum++ == 'O'){ - if (*dataum++ == 'O'){ - if (*dataum++ == 'P'){ - if (*dataum++ == 'P'){ - if (*dataum++ == 'O'){ - if (*dataum++ == 'I'){ - if (*dataum++ == 'N'){ - if (*dataum++ == 'T'){ - if (*dataum++ == '=') - { - size_t newcount = 0; - CHAR looplength[64]; - while (*dataum != 1 && newcount < 63) - { - looplength[newcount++] = *dataum++; - } - - looplength[newcount] = '\n'; - - loopstart = atoi(looplength); - } - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - } - - if (loopstart > 0) - { - const int length = FSOUND_Stream_GetLengthMs(fmus); - const int freq = 44100; - const unsigned int loopend = (unsigned int)((freq/1000.0f)*length-(freq/1000.0f)); - if (!FSOUND_Stream_SetLoopPoints(fmus, loopstart, loopend)) - { - printf("FMOD(Start,FSOUND_Stream_SetLoopPoints): %s\n", - FMOD_ErrorString(FSOUND_GetError())); - } - } - } - - if (mod) - FMUSIC_PlaySong(mod); - if (fmus) - fsoundchannel = FSOUND_Stream_PlayEx(FSOUND_FREE, fmus, NULL, FALSE); - - M_SetVolume(128); -} - -static inline VOID FreeWADLumps(VOID) -{ - M_FreeMusic(); - if (wfptr) free_wadfile(wfptr); - wfptr = NULL; -} - -static inline VOID ReadWADLumps(LPCSTR WADfilename, HWND hDlg) -{ - HWND listbox = GetDlgItem(hDlg, IDC_PLAYLIST); - FILE* f; - struct lumplist *curlump; - - SendMessage(listbox, LB_RESETCONTENT, 0, 0); - FreeWADLumps(); - f = fopen(WADfilename, "rb"); - wfptr = read_wadfile(f); - fclose(f); - - /* start of C_LIST */ - /* Loop through the lump list, printing lump info */ - for(curlump = wfptr->head->next; curlump; curlump = curlump->next) - { - LPCSTR lumpname = get_lump_name(curlump->cl); - if (!strncmp(lumpname, "O_", 2) || !strncmp(lumpname, "D_", 2)) - SendMessage(listbox, LB_ADDSTRING, 0, (LPARAM)(LPCSTR)get_lump_name(curlump->cl)); - } - /* end of C_LIST */ -} - -// -// OpenWadfile -// -// Provides a common dialog box -// for selecting the desired wad file. -// -static inline VOID OpenWadfile(HWND hDlg) -{ - OPENFILENAMEA ofn; - CHAR FileBuffer[256] = ""; - - ZeroMemory(&ofn, sizeof(ofn)); - ofn.hwndOwner = hDlg; - ofn.lpstrFilter = "WAD Files\0*.wad\0All Files\0*.*\0\0"; - ofn.lpstrInitialDir = NULL; - ofn.lpstrFile = FileBuffer; - ofn.lStructSize = sizeof(ofn); - ofn.nMaxFile = sizeof(FileBuffer); - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = 0; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - - if (GetOpenFileNameA(&ofn)) - ReadWADLumps(FileBuffer, hDlg); -} - -static inline VOID PlayLump(HWND hDlg) -{ - HWND listbox = GetDlgItem(hDlg, IDC_PLAYLIST); - LRESULT cursel = SendMessage(listbox, LB_GETCURSEL, 0, 0); - - /* Start of C_EXTRACT */ - CHAR argv[9]; - - SendMessage(listbox, LB_GETTEXT, cursel, (LPARAM)(LPCSTR)argv); - - /* Extract LUMPNAME FILENAME pairs */ - if (wfptr) - { - struct lumplist *extracted; - - printf("Extracting lump %s...\n", argv); - /* Find the lump to extract */ - extracted = find_previous_lump(wfptr->head, NULL, argv); - if (extracted == NULL || (extracted = extracted->next) == NULL) - return; - - /* Extract lump */ - M_StartFMODSong(extracted->cl->data, extracted->cl->len, FALSE, hDlg); - - /* end of extracting LUMPNAME FILENAME pairs */ - - } /* end of C_EXTRACT */ - return; -} - -static LRESULT CALLBACK MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - return DefWindowProc(hWnd, message, wParam, lParam); -} - -static INT_PTR CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch(message) - { - case WM_INITDIALOG: - M_InitMusic(); - break; - - case WM_CLOSE: - EndDialog(hDlg, message); - break; - - case WM_DESTROY: - FreeWADLumps(); - M_ShutdownMusic(); - break; - - case WM_COMMAND: - { - switch(LOWORD(wParam)) - { - case 2: - EndDialog(hDlg, message); - return TRUE; - case IDC_ABOUT: // The About button. - { - char TempString[256]; - sprintf(TempString, "%s %s by %s - %s", APPTITLE, APPVERSION, APPAUTHOR, APPCOMPANY); - MessageBoxA(hDlg, TempString, "About", MB_OK|MB_APPLMODAL); - } - return TRUE; - case IDC_OPEN: - OpenWadfile(hDlg); - return TRUE; - case IDC_PLAY: - PlayLump(hDlg); - return TRUE; - default: - break; - } - break; - } - } - - return FALSE; -} - -static inline VOID RegisterDialogClass(LPCSTR name, WNDPROC callback, HINSTANCE hInst) -{ - WNDCLASSA wnd; - - wnd.style = CS_HREDRAW | CS_VREDRAW; - wnd.cbWndExtra = DLGWINDOWEXTRA; - wnd.cbClsExtra = 0; - wnd.hCursor = LoadCursorA(NULL,(LPCSTR)MAKEINTRESOURCE(IDC_ARROW)); - wnd.hIcon = LoadIcon(NULL,MAKEINTRESOURCE(IDI_ICON1)); - wnd.hInstance = hInst; - wnd.lpfnWndProc = callback; - wnd.lpszClassName = name; - wnd.lpszMenuName = NULL; - wnd.hbrBackground = (HBRUSH)(COLOR_WINDOW); - - if (!RegisterClassA(&wnd)) - { - return; - } -} - -int APIENTRY WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow) -{ - // Prevent multiples instances of this app. - CreateMutexA(NULL, TRUE, APPTITLE); - - if (GetLastError() == ERROR_ALREADY_EXISTS) - return 0; - - RegisterDialogClass("SRB2MP", MainWndproc, hInstance); - - DialogBoxA(hInstance, (LPCSTR)IDD_MAIN, NULL, DialogProc); - - return 0; -} diff --git a/tools/SRB2MP/SRB2MP.dsp b/tools/SRB2MP/SRB2MP.dsp deleted file mode 100644 index f2e700fb5..000000000 --- a/tools/SRB2MP/SRB2MP.dsp +++ /dev/null @@ -1,148 +0,0 @@ -# Microsoft Developer Studio Project File - Name="SRB2MP" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=SRB2MP - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "SRB2MP.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "SRB2MP.mak" CFG="SRB2MP - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "SRB2MP - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "SRB2MP - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "SRB2MP - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib fmodvc.lib /nologo /subsystem:windows /machine:I386 - -!ELSEIF "$(CFG)" == "SRB2MP - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib fmodvc.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "SRB2MP - Win32 Release" -# Name "SRB2MP - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\lump.c -# End Source File -# Begin Source File - -SOURCE=.\SRB2MP.c -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.c -# ADD CPP /Yc"stdafx.h" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\lump.h -# End Source File -# Begin Source File - -SOURCE=.\resource.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\icon1.ico -# End Source File -# Begin Source File - -SOURCE=.\icon2.ico -# End Source File -# Begin Source File - -SOURCE=.\icon3.ico -# End Source File -# Begin Source File - -SOURCE=.\Script1.rc -# End Source File -# End Group -# Begin Source File - -SOURCE=.\ReadMe.txt -# End Source File -# End Target -# End Project diff --git a/tools/SRB2MP/SRB2MP.dsw b/tools/SRB2MP/SRB2MP.dsw deleted file mode 100644 index b73bd1ac7..000000000 --- a/tools/SRB2MP/SRB2MP.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "SRB2MP"=.\SRB2MP.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/tools/SRB2MP/Script1.aps b/tools/SRB2MP/Script1.aps deleted file mode 100644 index 994653cb1..000000000 Binary files a/tools/SRB2MP/Script1.aps and /dev/null differ diff --git a/tools/SRB2MP/Script1.rc b/tools/SRB2MP/Script1.rc deleted file mode 100644 index 3fa7bd572..000000000 --- a/tools/SRB2MP/Script1.rc +++ /dev/null @@ -1,118 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_MAIN DIALOG DISCARDABLE 0, 0, 262, 170 -STYLE DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU -CAPTION "SRB2 Music Player" -FONT 8, "MS Sans Serif" -BEGIN - PUSHBUTTON "E&xit",IDCANCEL,205,145,50,19 - PUSHBUTTON "&About",IDC_ABOUT,230,15,23,10 - LISTBOX IDC_WADLIST,5,30,112,110,LBS_SORT | LBS_NOINTEGRALHEIGHT | - WS_VSCROLL | WS_TABSTOP - LISTBOX IDC_PLAYLIST,140,30,114,110,LBS_SORT | - LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&Play",IDC_PLAY,140,145,60,20 - PUSHBUTTON "->",IDC_ADD,120,35,15,15 - PUSHBUTTON "<-",IDC_REMOVE,120,55,15,15 - PUSHBUTTON "&Open WAD...",IDC_OPEN,5,10,50,15 - ICON IDI_ICON1,IDC_STATIC,205,5,20,20 - LTEXT "Title:",IDC_TITLE,5,140,125,10 - LTEXT "By:",IDC_ARTIST,5,150,125,15 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_MAIN, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 255 - TOPMARGIN, 7 - BOTTOMMARGIN, 163 - END -END -#endif // APSTUDIO_INVOKED - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_ICON1 ICON DISCARDABLE "icon1.ico" -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/tools/SRB2MP/StdAfx.c b/tools/SRB2MP/StdAfx.c deleted file mode 100644 index 4f305cd1a..000000000 --- a/tools/SRB2MP/StdAfx.c +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// SRB2MP.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "StdAfx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/tools/SRB2MP/StdAfx.h b/tools/SRB2MP/StdAfx.h deleted file mode 100644 index 84ac428b8..000000000 --- a/tools/SRB2MP/StdAfx.h +++ /dev/null @@ -1,35 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) -#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ - -//#define UNICODE - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -#include -#include -#include -#include - -// TODO: reference additional headers your program requires here -#ifdef __MINGW32__ -#include -#include -#else -#include -#include -#endif -#include "resource.h" - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/tools/SRB2MP/icon1.ico b/tools/SRB2MP/icon1.ico deleted file mode 100644 index 7548e7caf..000000000 Binary files a/tools/SRB2MP/icon1.ico and /dev/null differ diff --git a/tools/SRB2MP/lump.c b/tools/SRB2MP/lump.c deleted file mode 100644 index 4cf355401..000000000 --- a/tools/SRB2MP/lump.c +++ /dev/null @@ -1,471 +0,0 @@ -/* - LumpMod v0.21, a command-line utility for working with lumps in wad files. - Copyright (C) 2003 Thunder Palace Entertainment. - - 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. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - lump.c: Provides functions for dealing with lumps -*/ - -#include "StdAfx.h" -#include -#include -#include "lump.h" - -/* Read contents of a wad file and store them in memory. - * fpoint is the file to read, opened with "rb" mode. - * A pointer to a new wadfile struct will be returned, or NULL on error. - */ -struct wadfile *read_wadfile(FILE *fpoint) { - struct wadfile *wfptr; - struct lumplist *curlump; - unsigned long diroffset, filelen; - unsigned long count; - - /* Allocate memory for wadfile struct */ - wfptr = (struct wadfile*)malloc(sizeof(struct wadfile)); - if(wfptr == NULL) return NULL; - - /* Read first four characters (PWAD or IWAD) */ - if(fread(wfptr->id, 4, 1, fpoint) < 1) { - free(wfptr); - return NULL; - } - - /* Read number of lumps */ - if(fread(&(wfptr->numlumps), 4, 1, fpoint) < 1) { - free(wfptr); - return NULL; - } - - /* If number of lumps is zero, nothing more needs to be done */ - if(wfptr->numlumps == 0) { - wfptr->head = NULL; - return wfptr; - } - - /* Read offset of directory */ - if(fread(&diroffset, 4, 1, fpoint) < 1) { - free(wfptr); - return NULL; - } - - /* Verify that the directory as long as it needs to be */ - fseek(fpoint, 0, SEEK_END); - filelen = ftell(fpoint); - if((filelen - diroffset) / DIRENTRYLEN < wfptr->numlumps) { - free(wfptr); - return NULL; - } - - /* Allocate memory for head lumplist item and set head pointer */ - curlump = (struct lumplist*)malloc(sizeof(struct lumplist)); - if(curlump == NULL) { - free(wfptr); - return NULL; - } - wfptr->head = curlump; - curlump->cl = NULL; - - /* Read directory entries and lumps */ - for(count = 0; count < wfptr->numlumps; count++) { - long lumpdataoffset; - - /* Advance to a new list item */ - curlump->next = (struct lumplist*)malloc(sizeof(struct lumplist)); - if(curlump->next == NULL) { - free_wadfile(wfptr); - return NULL; - } - curlump = curlump->next; - curlump->next = NULL; - - /* Allocate memory for the lump info */ - curlump->cl = (struct lump*)malloc(sizeof(struct lump)); - if(curlump->cl == NULL) { - free_wadfile(wfptr); - return NULL; - } - - /* Seek to the proper position in the file */ - if(fseek(fpoint, diroffset + (count * DIRENTRYLEN), SEEK_SET) != 0) { - free_wadfile(wfptr); - return NULL; - } - - /* Read offset of lump data */ - if(fread(&lumpdataoffset, 4, 1, fpoint) < 1) { - free_wadfile(wfptr); - return NULL; - } - - /* Read size of lump in bytes */ - if(fread(&(curlump->cl->len), 4, 1, fpoint) < 1) { - free_wadfile(wfptr); - return NULL; - } - - /* Read lump name */ - if(fread(curlump->cl->name, 8, 1, fpoint) < 1) { - free_wadfile(wfptr); - return NULL; - } - - /* Read actual lump data, unless lump size is 0 */ - if(curlump->cl->len > 0) { - if(fseek(fpoint, lumpdataoffset, SEEK_SET) != 0) { - free_wadfile(wfptr); - return NULL; - } - - /* Allocate memory for data */ - curlump->cl->data = (unsigned char*)malloc(curlump->cl->len); - if(curlump->cl->data == NULL) { - free_wadfile(wfptr); - return NULL; - } - - /* Fill the data buffer */ - if(fread(curlump->cl->data, curlump->cl->len, 1, fpoint) < 1) { - free_wadfile(wfptr); - return NULL; - } - } else curlump->cl->data = NULL; - } /* End of directory reading loop */ - - return wfptr; -} - -/* Free a wadfile from memory as well as all related structures. - */ -void free_wadfile(struct wadfile *wfptr) { - struct lumplist *curlump, *nextlump; - - if(wfptr == NULL) return; - curlump = wfptr->head; - - /* Free items in the lump list */ - while(curlump != NULL) { - - /* Free the actual lump and its data, if necessary */ - if(curlump->cl != NULL) { - if(curlump->cl->data != NULL) free(curlump->cl->data); - free(curlump->cl); - } - - /* Advance to next lump and free this one */ - nextlump = curlump->next; - free(curlump); - curlump = nextlump; - } - - free(wfptr); -} - -/* Write complete wadfile to a file stream, opened with "wb" mode. - * fpoint is the stream to write to. - * wfptr is a pointer to the wadfile structure to use. - * Return zero on success, nonzero on failure. - */ -int write_wadfile(FILE *fpoint, struct wadfile *wfptr) { - struct lumplist *curlump; - long lumpdataoffset, diroffset; - - if(wfptr == NULL) return 1; - - /* Write four-character ID ("PWAD" or "IWAD") */ - if(fwrite(wfptr->id, 4, 1, fpoint) < 1) return 2; - - /* Write number of lumps */ - if(fwrite(&(wfptr->numlumps), 4, 1, fpoint) < 1) return 3; - - /* Offset of directory is not known yet. For now, write number of lumps - * again, just to fill the space. - */ - if(fwrite(&(wfptr->numlumps), 4, 1, fpoint) < 1) return 4; - - /* Loop through lump list, writing lump data */ - for(curlump = wfptr->head; curlump != NULL; curlump = curlump->next) { - - /* Don't write anything for the head of the lump list or for lumps of - zero length */ - if(curlump->cl == NULL || curlump->cl->data == NULL) continue; - - /* Write the data */ - if(fwrite(curlump->cl->data, curlump->cl->len, 1, fpoint) < 1) - return 5; - } - - /* Current position is where directory will start */ - diroffset = ftell(fpoint); - - /* Offset for the first lump's data is always 12 */ - lumpdataoffset = 12; - - /* Loop through lump list again, this time writing directory entries */ - for(curlump = wfptr->head; curlump != NULL; curlump = curlump->next) { - - /* Don't write anything for the head of the lump list */ - if(curlump->cl == NULL) continue; - - /* Write offset for lump data */ - if(fwrite(&lumpdataoffset, 4, 1, fpoint) < 1) return 6; - - /* Write size of lump data */ - if(fwrite(&(curlump->cl->len), 4, 1, fpoint) < 1) return 7; - - /* Write lump name */ - if(fwrite(curlump->cl->name, 8, 1, fpoint) < 1) return 8; - - /* Increment lumpdataoffset variable as appropriate */ - lumpdataoffset += curlump->cl->len; - } - - /* Go back to header and write the proper directory offset */ - fseek(fpoint, 8, SEEK_SET); - if(fwrite(&diroffset, 4, 1, fpoint) < 1) return 9; - - return 0; -} - -/* Get the name of a lump, as a null-terminated string. - * item is a pointer to the lump (not lumplist) whose name will be obtained. - * Return NULL on error. - */ -char *get_lump_name(struct lump *item) { - char convname[9], *retname; - - if(item == NULL) return NULL; - memcpy(convname, item->name, 8); - convname[8] = '\0'; - - retname = (char*)malloc(strlen(convname) + 1); - if(retname != NULL) strcpy(retname, convname); - return retname; -} - -/* Find the lump after start and before end having a certain name. - * Return a pointer to the list item for that lump, or return NULL if no lump - * by that name is found or lumpname is too long. - * lumpname is a null-terminated string. - * If end parameter is NULL, search to the end of the entire list. - */ -struct lumplist *find_previous_lump(struct lumplist *start, struct lumplist - *end, char *lumpname) { - struct lumplist *curlump, *lastlump; - char *curname; - int found = 0; - - /* Verify that parameters are valid */ - if(start==NULL || start==end || lumpname==NULL || strlen(lumpname) > 8) - return NULL; - - /* Loop through the list from start parameter */ - lastlump = start; - for(curlump = start->next; curlump != end && curlump != NULL; - curlump = curlump->next) { - - /* Skip header lump */ - if(curlump->cl == NULL) continue; - - /* Find name of this lump */ - curname = get_lump_name(curlump->cl); - if(curname == NULL) continue; - - /* Compare names to see if this is the lump we want */ - if(strcmp(curname, lumpname) == 0) { - found = 1; - break; - } - - /* Free memory allocated to curname */ - free(curname); - - lastlump = curlump; - } - - if(found) return lastlump; - return NULL; -} - -/* Remove a lump from the list, free it, and free its data. - * before is the lump immediately preceding the lump to be removed. - * wfptr is a pointer to the wadfile structure to which the removed lump - * belongs, so that numlumps can be decreased. - */ -void remove_next_lump(struct wadfile *wfptr, struct lumplist *before) { - struct lumplist *removed; - - /* Verify that parameters are valid */ - if(before == NULL || before->next == NULL || wfptr == NULL) return; - - /* Update linked list to omit removed lump */ - removed = before->next; - before->next = removed->next; - - /* Free lump info and data if necessary */ - if(removed->cl != NULL) { - if(removed->cl->data != NULL) free(removed->cl->data); - free(removed->cl); - } - - free(removed); - - /* Decrement numlumps */ - wfptr->numlumps--; -} - -/* Add a lump. - * The lump will follow prev in the list and be named name, with a data size - * of len. - * A copy will be made of the data. - * Return zero on success or nonzero on failure. - */ -int add_lump(struct wadfile *wfptr, struct lumplist *prev, char *name, long - len, unsigned char *data) { - struct lump *newlump; - struct lumplist *newlumplist; - unsigned char *copydata; - - /* Verify that parameters are valid */ - if(wfptr == NULL || prev == NULL || name == NULL || strlen(name) > 8) - return 1; - - /* Allocate space for newlump and newlumplist */ - newlump = (struct lump*)malloc(sizeof(struct lump)); - newlumplist = (struct lumplist*)malloc(sizeof(struct lumplist)); - if(newlump == NULL || newlumplist == NULL) return 2; - - /* Copy lump data and set up newlump */ - if(len == 0 || data == NULL) { - newlump->len = 0; - newlump->data = NULL; - } else { - newlump->len = len; - copydata = (unsigned char*)malloc(len); - if(copydata == NULL) return 3; - memcpy(copydata, data, len); - newlump->data = copydata; - } - - /* Set name of newlump */ - memset(newlump->name, '\0', 8); - if(strlen(name) == 8) memcpy(newlump->name, name, 8); - else strcpy(newlump->name, name); - - /* Set up newlumplist and alter prev appropriately */ - newlumplist->cl = newlump; - newlumplist->next = prev->next; - prev->next = newlumplist; - - /* Increment numlumps */ - wfptr->numlumps++; - - return 0; -} - -/* Rename a lump. - * renamed is a pointer to the lump (not lumplist) that needs renaming. - * newname is a null-terminated string with the new name. - * Return zero on success or nonzero on failure. - */ -int rename_lump(struct lump *renamed, char *newname) { - - /* Verify that parameters are valid. */ - if(newname == NULL || renamed == NULL || strlen(newname) > 8) return 1; - - /* Do the renaming. */ - memset(renamed->name, '\0', 8); - if(strlen(newname) == 8) memcpy(renamed->name, newname, 8); - else strcpy(renamed->name, newname); - - return 0; -} - -/* Find the last lump in a wadfile structure. - * Return this lump or NULL on failure. - */ -struct lumplist *find_last_lump(struct wadfile *wfptr) { - struct lumplist *curlump; - - if(wfptr == NULL || wfptr->head == NULL) return NULL; - curlump = wfptr->head; - - while(curlump->next != NULL) curlump = curlump->next; - return curlump; -} - -/* Find the last lump between start and end. - * Return this lump or NULL on failure. - */ -struct lumplist *find_last_lump_between(struct lumplist *start, struct - lumplist *end) { - struct lumplist *curlump; - - if(start == NULL) return NULL; - curlump = start; - - while(curlump->next != end) { - curlump = curlump->next; - if(curlump == NULL) break; - } - - return curlump; -} - -/* Find the next section lump. A section lump is MAPxx (0 <= x <= 9), ExMy - * (0 <= x <= 9, 0 <= y <= 9), or any lump whose name ends in _START or _END. - * Return NULL if there are no section lumps after start. - */ -struct lumplist *find_next_section_lump(struct lumplist *start) { - struct lumplist *curlump, *found = NULL; - char *curname; - - /* Verify that parameter is valid */ - if(start == NULL || start->next == NULL) return NULL; - - /* Loop through the list from start parameter */ - for(curlump = start->next; curlump != NULL && found == NULL; - curlump = curlump->next) { - - /* Skip header lump */ - if(curlump->cl == NULL) continue; - - /* Find name of this lump */ - curname = get_lump_name(curlump->cl); - if(curname == NULL) continue; - - /* Check to see if this is a section lump */ - if(strlen(curname) == 5 && strncmp("MAP", curname, 3) == 0 && - isdigit(curname[3]) && isdigit(curname[4])) - found = curlump; - else if(strlen(curname) == 4 && curname[0] == 'E' && curname[2] == - 'M' && isdigit(curname[1]) && isdigit(curname[3])) - found = curlump; - else if(strlen(curname) == 7 && strcmp("_START", &curname[1]) == 0) - found = curlump; - else if(strlen(curname) == 8 && strcmp("_START", &curname[2]) == 0) - found = curlump; - else if(strlen(curname) == 5 && strcmp("_END", &curname[1]) == 0) - found = curlump; - else if(strlen(curname) == 6 && strcmp("_END", &curname[2]) == 0) - found = curlump; - - /* Free memory allocated to curname */ - free(curname); - } - - return found; -} diff --git a/tools/SRB2MP/lump.h b/tools/SRB2MP/lump.h deleted file mode 100644 index b36b84441..000000000 --- a/tools/SRB2MP/lump.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - LumpMod v0.21, a command-line utility for working with lumps in wad files. - Copyright (C) 2003 Thunder Palace Entertainment. - - 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. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - lump.h: Defines constants, structures, and functions used in lump.c -*/ - -#ifndef __LUMP_H -#define __LUMP_H - -/* Entries in the wadfile directory are 16 bytes */ -#define DIRENTRYLEN 16 - -/* Lumps and associated info */ -struct lump { - long len; - unsigned char *data; - char name[8]; -}; - -/* Linked list of lumps */ -struct lumplist { - struct lump *cl; /* actual content of the lump */ - struct lumplist *next; -}; - -/* Structure to contain all wadfile data */ -struct wadfile { - char id[4]; /* IWAD or PWAD */ - unsigned long numlumps; /* 32-bit integer */ - struct lumplist *head; /* points to first entry */ -}; - -/* Function declarations */ -struct wadfile *read_wadfile(FILE *); -void free_wadfile(struct wadfile *); -int write_wadfile(FILE *, struct wadfile *); -char *get_lump_name(struct lump *); -struct lumplist *find_previous_lump(struct lumplist *, struct lumplist *, char *); -void remove_next_lump(struct wadfile *, struct lumplist *); -int add_lump(struct wadfile *, struct lumplist *, char *, long, unsigned char *); -int rename_lump(struct lump *, char *); -struct lumplist *find_last_lump(struct wadfile *); -struct lumplist *find_last_lump_between(struct lumplist *, struct lumplist *); -struct lumplist *find_next_section_lump(struct lumplist *); - -#endif diff --git a/tools/SRB2MP/resource.h b/tools/SRB2MP/resource.h deleted file mode 100644 index 56924e34a..000000000 --- a/tools/SRB2MP/resource.h +++ /dev/null @@ -1,26 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by Script1.rc -// -#define IDD_MAIN 101 -#define IDI_ICON1 102 -#define IDC_ABOUT 1000 -#define IDC_WADLIST 1001 -#define IDC_PLAYLIST 1002 -#define IDC_PLAY 1003 -#define IDC_ADD 1004 -#define IDC_REMOVE 1005 -#define IDC_OPEN 1006 -#define IDC_TITLE 1007 -#define IDC_ARTIST 1008 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 105 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1009 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/tools/SRB2Updater/Bunny.cs b/tools/SRB2Updater/Bunny.cs deleted file mode 100644 index 71934ee31..000000000 --- a/tools/SRB2Updater/Bunny.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Windows.Forms; - -namespace SRB2Updater -{ - public class Bunny - { - List Keys = new List{System.Windows.Forms.Keys.Up, System.Windows.Forms.Keys.Up, - System.Windows.Forms.Keys.Down, System.Windows.Forms.Keys.Down, - System.Windows.Forms.Keys.Left, System.Windows.Forms.Keys.Right, - System.Windows.Forms.Keys.Left, System.Windows.Forms.Keys.Right, - System.Windows.Forms.Keys.B, System.Windows.Forms.Keys.A}; - private int mPosition = -1; - - public int Position - { - get { return mPosition; } - private set { mPosition = value; } - } - - public bool IsCompletedBy(Keys key) - { - - if (Keys[Position + 1] == key) - { - // move to next - Position++; - } - else if (Position == 1 && key == System.Windows.Forms.Keys.Up) - { - // stay where we are - } - else if (Keys[0] == key) - { - // restart at 1st - Position = 0; - } - else - { - // no match in sequence - Position = -1; - } - - if (Position == Keys.Count - 1) - { - Position = -1; - return true; - } - return false; - } - } -} diff --git a/tools/SRB2Updater/Debug.Designer.cs b/tools/SRB2Updater/Debug.Designer.cs deleted file mode 100644 index 6ec72f904..000000000 --- a/tools/SRB2Updater/Debug.Designer.cs +++ /dev/null @@ -1,266 +0,0 @@ -namespace SRB2Updater -{ - partial class Debug - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.lblOverallPercentage = new System.Windows.Forms.Label(); - this.lblPercent = new System.Windows.Forms.Label(); - this.lblOverall = new System.Windows.Forms.Label(); - this.lblCurrent = new System.Windows.Forms.Label(); - this.lblTotal = new System.Windows.Forms.Label(); - this.lblRead = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.label6 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); - this.lblKonami = new System.Windows.Forms.Label(); - this.lblRandom = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.tableLayoutPanel1.SuspendLayout(); - this.SuspendLayout(); - // - // lblOverallPercentage - // - this.lblOverallPercentage.AutoSize = true; - this.lblOverallPercentage.Location = new System.Drawing.Point(176, 150); - this.lblOverallPercentage.Name = "lblOverallPercentage"; - this.lblOverallPercentage.Size = new System.Drawing.Size(21, 13); - this.lblOverallPercentage.TabIndex = 26; - this.lblOverallPercentage.Text = "0%"; - // - // lblPercent - // - this.lblPercent.AutoSize = true; - this.lblPercent.Location = new System.Drawing.Point(176, 90); - this.lblPercent.Name = "lblPercent"; - this.lblPercent.Size = new System.Drawing.Size(21, 13); - this.lblPercent.TabIndex = 25; - this.lblPercent.Text = "0%"; - // - // lblOverall - // - this.lblOverall.AutoSize = true; - this.lblOverall.Location = new System.Drawing.Point(176, 120); - this.lblOverall.Name = "lblOverall"; - this.lblOverall.Size = new System.Drawing.Size(41, 13); - this.lblOverall.TabIndex = 24; - this.lblOverall.Text = "0 bytes"; - // - // lblCurrent - // - this.lblCurrent.AutoSize = true; - this.lblCurrent.Location = new System.Drawing.Point(176, 60); - this.lblCurrent.Name = "lblCurrent"; - this.lblCurrent.Size = new System.Drawing.Size(41, 13); - this.lblCurrent.TabIndex = 23; - this.lblCurrent.Text = "0 bytes"; - // - // lblTotal - // - this.lblTotal.AutoSize = true; - this.lblTotal.Location = new System.Drawing.Point(176, 0); - this.lblTotal.Name = "lblTotal"; - this.lblTotal.Size = new System.Drawing.Size(41, 13); - this.lblTotal.TabIndex = 21; - this.lblTotal.Text = "0 bytes"; - // - // lblRead - // - this.lblRead.AutoSize = true; - this.lblRead.Location = new System.Drawing.Point(176, 30); - this.lblRead.Name = "lblRead"; - this.lblRead.Size = new System.Drawing.Size(41, 13); - this.lblRead.TabIndex = 22; - this.lblRead.Text = "0 bytes"; - this.lblRead.TextAlign = System.Drawing.ContentAlignment.TopRight; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(3, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(105, 13); - this.label1.TabIndex = 27; - this.label1.Text = "Total Download Size"; - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.ColumnCount = 2; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 66.66666F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); - this.tableLayoutPanel1.Controls.Add(this.label6, 0, 5); - this.tableLayoutPanel1.Controls.Add(this.label5, 0, 4); - this.tableLayoutPanel1.Controls.Add(this.label4, 0, 3); - this.tableLayoutPanel1.Controls.Add(this.label3, 0, 2); - this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.lblOverallPercentage, 1, 5); - this.tableLayoutPanel1.Controls.Add(this.lblTotal, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.lblOverall, 1, 4); - this.tableLayoutPanel1.Controls.Add(this.lblPercent, 1, 3); - this.tableLayoutPanel1.Controls.Add(this.lblRead, 1, 1); - this.tableLayoutPanel1.Controls.Add(this.lblCurrent, 1, 2); - this.tableLayoutPanel1.Controls.Add(this.label7, 0, 6); - this.tableLayoutPanel1.Controls.Add(this.lblKonami, 1, 6); - this.tableLayoutPanel1.Controls.Add(this.lblRandom, 1, 7); - this.tableLayoutPanel1.Controls.Add(this.label9, 0, 7); - this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 12); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 9; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(260, 355); - this.tableLayoutPanel1.TabIndex = 28; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(3, 150); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(98, 13); - this.label6.TabIndex = 32; - this.label6.Text = "Overall Percentage"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(3, 120); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(132, 13); - this.label5.TabIndex = 31; - this.label5.Text = "Bytes Downloaded Overall"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(3, 90); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(118, 13); - this.label4.TabIndex = 30; - this.label4.Text = "Current File Percentage"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(3, 60); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(146, 13); - this.label3.TabIndex = 29; - this.label3.Text = "Downloaded from Current File"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(3, 30); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(62, 13); - this.label2.TabIndex = 28; - this.label2.Text = "Bytes Read"; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(3, 180); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(42, 13); - this.label7.TabIndex = 33; - this.label7.Text = "Konami"; - // - // lblKonami - // - this.lblKonami.AutoSize = true; - this.lblKonami.Location = new System.Drawing.Point(176, 180); - this.lblKonami.Name = "lblKonami"; - this.lblKonami.Size = new System.Drawing.Size(16, 13); - this.lblKonami.TabIndex = 34; - this.lblKonami.Text = "-1"; - // - // lblRandom - // - this.lblRandom.AutoSize = true; - this.lblRandom.Location = new System.Drawing.Point(176, 210); - this.lblRandom.Name = "lblRandom"; - this.lblRandom.Size = new System.Drawing.Size(13, 13); - this.lblRandom.TabIndex = 37; - this.lblRandom.Text = "0"; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(3, 210); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(47, 13); - this.label9.TabIndex = 38; - this.label9.Text = "Random"; - // - // Debug - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(284, 379); - this.Controls.Add(this.tableLayoutPanel1); - this.Name = "Debug"; - this.Text = "Debug"; - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Label lblOverallPercentage; - private System.Windows.Forms.Label lblPercent; - private System.Windows.Forms.Label lblOverall; - private System.Windows.Forms.Label lblCurrent; - private System.Windows.Forms.Label lblTotal; - private System.Windows.Forms.Label lblRead; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label lblKonami; - private System.Windows.Forms.Label lblRandom; - private System.Windows.Forms.Label label9; - } -} \ No newline at end of file diff --git a/tools/SRB2Updater/Debug.cs b/tools/SRB2Updater/Debug.cs deleted file mode 100644 index 5cb54dd37..000000000 --- a/tools/SRB2Updater/Debug.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; - -namespace SRB2Updater -{ - public partial class Debug : Form - { - public Debug() - { - InitializeComponent(); - } - - public String strOverall - { - get { return this.lblOverall.Text; } - set { this.lblOverall.Text = value; } - } - - public String strKonami - { - get { return this.lblKonami.Text; } - set { this.lblKonami.Text = value; } - } - - public String strRandom - { - get { return this.lblRandom.Text; } - set { this.lblRandom.Text = value; } - } - - public String strOverallPercentage - { - get { return this.lblOverallPercentage.Text; } - set { this.lblOverallPercentage.Text = value; } - } - - public String strCurrent - { - get { return this.lblCurrent.Text; } - set { this.lblCurrent.Text = value; } - } - - public String strPercent - { - get { return this.lblPercent.Text; } - set { this.lblPercent.Text = value; } - } - - public String strRead - { - get { return this.lblRead.Text; } - set { this.lblRead.Text = value; } - } - - public String strTotal - { - get { return this.lblTotal.Text; } - set { this.lblTotal.Text = value; } - } - } -} diff --git a/tools/SRB2Updater/Debug.resx b/tools/SRB2Updater/Debug.resx deleted file mode 100644 index ff31a6db5..000000000 --- a/tools/SRB2Updater/Debug.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/tools/SRB2Updater/Launcher.Designer.cs b/tools/SRB2Updater/Launcher.Designer.cs deleted file mode 100644 index 9126eba54..000000000 --- a/tools/SRB2Updater/Launcher.Designer.cs +++ /dev/null @@ -1,766 +0,0 @@ -namespace SRB2Updater -{ - partial class Launcher - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Launcher)); - this.panel1 = new System.Windows.Forms.Panel(); - this.panel3 = new System.Windows.Forms.Panel(); - this.btnOptions = new System.Windows.Forms.Button(); - this.btnCheckFiles = new System.Windows.Forms.Button(); - this.btnStartSRB2 = new System.Windows.Forms.Button(); - this.panel2 = new System.Windows.Forms.Panel(); - this.lblProgress = new System.Windows.Forms.Label(); - this.update_optional = new System.Windows.Forms.CheckBox(); - this.progress_overall = new System.Windows.Forms.ProgressBar(); - this.progress_currentFile = new System.Windows.Forms.ProgressBar(); - this.tab_web = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this.panel10 = new System.Windows.Forms.Panel(); - this.webBrowser3 = new System.Windows.Forms.WebBrowser(); - this.tabPage2 = new System.Windows.Forms.TabPage(); - this.panel9 = new System.Windows.Forms.Panel(); - this.webBrowser1 = new System.Windows.Forms.WebBrowser(); - this.tabPage3 = new System.Windows.Forms.TabPage(); - this.panel8 = new System.Windows.Forms.Panel(); - this.fileList = new System.Windows.Forms.DataGridView(); - this.name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.filename = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.status = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.localmd5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.md5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.optional = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.calculated = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.serverTab = new System.Windows.Forms.TabPage(); - this.panel6 = new System.Windows.Forms.Panel(); - this.listViewServers = new System.Windows.Forms.ListView(); - this.colhdrName = new System.Windows.Forms.ColumnHeader("(none)"); - this.colhdrGametype = new System.Windows.Forms.ColumnHeader(); - this.colhdrPing = new System.Windows.Forms.ColumnHeader(); - this.colhdrPlayers = new System.Windows.Forms.ColumnHeader(); - this.colhdrVersion = new System.Windows.Forms.ColumnHeader(); - this.panel4 = new System.Windows.Forms.Panel(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.label4 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); - this.button3 = new System.Windows.Forms.Button(); - this.btnConnect = new System.Windows.Forms.Button(); - this.panel5 = new System.Windows.Forms.Panel(); - this.bannerRandom = new System.Windows.Forms.Panel(); - this.backgroundWorkerQueryServers = new System.ComponentModel.BackgroundWorker(); - this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); - this.webBrowser2 = new System.Windows.Forms.WebBrowser(); - this.panel1.SuspendLayout(); - this.panel3.SuspendLayout(); - this.panel2.SuspendLayout(); - this.tab_web.SuspendLayout(); - this.tabPage1.SuspendLayout(); - this.panel10.SuspendLayout(); - this.tabPage2.SuspendLayout(); - this.panel9.SuspendLayout(); - this.tabPage3.SuspendLayout(); - this.panel8.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.fileList)).BeginInit(); - this.serverTab.SuspendLayout(); - this.panel6.SuspendLayout(); - this.panel4.SuspendLayout(); - this.groupBox1.SuspendLayout(); - this.panel5.SuspendLayout(); - this.SuspendLayout(); - // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.panel1.Controls.Add(this.panel3); - this.panel1.Controls.Add(this.panel2); - this.panel1.Location = new System.Drawing.Point(12, 415); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(772, 125); - this.panel1.TabIndex = 0; - // - // panel3 - // - this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel3.Controls.Add(this.btnOptions); - this.panel3.Controls.Add(this.btnCheckFiles); - this.panel3.Controls.Add(this.btnStartSRB2); - this.panel3.Location = new System.Drawing.Point(557, 10); - this.panel3.Name = "panel3"; - this.panel3.Size = new System.Drawing.Size(204, 104); - this.panel3.TabIndex = 1; - // - // btnOptions - // - this.btnOptions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.btnOptions.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnOptions.Location = new System.Drawing.Point(105, 72); - this.btnOptions.Name = "btnOptions"; - this.btnOptions.Size = new System.Drawing.Size(96, 29); - this.btnOptions.TabIndex = 2; - this.btnOptions.Text = "Options"; - this.btnOptions.UseVisualStyleBackColor = true; - this.btnOptions.Click += new System.EventHandler(this.btnOptions_Click); - // - // btnCheckFiles - // - this.btnCheckFiles.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.btnCheckFiles.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnCheckFiles.Location = new System.Drawing.Point(4, 72); - this.btnCheckFiles.Name = "btnCheckFiles"; - this.btnCheckFiles.Size = new System.Drawing.Size(96, 29); - this.btnCheckFiles.TabIndex = 1; - this.btnCheckFiles.Text = "Check Files"; - this.btnCheckFiles.UseVisualStyleBackColor = true; - this.btnCheckFiles.Click += new System.EventHandler(this.update_Load); - // - // btnStartSRB2 - // - this.btnStartSRB2.BackColor = System.Drawing.Color.Transparent; - this.btnStartSRB2.Font = new System.Drawing.Font("Arial Rounded MT Bold", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnStartSRB2.Location = new System.Drawing.Point(4, 4); - this.btnStartSRB2.Name = "btnStartSRB2"; - this.btnStartSRB2.Size = new System.Drawing.Size(197, 62); - this.btnStartSRB2.TabIndex = 0; - this.btnStartSRB2.Text = "Start"; - this.btnStartSRB2.UseVisualStyleBackColor = false; - this.btnStartSRB2.Click += new System.EventHandler(this.btnStartSRB2_Click); - // - // panel2 - // - this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel2.Controls.Add(this.lblProgress); - this.panel2.Controls.Add(this.update_optional); - this.panel2.Controls.Add(this.progress_overall); - this.panel2.Controls.Add(this.progress_currentFile); - this.panel2.Location = new System.Drawing.Point(10, 10); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(541, 105); - this.panel2.TabIndex = 0; - // - // lblProgress - // - this.lblProgress.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblProgress.AutoSize = true; - this.lblProgress.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblProgress.ForeColor = System.Drawing.Color.Black; - this.lblProgress.Location = new System.Drawing.Point(6, 68); - this.lblProgress.Name = "lblProgress"; - this.lblProgress.Size = new System.Drawing.Size(299, 14); - this.lblProgress.TabIndex = 14; - this.lblProgress.Text = "Click \'Check Files\' to check for and apply updates."; - // - // update_optional - // - this.update_optional.AutoSize = true; - this.update_optional.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.update_optional.Location = new System.Drawing.Point(372, 68); - this.update_optional.Name = "update_optional"; - this.update_optional.Size = new System.Drawing.Size(160, 18); - this.update_optional.TabIndex = 13; - this.update_optional.Text = "Download Optional Updates"; - this.update_optional.UseVisualStyleBackColor = true; - // - // progress_overall - // - this.progress_overall.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.progress_overall.Location = new System.Drawing.Point(9, 36); - this.progress_overall.Name = "progress_overall"; - this.progress_overall.Size = new System.Drawing.Size(522, 26); - this.progress_overall.TabIndex = 1; - // - // progress_currentFile - // - this.progress_currentFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.progress_currentFile.Location = new System.Drawing.Point(9, 4); - this.progress_currentFile.Name = "progress_currentFile"; - this.progress_currentFile.Size = new System.Drawing.Size(522, 26); - this.progress_currentFile.TabIndex = 0; - // - // tab_web - // - this.tab_web.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tab_web.Controls.Add(this.tabPage1); - this.tab_web.Controls.Add(this.tabPage2); - this.tab_web.Controls.Add(this.tabPage3); - this.tab_web.Controls.Add(this.serverTab); - this.tab_web.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F); - this.tab_web.Location = new System.Drawing.Point(0, 138); - this.tab_web.Name = "tab_web"; - this.tab_web.SelectedIndex = 0; - this.tab_web.Size = new System.Drawing.Size(770, 256); - this.tab_web.TabIndex = 1; - // - // tabPage1 - // - this.tabPage1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.tabPage1.Controls.Add(this.panel10); - this.tabPage1.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.tabPage1.Location = new System.Drawing.Point(4, 23); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(762, 229); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "News & Updates"; - // - // panel10 - // - this.panel10.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel10.Controls.Add(this.webBrowser3); - this.panel10.Location = new System.Drawing.Point(4, 6); - this.panel10.Name = "panel10"; - this.panel10.Padding = new System.Windows.Forms.Padding(5); - this.panel10.Size = new System.Drawing.Size(748, 217); - this.panel10.TabIndex = 14; - // - // webBrowser3 - // - this.webBrowser3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.webBrowser3.Location = new System.Drawing.Point(8, 8); - this.webBrowser3.MinimumSize = new System.Drawing.Size(20, 20); - this.webBrowser3.Name = "webBrowser3"; - this.webBrowser3.Size = new System.Drawing.Size(732, 201); - this.webBrowser3.TabIndex = 0; - this.webBrowser3.Url = new System.Uri("http://update.srb2.org/files_beta/files_beta.xml", System.UriKind.Absolute); - // - // tabPage2 - // - this.tabPage2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.tabPage2.Controls.Add(this.panel9); - this.tabPage2.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F); - this.tabPage2.Location = new System.Drawing.Point(4, 23); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(762, 229); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "Change Log"; - // - // panel9 - // - this.panel9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel9.Controls.Add(this.webBrowser1); - this.panel9.Location = new System.Drawing.Point(4, 6); - this.panel9.Name = "panel9"; - this.panel9.Padding = new System.Windows.Forms.Padding(5); - this.panel9.Size = new System.Drawing.Size(748, 217); - this.panel9.TabIndex = 13; - // - // webBrowser1 - // - this.webBrowser1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.webBrowser1.Location = new System.Drawing.Point(8, 8); - this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20); - this.webBrowser1.Name = "webBrowser1"; - this.webBrowser1.Size = new System.Drawing.Size(732, 201); - this.webBrowser1.TabIndex = 0; - this.webBrowser1.Url = new System.Uri("http://update.srb2.org/files_beta/changelog.html", System.UriKind.Absolute); - // - // tabPage3 - // - this.tabPage3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.tabPage3.Controls.Add(this.panel8); - this.tabPage3.Location = new System.Drawing.Point(4, 23); - this.tabPage3.Name = "tabPage3"; - this.tabPage3.Padding = new System.Windows.Forms.Padding(3); - this.tabPage3.Size = new System.Drawing.Size(762, 229); - this.tabPage3.TabIndex = 2; - this.tabPage3.Text = "Download List"; - // - // panel8 - // - this.panel8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel8.Controls.Add(this.fileList); - this.panel8.Location = new System.Drawing.Point(4, 6); - this.panel8.Name = "panel8"; - this.panel8.Padding = new System.Windows.Forms.Padding(5); - this.panel8.Size = new System.Drawing.Size(748, 217); - this.panel8.TabIndex = 12; - // - // fileList - // - this.fileList.AllowUserToAddRows = false; - this.fileList.AllowUserToDeleteRows = false; - this.fileList.AllowUserToResizeRows = false; - dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - dataGridViewCellStyle1.Font = new System.Drawing.Font("Arial Rounded MT Bold", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle1.ForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.Color.Black; - this.fileList.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; - this.fileList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.fileList.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; - this.fileList.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - this.fileList.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - dataGridViewCellStyle2.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F); - dataGridViewCellStyle2.ForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle2.Padding = new System.Windows.Forms.Padding(2); - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.fileList.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; - this.fileList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.fileList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.name, - this.filename, - this.status, - this.localmd5, - this.md5, - this.optional, - this.calculated}); - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - dataGridViewCellStyle4.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F); - dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.fileList.DefaultCellStyle = dataGridViewCellStyle4; - this.fileList.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.fileList.Location = new System.Drawing.Point(8, 8); - this.fileList.MultiSelect = false; - this.fileList.Name = "fileList"; - this.fileList.ReadOnly = true; - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - dataGridViewCellStyle5.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F); - dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.fileList.RowHeadersDefaultCellStyle = dataGridViewCellStyle5; - this.fileList.RowHeadersVisible = false; - dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - dataGridViewCellStyle6.ForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.Black; - this.fileList.RowsDefaultCellStyle = dataGridViewCellStyle6; - this.fileList.RowTemplate.DefaultCellStyle.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - this.fileList.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.fileList.RowTemplate.DefaultCellStyle.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - this.fileList.RowTemplate.DefaultCellStyle.SelectionForeColor = System.Drawing.Color.Black; - this.fileList.RowTemplate.ReadOnly = true; - this.fileList.Size = new System.Drawing.Size(732, 201); - this.fileList.TabIndex = 11; - // - // name - // - this.name.DataPropertyName = "name"; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.White; - this.name.DefaultCellStyle = dataGridViewCellStyle3; - this.name.FillWeight = 128.7982F; - this.name.HeaderText = "Name"; - this.name.Name = "name"; - this.name.ReadOnly = true; - // - // filename - // - this.filename.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; - this.filename.DataPropertyName = "filename"; - this.filename.HeaderText = "File"; - this.filename.Name = "filename"; - this.filename.ReadOnly = true; - this.filename.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - this.filename.Width = 150; - // - // status - // - this.status.DataPropertyName = "status"; - this.status.FillWeight = 128.7982F; - this.status.HeaderText = "Status"; - this.status.Name = "status"; - this.status.ReadOnly = true; - // - // localmd5 - // - this.localmd5.DataPropertyName = "localmd5"; - this.localmd5.FillWeight = 13.60544F; - this.localmd5.HeaderText = "localmd5"; - this.localmd5.Name = "localmd5"; - this.localmd5.ReadOnly = true; - this.localmd5.Visible = false; - // - // md5 - // - this.md5.DataPropertyName = "md5"; - this.md5.FillWeight = 128.7982F; - this.md5.HeaderText = "md5"; - this.md5.Name = "md5"; - this.md5.ReadOnly = true; - this.md5.Visible = false; - // - // optional - // - this.optional.DataPropertyName = "optional"; - this.optional.HeaderText = "optional"; - this.optional.Name = "optional"; - this.optional.ReadOnly = true; - this.optional.Visible = false; - // - // calculated - // - this.calculated.DataPropertyName = "calculated"; - this.calculated.HeaderText = "calculated"; - this.calculated.Name = "calculated"; - this.calculated.ReadOnly = true; - this.calculated.Visible = false; - // - // serverTab - // - this.serverTab.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.serverTab.Controls.Add(this.panel6); - this.serverTab.Controls.Add(this.panel4); - this.serverTab.Location = new System.Drawing.Point(4, 23); - this.serverTab.Name = "serverTab"; - this.serverTab.Padding = new System.Windows.Forms.Padding(3); - this.serverTab.Size = new System.Drawing.Size(762, 229); - this.serverTab.TabIndex = 3; - this.serverTab.Text = "Master Server"; - // - // panel6 - // - this.panel6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel6.Controls.Add(this.listViewServers); - this.panel6.Location = new System.Drawing.Point(4, 6); - this.panel6.Name = "panel6"; - this.panel6.Padding = new System.Windows.Forms.Padding(5); - this.panel6.Size = new System.Drawing.Size(603, 217); - this.panel6.TabIndex = 6; - // - // listViewServers - // - this.listViewServers.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.listViewServers.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - this.listViewServers.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.listViewServers.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.colhdrName, - this.colhdrGametype, - this.colhdrPing, - this.colhdrPlayers, - this.colhdrVersion}); - this.listViewServers.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.listViewServers.FullRowSelect = true; - this.listViewServers.HideSelection = false; - this.listViewServers.Location = new System.Drawing.Point(9, 8); - this.listViewServers.Name = "listViewServers"; - this.listViewServers.ShowItemToolTips = true; - this.listViewServers.Size = new System.Drawing.Size(586, 201); - this.listViewServers.TabIndex = 1; - this.listViewServers.UseCompatibleStateImageBehavior = false; - this.listViewServers.View = System.Windows.Forms.View.Details; - this.listViewServers.ItemActivate += new System.EventHandler(this.listViewServers_ItemActivate); - this.listViewServers.SelectedIndexChanged += new System.EventHandler(this.listViewServers_SelectedIndexChanged); - this.listViewServers.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewServers_ColumnClick); - // - // colhdrName - // - this.colhdrName.Tag = ""; - this.colhdrName.Text = "Server Name"; - this.colhdrName.Width = 231; - // - // colhdrGametype - // - this.colhdrGametype.Text = "Gametype"; - this.colhdrGametype.Width = 92; - // - // colhdrPing - // - this.colhdrPing.Text = "Ping (ms)"; - this.colhdrPing.Width = 87; - // - // colhdrPlayers - // - this.colhdrPlayers.Text = "Players"; - this.colhdrPlayers.Width = 88; - // - // colhdrVersion - // - this.colhdrVersion.Text = "Version"; - this.colhdrVersion.Width = 87; - // - // panel4 - // - this.panel4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel4.Controls.Add(this.groupBox1); - this.panel4.Controls.Add(this.button1); - this.panel4.Controls.Add(this.button3); - this.panel4.Controls.Add(this.btnConnect); - this.panel4.Location = new System.Drawing.Point(613, 6); - this.panel4.Name = "panel4"; - this.panel4.Padding = new System.Windows.Forms.Padding(5); - this.panel4.Size = new System.Drawing.Size(139, 217); - this.panel4.TabIndex = 5; - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.label4); - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.label2); - this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Location = new System.Drawing.Point(9, 114); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(122, 95); - this.groupBox1.TabIndex = 5; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Key"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label4.ForeColor = System.Drawing.Color.Black; - this.label4.Location = new System.Drawing.Point(6, 77); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(87, 14); - this.label4.TabIndex = 3; - this.label4.Text = "Normal Game"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label3.ForeColor = System.Drawing.Color.DimGray; - this.label3.Location = new System.Drawing.Point(6, 57); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(78, 14); - this.label3.TabIndex = 2; - this.label3.Text = "Game is Full"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.ForeColor = System.Drawing.Color.Green; - this.label2.Location = new System.Drawing.Point(6, 37); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(99, 14); - this.label2.TabIndex = 1; - this.label2.Text = "Cheats Enabled"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.ForeColor = System.Drawing.Color.Red; - this.label1.Location = new System.Drawing.Point(6, 17); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(57, 14); - this.label1.TabIndex = 0; - this.label1.Text = "Modified"; - // - // button1 - // - this.button1.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9.75F); - this.button1.Location = new System.Drawing.Point(8, 8); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(123, 29); - this.button1.TabIndex = 2; - this.button1.Text = "Refresh List"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.btnRefresh_Click); - // - // button3 - // - this.button3.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9.75F); - this.button3.Location = new System.Drawing.Point(8, 78); - this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(123, 29); - this.button3.TabIndex = 4; - this.button3.Text = "Join Game (IP)"; - this.button3.UseVisualStyleBackColor = true; - // - // btnConnect - // - this.btnConnect.Enabled = false; - this.btnConnect.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9.75F); - this.btnConnect.Location = new System.Drawing.Point(8, 43); - this.btnConnect.Name = "btnConnect"; - this.btnConnect.Size = new System.Drawing.Size(123, 29); - this.btnConnect.TabIndex = 3; - this.btnConnect.Text = "Join Game (List)"; - this.btnConnect.UseVisualStyleBackColor = true; - this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click); - // - // panel5 - // - this.panel5.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.panel5.Controls.Add(this.tab_web); - this.panel5.Controls.Add(this.bannerRandom); - this.panel5.Location = new System.Drawing.Point(12, 13); - this.panel5.Name = "panel5"; - this.panel5.Size = new System.Drawing.Size(772, 396); - this.panel5.TabIndex = 1; - // - // bannerRandom - // - this.bannerRandom.BackgroundImage = global::SRB2Updater.Properties.Resources.Banner4; - this.bannerRandom.Location = new System.Drawing.Point(0, -2); - this.bannerRandom.Name = "bannerRandom"; - this.bannerRandom.Size = new System.Drawing.Size(768, 123); - this.bannerRandom.TabIndex = 3; - // - // backgroundWorkerQueryServers - // - this.backgroundWorkerQueryServers.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorkerQueryServers_DoWork); - // - // openFileDialog1 - // - this.openFileDialog1.DefaultExt = "exe"; - this.openFileDialog1.Filter = "Executables files|*.exe|All files|*.*"; - // - // webBrowser2 - // - this.webBrowser2.Location = new System.Drawing.Point(8, 8); - this.webBrowser2.MinimumSize = new System.Drawing.Size(20, 20); - this.webBrowser2.Name = "webBrowser2"; - this.webBrowser2.Size = new System.Drawing.Size(567, 201); - this.webBrowser2.TabIndex = 0; - this.webBrowser2.Url = new System.Uri("http://update.srb2.org/files_beta/changelog.html", System.UriKind.Absolute); - // - // Launcher - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.ClientSize = new System.Drawing.Size(796, 552); - this.Controls.Add(this.panel5); - this.Controls.Add(this.panel1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.KeyPreview = true; - this.Name = "Launcher"; - this.Text = "Launcher"; - this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Launcher_FormClosed); - this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Launcher_KeyUp); - this.panel1.ResumeLayout(false); - this.panel3.ResumeLayout(false); - this.panel2.ResumeLayout(false); - this.panel2.PerformLayout(); - this.tab_web.ResumeLayout(false); - this.tabPage1.ResumeLayout(false); - this.panel10.ResumeLayout(false); - this.tabPage2.ResumeLayout(false); - this.panel9.ResumeLayout(false); - this.tabPage3.ResumeLayout(false); - this.panel8.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.fileList)).EndInit(); - this.serverTab.ResumeLayout(false); - this.panel6.ResumeLayout(false); - this.panel4.ResumeLayout(false); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.panel5.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Panel panel2; - private System.Windows.Forms.Panel panel3; - private System.Windows.Forms.Button btnOptions; - private System.Windows.Forms.Button btnCheckFiles; - private System.Windows.Forms.Button btnStartSRB2; - private System.Windows.Forms.TabControl tab_web; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.TabPage tabPage2; - private System.Windows.Forms.Panel panel5; - private System.Windows.Forms.WebBrowser webBrowser1; - private System.Windows.Forms.Panel bannerRandom; - private System.Windows.Forms.ProgressBar progress_overall; - private System.Windows.Forms.ProgressBar progress_currentFile; - private System.Windows.Forms.TabPage tabPage3; - private System.Windows.Forms.DataGridView fileList; - private System.Windows.Forms.CheckBox update_optional; - private System.Windows.Forms.Label lblProgress; - private System.Windows.Forms.DataGridViewTextBoxColumn name; - private System.Windows.Forms.DataGridViewTextBoxColumn filename; - private System.Windows.Forms.DataGridViewTextBoxColumn status; - private System.Windows.Forms.DataGridViewTextBoxColumn localmd5; - private System.Windows.Forms.DataGridViewTextBoxColumn md5; - private System.Windows.Forms.DataGridViewTextBoxColumn optional; - private System.Windows.Forms.DataGridViewTextBoxColumn calculated; - private System.Windows.Forms.TabPage serverTab; - private System.Windows.Forms.ListView listViewServers; - private System.Windows.Forms.ColumnHeader colhdrName; - private System.Windows.Forms.ColumnHeader colhdrGametype; - private System.Windows.Forms.ColumnHeader colhdrPing; - private System.Windows.Forms.ColumnHeader colhdrPlayers; - private System.Windows.Forms.ColumnHeader colhdrVersion; - private System.ComponentModel.BackgroundWorker backgroundWorkerQueryServers; - private System.Windows.Forms.Panel panel4; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Button button3; - private System.Windows.Forms.Button btnConnect; - private System.Windows.Forms.OpenFileDialog openFileDialog1; - private System.Windows.Forms.Panel panel6; - private System.Windows.Forms.Panel panel8; - private System.Windows.Forms.Panel panel9; - private System.Windows.Forms.Panel panel10; - private System.Windows.Forms.WebBrowser webBrowser3; - private System.Windows.Forms.WebBrowser webBrowser2; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label4; - } -} \ No newline at end of file diff --git a/tools/SRB2Updater/Launcher.cs b/tools/SRB2Updater/Launcher.cs deleted file mode 100644 index df2fdf712..000000000 --- a/tools/SRB2Updater/Launcher.cs +++ /dev/null @@ -1,658 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -//using System.Data.OleDb; -using System.Xml; -//using System.Drawing; -using System.Text; -using System.Windows.Forms; -using System.Net; -using System.IO; -using System.Threading; -using System.Security.Cryptography; -//using System.Runtime.InteropServices; -using System.Diagnostics; -using System.Drawing; -using System.Media; - -namespace SRB2Updater -{ - public partial class Launcher : Form - { - private Settings settings = new Settings(); - private Debug debug = new Debug(); - // The thread inside which the download happens - private Thread thrDownload; - private Thread thrTotal; - // The stream of data retrieved from the web server - private Stream strResponse; - // The stream of data that we write to the harddrive - private Stream strLocal; - // The request to the web server for file information - private HttpWebRequest webRequest; - // The response from the web server containing information about the file - private HttpWebResponse webResponse; - // The progress of the download in percentage - private static int PercentProgress; - private static int OverallPercentProgress; - // Overall progress as a percentage - private static Int64 OverallProgress; - // Progress stored, for calculating overall - private static Int64 CurrentProgress; - // Total File Size of entire update - private static Int64 TotalSize; - // The delegate which we will call from the thread to update the form - private delegate void UpdateProgessCallback(Int64 BytesRead, Int64 TotalBytes); - private delegate void OverallProgessCallback(Int64 BytesRead); - // When to pause - bool goPause = false; - // Download Details - string downFile; - // Updating - bool filesGot = false; - bool downloadStatus = false; - bool doneCalculate = false; - string formTitle = "Sonic Robo Blast 2 Launcher"; - bool loadedBat = false; - ProcessStartInfo startinfo = new ProcessStartInfo(); - private ServerQuerier sq; - private string MSFail; - - public Launcher(string[] args) - { - InitializeComponent(); - settings.GetSettings(); - sq = new ServerQuerier(); - ServerInfoListViewAdder silva = new ServerInfoListViewAdder(sq, this); - try - { - sq.SetMasterServer(settings.msAddress, Convert.ToUInt16(settings.msPort)); - } - catch (Exception exception) - { - MSFail = exception.Message; - } - sq.StartListening(silva); - backgroundWorkerQueryServers.RunWorkerAsync(); - foreach (string arg in args) - { - if (arg == "-debug") - { - debug.Show(); - break; - } - } - RandomBanner(); - } - - public string getMD5(string filename) - { - StringBuilder sb = new StringBuilder(); - FileInfo f = new FileInfo(filename); - FileStream fs = f.OpenRead(); - MD5 md5 = new MD5CryptoServiceProvider(); - byte[] hash = md5.ComputeHash(fs); - fs.Close(); - foreach (byte hex in hash) - sb.Append(hex.ToString("x2")); - string md5sum = sb.ToString(); - return md5sum; - } - - public void PlayIt() - { - SoundPlayer player = new SoundPlayer(Properties.Resources.Kotaku); - player.Play(); - } - - public void RandomBanner() - { - Random random = new Random(); - int rand = random.Next(0, 4); - //this.bannerRandom.BackgroundImage = global::SRB2Updater.Properties.Resources.Banner; - switch (rand) - { - case 0: - bannerRandom.BackgroundImage = global::SRB2Updater.Properties.Resources.Banner; - break; - case 1: - bannerRandom.BackgroundImage = global::SRB2Updater.Properties.Resources.Banner2; - break; - case 2: - bannerRandom.BackgroundImage = global::SRB2Updater.Properties.Resources.Banner3; - break; - case 3: - bannerRandom.BackgroundImage = global::SRB2Updater.Properties.Resources.Banner4; - break; - default: - bannerRandom.BackgroundImage = global::SRB2Updater.Properties.Resources.Banner; - break; - } - - debug.strRandom = Convert.ToString(rand); - } - - private void updateList(bool doCalculate) - { - if (filesGot == false) - { - - XmlDataDocument xmlDatadoc = new XmlDataDocument(); - xmlDatadoc.DataSet.ReadXml("http://update.srb2.org/files_beta/files_beta.xml"); - DataSet ds = new DataSet("Files DataSet"); - ds = xmlDatadoc.DataSet; - fileList.DataSource = ds.DefaultViewManager; - fileList.DataMember = "File"; - filesGot = true; - } - if (downloadStatus == false) - { - foreach (DataGridViewRow fileRow in fileList.Rows) - { - if (!File.Exists(fileRow.Cells["filename"].Value.ToString()) && fileRow.Cells["filename"].Value.ToString() != "srb2update.update") - { -// fileRow.DefaultCellStyle.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); - fileRow.Cells["localmd5"].Value = "not_found"; - } else { - if (fileRow.Cells["filename"].Value.ToString() == "srb2update.update") - fileRow.Cells["localmd5"].Value = getMD5("srb2update.exe"); - else - fileRow.Cells["localmd5"].Value = getMD5(fileRow.Cells["filename"].Value.ToString()); - } - if (fileRow.Cells["localmd5"].Value.ToString() != fileRow.Cells["md5"].Value.ToString()) - { -// if (fileRow.Cells["localmd5"].Value.ToString() != "not_found") -// fileRow.DefaultCellStyle.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(224)))), ((int)(((byte)(206))))); - fileRow.Cells["status"].Value = "Queued"; - - } - else - { - fileRow.Cells["status"].Value = "Up to date"; - } - } - if (doCalculate) - { - thrTotal = new Thread(new ParameterizedThreadStart(CalculateTotalSize)); - thrTotal.Start(0); - } - if (doneCalculate) - { - foreach (DataGridViewRow fileRow in fileList.Rows) - { - if (fileRow.Cells["localmd5"].Value.ToString() != fileRow.Cells["md5"].Value.ToString()) - { - if (fileRow.Cells["optional"].Value.ToString() == "1" && !update_optional.Checked) - fileRow.Cells["Status"].Value = "Skipped (Optional)"; - else - { - downFile = fileRow.Cells["filename"].Value.ToString(); - thrDownload = new Thread(new ParameterizedThreadStart(Download)); - thrDownload.Start(0); - fileRow.Cells["Status"].Value = "Downloading..."; - downloadStatus = true; - break; - } - } - else - { - fileRow.Cells["Status"].Value = "Up to date"; - } - CurrentProgress = 0; - } - } - } - } - - private void UpdateProgress(Int64 BytesRead, Int64 TotalBytes) - { - // Calculate the download progress in percentages - PercentProgress = Convert.ToInt32((BytesRead * 100) / TotalBytes); - // Make progress on the progress bar - progress_currentFile.Value = PercentProgress; - // Display the current progress on the form - lblProgress.Text = downFile + " - " + (BytesRead / 1024) + "KB of " + (TotalBytes / 1024) + "KB (" + PercentProgress + "%)"; - this.Text = formTitle + " :: Downloading " + downFile + " (" + PercentProgress + "%)"; - debug.strPercent = PercentProgress.ToString() + "%"; - if (BytesRead >= TotalBytes - 1) - updateList(false); - } - - private void UpdateOverallProgress(Int64 BytesRead) - { - // Calculate progress change and add to OverallProgress... - OverallProgress += BytesRead - CurrentProgress; - // Calculate the download progress in percentages - if (TotalSize < 1) - TotalSize = 1; - OverallPercentProgress = Convert.ToInt32((OverallProgress * 100) / TotalSize); - // Make progress on the progress bar - if (OverallPercentProgress > 100) - OverallPercentProgress = 100; - progress_overall.Value = OverallPercentProgress; - if (OverallProgress >= TotalSize) - { - lblProgress.Text = "Done"; - btnCheckFiles.Enabled = true; - } - CurrentProgress = BytesRead; - debug.strCurrent = Convert.ToString(CurrentProgress) + " bytes"; - debug.strOverall = Convert.ToString(OverallProgress) + " bytes"; - debug.strOverallPercentage = Convert.ToString(OverallPercentProgress) + "%"; - debug.strRead = Convert.ToString(BytesRead) + " bytes"; - debug.strTotal = Convert.ToString(TotalSize) + " bytes"; - } - - private void CalculateTotalSize(object startpoint) - { - foreach (DataGridViewRow fileRow in fileList.Rows) - { - if ((fileRow.Cells["optional"].Value.ToString() == "0" || update_optional.Checked) && fileRow.Cells["localmd5"].Value.ToString() != fileRow.Cells["md5"].Value.ToString()) - { - try - { - // Create a request to the file we are downloading - webRequest = (HttpWebRequest)WebRequest.Create("http://update.srb2.org/files_beta/" + fileRow.Cells["filename"].Value.ToString()); - // Set the starting point of the request - webRequest.AddRange(0); - - // Set default authentication for retrieving the file - webRequest.Credentials = CredentialCache.DefaultCredentials; - // Retrieve the response from the server - webResponse = (HttpWebResponse)webRequest.GetResponse(); - // Ask the server for the file size and store it - Int64 fileSize = webResponse.ContentLength; - TotalSize = TotalSize + fileSize; - } - finally - { - // When the above code has ended, close the streams - webResponse.Close(); - } - } - } - doneCalculate = true; - updateList(false); - } - - private void Download(object startpoint) - { - try - { - string filename = Convert.ToString(startpoint); - // Create a request to the file we are downloading - webRequest = (HttpWebRequest)WebRequest.Create("http://update.srb2.org/files_beta/" + downFile); - // Set the starting point of the request - webRequest.AddRange(0); - - // Set default authentication for retrieving the file - webRequest.Credentials = CredentialCache.DefaultCredentials; - // Retrieve the response from the server - webResponse = (HttpWebResponse)webRequest.GetResponse(); - // Ask the server for the file size and store it - Int64 fileSize = webResponse.ContentLength; - - // Open the URL for download - strResponse = webResponse.GetResponseStream(); - - // Create a new file stream where we will be saving the data (local drive) - strLocal = new FileStream(downFile, FileMode.Create, FileAccess.Write, FileShare.None); - // It will store the current number of bytes we retrieved from the server - int bytesSize = 0; - // A buffer for storing and writing the data retrieved from the server - byte[] downBuffer = new byte[2048]; - - // Loop through the buffer until the buffer is empty - while ((bytesSize = strResponse.Read(downBuffer, 0, downBuffer.Length)) > 0) - { - // Write the data from the buffer to the local hard drive - strLocal.Write(downBuffer, 0, bytesSize); - // Invoke the method that updates the form's label and progress bar - this.Invoke(new UpdateProgessCallback(this.UpdateProgress), new object[] { strLocal.Length, fileSize }); - this.Invoke(new OverallProgessCallback(this.UpdateOverallProgress), new object[] { strLocal.Length }); - - if (goPause == true) - { - break; - } - } - } - finally - { - // When the above code has ended, close the streams - strResponse.Close(); - strLocal.Close(); - // And update the row! - downloadStatus = false; - if (downFile == "srb2update.update" && loadedBat != true) - { - MessageBox.Show("The updater will now restart to apply a patch.", "Self Update", MessageBoxButtons.OK); - CreateUpdaterBat(); - startinfo.WindowStyle = ProcessWindowStyle.Hidden; - startinfo.FileName = "srb2update.bat"; - System.Diagnostics.Process.Start(startinfo); - downloadStatus = false; - Environment.Exit(0); - } else - updateList(false); - } - } - - private void CreateUpdaterBat() - { - File.WriteAllText("srb2update.bat", "ping 127.0.0.1\ncopy srb2update.update srb2update.exe\ndel srb2update.update\nsrb2update.exe\nexit"); - } - - - private void update_Load(object sender, EventArgs e) - { - lblProgress.Text = "Getting File List..."; - if (File.Exists("srb2update.bat")) - File.Delete("srb2update.bat"); - TotalSize = 0; - CurrentProgress = 0; - OverallPercentProgress = 0; - OverallProgress = 0; - btnCheckFiles.Enabled = false; - updateList(true); - } - - private void btnOptions_Click(object sender, EventArgs e) - { - new Options(settings).ShowDialog(); - } - - private class ServerInfoListViewAdder : ServerQuerier.ServerInfoReceiveHandler - { - private delegate ListViewItem AddToListCallback(ListViewItem lvi); - private Launcher form1; - private Dictionary dicGametypes = new Dictionary(); - private static Dictionary> dicDefaultFiles = - new Dictionary>(); - - static ServerInfoListViewAdder() - { - dicDefaultFiles.Add( - ServerQuerier.ServerInfoVer.SIV_PREME, - new List( - new string[] { - "srb2.srb", "sonic.plr", "tails.plr", "knux.plr", - "auto.wpn", "bomb.wpn", "home.wpn", "rail.wpn", "infn.wpn", - "drill.dta", "soar.dta", "music.dta" - }) - ); - - dicDefaultFiles.Add( - ServerQuerier.ServerInfoVer.SIV_ME, - new List( - new string[] { - "srb2.wad", "sonic.plr", "tails.plr", "knux.plr", - "rings.wpn", "drill.dta", "soar.dta", "music.dta" - }) - ); - } - - - public ServerInfoListViewAdder(ServerQuerier sq, Launcher form1) - : base(sq) - { - this.form1 = form1; - - // Gametypes. - dicGametypes.Add(0, "Co-op"); - dicGametypes.Add(1, "Match"); - dicGametypes.Add(2, "Race"); - dicGametypes.Add(3, "Tag"); - dicGametypes.Add(4, "CTF"); - dicGametypes.Add(5, "Chaos"); - - // Don't think these are actually used. - dicGametypes.Add(42, "Team Match"); - dicGametypes.Add(43, "Time-Only Race"); - } - - public override void ProcessServerInfo(ServerQuerier.SRB2ServerInfo srb2si) - { - ListView lv = form1.listViewServers; - - // Build a list item. - ListViewItem lvi = new ListViewItem(srb2si.strName); - - // So we can get address and whatever else we might need. - lvi.Tag = srb2si; - - // Gametype string, or number if not recognised. - if (dicGametypes.ContainsKey(srb2si.byGametype)) - lvi.SubItems.Add(dicGametypes[srb2si.byGametype]); - else - lvi.SubItems.Add(Convert.ToString(srb2si.byGametype)); - - lvi.SubItems.Add(Convert.ToString(srb2si.uiTime)); - lvi.SubItems.Add(srb2si.byPlayers + "/" + srb2si.byMaxplayers); - lvi.SubItems.Add(srb2si.strVersion); - - // Make the tooltip. - BuildTooltip(lvi, form1.settings.ShowDefaultWads); - - // Is the game full? - if (srb2si.byPlayers >= srb2si.byMaxplayers) - lvi.ForeColor = Color.DimGray; - // Modified? - else if (srb2si.bModified) - lvi.ForeColor = Color.Red; - - // Thread-safe goodness. - if (lv.InvokeRequired) - { - // Call ourselves in the context of the form's thread. - AddToListCallback addtolistcallback = new AddToListCallback(lv.Items.Add); - lv.Invoke(addtolistcallback, new object[] { lvi }); - } - else - { - // Add it! - lv.Items.Add(lvi); - } - - } - - public override void HandleException(Exception e) - { - - } - - public static void BuildTooltip(ListViewItem lvi, bool bShowDefaultWads) - { - string strWads = String.Empty; - ServerQuerier.SRB2ServerInfo srb2si = (ServerQuerier.SRB2ServerInfo)lvi.Tag; - - foreach (ServerQuerier.AddedWad aw in srb2si.listFiles) - { - List listDefaultFiles = dicDefaultFiles[srb2si.siv]; - - if (bShowDefaultWads || !listDefaultFiles.Contains(aw.strFilename)) - { - strWads += String.Format("\n{0} ({1:f1} KB)", aw.strFilename, Convert.ToSingle(aw.uiSize) / 1024); - if (aw.bImportant) - { - if (aw.downloadtype == ServerQuerier.DownloadTypes.DT_TOOBIG) - strWads += " (too big to download)"; - else if (aw.downloadtype == ServerQuerier.DownloadTypes.DT_DISABLED) - strWads += " (downloading disabled)"; - } - else strWads += " (unimportant)"; - } - } - - lvi.ToolTipText = "Current map: " + srb2si.strMapName + "\n"; - if (strWads != String.Empty) - lvi.ToolTipText += "Wads added:" + strWads; - else lvi.ToolTipText += "No wads added"; - } - } - - private void backgroundWorkerQueryServers_DoWork(object sender, DoWorkEventArgs e) - { - MSClient msclient = new MSClient(); - - try - { - List listServers = msclient.GetServerList(settings.msAddress, Convert.ToUInt16(settings.msPort)); - - - // Query each of the individual servers asynchronously. - foreach (MSServerEntry msse in listServers) - { - sq.Query(msse.strAddress, msse.unPort); - } - } - catch (System.Net.Sockets.SocketException sockexception) - { - MSFail = sockexception.Message; - } - catch (Exception exception) - { - MSFail = exception.Message; - } - } - - private void btnRefresh_Click(object sender, EventArgs e) - { - if (!backgroundWorkerQueryServers.IsBusy) - { - // Clear the server list. - listViewServers.Items.Clear(); - - // Disable the Connect button. - btnConnect.Enabled = false; - - // Query the MS and the individual servers in another thread. - backgroundWorkerQueryServers.RunWorkerAsync(); - } - } - - private void btnConnect_Click(object sender, EventArgs e) - { - if (listViewServers.SelectedItems.Count > 0) - { - ConnectToServerFromListItem(listViewServers.SelectedItems[0]); - } - } - - private void ConnectToServerFromListItem(ListViewItem lvi) - { - ServerQuerier.SRB2ServerInfo srb2si = (ServerQuerier.SRB2ServerInfo)lvi.Tag; - - // Prompt to get a binary if we need one. - if (!settings.HasBinaryForVersion(srb2si.strVersion) && - MessageBox.Show("To join this game, you must register an executable file for version " + srb2si.strVersion + ". Would you like to do so?", Text, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes && - openFileDialog1.ShowDialog() == DialogResult.OK) - { - settings.SetBinary(srb2si.strVersion, openFileDialog1.FileName); - settings.SaveSettings(); - } - - // Go! - ConnectToServer(srb2si.strAddress, srb2si.unPort, srb2si.strVersion); - } - - private void ConnectToServer(string strAddress, ushort unPort, string strVersion) - { - // Make sure we now have a binary. - if (settings.HasBinaryForVersion(strVersion)) - { - try - { - string strBinary = settings.GetBinary(strVersion); - string strDirectory = System.IO.Path.GetDirectoryName(strBinary); - if (strDirectory != String.Empty) - System.IO.Directory.SetCurrentDirectory(strDirectory); - System.Diagnostics.Process.Start(strBinary, System.String.Format("-connect {0}:{1} {2}", strAddress, unPort, settings.Params)).Close(); - if (settings.CloseOnStart) - Environment.Exit(0); - } - catch (Exception exception) - { - MessageBox.Show("Unable to start SRB2: " + exception.Message + ".", "SRB2 MS Launcher", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - } - - private class ListViewSorter : System.Collections.IComparer - { - private int iColumn; - public int Column { get { return iColumn; } } - public SortOrder so; - - public ListViewSorter(int iColumn) - { - this.iColumn = iColumn; - so = SortOrder.Ascending; - } - - public int Compare(object x, object y) - { - ListViewItem lviX = (ListViewItem)x; - ListViewItem lviY = (ListViewItem)y; - - return ((so == SortOrder.Ascending) ? 1 : -1) * String.Compare(lviX.SubItems[iColumn].Text, lviY.SubItems[iColumn].Text); - } - - public void ToggleSortOrder() - { - if (so != SortOrder.Ascending) - so = SortOrder.Ascending; - else - so = SortOrder.Descending; - } - } - - private void listViewServers_ColumnClick(object sender, ColumnClickEventArgs e) - { - if (listViewServers.ListViewItemSorter != null && - ((ListViewSorter)listViewServers.ListViewItemSorter).Column == e.Column) - { - ((ListViewSorter)listViewServers.ListViewItemSorter).ToggleSortOrder(); - listViewServers.Sort(); - } - else - { - listViewServers.ListViewItemSorter = new ListViewSorter(e.Column); - } - } - - private void listViewServers_SelectedIndexChanged(object sender, EventArgs e) - { - btnConnect.Enabled = (listViewServers.SelectedItems.Count > 0); - } - - private void listViewServers_ItemActivate(object sender, EventArgs e) - { - ConnectToServerFromListItem(listViewServers.SelectedItems[0]); - } - - private void Launcher_FormClosed(object sender, FormClosedEventArgs e) - { - Environment.Exit(0); - } - - private Bunny sequence = new Bunny(); - - private void Launcher_KeyUp(object sender, KeyEventArgs e) - { - if (sequence.IsCompletedBy(e.KeyCode)) - { - PlayIt(); - } - debug.strKonami = Convert.ToString(sequence.Position); - } - - private void btnStartSRB2_Click(object sender, EventArgs e) - { - System.Diagnostics.Process.Start("srb2win.exe", System.String.Format("{0}", settings.Params)).Close(); - if(settings.CloseOnStart) - Environment.Exit(0); - } - } -} diff --git a/tools/SRB2Updater/Launcher.resx b/tools/SRB2Updater/Launcher.resx deleted file mode 100644 index 464d72c21..000000000 --- a/tools/SRB2Updater/Launcher.resx +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - 17, 17 - - - 585, 17 - - - - - AAABAAEAICAAAAEACACoCAAAFgAAACgAAAAgAAAAQAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAADg4OAIAAAABQABkAlgAAALkAAABQGQAAcwAlAJYAMQBzJQAAuQA9AJYxAACWAGIAMjIyALk9 - AAD/JSUAPj4+AFZWVgD/SEgAYmJiAABilgBubm4Aenp6AP9rawCAgIAAhoaGAJKSkgD/jo4Anp6eAKSg - oAD/jqsAqqqqAGuP/wC2trYAwMDAAI6r/wDCwsIAa8b/AM7OzgCO1P8A2traAObm5gDy8vIA////AAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAGgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFQ8PHQAAAAAAAAAAAAAAACMgJSUlJSUZ - AAAAABMNBgoPDw8AAAAAAAAAAAAAACInJycnJycnJyclFgYGBggPDw8PDwAAAAAAAAAAAAAjJycnJycn - JycnGScnFQkGCA8PDw8AAAAAAAAAAAAAISMnJycjIyMjJycnJycVDwYGDw8PDwAAAAAAAAAAAAAQAAEj - HygqKSkkHyMnJwoPDwYJDw8PAAAAAAAAAAAAACkTHxwrKysrKysrGhkMDw8PCwYJDw8AAAAAAAAAACkp - JA0pACkrKysrKyspDw8PDw8PAwYIAAAAAAAAAAAAACsiARwAISsrKysrKysSDw8PDw8PAwYAAAAAAAAA - AAAAKyIAEAAfKysrKysrKxcPDw8PDw8PDwgIABYAABcSCAArKAMPACIrKysrKysrGw8PDw8PDw8PDw8P - Dw8PDw8RACsoBA8EISsrKysrKyseDw8PDw8PDw8PDw8PDw8PDwAAKx8PDw8VKSsrKysrKxcPDw8PDw8P - Dw8PDw8PDw8AACooFQ8PDw8aKCsrKysmDw8PDw8PDw8PDw8PDw8PFQAAAAAKDw8PDw8VIigoIgoPDw8P - Dw8PDw8PDw8PDxEAAAAAAAoPDw8PDw8XFxcXEhIPDwUPDw8PDw8PDw8YAAAAAAAACA8PDw8SFxcXFxcX - FxcPFQ8PDw8PDw8KAAAAAAAAAAAACg8PEhcXFxcXFxcXFxkjBRISEhISGAAAAAAAAAAAIRcXCA8XFxcX - FxcXFxcaJyMFDwoLEQAAAAAAAAAAAAAAFxcSDxIXFxcXFxcSEyAlIwILCwsIAAAAAAAAAAAAABcXEg8A - EhIXFxcXEgoPDBUUBwsLCwsLAAAAAAAAAAAAFxcAAAAAFxIXFxcXFxIKDw8ICwsLDg4LAAAAAAAAAAAA - AAAAAAAAABISFxcXFw8PDw8PDw8PDwAAAAAAAAAAAAAAAAAAAAAAAAASEhcSDw8PDw8PDxIAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAFwoSDw8SFwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAP///////////////////3////w//APAf/AAAH/gAAD/wAAA/8AAAP/AAAD/AAAB/4AA - Af+AAABYgAAAAIAAAAGAAAADAAAAA8AAAAfAAAAPwAAAP+AAAH+AAAH/wAAB/4QAAP+eAAB//4AA///g - Af//+A////////////////// - - - \ No newline at end of file diff --git a/tools/SRB2Updater/MSClient.cs b/tools/SRB2Updater/MSClient.cs deleted file mode 100644 index 40cb0d984..000000000 --- a/tools/SRB2Updater/MSClient.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Net.Sockets; -using System.Net; -using System.IO; - -namespace SRB2Updater -{ - class MSClient - { - private Socket socket; - - /// - /// Constructs an MS client object. - /// - public MSClient() - { - socket = new Socket( - AddressFamily.InterNetwork, - SocketType.Stream, - ProtocolType.IP); - } - - /// - /// Gets list of servers reported by the MS. - /// - /// Hostname or IP address of MS. - /// Port of MS. - /// List of running servers. - public List GetServerList(string strAddress, ushort unPort) - { - // Resolve the address if necessary. - IPHostEntry iphe = Dns.GetHostEntry(strAddress); - - int iIPIndex = 0; - while (iIPIndex < iphe.AddressList.Length && - iphe.AddressList[iIPIndex].AddressFamily != socket.AddressFamily) - { - iIPIndex++; - } - - // No addresses from our family? - if (iIPIndex >= iphe.AddressList.Length) - throw new SocketException((int)SocketError.HostNotFound); - - socket.Connect(iphe.AddressList[iIPIndex], unPort); - - // Send a request for the short server list. - byte[] byPacket = new byte[12]; - BinaryWriter bw = new BinaryWriter(new MemoryStream(byPacket)); - bw.Write((uint)0); // Unused - bw.Write((uint)IPAddress.HostToNetworkOrder(205)); // GET_SHORT_SERVER_MSG - bw.Write((uint)0); // Length of tail. - socket.Send(byPacket); - - List listServers = new List(); - - // Don't sit and wait for ever. - socket.ReceiveTimeout = 10000; - - // Keep reading packets. We break if we receive the sentinel end-packet. - byte[] byServer = new byte[12 + 80]; - while (true) - { - int iLen = socket.Receive(byServer); - BinaryReader br = new BinaryReader(new MemoryStream(byServer)); - - // Ignore the first eight bytes. - br.ReadInt64(); - - // Is that the list finished? - int iTailLen = IPAddress.NetworkToHostOrder(br.ReadInt32()); - if (iTailLen == 0) - break; - else if (iTailLen != iLen - 12) - { - // MS is in a bad mood. - //throw new Exception("Bad packet."); - break; - } - - // Otherwise, add the server to the list. - MSServerEntry msse = new MSServerEntry(); - - br.ReadBytes(16); // Skip. - msse.strAddress = Encoding.ASCII.GetString(br.ReadBytes(16)); - - string str = Encoding.ASCII.GetString(br.ReadBytes(8)); - int iPos = str.IndexOf("\0"); - if (iPos >= 0) - str = str.Remove(iPos); - msse.unPort = Convert.ToUInt16(str); - - msse.strName = Encoding.ASCII.GetString(br.ReadBytes(32)); - iPos = msse.strName.IndexOf("\0"); - if (iPos >= 0) - msse.strName = msse.strName.Remove(iPos); - - msse.strVersion = Encoding.ASCII.GetString(br.ReadBytes(8)); - iPos = msse.strVersion.IndexOf("\0"); - if (iPos >= 0) - msse.strVersion = msse.strVersion.Remove(iPos); - - listServers.Add(msse); - } - - return listServers; - } - } - - public struct MSServerEntry - { - public string strAddress; - public ushort unPort; - public string strName; - public string strVersion; - public bool bPermanent; - } - -} diff --git a/tools/SRB2Updater/Options.Designer.cs b/tools/SRB2Updater/Options.Designer.cs deleted file mode 100644 index 01234549d..000000000 --- a/tools/SRB2Updater/Options.Designer.cs +++ /dev/null @@ -1,628 +0,0 @@ -namespace SRB2Updater -{ - partial class Options - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Options)); - this.groupDisplay = new System.Windows.Forms.GroupBox(); - this.label2 = new System.Windows.Forms.Label(); - this.txtHeight = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.txtWidth = new System.Windows.Forms.TextBox(); - this.chkCustomResolution = new System.Windows.Forms.CheckBox(); - this.chkDisplayWindowed = new System.Windows.Forms.CheckBox(); - this.panel1 = new System.Windows.Forms.Panel(); - this.btnCancel = new System.Windows.Forms.Button(); - this.btnSave = new System.Windows.Forms.Button(); - this.panel2 = new System.Windows.Forms.Panel(); - this.groupMS = new System.Windows.Forms.GroupBox(); - this.label4 = new System.Windows.Forms.Label(); - this.txtMSPort = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.txtMSAddress = new System.Windows.Forms.TextBox(); - this.panel3 = new System.Windows.Forms.Panel(); - this.panel7 = new System.Windows.Forms.Panel(); - this.groupBox3 = new System.Windows.Forms.GroupBox(); - this.txtParams = new System.Windows.Forms.TextBox(); - this.label9 = new System.Windows.Forms.Label(); - this.panel4 = new System.Windows.Forms.Panel(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.listviewBinaries = new System.Windows.Forms.ListView(); - this.colhdrVersion = new System.Windows.Forms.ColumnHeader(); - this.colhdrBinary = new System.Windows.Forms.ColumnHeader(); - this.textboxBinary = new System.Windows.Forms.TextBox(); - this.btnAdd = new System.Windows.Forms.Button(); - this.btnDel = new System.Windows.Forms.Button(); - this.label5 = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); - this.btnBrowse = new System.Windows.Forms.Button(); - this.textboxVersion = new System.Windows.Forms.TextBox(); - this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); - this.tabControl1 = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this.tabPage2 = new System.Windows.Forms.TabPage(); - this.panel5 = new System.Windows.Forms.Panel(); - this.panel6 = new System.Windows.Forms.Panel(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.chkShowDefaultWads = new System.Windows.Forms.CheckBox(); - this.chkCloseOnStart = new System.Windows.Forms.CheckBox(); - this.groupDisplay.SuspendLayout(); - this.panel1.SuspendLayout(); - this.panel2.SuspendLayout(); - this.groupMS.SuspendLayout(); - this.panel3.SuspendLayout(); - this.panel7.SuspendLayout(); - this.groupBox3.SuspendLayout(); - this.panel4.SuspendLayout(); - this.groupBox1.SuspendLayout(); - this.tabControl1.SuspendLayout(); - this.tabPage1.SuspendLayout(); - this.tabPage2.SuspendLayout(); - this.panel5.SuspendLayout(); - this.panel6.SuspendLayout(); - this.groupBox2.SuspendLayout(); - this.SuspendLayout(); - // - // groupDisplay - // - this.groupDisplay.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupDisplay.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.groupDisplay.Controls.Add(this.label2); - this.groupDisplay.Controls.Add(this.txtHeight); - this.groupDisplay.Controls.Add(this.label1); - this.groupDisplay.Controls.Add(this.txtWidth); - this.groupDisplay.Controls.Add(this.chkCustomResolution); - this.groupDisplay.Controls.Add(this.chkDisplayWindowed); - this.groupDisplay.Location = new System.Drawing.Point(8, 8); - this.groupDisplay.Name = "groupDisplay"; - this.groupDisplay.Size = new System.Drawing.Size(268, 102); - this.groupDisplay.TabIndex = 1; - this.groupDisplay.TabStop = false; - this.groupDisplay.Text = "Display Settings"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(128, 74); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(46, 15); - this.label2.TabIndex = 5; - this.label2.Text = "Height:"; - // - // txtHeight - // - this.txtHeight.Location = new System.Drawing.Point(175, 71); - this.txtHeight.MaxLength = 4; - this.txtHeight.Name = "txtHeight"; - this.txtHeight.Size = new System.Drawing.Size(46, 21); - this.txtHeight.TabIndex = 4; - this.txtHeight.Text = "768"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(19, 74); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(41, 15); - this.label1.TabIndex = 3; - this.label1.Text = "Width:"; - // - // txtWidth - // - this.txtWidth.Location = new System.Drawing.Point(66, 71); - this.txtWidth.MaxLength = 4; - this.txtWidth.Name = "txtWidth"; - this.txtWidth.Size = new System.Drawing.Size(46, 21); - this.txtWidth.TabIndex = 2; - this.txtWidth.Text = "1024"; - // - // chkCustomResolution - // - this.chkCustomResolution.AutoSize = true; - this.chkCustomResolution.Location = new System.Drawing.Point(6, 46); - this.chkCustomResolution.Name = "chkCustomResolution"; - this.chkCustomResolution.Size = new System.Drawing.Size(159, 19); - this.chkCustomResolution.TabIndex = 1; - this.chkCustomResolution.Text = "Use Custom Resolution"; - this.chkCustomResolution.UseVisualStyleBackColor = true; - this.chkCustomResolution.CheckedChanged += new System.EventHandler(this.chkCustomResolution_CheckedChanged); - // - // chkDisplayWindowed - // - this.chkDisplayWindowed.AutoSize = true; - this.chkDisplayWindowed.Location = new System.Drawing.Point(6, 20); - this.chkDisplayWindowed.Name = "chkDisplayWindowed"; - this.chkDisplayWindowed.Size = new System.Drawing.Size(117, 19); - this.chkDisplayWindowed.TabIndex = 0; - this.chkDisplayWindowed.Text = "Windowed Mode"; - this.chkDisplayWindowed.UseVisualStyleBackColor = true; - // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel1.Controls.Add(this.groupDisplay); - this.panel1.Location = new System.Drawing.Point(14, 13); - this.panel1.Name = "panel1"; - this.panel1.Padding = new System.Windows.Forms.Padding(5); - this.panel1.Size = new System.Drawing.Size(284, 118); - this.panel1.TabIndex = 2; - // - // btnCancel - // - this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnCancel.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnCancel.Location = new System.Drawing.Point(260, 525); - this.btnCancel.Name = "btnCancel"; - this.btnCancel.Size = new System.Drawing.Size(75, 23); - this.btnCancel.TabIndex = 3; - this.btnCancel.Text = "Cancel"; - this.btnCancel.UseVisualStyleBackColor = true; - this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); - // - // btnSave - // - this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnSave.Font = new System.Drawing.Font("Arial Rounded MT Bold", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnSave.Location = new System.Drawing.Point(174, 525); - this.btnSave.Name = "btnSave"; - this.btnSave.Size = new System.Drawing.Size(75, 23); - this.btnSave.TabIndex = 4; - this.btnSave.Text = "Ok"; - this.btnSave.UseVisualStyleBackColor = true; - this.btnSave.Click += new System.EventHandler(this.btnSave_Click); - // - // panel2 - // - this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel2.Controls.Add(this.groupMS); - this.panel2.Location = new System.Drawing.Point(13, 13); - this.panel2.Name = "panel2"; - this.panel2.Padding = new System.Windows.Forms.Padding(5); - this.panel2.Size = new System.Drawing.Size(286, 95); - this.panel2.TabIndex = 5; - // - // groupMS - // - this.groupMS.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupMS.Controls.Add(this.label4); - this.groupMS.Controls.Add(this.txtMSPort); - this.groupMS.Controls.Add(this.label3); - this.groupMS.Controls.Add(this.txtMSAddress); - this.groupMS.Location = new System.Drawing.Point(9, 8); - this.groupMS.Name = "groupMS"; - this.groupMS.Size = new System.Drawing.Size(269, 79); - this.groupMS.TabIndex = 0; - this.groupMS.TabStop = false; - this.groupMS.Text = "Connection"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(41, 51); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(32, 15); - this.label4.TabIndex = 3; - this.label4.Text = "Port:"; - // - // txtMSPort - // - this.txtMSPort.Location = new System.Drawing.Point(79, 48); - this.txtMSPort.Name = "txtMSPort"; - this.txtMSPort.Size = new System.Drawing.Size(86, 21); - this.txtMSPort.TabIndex = 2; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(17, 23); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(56, 15); - this.label3.TabIndex = 1; - this.label3.Text = "Address:"; - // - // txtMSAddress - // - this.txtMSAddress.Location = new System.Drawing.Point(79, 20); - this.txtMSAddress.Name = "txtMSAddress"; - this.txtMSAddress.Size = new System.Drawing.Size(184, 21); - this.txtMSAddress.TabIndex = 0; - // - // panel3 - // - this.panel3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.panel3.Controls.Add(this.panel7); - this.panel3.Controls.Add(this.panel4); - this.panel3.Controls.Add(this.panel1); - this.panel3.Location = new System.Drawing.Point(6, 6); - this.panel3.Name = "panel3"; - this.panel3.Padding = new System.Windows.Forms.Padding(10); - this.panel3.Size = new System.Drawing.Size(312, 467); - this.panel3.TabIndex = 6; - // - // panel7 - // - this.panel7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel7.Controls.Add(this.groupBox3); - this.panel7.Location = new System.Drawing.Point(15, 350); - this.panel7.Name = "panel7"; - this.panel7.Padding = new System.Windows.Forms.Padding(5); - this.panel7.Size = new System.Drawing.Size(283, 106); - this.panel7.TabIndex = 7; - // - // groupBox3 - // - this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox3.Controls.Add(this.chkCloseOnStart); - this.groupBox3.Controls.Add(this.txtParams); - this.groupBox3.Controls.Add(this.label9); - this.groupBox3.Location = new System.Drawing.Point(13, 8); - this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(258, 83); - this.groupBox3.TabIndex = 12; - this.groupBox3.TabStop = false; - this.groupBox3.Text = "Command Line"; - // - // txtParams - // - this.txtParams.Location = new System.Drawing.Point(83, 20); - this.txtParams.Name = "txtParams"; - this.txtParams.Size = new System.Drawing.Size(167, 21); - this.txtParams.TabIndex = 6; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(5, 23); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(75, 15); - this.label9.TabIndex = 7; - this.label9.Text = "Parameters:"; - // - // panel4 - // - this.panel4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel4.Controls.Add(this.groupBox1); - this.panel4.Location = new System.Drawing.Point(15, 137); - this.panel4.Name = "panel4"; - this.panel4.Padding = new System.Windows.Forms.Padding(5); - this.panel4.Size = new System.Drawing.Size(284, 207); - this.panel4.TabIndex = 6; - // - // groupBox1 - // - this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox1.Controls.Add(this.listviewBinaries); - this.groupBox1.Controls.Add(this.textboxBinary); - this.groupBox1.Controls.Add(this.btnAdd); - this.groupBox1.Controls.Add(this.btnDel); - this.groupBox1.Controls.Add(this.label5); - this.groupBox1.Controls.Add(this.label7); - this.groupBox1.Controls.Add(this.btnBrowse); - this.groupBox1.Controls.Add(this.textboxVersion); - this.groupBox1.Location = new System.Drawing.Point(13, 8); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(259, 191); - this.groupBox1.TabIndex = 12; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Executables"; - // - // listviewBinaries - // - this.listviewBinaries.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.listviewBinaries.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.colhdrVersion, - this.colhdrBinary}); - this.listviewBinaries.FullRowSelect = true; - this.listviewBinaries.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this.listviewBinaries.HideSelection = false; - this.listviewBinaries.Location = new System.Drawing.Point(6, 19); - this.listviewBinaries.Name = "listviewBinaries"; - this.listviewBinaries.Size = new System.Drawing.Size(245, 83); - this.listviewBinaries.TabIndex = 0; - this.listviewBinaries.UseCompatibleStateImageBehavior = false; - this.listviewBinaries.View = System.Windows.Forms.View.Details; - this.listviewBinaries.SelectedIndexChanged += new System.EventHandler(this.listviewBinaries_SelectedIndexChanged); - // - // colhdrVersion - // - this.colhdrVersion.Text = "Version"; - // - // colhdrBinary - // - this.colhdrBinary.Text = "Binary"; - this.colhdrBinary.Width = 198; - // - // textboxBinary - // - this.textboxBinary.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textboxBinary.Enabled = false; - this.textboxBinary.Location = new System.Drawing.Point(84, 161); - this.textboxBinary.Name = "textboxBinary"; - this.textboxBinary.Size = new System.Drawing.Size(93, 21); - this.textboxBinary.TabIndex = 4; - this.textboxBinary.TextChanged += new System.EventHandler(this.textboxBinary_TextChanged); - // - // btnAdd - // - this.btnAdd.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.btnAdd.Location = new System.Drawing.Point(51, 104); - this.btnAdd.Name = "btnAdd"; - this.btnAdd.Size = new System.Drawing.Size(98, 25); - this.btnAdd.TabIndex = 1; - this.btnAdd.Text = "&Add"; - this.btnAdd.UseVisualStyleBackColor = true; - this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click); - // - // btnDel - // - this.btnDel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.btnDel.Enabled = false; - this.btnDel.Location = new System.Drawing.Point(155, 104); - this.btnDel.Name = "btnDel"; - this.btnDel.Size = new System.Drawing.Size(98, 25); - this.btnDel.TabIndex = 2; - this.btnDel.Text = "&Delete"; - this.btnDel.UseVisualStyleBackColor = true; - this.btnDel.Click += new System.EventHandler(this.btnDel_Click); - // - // label5 - // - this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(6, 138); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(51, 15); - this.label5.TabIndex = 2; - this.label5.Text = "Version:"; - // - // label7 - // - this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(6, 164); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(44, 15); - this.label7.TabIndex = 3; - this.label7.Text = "Binary:"; - // - // btnBrowse - // - this.btnBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.btnBrowse.Enabled = false; - this.btnBrowse.Location = new System.Drawing.Point(183, 161); - this.btnBrowse.Name = "btnBrowse"; - this.btnBrowse.Size = new System.Drawing.Size(68, 21); - this.btnBrowse.TabIndex = 5; - this.btnBrowse.Text = "&Browse..."; - this.btnBrowse.UseVisualStyleBackColor = true; - this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click); - // - // textboxVersion - // - this.textboxVersion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textboxVersion.Enabled = false; - this.textboxVersion.Location = new System.Drawing.Point(84, 135); - this.textboxVersion.Name = "textboxVersion"; - this.textboxVersion.Size = new System.Drawing.Size(167, 21); - this.textboxVersion.TabIndex = 3; - this.textboxVersion.TextChanged += new System.EventHandler(this.textboxVersion_TextChanged); - // - // openFileDialog1 - // - this.openFileDialog1.DefaultExt = "exe"; - this.openFileDialog1.Filter = "Executable files|*.exe|All files|*.*"; - // - // tabControl1 - // - this.tabControl1.Controls.Add(this.tabPage1); - this.tabControl1.Controls.Add(this.tabPage2); - this.tabControl1.Location = new System.Drawing.Point(12, 12); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(332, 507); - this.tabControl1.TabIndex = 7; - // - // tabPage1 - // - this.tabPage1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.tabPage1.Controls.Add(this.panel3); - this.tabPage1.Location = new System.Drawing.Point(4, 24); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(324, 479); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "SRB2"; - // - // tabPage2 - // - this.tabPage2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.tabPage2.Controls.Add(this.panel5); - this.tabPage2.Location = new System.Drawing.Point(4, 24); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(324, 479); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "Master Server"; - // - // panel5 - // - this.panel5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(212)))), ((int)(((byte)(204)))), ((int)(((byte)(187))))); - this.panel5.Controls.Add(this.panel6); - this.panel5.Controls.Add(this.panel2); - this.panel5.Location = new System.Drawing.Point(6, 6); - this.panel5.Name = "panel5"; - this.panel5.Padding = new System.Windows.Forms.Padding(10); - this.panel5.Size = new System.Drawing.Size(312, 507); - this.panel5.TabIndex = 7; - // - // panel6 - // - this.panel6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.panel6.Controls.Add(this.groupBox2); - this.panel6.Location = new System.Drawing.Point(13, 114); - this.panel6.Name = "panel6"; - this.panel6.Padding = new System.Windows.Forms.Padding(5); - this.panel6.Size = new System.Drawing.Size(286, 61); - this.panel6.TabIndex = 6; - // - // groupBox2 - // - this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox2.Controls.Add(this.chkShowDefaultWads); - this.groupBox2.Location = new System.Drawing.Point(9, 8); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(269, 45); - this.groupBox2.TabIndex = 0; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "List Settings"; - // - // chkShowDefaultWads - // - this.chkShowDefaultWads.AutoSize = true; - this.chkShowDefaultWads.Location = new System.Drawing.Point(6, 20); - this.chkShowDefaultWads.Name = "chkShowDefaultWads"; - this.chkShowDefaultWads.Size = new System.Drawing.Size(201, 19); - this.chkShowDefaultWads.TabIndex = 8; - this.chkShowDefaultWads.Text = "Show default files in list of wads"; - this.chkShowDefaultWads.UseVisualStyleBackColor = true; - // - // chkCloseOnStart - // - this.chkCloseOnStart.AutoSize = true; - this.chkCloseOnStart.Location = new System.Drawing.Point(9, 47); - this.chkCloseOnStart.Name = "chkCloseOnStart"; - this.chkCloseOnStart.Size = new System.Drawing.Size(216, 19); - this.chkCloseOnStart.TabIndex = 9; - this.chkCloseOnStart.Text = "Close Launcher when SRB2 starts"; - this.chkCloseOnStart.UseVisualStyleBackColor = true; - // - // Options - // - this.AcceptButton = this.btnSave; - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(230)))), ((int)(((byte)(217))))); - this.ClientSize = new System.Drawing.Size(356, 560); - this.Controls.Add(this.tabControl1); - this.Controls.Add(this.btnSave); - this.Controls.Add(this.btnCancel); - this.Font = new System.Drawing.Font("Arial", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Name = "Options"; - this.Text = "Options"; - this.groupDisplay.ResumeLayout(false); - this.groupDisplay.PerformLayout(); - this.panel1.ResumeLayout(false); - this.panel2.ResumeLayout(false); - this.groupMS.ResumeLayout(false); - this.groupMS.PerformLayout(); - this.panel3.ResumeLayout(false); - this.panel7.ResumeLayout(false); - this.groupBox3.ResumeLayout(false); - this.groupBox3.PerformLayout(); - this.panel4.ResumeLayout(false); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.tabControl1.ResumeLayout(false); - this.tabPage1.ResumeLayout(false); - this.tabPage2.ResumeLayout(false); - this.panel5.ResumeLayout(false); - this.panel6.ResumeLayout(false); - this.groupBox2.ResumeLayout(false); - this.groupBox2.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.GroupBox groupDisplay; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.CheckBox chkDisplayWindowed; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox txtWidth; - private System.Windows.Forms.CheckBox chkCustomResolution; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox txtHeight; - private System.Windows.Forms.Button btnCancel; - private System.Windows.Forms.Button btnSave; - private System.Windows.Forms.Panel panel2; - private System.Windows.Forms.GroupBox groupMS; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox txtMSAddress; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.TextBox txtMSPort; - private System.Windows.Forms.Panel panel3; - private System.Windows.Forms.OpenFileDialog openFileDialog1; - private System.Windows.Forms.Panel panel4; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.ListView listviewBinaries; - private System.Windows.Forms.ColumnHeader colhdrVersion; - private System.Windows.Forms.ColumnHeader colhdrBinary; - private System.Windows.Forms.TextBox textboxBinary; - private System.Windows.Forms.Button btnAdd; - private System.Windows.Forms.Button btnDel; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Button btnBrowse; - private System.Windows.Forms.TextBox textboxVersion; - private System.Windows.Forms.TabControl tabControl1; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.TabPage tabPage2; - private System.Windows.Forms.Panel panel5; - private System.Windows.Forms.Panel panel6; - private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.CheckBox chkShowDefaultWads; - private System.Windows.Forms.Panel panel7; - private System.Windows.Forms.GroupBox groupBox3; - private System.Windows.Forms.TextBox txtParams; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.CheckBox chkCloseOnStart; - } -} \ No newline at end of file diff --git a/tools/SRB2Updater/Options.cs b/tools/SRB2Updater/Options.cs deleted file mode 100644 index a45cb13af..000000000 --- a/tools/SRB2Updater/Options.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using System.IO; - -namespace SRB2Updater -{ - public partial class Options : Form - { - private Settings settings; - public Options(Settings settings) - { - InitializeComponent(); - this.settings = settings; - SetOptions(); - } - - private void SetOptions() - { - chkDisplayWindowed.Checked = settings.displayWindowed; - chkCustomResolution.Checked = settings.displayCustom; - txtHeight.Text = settings.displayHeight.ToString(); - txtWidth.Text = settings.displayWidth.ToString(); - txtMSPort.Text = settings.msPort.ToString(); - settings.AddBinariesToListView(listviewBinaries); - txtMSAddress.Text = settings.msAddress.ToString(); - txtParams.Text = settings.Params.ToString(); - chkCloseOnStart.Checked = settings.CloseOnStart; - chkShowDefaultWads.Checked = settings.ShowDefaultWads; - if (settings.displayCustom) - { - txtHeight.Enabled = true; - txtWidth.Enabled = true; - } - else - { - txtHeight.Enabled = false; - txtWidth.Enabled = false; - } - } - - private void chkCustomResolution_CheckedChanged(object sender, EventArgs e) - { - if (chkCustomResolution.Checked) - { - txtHeight.Enabled = true; - txtWidth.Enabled = true; - } - else - { - txtHeight.Enabled = false; - txtWidth.Enabled = false; - } - } - - private void btnSave_Click(object sender, EventArgs e) - { - settings.displayCustom = chkCustomResolution.Checked; - settings.displayHeight = Convert.ToInt32(txtHeight.Text); - settings.displayWidth = Convert.ToInt32(txtWidth.Text); - settings.displayWindowed = chkDisplayWindowed.Checked; - settings.msAddress = txtMSAddress.Text; - settings.ShowDefaultWads = chkShowDefaultWads.Checked; - settings.Params = txtParams.Text; - settings.msPort = Convert.ToInt32(txtMSPort.Text); - settings.CloseOnStart = chkCloseOnStart.Checked; - settings.SaveSettings(); - settings.SetBinariesFromListView(listviewBinaries); - Close(); - } - - private void btnCancel_Click(object sender, EventArgs e) - { - Close(); - } - - private void btnAdd_Click(object sender, EventArgs e) - { - listviewBinaries.Items.Add(new ListViewItem(new string[] { "[New Version]", "" })); - } - - private void btnDel_Click(object sender, EventArgs e) - { - if (listviewBinaries.SelectedItems.Count > 0) - listviewBinaries.Items.Remove(listviewBinaries.SelectedItems[0]); - } - - private void btnBrowse_Click(object sender, EventArgs e) - { - if (listviewBinaries.SelectedItems.Count > 0 && - openFileDialog1.ShowDialog() == DialogResult.OK) - textboxBinary.Text = openFileDialog1.FileName; - } - - private void textboxVersion_TextChanged(object sender, EventArgs e) - { - if (listviewBinaries.SelectedItems.Count > 0) - listviewBinaries.SelectedItems[0].Text = textboxVersion.Text; - } - - private void textboxBinary_TextChanged(object sender, EventArgs e) - { - if (listviewBinaries.SelectedItems.Count > 0) - listviewBinaries.SelectedItems[0].SubItems[1].Text = textboxBinary.Text; - } - - private void listviewBinaries_SelectedIndexChanged(object sender, EventArgs e) - { - if (listviewBinaries.SelectedItems.Count > 0) - { - btnDel.Enabled = true; - btnBrowse.Enabled = true; - textboxVersion.Text = listviewBinaries.SelectedItems[0].Text; - textboxBinary.Text = listviewBinaries.SelectedItems[0].SubItems[1].Text; - textboxVersion.Enabled = true; - textboxBinary.Enabled = true; - } - else - { - btnDel.Enabled = false; - btnBrowse.Enabled = false; - textboxVersion.Text = ""; - textboxBinary.Text = ""; - textboxVersion.Enabled = false; - textboxBinary.Enabled = false; - } - } - } -} diff --git a/tools/SRB2Updater/Options.resx b/tools/SRB2Updater/Options.resx deleted file mode 100644 index ee0d50c3f..000000000 --- a/tools/SRB2Updater/Options.resx +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - - - AAABAAEAICAAAAEACACoCAAAFgAAACgAAAAgAAAAQAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAADg4OAIAAAABQABkAlgAAALkAAABQGQAAcwAlAJYAMQBzJQAAuQA9AJYxAACWAGIAMjIyALk9 - AAD/JSUAPj4+AFZWVgD/SEgAYmJiAABilgBubm4Aenp6AP9rawCAgIAAhoaGAJKSkgD/jo4Anp6eAKSg - oAD/jqsAqqqqAGuP/wC2trYAwMDAAI6r/wDCwsIAa8b/AM7OzgCO1P8A2traAObm5gDy8vIA////AAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAGgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFQ8PHQAAAAAAAAAAAAAAACMgJSUlJSUZ - AAAAABMNBgoPDw8AAAAAAAAAAAAAACInJycnJycnJyclFgYGBggPDw8PDwAAAAAAAAAAAAAjJycnJycn - JycnGScnFQkGCA8PDw8AAAAAAAAAAAAAISMnJycjIyMjJycnJycVDwYGDw8PDwAAAAAAAAAAAAAQAAEj - HygqKSkkHyMnJwoPDwYJDw8PAAAAAAAAAAAAACkTHxwrKysrKysrGhkMDw8PCwYJDw8AAAAAAAAAACkp - JA0pACkrKysrKyspDw8PDw8PAwYIAAAAAAAAAAAAACsiARwAISsrKysrKysSDw8PDw8PAwYAAAAAAAAA - AAAAKyIAEAAfKysrKysrKxcPDw8PDw8PDwgIABYAABcSCAArKAMPACIrKysrKysrGw8PDw8PDw8PDw8P - Dw8PDw8RACsoBA8EISsrKysrKyseDw8PDw8PDw8PDw8PDw8PDwAAKx8PDw8VKSsrKysrKxcPDw8PDw8P - Dw8PDw8PDw8AACooFQ8PDw8aKCsrKysmDw8PDw8PDw8PDw8PDw8PFQAAAAAKDw8PDw8VIigoIgoPDw8P - Dw8PDw8PDw8PDxEAAAAAAAoPDw8PDw8XFxcXEhIPDwUPDw8PDw8PDw8YAAAAAAAACA8PDw8SFxcXFxcX - FxcPFQ8PDw8PDw8KAAAAAAAAAAAACg8PEhcXFxcXFxcXFxkjBRISEhISGAAAAAAAAAAAIRcXCA8XFxcX - FxcXFxcaJyMFDwoLEQAAAAAAAAAAAAAAFxcSDxIXFxcXFxcSEyAlIwILCwsIAAAAAAAAAAAAABcXEg8A - EhIXFxcXEgoPDBUUBwsLCwsLAAAAAAAAAAAAFxcAAAAAFxIXFxcXFxIKDw8ICwsLDg4LAAAAAAAAAAAA - AAAAAAAAABISFxcXFw8PDw8PDw8PDwAAAAAAAAAAAAAAAAAAAAAAAAASEhcSDw8PDw8PDxIAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAFwoSDw8SFwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAP///////////////////3////w//APAf/AAAH/gAAD/wAAA/8AAAP/AAAD/AAAB/4AA - Af+AAABYgAAAAIAAAAGAAAADAAAAA8AAAAfAAAAPwAAAP+AAAH+AAAH/wAAB/4QAAP+eAAB//4AA///g - Af//+A////////////////// - - - \ No newline at end of file diff --git a/tools/SRB2Updater/Program.cs b/tools/SRB2Updater/Program.cs deleted file mode 100644 index 51c0be56e..000000000 --- a/tools/SRB2Updater/Program.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Windows.Forms; - -namespace SRB2Updater -{ - static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main(string[] args) - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Launcher(args)); - } - } -} diff --git a/tools/SRB2Updater/Properties/AssemblyInfo.cs b/tools/SRB2Updater/Properties/AssemblyInfo.cs deleted file mode 100644 index abc46e8cd..000000000 --- a/tools/SRB2Updater/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Resources; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("SRB2 Automatic Updater")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Sonic Team Junior")] -[assembly: AssemblyProduct("Sonic Robo Blast 2")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("94c164ce-02a9-4966-948f-004d35760ba1")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: NeutralResourcesLanguageAttribute("en-US")] diff --git a/tools/SRB2Updater/Properties/Resources.Designer.cs b/tools/SRB2Updater/Properties/Resources.Designer.cs deleted file mode 100644 index 246c91e52..000000000 --- a/tools/SRB2Updater/Properties/Resources.Designer.cs +++ /dev/null @@ -1,132 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.4927 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace SRB2Updater.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SRB2Updater.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - internal static System.Drawing.Bitmap Banner { - get { - object obj = ResourceManager.GetObject("Banner", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap Banner2 { - get { - object obj = ResourceManager.GetObject("Banner2", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap Banner3 { - get { - object obj = ResourceManager.GetObject("Banner3", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap Banner4 { - get { - object obj = ResourceManager.GetObject("Banner4", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap CONSBACK { - get { - object obj = ResourceManager.GetObject("CONSBACK", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.IO.UnmanagedMemoryStream Kotaku { - get { - return ResourceManager.GetStream("Kotaku", resourceCulture); - } - } - - internal static System.Drawing.Bitmap Sonic { - get { - object obj = ResourceManager.GetObject("Sonic", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap sonic_bottom { - get { - object obj = ResourceManager.GetObject("sonic_bottom", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap sonic_top { - get { - object obj = ResourceManager.GetObject("sonic_top", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - internal static System.Drawing.Bitmap updaterbanner { - get { - object obj = ResourceManager.GetObject("updaterbanner", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - } -} diff --git a/tools/SRB2Updater/Properties/Resources.resx b/tools/SRB2Updater/Properties/Resources.resx deleted file mode 100644 index b5c93d021..000000000 --- a/tools/SRB2Updater/Properties/Resources.resx +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - ..\Resources\CONSBACK.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Sonic.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Banner.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\sonic_bottom.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\sonic_top.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\updaterbanner.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Banner2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Banner3.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Banner4.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Kotaku.wav;System.IO.MemoryStream, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/tools/SRB2Updater/Properties/Settings.Designer.cs b/tools/SRB2Updater/Properties/Settings.Designer.cs deleted file mode 100644 index 4e8aea28c..000000000 --- a/tools/SRB2Updater/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.3506 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace SRB2Updater.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/tools/SRB2Updater/Properties/Settings.settings b/tools/SRB2Updater/Properties/Settings.settings deleted file mode 100644 index abf36c5d3..000000000 --- a/tools/SRB2Updater/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/tools/SRB2Updater/Resources/Banner.png b/tools/SRB2Updater/Resources/Banner.png deleted file mode 100644 index 7d8d55602..000000000 Binary files a/tools/SRB2Updater/Resources/Banner.png and /dev/null differ diff --git a/tools/SRB2Updater/Resources/Banner.psd b/tools/SRB2Updater/Resources/Banner.psd deleted file mode 100644 index eb29b8b6f..000000000 Binary files a/tools/SRB2Updater/Resources/Banner.psd and /dev/null differ diff --git a/tools/SRB2Updater/Resources/Banner2.png b/tools/SRB2Updater/Resources/Banner2.png deleted file mode 100644 index f3d3d3e6d..000000000 Binary files a/tools/SRB2Updater/Resources/Banner2.png and /dev/null differ diff --git a/tools/SRB2Updater/Resources/Banner3.png b/tools/SRB2Updater/Resources/Banner3.png deleted file mode 100644 index 04713070a..000000000 Binary files a/tools/SRB2Updater/Resources/Banner3.png and /dev/null differ diff --git a/tools/SRB2Updater/Resources/Banner4.png b/tools/SRB2Updater/Resources/Banner4.png deleted file mode 100644 index 8b2627b8d..000000000 Binary files a/tools/SRB2Updater/Resources/Banner4.png and /dev/null differ diff --git a/tools/SRB2Updater/Resources/CONSBACK.bmp b/tools/SRB2Updater/Resources/CONSBACK.bmp deleted file mode 100644 index 3c1298f08..000000000 Binary files a/tools/SRB2Updater/Resources/CONSBACK.bmp and /dev/null differ diff --git a/tools/SRB2Updater/Resources/Kotaku.wav b/tools/SRB2Updater/Resources/Kotaku.wav deleted file mode 100644 index 49e7f613a..000000000 Binary files a/tools/SRB2Updater/Resources/Kotaku.wav and /dev/null differ diff --git a/tools/SRB2Updater/Resources/Sonic.png b/tools/SRB2Updater/Resources/Sonic.png deleted file mode 100644 index a19cf225d..000000000 Binary files a/tools/SRB2Updater/Resources/Sonic.png and /dev/null differ diff --git a/tools/SRB2Updater/Resources/Srb2win.ico b/tools/SRB2Updater/Resources/Srb2win.ico deleted file mode 100644 index 0036a827a..000000000 Binary files a/tools/SRB2Updater/Resources/Srb2win.ico and /dev/null differ diff --git a/tools/SRB2Updater/Resources/sonic_bottom.png b/tools/SRB2Updater/Resources/sonic_bottom.png deleted file mode 100644 index 42c17c785..000000000 Binary files a/tools/SRB2Updater/Resources/sonic_bottom.png and /dev/null differ diff --git a/tools/SRB2Updater/Resources/sonic_top.png b/tools/SRB2Updater/Resources/sonic_top.png deleted file mode 100644 index 66d6fccaa..000000000 Binary files a/tools/SRB2Updater/Resources/sonic_top.png and /dev/null differ diff --git a/tools/SRB2Updater/Resources/updaterbanner.png b/tools/SRB2Updater/Resources/updaterbanner.png deleted file mode 100644 index 9a2f6fa38..000000000 Binary files a/tools/SRB2Updater/Resources/updaterbanner.png and /dev/null differ diff --git a/tools/SRB2Updater/SRB2Updater.csproj b/tools/SRB2Updater/SRB2Updater.csproj deleted file mode 100644 index 6e8647312..000000000 --- a/tools/SRB2Updater/SRB2Updater.csproj +++ /dev/null @@ -1,173 +0,0 @@ - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {2E2F67C6-8492-4034-A142-50872504D86D} - WinExe - Properties - SRB2Updater - srb2update - - - - - 2.0 - v2.0 - - - false - Srb2win.ico - SRB2Updater.Program - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - Form - - - Debug.cs - - - Form - - - Launcher.cs - - - - Form - - - Options.cs - - - - - Debug.cs - Designer - - - Launcher.cs - Designer - - - Options.cs - Designer - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - False - .NET Framework Client Profile - false - - - False - .NET Framework 2.0 %28x86%29 - true - - - False - .NET Framework 3.0 %28x86%29 - false - - - False - .NET Framework 3.5 - false - - - False - .NET Framework 3.5 SP1 - false - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tools/SRB2Updater/SRB2Updater.sln b/tools/SRB2Updater/SRB2Updater.sln deleted file mode 100644 index f4e88dc64..000000000 --- a/tools/SRB2Updater/SRB2Updater.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SRB2Updater", "SRB2Updater.csproj", "{2E2F67C6-8492-4034-A142-50872504D86D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2E2F67C6-8492-4034-A142-50872504D86D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2E2F67C6-8492-4034-A142-50872504D86D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2E2F67C6-8492-4034-A142-50872504D86D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2E2F67C6-8492-4034-A142-50872504D86D}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/tools/SRB2Updater/ServerQuerier.cs b/tools/SRB2Updater/ServerQuerier.cs deleted file mode 100644 index 51b6940f6..000000000 --- a/tools/SRB2Updater/ServerQuerier.cs +++ /dev/null @@ -1,362 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Net; -using System.Net.Sockets; -using System.IO; - -namespace SRB2Updater -{ - class ServerQuerier - { - private UdpClient udpclient; - private IPEndPoint ipepMS; - - private const int MS_HOLEPUNCH_SIZE = 0; - private const int PT_ASKINFO_SIZE = 16; - private const byte PT_ASKINFO = 12; - private const byte PT_SERVERINFO = 13; - private const int MAXSERVERNAME = 32; - private const int MAX_WADPATH = 128; - - /// - /// Constructs a ServerQuerier object. - /// - public ServerQuerier() - { - udpclient = new UdpClient(0, AddressFamily.InterNetwork); - - // Fix for WSAECONNRESET. Only affects Win2k and up. If I send a - // packet to a host which replies with an ICMP Port Unreachable, - // subsequent socket operations go doo-lally. So, we enable the - // older behaviour of ignoring these ICMP messages, since we don't - // care about them anyway. - if (Environment.OSVersion.Platform == PlatformID.Win32NT && - Environment.OSVersion.Version.Major >= 5) - { - const uint IOC_IN = 0x80000000; - const uint IOC_VENDOR = 0x18000000; - const uint SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12; - - udpclient.Client.IOControl(unchecked((int)SIO_UDP_CONNRESET), new byte[] { Convert.ToByte(false) }, null); - } - } - - public void StartListening(ServerInfoReceiveHandler sirh) - { - // Start listening. - udpclient.BeginReceive(new AsyncCallback(ServerInfoReceiveHandler.Receive), sirh); - } - - - /// - /// Sets the master server address. Necessary before querying via the MS. - /// - /// IP address of hostname of MS. - /// Port of MS. - public void SetMasterServer(string strAddress, ushort unPort) - { - IPAddress address = Dns.GetHostEntry(strAddress).AddressList[0]; - ipepMS = new IPEndPoint(address, unPort); - } - - public void Query(string strAddress, ushort unPort) - { - // Build the packet. - byte[] byPacket = new byte[PT_ASKINFO_SIZE]; - BinaryWriter bw = new BinaryWriter(new MemoryStream(byPacket)); - - bw.Seek(4, SeekOrigin.Begin); // Skip the checksum. - bw.Write((byte)0); // ack - bw.Write((byte)0); // ackreturn - bw.Write((byte)PT_ASKINFO); // Packet type. - bw.Write((byte)0); // Reserved. - bw.Write((byte)0); // Version. This is actually unnecessary -- the client will reply anyway. -MattW_CFI - bw.Write((byte)0); // Reserved. - bw.Write((byte)0); // Reserved. - bw.Write((byte)0); // Reserved. - // Time for ping calculation. - bw.Write(unchecked((uint)(DateTime.Now.Ticks / 10000))); - - // Calculate the checksum. - bw.Seek(0, SeekOrigin.Begin); - bw.Write(SRB2Checksum(byPacket)); - - // Send the packet. - udpclient.Send(byPacket, byPacket.Length, strAddress, unPort); - } - - /// - /// Calculates the checksum of an SRB2 packet. - /// - /// Packet. - /// Checksum. - private static uint SRB2Checksum(byte[] byPacket) - { - uint c = 0x1234567; - int i; - - for (i = 4; i < byPacket.Length; i++) - unchecked - { - c += (uint)byPacket[i] * (uint)(i - 3); - } - - return c; - } - - private static string ReadFixedLengthStr(BinaryReader br, int iLen) - { - String str = Encoding.ASCII.GetString(br.ReadBytes(iLen)); - int iPos = str.IndexOf("\0"); - if (iPos >= 0) - str = str.Remove(iPos); - - return str; - } - - public abstract class ServerInfoReceiveHandler - { - UdpClient udpclient; - IPEndPoint ipepRemote; - - /// - /// Called after a server info packet is received. - /// - /// Server info. - public abstract void ProcessServerInfo(SRB2ServerInfo srb2si); - public abstract void HandleException(Exception e); - - public ServerInfoReceiveHandler(ServerQuerier sq) - { - ipepRemote = new IPEndPoint(IPAddress.Any, 0); - - udpclient = sq.udpclient; - } - - public static void Receive(IAsyncResult ar) - { - ServerInfoReceiveHandler sirh = (ServerInfoReceiveHandler)ar.AsyncState; - - byte[] byPacket = sirh.udpclient.EndReceive(ar, ref sirh.ipepRemote); - - // Analyse the packet. - BinaryReader br = new BinaryReader(new MemoryStream(byPacket)); - - // Get the checksum. - uint uiChecksum = br.ReadUInt32(); - - // Skip ack and ackreturn and get packet type. - br.ReadBytes(2); - byte byPacketType = br.ReadByte(); - - // Only interested in valid PT_SERVERINFO packets. - if (byPacketType == PT_SERVERINFO && uiChecksum == SRB2Checksum(byPacket)) - { - bool bMalformed = true; - - // Skip padding. - br.ReadByte(); - - // Remember where we are. - long iPacketStart = br.BaseStream.Position; - - // Try to interpret the packet in each recognised format. - foreach (ServerInfoVer siv in Enum.GetValues(typeof(ServerInfoVer))) - { - SRB2ServerInfo srb2si; - byte byNumWads = 0; - - srb2si.siv = siv; - - br.BaseStream.Position = iPacketStart; - - // Get address from socket. - srb2si.strAddress = sirh.ipepRemote.Address.ToString(); - srb2si.unPort = unchecked((ushort)sirh.ipepRemote.Port); - - // Get version. - byte byVersion = br.ReadByte(); - - if (siv == ServerInfoVer.SIV_PREME) - { - br.ReadBytes(3); - - uint uiSubVersion = br.ReadUInt32(); - - // Format version. - // MattW_CFI: I hope you don't mind this exception, Oogaland, but 0.01.6 looks odd >_> - if (byVersion == 1 && uiSubVersion == 6) - srb2si.strVersion = "X.01.6"; - else - srb2si.strVersion = byVersion.ToString(); - //srb2si.strVersion = String.Format("{0}.{1:00}.{2}", byVersion / 100, byVersion % 100, uiSubVersion); - } - else - { - byte bySubVersion = br.ReadByte(); - - // Format version. - //srb2si.strVersion = String.Format("{0}.{1:00}.{2}", byVersion / 100, byVersion % 100, bySubVersion); - srb2si.strVersion = byVersion.ToString(); - } - - srb2si.byPlayers = br.ReadByte(); - srb2si.byMaxplayers = br.ReadByte(); - srb2si.byGametype = br.ReadByte(); - srb2si.bModified = (br.ReadByte() != 0); - - if (siv == ServerInfoVer.SIV_ME) - byNumWads = br.ReadByte(); - - srb2si.sbyAdminplayer = br.ReadSByte(); - - if (siv == ServerInfoVer.SIV_PREME) - br.ReadBytes(3); - - // Calculate ping. - srb2si.uiTime = unchecked((uint)((long)(DateTime.Now.Ticks / 10000 - br.ReadUInt32()) % ((long)UInt32.MaxValue + 1))); - - if (siv == ServerInfoVer.SIV_PREME) - br.ReadUInt32(); - - // Get and tidy map name. - if (siv == ServerInfoVer.SIV_PREME) - { - srb2si.strMapName = ReadFixedLengthStr(br, 8); - srb2si.strName = ReadFixedLengthStr(br, MAXSERVERNAME); - } - else - { - srb2si.strName = ReadFixedLengthStr(br, MAXSERVERNAME); - srb2si.strMapName = ReadFixedLengthStr(br, 8); - } - - if (siv == ServerInfoVer.SIV_PREME) - byNumWads = br.ReadByte(); - - // Create new list of strings of initial size equal to number of wads. - srb2si.listFiles = new List(byNumWads); - - // Get the files info. - byte[] byFiles = br.ReadBytes(siv == ServerInfoVer.SIV_PREME ? 4096 : 936); - BinaryReader brFiles = new BinaryReader(new MemoryStream(byFiles)); - - // Extract the filenames. - try - { - for (int i = 0; i < byNumWads; i++) - { - bool bFullString = false; - AddedWad aw = new AddedWad(); - - if (siv == ServerInfoVer.SIV_PREME) - { - aw.bImportant = brFiles.ReadByte() != 0; - aw.downloadtype = (DownloadTypes)brFiles.ReadByte(); - } - else - { - byte byFileStatus = brFiles.ReadByte(); - aw.bImportant = (byFileStatus & 0xF) != 0; - aw.downloadtype = (DownloadTypes)(byFileStatus >> 4); - } - - aw.uiSize = brFiles.ReadUInt32(); - - // Work out how long the string is. - int iStringPos = (int)brFiles.BaseStream.Position; - while (iStringPos < byFiles.Length && byFiles[iStringPos] != 0) iStringPos++; - - // Make sure it's not longer than the max name length. - if (iStringPos - (int)brFiles.BaseStream.Position > MAX_WADPATH) - { - bFullString = true; - iStringPos = MAX_WADPATH + (int)brFiles.BaseStream.Position; - } - - // Get the info and add it, if possible. - if (iStringPos > (int)brFiles.BaseStream.Position) - { - aw.strFilename = Encoding.ASCII.GetString(brFiles.ReadBytes(iStringPos - (int)brFiles.BaseStream.Position)); - srb2si.listFiles.Add(aw); - } - - // Skip nul. - if (!bFullString) brFiles.ReadByte(); - - // Skip the md5sum. - brFiles.ReadBytes(16); - } - - // Okay, done! Do something useful with the server info. - sirh.ProcessServerInfo(srb2si); - - // If we got this far without an exception, leave the foreach loop. - bMalformed = false; - break; - } - catch (EndOfStreamException) - { - // Packet doesn't match supposed type, so we swallow the exception - // and try remaining types. - } - catch (Exception e) - { - sirh.HandleException(e); - break; - } - } - - if (bMalformed) - sirh.HandleException(new Exception("Received invalid PT_SERVERINFO packet from " + sirh.ipepRemote.Address + ":" + sirh.ipepRemote.Port + ".")); - } - - // Resume listening. - sirh.ipepRemote = new IPEndPoint(IPAddress.Any, 0); - sirh.udpclient.BeginReceive(new AsyncCallback(Receive), sirh); - } - } - - public enum DownloadTypes - { - DT_TOOBIG = 0, - DT_OK = 1, - DT_DISABLED = 2 - } - - public struct AddedWad - { - public string strFilename; - public bool bImportant; - public uint uiSize; - public DownloadTypes downloadtype; - } - - public enum ServerInfoVer - { - SIV_PREME, - SIV_ME - }; - - public struct SRB2ServerInfo - { - public string strAddress; - public ushort unPort; - - public ServerInfoVer siv; - - public string strVersion; - public byte byPlayers; - public byte byMaxplayers; - public byte byGametype; - public bool bModified; - public sbyte sbyAdminplayer; - public uint uiTime; - public string strMapName; - public string strName; - - public List listFiles; - } - } -} diff --git a/tools/SRB2Updater/Settings.cs b/tools/SRB2Updater/Settings.cs deleted file mode 100644 index d72aeee51..000000000 --- a/tools/SRB2Updater/Settings.cs +++ /dev/null @@ -1,219 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections; -using System.Text; -using System.Data; -using Microsoft.Win32; -using System.Windows.Forms; -using System.IO; - -namespace SRB2Updater -{ - public class Settings - { - // Global Settings - public bool boolDisplayWindowed; - public bool boolDisplayCustomResolution; - public bool boolCloseOnStart; - public int intDisplayWidth; - public int intDisplayHeight; - public string strMSAddress; - public int intMSPort; - public Array arrWadList; - public string strParams; - - public string Params - { - get { return strParams; } - set { strParams = value; } - } - - public Array wadList - { - get { return arrWadList; } - set { arrWadList = value; } - } - - public bool CloseOnStart - { - get { return boolCloseOnStart; } - set { boolCloseOnStart = value; } - } - - public string msAddress - { - get { return strMSAddress; } - set { strMSAddress = value; } - } - - public int msPort - { - get { return intMSPort; } - set { intMSPort = value; } - } - - public bool displayWindowed - { - get { return boolDisplayWindowed; } - set { boolDisplayWindowed = value; } - } - - public bool displayCustom - { - get { return boolDisplayCustomResolution; } - set { boolDisplayCustomResolution = value; } - } - - public int displayWidth - { - get { return intDisplayWidth; } - set { intDisplayWidth = value; } - } - - public int displayHeight - { - get { return intDisplayHeight; } - set { intDisplayHeight = value; } - } - - bool boolShowDefaultWads; - public bool ShowDefaultWads - { - get { return boolShowDefaultWads; } - set { boolShowDefaultWads = value; } - } - - public void GetSettings() - { - RegistryKey rk = Registry.CurrentUser.CreateSubKey(@"Software\SonicTeamJunior\Launcher"); - RegistryKey rkDisplay = Registry.CurrentUser.CreateSubKey(@"Software\SonicTeamJunior\Launcher\Display"); - RegistryKey rkMS = Registry.CurrentUser.CreateSubKey(@"Software\SonicTeamJunior\Launcher\MasterServer"); - RegistryKey rkBinaries = rk.CreateSubKey("Binaries"); - rkBinaries.SetValue("2.0.4", Directory.GetCurrentDirectory() + "\\srb2win.exe"); - - try { boolDisplayCustomResolution = Convert.ToInt32(rkDisplay.GetValue("CustomResolution", 0)) != 0; } - catch { boolDisplayCustomResolution = false; } - try { boolDisplayWindowed = Convert.ToInt32(rkDisplay.GetValue("Windowed", 0)) != 0; } - catch { boolDisplayWindowed = false; } - try { boolShowDefaultWads = Convert.ToInt32(rkDisplay.GetValue("ShowDefaultWads", 0)) != 0; } - catch { boolShowDefaultWads = false; } - try { boolCloseOnStart = Convert.ToInt32(rkDisplay.GetValue("CloseOnStart", 0)) != 0; } - catch { boolCloseOnStart = false; } - intDisplayHeight = Convert.ToInt32(rkDisplay.GetValue("Height", "480")); - intDisplayWidth = Convert.ToInt32(rkDisplay.GetValue("Width", "640")); - intMSPort = Convert.ToInt32(rkMS.GetValue("Port", "28900")); - strMSAddress = Convert.ToString(rkMS.GetValue("Address", "ms.srb2.org")); - strParams = Convert.ToString(rk.GetValue("Params")); - - dicBinaries.Clear(); - foreach (string strName in rkBinaries.GetValueNames()) - dicBinaries[strName] = (string)rkBinaries.GetValue(strName); - - - rk.Close(); - rkDisplay.Close(); - rkMS.Close(); - rkBinaries.Close(); - } - - public void SaveSettings() - { - RegistryKey rk = Registry.CurrentUser.CreateSubKey(@"Software\SonicTeamJunior\Launcher"); - RegistryKey rkDisplay = rk.CreateSubKey("Display"); - RegistryKey rkMS = rk.CreateSubKey("MasterServer"); - rkDisplay.SetValue("CustomResolution", boolDisplayCustomResolution); - rkDisplay.SetValue("Windowed", boolDisplayWindowed); - rkDisplay.SetValue("Height", intDisplayHeight); - rkDisplay.SetValue("Width", intDisplayWidth); - rkMS.SetValue("Port", intMSPort); - rkMS.SetValue("Address", strMSAddress); - rkMS.SetValue("ShowDefaultWads", boolShowDefaultWads); - rk.SetValue("Params", strParams); - rk.SetValue("CloseOnStart", boolCloseOnStart); - - rk.DeleteSubKey("Binaries", false); - RegistryKey rkBinaries = rk.CreateSubKey("Binaries"); - rkBinaries.SetValue("2.0.4", Directory.GetCurrentDirectory() + "\\srb2win.exe"); - foreach (string strName in dicBinaries.Keys) - rkBinaries.SetValue(strName, dicBinaries[strName]); - - rk.Close(); - } - -/* public void WriteToRegistry() - { - RegistryKey rk = Registry.CurrentUser.CreateSubKey(@"Software\SRB2MSLauncher"); - - rk.SetValue("Params", strParams); - rk.SetValue("Masterserver", strMSAddress); - rk.SetValue("MSPort", unMSPort, RegistryValueKind.DWord); - rk.SetValue("ShowDefaultWads", Convert.ToInt32(bShowDefaultWads), RegistryValueKind.DWord); - - rk.DeleteSubKey("Binaries", false); - RegistryKey rkBinaries = rk.CreateSubKey("Binaries"); - foreach (string strName in dicBinaries.Keys) - rkBinaries.SetValue(strName, dicBinaries[strName]); - - rkBinaries.Close(); - rk.Close(); - } - - public void LoadFromRegistry() - { - RegistryKey rk = Registry.CurrentUser.CreateSubKey(@"Software\SRB2MSLauncher"); - RegistryKey rkBinaries = rk.CreateSubKey("Binaries"); - - strParams = (string)rk.GetValue("Params", ""); - strMSAddress = (string)rk.GetValue("Masterserver", "ms.srb2.org"); - - try { unMSPort = Convert.ToUInt16(rk.GetValue("MSPort", MS_DEFAULT_PORT)); } - catch { unMSPort = MS_DEFAULT_PORT; } - - try { bShowDefaultWads = Convert.ToInt32(rk.GetValue("ShowDefaultWads", 0)) != 0; } - catch { bShowDefaultWads = true; } - - dicBinaries.Clear(); - foreach (string strName in rkBinaries.GetValueNames()) - dicBinaries[strName] = (string)rkBinaries.GetValue(strName); - - rkBinaries.Close(); - rk.Close(); - }*/ - - - public List VersionStrings - { - get { return new List(dicBinaries.Keys); } - } - - public bool HasBinaryForVersion(string strVersion) - { - return dicBinaries.ContainsKey(strVersion) && dicBinaries[strVersion] != ""; - } - - public void AddBinariesToListView(ListView lv) - { - foreach (string strName in dicBinaries.Keys) - lv.Items.Add(new ListViewItem(new string[] { strName, dicBinaries[strName] })); - } - - public void SetBinariesFromListView(ListView lv) - { - dicBinaries.Clear(); - foreach (ListViewItem lvi in lv.Items) - dicBinaries[lvi.Text] = lvi.SubItems[1].Text; - } - - Dictionary dicBinaries = new Dictionary(); - - public void SetBinary(string strVersion, string strBinary) - { - dicBinaries[strVersion] = strBinary; - } - - public string GetBinary(string strVersion) - { - return dicBinaries[strVersion]; - } - } -} \ No newline at end of file diff --git a/tools/SRB2Updater/app.config b/tools/SRB2Updater/app.config deleted file mode 100644 index b7db28170..000000000 --- a/tools/SRB2Updater/app.config +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/tools/djgpp/all313.dif b/tools/djgpp/all313.dif deleted file mode 100644 index cdecf7d84..000000000 --- a/tools/djgpp/all313.dif +++ /dev/null @@ -1,812 +0,0 @@ -diff -ruN allegro.312/demo/alld/tmp.txt allegro.313/demo/alld/tmp.txt ---- allegro.312/demo/alld/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/demo/alld/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/demo/alleg/tmp.txt allegro.313/demo/alleg/tmp.txt ---- allegro.312/demo/alleg/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/demo/alleg/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/demo/allp/tmp.txt allegro.313/demo/allp/tmp.txt ---- allegro.312/demo/allp/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/demo/allp/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/examples/alld/tmp.txt allegro.313/examples/alld/tmp.txt ---- allegro.312/examples/alld/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/examples/alld/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/examples/alleg/tmp.txt allegro.313/examples/alleg/tmp.txt ---- allegro.312/examples/alleg/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/examples/alleg/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/examples/allp/tmp.txt allegro.313/examples/allp/tmp.txt ---- allegro.312/examples/allp/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/examples/allp/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/makefile allegro.313/makefile ---- allegro.312/makefile Sun Feb 21 00:31:48 1999 -+++ allegro.313/makefile Mon Jun 20 23:45:18 2005 -@@ -7,8 +7,10 @@ - # # - ################################################# - --# replace this definition if you are using PGCC --# PGCC=1 -+# remline this definition if need Allegro for 486 -+PGCC=1 -+ -+GCC=gcc-2 - - .PHONY: baddjgpp baddjdev badgcc badbnu badmake badtxi badpath badalleg - -@@ -22,23 +24,25 @@ - # check that the djdev package is installed - ifeq ($(wildcard $(DJDIR)/bin/djasm.exe),) - baddjdev: -- @echo Missing djgpp package! You need to install djdev201.zip (or whatever the -+ @echo Missing djgpp package! You need to install djdev203.zip (or whatever the - @echo latest version is). Download this from wherever you got djgpp, and unzip - @echo it into the root of your djgpp directory. - endif - - # check that the gcc package is installed --ifeq ($(wildcard $(DJDIR)/bin/gcc.exe),) -+ifeq ($(wildcard $(DJDIR)/bin/$(GCC).exe),) - badgcc: -- @echo Missing djgpp package! You need to install gcc2721b.zip (or whatever the -- @echo latest version is). Download this from wherever you got djgpp, and unzip -- @echo it into the root of your djgpp directory. -+ @echo Missing djgpp package! You need to install gcc2953b.zip. Download this -+ @echo from wherever you got djgpp, and unzip bin\gcc.exe , rename it as -+ @echo $(GCC).exe into the of your bin directory. - endif - -+GCC := @$(GCC) -+ - # check that the binutils package is installed - ifeq ($(wildcard $(DJDIR)/bin/ld.exe),) - badbnu: -- @echo Missing djgpp package! You need to install bnu27b.zip (or whatever the -+ @echo Missing djgpp package! You need to install bnu216b.zip (or whatever the - @echo latest version is). Download this from wherever you got djgpp, and unzip - @echo it into the root of your djgpp directory. - endif -@@ -46,7 +50,7 @@ - # check that the make package is installed - ifeq ($(wildcard $(DJDIR)/bin/make.exe),) - badmake: -- @echo Missing djgpp package! You need to install mak3761b.zip (or whatever the -+ @echo Missing djgpp package! You need to install mak3791b.zip (or whatever the - @echo latest version is). Download this from wherever you got djgpp, and unzip - @echo it into the root of your djgpp directory. - endif -@@ -54,7 +58,7 @@ - # check that the texinfo package is installed - ifeq ($(wildcard $(DJDIR)/bin/makeinfo.exe),) - badtxi: -- @echo Missing djgpp package! You need to install txi390b.zip (or whatever the -+ @echo Missing djgpp package! You need to install txi48b.zip (or whatever the - @echo latest version is). Download this from wherever you got djgpp, and unzip - @echo it into the root of your djgpp directory. If you do not need the Info - @echo documentation, run make all to ignore this error. -@@ -83,11 +87,32 @@ - endif - endif - -+# -------- check environment to see what type of library to build -------- -+ -+ifdef DEBUGMODE -+ -+# -------- build a debugging library -------- -+VERSION = alld -+ -+else -+ifdef PROFILEMODE -+ -+# -------- build a profiling library -------- -+VERSION = allp -+ -+else -+ -+# -------- build a release library -------- -+VERSION = alleg -+ -+endif -+endif -+ -+ - # set some useful paths --OBJ = obj/djgpp --DOBJ = obj\djgpp --LIB = lib/djgpp/liballeg.a --LIBDEST = $(DJDIR)/lib/liballeg.a -+LIB = lib$(VERSION).a -+OBJ = obj/djgpp/$(VERSION) -+LIBDEST = $(DJDIR)/lib/$(LIB) - INCDEST = $(DJDIR)/include/allegro.h - DOCDEST = $(DJDIR)/info/allegro.inf - INTERNAL_H = src/internal.h src/djgpp/interndj.h -@@ -113,19 +138,22 @@ - else - ifdef PROFILEMODE - # build with profiling information -+OFLAGS = -pg -O3 -ffast-math - ifdef PGCC --OFLAGS = -pg -mpentium -O6 -ffast-math -+OFLAGS := $(OFLAGS) -mcpu=pentium - else --OFLAGS = -pg -m486 -O3 -ffast-math -+OFLAGS := $(OFLAGS) -mcpu=i486 - endif - LFLAGS = -pg - -+ - else - # build a normal optimised version -+OFLAGS = -O3 -ffast-math -fomit-frame-pointer - ifdef PGCC --OFLAGS = -mpentium -O6 -ffast-math -fomit-frame-pointer -+OFLAGS := $(OFLAGS) -mcpu=pentium - else --OFLAGS = -m486 -O3 -ffast-math -fomit-frame-pointer -+OFLAGS := $(OFLAGS) -mcpu=i486 - endif - - ifdef SYMBOLMODE -@@ -179,9 +207,18 @@ - - .PHONY: all msg lib install uninstall docs clean veryclean mmxtest $(PROGRAMS) - --all: msg $(LIB) $(PROGRAMS) docs install -+all: msg lib/djgpp/$(LIB) $(PROGRAMS) docs - @echo All done. -- @echo To use Allegro, #include allegro.h and link with liballeg.a -+ifdef DEBUGMODE -+ @echo To install this version of Allegro, run make install DEBUGMODE=1 -+else -+ifdef PROFILEMODE -+ @echo To install this version of Allegro, run make install PROFILEMODE=1 -+else -+ @echo To install this version of Allegro, run make install -+endif -+endif -+ @echo To use Allegro, #include allegro.h and link with $(LIB) - @echo Example command line: gcc foobar.c -o foobar.exe -lalleg - @echo Run make compress to run DJP or UPX on the executable files - @echo Enjoy! -@@ -189,36 +226,36 @@ - msg: - @echo Compiling Allegro. Please wait... - --lib: $(LIB) -+lib: lib/djgpp/$(LIB) - - install: $(LIBDEST) $(INCDEST) $(DOCDEST) - - docs: $(DOCS) - --$(LIBDEST): $(LIB) -- copy lib\djgpp\liballeg.a $(subst /,\,$(LIBDEST)) -+$(LIBDEST): lib/djgpp/$(LIB) -+ cp lib/djgpp/$(LIB) $(LIBDEST) - - $(INCDEST): allegro.h -- copy allegro.h $(subst /,\,$(INCDEST)) -+ cp allegro.h $(INCDEST) - - $(DOCDEST): docs/allegro.inf - ifneq ($(wildcard $(DJDIR)/bin/makeinfo.exe),) -- copy docs\allegro.inf $(subst /,\,$(DOCDEST)) -+ cp docs\allegro.inf $(DOCDEST) - else - @echo makeinfo not installed: skipping copy of allegro.inf - endif - - $(OBJ)/%.o: %.c allegro.h -- gcc $(CFLAGS) -o $@ -c $< -+ $(GCC) $(CFLAGS) -o $@ -c $< - - $(OBJ)/%.o: %.S asmdefs.inc $(OBJ)/asmdef.inc -- gcc $(SFLAGS) -o $@ -c $< -+ $(GCC) $(SFLAGS) -o $@ -c $< - - $(OBJ)/%.o: %.s asmdefs.inc $(OBJ)/asmdef.inc -- gcc -x assembler-with-cpp $(SFLAGS) -o $@ -c $< -+ $(GCC) -x assembler-with-cpp $(SFLAGS) -o $@ -c $< - --*/%.exe: $(OBJ)/%.o $(LIB) -- gcc $(LFLAGS) -o $@ $< $(LIB) -+*/$(VERSION)/%.exe: $(OBJ)/%.o lib/djgpp/$(LIB) -+ $(GCC) $(LFLAGS) -o $@ $< lib/djgpp/$(LIB) - - docs/%.inf: docs/%.txi - ifneq ($(wildcard $(DJDIR)/bin/makeinfo.exe),) -@@ -252,38 +289,38 @@ - $(OBJ)/makedoc.exe -part -ascii THANKS docs/thanks._tx - - $(OBJ)/makedoc.exe: docs/makedoc.c -- gcc $(CFLAGS) $(LFLAGS) -o $@ docs/makedoc.c -+ $(GCC) $(CFLAGS) $(LFLAGS) -o $@ docs/makedoc.c - - $(OBJ)/asmdef.inc: $(OBJ)/asmdef.exe - $(OBJ)/asmdef.exe $(OBJ)/asmdef.inc - - $(OBJ)/asmdef.exe: src/asmdef.c allegro.h $(INTERNAL_H) -- gcc $(CFLAGS) $(LFLAGS) -o $@ src/asmdef.c -+ $(GCC) $(CFLAGS) $(LFLAGS) -o $@ src/asmdef.c - - mmxtest: -- @echo // no MMX > $(DOBJ)\mmx.h -- @echo .text > $(DOBJ)\mmxtest.s -- @echo emms >> $(DOBJ)\mmxtest.s -- @gcc -c $(OBJ)/mmxtest.s -o $(OBJ)/mmxtest.o -- @echo #define ALLEGRO_MMX > $(DOBJ)\mmx.h -+ @echo // no MMX > $(subst /,\,$(OBJ))\mmx.h -+ @echo .text > $(subst /,\,$(OBJ))\mmxtest.s -+ @echo emms >> $(subst /,\,$(OBJ))\mmxtest.s -+ @$(GCC) -c $(OBJ)/mmxtest.s -o $(OBJ)/mmxtest.o -+ @echo #define ALLEGRO_MMX > $(subst /,\,$(OBJ))\mmx.h - @echo Your assembler supports MMX instructions! - - $(OBJ)/mmx.h: - @echo Testing for MMX assembler support... - -$(MAKE) mmxtest - --$(OBJ)/setupdat.s $(OBJ)/setupdat.h: setup/setup.dat tools/dat2s.exe -- tools/dat2s.exe setup/setup.dat -o $(OBJ)/setupdat.s -h $(OBJ)/setupdat.h -+$(OBJ)/setupdat.s $(OBJ)/setupdat.h: setup/setup.dat tools/$(VERSION)/dat2s.exe -+ tools/$(VERSION)/dat2s.exe setup/setup.dat -o $(OBJ)/setupdat.s -h $(OBJ)/setupdat.h - - $(OBJ)/setupdat.o: $(OBJ)/setupdat.s -- gcc $(SFLAGS) -o $(OBJ)/setupdat.o -c $(OBJ)/setupdat.s -+ $(GCC) $(SFLAGS) -o $(OBJ)/setupdat.o -c $(OBJ)/setupdat.s - --setup/setup.exe: $(OBJ)/setup.o $(OBJ)/setupdat.o $(LIB) -- gcc $(LFLAGS) -o setup/setup.exe $(OBJ)/setup.o $(OBJ)/setupdat.o $(LIB) -+setup/$(VERSION)/setup.exe: $(OBJ)/setup.o $(OBJ)/setupdat.o lib/djgpp/$(LIB) -+ $(GCC) $(LFLAGS) -o setup/$(VERSION)/setup.exe $(OBJ)/setup.o $(OBJ)/setupdat.o lib/djgpp/$(LIB) - ifndef DEBUGMODE - ifndef SYMBOLMODE - ifneq ($(DJP),) -- $(DJP) setup/setup.exe -+ $(DJP) setup/$(VERSION)/setup.exe - endif - endif - endif -@@ -301,79 +338,79 @@ - endif - - $(OBJ)/plugins.h: $(wildcard tools/plugins/*.inc) -- copy tools\plugins\*.inc $(DOBJ)\plugins.h -+ cat tools/plugins/*.inc > $(OBJ)/plugins.h - --tools/dat.exe: $(OBJ)/dat.o $(DATEDIT_DEPS) $(LIB) -- gcc $(LFLAGS) -o tools/dat.exe $(OBJ)/dat.o $(DATEDIT_LINK) $(LIB) -+tools/$(VERSION)/dat.exe: $(OBJ)/dat.o $(DATEDIT_DEPS) lib/djgpp/$(LIB) -+ $(GCC) $(LFLAGS) -o tools/$(VERSION)/dat.exe $(OBJ)/dat.o $(DATEDIT_LINK) lib/djgpp/$(LIB) - --tools/dat2s.exe: $(OBJ)/dat2s.o $(DATEDIT_DEPS) $(LIB) -- gcc $(LFLAGS) -o tools/dat2s.exe $(OBJ)/dat2s.o $(DATEDIT_LINK) $(LIB) -+tools/$(VERSION)/dat2s.exe: $(OBJ)/dat2s.o $(DATEDIT_DEPS) lib/djgpp/$(LIB) -+ $(GCC) $(LFLAGS) -o tools/$(VERSION)/dat2s.exe $(OBJ)/dat2s.o $(DATEDIT_LINK) lib/djgpp/$(LIB) - --tools/grabber.exe: $(OBJ)/grabber.o $(DATEDIT_DEPS) $(LIB) -- gcc $(LFLAGS) -o tools/grabber.exe $(OBJ)/grabber.o $(DATEDIT_LINK) $(LIB) -+tools/$(VERSION)/grabber.exe: $(OBJ)/grabber.o $(DATEDIT_DEPS) lib/djgpp/$(LIB) -+ $(GCC) $(LFLAGS) -o tools/$(VERSION)/grabber.exe $(OBJ)/grabber.o $(DATEDIT_LINK) lib/djgpp/$(LIB) - --tools/pat2dat.exe: $(OBJ)/pat2dat.o $(DATEDIT_DEPS) $(LIB) -- gcc $(LFLAGS) -o tools/pat2dat.exe $(OBJ)/pat2dat.o $(DATEDIT_LINK) $(LIB) -+tools/$(VERSION)/pat2dat.exe: $(OBJ)/pat2dat.o $(DATEDIT_DEPS) lib/djgpp/$(LIB) -+ $(GCC) $(LFLAGS) -o tools/$(VERSION)/pat2dat.exe $(OBJ)/pat2dat.o $(DATEDIT_LINK) lib/djgpp/$(LIB) - --$(LIB): $(LIB_OBJS) -- ar rs $(LIB) $(LIB_OBJS) -+lib/djgpp/$(LIB): $(LIB_OBJS) -+ ar rs lib/djgpp/$(LIB) $(LIB_OBJS) - - compress: $(PROGRAMS) - ifneq ($(DJP),) -- $(DJP) demo/*.exe examples/*.exe tests/*.exe tools/*.exe setup/keyconf.exe obj/djgpp/*.exe -+ $(DJP) demo/$(VERSION)/*.exe examples/$(VERSION)/*.exe tests/$(VERSION)/*.exe tools/$(VERSION)/*.exe setup/$(VERSION)/keyconf.exe $(OBJ)*.exe - else - @echo No executable compressor found! This target requires either the - @echo DJP or UPX utilities to be installed in your djgpp bin directory. - endif - - clean: -- -rm -v obj/djgpp/*.* lib/djgpp/*.* docs/*.$(HTML) docs/*.txi docs/*.inf docs/*.rtf -+ -rm -f -v $(OBJ)/*.* lib/djgpp/*.* docs/*.$(HTML) docs/*.txi docs/*.inf docs/*.rtf - - veryclean: clean -- -rm -v allegro.txt AUTHORS CHANGES faq.txt help.txt NEWS THANKS \ -- demo/*.exe examples/*.exe setup/*.exe tests/*.exe tools/*.exe -+ -rm -f -v allegro.txt AUTHORS CHANGES faq.txt help.txt NEWS THANKS \ -+ demo/$(VERSION)/*.exe examples/$(VERSION)/*.exe setup/$(VERSION)/*.exe tests/$(VERSION)/*.exe tools/$(VERSION)/*.exe - - uninstall: -- -rm $(LIBDEST) -- -rm $(INCDEST) -- -rm $(DOCDEST) -+ -rm -f $(LIBDEST) -+ -rm -f $(INCDEST) -+ -rm -f $(DOCDEST) - @echo All gone! (sulk) - --demo: demo/demo.exe --keyconf: setup/keyconf.exe --setup: setup/setup.exe --afinfo: tests/afinfo.exe --akaitest: tests/akaitest.exe --digitest: tests/digitest.exe --mathtest: tests/mathtest.exe --miditest: tests/miditest.exe --play: tests/play.exe --playfli: tests/playfli.exe --test: tests/test.exe --vesainfo: tests/vesainfo.exe --colormap: tools/colormap.exe --dat: tools/dat.exe --dat2s: tools/dat2s.exe --exedat: tools/exedat.exe --grabber: tools/grabber.exe --pack: tools/pack.exe --pat2dat: tools/pat2dat.exe --rgbmap: tools/rgbmap.exe -- --examples: examples/ex1.exe examples/ex2.exe examples/ex3.exe \ -- examples/ex4.exe examples/ex5.exe examples/ex6.exe \ -- examples/ex7.exe examples/ex8.exe examples/ex9.exe \ -- examples/ex10.exe examples/ex11.exe examples/ex12.exe \ -- examples/ex13.exe examples/ex14.exe examples/ex15.exe \ -- examples/ex16.exe examples/ex17.exe examples/ex18.exe \ -- examples/ex19.exe examples/ex20.exe examples/ex21.exe \ -- examples/ex22.exe examples/ex23.exe examples/ex24.exe \ -- examples/ex25.exe examples/ex26.exe examples/ex27.exe \ -- examples/ex28.exe examples/ex29.exe examples/ex30.exe \ -- examples/ex31.exe examples/ex32.exe examples/ex33.exe \ -- examples/ex34.exe examples/ex35.exe examples/ex36.exe \ -- examples/ex37.exe examples/ex38.exe examples/ex39.exe \ -- examples/ex40.exe -+demo: demo/$(VERSION)/demo.exe -+keyconf: setup/$(VERSION)/keyconf.exe -+setup: setup/$(VERSION)/setup.exe -+afinfo: tests/$(VERSION)/afinfo.exe -+akaitest: tests/$(VERSION)/akaitest.exe -+digitest: tests/$(VERSION)/digitest.exe -+mathtest: tests/$(VERSION)/mathtest.exe -+miditest: tests/$(VERSION)/miditest.exe -+play: tests/$(VERSION)/play.exe -+playfli: tests/$(VERSION)/playfli.exe -+test: tests/$(VERSION)/test.exe -+vesainfo: tests/$(VERSION)/vesainfo.exe -+colormap: tools/$(VERSION)/colormap.exe -+dat: tools/$(VERSION)/dat.exe -+dat2s: tools/$(VERSION)/dat2s.exe -+exedat: tools/$(VERSION)/exedat.exe -+grabber: tools/$(VERSION)/grabber.exe -+pack: tools/$(VERSION)/pack.exe -+pat2dat: tools/$(VERSION)/pat2dat.exe -+rgbmap: tools/$(VERSION)/rgbmap.exe -+ -+examples: examples/$(VERSION)/ex1.exe examples/$(VERSION)/ex2.exe examples/$(VERSION)/ex3.exe \ -+ examples/$(VERSION)/ex4.exe examples/$(VERSION)/ex5.exe examples/$(VERSION)/ex6.exe \ -+ examples/$(VERSION)/ex7.exe examples/$(VERSION)/ex8.exe examples/$(VERSION)/ex9.exe \ -+ examples/$(VERSION)/ex10.exe examples/$(VERSION)/ex11.exe examples/$(VERSION)/ex12.exe \ -+ examples/$(VERSION)/ex13.exe examples/$(VERSION)/ex14.exe examples/$(VERSION)/ex15.exe \ -+ examples/$(VERSION)/ex16.exe examples/$(VERSION)/ex17.exe examples/$(VERSION)/ex18.exe \ -+ examples/$(VERSION)/ex19.exe examples/$(VERSION)/ex20.exe examples/$(VERSION)/ex21.exe \ -+ examples/$(VERSION)/ex22.exe examples/$(VERSION)/ex23.exe examples/$(VERSION)/ex24.exe \ -+ examples/$(VERSION)/ex25.exe examples/$(VERSION)/ex26.exe examples/$(VERSION)/ex27.exe \ -+ examples/$(VERSION)/ex28.exe examples/$(VERSION)/ex29.exe examples/$(VERSION)/ex30.exe \ -+ examples/$(VERSION)/ex31.exe examples/$(VERSION)/ex32.exe examples/$(VERSION)/ex33.exe \ -+ examples/$(VERSION)/ex34.exe examples/$(VERSION)/ex35.exe examples/$(VERSION)/ex36.exe \ -+ examples/$(VERSION)/ex37.exe examples/$(VERSION)/ex38.exe examples/$(VERSION)/ex39.exe \ -+ examples/$(VERSION)/ex40.exe - - $(OBJ)/demo.o: demo.h - $(OBJ)/adlib.o: fm_instr.h -diff -ruN allegro.312/obj/djgpp/alld/tmp.txt allegro.313/obj/djgpp/alld/tmp.txt ---- allegro.312/obj/djgpp/alld/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/obj/djgpp/alld/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/obj/djgpp/alleg/tmp.txt allegro.313/obj/djgpp/alleg/tmp.txt ---- allegro.312/obj/djgpp/alleg/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/obj/djgpp/alleg/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/obj/djgpp/allp/tmp.txt allegro.313/obj/djgpp/allp/tmp.txt ---- allegro.312/obj/djgpp/allp/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/obj/djgpp/allp/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/obj/djgpp/tmp.txt allegro.313/obj/djgpp/tmp.txt ---- allegro.312/obj/djgpp/tmp.txt Sat Feb 27 21:25:34 1999 -+++ allegro.313/obj/djgpp/tmp.txt Thu Jan 1 00:00:00 1970 -@@ -1 +0,0 @@ --This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/setup/alld/tmp.txt allegro.313/setup/alld/tmp.txt ---- allegro.312/setup/alld/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/setup/alld/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/setup/alleg/tmp.txt allegro.313/setup/alleg/tmp.txt ---- allegro.312/setup/alleg/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/setup/alleg/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/setup/allp/tmp.txt allegro.313/setup/allp/tmp.txt ---- allegro.312/setup/allp/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/setup/allp/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/src/asmdefs.inc allegro.313/src/asmdefs.inc ---- allegro.312/src/asmdefs.inc Sat Feb 20 20:51:22 1999 -+++ allegro.313/src/asmdefs.inc Sun Jun 19 04:18:44 2005 -@@ -41,8 +41,8 @@ - * %eax. Registers will be unchanged, except %eax will return a pointer - * to the start of the selected scanline. - */ --#define WRITE_BANK() call BMP_WBANK(%edx) --#define READ_BANK() call BMP_RBANK(%edx) -+#define WRITE_BANK() call *BMP_WBANK(%edx) -+#define READ_BANK() call *BMP_RBANK(%edx) - - - /* Helper macro for looking up a position in the pattern bitmap. Passed -diff -ruN allegro.312/src/djgpp/gpro.c allegro.313/src/djgpp/gpro.c ---- allegro.312/src/djgpp/gpro.c Sat Feb 20 22:01:28 1999 -+++ allegro.313/src/djgpp/gpro.c Mon Jun 20 21:23:42 2005 -@@ -53,135 +53,79 @@ - */ - static int read_gpp(int pad_num) - { -- char samples[60]; -- char clock_mask, data_mask; -- int ret; -- -- asm ( -- " cmpb $0, %0 ; " -- " jne 14f ; " -- " movb $0x10, %b2 ; " -- " movb $0x20, %b3 ; " -- " jmp 15f ; " -- " 14: " -- " movb $0x40, %b2 ; " -- " movb $0x80, %b3 ; " -- -- " 15: " -- " xorl %%ebx, %%ebx ; " -- " xorl %%edi, %%edi ; " -- " movw $0x201, %%dx ; " -- -- " cli ; " -- " inb %%dx, %%al ; " -- " movb %%al, %%ah ; " -- -- " 4: " -- " xorl %%ecx, %%ecx ; " -- " 0: " -- " inb %%dx, %%al ; " -- " cmpb %%ah, %%al ; " -- " jne 1f ; " -- " incl %%ecx ; " -- " cmpl $255, %%ecx ; " -- " jl 0b ; " -- -- " 1: " -- " cmpl $255, %%ecx ; " -- " je 16f ; " -- -- " testb %%ah, %b2 ; " -- " jz 2f ; " -- " testb %%al, %b2 ; " -- " jnz 2f ; " -- -- " addl %4, %%edi ; " -- " testb %%al, %b3 ; " -- " jz 3f ; " -- " movb $1, (%%edi) ; " -- " jmp 12f ; " -- " 3: " -- " movb $0, (%%edi) ; " -- " 12: " -- " subl %4, %%edi ; " -- " incl %%edi ; " -- -- " 2: " -- " movb %%al, %%ah ; " -- " cmpl $200, %%ebx ; " -- " je 13f ; " -- " incl %%ebx ; " -- " cmpl $50, %%edi ; " -- " jl 4b ; " -- -- " 13: " -- " sti ; " -- " xorl %%ecx, %%ecx ; " -- " movl $1, %%esi ; " -- " 7: " -- " addl %4, %%esi ; " -- " movb (%%esi), %%dl ; " -- " subl %4, %%esi ; " -- " cmpb $1, %%dl ; " -- " jg 16f ; " -- " jne 6f ; " -- " incl %%ecx ; " -- " jmp 5f ; " -- " 6: " -- " xorl %%ecx, %%ecx ; " -- -- " 5: " -- " cmpl $5, %%ecx ; " -- " je 8f ; " -- " cmpl %%edi, %%esi ; " -- " je 8f ; " -- " incl %%esi ; " -- " jmp 7b ; " -- -- " 8: " -- " cmpl $5, %%ecx ; " -- " jne 16f ; " -- " addl $2, %%esi ; " -- " xorl %%eax, %%eax ; " -- " xorl %%ebx, %%ebx ; " -- " xorl %%ecx, %%ecx ; " -- " xorl %%edx, %%edx ; " -- -- " 10: " -- " incl %%ecx ; " -- " cmpl $5, %%ecx ; " -- " jne 11f ; " -- " movl $1, %%ecx ; " -- " incl %%esi ; " -- " 11: " -- " addl %4, %%esi ; " -- " movb (%%esi), %%dl ; " -- " subl %4, %%esi ; " -- " orl %%edx, %%eax ; " -- " shll $1, %%eax ; " -- " cmpl $13, %%ebx ; " -- " je 9f ; " -- " incl %%ebx ; " -- " incl %%esi ; " -- " jmp 10b ; " -- -- " 16: " -- " movl $1, %%eax ; " -- -- " 9: " -- " sti ; " -- -- : "=a" (ret) -- -- : "0" (pad_num), -- "m" (clock_mask), -- "m" (data_mask), -- "m" (samples) -+ int samples[50]; -+ int clock_mask, data_mask, data, old_data; -+ int num_samples, timeout1, timeout2, sample_pos, c; -+ -+ if (pad_num == 0) { -+ clock_mask = 0x10; -+ data_mask = 0x20; -+ } -+ else { -+ clock_mask = 0x40; -+ data_mask = 0x80; -+ } -+ -+ num_samples = 0; -+ timeout1 = 0; -+ -+ asm volatile ("cli"); -+ -+ old_data = inportb(0x201); -+ data = 0; -+ -+ while (num_samples<50) { -+ for (timeout2=0; timeout2<255; timeout2++) { -+ data = inportb(0x201); -+ if (data != old_data) -+ break; -+ } -+ -+ if (timeout2 == 255) { -+ asm volatile ("sti"); -+ return 1; -+ } -+ -+ if ((old_data & clock_mask) && (!(data & clock_mask))) { -+ samples[num_samples] = (data & data_mask) ? 1 : 0; -+ num_samples++; -+ } -+ -+ old_data = data; -+ -+ if (timeout1++ == 200) -+ break; -+ } -+ -+ asm volatile ("sti"); -+ -+ c = 0; -+ -+ for (sample_pos=1; sample_posgs), - "=m" (sregs->ss) - -- : /* no inputs */ -- -- : "%eax" /* clobbers %eax */ - ); - } - -diff -ruN allegro.312/src/gfx15.s allegro.313/src/gfx15.s ---- allegro.312/src/gfx15.s Sat Feb 20 20:50:30 1999 -+++ allegro.313/src/gfx15.s Mon Jun 20 22:46:02 2005 -@@ -367,9 +367,9 @@ - movl BMP_CT(%edx), %esi /* clip y1 */ - - vline_y1_ok: -- cmpw BMP_CB(%edx), %ecx /* test y2, bmp->cb */ -+ cmpw BMP_CB(%edx), %cx /* test y2, bmp->cb */ - jl vline_noclip -- cmpw BMP_CB(%edx), %esi /* test y1, bmp->cb */ -+ cmpw BMP_CB(%edx), %si /* test y1, bmp->cb */ - jge vline_done - movl BMP_CB(%edx), %ecx /* clip y2 */ - decl %ecx -diff -ruN allegro.312/src/gfx16.s allegro.313/src/gfx16.s ---- allegro.312/src/gfx16.s Sat Feb 20 20:50:42 1999 -+++ allegro.313/src/gfx16.s Mon Jun 20 22:47:28 2005 -@@ -417,9 +417,9 @@ - movl BMP_CT(%edx), %esi /* clip y1 */ - - vline_y1_ok: -- cmpw BMP_CB(%edx), %ecx /* test y2, bmp->cb */ -+ cmpw BMP_CB(%edx), %cx /* test y2, bmp->cb */ - jl vline_noclip -- cmpw BMP_CB(%edx), %esi /* test y1, bmp->cb */ -+ cmpw BMP_CB(%edx), %si /* test y1, bmp->cb */ - jge vline_done - movl BMP_CB(%edx), %ecx /* clip y2 */ - decl %ecx -diff -ruN allegro.312/src/gfx24.s allegro.313/src/gfx24.s ---- allegro.312/src/gfx24.s Sat Feb 20 20:46:30 1999 -+++ allegro.313/src/gfx24.s Mon Jun 20 22:48:22 2005 -@@ -265,7 +265,7 @@ - movl %eax, ARG2 /* ARG2 == 12(%ebp) */ - movl %eax, 15(%ebp) /* overwrite ARG2, ARG3, ARG4 */ - movl %eax, 18(%ebp) -- movw %eax, 21(%ebp) -+ movw %ax, 21(%ebp) - shrl $16, %eax - movb %al, 23(%ebp) - cmpl $4, %ecx -@@ -503,9 +503,9 @@ - movl BMP_CT(%edx), %esi /* clip y1 */ - - vline_y1_ok: -- cmpw BMP_CB(%edx), %ecx /* test y2, bmp->cb */ -+ cmpw BMP_CB(%edx), %cx /* test y2, bmp->cb */ - jl vline_noclip -- cmpw BMP_CB(%edx), %esi /* test y1, bmp->cb */ -+ cmpw BMP_CB(%edx), %si /* test y1, bmp->cb */ - jge vline_done - movl BMP_CB(%edx), %ecx /* clip y2 */ - decl %ecx -diff -ruN allegro.312/src/gfx32.s allegro.313/src/gfx32.s ---- allegro.312/src/gfx32.s Sat Feb 20 20:50:40 1999 -+++ allegro.313/src/gfx32.s Mon Jun 20 22:48:44 2005 -@@ -398,9 +398,9 @@ - movl BMP_CT(%edx), %esi /* clip y1 */ - - vline_y1_ok: -- cmpw BMP_CB(%edx), %ecx /* test y2, bmp->cb */ -+ cmpw BMP_CB(%edx), %cx /* test y2, bmp->cb */ - jl vline_noclip -- cmpw BMP_CB(%edx), %esi /* test y1, bmp->cb */ -+ cmpw BMP_CB(%edx), %si /* test y1, bmp->cb */ - jge vline_done - movl BMP_CB(%edx), %ecx /* clip y2 */ - decl %ecx -diff -ruN allegro.312/src/gfx8.s allegro.313/src/gfx8.s ---- allegro.312/src/gfx8.s Sat Feb 20 20:50:54 1999 -+++ allegro.313/src/gfx8.s Mon Jun 20 22:49:02 2005 -@@ -455,9 +455,9 @@ - movl BMP_CT(%edx), %esi /* clip y1 */ - - vline_y1_ok: -- cmpw BMP_CB(%edx), %ecx /* test y2, bmp->cb */ -+ cmpw BMP_CB(%edx), %cx /* test y2, bmp->cb */ - jl vline_noclip -- cmpw BMP_CB(%edx), %esi /* test y1, bmp->cb */ -+ cmpw BMP_CB(%edx), %si /* test y1, bmp->cb */ - jge vline_done - movl BMP_CB(%edx), %ecx /* clip y2 */ - decl %ecx -diff -ruN allegro.312/tests/alld/tmp.txt allegro.313/tests/alld/tmp.txt ---- allegro.312/tests/alld/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/tests/alld/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/tests/alleg/tmp.txt allegro.313/tests/alleg/tmp.txt ---- allegro.312/tests/alleg/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/tests/alleg/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/tests/allp/tmp.txt allegro.313/tests/allp/tmp.txt ---- allegro.312/tests/allp/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/tests/allp/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/tools/alld/tmp.txt allegro.313/tools/alld/tmp.txt ---- allegro.312/tools/alld/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/tools/alld/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/tools/alleg/tmp.txt allegro.313/tools/alleg/tmp.txt ---- allegro.312/tools/alleg/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/tools/alleg/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. -diff -ruN allegro.312/tools/allp/tmp.txt allegro.313/tools/allp/tmp.txt ---- allegro.312/tools/allp/tmp.txt Thu Jan 1 00:00:00 1970 -+++ allegro.313/tools/allp/tmp.txt Sat Feb 27 21:25:34 1999 -@@ -0,0 +1 @@ -+This file is needed because some unzip programs skip empty directories. diff --git a/tools/fmoddyn.h b/tools/fmoddyn.h deleted file mode 100644 index d1e7c43f8..000000000 --- a/tools/fmoddyn.h +++ /dev/null @@ -1,582 +0,0 @@ -/* =========================================================================================== */ -/* FMOD Dynamic DLL loading header. Copyright (c), Firelight Technologies Pty, Ltd. 1999-2004. */ -/* =========================================================================================== */ - -#ifndef _FMODDYN_H_ -#define _FMODDYN_H_ - -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) - #include -#else - #include - #include -#endif -#include - -typedef struct -{ - void *module; - - signed char (F_API *FSOUND_SetOutput)(int outputtype); - signed char (F_API *FSOUND_SetDriver)(int driver); - signed char (F_API *FSOUND_SetMixer)(int mixer); - signed char (F_API *FSOUND_SetBufferSize)(int len_ms); - signed char (F_API *FSOUND_SetHWND)(void *hwnd); - signed char (F_API *FSOUND_SetMinHardwareChannels)(int min); - signed char (F_API *FSOUND_SetMaxHardwareChannels)(int max); - signed char (F_API *FSOUND_SetMemorySystem)(void *pool, int poollen, FSOUND_ALLOCCALLBACK useralloc, FSOUND_REALLOCCALLBACK userrealloc, FSOUND_FREECALLBACK userfree); - signed char (F_API *FSOUND_Init)(int mixrate, int maxsoftwarechannels, unsigned int flags); - void (F_API *FSOUND_Close)(); - void (F_API *FSOUND_Update)(); /* you must call this once a frame */ - void (F_API *FSOUND_SetSpeakerMode)(unsigned int speakermode); - void (F_API *FSOUND_SetSFXMasterVolume)(int volume); - void (F_API *FSOUND_SetPanSeperation)(float pansep); - void (F_API *FSOUND_File_SetCallbacks)(FSOUND_OPENCALLBACK useropen, FSOUND_CLOSECALLBACK userclose, FSOUND_READCALLBACK userread, FSOUND_SEEKCALLBACK userseek, FSOUND_TELLCALLBACK usertell); - int (F_API *FSOUND_GetError)(); - float (F_API *FSOUND_GetVersion)(); - int (F_API *FSOUND_GetOutput)(); - void * (F_API *FSOUND_GetOutputHandle)(); - int (F_API *FSOUND_GetDriver)(); - int (F_API *FSOUND_GetMixer)(); - int (F_API *FSOUND_GetNumDrivers)(); - const char * (F_API *FSOUND_GetDriverName)(int id); - signed char (F_API *FSOUND_GetDriverCaps)(int id, unsigned int *caps); - int (F_API *FSOUND_GetOutputRate)(); - int (F_API *FSOUND_GetMaxChannels)(); - int (F_API *FSOUND_GetMaxSamples)(); - unsigned int (F_API *FSOUND_GetSpeakerMode)(); - int (F_API *FSOUND_GetSFXMasterVolume)(); - signed char (F_API *FSOUND_GetNumHWChannels)(int *num2d, int *num3d, int *total); - int (F_API *FSOUND_GetChannelsPlaying)(); - float (F_API *FSOUND_GetCPUUsage)(); - void (F_API *FSOUND_GetMemoryStats)(unsigned int *currentalloced, unsigned int *maxalloced); - FSOUND_SAMPLE * (F_API *FSOUND_Sample_Load)(int index, const char *name_or_data, unsigned int mode, int offset, int length); - FSOUND_SAMPLE * (F_API *FSOUND_Sample_Alloc)(int index, int length, unsigned int mode, int deffreq, int defvol, int defpan, int defpri); - void (F_API *FSOUND_Sample_Free)(FSOUND_SAMPLE *sptr); - signed char (F_API *FSOUND_Sample_Upload)(FSOUND_SAMPLE *sptr, void *srcdata, unsigned int mode); - signed char (F_API *FSOUND_Sample_Lock)(FSOUND_SAMPLE *sptr, int offset, int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2); - signed char (F_API *FSOUND_Sample_Unlock)(FSOUND_SAMPLE *sptr, void *ptr1, void *ptr2, unsigned int len1, unsigned int len2); - signed char (F_API *FSOUND_Sample_SetMode)(FSOUND_SAMPLE *sptr, unsigned int mode); - signed char (F_API *FSOUND_Sample_SetLoopPoints)(FSOUND_SAMPLE *sptr, int loopstart, int loopend); - signed char (F_API *FSOUND_Sample_SetDefaults)(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri); - signed char (F_API *FSOUND_Sample_SetDefaultsEx)(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri, int varfreq, int varvol, int varpan); - signed char (F_API *FSOUND_Sample_SetMinMaxDistance)(FSOUND_SAMPLE *sptr, float min, float max); - signed char (F_API *FSOUND_Sample_SetMaxPlaybacks)(FSOUND_SAMPLE *sptr, int max); - FSOUND_SAMPLE * (F_API *FSOUND_Sample_Get)(int sampno); - const char * (F_API *FSOUND_Sample_GetName)(FSOUND_SAMPLE *sptr); - unsigned int (F_API *FSOUND_Sample_GetLength)(FSOUND_SAMPLE *sptr); - signed char (F_API *FSOUND_Sample_GetLoopPoints)(FSOUND_SAMPLE *sptr, int *loopstart, int *loopend); - signed char (F_API *FSOUND_Sample_GetDefaults)(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri); - signed char (F_API *FSOUND_Sample_GetDefaultsEx)(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri, int *varfreq, int *varvol, int *varpan); - unsigned int (F_API *FSOUND_Sample_GetMode)(FSOUND_SAMPLE *sptr); - signed char (F_API *FSOUND_Sample_GetMinMaxDistance)(FSOUND_SAMPLE *sptr, float *min, float *max); - int (F_API *FSOUND_PlaySound)(int channel, FSOUND_SAMPLE *sptr); - int (F_API *FSOUND_PlaySoundEx)(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused); - signed char (F_API *FSOUND_StopSound)(int channel); - signed char (F_API *FSOUND_SetFrequency)(int channel, int freq); - signed char (F_API *FSOUND_SetVolume)(int channel, int vol); - signed char (F_API *FSOUND_SetVolumeAbsolute)(int channel, int vol); - signed char (F_API *FSOUND_SetPan)(int channel, int pan); - signed char (F_API *FSOUND_SetSurround)(int channel, signed char surround); - signed char (F_API *FSOUND_SetMute)(int channel, signed char mute); - signed char (F_API *FSOUND_SetPriority)(int channel, int priority); - signed char (F_API *FSOUND_SetReserved)(int channel, signed char reserved); - signed char (F_API *FSOUND_SetPaused)(int channel, signed char paused); - signed char (F_API *FSOUND_SetLoopMode)(int channel, unsigned int loopmode); - signed char (F_API *FSOUND_SetCurrentPosition)(int channel, unsigned int offset); - signed char (F_API *FSOUND_3D_SetAttributes)(int channel, const float *pos, const float *vel); - signed char (F_API *FSOUND_3D_SetMinMaxDistance)(int channel, float min, float max); - signed char (F_API *FSOUND_IsPlaying)(int channel); - int (F_API *FSOUND_GetFrequency)(int channel); - int (F_API *FSOUND_GetVolume)(int channel); - int (F_API *FSOUND_GetAmplitude)(int channel); - int (F_API *FSOUND_GetPan)(int channel); - signed char (F_API *FSOUND_GetSurround)(int channel); - signed char (F_API *FSOUND_GetMute)(int channel); - int (F_API *FSOUND_GetPriority)(int channel); - signed char (F_API *FSOUND_GetReserved)(int channel); - signed char (F_API *FSOUND_GetPaused)(int channel); - unsigned int (F_API *FSOUND_GetLoopMode)(int channel); - unsigned int (F_API *FSOUND_GetCurrentPosition)(int channel); - FSOUND_SAMPLE * (F_API *FSOUND_GetCurrentSample)(int channel); - signed char (F_API *FSOUND_GetCurrentLevels)(int channel, float *l, float *r); - int (F_API *FSOUND_GetNumSubChannels)(int channel); - int (F_API *FSOUND_GetSubChannel)(int channel, int subchannel); - signed char (F_API *FSOUND_3D_GetAttributes)(int channel, float *pos, float *vel); - signed char (F_API *FSOUND_3D_GetMinMaxDistance)(int channel, float *min, float *max); - void (F_API *FSOUND_3D_SetDopplerFactor)(float scale); - void (F_API *FSOUND_3D_SetDistanceFactor)(float scale); - void (F_API *FSOUND_3D_SetRolloffFactor)(float scale); - void (F_API *FSOUND_3D_Listener_SetCurrent)(int current, int numlisteners); /* use this if you use multiple listeners / splitscreen */ - void (F_API *FSOUND_3D_Listener_SetAttributes)(const float *pos, const float *vel, float fx, float fy, float fz, float tx, float ty, float tz); - void (F_API *FSOUND_3D_Listener_GetAttributes)(float *pos, float *vel, float *fx, float *fy, float *fz, float *tx, float *ty, float *tz); - int (F_API *FSOUND_FX_Enable)(int channel, unsigned int fx); /* See FSOUND_FX_MODES */ - signed char (F_API *FSOUND_FX_Disable)(int channel); - signed char (F_API *FSOUND_FX_SetChorus)(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase); - signed char (F_API *FSOUND_FX_SetCompressor)(int fxid, float Gain, float Attack, float Release, float Threshold, float Ratio, float Predelay); - signed char (F_API *FSOUND_FX_SetDistortion)(int fxid, float Gain, float Edge, float PostEQCenterFrequency, float PostEQBandwidth, float PreLowpassCutoff); - signed char (F_API *FSOUND_FX_SetEcho)(int fxid, float WetDryMix, float Feedback, float LeftDelay, float RightDelay, int PanDelay); - signed char (F_API *FSOUND_FX_SetFlanger)(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase); - signed char (F_API *FSOUND_FX_SetGargle)(int fxid, int RateHz, int WaveShape); - signed char (F_API *FSOUND_FX_SetI3DL2Reverb)(int fxid, int Room, int RoomHF, float RoomRolloffFactor, float DecayTime, float DecayHFRatio, int Reflections, float ReflectionsDelay, int Reverb, float ReverbDelay, float Diffusion, float Density, float HFReference); - signed char (F_API *FSOUND_FX_SetParamEQ)(int fxid, float Center, float Bandwidth, float Gain); - signed char (F_API *FSOUND_FX_SetWavesReverb)(int fxid, float InGain, float ReverbMix, float ReverbTime, float HighFreqRTRatio); - signed char (F_API *FSOUND_Stream_SetBufferSize)(int ms); /* call this before opening streams, not after */ - FSOUND_STREAM * (F_API *FSOUND_Stream_Open)(const char *name_or_data, unsigned int mode, int offset, int length); - FSOUND_STREAM * (F_API *FSOUND_Stream_Create)(FSOUND_STREAMCALLBACK callback, int length, unsigned int mode, int samplerate, void *userdata); - signed char (F_API *FSOUND_Stream_Close)(FSOUND_STREAM *stream); - int (F_API *FSOUND_Stream_Play)(int channel, FSOUND_STREAM *stream); - int (F_API *FSOUND_Stream_PlayEx)(int channel, FSOUND_STREAM *stream, FSOUND_DSPUNIT *dsp, signed char startpaused); - signed char (F_API *FSOUND_Stream_Stop)(FSOUND_STREAM *stream); - signed char (F_API *FSOUND_Stream_SetPosition)(FSOUND_STREAM *stream, unsigned int position); - unsigned int (F_API *FSOUND_Stream_GetPosition)(FSOUND_STREAM *stream); - signed char (F_API *FSOUND_Stream_SetTime)(FSOUND_STREAM *stream, int ms); - int (F_API *FSOUND_Stream_GetTime)(FSOUND_STREAM *stream); - int (F_API *FSOUND_Stream_GetLength)(FSOUND_STREAM *stream); - int (F_API *FSOUND_Stream_GetLengthMs)(FSOUND_STREAM *stream); - signed char (F_API *FSOUND_Stream_SetMode)(FSOUND_STREAM *stream, unsigned int mode); - unsigned int (F_API *FSOUND_Stream_GetMode)(FSOUND_STREAM *stream); - signed char (F_API *FSOUND_Stream_SetLoopPoints)(FSOUND_STREAM *stream, unsigned int loopstartpcm, unsigned int loopendpcm); - signed char (F_API *FSOUND_Stream_SetLoopCount)(FSOUND_STREAM *stream, int count); - int (F_API *FSOUND_Stream_GetOpenState)(FSOUND_STREAM *stream); - FSOUND_SAMPLE * (F_API *FSOUND_Stream_GetSample)(FSOUND_STREAM *stream); /* every stream contains a sample to playback on */ - FSOUND_DSPUNIT * (F_API *FSOUND_Stream_CreateDSP)(FSOUND_STREAM *stream, FSOUND_DSPCALLBACK callback, int priority, void *userdata); - signed char (F_API *FSOUND_Stream_SetEndCallback)(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata); - signed char (F_API *FSOUND_Stream_SetSyncCallback)(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata); - FSOUND_SYNCPOINT *(F_API *FSOUND_Stream_AddSyncPoint)(FSOUND_STREAM *stream, unsigned int pcmoffset, const char *name); - signed char (F_API *FSOUND_Stream_DeleteSyncPoint)(FSOUND_SYNCPOINT *point); - int (F_API *FSOUND_Stream_GetNumSyncPoints)(FSOUND_STREAM *stream); - FSOUND_SYNCPOINT *(F_API *FSOUND_Stream_GetSyncPoint)(FSOUND_STREAM *stream, int index); - char * (F_API *FSOUND_Stream_GetSyncPointInfo)(FSOUND_SYNCPOINT *point, unsigned int *pcmoffset); - signed char (F_API *FSOUND_Stream_SetSubStream)(FSOUND_STREAM *stream, int index); - int (F_API *FSOUND_Stream_GetNumSubStreams)(FSOUND_STREAM *stream); - signed char (F_API *FSOUND_Stream_SetSubStreamSentence)(FSOUND_STREAM *stream, const int *sentencelist, int numitems); - signed char (F_API *FSOUND_Stream_GetNumTagFields)(FSOUND_STREAM *stream, int *num); - signed char (F_API *FSOUND_Stream_GetTagField)(FSOUND_STREAM *stream, int num, int *type, char **name, void **value, int *length); - signed char (F_API *FSOUND_Stream_FindTagField)(FSOUND_STREAM *stream, int type, const char *name, void **value, int *length); - signed char (F_API *FSOUND_Stream_Net_SetProxy)(const char *proxy); - signed char (F_API *FSOUND_Stream_Net_SetTimeout)(int timeout); - char * (F_API *FSOUND_Stream_Net_GetLastServerStatus)(); - signed char (F_API *FSOUND_Stream_Net_SetBufferProperties)(int buffersize, int prebuffer_percent, int rebuffer_percent); - signed char (F_API *FSOUND_Stream_Net_GetBufferProperties)(int *buffersize, int *prebuffer_percent, int *rebuffer_percent); - signed char (F_API *FSOUND_Stream_Net_SetMetadataCallback)(FSOUND_STREAM *stream, FSOUND_METADATACALLBACK callback, void *userdata); - signed char (F_API *FSOUND_Stream_Net_GetStatus)(FSOUND_STREAM *stream, int *status, int *bufferpercentused, int *bitrate, unsigned int *flags); - signed char (F_API *FSOUND_CD_Play)(char drive, int track); - void (F_API *FSOUND_CD_SetPlayMode)(char drive, signed char mode); - signed char (F_API *FSOUND_CD_Stop)(char drive); - signed char (F_API *FSOUND_CD_SetPaused)(char drive, signed char paused); - signed char (F_API *FSOUND_CD_SetVolume)(char drive, int volume); - signed char (F_API *FSOUND_CD_SetTrackTime)(char drive, unsigned int ms); - signed char (F_API *FSOUND_CD_OpenTray)(char drive, signed char open); - signed char (F_API *FSOUND_CD_GetPaused)(char drive); - int (F_API *FSOUND_CD_GetTrack)(char drive); - int (F_API *FSOUND_CD_GetNumTracks)(char drive); - int (F_API *FSOUND_CD_GetVolume)(char drive); - int (F_API *FSOUND_CD_GetTrackLength)(char drive, int track); - int (F_API *FSOUND_CD_GetTrackTime)(char drive); - FSOUND_DSPUNIT * (F_API *FSOUND_DSP_Create)(FSOUND_DSPCALLBACK callback, int priority, void *userdata); - void (F_API *FSOUND_DSP_Free)(FSOUND_DSPUNIT *unit); - void (F_API *FSOUND_DSP_SetPriority)(FSOUND_DSPUNIT *unit, int priority); - int (F_API *FSOUND_DSP_GetPriority)(FSOUND_DSPUNIT *unit); - void (F_API *FSOUND_DSP_SetActive)(FSOUND_DSPUNIT *unit, signed char active); - signed char (F_API *FSOUND_DSP_GetActive)(FSOUND_DSPUNIT *unit); - FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetClearUnit)(); - FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetSFXUnit)(); - FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetMusicUnit)(); - FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetFFTUnit)(); - FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetClipAndCopyUnit)(); - signed char (F_API *FSOUND_DSP_MixBuffers)(void *destbuffer, void *srcbuffer, int len, int freq, int vol, int pan, unsigned int mode); - void (F_API *FSOUND_DSP_ClearMixBuffer)(); - int (F_API *FSOUND_DSP_GetBufferLength)(); /* Length of each DSP update */ - int (F_API *FSOUND_DSP_GetBufferLengthTotal)(); /* Total buffer length due to FSOUND_SetBufferSize */ - float * (F_API *FSOUND_DSP_GetSpectrum)(); /* Array of 512 floats - call FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE)) for this to work. */ - signed char (F_API *FSOUND_Reverb_SetProperties)(const FSOUND_REVERB_PROPERTIES *prop); - signed char (F_API *FSOUND_Reverb_GetProperties)(FSOUND_REVERB_PROPERTIES *prop); - signed char (F_API *FSOUND_Reverb_SetChannelProperties)(int channel, const FSOUND_REVERB_CHANNELPROPERTIES *prop); - signed char (F_API *FSOUND_Reverb_GetChannelProperties)(int channel, FSOUND_REVERB_CHANNELPROPERTIES *prop); - signed char (F_API *FSOUND_Record_SetDriver)(int outputtype); - int (F_API *FSOUND_Record_GetNumDrivers)(); - const char * (F_API *FSOUND_Record_GetDriverName)(int id); - int (F_API *FSOUND_Record_GetDriver)(); - signed char (F_API *FSOUND_Record_StartSample)(FSOUND_SAMPLE *sptr, signed char loop); - signed char (F_API *FSOUND_Record_Stop)(); - int (F_API *FSOUND_Record_GetPosition)(); - FMUSIC_MODULE * (F_API *FMUSIC_LoadSong)(const char *name); - FMUSIC_MODULE * (F_API *FMUSIC_LoadSongEx)(const char *name_or_data, int offset, int length, unsigned int mode, const int *samplelist, int samplelistnum); - int (F_API *FMUSIC_GetOpenState)(FMUSIC_MODULE *mod); - signed char (F_API *FMUSIC_FreeSong)(FMUSIC_MODULE *mod); - signed char (F_API *FMUSIC_PlaySong)(FMUSIC_MODULE *mod); - signed char (F_API *FMUSIC_StopSong)(FMUSIC_MODULE *mod); - void (F_API *FMUSIC_StopAllSongs)(); - signed char (F_API *FMUSIC_SetZxxCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback); - signed char (F_API *FMUSIC_SetRowCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int rowstep); - signed char (F_API *FMUSIC_SetOrderCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int orderstep); - signed char (F_API *FMUSIC_SetInstCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int instrument); - signed char (F_API *FMUSIC_SetSample)(FMUSIC_MODULE *mod, int sampno, FSOUND_SAMPLE *sptr); - signed char (F_API *FMUSIC_SetUserData)(FMUSIC_MODULE *mod, void *userdata); - signed char (F_API *FMUSIC_OptimizeChannels)(FMUSIC_MODULE *mod, int maxchannels, int minvolume); - signed char (F_API *FMUSIC_SetReverb)(signed char reverb); /* MIDI only */ - signed char (F_API *FMUSIC_SetLooping)(FMUSIC_MODULE *mod, signed char looping); - signed char (F_API *FMUSIC_SetOrder)(FMUSIC_MODULE *mod, int order); - signed char (F_API *FMUSIC_SetPaused)(FMUSIC_MODULE *mod, signed char pause); - signed char (F_API *FMUSIC_SetMasterVolume)(FMUSIC_MODULE *mod, int volume); - signed char (F_API *FMUSIC_SetMasterSpeed)(FMUSIC_MODULE *mode, float speed); - signed char (F_API *FMUSIC_SetPanSeperation)(FMUSIC_MODULE *mod, float pansep); - const char * (F_API *FMUSIC_GetName)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetType)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetNumOrders)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetNumPatterns)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetNumInstruments)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetNumSamples)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetNumChannels)(FMUSIC_MODULE *mod); - FSOUND_SAMPLE * (F_API *FMUSIC_GetSample)(FMUSIC_MODULE *mod, int sampno); - int (F_API *FMUSIC_GetPatternLength)(FMUSIC_MODULE *mod, int orderno); - signed char (F_API *FMUSIC_IsFinished)(FMUSIC_MODULE *mod); - signed char (F_API *FMUSIC_IsPlaying)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetMasterVolume)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetGlobalVolume)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetOrder)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetPattern)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetSpeed)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetBPM)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetRow)(FMUSIC_MODULE *mod); - signed char (F_API *FMUSIC_GetPaused)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetTime)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetRealChannel)(FMUSIC_MODULE *mod, int modchannel); - unsigned int (F_API *FMUSIC_GetUserData)(FMUSIC_MODULE *mod); -} FMOD_INSTANCE; - - -static FMOD_INSTANCE *FMOD_CreateInstance(char *dllName) -{ - FMOD_INSTANCE *instance; - - instance = (FMOD_INSTANCE *)calloc(sizeof(FMOD_INSTANCE), 1); - if (!instance) - { - return NULL; - } - -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) - instance->module = LoadLibrary(dllName); -#else - instance->module = dlopen(dllName, RTLD_LAZY); -#endif - if (!instance->module) - { - free(instance); - return NULL; - } - -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) -#ifdef __MINGW64__ - #define F_GETPROC(_x, _y) \ - { \ - char tmp[] = _y; \ - *(strchr(tmp, '@')) = 0; \ - instance->_x = (LPVOID)GetProcAddress((HMODULE)instance->module, &tmp[1]); \ - if (!instance->_x) \ - { \ - FreeLibrary((HMODULE)instance->module); \ - free(instance); \ - return NULL; \ - } \ - } -#elif defined(__MINGW32__) - #define F_GETPROC(_x, _y) \ - { \ - instance->_x = (LPVOID)GetProcAddress((HMODULE)instance->module, _y); \ - if (!instance->_x) \ - { \ - FreeLibrary((HMODULE)instance->module); \ - free(instance); \ - return NULL; \ - } \ - } -#elif defined (_X86_) - #define F_GETPROC(_x, _y) \ - { \ - instance->_x = (LPVOID)(size_t)GetProcAddress((HMODULE)instance->module, _y); \ - if (!instance->_x) \ - { \ - FreeLibrary((HMODULE)instance->module); \ - free(instance); \ - return NULL; \ - } \ - } -#else - #define F_GETPROC(_x, _y) \ - { \ - char tmp[] = _y; \ - *(strchr(tmp, '@')) = 0; \ - instance->_x = (LPVOID)(size_t)GetProcAddress((HMODULE)instance->module, &tmp[1]); \ - if (!instance->_x) \ - { \ - FreeLibrary((HMODULE)instance->module); \ - free(instance); \ - return NULL; \ - } \ - } -#endif -#else - #define F_GETPROC(_x, _y) \ - { \ - char tmp[] = _y; \ - *(strchr(tmp, '@')) = 0; \ - instance->_x = (void *)dlsym(instance->module, &tmp[1]); \ - if (!instance->_x) \ - { \ - dlclose(instance->module); \ - free(instance); \ - return NULL; \ - } \ - } -#endif - - F_GETPROC(FSOUND_SetOutput, "_FSOUND_SetOutput@4"); - F_GETPROC(FSOUND_SetDriver, "_FSOUND_SetDriver@4"); - F_GETPROC(FSOUND_SetMixer, "_FSOUND_SetMixer@4"); - F_GETPROC(FSOUND_SetBufferSize, "_FSOUND_SetBufferSize@4"); - F_GETPROC(FSOUND_SetHWND, "_FSOUND_SetHWND@4"); - F_GETPROC(FSOUND_SetMinHardwareChannels, "_FSOUND_SetMinHardwareChannels@4"); - F_GETPROC(FSOUND_SetMaxHardwareChannels, "_FSOUND_SetMaxHardwareChannels@4"); - F_GETPROC(FSOUND_SetMemorySystem, "_FSOUND_SetMemorySystem@20"); - F_GETPROC(FSOUND_Init, "_FSOUND_Init@12"); - F_GETPROC(FSOUND_Close, "_FSOUND_Close@0"); - F_GETPROC(FSOUND_Update, "_FSOUND_Update@0"); - F_GETPROC(FSOUND_SetSFXMasterVolume, "_FSOUND_SetSFXMasterVolume@4"); - F_GETPROC(FSOUND_SetPanSeperation, "_FSOUND_SetPanSeperation@4"); - F_GETPROC(FSOUND_SetSpeakerMode, "_FSOUND_SetSpeakerMode@4"); - F_GETPROC(FSOUND_GetError, "_FSOUND_GetError@0"); - F_GETPROC(FSOUND_GetVersion, "_FSOUND_GetVersion@0"); - F_GETPROC(FSOUND_GetOutput, "_FSOUND_GetOutput@0"); - F_GETPROC(FSOUND_GetOutputHandle, "_FSOUND_GetOutputHandle@0"); - F_GETPROC(FSOUND_GetDriver, "_FSOUND_GetDriver@0"); - F_GETPROC(FSOUND_GetMixer, "_FSOUND_GetMixer@0"); - F_GETPROC(FSOUND_GetNumDrivers, "_FSOUND_GetNumDrivers@0"); - F_GETPROC(FSOUND_GetDriverName, "_FSOUND_GetDriverName@4"); - F_GETPROC(FSOUND_GetDriverCaps, "_FSOUND_GetDriverCaps@8"); - F_GETPROC(FSOUND_GetOutputRate, "_FSOUND_GetOutputRate@0"); - F_GETPROC(FSOUND_GetMaxChannels, "_FSOUND_GetMaxChannels@0"); - F_GETPROC(FSOUND_GetMaxSamples, "_FSOUND_GetMaxSamples@0"); - F_GETPROC(FSOUND_GetSpeakerMode, "_FSOUND_GetSpeakerMode@0"); - F_GETPROC(FSOUND_GetSFXMasterVolume, "_FSOUND_GetSFXMasterVolume@0"); - F_GETPROC(FSOUND_GetNumHWChannels, "_FSOUND_GetNumHWChannels@12"); - F_GETPROC(FSOUND_GetChannelsPlaying, "_FSOUND_GetChannelsPlaying@0"); - F_GETPROC(FSOUND_GetCPUUsage, "_FSOUND_GetCPUUsage@0"); - F_GETPROC(FSOUND_GetMemoryStats, "_FSOUND_GetMemoryStats@8"); - F_GETPROC(FSOUND_Sample_Load, "_FSOUND_Sample_Load@20"); - F_GETPROC(FSOUND_Sample_Alloc, "_FSOUND_Sample_Alloc@28"); - F_GETPROC(FSOUND_Sample_Free, "_FSOUND_Sample_Free@4"); - F_GETPROC(FSOUND_Sample_Upload, "_FSOUND_Sample_Upload@12"); - F_GETPROC(FSOUND_Sample_Lock, "_FSOUND_Sample_Lock@28"); - F_GETPROC(FSOUND_Sample_Unlock, "_FSOUND_Sample_Unlock@20"); - F_GETPROC(FSOUND_Sample_SetMode, "_FSOUND_Sample_SetMode@8"); - F_GETPROC(FSOUND_Sample_SetLoopPoints, "_FSOUND_Sample_SetLoopPoints@12"); - F_GETPROC(FSOUND_Sample_SetDefaults, "_FSOUND_Sample_SetDefaults@20"); - F_GETPROC(FSOUND_Sample_SetDefaultsEx, "_FSOUND_Sample_SetDefaultsEx@32"); - F_GETPROC(FSOUND_Sample_SetMinMaxDistance, "_FSOUND_Sample_SetMinMaxDistance@12"); - F_GETPROC(FSOUND_Sample_SetMaxPlaybacks, "_FSOUND_Sample_SetMaxPlaybacks@8"); - F_GETPROC(FSOUND_Sample_Get, "_FSOUND_Sample_Get@4"); - F_GETPROC(FSOUND_Sample_GetName, "_FSOUND_Sample_GetName@4"); - F_GETPROC(FSOUND_Sample_GetLength, "_FSOUND_Sample_GetLength@4"); - F_GETPROC(FSOUND_Sample_GetLoopPoints, "_FSOUND_Sample_GetLoopPoints@12"); - F_GETPROC(FSOUND_Sample_GetDefaults, "_FSOUND_Sample_GetDefaults@20"); - F_GETPROC(FSOUND_Sample_GetDefaultsEx, "_FSOUND_Sample_GetDefaultsEx@32"); - F_GETPROC(FSOUND_Sample_GetMode, "_FSOUND_Sample_GetMode@4"); - F_GETPROC(FSOUND_Sample_GetMinMaxDistance, "_FSOUND_Sample_GetMinMaxDistance@12"); - F_GETPROC(FSOUND_PlaySound, "_FSOUND_PlaySound@8"); - F_GETPROC(FSOUND_PlaySoundEx, "_FSOUND_PlaySoundEx@16"); - F_GETPROC(FSOUND_StopSound, "_FSOUND_StopSound@4"); - F_GETPROC(FSOUND_SetFrequency, "_FSOUND_SetFrequency@8"); - F_GETPROC(FSOUND_SetVolume, "_FSOUND_SetVolume@8"); - F_GETPROC(FSOUND_SetVolumeAbsolute, "_FSOUND_SetVolumeAbsolute@8"); - F_GETPROC(FSOUND_SetPan, "_FSOUND_SetPan@8"); - F_GETPROC(FSOUND_SetSurround, "_FSOUND_SetSurround@8"); - F_GETPROC(FSOUND_SetMute, "_FSOUND_SetMute@8"); - F_GETPROC(FSOUND_SetPriority, "_FSOUND_SetPriority@8"); - F_GETPROC(FSOUND_SetReserved, "_FSOUND_SetReserved@8"); - F_GETPROC(FSOUND_SetPaused, "_FSOUND_SetPaused@8"); - F_GETPROC(FSOUND_SetLoopMode, "_FSOUND_SetLoopMode@8"); - F_GETPROC(FSOUND_SetCurrentPosition, "_FSOUND_SetCurrentPosition@8"); - F_GETPROC(FSOUND_3D_SetAttributes, "_FSOUND_3D_SetAttributes@12"); - F_GETPROC(FSOUND_3D_SetMinMaxDistance, "_FSOUND_3D_SetMinMaxDistance@12"); - F_GETPROC(FSOUND_IsPlaying, "_FSOUND_IsPlaying@4"); - F_GETPROC(FSOUND_GetFrequency, "_FSOUND_GetFrequency@4"); - F_GETPROC(FSOUND_GetVolume, "_FSOUND_GetVolume@4"); - F_GETPROC(FSOUND_GetAmplitude, "_FSOUND_GetAmplitude@4"); - F_GETPROC(FSOUND_GetPan, "_FSOUND_GetPan@4"); - F_GETPROC(FSOUND_GetSurround, "_FSOUND_GetSurround@4"); - F_GETPROC(FSOUND_GetMute, "_FSOUND_GetMute@4"); - F_GETPROC(FSOUND_GetPriority, "_FSOUND_GetPriority@4"); - F_GETPROC(FSOUND_GetReserved, "_FSOUND_GetReserved@4"); - F_GETPROC(FSOUND_GetPaused, "_FSOUND_GetPaused@4"); - F_GETPROC(FSOUND_GetLoopMode, "_FSOUND_GetLoopMode@4"); - F_GETPROC(FSOUND_GetCurrentPosition, "_FSOUND_GetCurrentPosition@4"); - F_GETPROC(FSOUND_GetCurrentSample, "_FSOUND_GetCurrentSample@4"); - F_GETPROC(FSOUND_GetCurrentLevels, "_FSOUND_GetCurrentLevels@12"); - F_GETPROC(FSOUND_GetNumSubChannels, "_FSOUND_GetNumSubChannels@4"); - F_GETPROC(FSOUND_GetSubChannel, "_FSOUND_GetSubChannel@8"); - F_GETPROC(FSOUND_3D_GetAttributes, "_FSOUND_3D_GetAttributes@12"); - F_GETPROC(FSOUND_3D_GetMinMaxDistance, "_FSOUND_3D_GetMinMaxDistance@12"); - F_GETPROC(FSOUND_3D_Listener_SetCurrent, "_FSOUND_3D_Listener_SetCurrent@8"); - F_GETPROC(FSOUND_3D_Listener_SetAttributes, "_FSOUND_3D_Listener_SetAttributes@32"); - F_GETPROC(FSOUND_3D_Listener_GetAttributes, "_FSOUND_3D_Listener_GetAttributes@32"); - F_GETPROC(FSOUND_3D_SetDopplerFactor, "_FSOUND_3D_SetDopplerFactor@4"); - F_GETPROC(FSOUND_3D_SetDistanceFactor, "_FSOUND_3D_SetDistanceFactor@4"); - F_GETPROC(FSOUND_3D_SetRolloffFactor, "_FSOUND_3D_SetRolloffFactor@4"); - F_GETPROC(FSOUND_FX_Enable, "_FSOUND_FX_Enable@8"); - F_GETPROC(FSOUND_FX_Disable, "_FSOUND_FX_Disable@4"); - F_GETPROC(FSOUND_FX_SetChorus, "_FSOUND_FX_SetChorus@32"); - F_GETPROC(FSOUND_FX_SetCompressor, "_FSOUND_FX_SetCompressor@28"); - F_GETPROC(FSOUND_FX_SetDistortion, "_FSOUND_FX_SetDistortion@24"); - F_GETPROC(FSOUND_FX_SetEcho, "_FSOUND_FX_SetEcho@24"); - F_GETPROC(FSOUND_FX_SetFlanger, "_FSOUND_FX_SetFlanger@32"); - F_GETPROC(FSOUND_FX_SetGargle, "_FSOUND_FX_SetGargle@12"); - F_GETPROC(FSOUND_FX_SetI3DL2Reverb, "_FSOUND_FX_SetI3DL2Reverb@52"); - F_GETPROC(FSOUND_FX_SetParamEQ, "_FSOUND_FX_SetParamEQ@16"); - F_GETPROC(FSOUND_FX_SetWavesReverb, "_FSOUND_FX_SetWavesReverb@20"); - F_GETPROC(FSOUND_Stream_Open, "_FSOUND_Stream_Open@16"); - F_GETPROC(FSOUND_Stream_Create, "_FSOUND_Stream_Create@20"); - F_GETPROC(FSOUND_Stream_Play, "_FSOUND_Stream_Play@8"); - F_GETPROC(FSOUND_Stream_PlayEx, "_FSOUND_Stream_PlayEx@16"); - F_GETPROC(FSOUND_Stream_Stop, "_FSOUND_Stream_Stop@4"); - F_GETPROC(FSOUND_Stream_Close, "_FSOUND_Stream_Close@4"); - F_GETPROC(FSOUND_Stream_SetEndCallback, "_FSOUND_Stream_SetEndCallback@12"); - F_GETPROC(FSOUND_Stream_SetSyncCallback, "_FSOUND_Stream_SetSyncCallback@12"); - F_GETPROC(FSOUND_Stream_GetSample, "_FSOUND_Stream_GetSample@4"); - F_GETPROC(FSOUND_Stream_CreateDSP, "_FSOUND_Stream_CreateDSP@16"); - F_GETPROC(FSOUND_Stream_SetBufferSize, "_FSOUND_Stream_SetBufferSize@4"); - F_GETPROC(FSOUND_Stream_SetPosition, "_FSOUND_Stream_SetPosition@8"); - F_GETPROC(FSOUND_Stream_GetPosition, "_FSOUND_Stream_GetPosition@4"); - F_GETPROC(FSOUND_Stream_SetTime, "_FSOUND_Stream_SetTime@8"); - F_GETPROC(FSOUND_Stream_GetTime, "_FSOUND_Stream_GetTime@4"); - F_GETPROC(FSOUND_Stream_GetLength, "_FSOUND_Stream_GetLength@4"); - F_GETPROC(FSOUND_Stream_GetLengthMs, "_FSOUND_Stream_GetLengthMs@4"); - F_GETPROC(FSOUND_Stream_SetMode, "_FSOUND_Stream_SetMode@8"); - F_GETPROC(FSOUND_Stream_GetMode, "_FSOUND_Stream_GetMode@4"); - F_GETPROC(FSOUND_Stream_SetSubStream, "_FSOUND_Stream_SetSubStream@8"); - F_GETPROC(FSOUND_Stream_GetNumSubStreams, "_FSOUND_Stream_GetNumSubStreams@4"); - F_GETPROC(FSOUND_Stream_SetSubStreamSentence, "_FSOUND_Stream_SetSubStreamSentence@12"); - F_GETPROC(FSOUND_Stream_SetLoopPoints, "_FSOUND_Stream_SetLoopPoints@12"); - F_GETPROC(FSOUND_Stream_SetLoopCount, "_FSOUND_Stream_SetLoopCount@8"); - F_GETPROC(FSOUND_Stream_AddSyncPoint, "_FSOUND_Stream_AddSyncPoint@12"); - F_GETPROC(FSOUND_Stream_DeleteSyncPoint, "_FSOUND_Stream_DeleteSyncPoint@4"); - F_GETPROC(FSOUND_Stream_GetNumSyncPoints, "_FSOUND_Stream_GetNumSyncPoints@4"); - F_GETPROC(FSOUND_Stream_GetSyncPoint, "_FSOUND_Stream_GetSyncPoint@8"); - F_GETPROC(FSOUND_Stream_GetSyncPointInfo, "_FSOUND_Stream_GetSyncPointInfo@8"); - F_GETPROC(FSOUND_Stream_GetOpenState, "_FSOUND_Stream_GetOpenState@4"); - F_GETPROC(FSOUND_Stream_GetNumTagFields, "_FSOUND_Stream_GetNumTagFields@8"); - F_GETPROC(FSOUND_Stream_GetTagField, "_FSOUND_Stream_GetTagField@24"); - F_GETPROC(FSOUND_Stream_FindTagField, "_FSOUND_Stream_FindTagField@20"); - F_GETPROC(FSOUND_Stream_Net_SetProxy, "_FSOUND_Stream_Net_SetProxy@4"); - F_GETPROC(FSOUND_Stream_Net_GetLastServerStatus, "_FSOUND_Stream_Net_GetLastServerStatus@0"); - F_GETPROC(FSOUND_Stream_Net_SetBufferProperties, "_FSOUND_Stream_Net_SetBufferProperties@12"); - F_GETPROC(FSOUND_Stream_Net_GetBufferProperties, "_FSOUND_Stream_Net_GetBufferProperties@12"); - F_GETPROC(FSOUND_Stream_Net_SetMetadataCallback, "_FSOUND_Stream_Net_SetMetadataCallback@12"); - F_GETPROC(FSOUND_Stream_Net_GetStatus, "_FSOUND_Stream_Net_GetStatus@20"); - F_GETPROC(FSOUND_CD_Play, "_FSOUND_CD_Play@8"); - F_GETPROC(FSOUND_CD_SetPlayMode, "_FSOUND_CD_SetPlayMode@8"); - F_GETPROC(FSOUND_CD_Stop, "_FSOUND_CD_Stop@4"); - F_GETPROC(FSOUND_CD_SetPaused, "_FSOUND_CD_SetPaused@8"); - F_GETPROC(FSOUND_CD_SetVolume, "_FSOUND_CD_SetVolume@8"); - F_GETPROC(FSOUND_CD_SetTrackTime, "_FSOUND_CD_SetTrackTime@8"); - F_GETPROC(FSOUND_CD_OpenTray, "_FSOUND_CD_OpenTray@8"); - F_GETPROC(FSOUND_CD_GetPaused, "_FSOUND_CD_GetPaused@4"); - F_GETPROC(FSOUND_CD_GetTrack, "_FSOUND_CD_GetTrack@4"); - F_GETPROC(FSOUND_CD_GetNumTracks, "_FSOUND_CD_GetNumTracks@4"); - F_GETPROC(FSOUND_CD_GetVolume, "_FSOUND_CD_GetVolume@4"); - F_GETPROC(FSOUND_CD_GetTrackLength, "_FSOUND_CD_GetTrackLength@8"); - F_GETPROC(FSOUND_CD_GetTrackTime, "_FSOUND_CD_GetTrackTime@4"); - F_GETPROC(FSOUND_DSP_Create, "_FSOUND_DSP_Create@12"); - F_GETPROC(FSOUND_DSP_Free, "_FSOUND_DSP_Free@4"); - F_GETPROC(FSOUND_DSP_SetPriority, "_FSOUND_DSP_SetPriority@8"); - F_GETPROC(FSOUND_DSP_GetPriority, "_FSOUND_DSP_GetPriority@4"); - F_GETPROC(FSOUND_DSP_SetActive, "_FSOUND_DSP_SetActive@8"); - F_GETPROC(FSOUND_DSP_GetActive, "_FSOUND_DSP_GetActive@4"); - F_GETPROC(FSOUND_DSP_GetClearUnit, "_FSOUND_DSP_GetClearUnit@0"); - F_GETPROC(FSOUND_DSP_GetSFXUnit, "_FSOUND_DSP_GetSFXUnit@0"); - F_GETPROC(FSOUND_DSP_GetMusicUnit, "_FSOUND_DSP_GetMusicUnit@0"); - F_GETPROC(FSOUND_DSP_GetClipAndCopyUnit, "_FSOUND_DSP_GetClipAndCopyUnit@0"); - F_GETPROC(FSOUND_DSP_GetFFTUnit, "_FSOUND_DSP_GetFFTUnit@0"); - F_GETPROC(FSOUND_DSP_MixBuffers, "_FSOUND_DSP_MixBuffers@28"); - F_GETPROC(FSOUND_DSP_ClearMixBuffer, "_FSOUND_DSP_ClearMixBuffer@0"); - F_GETPROC(FSOUND_DSP_GetBufferLength, "_FSOUND_DSP_GetBufferLength@0"); - F_GETPROC(FSOUND_DSP_GetBufferLengthTotal, "_FSOUND_DSP_GetBufferLengthTotal@0"); - F_GETPROC(FSOUND_DSP_GetSpectrum, "_FSOUND_DSP_GetSpectrum@0"); - F_GETPROC(FSOUND_Reverb_SetProperties, "_FSOUND_Reverb_SetProperties@4"); - F_GETPROC(FSOUND_Reverb_GetProperties, "_FSOUND_Reverb_GetProperties@4"); - F_GETPROC(FSOUND_Reverb_SetChannelProperties, "_FSOUND_Reverb_SetChannelProperties@8"); - F_GETPROC(FSOUND_Reverb_GetChannelProperties, "_FSOUND_Reverb_GetChannelProperties@8"); - F_GETPROC(FSOUND_Record_SetDriver, "_FSOUND_Record_SetDriver@4"); - F_GETPROC(FSOUND_Record_GetNumDrivers, "_FSOUND_Record_GetNumDrivers@0"); - F_GETPROC(FSOUND_Record_GetDriverName, "_FSOUND_Record_GetDriverName@4"); - F_GETPROC(FSOUND_Record_GetDriver, "_FSOUND_Record_GetDriver@0"); - F_GETPROC(FSOUND_Record_StartSample, "_FSOUND_Record_StartSample@8"); - F_GETPROC(FSOUND_Record_Stop, "_FSOUND_Record_Stop@0"); - F_GETPROC(FSOUND_Record_GetPosition, "_FSOUND_Record_GetPosition@0"); - F_GETPROC(FSOUND_File_SetCallbacks, "_FSOUND_File_SetCallbacks@20"); - F_GETPROC(FMUSIC_LoadSong, "_FMUSIC_LoadSong@4"); - F_GETPROC(FMUSIC_LoadSongEx, "_FMUSIC_LoadSongEx@24"); - F_GETPROC(FMUSIC_GetOpenState, "_FMUSIC_GetOpenState@4"); - F_GETPROC(FMUSIC_FreeSong, "_FMUSIC_FreeSong@4"); - F_GETPROC(FMUSIC_PlaySong, "_FMUSIC_PlaySong@4"); - F_GETPROC(FMUSIC_StopSong, "_FMUSIC_StopSong@4"); - F_GETPROC(FMUSIC_StopAllSongs, "_FMUSIC_StopAllSongs@0"); - F_GETPROC(FMUSIC_SetZxxCallback, "_FMUSIC_SetZxxCallback@8"); - F_GETPROC(FMUSIC_SetRowCallback, "_FMUSIC_SetRowCallback@12"); - F_GETPROC(FMUSIC_SetOrderCallback, "_FMUSIC_SetOrderCallback@12"); - F_GETPROC(FMUSIC_SetInstCallback, "_FMUSIC_SetInstCallback@12"); - F_GETPROC(FMUSIC_SetSample, "_FMUSIC_SetSample@12"); - F_GETPROC(FMUSIC_SetUserData, "_FMUSIC_SetUserData@8"); - F_GETPROC(FMUSIC_OptimizeChannels, "_FMUSIC_OptimizeChannels@12"); - F_GETPROC(FMUSIC_SetReverb, "_FMUSIC_SetReverb@4"); - F_GETPROC(FMUSIC_SetLooping, "_FMUSIC_SetLooping@8"); - F_GETPROC(FMUSIC_SetOrder, "_FMUSIC_SetOrder@8"); - F_GETPROC(FMUSIC_SetPaused, "_FMUSIC_SetPaused@8"); - F_GETPROC(FMUSIC_SetMasterVolume, "_FMUSIC_SetMasterVolume@8"); - F_GETPROC(FMUSIC_SetMasterSpeed, "_FMUSIC_SetMasterSpeed@8"); - F_GETPROC(FMUSIC_SetPanSeperation, "_FMUSIC_SetPanSeperation@8"); - F_GETPROC(FMUSIC_GetName, "_FMUSIC_GetName@4"); - F_GETPROC(FMUSIC_GetType, "_FMUSIC_GetType@4"); - F_GETPROC(FMUSIC_GetNumOrders, "_FMUSIC_GetNumOrders@4"); - F_GETPROC(FMUSIC_GetNumPatterns, "_FMUSIC_GetNumPatterns@4"); - F_GETPROC(FMUSIC_GetNumInstruments, "_FMUSIC_GetNumInstruments@4"); - F_GETPROC(FMUSIC_GetNumSamples, "_FMUSIC_GetNumSamples@4"); - F_GETPROC(FMUSIC_GetNumChannels, "_FMUSIC_GetNumChannels@4"); - F_GETPROC(FMUSIC_GetSample, "_FMUSIC_GetSample@8"); - F_GETPROC(FMUSIC_GetPatternLength, "_FMUSIC_GetPatternLength@8"); - F_GETPROC(FMUSIC_IsFinished, "_FMUSIC_IsFinished@4"); - F_GETPROC(FMUSIC_IsPlaying, "_FMUSIC_IsPlaying@4"); - F_GETPROC(FMUSIC_GetMasterVolume, "_FMUSIC_GetMasterVolume@4"); - F_GETPROC(FMUSIC_GetGlobalVolume, "_FMUSIC_GetGlobalVolume@4"); - F_GETPROC(FMUSIC_GetOrder, "_FMUSIC_GetOrder@4"); - F_GETPROC(FMUSIC_GetPattern, "_FMUSIC_GetPattern@4"); - F_GETPROC(FMUSIC_GetSpeed, "_FMUSIC_GetSpeed@4"); - F_GETPROC(FMUSIC_GetBPM, "_FMUSIC_GetBPM@4"); - F_GETPROC(FMUSIC_GetRow, "_FMUSIC_GetRow@4"); - F_GETPROC(FMUSIC_GetPaused, "_FMUSIC_GetPaused@4"); - F_GETPROC(FMUSIC_GetTime, "_FMUSIC_GetTime@4"); - F_GETPROC(FMUSIC_GetRealChannel, "_FMUSIC_GetRealChannel@8"); - F_GETPROC(FMUSIC_GetUserData, "_FMUSIC_GetUserData@4"); - - return instance; -} - -static void FMOD_FreeInstance(FMOD_INSTANCE *instance) -{ - if (instance) - { - if (instance->module) - { -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) - FreeLibrary((HMODULE)instance->module); -#else - dlclose(instance->module); -#endif - } - free(instance); - } -} - -#endif diff --git a/tools/gdbst03/Makefile b/tools/gdbst03/Makefile deleted file mode 100644 index 5279e5b55..000000000 --- a/tools/gdbst03/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -# -# Makefile for GDB Stub for DJGPP/Mingw 0.3 source distribution -# -# Copyright 2000 by Jonathan Brogdon -# - -include Makefile.cfg - -default: - @$(ECHO) Welcome to GDB Stub for DJGPP & Mingw 0.3 source distribution! - @$(ECHO) To make the GDB stub type: - @$(ECHO) make all - Make library and demo programs - @$(ECHO) make library - Make only library - @$(ECHO) make demo - Make demo program - @$(ECHO) make install - Install library and header files - @$(ECHO) make uninstall - Uninstall library and header files - @$(ECHO) make clean - Remove .o files - @$(ECHO) make distclean - Remove ready binaries and .o files - @$(ECHO) make dep - Make dependences - -# Inform make of phony targets -.PHONY: library demo clean blankdep dep distclean install - -all: dep library demo - @$(ECHO) Library and demo program created - -./lib/libgdbst.a: - @mkdir -p lib - @make -s -C ./src/library all - -library: ./lib/libgdbst.a - @$(ECHO) Library created - -demo: ./lib/libgdbst.a - @mkdir -p demo - @make -s -C ./src/demo all - @$(ECHO) Demo program created - -clean: - @make -s -C ./src/library clean - @make -s -C ./src/demo clean - @$(ECHO) Clean complete - -blankdep: -# Create blank depend.dep files to avoid errors - @$(ECHOBLANK) > ./src/library/depend.dep - @$(ECHOBLANK) > ./src/demo/depend.dep - -# Now carry on as usual -dep: blankdep - @make -s -C ./src/library dep - @make -s -C ./src/demo dep - @$(ECHO) Created dependency files - -# Blank all the dependencies too -distclean: blankdep - @make -s -C ./src/library distclean - @make -s -C ./src/demo distclean - @$(RM) -r ./demo/ - @$(RM) -r ./lib/ - @$(ECHO) Cleaned up files - -install: library -ifdef DJGPP - @cp lib/*.a $(DJDIR)/lib - @ginstall -d $(DJDIR)/include - @cp include/*.h $(DJDIR)/include - @$(ECHO) GDB Stub Library for DJGPP installed -endif - -uninstall: -ifdef DJGPP - @$(RM) $(DJDIR)/lib/libgdb.a - @$(RM) $(DJDIR)/include/i386-stub.h - @$(ECHO) GDB Stub Library for DJGPP uninstalled -ifdef DJGPP - - - - - - - diff --git a/tools/gdbst03/announce b/tools/gdbst03/announce deleted file mode 100644 index ac976b644..000000000 --- a/tools/gdbst03/announce +++ /dev/null @@ -1,27 +0,0 @@ -GDB Stub for DJGPP 0.1 Announcement -=================================== - -GDB Stub for DJGPP Copyright 2000 by Jonathan Brogdon - -Hello. - - I'd like to announce the GDB Stub for DJGPP for DJGPP, the latest version of -a GDB stub for DJGPP targets. The GDB Stub for DJGPP conforms to the GNU GDB stub -interface as specified in the GDB User's Manual. It allows for debugging of a -DJGPP target remotely over a serial link with GDB. - - It comes with an example program for demonstrating remote debugging of -DJGPP targets, and documentation (man and HTML pages). - - The GDB Stub for DJGPP is distributed under the GNU Library General Public License -(LGPL). - - If you have any questions relating to libsocket, please mail me and I'll -be happy to help. - - Thanks, - - Jonathan Brogdon - - - June 29th 2000 diff --git a/tools/gdbst03/include/i386-stub.h b/tools/gdbst03/include/i386-stub.h deleted file mode 100644 index 092a3dfc6..000000000 --- a/tools/gdbst03/include/i386-stub.h +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** - * - * i386-stub.h - * - * Description: Data definitions and constants for low level - * GDB server support. - * - * Terms of use: This software is provided for use under the terms - * and conditions of the GNU General Public License. - * You should have received a copy of the GNU General - * Public License along with this program; if not, write - * to the Free Software Foundation, Inc., 59 Temple Place - * Suite 330, Boston, MA 02111-1307, USA. - * - * Credits: Created by Jonathan Brogdon - * - * History - * Engineer: Date: Notes: - * --------- ----- ------ - * Jonathan Brogdon 20000617 Genesis - * Gordon Schumacher 20020212 Updated for modularity - * - ****************************************************************************/ -#ifndef _GDBSTUB_H_ -#define _GDBSTUB_H_ - - -#ifdef __cplusplus -extern "C" { -#endif -extern int gdb_serial_init(unsigned int port, unsigned int speed); -extern void gdb_target_init(void); -extern void gdb_target_close(void); - -extern void set_debug_traps(void); -extern void restore_traps(void); -extern void breakpoint(void); -#ifdef __cplusplus -} -#endif - - -#endif /* _GDBSTUB_H_ */ diff --git a/tools/gdbst03/install b/tools/gdbst03/install deleted file mode 100644 index b92c39c04..000000000 --- a/tools/gdbst03/install +++ /dev/null @@ -1,20 +0,0 @@ -The makefile contains the information about the target products -available. - -Note: Makefile.cfg contains macros for various tools used during -the build process. Of particular note: some folks use the echo.exe -that is available from the DJGPP (or other) site(s). Others may not -have installed this, and therefore calls to echo during the build -will use the built-in DOS echo command. When attempting to echo a -blank line, the arguments to these two echo commands are different. -Therefore, makefile.cfg contains the macro ECHOBLANK. Please set -this macro according to the needs of your environment. If you change -this in makefile.cfg, it will be picked up by all other project -makefiles. - -Type 'make' to see a list of targets. When the 'install' -target is made, the libgdb.a will be copied into your $(DJDIR)/lib -directory. In addition, the i386-stub.h file will be copied into -your $(DJDIR)/include directory. The uninstall target will remove -these files. - diff --git a/tools/gdbst03/license b/tools/gdbst03/license deleted file mode 100644 index 4356f26ed..000000000 --- a/tools/gdbst03/license +++ /dev/null @@ -1,454 +0,0 @@ - -GNU LIBRARY GENERAL PUBLIC LICENSE -********************************** - - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - [This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - -Preamble -======== - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it in -new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License, which was designed for utility -programs. This license, the GNU Library General Public License, -applies to certain designated libraries. This license is quite -different from the ordinary one; be sure to read it in full, and don't -assume that anything in it is the same as in the ordinary license. - - The reason we have a separate public license for some libraries is -that they blur the distinction we usually make between modifying or -adding to a program and simply using it. Linking a program with a -library, without changing the library, is in some sense simply using -the library, and is analogous to running a utility program or -application program. However, in a textual and legal sense, the linked -executable is a combined work, a derivative of the original library, -and the ordinary General Public License treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended -to permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to -achieve this as regards changes in header files, but we have achieved -it as regards changes in the actual functions of the Library.) The -hope is that this will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which - contains a notice placed by the copyright holder or other - authorized party saying it may be distributed under the terms of - this Library General Public License (also called "this License"). - Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data - prepared so as to be conveniently linked with application programs - (which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work - which has been distributed under these terms. A "work based on the - Library" means either the Library or any derivative work under - copyright law: that is to say, a work containing the Library or a - portion of it, either verbatim or with modifications and/or - translated straightforwardly into another language. (Hereinafter, - translation is included without limitation in the term - "modification".) - - "Source code" for a work means the preferred form of the work for - making modifications to it. For a library, complete source code - means all the source code for all modules it contains, plus any - associated interface definition files, plus the scripts used to - control compilation and installation of the library. - - Activities other than copying, distribution and modification are - not covered by this License; they are outside its scope. The act - of running a program using the Library is not restricted, and - output from such a program is covered only if its contents - constitute a work based on the Library (independent of the use of - the Library in a tool for writing it). Whether that is true - depends on what the Library does and what the program that uses - the Library does. - - 1. You may copy and distribute verbatim copies of the Library's - complete source code as you receive it, in any medium, provided - that you conspicuously and appropriately publish on each copy an - appropriate copyright notice and disclaimer of warranty; keep - intact all the notices that refer to this License and to the - absence of any warranty; and distribute a copy of this License - along with the Library. - - You may charge a fee for the physical act of transferring a copy, - and you may at your option offer warranty protection in exchange - for a fee. - - 2. You may modify your copy or copies of the Library or any portion - of it, thus forming a work based on the Library, and copy and - distribute such modifications or work under the terms of Section 1 - above, provided that you also meet all of these conditions: - - a. The modified work must itself be a software library. - - b. You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c. You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d. If a facility in the modified Library refers to a function or - a table of data to be supplied by an application program that - uses the facility, other than as an argument passed when the - facility is invoked, then you must make a good faith effort - to ensure that, in the event an application does not supply - such function or table, the facility still operates, and - performs whatever part of its purpose remains meaningful. - - (For example, a function in a library to compute square roots - has a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function - must be optional: if the application does not supply it, the - square root function must still compute square roots.) - - These requirements apply to the modified work as a whole. If - identifiable sections of that work are not derived from the - Library, and can be reasonably considered independent and separate - works in themselves, then this License, and its terms, do not - apply to those sections when you distribute them as separate - works. But when you distribute the same sections as part of a - whole which is a work based on the Library, the distribution of - the whole must be on the terms of this License, whose permissions - for other licensees extend to the entire whole, and thus to each - and every part regardless of who wrote it. - - Thus, it is not the intent of this section to claim rights or - contest your rights to work written entirely by you; rather, the - intent is to exercise the right to control the distribution of - derivative or collective works based on the Library. - - In addition, mere aggregation of another work not based on the - Library with the Library (or with a work based on the Library) on - a volume of a storage or distribution medium does not bring the - other work under the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public - License instead of this License to a given copy of the Library. - To do this, you must alter all the notices that refer to this - License, so that they refer to the ordinary GNU General Public - License, version 2, instead of to this License. (If a newer - version than version 2 of the ordinary GNU General Public License - has appeared, then you can specify that version instead if you - wish.) Do not make any other change in these notices. - - Once this change is made in a given copy, it is irreversible for - that copy, so the ordinary GNU General Public License applies to - all subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of - the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or - derivative of it, under Section 2) in object code or executable - form under the terms of Sections 1 and 2 above provided that you - accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software - interchange. - - If distribution of object code is made by offering access to copy - from a designated place, then offering equivalent access to copy - the source code from the same place satisfies the requirement to - distribute the source code, even though third parties are not - compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the - Library, but is designed to work with the Library by being - compiled or linked with it, is called a "work that uses the - Library". Such a work, in isolation, is not a derivative work of - the Library, and therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library - creates an executable that is a derivative of the Library (because - it contains portions of the Library), rather than a "work that - uses the library". The executable is therefore covered by this - License. Section 6 states terms for distribution of such - executables. - - When a "work that uses the Library" uses material from a header - file that is part of the Library, the object code for the work may - be a derivative work of the Library even though the source code is - not. Whether this is true is especially significant if the work - can be linked without the Library, or if the work is itself a - library. The threshold for this to be true is not precisely - defined by law. - - If such an object file uses only numerical parameters, data - structure layouts and accessors, and small macros and small inline - functions (ten lines or less in length), then the use of the object - file is unrestricted, regardless of whether it is legally a - derivative work. (Executables containing this object code plus - portions of the Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may - distribute the object code for the work under the terms of Section - 6. Any executables containing that work also fall under Section 6, - whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or - link a "work that uses the Library" with the Library to produce a - work containing portions of the Library, and distribute that work - under terms of your choice, provided that the terms permit - modification of the work for the customer's own use and reverse - engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the - Library is used in it and that the Library and its use are covered - by this License. You must supply a copy of this License. If the - work during execution displays copyright notices, you must include - the copyright notice for the Library among them, as well as a - reference directing the user to the copy of this License. Also, - you must do one of these things: - - a. Accompany the work with the complete corresponding - machine-readable source code for the Library including - whatever changes were used in the work (which must be - distributed under Sections 1 and 2 above); and, if the work - is an executable linked with the Library, with the complete - machine-readable "work that uses the Library", as object code - and/or source code, so that the user can modify the Library - and then relink to produce a modified executable containing - the modified Library. (It is understood that the user who - changes the contents of definitions files in the Library will - not necessarily be able to recompile the application to use - the modified definitions.) - - b. Accompany the work with a written offer, valid for at least - three years, to give the same user the materials specified in - Subsection 6a, above, for a charge no more than the cost of - performing this distribution. - - c. If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the - above specified materials from the same place. - - d. Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the - Library" must include any data and utility programs needed for - reproducing the executable from it. However, as a special - exception, the source code distributed need not include anything - that is normally distributed (in either source or binary form) - with the major components (compiler, kernel, and so on) of the - operating system on which the executable runs, unless that - component itself accompanies the executable. - - It may happen that this requirement contradicts the license - restrictions of other proprietary libraries that do not normally - accompany the operating system. Such a contradiction means you - cannot use both them and the Library together in an executable - that you distribute. - - 7. You may place library facilities that are a work based on the - Library side-by-side in a single library together with other - library facilities not covered by this License, and distribute - such a combined library, provided that the separate distribution - of the work based on the Library and of the other library - facilities is otherwise permitted, and provided that you do these - two things: - - a. Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b. Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same - work. - - 8. You may not copy, modify, sublicense, link with, or distribute the - Library except as expressly provided under this License. Any - attempt otherwise to copy, modify, sublicense, link with, or - distribute the Library is void, and will automatically terminate - your rights under this License. However, parties who have - received copies, or rights, from you under this License will not - have their licenses terminated so long as such parties remain in - full compliance. - - 9. You are not required to accept this License, since you have not - signed it. However, nothing else grants you permission to modify - or distribute the Library or its derivative works. These actions - are prohibited by law if you do not accept this License. - Therefore, by modifying or distributing the Library (or any work - based on the Library), you indicate your acceptance of this - License to do so, and all its terms and conditions for copying, - distributing or modifying the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the - Library), the recipient automatically receives a license from the - original licensor to copy, distribute, link with or modify the - Library subject to these terms and conditions. You may not impose - any further restrictions on the recipients' exercise of the rights - granted herein. You are not responsible for enforcing compliance - by third parties to this License. - - 11. If, as a consequence of a court judgment or allegation of patent - infringement or for any other reason (not limited to patent - issues), conditions are imposed on you (whether by court order, - agreement or otherwise) that contradict the conditions of this - License, they do not excuse you from the conditions of this - License. If you cannot distribute so as to satisfy simultaneously - your obligations under this License and any other pertinent - obligations, then as a consequence you may not distribute the - Library at all. For example, if a patent license would not permit - royalty-free redistribution of the Library by all those who - receive copies directly or indirectly through you, then the only - way you could satisfy both it and this License would be to refrain - entirely from distribution of the Library. - - If any portion of this section is held invalid or unenforceable - under any particular circumstance, the balance of the section is - intended to apply, and the section as a whole is intended to apply - in other circumstances. - - It is not the purpose of this section to induce you to infringe any - patents or other property right claims or to contest validity of - any such claims; this section has the sole purpose of protecting - the integrity of the free software distribution system which is - implemented by public license practices. Many people have made - generous contributions to the wide range of software distributed - through that system in reliance on consistent application of that - system; it is up to the author/donor to decide if he or she is - willing to distribute software through any other system and a - licensee cannot impose that choice. - - This section is intended to make thoroughly clear what is believed - to be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in - certain countries either by patents or by copyrighted interfaces, - the original copyright holder who places the Library under this - License may add an explicit geographical distribution limitation - excluding those countries, so that distribution is permitted only - in or among countries not thus excluded. In such case, this - License incorporates the limitation as if written in the body of - this License. - - 13. The Free Software Foundation may publish revised and/or new - versions of the Library General Public License from time to time. - Such new versions will be similar in spirit to the present version, - but may differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the - Library specifies a version number of this License which applies - to it and "any later version", you have the option of following - the terms and conditions either of that version or of any later - version published by the Free Software Foundation. If the Library - does not specify a license version number, you may choose any - version ever published by the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free - programs whose distribution conditions are incompatible with these, - write to the author to ask for permission. For software which is - copyrighted by the Free Software Foundation, write to the Free - Software Foundation; we sometimes make exceptions for this. Our - decision will be guided by the two goals of preserving the free - status of all derivatives of our free software and of promoting - the sharing and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO - WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE - LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT - HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT - WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT - NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE - QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE - LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY - SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN - WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY - MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE - LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, - INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR - INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF - DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU - OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY - OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN - ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - diff --git a/tools/gdbst03/makefile.cfg b/tools/gdbst03/makefile.cfg deleted file mode 100644 index 4265258a7..000000000 --- a/tools/gdbst03/makefile.cfg +++ /dev/null @@ -1,67 +0,0 @@ -# -# Makefile.cfg for GDB stub for DJGPP and Mingw -# -# libgdbst Copyright 2000 by Jonathan Brogodn -# - -# -# GNU compiler & tools' flags -# -CC = gcc -CFLAGS = -Wall -Werror -march=i486 -O2 -g - -# Archiver -AR = ar -ARFLAGS = -r - -# Stripper -STRIP = strip - -# Assembler -AS = as -ASFLAGS = - -# Linker -LD = ld -LDFLAGS = - -# Remove -RM = rm -f - -# Echo -ECHO = echo - -# Echo Blank -#ECHOBLANK = echo "" -ECHOBLANK = echo. - -# -# check for OS... badly -# - -ifndef DJDIR -ifndef DJGPP - WINDOWS=1 -endif -endif - -ifndef windir -ifndef WINDOWS - DJGPP=1 -endif -endif - -# -# Rules -# -.SUFFIXES: .c .asm .o - -.asm.o: - @$(CC) $(CFLAGS) -I$(INC_PATH) -c -o ./$@ ./$< - -.s.o: - @$(AS) $(ASFLAGS) ./$< - -.c.o : - @$(CC) $(CFLAGS) -c -I$(INC_PATH) -c -o ./$@ ./$< - diff --git a/tools/gdbst03/readme b/tools/gdbst03/readme deleted file mode 100644 index 316e61cae..000000000 --- a/tools/gdbst03/readme +++ /dev/null @@ -1,171 +0,0 @@ -GDB Stub for DJGPP 0.2 Readme File -================================== - -Copyright ---------- -GDB Stub for DJGPP is distributed under the terms of the GNU Library -General Public License (GNU LGPL) - please see the document LICENSE, -which should be found in the same directory as this file. - -Copyright (c) 2000 by Jonathan Brogdon, 2002 by Gordon Schumacher - -What It Does ------------- -The GDB stub is used to debug a DJGPP target remotely over a one of -the PC COM ports. GDB, running on a host machine, communicates with -the target using the GDB serial protocol over the serial link. For -more information on the GDB stub, see "Debugging with GDB, The GNU -Source-Level Debugger", by Richard M. Stallman and Roland H. Pesch -(http://sources.redhat.com/gdb/download/onlinedocs/gdb.html) - -How It Works ------------- - -Exceptions: - -The GDB stub needs to handle all processor exceptions. Since these -exceptions already handled by DJGPP, we cannot handle them directly. -DJGPP maps all processor exceptions to signals. Therefore, we can -install the GDB stub handler as the signal handler for those signals -that represent processor exceptions. The following table shows the -processor exception to signal mapping: - - Exception/Interrupt: Exception #: Signal: - ------------------- ----------- ------ - Divide Error 0 SIGFPE - Debug Exception 1 SIGTRAP - NMI Interrupt 2 No signal defined - Breakpoint 3 SIGTRAP - INTO-detected overflow 4 SIGFPE - BOUND Range Exceeded 5 SIGSEGV - Invalid Opcode 6 No signal defined - Coprocessor not available 7 SIGNOFP - Double Fault 8 SIGSEGV - Coprocessor Seg overrun 9 SIGSEGV - Invalid Task State Seg 10 No signal defined - Segment not present 11 SIGSEGV - Stack Fault 12 SIGSEGV - General Protection Fault 13 SIGSEGV - Page Fault 14 SIGSEGV - Intel Reserved 15 No signal defined - Coprocessor Error 16 SIGFPE - -The GDB stub handler services requests from the GDB host. These -requests are seen by the GDB stub handler as command messages from -the GDB host. These commands and command formats are defined in -"Debugging with GDB, The GNU Source-Level Debugger", by Richard M. -Stallman and Roland H. Pesch (http://sources.redhat.com/gdb/ -download/onlinedocs/gdb.html -- one of many sources). - -Serial Interface: - -Interface functions for sending and receiving characters from the -serial interface must be provided by the engineer porting the GDB -stub. The following funtions must be provided to support the -implementation. - - int getDebugChar(void); - void putDebugChar(int c); - -There are a variety of serial libraries for DJGPP. The user may -already be using one of these libraries in their application, and -installing more than one serial library often causes conflicts. -To this end, a modular function layer was written that allows any -serial library to be used with the GDB stub. Layers have been -written to support SVAsync, DZComm, and the _bios_serialcom() -function. At the time of this writing, DZComm appears to work the -best for serial debugging. - -Hard Coded Breakpoint: - -A breakpoint() function is provided to manually invoke the stub. -This function, inserts a breakpoint instruction directly in the code -to invoke the GDB stub handler. - -How You Use It --------------- -First, you need to select a serial library. In the i386-supp.c file, -there are lines of the form - - // #include "some_layer.h" - -Uncomment the line for the serial library you intend to use - or add -a new include line for a file written for some other library. -In the main() function of your target program, you should initilize -the GDB serial handlers and the GDB stub. The following functions -are provided in the GDB stub library for this purpose. - - gdb_serial_init(unsigned int port, unsigned int speed); - gdb_target_init(void); - -Where, port is the COM port number, and speed is the baud rate for -the serial link. - -After initialing the GDB serial interface and target, you should -invoke the breakpoint() function somewhere. You may choose to do -this immediately after initialization, or at a specific location in -your code where you wish to set a breakpoint. By putting the -breakpoint() function in the beginning of main(), you can use the -GDB host to set a breakpoint at any place in your code. - -Make sure that you use the '-g' option when compiling your files with -gcc. - -After the target executable is running, start up gdb on the host, -passing the target executable as an argument. - - Example: gdb demo.exe - -Now, tell gdb which serial interface to use for communicating to -the target. - - Example: (gdb) target remote COM1 - -This example uses COM1 on the host to communicate with the target. -GDB is now 'listening' on COM for a valid GDB serial packet. - -Once your GDB host finds your target, you may need to tell GDB where -to find any source files which were used to generate your program. -Use the directory command to do this. - - Example: (gdb) directory ../src/demo - -That's it. You should now be able to single step through code, set -breakpoints, set variables, examine variables, any anthing else that -you would normally use GDB to accomplish. - -What You Build --------------- -Read the INSTALL file for more information on installing the GDB stub -library. After installing the library, your code should include -i386-stub.h for function prototypes. In addition, your code should -link against the libgdb.a library. The source for a demonstration -program has been included with this distributias an example. -As an alternative, you can simply include the i386-stub and i386-supp -files and the layer header for the serial library you plan to use into -your project and link them in directly. - -For More Info -------------- -See "Debugging with GDB, The GNU Source-Level Debugger", by Richard -M. Stallman and Roland H. Pesch (http://sources.redhat.com/gdb/ -download/onlinedocs/gdb.html -- one of many sources). - -TODO ----- -Port for network operation. - -Contact Info ------------- -My contact info is below. If you have any comments, suggestions, bug -reports or problems, please mail me, and I'll see what I can do. - - Regards, - Jonathan Brogdon - - 6th June 2000 - - Modular update: - Gordon Schumacher - - 12th February 2002 \ No newline at end of file diff --git a/tools/gdbst03/src/demo/crc_16.c b/tools/gdbst03/src/demo/crc_16.c deleted file mode 100644 index ad1f53cd1..000000000 --- a/tools/gdbst03/src/demo/crc_16.c +++ /dev/null @@ -1,46 +0,0 @@ -#define POLY 0x8408 -/* -// 16 12 5 -// this is the CCITT CRC 16 polynomial X + X + X + 1. -// This works out to be 0x1021, but the way the algorithm works -// lets us use 0x8408 (the reverse of the bit pattern). The high -// bit is always assumed to be set, thus we only use 16 bits to -// represent the 17 bit value. -*/ - -#include "crc.h" - -WORD crc16(char *data_p, WORD length) -{ - unsigned char i; - unsigned int data; - unsigned int crc = 0xffff; - - if (length == 0) - return (~crc); - - do - { - for (i=0, data=(unsigned int)0xff & *data_p++; - i < 8; - i++, data >>= 1) - { - if ((crc & 0x0001) ^ (data & 0x0001)) - crc = (crc >> 1) ^ POLY; - else crc >>= 1; - } - } while (--length); - - crc = ~crc; - data = crc; - crc = (crc << 8) | ((data >> 8) & 0xff); - - return (crc); -} - - - - - - - diff --git a/tools/gdbst03/src/demo/makefile b/tools/gdbst03/src/demo/makefile deleted file mode 100644 index ab48954b2..000000000 --- a/tools/gdbst03/src/demo/makefile +++ /dev/null @@ -1,42 +0,0 @@ -# -# Makefile for GDB Stub demo -# Written by Jonathan Brogodn -# -# GDB Stub for DJGPP Copyright 2000 by Jonathan Brogdon -# - -include ../../Makefile.cfg - -CFLAGS += -g -CFLAGS += -I../../include -I../include -I. -CFLAGS += -DDEBUG_COM_PORT=1 -CFLAGS += -DDEBUG_COM_PORT_SPEED=9600 -CFLAGS += -DREMOTE_DEBUGGING - -# Objects to build -OBJS = serdbg.o crc_16.o - -all: demo - -demo: $(OBJS) -ifdef DJGPP - @$(LD) $(LDFLAGS) -Map ./$@.map -o../../demo/$@.exe $(DJDIR)/lib/crt0.o $(OBJS) -L$(DJDIR)/lib -L../../lib -lgdbst -ldzcom -lc -lgcc -endif -ifdef WINDOWS - @$(LD) $(LDFLAGS) -Map ./$@.map -o../../demo/$@.exe $(DJDIR)/lib/crt0.o $(OBJS) -L../../lib -lgdbst -lwsock32 -lc -lgcc -endif - -clean: - @$(RM) $(OBJS) - @$(RM) *.map - -distclean: clean - @$(RM) $(OBJS) - @$(RM) depend.dep - @$(RM) ../../demo/*.exe - -dep: - @$(CC) $(CFLAGS) -M *.c > depend.dep - -$(OBJS): -include depend.dep diff --git a/tools/gdbst03/src/demo/serdbg.c b/tools/gdbst03/src/demo/serdbg.c deleted file mode 100644 index 01778789c..000000000 --- a/tools/gdbst03/src/demo/serdbg.c +++ /dev/null @@ -1,102 +0,0 @@ -/*********************************************************************** - * serdbg.c - * - * Description: Pretty simple demonstration program. It accomplishes - * the following. - * - * 1. Allocate a block of memory Feel free to change - * size (memBlockSize) with debugger. - * - * 2. Writes a word pattern to the entire block. Feel - * free to change the pattern (memPatternWord) with - * debugger. - * - * 3. Computes the CRC-16 on the block. Feel free to - * check the size with the debuger. - * - * 4. Free the memory block allocated in step 1. Repeat - * step 1. If you wish to exit, set doneFlag to 0 with - * the debugger. - * - * Credits: Created by Jonathan Brogdon - * - * Terms of use: Use as you will. - * - * Global Data: None. - * Global Functions: main - * - * History - * Engineer: Date: Notes: - * --------- ----- ------ - * Jonathan Brogdon 070500 Genesis - * - ***********************************************************************/ -#include -#include -#include -#include - -#define MEM_BLOCK_SIZE 100 /* Words */ -#define MEM_PATTERN_WORD 0x55AA - -void write_mem_pattern(unsigned short*, unsigned short, unsigned short); - -/************************************************************************ - * - * main() - * - ************************************************************************/ -int main(int argc, char *argv[]) -{ - volatile int doneFlag = 0; - unsigned short crcValue = 0; - unsigned short * memBlockPtr = NULL; - short memBlockSize = MEM_BLOCK_SIZE; - short memPatternWord = MEM_PATTERN_WORD; - -#ifdef REMOTE_DEBUGGING - /* Only setup if demonstrating remote debugging */ - gdb_serial_init(DEBUG_COM_PORT,DEBUG_COM_PORT_SPEED); - gdb_target_init(); - breakpoint(); -#endif - - while(doneFlag != 1) - { - memBlockSize = MEM_BLOCK_SIZE; - memPatternWord = MEM_PATTERN_WORD; - memBlockPtr = (unsigned short *) malloc((int)memBlockSize); - - write_mem_pattern(memBlockPtr, memBlockSize, memPatternWord); - - crcValue = crc16((char *)memBlockPtr,memBlockSize); - - free(memBlockPtr); - } - - exit(0); -} - -/************************************************************************ - * - * write_mem_pattern() - * - * Description: Writes a word pattern to a block of RAM. - * - ************************************************************************/ -void write_mem_pattern(unsigned short *block, unsigned short blockSize, unsigned short patternWord) -{ - int index = 0; - - for(index = 0; index < blockSize; index++) - { - block[index] = patternWord; - } -} - - - - - - - diff --git a/tools/gdbst03/src/include/crc.h b/tools/gdbst03/src/include/crc.h deleted file mode 100644 index 937d0b794..000000000 --- a/tools/gdbst03/src/include/crc.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * CRC.H - header file for CRC functions - */ - -#ifndef _CRC_H_ -#define _CRC_H_ - -#include /* For size_t */ - -typedef unsigned char BYTE; -typedef unsigned short WORD; -typedef unsigned long DWORD; - -/* -** File: CRC-16.C -*/ - -WORD crc16(char *data_p, WORD length); - -#endif /* _CRC_H_ */ diff --git a/tools/gdbst03/src/include/i386-supp.h b/tools/gdbst03/src/include/i386-supp.h deleted file mode 100644 index e1923377c..000000000 --- a/tools/gdbst03/src/include/i386-supp.h +++ /dev/null @@ -1,30 +0,0 @@ -/**************************************************************************** - * - * i386-supp.h - * - * Description: Data definitions and constants for low level - * GDB stub support. - * - * Terms of use: This software is provided for use under the terms - * and conditions of the GNU General Public License. - * You should have received a copy of the GNU General - * Public License along with this program; if not, write - * to the Free Software Foundation, Inc., 59 Temple Place - * Suite 330, Boston, MA 02111-1307, USA. - * - * Credits: Created by Jonathan Brogdon - * - * History - * Engineer: Date: Notes: - * --------- ----- ------ - * Jonathan Brogdon 20000629 Genesis - * Gordon Schumacher 20020212 Updated for modularity - * - ****************************************************************************/ -#ifndef _GDBSUPP_H_ -#define _GDBSUPP_H_ - -extern int putDebugChar(char c); -extern int getDebugChar(void); - -#endif /* _GDBSUPP_H_ */ diff --git a/tools/gdbst03/src/library/bios_layer.h b/tools/gdbst03/src/library/bios_layer.h deleted file mode 100644 index 946f40997..000000000 --- a/tools/gdbst03/src/library/bios_layer.h +++ /dev/null @@ -1,137 +0,0 @@ -//======================================================================================================= -// bios_layer.h - Serial command layer for standard BIOS calls -// It's here if you want it, but I wouldn't suggest it... -//======================================================================================================= - -//======================================================================================================= -//======================================================================================================= - -#ifndef _BIOS_LAYER_H -#define _BIOS_LAYER_H - - -//=============================================================================== -// Include files -//=============================================================================== - -#include - -//=============================================================================== -// Static variable definitions -//=============================================================================== - -unsigned comport; - -//=============================================================================== -// Inline function definitions -//=============================================================================== - -#define BIOS_SER_TIMEOUT 1000000 - -// Initialize the serial library -// Should return 0 if no error occurred -__inline int GDBStub_SerInit(int port) -{ - comport = (unsigned) port; - return 0; -} - - -// Set the serial port speed (and other configurables) -// Should return 0 if the speed is set properly -__inline int GDBStub_SerSpeed(int speed) -{ - unsigned bps; - - switch (speed) - { - case 110: - bps = _COM_110; - break; - - case 150: - bps = _COM_150; - break; - - case 300: - bps = _COM_300; - break; - - case 600: - bps = _COM_600; - break; - - case 1200: - bps = _COM_1200; - break; - - case 2400: - bps = _COM_2400; - break; - - case 4800: - bps = _COM_4800; - break; - - case 9600: - default: - bps = _COM_9600; - break; - } - - _bios_serialcom(_COM_INIT, comport, - bps | _COM_NOPARITY | _COM_CHR8 | _COM_STOP1); - return 0; -} - - -// Check to see if there's room in the buffer to send data -// Should return 0 if it is okay to send -__inline int GDBStub_SerSendOk(void) -{ - return 0; -} - - -// Send a character to the serial port -// Should return 0 if the send succeeds -__inline int GDBStub_SerSend(int c) -{ - register int ret; - register int timeout = 0; - - do - { - ret = _bios_serialcom(_COM_SEND, comport, (unsigned) c); - } while((ret != 0) && (timeout++ < BIOS_SER_TIMEOUT)); - return (timeout >= BIOS_SER_TIMEOUT); -} - - -// Check to see if there are characters waiting in the buffer -// Should return 0 if there's data waiting -__inline int GDBStub_SerRecvOk(void) -{ - return 0; -} - - -// Read a character from the serial port -// Should return the character read -__inline int GDBStub_SerRecv(void) -{ - register int data; - register int timeout = 0; - - do - { - data = _bios_serialcom(_COM_RECEIVE, comport, 0) & 0xff; - } while((data > 0xff) && (timeout++ < BIOS_SER_TIMEOUT)); - - return data; -} - - - - -#endif diff --git a/tools/gdbst03/src/library/dzc_layer.h b/tools/gdbst03/src/library/dzc_layer.h deleted file mode 100644 index cc083077f..000000000 --- a/tools/gdbst03/src/library/dzc_layer.h +++ /dev/null @@ -1,169 +0,0 @@ -//======================================================================================================= -// dzc_layer.h - Serial command layer for DZcomm -// -//======================================================================================================= - -//======================================================================================================= -//======================================================================================================= - -#ifndef _DZC_LAYER_H -#define _DZC_LAYER_H - - -//=============================================================================== -// Include files -//=============================================================================== - -#include - -//=============================================================================== -// Static variable definitions -//=============================================================================== - -comm_port *comport; - -//=============================================================================== -// Inline function definitions -//=============================================================================== - -// Initialize the serial library -// Should return 0 if no error occurred -__inline int GDBStub_SerInit(int port) -{ - int ret; - comm com; - - ret = dzcomm_init(); - if (ret != 0) - { - switch (port) - { - case 4: - com = _com4; - break; - - case 3: - com = _com3; - break; - - case 2: - com = _com2; - break; - - case 1: - default: - com = _com1; - break; - } - comport = comm_port_init(com); - } - return (ret == 0); -} - -// Set the serial port speed (and other configurables) -// Should return 0 if the speed is set properly -__inline int GDBStub_SerSpeed(int speed) -{ - baud_bits bps; - - switch (speed) - { - case 110: - bps = _110; - break; - - case 150: - bps = _150; - break; - - case 300: - bps = _300; - break; - - case 600: - bps = _600; - break; - - case 1200: - bps = _1200; - break; - - case 2400: - bps = _2400; - break; - - case 4800: - bps = _4800; - break; - - case 9600: - bps = _9600; - break; - - case 19200: - bps = _19200; - break; - - case 38400: - bps = _38400; - break; - - case 57600: - bps = _57600; - break; - - case 115200: - default: - bps = _115200; - break; - } - - comm_port_set_baud_rate(comport, bps); - comm_port_set_parity(comport, NO_PARITY); - comm_port_set_data_bits(comport, BITS_8); - comm_port_set_stop_bits(comport, STOP_1); - comm_port_set_flow_control(comport, RTS_CTS); - comm_port_install_handler(comport); - - return 0; -} - -// Check to see if there's room in the buffer to send data -// Should return 0 if it is okay to send -__inline int GDBStub_SerSendOk(void) -{ - return (comm_port_out_full(comport) == 0); -} - -// Send a character to the serial port -// Should return 0 if the send succeeds -__inline int GDBStub_SerSend(int c) -{ - return comm_port_out(comport, (unsigned char) c); -} - -// Check to see if there are characters waiting in the buffer -// Should return 0 if there's data waiting -__inline int GDBStub_SerRecvOk(void) -{ - return (comm_port_in_empty(comport) == 0); -} - -// Read a character from the serial port -// Should return the character read -__inline int GDBStub_SerRecv(void) -{ - return comm_port_test(comport); -} - - - - -#endif - -/*================================================================== - - $Log: $ - - -===============================================================*/ diff --git a/tools/gdbst03/src/library/i386-stub.c b/tools/gdbst03/src/library/i386-stub.c deleted file mode 100644 index 1ab2ceeeb..000000000 --- a/tools/gdbst03/src/library/i386-stub.c +++ /dev/null @@ -1,1555 +0,0 @@ -/**************************************************************************** - - THIS SOFTWARE IS NOT COPYRIGHTED - - HP offers the following for use in the public domain. HP makes no - warranty with regard to the software or it's performance and the - user accepts the software "AS IS" with all faults. - - HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD - TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - -****************************************************************************/ - -/**************************************************************************** - * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $ - * - * Module name: remcom.c $ - * Revision: 1.34 $ - * Date: 91/03/09 12:29:49 $ - * Contributor: Lake Stevens Instrument Division$ - * - * Description: low level support for gdb debugger. $ - * - * Considerations: only works on target hardware $ - * - * Written by: Glenn Engel $ - * ModuleState: Experimental $ - * - * NOTES: See Below $ - * - * Modified for 386 by Jim Kingdon, Cygnus Support. - * - * To enable debugger support, two things need to happen. One, a - * call to set_debug_traps() is necessary in order to allow any breakpoints - * or error conditions to be properly intercepted and reported to gdb. - * Two, a breakpoint needs to be generated to begin communication. This - * is most easily accomplished by a call to breakpoint(). Breakpoint() - * simulates a breakpoint by executing a trap #1. - * - * The external function exceptionHandler() is - * used to attach a specific handler to a specific 386 vector number. - * It should use the same privilege level it runs at. It should - * install it as an interrupt gate so that interrupts are masked - * while the handler runs. - * - * Because gdb will sometimes write to the stack area to execute function - * calls, this program cannot rely on using the supervisor stack so it - * uses it's own stack area reserved in the int array remcomStack. - * - ************* - * - * The following gdb commands are supported: - * - * command function Return value - * - * g return the value of the CPU registers hex data or ENN - * G set the value of the CPU registers OK or ENN - * - * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN - * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN - * - * c Resume at current address SNN ( signal NN) - * cAA..AA Continue at address AA..AA SNN - * - * s Step one instruction SNN - * sAA..AA Step one instruction from AA..AA SNN - * - * k kill - * - * ? What was the last sigval ? SNN (signal NN) - * - * All commands and responses are sent with a packet which includes a - * checksum. A packet consists of - * - * $#. - * - * where - * :: - * :: < two hex digits computed as modulo 256 sum of > - * - * When a packet is received, it is first acknowledged with either '+' or '-'. - * '+' indicates a successful transfer. '-' indicates a failed transfer. - * - * Example: - * - * Host: Reply: - * $m0,10#2a +$00010203040506070809101112131415#42 - * - ****************************************************************************/ - -#include -#include -#ifdef DJGPP -#include -#include -#include -#include -#endif //#ifdef DJGPP - - -/* - * - * external low-level support routines - */ - -extern void putDebugChar(); /* write a single character */ -extern int getDebugChar(); /* read and return a single char */ -#ifndef DJGPP -extern void exceptionHandler(); /* assign an exception handler */ -#endif - -/* - * BUFMAX defines the maximum number of characters in inbound/outbound buffers - * at least NUMREGBYTES*2 are needed for register packets - */ -#define BUFMAX 400 - -/* - * boolean flag. != 0 means we've been initialized - */ -static char gdb_initialized; - -/* - * debug > 0 prints ill-formed commands in valid packets & checksum errors - */ -int remote_debug; - -/* - * Hexadecimal character string. - */ -#ifndef DJGPP -static const char hexchars[]="0123456789abcdef"; -#else -static char hexchars[]="0123456789abcdef"; -#endif - -/* - * Number of registers. -*/ -#define NUMREGS 16 - -/* - * Number of bytes of registers. -*/ -#define NUMREGBYTES (NUMREGS * 4) - -/* - * i386 Registers - */ -enum regnames {EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI, - PC /* also known as eip */, - PS /* also known as eflags */, - CS, SS, DS, ES, FS, GS -}; - -/* - * Register storage buffer. - */ -static int registers[NUMREGS]; - -/* - * Address of a routine to RTE to if we get a memory fault. -*/ -#ifndef DJGPP -static void (*volatile mem_fault_routine) () = NULL; -#else -static void (*mem_fault_routine)() = NULL; -#endif - -/* I/O buffers */ -static char remcomInBuffer[BUFMAX]; -static char remcomOutBuffer[BUFMAX]; - -#if !(defined(DJGPP) || defined(_WIN32)) //MF -#define STACKSIZE 10000 -int remcomStack[STACKSIZE/sizeof(int)]; -static int* stackPtr = &remcomStack[STACKSIZE/sizeof(int) - 1]; -#endif - -#ifdef DJGPP -static void lock_handler_data(void); -#endif //#ifdef DJGPP - -void _returnFromException (); - -/*************************** ASSEMBLY CODE MACROS *************************/ -/* */ - -extern void -return_to_prog (); - -/* Restore the program's registers (including the stack pointer, which - means we get the right stack and don't have to worry about popping our - return address and any stack frames and so on) and return. */ -asm(".text"); -asm(".globl _return_to_prog"); -asm("_return_to_prog:"); -asm(" movw _registers+44, %ss"); -asm(" movl _registers+16, %esp"); -asm(" movl _registers+4, %ecx"); -asm(" movl _registers+8, %edx"); -asm(" movl _registers+12, %ebx"); -asm(" movl _registers+20, %ebp"); -asm(" movl _registers+24, %esi"); -asm(" movl _registers+28, %edi"); -asm(" movw _registers+48, %ds"); -asm(" movw _registers+52, %es"); -asm(" movw _registers+56, %fs"); -asm(" movw _registers+60, %gs"); -asm(" movl _registers+36, %eax"); -asm(" pushl %eax"); /* saved eflags */ -asm(" movl _registers+40, %eax"); -asm(" pushl %eax"); /* saved cs */ -asm(" movl _registers+32, %eax"); -asm(" pushl %eax"); /* saved eip */ -asm(" movl _registers, %eax"); -/* use iret to restore pc and flags together so - that trace flag works right. */ -asm(" iret"); - -/* - * BREAKPOINT macro - */ -#ifdef _MSC_VER //MF -#define BREAKPOINT() __asm int 3; -#else -#define BREAKPOINT() asm(" int $3"); -#endif - -/* - * Store the error code here just in case the user cares. -*/ -int gdb_i386errcode; - -/* - * Store the vector number here (since GDB only gets the signal - * number through the usual means, and that's not very specific). - */ -#ifndef _WIN32 //MF -int gdb_i386vector = -1; -#endif // !_WIN32 - -#if defined(DJGPP) || defined(_WIN32) -static void handle_exception(int); -#endif - -#ifdef DJGPP - -/*********************************************************************** - * save_regs - * - * Description: Retreives the i386 registers as they were when the - * exception occurred. Registers are stored in the - * local static buffer. - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void save_regs(void) -{ - registers[EAX] = (int) __djgpp_exception_state->__eax; - registers[ECX] = (int) __djgpp_exception_state->__ecx; - registers[EDX] = (int) __djgpp_exception_state->__edx; - registers[EBX] = (int) __djgpp_exception_state->__ebx; - registers[ESP] = (int) __djgpp_exception_state->__esp; - registers[EBP] = (int) __djgpp_exception_state->__ebp; - registers[ESI] = (int) __djgpp_exception_state->__esi; - registers[EDI] = (int) __djgpp_exception_state->__edi; - registers[PC] = (int) __djgpp_exception_state->__eip; - registers[PS] = (int) __djgpp_exception_state->__eflags; - registers[CS] = (int) __djgpp_exception_state->__cs; - registers[SS] = (int) __djgpp_exception_state->__ss; - registers[DS] = (int) __djgpp_exception_state->__ds; - registers[ES] = (int) __djgpp_exception_state->__es; - registers[FS] = (int) __djgpp_exception_state->__fs; - registers[GS] = (int) __djgpp_exception_state->__gs; -} -static void end_save_regs(void){} - -/*********************************************************************** - * set_regs - * - * Description: Restores i386 registers to the DJGPP register buffer. - * DJGPP exception handler will restore registers from - * it's buffer on exit from the handler. - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void set_regs(void) -{ - __djgpp_exception_state->__eax = (unsigned long) registers[EAX]; - __djgpp_exception_state->__ecx = (unsigned long) registers[ECX]; - __djgpp_exception_state->__edx = (unsigned long) registers[EDX]; - __djgpp_exception_state->__ebx = (unsigned long) registers[EBX]; - __djgpp_exception_state->__esp = (unsigned long) registers[ESP]; - __djgpp_exception_state->__ebp = (unsigned long) registers[EBP]; - __djgpp_exception_state->__esi = (unsigned long) registers[ESI]; - __djgpp_exception_state->__edi = (unsigned long) registers[EDI]; - __djgpp_exception_state->__eip = (unsigned long) registers[PC]; - __djgpp_exception_state->__eflags = (unsigned long) registers[PS]; - __djgpp_exception_state->__cs = (unsigned long) registers[CS]; - __djgpp_exception_state->__ss = (unsigned long) registers[SS]; - __djgpp_exception_state->__ds = (unsigned long) registers[DS]; - __djgpp_exception_state->__es = (unsigned long) registers[ES]; - __djgpp_exception_state->__fs = (unsigned long) registers[FS]; - __djgpp_exception_state->__gs = (unsigned long) registers[GS]; -} -static void end_set_regs(void){} - -/*********************************************************************** - * sigsegv_handler - * - * Description: Handles SIGSEGV signal - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void sigsegv_handler(int except_num){ - - /* Save general purpose registers */ - save_regs(); - - /* Dispatch memory fault handling routine if one is registered. */ - if(mem_fault_routine != 0) - { - (*mem_fault_routine)(); - mem_fault_routine = NULL; - } - else - { - /* Save error code */ - gdb_i386errcode = __djgpp_exception_state->__sigmask & 0xffff; - - /* Call the general exception handler */ - handle_exception(except_num); - } - /* Write back registers */ - set_regs(); - - /* Return from handler */ - longjmp(__djgpp_exception_state,__djgpp_exception_state->__eax); -} -static void end_sigsegv_handler(void){} - -/*********************************************************************** - * sigfpe_handler - * - * Description: Handles SIGFPE signal - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void sigfpe_handler(int except_num){ - - /* Save general purpose registers */ - save_regs(); - - /* Call the general purpose exception handler */ - handle_exception(except_num); - - /* Write back registers */ - set_regs(); - - /* Return from handler */ - longjmp(__djgpp_exception_state,__djgpp_exception_state->__eax); -} -static void end_sigfpe_handler(void){} - -/*********************************************************************** - * sigtrap_handler - * - * Description: Handles SIGTRAP signal - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void sigtrap_handler(int except_num) { - - /* Save general purpose registers */ - save_regs(); - - /* Call the general purpose exception handler */ - handle_exception(except_num); - - /* Write back registers */ - set_regs(); - - /* Return from handler */ - longjmp(__djgpp_exception_state,__djgpp_exception_state->__eax); -} -static void end_sigtrap_handler(int except_num){} - -/*********************************************************************** - * sigill_handler - * - * Description: Handles SIGILL signal - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void sigill_handler(int except_num) { - - /* Save general purpose registers */ - save_regs(); - - /* Call the general purpose exception handler */ - handle_exception(except_num); - - /* Write back registers */ - set_regs(); - - /* Return from handler */ - longjmp(__djgpp_exception_state,__djgpp_exception_state->__eax); -} -static void end_sigill_handler(int except_num){} -#endif - -#ifdef _WIN32 //MF - -void win32_exception_handler(EXCEPTION_POINTERS* exc_info) -{ - PCONTEXT ctx = exc_info->ContextRecord; - - registers[EAX] = ctx->Eax; - registers[ECX] = ctx->Ecx; - registers[EDX] = ctx->Edx; - registers[EBX] = ctx->Ebx; - registers[ESP] = ctx->Esp; - registers[EBP] = ctx->Ebp; - registers[ESI] = ctx->Esi; - registers[EDI] = ctx->Edi; - registers[PC] = ctx->Eip; - registers[PS] = ctx->EFlags; - registers[CS] = ctx->SegCs; - registers[SS] = ctx->SegSs; - registers[DS] = ctx->SegDs; - registers[ES] = ctx->SegEs; - registers[FS] = ctx->SegFs; - registers[GS] = ctx->SegGs; - - handle_exception((int)(exc_info->ExceptionRecord->ExceptionCode & 0xFFFF)); - - ctx->Eax = registers[EAX]; - ctx->Ecx = registers[ECX]; - ctx->Edx = registers[EDX]; - ctx->Ebx = registers[EBX]; - ctx->Esp = registers[ESP]; - ctx->Ebp = registers[EBP]; - ctx->Esi = registers[ESI]; - ctx->Edi = registers[EDI]; - ctx->Eip = registers[PC]; - ctx->EFlags = registers[PS]; - ctx->SegCs = registers[CS]; - ctx->SegSs = registers[SS]; - ctx->SegDs = registers[DS]; - ctx->SegEs = registers[ES]; - ctx->SegFs = registers[FS]; - ctx->SegGs = registers[GS]; -} - -#endif // _WIN32 - -/*********************************************************************** - * hex - * - * Description: Convert ASCII character values, representing hex - * digits, to the integer value. - * - * Inputs: - * ch - data character - * Outputs: None. - * Returns: integer value represented by the input character. - * - ***********************************************************************/ -static int hex (char ch) -{ - if ((ch >= 'a') && (ch <= 'f')) - return (ch - 'a' + 10); - if ((ch >= '0') && (ch <= '9')) - return (ch - '0'); - if ((ch >= 'A') && (ch <= 'F')) - return (ch - 'A' + 10); - return (-1); -} -#ifdef DJGPP -static void end_hex(void) {} -#endif - -/*********************************************************************** - * getpacket - * - * Description: Retrieve GDB data packet. - * Scan for the sequence $# - * Inputs: None. - * Outputs: None. - * Returns: Beginning of packet buffer. - * - ***********************************************************************/ -static unsigned char *getpacket (void) -{ - unsigned char *buffer = &remcomInBuffer[0]; - unsigned char checksum; - unsigned char xmitcsum; - int count; - char ch; - - while (1) - { - /* wait around for the start character, ignore all other characters */ - while ((ch = getDebugChar ()) != '$') - ; - - retry: - checksum = 0; - xmitcsum = -1; - count = 0; - - /* now, read until a # or end of buffer is found */ - while (count < BUFMAX) - { - ch = getDebugChar (); - if (ch == '$') - goto retry; - if (ch == '#') - break; - checksum = checksum + ch; - buffer[count] = ch; - count = count + 1; - } - buffer[count] = 0; - - if (ch == '#') - { - ch = getDebugChar (); - xmitcsum = hex (ch) << 4; - ch = getDebugChar (); - xmitcsum += hex (ch); - - if (checksum != xmitcsum) - { - if (remote_debug) - { - fprintf (stderr, - "bad checksum. My count = 0x%x, sent=0x%x. buf=%s\n", - checksum, xmitcsum, buffer); - } - putDebugChar ('-'); /* failed checksum */ - } - else - { - putDebugChar ('+'); /* successful transfer */ - - /* if a sequence char is present, reply the sequence ID */ - if (buffer[2] == ':') - { - putDebugChar (buffer[0]); - putDebugChar (buffer[1]); - - return &buffer[3]; - } - - return &buffer[0]; - } - } - } -} -#ifdef DJGPP -static void end_getpacket(void) {} -#endif - -/*********************************************************************** - * putpacket - * - * Description: Send GDB data packet. - * - * Inputs: Buffer of data to send. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void putpacket (unsigned char *buffer) -{ - unsigned char checksum; - int count; - char ch; - - /* $#. */ - do - { - putDebugChar ('$'); - checksum = 0; - count = 0; - - while ((ch = buffer[count])) - { - putDebugChar (ch); - checksum += ch; - count += 1; - } - - putDebugChar ('#'); - putDebugChar (hexchars[checksum >> 4]); - putDebugChar (hexchars[checksum % 16]); - - } - while (getDebugChar () != '+'); -} -#ifdef DJGPP -static void end_putpacket(void) {} -#endif - - -/*********************************************************************** - * debug_error - * - * Description: Log errors - * - * Inputs: - * format - Format string. - * parm - parameter string - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void debug_error (const char *format, char *parm) -{ - if (remote_debug) - fprintf (stderr, format, parm); -} -#ifdef DJGPP -static void end_debug_error(void) {} -#endif - -/* - * Indicate to caller of mem2hex or hex2mem that there has been an error. - */ -#ifndef DJGPP -static volatile int mem_err = 0; -#else -static int mem_err = 0; -#endif - -/*********************************************************************** - * set_mem_err - * - * Description: set memory error flag - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void set_mem_err (void) -{ - mem_err = 1; -} -#ifdef DJGPP -static void end_set_mem_err(void) {} -#endif - -/*********************************************************************** - * get_char - * - * Description: Retreive a character from the specified address. - * These are separate functions so that they are so - * short and sweet that the compiler won't save any - * registers (if there is a fault to mem_fault, they - * won't get restored, so there better not be any saved). - * - * Inputs: addr - The address to read from. - * Outputs: None. - * Returns: data read from address. - * - ***********************************************************************/ -static int get_char (char *addr) -{ - return *addr; -} -#ifdef DJGPP -static void end_get_char(void) {} -#endif - -/*********************************************************************** - * set_char - * - * Description: Write a value to the specified address. - * These are separate functions so that they are so - * short and sweet that the compiler won't save any - * registers (if there is a fault to mem_fault, they - * won't get restored, so there better not be any saved). - * - * Inputs: - * addr - The address to read from. - * val - value to write. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void set_char (char *addr, int val) -{ - *addr = val; -} -#ifdef DJGPP -static void end_set_char(void) {} -#endif - - -/*********************************************************************** - * mem2hex - * - * Description: Convert the memory pointed to by mem into hex, placing - * result in buf. Return a pointer to the last char put - * in buf (null). If MAY_FAULT is non-zero, then we should - * set mem_err in response to a fault; if zero treat a - * fault like any other fault in the stub. - * - * Inputs: - * mem - Memory address - * buf - data buffer - * count - number of bytes - * may_fault - flag indicating that the operation may cause a mem fault. - * Outputs: None. - * Returns: Pointer to last character. - * - ***********************************************************************/ -static char *mem2hex (char *mem,char *buf,int count,int may_fault) -{ - int i; - unsigned char ch; - -#ifdef _WIN32 //MF - if (IsBadReadPtr(mem, (DWORD)count)) - return mem; -#else - if (may_fault) - mem_fault_routine = set_mem_err; -#endif - for (i = 0; i < count; i++) - { - ch = get_char (mem++); - if (may_fault && mem_err) - return (buf); - *buf++ = hexchars[ch >> 4]; - *buf++ = hexchars[ch % 16]; - } - *buf = 0; -#ifndef _WIN32 //MF - if (may_fault) - mem_fault_routine = NULL; -#endif - return (buf); -} -#ifdef DJGPP -static void end_mem2hex(void) {} -#endif - -/*********************************************************************** - * hex2mem - * - * Description: Convert the hex array pointed to by buf into binary to - * be placed in mem. Return a pointer to the character - * AFTER the last byte written - * Inputs: - * buf - * mem - * count - * may_fault - * Outputs: None. - * Returns: Pointer to buffer after last byte. - * - ***********************************************************************/ -static char *hex2mem (char *buf,char *mem,int count,int may_fault) -{ - int i; - unsigned char ch; - -#ifdef _WIN32 //MF - // MinGW does not support structured exception handling, so let's - // go safe and make memory writable by default - DWORD old_protect; - - VirtualProtect(mem, (DWORD)count, PAGE_EXECUTE_READWRITE, &old_protect); -#else - if (may_fault) - mem_fault_routine = set_mem_err; -#endif - for (i = 0; i < count; i++) - { - ch = hex (*buf++) << 4; - ch = ch + hex (*buf++); - set_char (mem++, ch); - if (may_fault && mem_err) - return (mem); - } -#ifndef _WIN32 //MF - if (may_fault) - mem_fault_routine = NULL; -#endif - return (mem); -} -#ifdef DJGPP -static void end_hex2mem(void) {} -#endif - -/*********************************************************************** - * computeSignal - * - * Description: This function takes the 386 exception vector and - * attempts to translate this number into a unix - * compatible signal value. - * Inputs: - * exceptionVector - * Outputs: None. - * Returns: - * - ***********************************************************************/ -static int computeSignal (int exceptionVector) -{ - int sigval; - switch (exceptionVector) - { - case 0: - sigval = 8; - break; /* divide by zero */ - case 1: - sigval = 5; - break; /* debug exception */ - case 3: - sigval = 5; - break; /* breakpoint */ - case 4: - sigval = 16; - break; /* into instruction (overflow) */ - case 5: - sigval = 16; - break; /* bound instruction */ - case 6: - sigval = 4; - break; /* Invalid opcode */ - case 7: - sigval = 8; - break; /* coprocessor not available */ - case 8: - sigval = 7; - break; /* double fault */ - case 9: - sigval = 11; - break; /* coprocessor segment overrun */ - case 10: - sigval = 11; - break; /* Invalid TSS */ - case 11: - sigval = 11; - break; /* Segment not present */ - case 12: - sigval = 11; - break; /* stack exception */ - case 13: - sigval = 11; - break; /* general protection */ - case 14: - sigval = 11; - break; /* page fault */ - case 16: - sigval = 7; - break; /* coprocessor error */ - default: - sigval = 7; /* "software generated" */ - } - return (sigval); -} -#ifdef DJGPP -static void end_computeSignal(void) {} -#endif - -/*********************************************************************** - * hexToInt - * - * Description: Convert an ASCII string to an integer. - * - * Inputs: - * Outputs: None. - * Returns: Number of chars processed - * - ***********************************************************************/ -int hexToInt (char **ptr, int *intValue) -{ - int numChars = 0; - int hexValue; - - *intValue = 0; - - while (**ptr) - { - hexValue = hex (**ptr); - if (hexValue >= 0) - { - *intValue = (*intValue << 4) | hexValue; - numChars++; - } - else - break; - - (*ptr)++; - } - - return (numChars); -} -#ifdef DJGPP -static void end_hexToInt(void) {} -#endif - - -/*********************************************************************** - * handle_exception - * - * Description: This function does all command procesing for interfacing - * to GDB. - * Inputs: - * exceptionVector - number of the vector. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void handle_exception (int exceptionVector) -{ - int sigval, stepping; - int addr, length; - char *ptr; - int newPC; - -#ifndef _WIN32 //MF - gdb_i386vector = exceptionVector; -#endif - - if (remote_debug) - { - printf ("vector=%d, sr=0x%x, pc=0x%x\n", - exceptionVector, registers[PS], registers[PC]); - } - - /* reply to host that an exception has occurred */ - sigval = computeSignal (exceptionVector); - - ptr = remcomOutBuffer; - - *ptr++ = 'T'; /* notify gdb with signo, PC, FP and SP */ - *ptr++ = hexchars[sigval >> 4]; - *ptr++ = hexchars[sigval & 0xf]; - - *ptr++ = hexchars[ESP]; - *ptr++ = ':'; - ptr = mem2hex((char *)®isters[ESP], ptr, 4, 0); /* SP */ - *ptr++ = ';'; - - *ptr++ = hexchars[EBP]; - *ptr++ = ':'; - ptr = mem2hex((char *)®isters[EBP], ptr, 4, 0); /* FP */ - *ptr++ = ';'; - - *ptr++ = hexchars[PC]; - *ptr++ = ':'; - ptr = mem2hex((char *)®isters[PC], ptr, 4, 0); /* PC */ - *ptr++ = ';'; - - *ptr = '\0'; - - putpacket (remcomOutBuffer); - - stepping = 0; - - while (1 == 1) - { - remcomOutBuffer[0] = 0; - ptr = getpacket (); - - switch (*ptr++) - { - case '?': - remcomOutBuffer[0] = 'S'; - remcomOutBuffer[1] = hexchars[sigval >> 4]; - remcomOutBuffer[2] = hexchars[sigval % 16]; - remcomOutBuffer[3] = 0; - break; - case 'd': - remote_debug = !(remote_debug); /* toggle debug flag */ - break; - case 'g': /* return the value of the CPU registers */ - mem2hex ((char *) registers, remcomOutBuffer, NUMREGBYTES, 0); - break; - case 'G': /* set the value of the CPU registers - return OK */ - hex2mem (ptr, (char *) registers, NUMREGBYTES, 0); - strcpy (remcomOutBuffer, "OK"); - break; - case 'P': /* set the value of a single CPU register - return OK */ - { - int regno; - - if (hexToInt (&ptr, ®no) && *ptr++ == '=') - if (regno >= 0 && regno < NUMREGS) - { - hex2mem (ptr, (char *) ®isters[regno], 4, 0); - strcpy (remcomOutBuffer, "OK"); - break; - } - - strcpy (remcomOutBuffer, "E01"); - break; - } - - /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ - case 'm': - /* TRY TO READ %x,%x. IF SUCCEED, SET PTR = 0 */ - if (hexToInt (&ptr, &addr)) - if (*(ptr++) == ',') - if (hexToInt (&ptr, &length)) - { - ptr = 0; - mem_err = 0; - mem2hex ((char *) addr, remcomOutBuffer, length, 1); - if (mem_err) - { - strcpy (remcomOutBuffer, "E03"); - debug_error ("%s","memory fault"); - } - } - - if (ptr) - { - strcpy (remcomOutBuffer, "E01"); - } - break; - - /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ - case 'M': - /* TRY TO READ '%x,%x:'. IF SUCCEED, SET PTR = 0 */ - if (hexToInt (&ptr, &addr)) - if (*(ptr++) == ',') - if (hexToInt (&ptr, &length)) - if (*(ptr++) == ':') - { - mem_err = 0; - hex2mem (ptr, (char *) addr, length, 1); - - if (mem_err) - { - strcpy (remcomOutBuffer, "E03"); - debug_error ("%s","memory fault"); - } - else - { - strcpy (remcomOutBuffer, "OK"); - } - - ptr = 0; - } - if (ptr) - { - strcpy (remcomOutBuffer, "E02"); - } - break; - - /* cAA..AA Continue at address AA..AA(optional) */ - /* sAA..AA Step one instruction from AA..AA(optional) */ - case 's': - stepping = 1; - case 'c': - /* try to read optional parameter, pc unchanged if no parm */ - if (hexToInt (&ptr, &addr)) - registers[PC] = addr; - - newPC = registers[PC]; - - /* clear the trace bit */ - registers[PS] &= 0xfffffeff; - - /* set the trace bit if we're stepping */ - if (stepping) - registers[PS] |= 0x100; - -#ifdef _WIN32 //MF - return; -#else - _returnFromException (); /* this is a jump */ - - break; - - /* kill the program */ - case 'k': /* do nothing */ -#if 0 - /* Huh? This doesn't look like "nothing". - m68k-stub.c and sparc-stub.c don't have it. */ - BREAKPOINT (); -#endif - break; -#endif - } /* switch */ - - /* reply to the request */ - putpacket (remcomOutBuffer); - } -} -#ifdef DJGPP -static void end_handle_exception(void) {} -#endif - -#ifndef DJGPP -/* GDB stores segment registers in 32-bit words (that's just the way - m-i386v.h is written). So zero the appropriate areas in registers. */ -#define SAVE_REGISTERS1() \ - asm ("movl %eax, _registers"); \ - asm ("movl %ecx, _registers+4"); \ - asm ("movl %edx, _registers+8"); \ - asm ("movl %ebx, _registers+12"); \ - asm ("movl %ebp, _registers+20"); \ - asm ("movl %esi, _registers+24"); \ - asm ("movl %edi, _registers+28"); \ - asm ("movw $0, %ax"); \ - asm ("movw %ds, _registers+48"); \ - asm ("movw %ax, _registers+50"); \ - asm ("movw %es, _registers+52"); \ - asm ("movw %ax, _registers+54"); \ - asm ("movw %fs, _registers+56"); \ - asm ("movw %ax, _registers+58"); \ - asm ("movw %gs, _registers+60"); \ - asm ("movw %ax, _registers+62"); -#define SAVE_ERRCODE() \ - asm ("popl %ebx"); \ - asm ("movl %ebx, _gdb_i386errcode"); -#define SAVE_REGISTERS2() \ - asm ("popl %ebx"); /* old eip */ \ - asm ("movl %ebx, _registers+32"); \ - asm ("popl %ebx"); /* old cs */ \ - asm ("movl %ebx, _registers+40"); \ - asm ("movw %ax, _registers+42"); \ - asm ("popl %ebx"); /* old eflags */ \ - asm ("movl %ebx, _registers+36"); \ - /* Now that we've done the pops, we can save the stack pointer."); */ \ - asm ("movw %ss, _registers+44"); \ - asm ("movw %ax, _registers+46"); \ - asm ("movl %esp, _registers+16"); - -/* See if mem_fault_routine is set, if so just IRET to that address. */ -#define CHECK_FAULT() \ - asm ("cmpl $0, _mem_fault_routine"); \ - asm ("jne mem_fault"); - -asm (".text"); -asm ("mem_fault:"); -/* OK to clobber temp registers; we're just going to end up in set_mem_err. */ -/* Pop error code from the stack and save it. */ -asm (" popl %eax"); -asm (" movl %eax, _gdb_i386errcode"); - -asm (" popl %eax"); /* eip */ -/* We don't want to return there, we want to return to the function - pointed to by mem_fault_routine instead. */ -asm (" movl _mem_fault_routine, %eax"); -asm (" popl %ecx"); /* cs (low 16 bits; junk in hi 16 bits). */ -asm (" popl %edx"); /* eflags */ - -/* Remove this stack frame; when we do the iret, we will be going to - the start of a function, so we want the stack to look just like it - would after a "call" instruction. */ -asm (" leave"); - -/* Push the stuff that iret wants. */ -asm (" pushl %edx"); /* eflags */ -asm (" pushl %ecx"); /* cs */ -asm (" pushl %eax"); /* eip */ - -/* Zero mem_fault_routine. */ -asm (" movl $0, %eax"); -asm (" movl %eax, _mem_fault_routine"); - -asm ("iret"); - - -#define CALL_HOOK() asm("call _remcomHandler"); - -/* This function is called when a i386 exception occurs. It saves - * all the cpu regs in the _registers array, munges the stack a bit, - * and invokes an exception handler (remcom_handler). - * - * stack on entry: stack on exit: - * old eflags vector number - * old cs (zero-filled to 32 bits) - * old eip - * - */ -extern void _catchException3(); -asm(".text"); -asm(".globl __catchException3"); -asm("__catchException3:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $3"); -CALL_HOOK(); - -/* Same thing for exception 1. */ -extern void _catchException1(); -asm(".text"); -asm(".globl __catchException1"); -asm("__catchException1:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $1"); -CALL_HOOK(); - -/* Same thing for exception 0. */ -extern void _catchException0(); -asm(".text"); -asm(".globl __catchException0"); -asm("__catchException0:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $0"); -CALL_HOOK(); - -/* Same thing for exception 4. */ -extern void _catchException4(); -asm(".text"); -asm(".globl __catchException4"); -asm("__catchException4:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $4"); -CALL_HOOK(); - -/* Same thing for exception 5. */ -extern void _catchException5(); -asm(".text"); -asm(".globl __catchException5"); -asm("__catchException5:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $5"); -CALL_HOOK(); - -/* Same thing for exception 6. */ -extern void _catchException6(); -asm(".text"); -asm(".globl __catchException6"); -asm("__catchException6:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $6"); -CALL_HOOK(); - -/* Same thing for exception 7. */ -extern void _catchException7(); -asm(".text"); -asm(".globl __catchException7"); -asm("__catchException7:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $7"); -CALL_HOOK(); - -/* Same thing for exception 8. */ -extern void _catchException8(); -asm(".text"); -asm(".globl __catchException8"); -asm("__catchException8:"); -SAVE_REGISTERS1(); -SAVE_ERRCODE(); -SAVE_REGISTERS2(); -asm ("pushl $8"); -CALL_HOOK(); - -/* Same thing for exception 9. */ -extern void _catchException9(); -asm(".text"); -asm(".globl __catchException9"); -asm("__catchException9:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $9"); -CALL_HOOK(); - -/* Same thing for exception 10. */ -extern void _catchException10(); -asm(".text"); -asm(".globl __catchException10"); -asm("__catchException10:"); -SAVE_REGISTERS1(); -SAVE_ERRCODE(); -SAVE_REGISTERS2(); -asm ("pushl $10"); -CALL_HOOK(); - -/* Same thing for exception 12. */ -extern void _catchException12(); -asm(".text"); -asm(".globl __catchException12"); -asm("__catchException12:"); -SAVE_REGISTERS1(); -SAVE_ERRCODE(); -SAVE_REGISTERS2(); -asm ("pushl $12"); -CALL_HOOK(); - -/* Same thing for exception 16. */ -extern void _catchException16(); -asm(".text"); -asm(".globl __catchException16"); -asm("__catchException16:"); -SAVE_REGISTERS1(); -SAVE_REGISTERS2(); -asm ("pushl $16"); -CALL_HOOK(); - -/* For 13, 11, and 14 we have to deal with the CHECK_FAULT stuff. */ - -/* Same thing for exception 13. */ -extern void _catchException13 (); -asm (".text"); -asm (".globl __catchException13"); -asm ("__catchException13:"); -CHECK_FAULT(); -SAVE_REGISTERS1(); -SAVE_ERRCODE(); -SAVE_REGISTERS2(); -asm ("pushl $13"); -CALL_HOOK(); - -/* Same thing for exception 11. */ -extern void _catchException11 (); -asm (".text"); -asm (".globl __catchException11"); -asm ("__catchException11:"); -CHECK_FAULT(); -SAVE_REGISTERS1(); -SAVE_ERRCODE(); -SAVE_REGISTERS2(); -asm ("pushl $11"); -CALL_HOOK(); - -/* Same thing for exception 14. */ -extern void _catchException14 (); -asm (".text"); -asm (".globl __catchException14"); -asm ("__catchException14:"); -CHECK_FAULT(); -SAVE_REGISTERS1(); -SAVE_ERRCODE(); -SAVE_REGISTERS2(); -asm ("pushl $14"); -CALL_HOOK(); - -/* - * remcomHandler is a front end for handle_exception. It moves the - * stack pointer into an area reserved for debugger use. - */ -asm("_remcomHandler:"); -asm(" popl %eax"); /* pop off return address */ -asm(" popl %eax"); /* get the exception number */ -asm(" movl _stackPtr, %esp"); /* move to remcom stack area */ -asm(" pushl %eax"); /* push exception onto stack */ -asm(" call _handle_exception"); /* this never returns */ -#endif - -void _returnFromException () -{ -#ifndef DJGPP - return_to_prog (); -#else -/* Return from handler */ - longjmp(__djgpp_exception_state,__djgpp_exception_state->__eax); -#endif -} - -/* this function is used to set up exception handlers for tracing and - breakpoints */ -#ifndef DJGPP -void -set_debug_traps (void) -{ -#ifndef _WIN32 //MF - stackPtr = &remcomStack[STACKSIZE / sizeof (int) - 1]; - - exceptionHandler (0, _catchException0); - exceptionHandler (1, _catchException1); - exceptionHandler (3, _catchException3); - exceptionHandler (4, _catchException4); - exceptionHandler (5, _catchException5); - exceptionHandler (6, _catchException6); - exceptionHandler (7, _catchException7); - exceptionHandler (8, _catchException8); - exceptionHandler (9, _catchException9); - exceptionHandler (10, _catchException10); - exceptionHandler (11, _catchException11); - exceptionHandler (12, _catchException12); - exceptionHandler (13, _catchException13); - exceptionHandler (14, _catchException14); - exceptionHandler (16, _catchException16); -#endif // _WIN32 - - gdb_initialized = 1; -} -#endif //#ifndef DJGPP - - -// DJGPP stuff -#ifdef DJGPP -/*********************************************************************** - * restore_traps - * - * Description: This function restores all used signal handlers to - * defaults. - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -void restore_traps(void) -{ - /* Restore default signal handlers */ - signal(SIGSEGV,SIG_DFL); - signal(SIGTRAP,SIG_DFL); - signal(SIGFPE,SIG_DFL); - signal(SIGTRAP,SIG_DFL); - signal(SIGILL,SIG_DFL); - - /* Clear init flag */ - gdb_initialized = 0; -} - -/*********************************************************************** - * lock_handler_data - * - * Description: This function locks all data that is used by the signal - * handlers. - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -static void lock_handler_data(void) -{ - _go32_dpmi_lock_data(&gdb_initialized,sizeof(gdb_initialized)); - _go32_dpmi_lock_data(&remote_debug,sizeof(remote_debug)); - _go32_dpmi_lock_data(hexchars,sizeof(hexchars)); - _go32_dpmi_lock_data(registers,sizeof(registers)); - _go32_dpmi_lock_data(&gdb_i386errcode,sizeof(gdb_i386errcode)); - _go32_dpmi_lock_data(&gdb_i386vector,sizeof(gdb_i386vector)); - - _go32_dpmi_lock_data(remcomInBuffer,sizeof(remcomInBuffer)); - _go32_dpmi_lock_data(remcomOutBuffer,sizeof(remcomOutBuffer)); - - _go32_dpmi_lock_code(getpacket,(unsigned long)end_getpacket- - (unsigned long)getpacket); - _go32_dpmi_lock_code(putpacket,(unsigned long)end_putpacket- - (unsigned long)putpacket); - _go32_dpmi_lock_code(debug_error,(unsigned long)end_debug_error- - (unsigned long)debug_error); - - _go32_dpmi_lock_data(&mem_fault_routine,sizeof(mem_fault_routine)); - _go32_dpmi_lock_data(&mem_err,sizeof(mem_err)); - - _go32_dpmi_lock_code(set_mem_err,(unsigned long)end_set_mem_err-(unsigned long)set_mem_err); - _go32_dpmi_lock_code(get_char,(unsigned long)end_get_char-(unsigned long)get_char); - _go32_dpmi_lock_code(set_char,(unsigned long)end_set_char-(unsigned long)set_char); - _go32_dpmi_lock_code(mem2hex,(unsigned long)end_hex-(unsigned long)hex); - _go32_dpmi_lock_code(mem2hex,(unsigned long)end_mem2hex-(unsigned long)mem2hex); - _go32_dpmi_lock_code(hex2mem,(unsigned long)end_hex2mem-(unsigned long)hex2mem); - _go32_dpmi_lock_code(computeSignal,(unsigned long)end_computeSignal- - (unsigned long)computeSignal); - _go32_dpmi_lock_code(hexToInt,(unsigned long)end_hexToInt-(unsigned long)hexToInt); - _go32_dpmi_lock_code(handle_exception,(unsigned long)end_handle_exception- - (unsigned long)handle_exception); - - _go32_dpmi_lock_code(sigsegv_handler, - (unsigned long)end_sigsegv_handler-(unsigned long)sigsegv_handler); - - _go32_dpmi_lock_code(sigfpe_handler, - (unsigned long)end_sigfpe_handler-(unsigned long)sigfpe_handler); - - _go32_dpmi_lock_code(sigtrap_handler, - (unsigned long)end_sigtrap_handler-(unsigned long)sigtrap_handler); - - _go32_dpmi_lock_code(sigill_handler, - (unsigned long)end_sigill_handler-(unsigned long)sigill_handler); - - _go32_dpmi_lock_code(save_regs, - (unsigned long)end_save_regs-(unsigned long)save_regs); - - _go32_dpmi_lock_code(set_regs, - (unsigned long)end_set_regs-(unsigned long)set_regs); - -} - -/*********************************************************************** - * set_debug_traps - * - * Description: This function installs signal handlers. - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -void set_debug_traps(void) -{ - /* Lock any data that may be used by the trap handlers */ - lock_handler_data(); - - /* Install signal handlers here */ - signal(SIGSEGV,sigsegv_handler); - signal(SIGFPE,sigfpe_handler); - signal(SIGTRAP,sigtrap_handler); - signal(SIGILL,sigill_handler); - - /* Set init flag */ - gdb_initialized = 1; - -} -#endif //#ifdef DJGPP - -/*********************************************************************** - * breakpoint - * - * Description: This function will generate a breakpoint exception. - * It is used at the beginning of a program to sync up - * with a debugger and can be used otherwise as a quick - * means to stop program execution and "break" into the - * debugger. - * - * Inputs: None. - * Outputs: None. - * Returns: None. - * - ***********************************************************************/ -void breakpoint () -{ - if (gdb_initialized) - BREAKPOINT (); -} - diff --git a/tools/gdbst03/src/library/i386-supp.c b/tools/gdbst03/src/library/i386-supp.c deleted file mode 100644 index baf465b4e..000000000 --- a/tools/gdbst03/src/library/i386-supp.c +++ /dev/null @@ -1,424 +0,0 @@ -/*********************************************************************** - * i386-supp.c - * - * Description: Support functions for the i386 GDB target stub. - * - * Credits: Created by Jonathan Brogdon - * - * Terms of use: This software is provided for use under the terms - * and conditions of the GNU General Public License. - * You should have received a copy of the GNU General - * Public License along with this program; if not, write - * to the Free Software Foundation, Inc., 59 Temple Place - * Suite 330, Boston, MA 02111-1307, USA. - * - * Global Data: None. - * Global Functions: - * gdb_serial_init - * gdb_target_init - * gdb_target_close - * putDebugChar - * getDebugChar - * - * History - * Engineer: Date: Notes: - * --------- ----- ------ - * Jonathan Brogdon 20000617 Genesis - * Gordon Schumacher 20020212 Updated for modularity - * - ***********************************************************************/ - - -#ifdef DJGPP -#include -#endif - -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#include -#include -#include -#define DEBUGBUFFERSIZE 1024 -HANDLE ser_port = (HANDLE)(-1); - -//#include "utility/utility.h" -#ifdef _MSC_VER -#ifndef DEBUG_SERIAL -#pragma comment(lib, "wsock32") -#endif -#endif -#endif - -#include -#include - -#ifdef DJGPP -//#include "bios_layer.h" // Include this for BIOS calls - NOT RECOMMENDED! -//#include "sva_layer.h" // Include this for SVAsync usage -#include "dzc_layer.h" // Include this for DZComm usage - - -#endif -#define SER_TIMEOUT 1000000 - -#ifdef _WIN32 -static LPTOP_LEVEL_EXCEPTION_FILTER s_prev_exc_handler = 0; - - -#define I386_EXCEPTION_CNT 17 - -LONG WINAPI exc_protection_handler(EXCEPTION_POINTERS* exc_info) -{ - int exc_nr = exc_info->ExceptionRecord->ExceptionCode & 0xFFFF; - - if (exc_nr < I386_EXCEPTION_CNT) { - //LOG(FmtString(TEXT("exc_protection_handler: Exception %x"), exc_nr)); - -#if 0 - if (exc_nr==11 || exc_nr==13 || exc_nr==14) { - if (mem_fault_routine) - mem_fault_routine(); - } -#endif - - ++exc_info->ContextRecord->Eip; - } - - return EXCEPTION_CONTINUE_EXECUTION; -} - -LONG WINAPI exc_handler(EXCEPTION_POINTERS* exc_info) -{ - int exc_nr = exc_info->ExceptionRecord->ExceptionCode & 0xFFFF; - - if (exc_nr < I386_EXCEPTION_CNT) { - //LOG(FmtString("Exception %x", exc_nr)); - //LOG(FmtString("EIP=%08X EFLAGS=%08X", exc_info->ContextRecord->Eip, exc_info->ContextRecord->EFlags)); - - // step over initial breakpoint - if (s_initial_breakpoint) { - s_initial_breakpoint = 0; - ++exc_info->ContextRecord->Eip; - } - - SetUnhandledExceptionFilter(exc_protection_handler); - - win32_exception_handler(exc_info); - //LOG(FmtString("EIP=%08X EFLAGS=%08X", exc_info->ContextRecord->Eip, exc_info->ContextRecord->EFlags)); - - SetUnhandledExceptionFilter(exc_handler); - - return EXCEPTION_CONTINUE_EXECUTION; - } - - return EXCEPTION_CONTINUE_SEARCH; -} - -void disable_debugging() -{ - if (s_prev_exc_handler) { - SetUnhandledExceptionFilter(s_prev_exc_handler); - s_prev_exc_handler = 0; - } -} -#endif - -#if !(defined(DJGPP) || defined(_WIN32)) -void exceptionHandler(int exc_nr, void* exc_addr) -{ - if (exc_nr>=0 && exc_nr SER_TIMEOUT) - { - if(WriteFile( ser_port, buffer, 1, &dwLength, NULL )) - return 1; - else if(timeout > SER_TIMEOUT) - return 0; - } - else timeout++; - goto retrywrite; -#endif -} - -/*********************************************************************** - * getDebugChar - * - * Description: gets a character from the debug COM port. - * - * Inputs: None. - * Outputs: None. - * Returns: character data from the serial support. - * - ***********************************************************************/ -int getDebugChar(void) -{ - register int timeout = 0; -#ifdef DJGPP - register int ret = -1; - - while ((GDBStub_SerRecvOk() == 0) && (timeout < SER_TIMEOUT)) - timeout++; - if (timeout < SER_TIMEOUT) - ret = GDBStub_SerRecv(); - - return ret; -#elif defined(_WIN32) - DWORD buffer[DEBUGBUFFERSIZE]; - COMSTAT ComStat ; - DWORD dwErrorFlags; - DWORD dwLength; - - if(ser_port == (HANDLE)-1) - return -1; - - retryread: - ClearCommError( ser_port, &dwErrorFlags, &ComStat ) ; - dwLength = min( DEBUGBUFFERSIZE, ComStat.cbInQue ) ; - - if (dwLength > 0 || timeout > SER_TIMEOUT) - { - if(ReadFile( ser_port, buffer, 1, &dwLength, NULL )) - return buffer[0]; - else if(timeout > SER_TIMEOUT) - return -1; - } - else timeout++; - goto retryread; -#endif -} - -#if 0 -static SOCKET s_rem_fd = INVALID_SOCKET; - -int init_gdb_connect() -{ -#ifdef _WIN32 - WORD wVersionRequested; - WSADATA wsa_data; -#endif - SOCKADDR_IN srv_addr; - SOCKADDR_IN rem_addr; - SOCKET srv_socket; - int rem_len; - - memset(&srv_addr,0,sizeof(srv_addr)); - s_prev_exc_handler = SetUnhandledExceptionFilter(exc_handler); - -#ifdef _WIN32 - wVersionRequested= MAKEWORD( 2, 2 ); - if (WSAStartup(wVersionRequested, &wsa_data)) { - fprintf(stderr, "WSAStartup() failed"); - return 0; - } -#endif - - srv_addr.sin_family = AF_INET; - srv_addr.sin_addr.s_addr = htonl(INADDR_ANY); - srv_addr.sin_port = htons(9999); - - srv_socket = socket(PF_INET, SOCK_STREAM, 0); - if (srv_socket == INVALID_SOCKET) { - perror("socket()"); - return 0; - } - - if (bind(srv_socket, (struct sockaddr*) &srv_addr, sizeof(srv_addr)) == -1) { - perror("bind()"); - return 0; - } - - if (listen(srv_socket, 4) == -1) { - perror("listen()"); - return 0; - } - - rem_len = sizeof(rem_addr); - - for(;;) { - s_rem_fd = accept(srv_socket, (struct sockaddr*)&rem_addr, &rem_len); - - if (s_rem_fd == INVALID_SOCKET) { - if (errno == EINTR) - continue; - - perror("accept()"); - return 0; - } - - break; - } - - return 1; -} - - -int getDebugChar() -{ - char buffer[DEBUGBUFFERSIZE]; - int r; - - if (s_rem_fd == INVALID_SOCKET) - return EOF; - - r = recv(s_rem_fd, buffer, 1, 0); - if (r == -1) { - perror("recv()"); - //LOG(TEXT("debugger connection broken")); - s_rem_fd = INVALID_SOCKET; - return EOF; - } - - if (!r) - return EOF; - - return buffer[0]; -} - -void putDebugChar(int c) -{ - if (s_rem_fd == INVALID_SOCKET) { - const char buffer[] = {c}; - - if (!send(s_rem_fd, buffer, 1, 0)) { - perror("send()"); - //LOG(TEXT("debugger connection broken")); - exit(-1); - } - } -} -#endif diff --git a/tools/gdbst03/src/library/makefile b/tools/gdbst03/src/library/makefile deleted file mode 100644 index 05e1e9030..000000000 --- a/tools/gdbst03/src/library/makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# Makefile for GDB Stub for DJGPP -# -# GDB Stub for DJGPP Copyright 2000 by Jonathan Brogdon -# - -include ../../Makefile.cfg - -CFLAGS += -I../../include -I../include - -LOBJS = i386-stub.o i386-supp.o - -all: library - -library: $(LOBJS) - @$(RM) ../../lib/libgdbst.a - @$(AR) rcs ../../lib/libgdbst.a $(LOBJS) - -dep: - @$(CC) $(CFLAGS) -M *.c > depend.dep - -clean: - @$(RM) $(LOBJS) - -distclean: clean - @$(RM) ../../lib/libgdbst.a - @$(RM) depend.dep - -$(OBJS) $(LOBJS): -include depend.dep diff --git a/tools/gdbst03/src/library/sva_layer.h b/tools/gdbst03/src/library/sva_layer.h deleted file mode 100644 index 4cdd1628b..000000000 --- a/tools/gdbst03/src/library/sva_layer.h +++ /dev/null @@ -1,83 +0,0 @@ -//======================================================================================================= -// sva_layer.h - Serial command layer for SVAsync -// -//======================================================================================================= - -//======================================================================================================= -//======================================================================================================= - -#ifndef _SVA_LAYER_H -#define _SVA_LAYER_H - - -//=============================================================================== -// Include files -//=============================================================================== - -#include "svasync.h" - -//=============================================================================== -// Inline function definitions -//=============================================================================== - -// Initialize the serial library -// Should return 0 if no error occurred -__inline int GDBStub_SerInit(int port) -{ - int ret, init; - - ret = init = SVAsyncInit(port - 1); - if (ret == 0) - ret = SVAsyncFifoInit(); - if (init == 0) - atexit(SVAsyncStop); - return ret; -} - - -// Set the serial port speed (and other configurables) -// Should return 0 if the speed is set properly -__inline int GDBStub_SerSpeed(int speed) -{ - SVAsyncSet(speed, BITS_8 | NO_PARITY | STOP_1); - SVAsyncHand(DTR | RTS); - return 0; -} - - -// Check to see if there's room in the buffer to send data -// Should return 0 if it is okay to send -__inline int GDBStub_SerSendOk(void) -{ - return !SVAsyncOutStat(); -} - - -// Send a character to the serial port -// Should return 0 if the send succeeds -__inline int GDBStub_SerSend(int c) -{ - SVAsyncOut((char) c); - return 0; -} - - -// Check to see if there are characters waiting in the buffer -// Should return 0 if there's data waiting -__inline int GDBStub_SerRecvOk(void) -{ - return SVAsyncInStat(); -} - - -// Read a character from the serial port -// Should return the character read -__inline int GDBStub_SerRecv(void) -{ - return SVAsyncIn(); -} - - - - -#endif diff --git a/tools/lumpmod/Makefile b/tools/lumpmod/Makefile deleted file mode 100644 index a01f80278..000000000 --- a/tools/lumpmod/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# Makfile for SRB2 Lumpmod -# by Alam Arias et al. - -SRC=lumpmod.c lump.c -OBJ=$(SRC:.c=.o)# replaces the .c from SRC with .o -EXE=lumpmod - -.PHONY : all # .PHONY ignores files named all -all: $(EXE) # all is dependent on $(BIN) to be complete - -$(EXE): $(OBJ) # $(EXE) is dependent on all of the files in $(OBJ) to exist - $(CC) $(OBJ) $(LDFLAGS) -o $@ - -.PHONY : clean # .PHONY ignores files named clean -clean: - -$(RM) $(OBJ) $(EXE) diff --git a/tools/lumpmod/lump.c b/tools/lumpmod/lump.c deleted file mode 100644 index ed2ff2f9d..000000000 --- a/tools/lumpmod/lump.c +++ /dev/null @@ -1,473 +0,0 @@ -/* - LumpMod v0.2.1, a command-line utility for working with lumps in wad - files. - Copyright (C) 2003 Thunder Palace Entertainment. - - 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. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - lump.c: Provides functions for dealing with lumps -*/ - -#include -#include -#include -#include -#include "lump.h" - -/* Read contents of a wad file and store them in memory. - * fpoint is the file to read, opened with "rb" mode. - * A pointer to a new wadfile struct will be returned, or NULL on error. - */ -struct wadfile *read_wadfile(FILE *fpoint) { - struct wadfile *wfptr; - struct lumplist *curlump; - long diroffset, filelen; - unsigned long count; - - /* Allocate memory for wadfile struct */ - wfptr = malloc(sizeof(struct wadfile)); - if(wfptr == NULL) return NULL; - - /* Read first four characters (PWAD or IWAD) */ - if(fread(wfptr->id, 4, 1, fpoint) < 1) { - free(wfptr); - return NULL; - } - - /* Read number of lumps */ - if(fread(&(wfptr->numlumps), 4, 1, fpoint) < 1) { - free(wfptr); - return NULL; - } - - /* If number of lumps is zero, nothing more needs to be done */ - if(wfptr->numlumps == 0) { - wfptr->head = NULL; - return wfptr; - } - - /* Read offset of directory */ - if(fread(&diroffset, 4, 1, fpoint) < 1) { - free(wfptr); - return NULL; - } - - /* Verify that the directory as long as it needs to be */ - fseek(fpoint, 0, SEEK_END); - filelen = ftell(fpoint); - if((filelen - diroffset) / DIRENTRYLEN < wfptr->numlumps) { - free(wfptr); - return NULL; - } - - /* Allocate memory for head lumplist item and set head pointer */ - curlump = malloc(sizeof(struct lumplist)); - if(curlump == NULL) { - free(wfptr); - return NULL; - } - wfptr->head = curlump; - curlump->cl = NULL; - - /* Read directory entries and lumps */ - for(count = 0; count < wfptr->numlumps; count++) { - long lumpdataoffset; - - /* Advance to a new list item */ - curlump->next = malloc(sizeof(struct lumplist)); - if(curlump->next == NULL) { - free_wadfile(wfptr); - return NULL; - } - curlump = curlump->next; - curlump->next = NULL; - - /* Allocate memory for the lump info */ - curlump->cl = malloc(sizeof(struct lump)); - if(curlump->cl == NULL) { - free_wadfile(wfptr); - return NULL; - } - - /* Seek to the proper position in the file */ - if(fseek(fpoint, diroffset + (count * DIRENTRYLEN), SEEK_SET) != 0) { - free_wadfile(wfptr); - return NULL; - } - - /* Read offset of lump data */ - if(fread(&lumpdataoffset, 4, 1, fpoint) < 1) { - free_wadfile(wfptr); - return NULL; - } - - /* Read size of lump in bytes */ - if(fread(&(curlump->cl->len), 4, 1, fpoint) < 1) { - free_wadfile(wfptr); - return NULL; - } - - /* Read lump name */ - if(fread(curlump->cl->name, 8, 1, fpoint) < 1) { - free_wadfile(wfptr); - return NULL; - } - - /* Read actual lump data, unless lump size is 0 */ - if(curlump->cl->len > 0) { - if(fseek(fpoint, lumpdataoffset, SEEK_SET) != 0) { - free_wadfile(wfptr); - return NULL; - } - - /* Allocate memory for data */ - curlump->cl->data = malloc(curlump->cl->len); - if(curlump->cl->data == NULL) { - free_wadfile(wfptr); - return NULL; - } - - /* Fill the data buffer */ - if(fread(curlump->cl->data, curlump->cl->len, 1, fpoint) < 1) { - free_wadfile(wfptr); - return NULL; - } - } else curlump->cl->data = NULL; - } /* End of directory reading loop */ - - return wfptr; -} - -/* Free a wadfile from memory as well as all related structures. - */ -void free_wadfile(struct wadfile *wfptr) { - struct lumplist *curlump, *nextlump; - - if(wfptr == NULL) return; - curlump = wfptr->head; - - /* Free items in the lump list */ - while(curlump != NULL) { - - /* Free the actual lump and its data, if necessary */ - if(curlump->cl != NULL) { - if(curlump->cl->data != NULL) free(curlump->cl->data); - free(curlump->cl); - } - - /* Advance to next lump and free this one */ - nextlump = curlump->next; - free(curlump); - curlump = nextlump; - } - - free(wfptr); -} - -/* Write complete wadfile to a file stream, opened with "wb" mode. - * fpoint is the stream to write to. - * wfptr is a pointer to the wadfile structure to use. - * Return zero on success, nonzero on failure. - */ -int write_wadfile(FILE *fpoint, struct wadfile *wfptr) { - struct lumplist *curlump; - long lumpdataoffset, diroffset; - - if(wfptr == NULL) return 1; - - /* Write four-character ID ("PWAD" or "IWAD") */ - if(fwrite(wfptr->id, 4, 1, fpoint) < 1) return 2; - - /* Write number of lumps */ - if(fwrite(&(wfptr->numlumps), 4, 1, fpoint) < 1) return 3; - - /* Offset of directory is not known yet. For now, write number of lumps - * again, just to fill the space. - */ - if(fwrite(&(wfptr->numlumps), 4, 1, fpoint) < 1) return 4; - - /* Loop through lump list, writing lump data */ - for(curlump = wfptr->head; curlump != NULL; curlump = curlump->next) { - - /* Don't write anything for the head of the lump list or for lumps of - zero length */ - if(curlump->cl == NULL || curlump->cl->data == NULL) continue; - - /* Write the data */ - if(fwrite(curlump->cl->data, curlump->cl->len, 1, fpoint) < 1) - return 5; - } - - /* Current position is where directory will start */ - diroffset = ftell(fpoint); - - /* Offset for the first lump's data is always 12 */ - lumpdataoffset = 12; - - /* Loop through lump list again, this time writing directory entries */ - for(curlump = wfptr->head; curlump != NULL; curlump = curlump->next) { - - /* Don't write anything for the head of the lump list */ - if(curlump->cl == NULL) continue; - - /* Write offset for lump data */ - if(fwrite(&lumpdataoffset, 4, 1, fpoint) < 1) return 6; - - /* Write size of lump data */ - if(fwrite(&(curlump->cl->len), 4, 1, fpoint) < 1) return 7; - - /* Write lump name */ - if(fwrite(curlump->cl->name, 8, 1, fpoint) < 1) return 8; - - /* Increment lumpdataoffset variable as appropriate */ - lumpdataoffset += curlump->cl->len; - } - - /* Go back to header and write the proper directory offset */ - fseek(fpoint, 8, SEEK_SET); - if(fwrite(&diroffset, 4, 1, fpoint) < 1) return 9; - - return 0; -} - -/* Get the name of a lump, as a null-terminated string. - * item is a pointer to the lump (not lumplist) whose name will be obtained. - * Return NULL on error. - */ -char *get_lump_name(struct lump *item) { - char convname[9], *retname; - - if(item == NULL) return NULL; - memcpy(convname, item->name, 8); - convname[8] = '\0'; - - retname = malloc(strlen(convname) + 1); - if(retname != NULL) strcpy(retname, convname); - return retname; -} - -/* Find the lump after start and before end having a certain name. - * Return a pointer to the list item for that lump, or return NULL if no lump - * by that name is found or lumpname is too long. - * lumpname is a null-terminated string. - * If end parameter is NULL, search to the end of the entire list. - */ -struct lumplist *find_previous_lump(struct lumplist *start, struct lumplist - *end, char *lumpname) { - struct lumplist *curlump, *lastlump; - char *curname; - int found = 0; - - /* Verify that parameters are valid */ - if(start==NULL || start==end || lumpname==NULL || strlen(lumpname) > 8) - return NULL; - - /* Loop through the list from start parameter */ - lastlump = start; - for(curlump = start->next; curlump != end && curlump != NULL; - curlump = curlump->next) { - - /* Skip header lump */ - if(curlump->cl == NULL) continue; - - /* Find name of this lump */ - curname = get_lump_name(curlump->cl); - if(curname == NULL) continue; - - /* Compare names to see if this is the lump we want */ - if(strcmp(curname, lumpname) == 0) { - found = 1; - break; - } - - /* Free memory allocated to curname */ - free(curname); - - lastlump = curlump; - } - - if(found) return lastlump; - return NULL; -} - -/* Remove a lump from the list, free it, and free its data. - * before is the lump immediately preceding the lump to be removed. - * wfptr is a pointer to the wadfile structure to which the removed lump - * belongs, so that numlumps can be decreased. - */ -void remove_next_lump(struct wadfile *wfptr, struct lumplist *before) { - struct lumplist *removed; - - /* Verify that parameters are valid */ - if(before == NULL || before->next == NULL || wfptr == NULL) return; - - /* Update linked list to omit removed lump */ - removed = before->next; - before->next = removed->next; - - /* Free lump info and data if necessary */ - if(removed->cl != NULL) { - if(removed->cl->data != NULL) free(removed->cl->data); - free(removed->cl); - } - - free(removed); - - /* Decrement numlumps */ - wfptr->numlumps--; -} - -/* Add a lump. - * The lump will follow prev in the list and be named name, with a data size - * of len. - * A copy will be made of the data. - * Return zero on success or nonzero on failure. - */ -int add_lump(struct wadfile *wfptr, struct lumplist *prev, char *name, long - len, unsigned char *data) { - struct lump *newlump; - struct lumplist *newlumplist; - unsigned char *copydata; - - /* Verify that parameters are valid */ - if(wfptr == NULL || prev == NULL || name == NULL || strlen(name) > 8) - return 1; - - /* Allocate space for newlump and newlumplist */ - newlump = malloc(sizeof(struct lump)); - newlumplist = malloc(sizeof(struct lumplist)); - if(newlump == NULL || newlumplist == NULL) return 2; - - /* Copy lump data and set up newlump */ - if(len == 0 || data == NULL) { - newlump->len = 0; - newlump->data = NULL; - } else { - newlump->len = len; - copydata = malloc(len); - if(copydata == NULL) return 3; - memcpy(copydata, data, len); - newlump->data = copydata; - } - - /* Set name of newlump */ - memset(newlump->name, '\0', 8); - if(strlen(name) == 8) memcpy(newlump->name, name, 8); - else strcpy(newlump->name, name); - - /* Set up newlumplist and alter prev appropriately */ - newlumplist->cl = newlump; - newlumplist->next = prev->next; - prev->next = newlumplist; - - /* Increment numlumps */ - wfptr->numlumps++; - - return 0; -} - -/* Rename a lump. - * renamed is a pointer to the lump (not lumplist) that needs renaming. - * newname is a null-terminated string with the new name. - * Return zero on success or nonzero on failure. - */ -int rename_lump(struct lump *renamed, char *newname) { - - /* Verify that parameters are valid. */ - if(newname == NULL || renamed == NULL || strlen(newname) > 8) return 1; - - /* Do the renaming. */ - memset(renamed->name, '\0', 8); - if(strlen(newname) == 8) memcpy(renamed->name, newname, 8); - else strcpy(renamed->name, newname); - - return 0; -} - -/* Find the last lump in a wadfile structure. - * Return this lump or NULL on failure. - */ -struct lumplist *find_last_lump(struct wadfile *wfptr) { - struct lumplist *curlump; - - if(wfptr == NULL || wfptr->head == NULL) return NULL; - curlump = wfptr->head; - - while(curlump->next != NULL) curlump = curlump->next; - return curlump; -} - -/* Find the last lump between start and end. - * Return this lump or NULL on failure. - */ -struct lumplist *find_last_lump_between(struct lumplist *start, struct - lumplist *end) { - struct lumplist *curlump; - - if(start == NULL) return NULL; - curlump = start; - - while(curlump->next != end) { - curlump = curlump->next; - if(curlump == NULL) break; - } - - return curlump; -} - -/* Find the next section lump. A section lump is MAPxx (0 <= x <= 9), ExMy - * (0 <= x <= 9, 0 <= y <= 9), or any lump whose name ends in _START or _END. - * Return NULL if there are no section lumps after start. - */ -struct lumplist *find_next_section_lump(struct lumplist *start) { - struct lumplist *curlump, *found = NULL; - char *curname; - - /* Verify that parameter is valid */ - if(start == NULL || start->next == NULL) return NULL; - - /* Loop through the list from start parameter */ - for(curlump = start->next; curlump != NULL && found == NULL; - curlump = curlump->next) { - - /* Skip header lump */ - if(curlump->cl == NULL) continue; - - /* Find name of this lump */ - curname = get_lump_name(curlump->cl); - if(curname == NULL) continue; - - /* Check to see if this is a section lump */ - if(strlen(curname) == 5 && strncmp("MAP", curname, 3) == 0 && - isdigit(curname[3]) && isdigit(curname[4])) - found = curlump; - else if(strlen(curname) == 4 && curname[0] == 'E' && curname[2] == - 'M' && isdigit(curname[1]) && isdigit(curname[3])) - found = curlump; - else if(strlen(curname) == 7 && strcmp("_START", &curname[1]) == 0) - found = curlump; - else if(strlen(curname) == 8 && strcmp("_START", &curname[2]) == 0) - found = curlump; - else if(strlen(curname) == 5 && strcmp("_END", &curname[1]) == 0) - found = curlump; - else if(strlen(curname) == 6 && strcmp("_END", &curname[2]) == 0) - found = curlump; - - /* Free memory allocated to curname */ - free(curname); - } - - return found; -} diff --git a/tools/lumpmod/lump.h b/tools/lumpmod/lump.h deleted file mode 100644 index 88e478716..000000000 --- a/tools/lumpmod/lump.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - LumpMod v0.2.1, a command-line utility for working with lumps in wad - files. - Copyright (C) 2003 Thunder Palace Entertainment. - - 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. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - lump.h: Defines constants, structures, and functions used in lump.c -*/ - -#ifndef __LUMP_H -#define __LUMP_H - -/* Entries in the wadfile directory are 16 bytes */ -#define DIRENTRYLEN 16 - -/* Lumps and associated info */ -struct lump { - long len; - unsigned char *data; - char name[8]; -}; - -/* Linked list of lumps */ -struct lumplist { - struct lump *cl; /* actual content of the lump */ - struct lumplist *next; -}; - -/* Structure to contain all wadfile data */ -struct wadfile { - char id[4]; /* IWAD or PWAD */ - long numlumps; /* 32-bit integer */ - struct lumplist *head; /* points to first entry */ -}; - -/* Function declarations */ -struct wadfile *read_wadfile(FILE *); -void free_wadfile(struct wadfile *); -int write_wadfile(FILE *, struct wadfile *); -char *get_lump_name(struct lump *); -struct lumplist *find_previous_lump(struct lumplist *, struct lumplist *, char *); -void remove_next_lump(struct wadfile *, struct lumplist *); -int add_lump(struct wadfile *, struct lumplist *, char *, long, unsigned char *); -int rename_lump(struct lump *, char *); -struct lumplist *find_last_lump(struct wadfile *); -struct lumplist *find_last_lump_between(struct lumplist *, struct lumplist *); -struct lumplist *find_next_section_lump(struct lumplist *); - -#endif diff --git a/tools/lumpmod/lumpmod.c b/tools/lumpmod/lumpmod.c deleted file mode 100644 index e9042615e..000000000 --- a/tools/lumpmod/lumpmod.c +++ /dev/null @@ -1,785 +0,0 @@ -/* - LumpMod v0.2.1, a command-line utility for working with lumps in wad - files. - Copyright (C) 2003 Thunder Palace Entertainment. - - 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. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - lumpmod.c: Provides program functionality; depends on lump.c and lump.h -*/ - -#include -#include -#include -#include "lump.h" - -int main(int argc, char *argv[]) { - enum commands { C_ADD, C_ADDSECT, C_DELETE, C_DELSECT, C_EXTRACT, C_LIST, - C_RENAME, C_UPDATE } cmd; - struct wadfile *wfptr; - struct lumplist *startitem, *enditem = NULL; - FILE *fpoint; - char *progname, **params; - char *startname = NULL, *endname = NULL; - int numargs, numparams, insection = 0; - - progname = argv[0]; - numargs = argc - 1; - - /* Verify that there are enough arguments */ - if(numargs < 2) { - fprintf(stderr, "%s: not enough arguments\n", progname); - return EXIT_FAILURE; - } - - /* Identify the command used */ - if(strcmp(argv[2], "add" ) == 0) cmd = C_ADD; - else if(strcmp(argv[2], "addsect") == 0) cmd = C_ADDSECT; - else if(strcmp(argv[2], "delete" ) == 0) cmd = C_DELETE; - else if(strcmp(argv[2], "delsect") == 0) cmd = C_DELSECT; - else if(strcmp(argv[2], "extract") == 0) cmd = C_EXTRACT; - else if(strcmp(argv[2], "list" ) == 0) cmd = C_LIST; - else if(strcmp(argv[2], "rename" ) == 0) cmd = C_RENAME; - else if(strcmp(argv[2], "update" ) == 0) cmd = C_UPDATE; - else { - fprintf(stderr, "%s: invalid command %s\n", progname, argv[2]); - return EXIT_FAILURE; - } - - /* Check for -s option */ - if(numargs >= 4 && strcmp(argv[3], "-s") == 0) { - if(cmd == C_ADDSECT || cmd == C_DELSECT) { - fprintf(stderr, "%s: no option -s for command %s\n", progname, argv[2]); - return EXIT_FAILURE; - } - insection = 1; - params = &argv[5]; - numparams = numargs - 4; - - /* Assume a map name if length > 2 */ - if(strlen(argv[4]) > 2) startname = argv[4]; - else { - startname = malloc(strlen(argv[4]) + 7); - endname = malloc(strlen(argv[4]) + 5); - if(startname == NULL || endname == NULL) { - fprintf(stderr, "%s: out of memory\n", progname); - return EXIT_FAILURE; - } - sprintf(startname, "%s_START", argv[4]); - sprintf(endname, "%s_END", argv[4]); - } - } else { - params = &argv[3]; - numparams = numargs - 2; - } /* end of check for -s option */ - - /* Load the wadfile into memory, since all commands require this */ - fpoint = fopen(argv[1], "rb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: unable to open file %s\n", progname, argv[1]); - return EXIT_FAILURE; - } - wfptr = read_wadfile(fpoint); - fclose(fpoint); - if(wfptr == NULL) { - fprintf(stderr, "%s: %s is not a valid wadfile\n", progname, argv[1]); - return EXIT_FAILURE; - } - - /* Find startitem and enditem, using startname and endname */ - if(startname == NULL) startitem = wfptr->head; - else { - startitem = find_previous_lump(wfptr->head, NULL, startname); - if(startitem == NULL) { - fprintf(stderr, "%s: can't find lump %s in %s", progname, - startname, argv[1]); - return EXIT_FAILURE; - } - startitem = startitem->next; - if(endname == NULL) { - if(startitem->next != NULL) { - char *itemname; - - enditem = startitem->next; - itemname = get_lump_name(enditem->cl); - while( strcmp(itemname, "THINGS" ) == 0 || - strcmp(itemname, "LINEDEFS") == 0 || - strcmp(itemname, "SIDEDEFS") == 0 || - strcmp(itemname, "VERTEXES") == 0 || - strcmp(itemname, "SEGS" ) == 0 || - strcmp(itemname, "SSECTORS") == 0 || - strcmp(itemname, "NODES" ) == 0 || - strcmp(itemname, "SECTORS" ) == 0 || - strcmp(itemname, "REJECT" ) == 0 || - strcmp(itemname, "BLOCKMAP") == 0) { - enditem = enditem->next; - if(enditem == NULL) break; - free(itemname); - itemname = get_lump_name(enditem->cl); - } - free(itemname); - if(enditem != NULL) enditem = enditem->next; - } else enditem = NULL; - } else { - enditem = find_previous_lump(startitem, NULL, endname); - if(enditem == NULL) { - fprintf(stderr, "%s: can't find lump %s in %s", progname, - endname, argv[1]); - return EXIT_FAILURE; - } - enditem = enditem->next; - } - } /* end of finding startitem and enditem */ - - /* Do stuff specific to each command */ - switch(cmd) { - case C_ADD: { - struct lumplist *startitem2, *before, *existing; - int overwrite = 1, firstentry = 0, canduplicate = 0; - char *startname2 = NULL; - - /* Parse options: -a, -b, -d, -n */ - while(numparams > 2) { - if(params[0][0] != '-') break; - if(strcmp(params[0], "-n") == 0) overwrite = 0; - else if(strcmp(params[0], "-d") == 0) canduplicate = 1; - else if(strcmp(params[0], "-b") == 0) firstentry = 1; - else if(strcmp(params[0], "-a") == 0) { - params = ¶ms[1]; - numparams--; - startname2 = params[0]; - } else { - fprintf(stderr, "%s: no option %s for command %s", - progname, params[0], argv[2]); - return EXIT_FAILURE; - } - params = ¶ms[1]; - numparams--; - } - - if(numparams < 2) { - fprintf(stderr, "%s: not enough parameters for %s", progname, - argv[2]); - return EXIT_FAILURE; - } - - /* Find the lump after which to add */ - if(firstentry) before = startitem; - else if(startname2 != NULL) { - before = find_previous_lump(startitem, enditem, startname2); - if(before == NULL) { - fprintf(stderr, "%s: can't find lump %s in %s", progname, - startname2, argv[1]); - return EXIT_FAILURE; - } - before = before->next; - } else { - if(insection) { - before = find_last_lump_between(startitem, enditem); - if(before == NULL) before = startitem; - } else before = find_last_lump(wfptr); - } - startitem2 = before; - - /* Add LUMPNAME FILENAME pairs */ - printf("Adding lumps in %s...\n", argv[1]); - for(;;) { - long newlumpsize; - unsigned char *newlumpdata; - - /* Check whether the lump already exists, unless -d is used */ - if(canduplicate) existing = NULL; - else existing = find_previous_lump(startitem, enditem, params[0]); - if(existing != NULL) existing = existing->next; - if(existing != NULL && overwrite == 0) { - printf("Lump %s already exists. Taking no action.\n", params[0]); - numparams -= 2; - if(numparams < 2) break; - params = ¶ms[2]; - continue; - } - - /* Read the file with new lump data */ - fpoint = fopen(params[1], "rb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: can't open file %s\n", progname, - params[1]); - return EXIT_FAILURE; - } - - /* Find size of lump data */ - fseek(fpoint, 0, SEEK_END); - newlumpsize = ftell(fpoint); - fseek(fpoint, 0, SEEK_SET); - - /* Copy lump data to memory */ - if(newlumpsize == 0) newlumpdata = NULL; - else { - newlumpdata = malloc(newlumpsize); - if(newlumpdata == NULL) { - fprintf(stderr, "%s: out of memory\n", progname); - return EXIT_FAILURE; - } - if(fread(newlumpdata, newlumpsize, 1, fpoint) < 1) { - fprintf(stderr, "%s: unable to read file %s\n", - progname, params[1]); - return EXIT_FAILURE; - } - } - - /* Close the file */ - fclose(fpoint); - - /* Add or update lump */ - if(existing == NULL) { - if(add_lump(wfptr, before, params[0], newlumpsize, - newlumpdata) != 0) { - fprintf(stderr, "%s: unable to add lump %s\n", - progname, params[0]); - return EXIT_FAILURE; - } - printf("Lump %s added.\n", params[0]); - - /* Other lumps will be added after the new one */ - before = before->next; - } else { - existing->cl->len = newlumpsize; - free(existing->cl->data); - existing->cl->data = malloc(newlumpsize); - if(existing->cl->data == NULL) { - fprintf(stderr, "%s: out of memory\n", progname); - return EXIT_FAILURE; - } - memcpy(existing->cl->data, newlumpdata, newlumpsize); - printf("Lump %s updated.\n", params[0]); - } - - /* Advance to the next pair, if there is a next pair */ - numparams -= 2; - if(numparams < 2) break; - params = ¶ms[2]; - } /* end of adding LUMPNAME FILENAME pairs */ - - /* Save the modified wadfile */ - fpoint = fopen(argv[1], "wb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: unable to open file %s for writing\n", - progname, argv[1]); - return EXIT_FAILURE; - } - if(write_wadfile(fpoint, wfptr) != 0) { - fprintf(stderr, "%s: unable to write wadfile to disk\n", - progname); - return EXIT_FAILURE; - } - fclose(fpoint); - printf("File %s successfully updated.\n", argv[1]); - } /* end of C_ADD */ - break; - - case C_UPDATE: { - struct lumplist *existing; - - /* Parse options (none) */ - if(numparams > 2 && params[0][0] == '-') { - fprintf(stderr, "%s: no option %s for command %s", - progname, params[0], argv[2]); - return EXIT_FAILURE; - } - - if(numparams < 2) { - fprintf(stderr, "%s: not enough parameters for %s", progname, - argv[2]); - return EXIT_FAILURE; - } - - /* Update LUMPNAME FILENAME pairs */ - printf("Updating lumps in %s...\n", argv[1]); - for(;;) { - long newlumpsize; - unsigned char *newlumpdata; - - /* Check whether the lump already exists */ - existing = find_previous_lump(startitem, enditem, params[0]); - if(existing == NULL) { - printf("Lump %s does not exist. Taking no action.\n", - params[0]); - numparams -= 2; - if(numparams < 2) break; - params = ¶ms[2]; - continue; - } - existing = existing->next; - - /* Read the file with new lump data */ - fpoint = fopen(params[1], "rb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: can't open file %s\n", progname, - params[1]); - return EXIT_FAILURE; - } - - /* Find size of lump data */ - fseek(fpoint, 0, SEEK_END); - newlumpsize = ftell(fpoint); - fseek(fpoint, 0, SEEK_SET); - - /* Copy lump data to memory */ - if(newlumpsize == 0) newlumpdata = NULL; - else { - newlumpdata = malloc(newlumpsize); - if(newlumpdata == NULL) { - fprintf(stderr, "%s: out of memory\n", progname); - return EXIT_FAILURE; - } - if(fread(newlumpdata, newlumpsize, 1, fpoint) < 1) { - fprintf(stderr, "%s: unable to read file %s\n", - progname, params[1]); - return EXIT_FAILURE; - } - } - - /* Close the file */ - fclose(fpoint); - - /* Update lump */ - existing->cl->len = newlumpsize; - free(existing->cl->data); - existing->cl->data = malloc(newlumpsize); - if(existing->cl->data == NULL) { - fprintf(stderr, "%s: out of memory\n", progname); - return EXIT_FAILURE; - } - memcpy(existing->cl->data, newlumpdata, newlumpsize); - printf("Lump %s updated.\n", params[0]); - - /* Advance to the next pair, if there is a next pair */ - numparams -= 2; - if(numparams < 2) break; - params = ¶ms[2]; - } /* end of updating LUMPNAME FILENAME pairs */ - - /* Save the modified wadfile */ - fpoint = fopen(argv[1], "wb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: unable to open file %s for writing\n", - progname, argv[1]); - return EXIT_FAILURE; - } - if(write_wadfile(fpoint, wfptr) != 0) { - fprintf(stderr, "%s: unable to write wadfile to disk\n", - progname); - return EXIT_FAILURE; - } - fclose(fpoint); - printf("File %s successfully updated.\n", argv[1]); - } /* end of C_UPDATE */ - break; - - case C_DELETE: { - struct lumplist *before; - - /* Parse options (none) */ - if(numparams > 1 && params[0][0] == '-') { - fprintf(stderr, "%s: no option %s for command %s", - progname, params[0], argv[2]); - return EXIT_FAILURE; - } - - if(numparams < 1) { - fprintf(stderr, "%s: not enough parameters for %s", progname, - argv[2]); - return EXIT_FAILURE; - } - - /* Delete LUMPNAME lumps */ - printf("Deleting lumps in %s...\n", argv[1]); - for(;;) { - - /* Find the lump to delete */ - before = find_previous_lump(startitem, enditem, params[0]); - if(before == NULL) { - printf("Lump %s does not exist. Taking no action.\n", - params[0]); - numparams--; - if(numparams < 1) break; - params = ¶ms[1]; - continue; - } - - /* Delete it */ - remove_next_lump(wfptr, before); - printf("Lump %s deleted.\n", params[0]); - - /* Advance to the next item to delete, if there is one */ - numparams--; - if(numparams < 1) break; - params = ¶ms[1]; - } /* end of deleting LUMPNAME lumps */ - - /* Save the modified wadfile */ - fpoint = fopen(argv[1], "wb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: unable to open file %s for writing\n", - progname, argv[1]); - return EXIT_FAILURE; - } - if(write_wadfile(fpoint, wfptr) != 0) { - fprintf(stderr, "%s: unable to write wadfile to disk\n", - progname); - return EXIT_FAILURE; - } - fclose(fpoint); - printf("File %s successfully updated.\n", argv[1]); - } /* end of C_DELETE */ - break; - - case C_RENAME: { - struct lumplist *renamed; - - /* Parse options (none) */ - if(numparams > 2 && params[0][0] == '-') { - fprintf(stderr, "%s: no option %s for command %s", - progname, params[0], argv[2]); - return EXIT_FAILURE; - } - - if(numparams < 2) { - fprintf(stderr, "%s: not enough parameters for %s", progname, - argv[2]); - return EXIT_FAILURE; - } - - /* Rename OLDNAME NEWNAME pairs */ - printf("Renaming lumps in %s...\n", argv[1]); - for(;;) { - - /* Find the lump to rename */ - renamed = find_previous_lump(startitem, enditem, params[0]); - if(renamed == NULL) { - printf("Lump %s does not exist. Taking no action.\n", - params[0]); - numparams -= 2; - if(numparams < 2) break; - params = ¶ms[2]; - continue; - } - renamed = renamed->next; - - /* Rename lump */ - memset(renamed->cl->name, '\0', 8); - if(strlen(params[1]) >= 8) memcpy(renamed->cl->name, - params[1], 8); - else strcpy(renamed->cl->name, params[1]); - - printf("Lump %s renamed to %s.\n", params[0], params[1]); - - /* Advance to the next pair, if there is a next pair */ - numparams -= 2; - if(numparams < 2) break; - params = ¶ms[2]; - } /* end of renaming OLDNAME NEWNAME pairs */ - - /* Save the modified wadfile */ - fpoint = fopen(argv[1], "wb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: unable to open file %s for writing\n", - progname, argv[1]); - return EXIT_FAILURE; - } - if(write_wadfile(fpoint, wfptr) != 0) { - fprintf(stderr, "%s: unable to write wadfile to disk\n", - progname); - return EXIT_FAILURE; - } - fclose(fpoint); - printf("File %s successfully updated.\n", argv[1]); - } /* end of C_RENAME */ - break; - - case C_EXTRACT: { - struct lumplist *extracted; - - /* Parse options (none) */ - if(numparams > 2 && params[0][0] == '-') { - fprintf(stderr, "%s: no option %s for command %s", - progname, params[0], argv[2]); - return EXIT_FAILURE; - } - - if(numparams < 2) { - fprintf(stderr, "%s: not enough parameters for %s", progname, - argv[2]); - return EXIT_FAILURE; - } - - /* Extract LUMPNAME FILENAME pairs */ - printf("Extracting lumps from %s...\n", argv[1]); - for(;;) { - - /* Find the lump to extract */ - extracted = find_previous_lump(startitem, enditem, params[0]); - if(extracted == NULL) { - printf("Lump %s does not exist. Taking no action.\n", - params[0]); - numparams -= 2; - if(numparams < 2) break; - params = ¶ms[2]; - continue; - } - extracted = extracted->next; - - /* Open the file to extract to */ - fpoint = fopen(params[1], "wb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: can't open file %s for writing\n", - progname, params[1]); - return EXIT_FAILURE; - } - - /* Extract lump */ - if(fwrite(extracted->cl->data, extracted->cl->len, 1, fpoint) - < 1) { - fprintf(stderr, "%s: unable to write lump %s to disk\n", - progname, params[0]); - return EXIT_FAILURE; - } - - /* Close the file */ - fclose(fpoint); - printf("Lump %s saved as %s.\n", params[0], params[1]); - - /* Advance to the next pair, if there is a next pair */ - numparams -= 2; - if(numparams < 2) break; - params = ¶ms[2]; - } /* end of extracting LUMPNAME FILENAME pairs */ - - printf("Finished extracting lumps from file %s.\n", argv[1]); - } /* end of C_EXTRACT */ - break; - - case C_LIST: { - struct lumplist *curlump; - int verbose = 0, i = 0; - - /* Parse options: -v */ - while(numparams > 0) { - if(params[0][0] != '-') break; - if(strcmp(params[0], "-v") == 0) verbose = 1; - else { - fprintf(stderr, "%s: no option %s for command %s", - progname, params[0], argv[2]); - return EXIT_FAILURE; - } - params = ¶ms[1]; - numparams--; - } - - /* Loop through the lump list, printing lump info */ - for(curlump = startitem->next; curlump != enditem; curlump = - curlump->next) { - i++; - if(verbose) printf("%5i %-8s %7li\n", i, - get_lump_name(curlump->cl), curlump->cl->len); - else printf("%s\n", get_lump_name(curlump->cl)); - } - } /* end of C_LIST */ - break; - - case C_DELSECT: { - - /* Parse options (none) */ - if(numparams > 1 && params[0][0] == '-') { - fprintf(stderr, "%s: no option %s for command %s", - progname, params[0], argv[2]); - return EXIT_FAILURE; - } - - if(numparams < 1) { - fprintf(stderr, "%s: not enough parameters for %s", progname, - argv[2]); - return EXIT_FAILURE; - } - - /* Delete sections */ - printf("Deleting sections in %s...\n", argv[1]); - for(;;) { - struct lumplist *curlump; - - /* Assume a map name if length > 2 */ - if(strlen(params[0]) > 2) startname = params[0]; - else { - startname = malloc(strlen(params[0]) + 7); - endname = malloc(strlen(params[0]) + 5); - if(startname == NULL || endname == NULL) { - fprintf(stderr, "%s: out of memory\n", progname); - return EXIT_FAILURE; - } - sprintf(startname, "%s_START", params[0]); - sprintf(endname, "%s_END", params[0]); - } - - /* Find startitem and enditem, using startname and endname */ - startitem = find_previous_lump(wfptr->head, NULL, startname); - if(startitem == NULL) { - fprintf(stderr, "%s: can't find lump %s in %s", progname, - startname, argv[1]); - return EXIT_FAILURE; - } - if(endname == NULL && startitem->next != NULL) { - char *itemname; - - enditem = startitem->next; - itemname = get_lump_name(enditem->cl); - do { - enditem = enditem->next; - if(enditem == NULL) break; - free(itemname); - itemname = get_lump_name(enditem->cl); - } while(strcmp(itemname, "THINGS" ) == 0 || - strcmp(itemname, "LINEDEFS") == 0 || - strcmp(itemname, "SIDEDEFS") == 0 || - strcmp(itemname, "VERTEXES") == 0 || - strcmp(itemname, "SEGS" ) == 0 || - strcmp(itemname, "SSECTORS") == 0 || - strcmp(itemname, "NODES" ) == 0 || - strcmp(itemname, "SECTORS" ) == 0 || - strcmp(itemname, "REJECT" ) == 0 || - strcmp(itemname, "BLOCKMAP") == 0); - free(itemname); - } - else { - enditem = find_previous_lump(startitem, NULL, endname); - if(enditem == NULL) { - fprintf(stderr, "%s: can't find lump %s in %s", - progname, endname, argv[1]); - return EXIT_FAILURE; - } - enditem = enditem->next->next; - } /* end of finding startitem and enditem */ - - /* Loop through the section lumps, deleting them */ - curlump = startitem; - while(curlump->next != enditem) - remove_next_lump(wfptr, curlump); - printf("Deleted section %s.\n", params[0]); - - /* Move to next parameter, if it exists */ - numparams--; - if(numparams < 1) break; - params = ¶ms[1]; - } /* end of deleting sections */ - - /* Save the modified wadfile */ - fpoint = fopen(argv[1], "wb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: unable to open file %s for writing\n", - progname, argv[1]); - return EXIT_FAILURE; - } - if(write_wadfile(fpoint, wfptr) != 0) { - fprintf(stderr, "%s: unable to write wadfile to disk\n", - progname); - return EXIT_FAILURE; - } - fclose(fpoint); - printf("File %s successfully updated.\n", argv[1]); - } /* end of C_DELSECT */ - break; - - case C_ADDSECT: { - - /* Parse options (none) */ - if(numparams > 1 && params[0][0] == '-') { - fprintf(stderr, "%s: no option %s for command %s", - progname, params[0], argv[2]); - return EXIT_FAILURE; - } - - if(numparams < 1) { - fprintf(stderr, "%s: not enough parameters for %s", progname, - argv[2]); - return EXIT_FAILURE; - } - - /* Add sections */ - printf("Adding sections in %s...\n", argv[1]); - for(;;) { - struct lumplist *curlump; - - /* Assume a map name if length > 2 */ - if(strlen(params[0]) > 2) startname = params[0]; - else { - startname = malloc(strlen(params[0]) + 7); - endname = malloc(strlen(params[0]) + 5); - if(startname == NULL || endname == NULL) { - fprintf(stderr, "%s: out of memory\n", progname); - return EXIT_FAILURE; - } - sprintf(startname, "%s_START", params[0]); - sprintf(endname, "%s_END", params[0]); - } - - /* Add section, unless it already exists */ - if(find_previous_lump(wfptr->head, NULL, startname) == NULL) { - struct lumplist *last; - - last = find_last_lump(wfptr); - if(add_lump(wfptr, last, startname, 0, NULL) != 0) { - fprintf(stderr, "%s: unable to add lump %s\n", - progname, startname); - return EXIT_FAILURE; - } - - if(endname != NULL) { - last = last->next; - if(add_lump(wfptr, last, endname, 0, NULL) != 0) { - fprintf(stderr, "%s: unable to add lump %s\n", - progname, endname); - return EXIT_FAILURE; - } - } - - printf("Added section %s.\n", params[0]); - } else - printf("Section %s already exists. Taking no action.\n", - params[0]); - - /* Move to next parameter, if it exists */ - numparams--; - if(numparams < 1) break; - params = ¶ms[1]; - } /* end of adding sections */ - - /* Save the modified wadfile */ - fpoint = fopen(argv[1], "wb"); - if(fpoint == NULL) { - fprintf(stderr, "%s: unable to open file %s for writing\n", - progname, argv[1]); - return EXIT_FAILURE; - } - if(write_wadfile(fpoint, wfptr) != 0) { - fprintf(stderr, "%s: unable to write wadfile to disk\n", - progname); - return EXIT_FAILURE; - } - fclose(fpoint); - printf("File %s successfully updated.\n", argv[1]); - } /* end of C_ADDSECT */ - } /* end of command-specific stuff */ - - return EXIT_SUCCESS; -} diff --git a/tools/lumpmod/lumpmod.html b/tools/lumpmod/lumpmod.html deleted file mode 100644 index 082784178..000000000 --- a/tools/lumpmod/lumpmod.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - -LumpMod v0.2.1 Documentation -

LumpMod v0.2.1

-

LumpMod is a small command-line utility for working with lumps in wad -files in the format used by DOOM and DOOM 2. It can add, delete, extract, -rename, list, and update individual lumps. It can also add sections -(XX_START and XX_END, for instance) and delete entire sections.

-

Usage

-

lumpmod [wadfile] [command] [-s section] [parameters]

-

Sections are MAPxx (xx = 01-99, where that map exists in the file), ExMy -(x, y = 1-9, where that map exists in the file), and anything else will be -the section between WHATEVER_START and WHATEVER_END. Sections that do not -exist in the wad file cannot be used. The section part can be left out to -work with the whole file. Any section specified here while using the addsect -or delsect commands will cause an error.

-

Note that the []... parameters in the command listings can be repeated. -For example, you can use lumpmod clowns.wad add CLOWNS clowns.lmp to -add a CLOWNS lump, or lumpmod clowns.wad add CLOWN1 clown1.lmp CLOWN2 -clown2.lmp to add two clown-related lumps.

-

Note also that lump names and commands are case sensitive. There is an -update command, but no UPDATE command.

-

Commands

-

add [-a lumpname] [-b] [-d] [-n] [LUMPNAME FILENAME]...

-

Add a lump to the end of the wad, or after the lump specified with the -a -option. If the lump already exists, it will be overwritten (with its position -unchanged) unless the -n option is specified, in which case no action will be -taken, or the -d option is specified, in which case an additional lump with -the same name will be added. If the lump specified in the -a option does not -exist, an error will occur. The -b option will add the lump at the beginning, -overriding the -a option.

-

addsect [SECTNAME]...

-

Add a section. The name must be one or two characters long. If section -name is HX, zero-length entries HX_START and HX_END will be added to the end -of the wad file. If this section already exists, no action will be taken.

-

delete [LUMPNAME]...

-

Remove LUMPNAME from the wad.

-

delsect [SECTNAME]...

-

Delete a section and anything inside it. If the section doesn't exist, no -action will be taken.

-

extract [LUMPNAME FILENAME]...

-

Save the contents of LUMPNAME to the file named FILENAME. (Wad file will -not be changed in any way.)

-

list [-v]

-

List all lumps in the wad, in the order they appear in the directory. -With the -v option, include numbers and lump lengths.

-

rename [OLDNAME NEWNAME]...

-

Rename a lump in the wad.

-

update [LUMPNAME FILENAME]...

-

Update LUMPNAME with the contents of FILENAME. If no lump named LUMPNAME -exists in the wad, no action will be taken.

-

Changes

-

Version 0.2.1 adds the -d option to the add command.

-

Version 0.2 contains a fix to a bug involving empty sections. The initial -public release was version 0.1.

-

Bugs

-

LumpMod currently chokes on completely empty wad files (i.e., those that -contain absolutely no lumps). Let me know if you find any other bugs.

-

Author

-

Catatonic Porpoise, <graue@oceanbase.org>. -Updates can be found at http://www.thunderpalace.com/software/.

-

Thanks

-

Thanks to Matthew S. Fell for writing "The Unofficial DOOM -Specs," which were very helpful in making this program.

-

License

-

Copyright © 2003 Thunder Palace Entertainment.

-

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.

-

You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

-